hexsha
stringlengths
40
40
size
int64
19
11.4M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
270
max_stars_repo_name
stringlengths
5
110
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
270
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
270
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
19
11.4M
avg_line_length
float64
1.93
229k
max_line_length
int64
12
688k
alphanum_fraction
float64
0.07
0.99
matches
listlengths
1
10
5b080fa1de0ef65d67a5839f7e53e4870f7d029d
1,225
cpp
C++
source/plc/src/plange.cpp
dlin172/Plange
4b36a1225b2263bc8d38a6d1cc9b50c3d4b58e04
[ "BSD-3-Clause" ]
null
null
null
source/plc/src/plange.cpp
dlin172/Plange
4b36a1225b2263bc8d38a6d1cc9b50c3d4b58e04
[ "BSD-3-Clause" ]
null
null
null
source/plc/src/plange.cpp
dlin172/Plange
4b36a1225b2263bc8d38a6d1cc9b50c3d4b58e04
[ "BSD-3-Clause" ]
null
null
null
#include "plange.hpp" plange::plange() { } plange::~plange() { } bool plange::is_Collection(const Expression& v) { ERROR(NotImplemented, __FUNCTION__); } bool plange::is_Integral(const Expression& v) { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Float() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Float16() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Float32() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Float64() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Float128() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Int() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Int8() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Int16() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Int32() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Int64() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Int128() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_Real() { ERROR(NotImplemented, __FUNCTION__); } value& plange::get_global(std::vector<std::u32string> qualifiers, std::u32string name) { ERROR(NotImplemented, __FUNCTION__); }
14.08046
86
0.730612
[ "vector" ]
5b0883a9a0d3200076714dd0c89299ecd095806d
6,581
cpp
C++
lib/benchmark/dataset_operations_benchmark.cpp
nvaytet/scipp
f14f56ed19cccb4162d55b1123df7225eeedb395
[ "BSD-3-Clause" ]
43
2019-04-08T14:13:11.000Z
2022-02-08T06:09:35.000Z
lib/benchmark/dataset_operations_benchmark.cpp
nvaytet/scipp
f14f56ed19cccb4162d55b1123df7225eeedb395
[ "BSD-3-Clause" ]
1,342
2019-03-30T07:06:08.000Z
2022-03-28T13:12:47.000Z
lib/benchmark/dataset_operations_benchmark.cpp
nvaytet/scipp
f14f56ed19cccb4162d55b1123df7225eeedb395
[ "BSD-3-Clause" ]
12
2019-06-13T08:56:12.000Z
2021-11-04T08:24:18.000Z
// SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2021 Scipp contributors (https://github.com/scipp) /// @file #include <benchmark/benchmark.h> #include <numeric> #include "common.h" #include "scipp/dataset/dataset.h" #include "scipp/dataset/reduction.h" using namespace scipp; using namespace scipp::core; std::vector<bool> make_bools(const scipp::index size, std::initializer_list<bool> pattern) { std::vector<bool> result(size); auto it = pattern.begin(); for (auto &&itm : result) { if (it == pattern.end()) it = pattern.begin(); itm = *(it++); } return result; } std::vector<bool> make_bools(const scipp::index size, bool pattern) { return make_bools(size, std::initializer_list<bool>{pattern}); } template <typename DType> Variable makeData(const Dimensions &dims) { std::vector<DType> data(dims.volume()); std::iota(data.begin(), data.end(), static_cast<DType>(0)); return makeVariable<DType>(Dimensions(dims), Values(data.begin(), data.end())); } struct Generate { Dataset operator()(const int axisLength, const int num_masks = 0) { Dataset d; d.setData("a", makeData<double>({Dim::X, axisLength})); for (int i = 0; i < num_masks; ++i) { auto bools = make_bools(axisLength, {false, true}); d["a"].masks().set( std::string(1, ('a' + i)), makeVariable<bool>(Dims{Dim::X}, Shape{axisLength}, Values(bools.begin(), bools.end()))); } return d; } }; struct Generate_2D_data { Dataset operator()(const int axisLength, const int num_masks = 0) { Dataset d; d.setData("a", makeData<double>({{Dim::X, axisLength}, {Dim::Y, axisLength}})); auto bools = make_bools(axisLength * axisLength, {false, true}); for (int i = 0; i < num_masks; ++i) { d["a"].masks().set( std::string(1, ('a' + i)), makeVariable<bool>(Dims{Dim::X, Dim::Y}, Shape{axisLength, axisLength}, Values(bools.begin(), bools.end()))); } return d; } }; struct Generate_3D_data { Dataset operator()(const int axisLength, const int num_masks = 0) { Dataset d; d.setData("a", makeData<double>({{Dim::X, axisLength}, {Dim::Y, axisLength}, {Dim::Z, axisLength}})); auto bools = make_bools(axisLength * axisLength * axisLength, {false, true}); for (int i = 0; i < num_masks; ++i) { d["a"].masks().set( std::string(1, ('a' + i)), makeVariable<bool>(Dims{Dim::X, Dim::Y, Dim::Z}, Shape{axisLength, axisLength, axisLength}, Values(bools.begin(), bools.end()))); } return d; } }; template <class Gen> static void BM_Dataset_sum(benchmark::State &state) { const auto itemCount = state.range(0); const auto maskCount = state.range(1); const auto d = Gen()(itemCount, maskCount); for (auto _ : state) { const auto result = sum(d, Dim::X); benchmark::DoNotOptimize(result); benchmark::ClobberMemory(); } } // ------------------------------------------------- // No masks // ------------------------------------------------- BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {0, 0}}); BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {2 << 12, 2 << 15}, /* Masks count */ {0, 0}}); BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate_2D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {0, 0}}); BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate_3D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {16, 128}, /* Masks count */ {0, 0}}); // ------------------------------------------------- // With Masks // ------------------------------------------------- BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {1, 8}}); BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {2 << 12, 2 << 15}, /* Masks count */ {1, 2}}); BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate_2D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {1, 8}}); BENCHMARK_TEMPLATE(BM_Dataset_sum, Generate_3D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {16, 128}, /* Masks count */ {1, 8}}); template <class Gen> static void BM_Dataset_mean(benchmark::State &state) { const auto itemCount = state.range(0); const auto d = Gen()(itemCount); for (auto _ : state) { const auto result = mean(d, Dim::X); benchmark::DoNotOptimize(result); benchmark::ClobberMemory(); } } // ------------------------------------------------- // No masks // ------------------------------------------------- BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {0, 0}}); BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {2 << 12, 2 << 15}, /* Masks count */ {0, 0}}); BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate_2D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {0, 0}}); BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate_3D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {16, 128}, /* Masks count */ {0, 0}}); // ------------------------------------------------- // With Masks // ------------------------------------------------- BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {1, 8}}); BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate) ->RangeMultiplier(2) ->Ranges({/* Item count */ {2 << 12, 2 << 15}, /* Masks count */ {1, 2}}); BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate_2D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {256, 2048}, /* Masks count */ {1, 8}}); BENCHMARK_TEMPLATE(BM_Dataset_mean, Generate_3D_data) ->RangeMultiplier(2) ->Ranges({/* Item count */ {16, 128}, /* Masks count */ {1, 8}}); BENCHMARK_MAIN();
32.579208
78
0.544294
[ "shape", "vector" ]
5b0a64def22255d2277fd6937b8525490faad44b
2,800
inl
C++
headers/Impl/FilterWriter.inl
SunYe1234/PDFNetNew
110af493387b866e765e877c8cacae72bafc4cf8
[ "Apache-2.0" ]
null
null
null
headers/Impl/FilterWriter.inl
SunYe1234/PDFNetNew
110af493387b866e765e877c8cacae72bafc4cf8
[ "Apache-2.0" ]
null
null
null
headers/Impl/FilterWriter.inl
SunYe1234/PDFNetNew
110af493387b866e765e877c8cacae72bafc4cf8
[ "Apache-2.0" ]
null
null
null
inline FilterWriter::FilterWriter () { REX(TRN_FilterWriterCreate(0, &m_impl)); } inline FilterWriter::FilterWriter (Filter& filter) { REX(TRN_FilterWriterCreate(filter.m_impl, &m_impl)); } inline FilterWriter::~FilterWriter () { DREX(m_impl, TRN_FilterWriterDestroy(m_impl)); } inline void FilterWriter::WriteUChar(UChar ch) { REX(TRN_FilterWriterWriteUChar(m_impl,ch)); } inline void FilterWriter::WriteInt(Int16 num) { REX(TRN_FilterWriterWriteInt16(m_impl,num)); } inline void FilterWriter::WriteInt(UInt16 num) { REX(TRN_FilterWriterWriteUInt16(m_impl,num)); } inline void FilterWriter::WriteInt(Int32 num) { REX(TRN_FilterWriterWriteInt32(m_impl,num)); } inline void FilterWriter::WriteInt(UInt32 num) { REX(TRN_FilterWriterWriteUInt32(m_impl,num)); } inline void FilterWriter::WriteInt(Int64 num) { REX(TRN_FilterWriterWriteInt64(m_impl,num)); } inline void FilterWriter::WriteInt(UInt64 num) { REX(TRN_FilterWriterWriteUInt64(m_impl,num)); } inline void FilterWriter::WriteString(const std::string& str) { REX(TRN_FilterWriterWriteString(m_impl,str.c_str())); } inline void FilterWriter::WriteString(const char* str) { REX(TRN_FilterWriterWriteString(m_impl,str)); } inline void FilterWriter::WriteFilter(FilterReader& reader) { REX(TRN_FilterWriterWriteFilter(m_impl,reader.m_impl)); } inline void FilterWriter::WriteLine(const char* line, char eol) { REX(TRN_FilterWriterWriteLine(m_impl,line,eol)); } inline size_t FilterWriter::WriteBuffer(std::vector<unsigned char> buf) { size_t result; REX(TRN_FilterWriterWriteBuffer(m_impl,(const char*)&(buf[0]),buf.size(),&result)); return result; } #ifndef SWIG inline size_t FilterWriter::WriteBuffer(const char* buf, size_t buf_size) { size_t result; REX(TRN_FilterWriterWriteBuffer(m_impl,buf,buf_size,&result)); return result; } #endif inline void FilterWriter::AttachFilter(Filter& filter) { REX(TRN_FilterWriterAttachFilter(m_impl,filter.m_impl)); } inline Filter FilterWriter::GetAttachedFilter() { TRN_Filter result; REX(TRN_FilterWriterGetAttachedFilter(m_impl,&result)); return Filter(result,false); } inline void FilterWriter::Seek(ptrdiff_t offset, Filter::ReferencePos origin) { REX(TRN_FilterWriterSeek(m_impl,offset,(enum TRN_FilterReferencePos)origin)); } inline ptrdiff_t FilterWriter::Tell () { ptrdiff_t result; REX(TRN_FilterWriterTell(m_impl,&result)); return result; } inline size_t FilterWriter::Count () { size_t result; REX(TRN_FilterWriterCount(m_impl,&result)); return result; } inline void FilterWriter::Flush () { REX(TRN_FilterWriterFlush(m_impl)); } inline void FilterWriter::FlushAll () { REX(TRN_FilterWriterFlushAll(m_impl)); }
21.705426
85
0.742143
[ "vector" ]
5b0a82f7c98fd6211937d69919b911bef3b20b27
9,570
hpp
C++
dd-httpd/HttpServer.hpp
WindSnowLi/dd-httpd
8b979f0a15946f4e869d088327b12eb330f9ea80
[ "MIT" ]
null
null
null
dd-httpd/HttpServer.hpp
WindSnowLi/dd-httpd
8b979f0a15946f4e869d088327b12eb330f9ea80
[ "MIT" ]
1
2022-03-24T07:10:10.000Z
2022-03-25T06:14:35.000Z
dd-httpd/HttpServer.hpp
WindSnowLi/dd-httpd
8b979f0a15946f4e869d088327b12eb330f9ea80
[ "MIT" ]
null
null
null
#pragma once #include <unordered_map> #include <functional> #include <string> #include <memory> #include <sstream> #include <string_view> #include <utility> #include "HttpRequest.hpp" #include "HttpResponse.hpp" #include "RequestMethod.hpp" #include "HttpRegisterInterceptor.hpp" #include "HttpRegisterServer.hpp" #include "Utils.hpp" #include "ThreadPool.hpp" /** * @brief 基础服务部分 * */ class HttpServer { public: /** * @brief 线程池 * */ std::shared_ptr<ThreadPool> threadPool; /** * @brief Http拦截器注册器 * */ std::shared_ptr<HttpRegisterInterceptor> httpRegisterInterceptor; /** * @brief Http服务注册器 * */ std::shared_ptr<HttpRegisterServer> httpRegisterServer; protected: /** * @brief * * @param client 网络适配器 * @return std::shared_ptr<HttpRequest> */ static std::shared_ptr<HttpRequest> Parse(const std::shared_ptr<NetworkAdapter> &client) { auto &&rs = client->Read(); if (!std::get<1>(rs)) { return nullptr; } std::stringstream &ss = std::get<0>(rs); std::string line{}; getline(ss, line); std::shared_ptr<HttpRequest> request = [&]() { auto r = std::make_shared<HttpRequest>(); std::string_view sv1(line); size_t first = sv1.find(' '); r->SetRequestMethod(StrToEnum(std::string(sv1.substr(0, first)))); std::string_view sv2(line.c_str() + first + 1); size_t second = sv2.find(' '); r->SetUrl(std::string(StrUtils::Split(std::string(sv2.substr(0, second)), '#')[0])); std::string_view sv3(line.c_str() + first + 1 + second + 1); r->SetProtocol(std::string(sv3.substr(0))); return r; }(); size_t methodIndex = request->GetUrl().find('?'); if (methodIndex != -1) { std::vector<std::string_view> &&params = StrUtils::Split({request->GetUrl().c_str() + methodIndex + 1}, '&'); request->SetParams(StrUtils::PropertyParse(params)); } getline(ss, line); while (!line.empty() && line[0] != '\r') { size_t split = line.find(':'); std::string key = line.substr(0, split); StrUtils::ToLowCase(key); request->AddHeader(key, line.substr(split + 1)); line.clear(); getline(ss, line); } std::string body{}; while (!ss.eof()) { getline(ss, line); body += line; } request->SetBody(body); return request; } /** * @brief 应答数据 * * @param client 网络适配器 * @param response 应答体 */ static bool Response(const std::shared_ptr<NetworkAdapter> &client, const std::shared_ptr<HttpRequest> &request, const std::shared_ptr<HttpResponse> &response) { if (request->GetHeader().count(CONNECTION) == 1) { response->GetHeader()[CONNECTION] = request->GetHeader()[CONNECTION]; } else { response->GetHeader()[CONNECTION] = CLOSE; } request->GetPartTable().empty() ? ResponseSimple(client, request, response) : ResponseRanges(client, request, response); return response->GetHeader()[CONNECTION] == KEEP_ALIVE; } static void ResponseRanges(const std::shared_ptr<NetworkAdapter> &client, const std::shared_ptr<HttpRequest> &request, const std::shared_ptr<HttpResponse> &response) { size_t fileLength = response->GetLength(); if (request->GetPartTable().size() < 2) { auto &part = const_cast<std::pair<long long, long long> &>(request->GetPartTable().front()); if (part.second >= fileLength || part.first >= part.second) { response->SetCode(PARTIAL_CONTENT_CODE); response->SetLength(0); } else { size_t sendLength = part.second - part.first; std::string contentRange = BYTES; contentRange = contentRange + " " + std::to_string(part.first) + "-" + std::to_string(part.second) + "/" + std::to_string(fileLength); response->SetLength(sendLength); response->GetHeader()[CONTENT_RANGE] = contentRange; } client->Write(response->GetHeadStream()); if (request->GetRequestMethod() != RequestMethod::HEAD) { client->Write(response->GetFp(), part.first, part.second); } return; } ResponseMultipartRanges(client, request, response); } static void ResponseMultipartRanges(const std::shared_ptr<NetworkAdapter> &client, const std::shared_ptr<HttpRequest> &request, const std::shared_ptr<HttpResponse> &response) { size_t fileLength = response->GetLength(); std::string oldContentType = response->GetHeader()[CONTENT_TYPE]; std::string boundary = "--"; boundary += StrUtils::GetRandStr(26); response->GetHeader()[CONTENT_TYPE] = std::string(MULTIPART_BYTERANGES) + ";boundary=" + boundary; response->SetCode(PARTIAL_CONTENT_CODE); auto &partTable = const_cast<std::vector<std::pair<long long, long long>> &>(request->GetPartTable()); std::vector<std::vector<std::pair<std::string, std::string>>> partHeaders; std::string contentRange; size_t sendLength = 0; for (auto &&i : partTable) { size_t l = i.second - i.first; if (i.second >= fileLength || i.first >= i.second) { l = 0; } sendLength += l; contentRange = std::to_string(i.first) + "-" + std::to_string(i.second) + "/" + std::to_string(fileLength); partHeaders.emplace_back(); partHeaders.back().push_back(std::make_pair(CONTENT_TYPE, oldContentType)); partHeaders.back().push_back(std::make_pair(CONTENT_RANGE, contentRange)); } for_each(partHeaders.begin(), partHeaders.end(), [&](std::vector<std::pair<std::string, std::string>> &i) { // 分割换行、空行、数据换行 sendLength += (boundary + "\r\n\r\n\r\n").size(); for_each(i.begin(), i.end(), [&](std::pair<std::string, std::string> &j) { sendLength += j.first.size() + std::string(":").size() + j.second.size() + std::string("\r\n").size(); }); }); sendLength += (boundary + "--").size(); response->SetLength(sendLength); client->Write(response->GetHeadStream()); if (request->GetRequestMethod() == RequestMethod::HEAD) { return; } for (size_t i = 0; i < partTable.size(); i++) { std::stringstream sH; sH << boundary << "\r\n"; for (auto &&j : partHeaders[i]) { sH << j.first << ":" << j.second << "\r\n"; } sH << "\r\n"; client->Write(sH); client->Write(response->GetFp(), partTable[i].first, partTable[i].second); sH.str(""); auto a = sH.str(); sH << "\r\n"; client->Write(sH); } std::stringstream tail; tail << boundary << "--"; client->Write(tail); } static void ResponseSimple(const std::shared_ptr<NetworkAdapter> &client, const std::shared_ptr<HttpRequest> &request, const std::shared_ptr<HttpResponse> &response) { client->Write(response->GetHeadStream()); if (request->GetRequestMethod() == RequestMethod::HEAD) { return; } if (response->GetFp().is_open()) { client->Write(response->GetFp()); } else { client->Write(std::stringstream(response->GetBody())); } } public: /** * @brief 开始执行Http交互 * * @param client 网络适配器 */ void AcceptHttp(std::shared_ptr<NetworkAdapter> client) { threadPool->AddTask( [hi = httpRegisterInterceptor, s = httpRegisterServer, c = client]() { while (true) { auto request = Parse(c); if (nullptr == request) { break; } std::shared_ptr<HttpResponse> response = std::make_shared<HttpResponse>(); // 验证前置拦截器 if ((hi == nullptr || hi->VerifyBefore(request, response))) { // 映射请求 s == nullptr || s->MapRequest(request, response); // 验证后置拦截器 if (hi != nullptr && !hi->VerifyAfter(request, response)) { response->SetCode(FORBIDDEN); } } else { response->SetCode(FORBIDDEN); } if (!Response(c, request, response)) { break; } } }); } };
38.12749
118
0.504911
[ "vector" ]
5b0e9a7c5e4e4d65e7ae6f7fb7010ec3c8f3f519
20,260
cpp
C++
applications/DG-Max/Programs/DGMaxEigen.cpp
hpgem/hpgem
b2f7ac6bdef3262af0c3e8559cb991357a96457f
[ "BSD-3-Clause-Clear" ]
5
2020-04-01T15:35:26.000Z
2022-02-22T02:48:12.000Z
applications/DG-Max/Programs/DGMaxEigen.cpp
hpgem/hpgem
b2f7ac6bdef3262af0c3e8559cb991357a96457f
[ "BSD-3-Clause-Clear" ]
139
2020-01-06T12:42:24.000Z
2022-03-10T20:58:14.000Z
applications/DG-Max/Programs/DGMaxEigen.cpp
hpgem/hpgem
b2f7ac6bdef3262af0c3e8559cb991357a96457f
[ "BSD-3-Clause-Clear" ]
4
2020-04-10T09:19:33.000Z
2021-08-21T07:20:42.000Z
#include <exception> #include "Base/CommandLineOptions.h" #include "Base/MeshFileInformation.h" #include "Output/VTKSpecificTimeWriter.h" #include "DGMaxLogger.h" #include "DGMaxProgramUtils.h" #include "Algorithms/DivDGMaxEigenvalue.h" #include "Algorithms/DGMaxEigenvalue.h" #include "Utils/KSpacePath.h" #include "Utils/StructureDescription.h" #include "Utils/PredefinedStructure.h" using namespace hpgem; // File name of the mesh file, e.g. -m mesh.hpgem auto& meshFile = Base::register_argument<std::string>( 'm', "meshFile", "The hpgem meshfile to use", true); // Polynomial order of the basis functions, e.g. -p 2 auto& order = Base::register_argument<std::size_t>( 'p', "order", "Polynomial order of the solution", true); // Number of eigenvalues to compute, e.g. -e 40 auto& numEigenvalues = Base::register_argument<std::size_t>( 'e', "eigenvalues", "The number of eigenvalues to compute", false, 24); auto& method = Base::register_argument<std::string>( '\0', "method", "The method to be used, either 'DGMAX', 'DGMAX_PROJECT' or 'DIVDGMAX' " "(default)", false, "DIVDGMAX"); // Compute a single point --point 1,0.5,0 or a path of points // [steps@]0,0:1,0:1,1 // Which corresponds to the point pi, 0.5pi, 0 in k-space and a path from 0,0 // via pi,0 to pi,pi in kspace taking each time "steps" steps, for each line, // (excluding first point, including last). // Untested with anything else than 0.0 as the first point of a path auto& pointMode = Base::register_argument<std::string>( '\0', "points", "Compute a single point in or a set of lines through k-space", false); // Number of steps to take in the k-space walk along the cube edge // e.g. --steps 20 auto& steps = Base::register_argument<std::size_t>( '\0', "steps", "Steps for the k-space walk", false, 10); // Penalty parameter, e.g. -a b5b0b5 auto& pparams = Base::register_argument<std::string>( 'a', "penalty", "Penalty parameters and fluxes to use, e.g. b5b0b5.0\n" "\t The letters are for the flux types and can be either b (Brezzi) " "or i (Interior penalty). The numbers are for the three penalty values.", false); // Dimension, e.g. -d 2 auto& d = Base::register_argument<std::size_t>( 'd', "dimension", "(deprecated) The dimension of the problem", false); // Either a number for the predefined structures or a filename for zone based // structure. See DGMax::determineStructureDescription for the exact format. auto& structure = Base::register_argument<std::string>( '\0', "structure", "Structure to use", false, "0"); // auto& fieldDir = Base::register_argument<std::string>( '\0', "fields", "Existing directory to output the fields to.", false, ""); // A natural mesh would be one where the unit cell in the mesh has a lattice // constant of '1' in mesh coordinates. However, it may be more convenient to // create a mesh at a different length scale. This option may be used to // indicate and compensate for this difference in scale. Specifically: // 1. The k-vectors are multiplied by 1/lengthscale // 2. The resulting frequencies are multiplied by lengthscale auto& lengthScale = Base::register_argument<double>( '\0', "lengthscale", "Length scale of the mesh", false, 1.0); template <std::size_t DIM> void runWithDimension(); double parseDGMaxPenaltyParameter(); DivDGMaxDiscretizationBase::Stab parsePenaltyParmaters(); template <std::size_t DIM> KSpacePath<DIM> parsePath(); /// Write out a visualization file for the mesh, including the material /// parameter (epsilon) /// /// \tparam DIM The dimension of the mesh /// \param fileName File name (without extension) for the mesh file /// \param mesh Pointer to the mesh. template <std::size_t DIM> void writeMesh(std::string fileName, const Base::MeshManipulator<DIM>* mesh); int main(int argc, char** argv) { Base::parse_options(argc, argv); initDGMaxLogging(); DGMax::printArguments(argc, argv); time_t start, end; time(&start); const Base::MeshFileInformation info = Base::MeshFileInformation::readInformation(meshFile.getValue()); const std::size_t dimension = info.dimension; // Check legacy dimension argument if (d.isUsed()) { logger.assert_always( d.getValue() == dimension, "Explicit dimension specified that does not match file contents"); } try { switch (dimension) { case 2: runWithDimension<2>(); break; case 3: runWithDimension<3>(); break; default: logger.assert_always(false, "Invalid dimension %", dimension); } } catch (const std::exception& e) { DGMaxLogger(ERROR, e.what()); exit(2); } catch (const char* message) { DGMaxLogger(ERROR, message); exit(1); } time(&end); DGMaxLogger(INFO, "Runtime %s", end - start); return 0; } template <std::size_t DIM> class DGMaxEigenDriver : public AbstractEigenvalueSolverDriver<DIM> { public: DGMaxEigenDriver(KSpacePath<DIM>& path, std::size_t targetNumberOfEigenvalues) : targetNumberOfEigenvalues_(targetNumberOfEigenvalues), currentPoint_(0), path_(path), frequencyResults_(path.totalNumberOfSteps()) { // Only one processor should write to the file Base::MPIContainer::Instance().onlyOnOneProcessor({[&]() { outFile.open("frequencies.csv"); logger.assert_always(!outFile.fail(), "Output file opening failed"); writeHeader(outFile, ','); }}); } ~DGMaxEigenDriver() override { if (outFile.is_open()) { outFile.close(); } } bool stop() const final { return currentPoint_ >= path_.totalNumberOfSteps(); } void nextKPoint() final { ++currentPoint_; } LinearAlgebra::SmallVector<DIM> getCurrentKPoint() const final { logger.assert_debug(currentPoint_ < path_.totalNumberOfSteps(), "Too large k-point index"); return path_.k(currentPoint_); } std::size_t getNumberOfKPoints() const final { return path_.totalNumberOfSteps(); } std::size_t getTargetNumberOfEigenvalues() const final { return targetNumberOfEigenvalues_; } void handleResult(AbstractEigenvalueResult<DIM>& result) final { frequencyResults_[currentPoint_] = result.getFrequencies(); Base::MPIContainer::Instance().onlyOnOneProcessor({[&]() { writeFrequencies(outFile, currentPoint_, frequencyResults_[currentPoint_], ','); }}); if (fieldDir.isUsed()) { DGMaxLogger(INFO, "Writing field paterns"); for (std::size_t i = 0; i < frequencyResults_[currentPoint_].size(); ++i) { std::stringstream outFile; // Note: Assumes the field directory is present if (fieldDir.hasArgument()) { outFile << fieldDir.getValue() << "/"; } outFile << "eigenfield-" << currentPoint_ << "-field-" << i; // Note the zero for timelevel is unused. Output::VTKSpecificTimeWriter<DIM> writer( outFile.str(), result.getMesh(), 0, order.getValue()); result.writeField(i, writer); } } writeOverlapIntegrals(result); } void printFrequencies() { writeHeader(std::cout, '\t'); for (std::size_t i = 0; i < frequencyResults_.size(); ++i) { writeFrequencies(std::cout, i, frequencyResults_[i], '\t'); } } private: std::size_t targetNumberOfEigenvalues_; std::size_t currentPoint_; KSpacePath<DIM> path_; std::vector<std::vector<double>> frequencyResults_; std::ofstream outFile; void writeHeader(std::ostream& stream, char separator) { // Mostly matching MPB // clang-format off stream << "freqs:" << separator << "k index" << separator << "kx/2pi" << separator << "ky/2pi" << separator << "kz/2pi" << separator << "kmag/2pi"; // clang-format on // Add headers for the number of expected bands. The actual number may // be higher. for (std::size_t i = 0; i < targetNumberOfEigenvalues_; ++i) { stream << separator << "band " << i; } stream << std::endl; } void writeFrequencies(std::ostream& stream, std::size_t point, std::vector<double>& frequencies, char separator) { auto k = path_.k(point); // Undo rescaling k *= lengthScale.getValue(); // MPB like prefix. Importantly, we don't have a reciprocal lattice // defined so we output the kx-kz instead of k1-k3. // clang-format off stream << "freqs:" << separator << point + 1 //MPB uses 1 indexing << separator << k[0] / (2*M_PI) << separator << k[1] / (2*M_PI) << separator << (DIM == 3 ? k[2] / (2*M_PI) : 0) << separator << k.l2Norm() / (2*M_PI); // clang-format on for (double frequency : frequencies) { // By convention the frequency is reported in units of // 2pi c/a, with c the speed of light and 'a' the lattice constant // (or similarly predefined length). For the computation we assume // c=1, and assume the length scale a matches that of the mesh. Thus // the distance between x=0 and x=1 is assumed to be 'a'. stream << separator << frequency / (2 * M_PI) * lengthScale.getValue(); } stream << std::endl; } void writeOverlapIntegrals(AbstractEigenvalueResult<DIM>& result) const { if (currentPoint_ == 0) { // No previous point return; } DGMaxLogger(INFO, "Writing overlap integrals"); // Compute overlap integrals -> Needs all processors LinearAlgebra::MiddleSizeMatrix overlapIntegrals = result.computeFieldOverlap(); Base::MPIContainer::Instance().onlyOnOneProcessor({[&]() { std::stringstream fileName; fileName << "overlap-" << currentPoint_ << ".csv"; std::ofstream overlapFile(fileName.str()); // Write header overlapFile << "Mode"; for (std::size_t j = 0; j < overlapIntegrals.getNumberOfColumns(); ++j) { std::stringstream header; overlapFile << "," << "Prev" << j; } overlapFile << std::endl; for (std::size_t i = 0; i < overlapIntegrals.getNumberOfRows(); ++i) { overlapFile << "New" << i; for (std::size_t j = 0; j < overlapIntegrals.getNumberOfColumns(); ++j) { overlapFile << "," << std::real(overlapIntegrals(i, j)) << "+" << std::imag(overlapIntegrals(i, j)) << "i"; } overlapFile << std::endl; } }}); } }; template <std::size_t DIM> void runWithDimension() { bool useDivDGMax = true; DGMaxEigenvalueBase::ProjectorUse useProjector = DGMaxEigenvalueBase::NONE; std::size_t numberOfElementMatrices = 2; std::size_t unknowns = 0; // 2 unknowns, 1 time level if (method.getValue() == "DGMAX") { useDivDGMax = false; unknowns = 1; } else if (method.getValue() == "DGMAX_PROJECT" || method.getValue() == "DGMAX_PROJECT1") { useDivDGMax = false; useProjector = method.getValue() == "DGMAX_PROJECT" ? DGMaxEigenvalueBase::ALL : DGMaxEigenvalueBase::INITIAL; unknowns = 2; // 1 more is needed for the projector operator numberOfElementMatrices = 3; } else if (method.getValue() == "DIVDGMAX") { useDivDGMax = true; unknowns = 2; } else { logger(ERROR, "Invalid method {}, should be either DGMAX, DGMAX_PROJECT, " "DGMAX_PROJECT1 or DIVDGMAX", method.getValue()); return; } Base::ConfigurationData configData(unknowns, 1); std::unique_ptr<DGMax::StructureDescription> structureDesc = DGMax::determineStructureDescription(structure.getValue(), DIM); auto mesh = DGMax::readMesh<DIM>(meshFile.getValue(), &configData, *structureDesc, numberOfElementMatrices); logger(INFO, "Loaded mesh % with % local elements", meshFile.getValue(), mesh->getNumberOfElements()); writeMesh<DIM>("mesh", mesh.get()); // TODO: Parameterize KSpacePath<DIM> path = parsePath<DIM>(); DGMaxEigenDriver<DIM> driver(path, numEigenvalues.getValue()); // Method dependent solving if (useDivDGMax) { DivDGMaxDiscretizationBase::Stab stab = parsePenaltyParmaters(); DivDGMaxEigenvalue<DIM> solver(*mesh, order.getValue(), stab); solver.solve(driver); } else { const double stab = parseDGMaxPenaltyParameter(); DGMaxEigenvalueBase::SolverConfig config; config.stab_ = stab; config.useHermitian_ = true; config.shiftFactor_ = 0; config.useProjector_ = useProjector; DGMaxEigenvalue<DIM> solver(*mesh, order.getValue(), config); solver.solve(driver); } Base::MPIContainer::Instance().onlyOnOneProcessor( {[&]() { driver.printFrequencies(); }}); } /// Parse DIM comma separated numbers as the coordinates of a point. /// \tparam DIM The dimension of the point /// \param pointString The string containing the point coordinates /// \param start The starting index in pointString /// \param point The point (out) /// \return The first index in pointString after the number. template <std::size_t DIM> std::size_t parsePoint(const std::string& pointString, std::size_t start, LinearAlgebra::SmallVector<DIM>& point) { for (std::size_t i = 0; i < DIM; ++i) { if (start >= pointString.size()) { throw std::invalid_argument( "Not enough coordinates for a reciprocal point"); } std::size_t len = 0; point[i] = std::stod(pointString.substr(start), &len); if (len == 0) { throw std::invalid_argument("No value parsed"); } start += len; if (i < DIM - 1) { // Skip the comma, space, whatever that ended the point start++; } } return start; } template <std::size_t DIM> KSpacePath<DIM> parsePath() { if (pointMode.isUsed()) { DGMax::PointPath<DIM> path = DGMax::parsePath<DIM>(pointMode.getValue()); // Compensate for factor of pi in the reciprocal lattice for (std::size_t i = 0; i < path.points_.size(); ++i) { path.points_[i] *= M_PI / lengthScale.getValue(); } // Default steps to 1. if (path.steps_ < 0) { path.steps_ = 1; } return KSpacePath<DIM>(path.points_, (std::size_t)path.steps_); } if (!steps.isUsed()) { logger(INFO, "Using default number of steps %", steps.getValue()); } return KSpacePath<DIM>::cubePath(steps.getValue(), false); } double parseDGMaxPenaltyParameter() { if (pparams.isUsed()) { std::size_t idx; try { double value = std::stod(pparams.getValue(), &idx); if (idx != pparams.getValue().size()) { throw std::invalid_argument( "Invalid stabilization parameter, should be a single " "number for DGMAX"); } return value; } catch (const std::invalid_argument&) { throw std::invalid_argument( "Invalid stabilization parameter, should be a single number " "for DGMAX"); } } else { // Default return 100; } } DivDGMaxDiscretizationBase::Stab parsePenaltyParmaters() { if (pparams.isUsed()) { DivDGMaxDiscretizationBase::Stab stab; std::string input = pparams.getValue(); std::vector<bool> useBrezzi; std::vector<double> values; std::size_t index = 0; bool error = false; // Only need three parameters while (input.size() > index && !error && useBrezzi.size() < 3) { // Parse the flux type char fluxType = input[index++]; if (fluxType == 'b') useBrezzi.emplace_back(true); else if (fluxType == 'i') useBrezzi.emplace_back(false); else { DGMaxLogger(ERROR, "Unknown flux type %", fluxType); error = true; break; } // Find the numeric digits std::size_t startIndex = index; while (input.size() > index) { char c = input[index]; if (std::isdigit(c) || c == '.' || c == '-' || c == 'e') { index++; } else { // Not a valid part of the number break; } } // Parse the number (if present) if (index != startIndex) { // There is some numeric content double value = std::stod(input.substr(startIndex, index - startIndex)); values.emplace_back(value); } else if (index == input.size()) { DGMaxLogger(ERROR, "Not enough input for the stabilization parameter"); error = true; } else { DGMaxLogger( ERROR, "No number at position % of the stabilization parameters", index); error = true; } } // Check the validity of the result if (!error && useBrezzi.size() < 3) { DGMaxLogger(ERROR, "Not enough stabilization parameters only parsed %", useBrezzi.size()); error = true; } if (!error && index != input.size()) { DGMaxLogger(ERROR, "Unconsumed stabilization parameter input at %", index); error = true; } if (!error) { DivDGMaxDiscretizationBase::Stab result; result.stab1 = values[0]; result.stab2 = values[1]; result.stab3 = values[2]; using FLUX = DivDGMaxDiscretizationBase::FluxType; result.fluxType1 = useBrezzi[0] ? FLUX::BREZZI : FLUX::IP; result.fluxType2 = useBrezzi[1] ? FLUX::BREZZI : FLUX::IP; result.fluxType3 = useBrezzi[2] ? FLUX::BREZZI : FLUX::IP; logger(INFO, "Using fluxes and stabilization: %", result); return result; } throw std::invalid_argument("Invalid stabilization parameter"); } else { // Default values DivDGMaxDiscretizationBase::Stab stab; stab.stab1 = 5; stab.stab2 = 0; stab.stab3 = 5; stab.setAllFluxeTypes(DivDGMaxDiscretizationBase::FluxType::BREZZI); return stab; } } template <std::size_t DIM> void writeMesh(std::string fileName, const Base::MeshManipulator<DIM>* mesh) { Output::VTKSpecificTimeWriter<DIM> writer(fileName, mesh); writer.write( [&](Base::Element* element, const Geometry::PointReference<DIM>&, std::size_t) { const ElementInfos* elementInfos = dynamic_cast<ElementInfos*>(element->getUserData()); logger.assert_debug(elementInfos != nullptr, "Incorrect user data type"); return elementInfos->epsilon_; }, "epsilon"); }
36.76951
80
0.576209
[ "mesh", "geometry", "vector" ]
5b11ddce2be4ba002af2653d161673134e34d077
2,900
cpp
C++
src/MyGame.cpp
NathanJMurray/CI628PongClient
5c03e38f354340f58d617cef861446d4d56ade09
[ "MIT" ]
null
null
null
src/MyGame.cpp
NathanJMurray/CI628PongClient
5c03e38f354340f58d617cef861446d4d56ade09
[ "MIT" ]
null
null
null
src/MyGame.cpp
NathanJMurray/CI628PongClient
5c03e38f354340f58d617cef861446d4d56ade09
[ "MIT" ]
null
null
null
#include "MyGame.h" Font scoreFont; SDL_Texture* Texture::LoadTexture(const char* texture, SDL_Renderer* ren) { SDL_Surface* tempSurface = IMG_Load(texture); SDL_Texture* tex = SDL_CreateTextureFromSurface(ren, tempSurface); SDL_FreeSurface(tempSurface); return tex; } SDL_Texture* ballTex; void MyGame::on_receive(std::string cmd, std::vector<std::string>& args) { if (cmd == "GAME_DATA") { // we should have exactly 4 arguments if (args.size() == 4) { game_data.player1Y = stoi(args.at(0)); game_data.player2Y = stoi(args.at(1)); game_data.ballX = stoi(args.at(2)); game_data.ballY = stoi(args.at(3)); } } else if (cmd == "SCORES") { game_data.score1 = stoi(args.at(0)); game_data.score2 = stoi(args.at(1)); } else { std::cout << "Received: " << cmd << std::endl; } } void MyGame::send(std::string message) { messages.push_back(message); } void MyGame::input(SDL_Event& event) { switch (event.key.keysym.sym) { //checks for key down event on the W key case SDLK_w: send(event.type == SDL_KEYDOWN ? "W_DOWN" : "W_UP"); break; //checks for key down event on the S key case SDLK_s: send(event.type == SDL_KEYDOWN ? "S_DOWN" : "S_UP"); break; //checks for key down event on the I key case SDLK_i: send(event.type == SDL_KEYDOWN ? "I_DOWN" : "I_UP"); break; //checks for key down event on the K key case SDLK_k: send(event.type == SDL_KEYDOWN ? "K_DOWN" : "K_UP"); break; } } void MyGame::update() { //updates the Y position of the player 2 player1.y = game_data.player1Y; //updates the Y position of the player 2 player2.y = game_data.player2Y; //updates the Y position of the ball ball.y = game_data.ballY; //updates the X position of the ball ball.x = game_data.ballX; } void MyGame::render(SDL_Renderer* renderer) { SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); //Draws a filled rect for the player 1 SDL_RenderFillRect(renderer, &player1); //Draws a filled rect for the player 2 SDL_RenderFillRect(renderer, &player2); //Draws a filled rect for the ball //SDL_RenderFillRect(renderer, &ball); ballTex = Texture::LoadTexture("assets/tennis-png-1806.png", renderer); SDL_RenderCopy(renderer, ballTex, NULL, &ball); if (score.w == NULL) { std::cout << "rect is empty" << std::endl; } scoreFont.fontRender(renderer); if (scoreFont.texture == NULL) { std::cout << "No Texture" << std::endl; } else { SDL_RenderCopy(renderer, scoreFont.texture, NULL, &score); } //SDL_RenderFillRect(renderer, &score); }
26.851852
75
0.595862
[ "render", "vector" ]
5b12b1a70ceb1a3a0437785e330390072b1c9cb7
102,248
cpp
C++
src/basic/adt/ApInt.cpp
tryboy/polarphp
f6608c4dc26add94e61684ed0edd3d5c7e86e768
[ "PHP-3.01" ]
null
null
null
src/basic/adt/ApInt.cpp
tryboy/polarphp
f6608c4dc26add94e61684ed0edd3d5c7e86e768
[ "PHP-3.01" ]
null
null
null
src/basic/adt/ApInt.cpp
tryboy/polarphp
f6608c4dc26add94e61684ed0edd3d5c7e86e768
[ "PHP-3.01" ]
null
null
null
// This source file is part of the polarphp.org open source project // // Copyright (c) 2017 - 2019 polarphp software foundation // Copyright (c) 2017 - 2019 zzu_softboy <zzu_softboy@163.com> // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://polarphp.org/LICENSE.txt for license information // See https://polarphp.org/CONTRIBUTORS.txt for the list of polarphp project authors // // Created by polarboy on 2018/06/15. #include "polarphp/basic/adt/ApInt.h" #include "polarphp/basic/adt/ArrayRef.h" #include "polarphp/basic/adt/FoldingSet.h" #include "polarphp/basic/adt/Hashing.h" #include "polarphp/basic/adt/SmallString.h" #include "polarphp/basic/adt/StringRef.h" #include "polarphp/basic/adt/ApInt.h" #include "polarphp/basic/adt/Bit.h" #include "polarphp/utils/Debug.h" #include "polarphp/utils/ErrorHandling.h" #include "polarphp/utils/MathExtras.h" #include "polarphp/utils/RawOutStream.h" #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <optional> namespace polar { namespace basic { #define DEBUG_TYPE "ApInt" using polar::utils::byte_swap16; using polar::utils::byte_swap32; using polar::utils::byte_swap64; using polar::utils::reverse_bits; using polar::utils::sign_extend64; using polar::debug_stream; using polar::utils::low32; using polar::utils::high32; using polar::utils::make64; using polar::utils::find_last_set; using polar::utils::find_first_set; using polar::utils::ZeroBehavior; namespace { /// A utility function for allocating memory, checking for allocation failures, /// and ensuring the contents are zeroed. inline uint64_t *get_cleared_memory(unsigned numWords) { uint64_t *result = new uint64_t[numWords]; memset(result, 0, numWords * sizeof(uint64_t)); return result; } /// A utility function for allocating memory and checking for allocation /// failure. The content is not zeroed. inline uint64_t *get_memory(unsigned numWords) { return new uint64_t[numWords]; } /// A utility function that converts a character to a digit. inline unsigned get_digit(char cdigit, uint8_t radix) { unsigned r; if (radix == 16 || radix == 36) { r = cdigit - '0'; if (r <= 9) { return r; } r = cdigit - 'A'; if (r <= radix - 11U) { return r + 10; } r = cdigit - 'a'; if (r <= radix - 11U) { return r + 10; } radix = 10; } r = cdigit - '0'; if (r < radix) { return r; } return -1U; } } // anonymous namespace void ApInt::initSlowCase(uint64_t value, bool isSigned) { m_intValue.m_pValue = get_cleared_memory(getNumWords()); m_intValue.m_pValue[0] = value; if (isSigned && int64_t(value) < 0) { for (unsigned i = 1; i < getNumWords(); ++i) { m_intValue.m_pValue[i] = WORDTYPE_MAX; } } clearUnusedBits(); } void ApInt::initSlowCase(const ApInt& other) { m_intValue.m_pValue = get_memory(getNumWords()); memcpy(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords() * APINT_WORD_SIZE); } void ApInt::initFromArray(ArrayRef<uint64_t> bigVal) { assert(m_bitWidth && "Bitwidth too small"); assert(bigVal.getData() && "Null pointer detected!"); if (isSingleWord()) { m_intValue.m_value = bigVal[0]; } else { // Get memory, cleared to 0 m_intValue.m_pValue = get_cleared_memory(getNumWords()); // Calculate the number of words to copy unsigned words = std::min<unsigned>(bigVal.getSize(), getNumWords()); // Copy the words from bigVal to pVal memcpy(m_intValue.m_pValue, bigVal.getData(), words * APINT_WORD_SIZE); } // Make sure unused high bits are cleared clearUnusedBits(); } ApInt::ApInt(unsigned numBits, ArrayRef<uint64_t> bigVal) : m_bitWidth(numBits) { initFromArray(bigVal); } ApInt::ApInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]) : m_bitWidth(numBits) { initFromArray(make_array_ref(bigVal, numWords)); } ApInt::ApInt(unsigned numbits, StringRef str, uint8_t radix) : m_bitWidth(numbits) { assert(m_bitWidth && "Bitwidth too small"); fromString(numbits, str, radix); } void ApInt::reallocate(unsigned newm_bitWidth) { // If the number of words is the same we can just change the width and stop. if (getNumWords() == getNumWords(newm_bitWidth)) { m_bitWidth = newm_bitWidth; return; } // If we have an allocation, delete it. if (!isSingleWord()) { delete [] m_intValue.m_pValue; } // Update m_bitWidth. m_bitWidth = newm_bitWidth; // If we are supposed to have an allocation, create it. if (!isSingleWord()) { m_intValue.m_pValue = get_memory(getNumWords()); } } void ApInt::assignSlowCase(const ApInt& other) { // Don't do anything for X = X if (this == &other) { return; } // Adjust the bit width and handle allocations as necessary. reallocate(other.getBitWidth()); // Copy the data. if (isSingleWord()) { m_intValue.m_value = other.m_intValue.m_value; } else { memcpy(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords() * APINT_WORD_SIZE); } } /// This method 'profiles' an ApInt for use with FoldingSet. void ApInt::profile(FoldingSetNodeId& id) const { id.addInteger(m_bitWidth); if (isSingleWord()) { id.addInteger(m_intValue.m_value); return; } unsigned numWords = getNumWords(); for (unsigned i = 0; i < numWords; ++i) { id.addInteger(m_intValue.m_pValue[i]); } } /// @brief Prefix increment operator. Increments the ApInt by one. ApInt& ApInt::operator++() { if (isSingleWord()) { ++m_intValue.m_value; } else { tcIncrement(m_intValue.m_pValue, getNumWords()); } return clearUnusedBits(); } /// @brief Prefix decrement operator. Decrements the ApInt by one. ApInt& ApInt::operator--() { if (isSingleWord()) { --m_intValue.m_value; } else { tcDecrement(m_intValue.m_pValue, getNumWords()); } return clearUnusedBits(); } /// Adds the rhs ApInt to this ApInt. /// @returns this, after addition of rhs. /// @brief Addition assignment operator. ApInt& ApInt::operator+=(const ApInt& other) { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be the same"); if (isSingleWord()) { m_intValue.m_value += other.m_intValue.m_value; } else { tcAdd(m_intValue.m_pValue, other.m_intValue.m_pValue, 0, getNumWords()); } return clearUnusedBits(); } ApInt& ApInt::operator+=(uint64_t other) { if (isSingleWord()) { m_intValue.m_value += other; } else { tcAddPart(m_intValue.m_pValue, other, getNumWords()); } return clearUnusedBits(); } /// Subtracts the rhs ApInt from this ApInt /// @returns this, after subtraction /// @brief Subtraction assignment operator. ApInt& ApInt::operator-=(const ApInt& other) { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be the same"); if (isSingleWord()) { m_intValue.m_value -= other.m_intValue.m_value; } else { tcSubtract(m_intValue.m_pValue, other.m_intValue.m_pValue, 0, getNumWords()); } return clearUnusedBits(); } ApInt& ApInt::operator-=(uint64_t other) { if (isSingleWord()) { m_intValue.m_value -= other; } else { tcSubtractPart(m_intValue.m_pValue, other, getNumWords()); } return clearUnusedBits(); } ApInt ApInt::operator*(const ApInt& other) const { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be the same"); if (isSingleWord()) { return ApInt(m_bitWidth, m_intValue.m_value * other.m_intValue.m_value); } ApInt result(get_memory(getNumWords()), getBitWidth()); tcMultiply(result.m_intValue.m_pValue, m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords()); result.clearUnusedBits(); return result; } void ApInt::andAssignSlowCase(const ApInt &other) { tcAnd(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords()); } void ApInt::orAssignSlowCase(const ApInt &other) { tcOr(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords()); } void ApInt::xorAssignSlowCase(const ApInt &other) { tcXor(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords()); } ApInt& ApInt::operator*=(const ApInt& other) { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be the same"); *this = *this * other; return *this; } ApInt& ApInt::operator*=(uint64_t other) { if (isSingleWord()) { m_intValue.m_value *= other; } else { unsigned numWords = getNumWords(); tcMultiplyPart(m_intValue.m_pValue, m_intValue.m_pValue, other, 0, numWords, numWords, false); } return clearUnusedBits(); } bool ApInt::equalSlowCase(const ApInt& other) const { return std::equal(m_intValue.m_pValue, m_intValue.m_pValue + getNumWords(), other.m_intValue.m_pValue); } int ApInt::compare(const ApInt &other) const { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be same for comparison"); if (isSingleWord()) { return m_intValue.m_value < other.m_intValue.m_value ? -1 : m_intValue.m_value > other.m_intValue.m_value; } return tcCompare(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords()); } int ApInt::compareSigned(const ApInt& other) const { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be same for comparison"); if (isSingleWord()) { int64_t lhsSext = sign_extend64(m_intValue.m_value, m_bitWidth); int64_t rhsSext = sign_extend64(other.m_intValue.m_value, m_bitWidth); return lhsSext < rhsSext ? -1 : lhsSext > rhsSext; } bool lhsNeg = isNegative(); bool rhsNeg = other.isNegative(); // If the sign bits don't match, then (LHS < rhs) if LHS is negative if (lhsNeg != rhsNeg) { return lhsNeg ? -1 : 1; } // Otherwise we can just use an unsigned comparison, because even negative // numbers compare correctly this way if both have the same signed-ness. return tcCompare(m_intValue.m_pValue, other.m_intValue.m_pValue, getNumWords()); } void ApInt::setBitsSlowCase(unsigned loBit, unsigned hiBit) { unsigned loWord = whichWord(loBit); unsigned hiWord = whichWord(hiBit); // Create an initial mask for the low word with zeros below loBit. uint64_t loMask = WORDTYPE_MAX << whichBit(loBit); // If hiBit is not aligned, we need a high mask. unsigned hiShiftAmt = whichBit(hiBit); if (hiShiftAmt != 0) { // Create a high mask with zeros above hiBit. uint64_t hiMask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - hiShiftAmt); // If loWord and hiWord are equal, then we combine the masks. Otherwise, // set the bits in hiWord. if (hiWord == loWord) { loMask &= hiMask; } else { m_intValue.m_pValue[hiWord] |= hiMask; } } // Apply the mask to the low word. m_intValue.m_pValue[loWord] |= loMask; // Fill any words between loWord and hiWord with all ones. for (unsigned word = loWord + 1; word < hiWord; ++word) { m_intValue.m_pValue[word] = WORDTYPE_MAX; } } /// @brief Toggle every bit to its opposite value. void ApInt::flipAllBitsSlowCase() { tcComplement(m_intValue.m_pValue, getNumWords()); clearUnusedBits(); } /// Toggle a given bit to its opposite value whose position is given /// as "bitPosition". /// @brief Toggles a given bit to its opposite value. void ApInt::flipBit(unsigned bitPosition) { assert(bitPosition < m_bitWidth && "Out of the bit-width range!"); if ((*this)[bitPosition]) { clearBit(bitPosition); } else setBit(bitPosition); } void ApInt::insertBits(const ApInt &subBits, unsigned bitPosition) { unsigned subm_bitWidth = subBits.getBitWidth(); assert(0 < subm_bitWidth && (subm_bitWidth + bitPosition) <= m_bitWidth && "Illegal bit insertion"); // Insertion is a direct copy. if (subm_bitWidth == m_bitWidth) { *this = subBits; return; } // Single word result can be done as a direct bitmask. if (isSingleWord()) { uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - subm_bitWidth); m_intValue.m_value &= ~(mask << bitPosition); m_intValue.m_value |= (subBits.m_intValue.m_value << bitPosition); return; } unsigned loBit = whichBit(bitPosition); unsigned loWord = whichWord(bitPosition); unsigned hi1Word = whichWord(bitPosition + subm_bitWidth - 1); // Insertion within a single word can be done as a direct bitmask. if (loWord == hi1Word) { uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - subm_bitWidth); m_intValue.m_pValue[loWord] &= ~(mask << loBit); m_intValue.m_pValue[loWord] |= (subBits.m_intValue.m_value << loBit); return; } // Insert on word boundaries. if (loBit == 0) { // Direct copy whole words. unsigned numWholeSubWords = subm_bitWidth / APINT_BITS_PER_WORD; memcpy(m_intValue.m_pValue + loWord, subBits.getRawData(), numWholeSubWords * APINT_WORD_SIZE); // Mask+insert remaining bits. unsigned remainingBits = subm_bitWidth % APINT_BITS_PER_WORD; if (remainingBits != 0) { uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - remainingBits); m_intValue.m_pValue[hi1Word] &= ~mask; m_intValue.m_pValue[hi1Word] |= subBits.getWord(subm_bitWidth - 1); } return; } // General case - set/clear individual bits in dst based on src. // TODO - there is scope for optimization here, but at the moment this code // path is barely used so prefer readability over performance. for (unsigned i = 0; i != subm_bitWidth; ++i) { if (subBits[i]) { setBit(bitPosition + i); } else { clearBit(bitPosition + i); } } } ApInt ApInt::extractBits(unsigned numBits, unsigned bitPosition) const { assert(numBits > 0 && "Can't extract zero bits"); assert(bitPosition < m_bitWidth && (numBits + bitPosition) <= m_bitWidth && "Illegal bit extraction"); if (isSingleWord()) { return ApInt(numBits, m_intValue.m_value >> bitPosition); } unsigned loBit = whichBit(bitPosition); unsigned loWord = whichWord(bitPosition); unsigned hiWord = whichWord(bitPosition + numBits - 1); // Single word result extracting bits from a single word source. if (loWord == hiWord) { return ApInt(numBits, m_intValue.m_pValue[loWord] >> loBit); } // Extracting bits that start on a source word boundary can be done // as a fast memory copy. if (loBit == 0) { return ApInt(numBits, make_array_ref(m_intValue.m_pValue + loWord, 1 + hiWord - loWord)); } // General case - shift + copy source words directly into place. ApInt result(numBits, 0); unsigned numSrcWords = getNumWords(); unsigned numDstWords = result.getNumWords(); uint64_t *destPtr = result.isSingleWord() ? &result.m_intValue.m_value : result.m_intValue.m_pValue; for (unsigned word = 0; word < numDstWords; ++word) { uint64_t w0 = m_intValue.m_pValue[loWord + word]; uint64_t w1 = (loWord + word + 1) < numSrcWords ? m_intValue.m_pValue[loWord + word + 1] : 0; destPtr[word] = (w0 >> loBit) | (w1 << (APINT_BITS_PER_WORD - loBit)); } return result.clearUnusedBits(); } unsigned ApInt::getBitsNeeded(StringRef str, uint8_t radix) { assert(!str.empty() && "Invalid string length"); assert((radix == 10 || radix == 8 || radix == 16 || radix == 2 || radix == 36) && "Radix should be 2, 8, 10, 16, or 36!"); size_t slen = str.getSize(); // Each computation below needs to know if it's negative. StringRef::iterator p = str.begin(); unsigned isNegative = *p == '-'; if (*p == '-' || *p == '+') { p++; slen--; assert(slen && "String is only a sign, needs a value."); } // For radixes of power-of-two values, the bits required is accurately and // easily computed if (radix == 2) { return slen + isNegative; } if (radix == 8) { return slen * 3 + isNegative; } if (radix == 16) { return slen * 4 + isNegative; } // FIXME: base 36 // This is grossly inefficient but accurate. We could probably do something // with a computation of roughly slen*64/20 and then adjust by the value of // the first few digits. But, I'm not sure how accurate that could be. // Compute a sufficient number of bits that is always large enough but might // be too large. This avoids the assertion in the constructor. This // calculation doesn't work appropriately for the numbers 0-9, so just use 4 // bits in that case. unsigned sufficient = radix == 10? (slen == 1 ? 4 : slen * 64/18) : (slen == 1 ? 7 : slen * 16/3); // Convert to the actual binary value. ApInt tmp(sufficient, StringRef(p, slen), radix); // Compute how many bits are required. If the log is infinite, assume we need // just bit. unsigned log = tmp.logBase2(); if (log == (unsigned)-1) { return isNegative + 1; } else { return isNegative + log + 1; } } HashCode hash_value(const ApInt &arg) { if (arg.isSingleWord()) { return hash_combine(arg.m_intValue.m_value); } return hash_combine_range(arg.m_intValue.m_pValue, arg.m_intValue.m_pValue + arg.getNumWords()); } bool ApInt::isSplat(unsigned splatSizeInBits) const { assert(getBitWidth() % splatSizeInBits == 0 && "splatSizeInBits must divide width!"); // We can check that all parts of an integer are equal by making use of a // little trick: rotate and check if it's still the same value. return *this == rotl(splatSizeInBits); } /// This function returns the high "numBits" bits of this ApInt. ApInt ApInt::getHiBits(unsigned numBits) const { return this->lshr(m_bitWidth - numBits); } /// This function returns the low "numBits" bits of this ApInt. ApInt ApInt::getLoBits(unsigned numBits) const { ApInt result(getLowBitsSet(m_bitWidth, numBits)); result &= *this; return result; } /// Return a value containing V broadcasted over newLen bits. ApInt ApInt::getSplat(unsigned newLen, const ApInt &value) { assert(newLen >= value.getBitWidth() && "Can't splat to smaller bit width!"); ApInt retValue = value.zextOrSelf(newLen); for (unsigned index = value.getBitWidth(); index < newLen; index <<= 1) { retValue |= retValue << index; } return retValue; } unsigned ApInt::countLeadingZerosSlowCase() const { unsigned count = 0; for (int i = getNumWords()-1; i >= 0; --i) { uint64_t value = m_intValue.m_pValue[i]; if (value == 0) { count += APINT_BITS_PER_WORD; } else { count += count_leading_zeros(value); break; } } // Adjust for unused bits in the most significant word (they are zero). unsigned mod = m_bitWidth % APINT_BITS_PER_WORD; count -= mod > 0 ? APINT_BITS_PER_WORD - mod : 0; return count; } unsigned ApInt::countLeadingOnesSlowCase() const { unsigned highWordBits = m_bitWidth % APINT_BITS_PER_WORD; unsigned shift; if (!highWordBits) { highWordBits = APINT_BITS_PER_WORD; shift = 0; } else { shift = APINT_BITS_PER_WORD - highWordBits; } int i = getNumWords() - 1; unsigned count = count_leading_ones(m_intValue.m_pValue[i] << shift); if (count == highWordBits) { for (i--; i >= 0; --i) { if (m_intValue.m_pValue[i] == WORDTYPE_MAX) { count += APINT_BITS_PER_WORD; } else { count += count_leading_ones(m_intValue.m_pValue[i]); break; } } } return count; } unsigned ApInt::countTrailingZerosSlowCase() const { unsigned count = 0; unsigned i = 0; for (; i < getNumWords() && m_intValue.m_pValue[i] == 0; ++i) { count += APINT_BITS_PER_WORD; } if (i < getNumWords()) { count += count_trailing_zeros(m_intValue.m_pValue[i]); } return std::min(count, m_bitWidth); } unsigned ApInt::countTrailingOnesSlowCase() const { unsigned count = 0; unsigned i = 0; for (; i < getNumWords() && m_intValue.m_pValue[i] == WORDTYPE_MAX; ++i) { count += APINT_BITS_PER_WORD; } if (i < getNumWords()) { count += count_trailing_ones(m_intValue.m_pValue[i]); } assert(count <= m_bitWidth); return count; } unsigned ApInt::countPopulationSlowCase() const { unsigned count = 0; for (unsigned i = 0; i < getNumWords(); ++i) { count += count_population(m_intValue.m_pValue[i]); } return count; } bool ApInt::intersectsSlowCase(const ApInt &other) const { for (unsigned i = 0, e = getNumWords(); i != e; ++i) { if ((m_intValue.m_pValue[i] & other.m_intValue.m_pValue[i]) != 0) { return true; } } return false; } bool ApInt::isSubsetOfSlowCase(const ApInt &other) const { for (unsigned i = 0, e = getNumWords(); i != e; ++i) { if ((m_intValue.m_pValue[i] & ~other.m_intValue.m_pValue[i]) != 0) { return false; } } return true; } ApInt ApInt::byteSwap() const { assert(m_bitWidth >= 16 && m_bitWidth % 16 == 0 && "Cannot byteswap!"); if (m_bitWidth == 16) { return ApInt(m_bitWidth, byte_swap16(uint16_t(m_intValue.m_value))); } if (m_bitWidth == 32) { return ApInt(m_bitWidth, byte_swap32(unsigned(m_intValue.m_value))); } if (m_bitWidth == 48) { unsigned temp1 = unsigned(m_intValue.m_value >> 16); temp1 = byte_swap32(temp1); uint16_t temp2 = uint16_t(m_intValue.m_value); temp2 = byte_swap16(temp2); return ApInt(m_bitWidth, (uint64_t(temp2) << 32) | temp1); } if (m_bitWidth == 64) { return ApInt(m_bitWidth, byte_swap64(m_intValue.m_value)); } ApInt result(getNumWords() * APINT_BITS_PER_WORD, 0); for (unsigned index = 0, num = getNumWords(); index != num; ++index) { result.m_intValue.m_pValue[index] = byte_swap64(m_intValue.m_pValue[num - index - 1]); } if (result.m_bitWidth != m_bitWidth) { result.lshrInPlace(result.m_bitWidth - m_bitWidth); result.m_bitWidth = m_bitWidth; } return result; } ApInt ApInt::reverseBits() const { switch (m_bitWidth) { case 64: return ApInt(m_bitWidth, reverse_bits<uint64_t>(m_intValue.m_value)); case 32: return ApInt(m_bitWidth, reverse_bits<uint32_t>(m_intValue.m_value)); case 16: return ApInt(m_bitWidth, reverse_bits<uint16_t>(m_intValue.m_value)); case 8: return ApInt(m_bitWidth, reverse_bits<uint8_t>(m_intValue.m_value)); default: break; } ApInt val(*this); ApInt reversed(m_bitWidth, 0); unsigned s = m_bitWidth; for (; val != 0; val.lshrInPlace(1)) { reversed <<= 1; reversed |= val[0]; --s; } reversed <<= s; return reversed; } ApInt apintops::greatest_common_divisor(ApInt lhs, ApInt rhs) { // Fast-path a common case. if (lhs == rhs) { return lhs; } // Corner cases: if either operand is zero, the other is the gcd. if (!lhs) { return rhs; } if (!rhs) { return lhs; } // Count common powers of 2 and remove all other powers of 2. unsigned pow2; { unsigned lhsPow2 = lhs.countTrailingZeros(); unsigned rhsPow2 = rhs.countTrailingZeros(); if (lhsPow2 > rhsPow2) { lhs.lshrInPlace(lhsPow2 - rhsPow2); pow2 = rhsPow2; } else if (rhsPow2 > lhsPow2) { rhs.lshrInPlace(rhsPow2 - lhsPow2); pow2 = lhsPow2; } else { pow2 = lhsPow2; } } // Both operands are odd multiples of 2^Pow_2: // // gcd(a, b) = gcd(|a - b| / 2^i, min(a, b)) // // This is a modified version of Stein's algorithm, taking advantage of // efficient countTrailingZeros(). while (lhs != rhs) { if (lhs.ugt(rhs)) { lhs -= rhs; lhs.lshrInPlace(lhs.countTrailingZeros() - pow2); } else { rhs -= lhs; rhs.lshrInPlace(rhs.countTrailingZeros() - pow2); } } return lhs; } ApInt apintops::round_double_to_apint(double doubleValue, unsigned width) { uint64_t temp = bit_cast<uint64_t>(doubleValue); // Get the sign bit from the highest order bit bool isNeg = temp >> 63; // Get the 11-bit exponent and adjust for the 1023 bit bias int64_t exp = ((temp >> 52) & 0x7ff) - 1023; // If the exponent is negative, the value is < 0 so just return 0. if (exp < 0) { return ApInt(width, 0u); } // Extract the mantissa by clearing the top 12 bits (sign + exponent). uint64_t mantissa = (temp & (~0ULL >> 12)) | 1ULL << 52; // If the exponent doesn't shift all bits out of the mantissa if (exp < 52) { return isNeg ? -ApInt(width, mantissa >> (52 - exp)) : ApInt(width, mantissa >> (52 - exp)); } // If the client didn't provide enough bits for us to shift the mantissa into // then the result is undefined, just return 0 if (width <= exp - 52) { return ApInt(width, 0); } // Otherwise, we have to shift the mantissa bits up to the right location ApInt ret(width, mantissa); ret <<= (unsigned)exp - 52; return isNeg ? -ret : ret; } /// This function converts this ApInt to a double. /// The layout for double is as following (IEEE Standard 754): /// -------------------------------------- /// | Sign Exponent Fraction Bias | /// |-------------------------------------- | /// | 1[63] 11[62-52] 52[51-00] 1023 | /// -------------------------------------- double ApInt::roundToDouble(bool isSigned) const { // Handle the simple case where the value is contained in one uint64_t. // It is wrong to optimize getWord(0) to VAL; there might be more than one word. if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) { if (isSigned) { int64_t sext = sign_extend64(getWord(0), m_bitWidth); return double(sext); } else return double(getWord(0)); } // Determine if the value is negative. bool isNeg = isSigned ? (*this)[m_bitWidth-1] : false; // Construct the absolute value if we're negative. ApInt temp(isNeg ? -(*this) : (*this)); // Figure out how many bits we're using. unsigned n = temp.getActiveBits(); // The exponent (without bias normalization) is just the number of bits // we are using. Note that the sign bit is gone since we constructed the // absolute value. uint64_t exp = n; // Return infinity for exponent overflow if (exp > 1023) { if (!isSigned || !isNeg) return std::numeric_limits<double>::infinity(); else return -std::numeric_limits<double>::infinity(); } exp += 1023; // Increment for 1023 bias // Number of bits in mantissa is 52. To obtain the mantissa value, we must // extract the high 52 bits from the correct words in pVal. uint64_t mantissa; unsigned hiWord = whichWord(n-1); if (hiWord == 0) { mantissa = temp.m_intValue.m_pValue[0]; if (n > 52) mantissa >>= n - 52; // shift down, we want the top 52 bits. } else { assert(hiWord > 0 && "huh?"); uint64_t hibits = temp.m_intValue.m_pValue[hiWord] << (52 - n % APINT_BITS_PER_WORD); uint64_t lobits = temp.m_intValue.m_pValue[hiWord-1] >> (11 + n % APINT_BITS_PER_WORD); mantissa = hibits | lobits; } // The leading bit of mantissa is implicit, so get rid of it. uint64_t sign = isNeg ? (1ULL << (APINT_BITS_PER_WORD - 1)) : 0; uint64_t ret = sign | (exp << 52) | mantissa; return bit_cast<double>(ret); } // Truncate to new width. ApInt ApInt::trunc(unsigned width) const { assert(width < m_bitWidth && "Invalid ApInt Truncate request"); assert(width && "Can't truncate to 0 bits"); if (width <= APINT_BITS_PER_WORD) { return ApInt(width, getRawData()[0]); } ApInt result(get_memory(getNumWords(width)), width); // Copy full words. unsigned i; for (i = 0; i != width / APINT_BITS_PER_WORD; i++) { result.m_intValue.m_pValue[i] = m_intValue.m_pValue[i]; } // Truncate and copy any partial word. unsigned bits = (0 - width) % APINT_BITS_PER_WORD; if (bits != 0) { result.m_intValue.m_pValue[i] = m_intValue.m_pValue[i] << bits >> bits; } return result; } // Sign extend to a new width. ApInt ApInt::sext(unsigned width) const { assert(width > m_bitWidth && "Invalid ApInt SignExtend request"); if (width <= APINT_BITS_PER_WORD) { return ApInt(width, sign_extend64(m_intValue.m_value, m_bitWidth)); } ApInt result(get_memory(getNumWords(width)), width); // Copy words. std::memcpy(result.m_intValue.m_pValue, getRawData(), getNumWords() * APINT_WORD_SIZE); // Sign extend the last word since there may be unused bits in the input. result.m_intValue.m_pValue[getNumWords() - 1] = sign_extend64(result.m_intValue.m_pValue[getNumWords() - 1], ((m_bitWidth - 1) % APINT_BITS_PER_WORD) + 1); // Fill with sign bits. std::memset(result.m_intValue.m_pValue + getNumWords(), isNegative() ? -1 : 0, (result.getNumWords() - getNumWords()) * APINT_WORD_SIZE); result.clearUnusedBits(); return result; } // Zero extend to a new width. ApInt ApInt::zext(unsigned width) const { assert(width > m_bitWidth && "Invalid ApInt ZeroExtend request"); if (width <= APINT_BITS_PER_WORD) { return ApInt(width, m_intValue.m_value); } ApInt result(get_memory(getNumWords(width)), width); // Copy words. std::memcpy(result.m_intValue.m_pValue, getRawData(), getNumWords() * APINT_WORD_SIZE); // Zero remaining words. std::memset(result.m_intValue.m_pValue + getNumWords(), 0, (result.getNumWords() - getNumWords()) * APINT_WORD_SIZE); return result; } ApInt ApInt::zextOrTrunc(unsigned width) const { if (m_bitWidth < width) { return zext(width); } if (m_bitWidth > width) { return trunc(width); } return *this; } ApInt ApInt::sextOrTrunc(unsigned width) const { if (m_bitWidth < width) { return sext(width); } if (m_bitWidth > width) { return trunc(width); } return *this; } ApInt ApInt::zextOrSelf(unsigned width) const { if (m_bitWidth < width) { return zext(width); } return *this; } ApInt ApInt::sextOrSelf(unsigned width) const { if (m_bitWidth < width) { return sext(width); } return *this; } /// Arithmetic right-shift this ApInt by shiftAmt. /// @brief Arithmetic right-shift function. void ApInt::ashrInPlace(const ApInt &shiftAmt) { ashrInPlace((unsigned)shiftAmt.getLimitedValue(m_bitWidth)); } /// Arithmetic right-shift this ApInt by shiftAmt. /// @brief Arithmetic right-shift function. void ApInt::ashrSlowCase(unsigned shiftAmt) { // Don't bother performing a no-op shift. if (!shiftAmt) { return; } // Save the original sign bit for later. bool negative = isNegative(); // wordShift is the inter-part shift; BitShift is is intra-part shift. unsigned wordShift = shiftAmt / APINT_BITS_PER_WORD; unsigned bitShift = shiftAmt % APINT_BITS_PER_WORD; unsigned wordsToMove = getNumWords() - wordShift; if (wordsToMove != 0) { // Sign extend the last word to fill in the unused bits. m_intValue.m_pValue[getNumWords() - 1] = sign_extend64( m_intValue.m_pValue[getNumWords() - 1], ((m_bitWidth - 1) % APINT_BITS_PER_WORD) + 1); // Fastpath for moving by whole words. if (bitShift == 0) { std::memmove(m_intValue.m_pValue, m_intValue.m_pValue + wordShift, wordsToMove * APINT_WORD_SIZE); } else { // Move the words containing significant bits. for (unsigned i = 0; i != wordsToMove - 1; ++i) m_intValue.m_pValue[i] = (m_intValue.m_pValue[i + wordShift] >> bitShift) | (m_intValue.m_pValue[i + wordShift + 1] << (APINT_BITS_PER_WORD - bitShift)); // Handle the last word which has no high bits to copy. m_intValue.m_pValue[wordsToMove - 1] = m_intValue.m_pValue[wordShift + wordsToMove - 1] >> bitShift; // Sign extend one more time. m_intValue.m_pValue[wordsToMove - 1] = sign_extend64(m_intValue.m_pValue[wordsToMove - 1], APINT_BITS_PER_WORD - bitShift); } } // Fill in the remainder based on the original sign. std::memset(m_intValue.m_pValue + wordsToMove, negative ? -1 : 0, wordShift * APINT_WORD_SIZE); clearUnusedBits(); } /// Logical right-shift this ApInt by shiftAmt. /// @brief Logical right-shift function. void ApInt::lshrInPlace(const ApInt &shiftAmt) { lshrInPlace((unsigned)shiftAmt.getLimitedValue(m_bitWidth)); } /// Logical right-shift this ApInt by shiftAmt. /// @brief Logical right-shift function. void ApInt::lshrSlowCase(unsigned shiftAmt) { tcShiftRight(m_intValue.m_pValue, getNumWords(), shiftAmt); } /// Left-shift this ApInt by shiftAmt. /// @brief Left-shift function. ApInt &ApInt::operator<<=(const ApInt &shiftAmt) { // It's undefined behavior in C to shift by m_bitWidth or greater. *this <<= (unsigned)shiftAmt.getLimitedValue(m_bitWidth); return *this; } void ApInt::shlSlowCase(unsigned shiftAmt) { tcShiftLeft(m_intValue.m_pValue, getNumWords(), shiftAmt); clearUnusedBits(); } namespace { // Calculate the rotate amount modulo the bit width. unsigned rotate_modulo(unsigned bitWidth, const ApInt &rotateAmt) { unsigned rotm_bitWidth = rotateAmt.getBitWidth(); ApInt rot = rotateAmt; if (rotm_bitWidth < bitWidth) { // Extend the rotate ApInt, so that the urem doesn't divide by 0. // e.g. ApInt(1, 32) would give ApInt(1, 0). rot = rotateAmt.zext(bitWidth); } rot = rot.urem(ApInt(rot.getBitWidth(), bitWidth)); return rot.getLimitedValue(bitWidth); } } // anonymous namespace ApInt ApInt::rotl(const ApInt &rotateAmt) const { return rotl(rotate_modulo(m_bitWidth, rotateAmt)); } ApInt ApInt::rotl(unsigned rotateAmt) const { rotateAmt %= m_bitWidth; if (rotateAmt == 0) { return *this; } return shl(rotateAmt) | lshr(m_bitWidth - rotateAmt); } ApInt ApInt::rotr(const ApInt &rotateAmt) const { return rotr(rotate_modulo(m_bitWidth, rotateAmt)); } ApInt ApInt::rotr(unsigned rotateAmt) const { rotateAmt %= m_bitWidth; if (rotateAmt == 0) { return *this; } return lshr(rotateAmt) | shl(m_bitWidth - rotateAmt); } // Square Root - this method computes and returns the square root of "this". // Three mechanisms are used for computation. For small values (<= 5 bits), // a table lookup is done. This gets some performance for common cases. For // values using less than 52 bits, the value is converted to double and then // the libc sqrt function is called. The result is rounded and then converted // back to a uint64_t which is then used to construct the result. Finally, // the Babylonian method for computing square roots is used. ApInt ApInt::sqrt() const { // Determine the magnitude of the value. unsigned magnitude = getActiveBits(); // Use a fast table for some small values. This also gets rid of some // rounding errors in libc sqrt for small values. if (magnitude <= 5) { static const uint8_t results[32] = { /* 0 */ 0, /* 1- 2 */ 1, 1, /* 3- 6 */ 2, 2, 2, 2, /* 7-12 */ 3, 3, 3, 3, 3, 3, /* 13-20 */ 4, 4, 4, 4, 4, 4, 4, 4, /* 21-30 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 31 */ 6 }; return ApInt(m_bitWidth, results[ (isSingleWord() ? m_intValue.m_value : m_intValue.m_pValue[0]) ]); } // If the magnitude of the value fits in less than 52 bits (the precision of // an IEEE double precision floating point value), then we can use the // libc sqrt function which will probably use a hardware sqrt computation. // This should be faster than the algorithm below. if (magnitude < 52) { return ApInt(m_bitWidth, uint64_t(::round(::sqrt(double(isSingleWord() ? m_intValue.m_value : m_intValue.m_pValue[0]))))); } // Okay, all the short cuts are exhausted. We must compute it. The following // is a classical Babylonian method for computing the square root. This code // was adapted to ApInt from a wikipedia article on such computations. // See http://www.wikipedia.org/ and go to the page named // Calculate_an_integer_square_root. unsigned nbits = m_bitWidth, i = 4; ApInt testy(m_bitWidth, 16); ApInt x_old(m_bitWidth, 1); ApInt x_new(m_bitWidth, 0); ApInt two(m_bitWidth, 2); // Select a good starting value using binary logarithms. for (;; i += 2, testy = testy.shl(2)) if (i >= nbits || this->ule(testy)) { x_old = x_old.shl(i / 2); break; } // Use the Babylonian method to arrive at the integer square root: for (;;) { x_new = (this->udiv(x_old) + x_old).udiv(two); if (x_old.ule(x_new)) { break; } x_old = x_new; } // Make sure we return the closest approximation // NOTE: The rounding calculation below is correct. It will produce an // off-by-one discrepancy with results from pari/gp. That discrepancy has been // determined to be a rounding issue with pari/gp as it begins to use a // floating point representation after 192 bits. There are no discrepancies // between this algorithm and pari/gp for bit widths < 192 bits. ApInt square(x_old * x_old); ApInt nextSquare((x_old + 1) * (x_old +1)); if (this->ult(square)) { return x_old; } assert(this->ule(nextSquare) && "Error in ApInt::sqrt computation"); ApInt midpoint((nextSquare - square).udiv(two)); ApInt offset(*this - square); if (offset.ult(midpoint)) { return x_old; } return x_old + 1; } /// Computes the multiplicative inverse of this ApInt for a given modulo. The /// iterative extended Euclidean algorithm is used to solve for this value, /// however we simplify it to speed up calculating only the inverse, and take /// advantage of div+rem calculations. We also use some tricks to avoid copying /// (potentially large) ApInts around. ApInt ApInt::multiplicativeInverse(const ApInt& modulo) const { assert(ult(modulo) && "This ApInt must be smaller than the modulo"); // Using the properties listed at the following web page (accessed 06/21/08): // http://www.numbertheory.org/php/euclid.html // (especially the properties numbered 3, 4 and 9) it can be proved that // m_bitWidth bits suffice for all the computations in the algorithm implemented // below. More precisely, this number of bits suffice if the multiplicative // inverse exists, but may not suffice for the general extended Euclidean // algorithm. ApInt r[2] = { modulo, *this }; ApInt t[2] = { ApInt(m_bitWidth, 0), ApInt(m_bitWidth, 1) }; ApInt q(m_bitWidth, 0); unsigned i; for (i = 0; r[i^1] != 0; i ^= 1) { // An overview of the math without the confusing bit-flipping: // q = r[i-2] / r[i-1] // r[i] = r[i-2] % r[i-1] // t[i] = t[i-2] - t[i-1] * q udivrem(r[i], r[i^1], q, r[i]); t[i] -= t[i^1] * q; } // If this ApInt and the modulo are not coprime, there is no multiplicative // inverse, so return 0. We check this by looking at the next-to-last // remainder, which is the gcd(*this,modulo) as calculated by the Euclidean // algorithm. if (r[i] != 1) { return ApInt(m_bitWidth, 0); } // The next-to-last t is the multiplicative inverse. However, we are // interested in a positive inverse. Calculate a positive one from a negative // one if necessary. A simple addition of the modulo suffices because // abs(t[i]) is known to be less than *this/2 (see the link above). if (t[i].isNegative()) { t[i] += modulo; } return std::move(t[i]); } /// Calculate the magic numbers required to implement a signed integer division /// by a constant as a sequence of multiplies, adds and shifts. Requires that /// the divisor not be 0, 1, or -1. Taken from "Hacker's Delight", Henry S. /// Warren, Jr., chapter 10. ApInt::MagicSign ApInt::getMagic() const { const ApInt& d = *this; unsigned p; ApInt ad, anc, delta, q1, r1, q2, r2, t; ApInt signedMin = ApInt::getSignedMinValue(d.getBitWidth()); struct MagicSign mag; ad = d.abs(); t = signedMin + (d.lshr(d.getBitWidth() - 1)); anc = t - 1 - t.urem(ad); // absolute value of nc p = d.getBitWidth() - 1; // initialize p q1 = signedMin.udiv(anc); // initialize q1 = 2p/abs(nc) r1 = signedMin - q1*anc; // initialize r1 = rem(2p,abs(nc)) q2 = signedMin.udiv(ad); // initialize q2 = 2p/abs(d) r2 = signedMin - q2*ad; // initialize r2 = rem(2p,abs(d)) do { p = p + 1; q1 = q1<<1; // update q1 = 2p/abs(nc) r1 = r1<<1; // update r1 = rem(2p/abs(nc)) if (r1.uge(anc)) { // must be unsigned comparison q1 = q1 + 1; r1 = r1 - anc; } q2 = q2<<1; // update q2 = 2p/abs(d) r2 = r2<<1; // update r2 = rem(2p/abs(d)) if (r2.uge(ad)) { // must be unsigned comparison q2 = q2 + 1; r2 = r2 - ad; } delta = ad - r2; } while (q1.ult(delta) || (q1 == delta && r1 == 0)); mag.m_magic = q2 + 1; if (d.isNegative()) { mag.m_magic = -mag.m_magic; // resulting magic number } mag.m_shift = p - d.getBitWidth(); // resulting shift return mag; } /// Calculate the magic numbers required to implement an unsigned integer /// division by a constant as a sequence of multiplies, adds and shifts. /// Requires that the divisor not be 0. Taken from "Hacker's Delight", Henry /// S. Warren, Jr., chapter 10. /// LeadingZeros can be used to simplify the calculation if the upper bits /// of the divided value are known zero. ApInt::MagicUnsign ApInt::getMagicUnsign(unsigned leadingZeros) const { const ApInt& d = *this; unsigned p; ApInt nc, delta, q1, r1, q2, r2; struct MagicUnsign magu; magu.m_addIndicator = 0; // initialize "add" indicator ApInt allOnes = ApInt::getAllOnesValue(d.getBitWidth()).lshr(leadingZeros); ApInt signedMin = ApInt::getSignedMinValue(d.getBitWidth()); ApInt signedMax = ApInt::getSignedMaxValue(d.getBitWidth()); nc = allOnes - (allOnes - d).urem(d); p = d.getBitWidth() - 1; // initialize p q1 = signedMin.udiv(nc); // initialize q1 = 2p/nc r1 = signedMin - q1*nc; // initialize r1 = rem(2p,nc) q2 = signedMax.udiv(d); // initialize q2 = (2p-1)/d r2 = signedMax - q2*d; // initialize r2 = rem((2p-1),d) do { p = p + 1; if (r1.uge(nc - r1)) { q1 = q1 + q1 + 1; // update q1 r1 = r1 + r1 - nc; // update r1 } else { q1 = q1+q1; // update q1 r1 = r1+r1; // update r1 } if ((r2 + 1).uge(d - r2)) { if (q2.uge(signedMax)) magu.m_addIndicator = 1; q2 = q2+q2 + 1; // update q2 r2 = r2+r2 + 1 - d; // update r2 } else { if (q2.uge(signedMin)) magu.m_addIndicator = 1; q2 = q2+q2; // update q2 r2 = r2+r2 + 1; // update r2 } delta = d - 1 - r2; } while (p < d.getBitWidth()*2 && (q1.ult(delta) || (q1 == delta && r1 == 0))); magu.m_magic = q2 + 1; // resulting magic number magu.m_shift = p - d.getBitWidth(); // resulting shift return magu; } namespace { /// Implementation of Knuth's Algorithm D (Division of nonnegative integers) /// from "Art of Computer Programming, Volume 2", section 4.3.1, p. 272. The /// variables here have the same names as in the algorithm. Comments explain /// the algorithm and any deviation from it. void knuth_div(uint32_t *u, uint32_t *v, uint32_t *q, uint32_t* r, unsigned m, unsigned n) { assert(u && "Must provide dividend"); assert(v && "Must provide divisor"); assert(q && "Must provide quotient"); assert(u != v && u != q && v != q && "Must use different memory"); assert(n>1 && "n must be > 1"); // b denotes the base of the number system. In our case b is 2^32. const uint64_t b = uint64_t(1) << 32; // The DEBUG macros here tend to be spam in the debug output if you're not // debugging this code. Disable them unless KNUTH_DEBUG is defined. #ifdef KNUTH_DEBUG #define DEBUG_KNUTH(X) POLAR_DEBUG(X) #else #define DEBUG_KNUTH(X) do {} while(false) #endif DEBUG_KNUTH(debug_stream() << "knuth_div: m=" << m << " n=" << n << '\n'); DEBUG_KNUTH(debug_stream() << "knuth_div: original:"); DEBUG_KNUTH(for (int i = m+n; i >=0; i--) debug_stream() << " " << u[i]); DEBUG_KNUTH(debug_stream() << " by"); DEBUG_KNUTH(for (int i = n; i >0; i--) debug_stream() << " " << v[i-1]); DEBUG_KNUTH(debug_stream() << '\n'); // D1. [Normalize.] Set d = b / (v[n-1] + 1) and multiply all the digits of // u and v by d. Note that we have taken Knuth's advice here to use a power // of 2 value for d such that d * v[n-1] >= b/2 (b is the base). A power of // 2 allows us to shift instead of multiply and it is easy to determine the // shift amount from the leading zeros. We are basically normalizing the u // and v so that its high bits are shifted to the top of v's range without // overflow. Note that this can require an extra word in u so that u must // be of length m+n+1. unsigned shift = count_leading_zeros(v[n-1]); uint32_t v_carry = 0; uint32_t u_carry = 0; if (shift) { for (unsigned i = 0; i < m+n; ++i) { uint32_t u_tmp = u[i] >> (32 - shift); u[i] = (u[i] << shift) | u_carry; u_carry = u_tmp; } for (unsigned i = 0; i < n; ++i) { uint32_t v_tmp = v[i] >> (32 - shift); v[i] = (v[i] << shift) | v_carry; v_carry = v_tmp; } } u[m+n] = u_carry; DEBUG_KNUTH(debug_stream() << "knuth_div: normal:"); DEBUG_KNUTH(for (int i = m+n; i >=0; i--) debug_stream() << " " << u[i]); DEBUG_KNUTH(debug_stream() << " by"); DEBUG_KNUTH(for (int i = n; i >0; i--) debug_stream() << " " << v[i-1]); DEBUG_KNUTH(debug_stream() << '\n'); // D2. [Initialize j.] Set j to m. This is the loop counter over the places. int j = m; do { DEBUG_KNUTH(debug_stream() << "knuth_div: quotient digit #" << j << '\n'); // D3. [Calculate q'.]. // Set qp = (u[j+n]*b + u[j+n-1]) / v[n-1]. (qp=qprime=q') // Set rp = (u[j+n]*b + u[j+n-1]) % v[n-1]. (rp=rprime=r') // Now test if qp == b or qp*v[n-2] > b*rp + u[j+n-2]; if so, decrease // qp by 1, increase rp by v[n-1], and repeat this test if rp < b. The test // on v[n-2] determines at high speed most of the cases in which the trial // value qp is one too large, and it eliminates all cases where qp is two // too large. uint64_t dividend = make64(u[j+n], u[j+n-1]); DEBUG_KNUTH(debug_stream() << "knuth_div: dividend == " << dividend << '\n'); uint64_t qp = dividend / v[n-1]; uint64_t rp = dividend % v[n-1]; if (qp == b || qp*v[n-2] > b*rp + u[j+n-2]) { qp--; rp += v[n-1]; if (rp < b && (qp == b || qp*v[n-2] > b*rp + u[j+n-2])) qp--; } DEBUG_KNUTH(debug_stream() << "knuth_div: qp == " << qp << ", rp == " << rp << '\n'); // D4. [Multiply and subtract.] Replace (u[j+n]u[j+n-1]...u[j]) with // (u[j+n]u[j+n-1]..u[j]) - qp * (v[n-1]...v[1]v[0]). This computation // consists of a simple multiplication by a one-place number, combined with // a subtraction. // The digits (u[j+n]...u[j]) should be kept positive; if the result of // this step is actually negative, (u[j+n]...u[j]) should be left as the // true value plus b**(n+1), namely as the b's complement of // the true value, and a "borrow" to the left should be remembered. int64_t borrow = 0; for (unsigned i = 0; i < n; ++i) { uint64_t p = uint64_t(qp) * uint64_t(v[i]); int64_t subres = int64_t(u[j+i]) - borrow - low32(p); u[j+i] = low32(subres); borrow = high32(p) - high32(subres); DEBUG_KNUTH(debug_stream() << "knuth_div: u[j+i] = " << u[j+i] << ", borrow = " << borrow << '\n'); } bool isNeg = u[j+n] < borrow; u[j+n] -= low32(borrow); DEBUG_KNUTH(debug_stream() << "knuth_div: after subtraction:"); DEBUG_KNUTH(for (int i = m+n; i >=0; i--) debug_stream() << " " << u[i]); DEBUG_KNUTH(debug_stream() << '\n'); // D5. [Test remainder.] Set q[j] = qp. If the result of step D4 was // negative, go to step D6; otherwise go on to step D7. q[j] = low32(qp); if (isNeg) { // D6. [Add back]. The probability that this step is necessary is very // small, on the order of only 2/b. Make sure that test data accounts for // this possibility. Decrease q[j] by 1 q[j]--; // and add (0v[n-1]...v[1]v[0]) to (u[j+n]u[j+n-1]...u[j+1]u[j]). // A carry will occur to the left of u[j+n], and it should be ignored // since it cancels with the borrow that occurred in D4. bool carry = false; for (unsigned i = 0; i < n; i++) { uint32_t limit = std::min(u[j+i],v[i]); u[j+i] += v[i] + carry; carry = u[j+i] < limit || (carry && u[j+i] == limit); } u[j+n] += carry; } DEBUG_KNUTH(debug_stream() << "knuth_div: after correction:"); DEBUG_KNUTH(for (int i = m+n; i >=0; i--) debug_stream() << " " << u[i]); DEBUG_KNUTH(debug_stream() << "\nknuth_div: digit result = " << q[j] << '\n'); // D7. [Loop on j.] Decrease j by one. Now if j >= 0, go back to D3. } while (--j >= 0); DEBUG_KNUTH(debug_stream() << "knuth_div: quotient:"); DEBUG_KNUTH(for (int i = m; i >=0; i--) debug_stream() <<" " << q[i]); DEBUG_KNUTH(debug_stream() << '\n'); // D8. [Unnormalize]. Now q[...] is the desired quotient, and the desired // remainder may be obtained by dividing u[...] by d. If r is non-null we // compute the remainder (urem uses this). if (r) { // The value d is expressed by the "shift" value above since we avoided // multiplication by d by using a shift left. So, all we have to do is // shift right here. if (shift) { uint32_t carry = 0; DEBUG_KNUTH(debug_stream() << "knuth_div: remainder:"); for (int i = n-1; i >= 0; i--) { r[i] = (u[i] >> shift) | carry; carry = u[i] << (32 - shift); DEBUG_KNUTH(debug_stream() << " " << r[i]); } } else { for (int i = n-1; i >= 0; i--) { r[i] = u[i]; DEBUG_KNUTH(debug_stream() << " " << r[i]); } } DEBUG_KNUTH(debug_stream() << '\n'); } DEBUG_KNUTH(debug_stream() << '\n'); } } // anonymous namespace void ApInt::divide(const WordType *lhs, unsigned lhsWords, const WordType *rhs, unsigned rhsWords, WordType *quotient, WordType *remainder) { assert(lhsWords >= rhsWords && "Fractional result"); // First, compose the values into an array of 32-bit words instead of // 64-bit words. This is a necessity of both the "short division" algorithm // and the Knuth "classical algorithm" which requires there to be native // operations for +, -, and * on an m bit value with an m*2 bit result. We // can't use 64-bit operands here because we don't have native results of // 128-bits. Furthermore, casting the 64-bit values to 32-bit values won't // work on large-endian machines. unsigned n = rhsWords * 2; unsigned m = (lhsWords * 2) - n; // Allocate space for the temporary values we need either on the stack, if // it will fit, or on the heap if it won't. uint32_t space[128]; uint32_t *U = nullptr; uint32_t *V = nullptr; uint32_t *Q = nullptr; uint32_t *R = nullptr; if ((remainder?4:3)*n+2*m+1 <= 128) { U = &space[0]; V = &space[m+n+1]; Q = &space[(m+n+1) + n]; if (remainder) R = &space[(m+n+1) + n + (m+n)]; } else { U = new uint32_t[m + n + 1]; V = new uint32_t[n]; Q = new uint32_t[m+n]; if (remainder) R = new uint32_t[n]; } // Initialize the dividend memset(U, 0, (m+n+1)*sizeof(uint32_t)); for (unsigned i = 0; i < lhsWords; ++i) { uint64_t tmp = lhs[i]; U[i * 2] = low32(tmp); U[i * 2 + 1] = high32(tmp); } U[m+n] = 0; // this extra word is for "spill" in the Knuth algorithm. // Initialize the divisor memset(V, 0, (n)*sizeof(uint32_t)); for (unsigned i = 0; i < rhsWords; ++i) { uint64_t tmp = rhs[i]; V[i * 2] = low32(tmp); V[i * 2 + 1] = high32(tmp); } // initialize the quotient and remainder memset(Q, 0, (m+n) * sizeof(uint32_t)); if (remainder) { memset(R, 0, n * sizeof(uint32_t)); } // Now, adjust m and n for the Knuth division. n is the number of words in // the divisor. m is the number of words by which the dividend exceeds the // divisor (i.e. m+n is the length of the dividend). These sizes must not // contain any zero words or the Knuth algorithm fails. for (unsigned i = n; i > 0 && V[i-1] == 0; i--) { n--; m++; } for (unsigned i = m+n; i > 0 && U[i-1] == 0; i--) { m--; } // If we're left with only a single word for the divisor, Knuth doesn't work // so we implement the short division algorithm here. This is much simpler // and faster because we are certain that we can divide a 64-bit quantity // by a 32-bit quantity at hardware speed and short division is simply a // series of such operations. This is just like doing short division but we // are using base 2^32 instead of base 10. assert(n != 0 && "Divide by zero?"); if (n == 1) { uint32_t divisor = V[0]; uint32_t remainder = 0; for (int i = m; i >= 0; i--) { uint64_t partial_dividend = make64(remainder, U[i]); if (partial_dividend == 0) { Q[i] = 0; remainder = 0; } else if (partial_dividend < divisor) { Q[i] = 0; remainder = low32(partial_dividend); } else if (partial_dividend == divisor) { Q[i] = 1; remainder = 0; } else { Q[i] = low32(partial_dividend / divisor); remainder = low32(partial_dividend - (Q[i] * divisor)); } } if (R) { R[0] = remainder; } } else { // Now we're ready to invoke the Knuth classical divide algorithm. In this // case n > 1. knuth_div(U, V, Q, R, m, n); } // If the caller wants the quotient if (quotient) { for (unsigned i = 0; i < lhsWords; ++i) { quotient[i] = make64(Q[i*2+1], Q[i*2]); } } // If the caller wants the remainder if (remainder) { for (unsigned i = 0; i < rhsWords; ++i) { remainder[i] = make64(R[i*2+1], R[i*2]); } } // Clean up the memory we allocated. if (U != &space[0]) { delete [] U; delete [] V; delete [] Q; delete [] R; } } ApInt ApInt::udiv(const ApInt &other) const { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be the same"); // First, deal with the easy case if (isSingleWord()) { assert(other.m_intValue.m_value != 0 && "Divide by zero?"); return ApInt(m_bitWidth, m_intValue.m_value / other.m_intValue.m_value); } // Get some facts about the LHS and rhs number of bits and words unsigned lhsWords = getNumWords(getActiveBits()); unsigned rhsBits = other.getActiveBits(); unsigned rhsWords = getNumWords(rhsBits); assert(rhsWords && "Divided by zero???"); // Deal with some degenerate cases if (!lhsWords) { // 0 / X ===> 0 return ApInt(m_bitWidth, 0); } if (rhsBits == 1) { // X / 1 ===> X return *this; } if (lhsWords < rhsWords || this->ult(other)) { // X / Y ===> 0, iff X < Y return ApInt(m_bitWidth, 0); } if (*this == other) { // X / X ===> 1 return ApInt(m_bitWidth, 1); } if (lhsWords == 1) {// rhsWords is 1 if lhsWords is 1. // All high words are zero, just use native divide return ApInt(m_bitWidth, this->m_intValue.m_pValue[0] / other.m_intValue.m_pValue[0]); } // We have to compute it the hard way. Invoke the Knuth divide algorithm. ApInt quotient(m_bitWidth, 0); // to hold result. divide(m_intValue.m_pValue, lhsWords, other.m_intValue.m_pValue, rhsWords, quotient.m_intValue.m_pValue, nullptr); return quotient; } ApInt ApInt::udiv(uint64_t other) const { assert(other != 0 && "Divide by zero?"); // First, deal with the easy case if (isSingleWord()) { return ApInt(m_bitWidth, m_intValue.m_value / other); } // Get some facts about the LHS words. unsigned lhsWords = getNumWords(getActiveBits()); // Deal with some degenerate cases if (!lhsWords) { // 0 / X ===> 0 return ApInt(m_bitWidth, 0); } if (other == 1) { // X / 1 ===> X return *this; } if (this->ult(other)) { // X / Y ===> 0, iff X < Y return ApInt(m_bitWidth, 0); } if (*this == other) { // X / X ===> 1 return ApInt(m_bitWidth, 1); } if (lhsWords == 1) { // rhsWords is 1 if lhsWords is 1. // All high words are zero, just use native divide return ApInt(m_bitWidth, this->m_intValue.m_pValue[0] / other); } // We have to compute it the hard way. Invoke the Knuth divide algorithm. ApInt quotient(m_bitWidth, 0); // to hold result. divide(m_intValue.m_pValue, lhsWords, &other, 1, quotient.m_intValue.m_pValue, nullptr); return quotient; } ApInt ApInt::sdiv(const ApInt &other) const { if (isNegative()) { if (other.isNegative()) { return (-(*this)).udiv(-other); } return -((-(*this)).udiv(other)); } if (other.isNegative()) { return -(this->udiv(-other)); } return this->udiv(other); } ApInt ApInt::sdiv(int64_t other) const { if (isNegative()) { if (other < 0) { return (-(*this)).udiv(-other); } return -((-(*this)).udiv(other)); } if (other < 0) { return -(this->udiv(-other)); } return this->udiv(other); } ApInt ApInt::urem(const ApInt &other) const { assert(m_bitWidth == other.m_bitWidth && "Bit widths must be the same"); if (isSingleWord()) { assert(other.m_intValue.m_value != 0 && "remainder by zero?"); return ApInt(m_bitWidth, m_intValue.m_value % other.m_intValue.m_value); } // Get some facts about the LHS unsigned lhsWords = getNumWords(getActiveBits()); // Get some facts about the rhs unsigned rhsBits = other.getActiveBits(); unsigned rhsWords = getNumWords(rhsBits); assert(rhsWords && "Performing remainder operation by zero ???"); // Check the degenerate cases if (lhsWords == 0) { // 0 % Y ===> 0 return ApInt(m_bitWidth, 0); } if (rhsBits == 1) { // X % 1 ===> 0 return ApInt(m_bitWidth, 0); } if (lhsWords < rhsWords || this->ult(other)) { // X % Y ===> X, iff X < Y return *this; } if (*this == other) { // X % X == 0; return ApInt(m_bitWidth, 0); } if (lhsWords == 1) { // All high words are zero, just use native remainder return ApInt(m_bitWidth, m_intValue.m_pValue[0] % other.m_intValue.m_pValue[0]); } // We have to compute it the hard way. Invoke the Knuth divide algorithm. ApInt remainder(m_bitWidth, 0); divide(m_intValue.m_pValue, lhsWords, other.m_intValue.m_pValue, rhsWords, nullptr, remainder.m_intValue.m_pValue); return remainder; } uint64_t ApInt::urem(uint64_t rhs) const { assert(rhs != 0 && "remainder by zero?"); if (isSingleWord()) { return m_intValue.m_value % rhs; } // Get some facts about the lhs unsigned lhsWords = getNumWords(getActiveBits()); // Check the degenerate cases if (lhsWords == 0) { // 0 % Y ===> 0 return 0; } if (rhs == 1) { // X % 1 ===> 0 return 0; } if (this->ult(rhs)) { // X % Y ===> X, iff X < Y return getZeroExtValue(); } if (*this == rhs) { // X % X == 0; return 0; } if (lhsWords == 1) { // All high words are zero, just use native remainder return m_intValue.m_pValue[0] % rhs; } // We have to compute it the hard way. Invoke the Knuth divide algorithm. uint64_t remainder; divide(m_intValue.m_pValue, lhsWords, &rhs, 1, nullptr, &remainder); return remainder; } ApInt ApInt::srem(const ApInt &rhs) const { if (isNegative()) { if (rhs.isNegative()) { return -((-(*this)).urem(-rhs)); } return -((-(*this)).urem(rhs)); } if (rhs.isNegative()) { return this->urem(-rhs); } return this->urem(rhs); } int64_t ApInt::srem(int64_t rhs) const { if (isNegative()) { if (rhs < 0) { return -((-(*this)).urem(-rhs)); } return -((-(*this)).urem(rhs)); } if (rhs < 0) { return this->urem(-rhs); } return this->urem(rhs); } void ApInt::udivrem(const ApInt &lhs, const ApInt &rhs, ApInt &quotient, ApInt &remainder) { assert(lhs.m_bitWidth == rhs.m_bitWidth && "Bit widths must be the same"); unsigned bitWidth = lhs.m_bitWidth; // First, deal with the easy case if (lhs.isSingleWord()) { assert(rhs.m_intValue.m_value != 0 && "Divide by zero?"); uint64_t quotVal = lhs.m_intValue.m_value / rhs.m_intValue.m_value; uint64_t remVal = lhs.m_intValue.m_value % rhs.m_intValue.m_value; quotient = ApInt(bitWidth, quotVal); remainder = ApInt(bitWidth, remVal); return; } // Get some size facts about the dividend and divisor unsigned lhsWords = getNumWords(lhs.getActiveBits()); unsigned rhsBits = rhs.getActiveBits(); unsigned rhsWords = getNumWords(rhsBits); assert(rhsWords && "Performing divrem operation by zero ???"); // Check the degenerate cases if (lhsWords == 0) { quotient = ApInt(bitWidth, 0); // 0 / Y ===> 0 remainder = ApInt(bitWidth, 0); // 0 % Y ===> 0 return; } if (rhsBits == 1) { quotient = lhs; // X / 1 ===> X remainder = ApInt(bitWidth, 0); // X % 1 ===> 0 } if (lhsWords < rhsWords || lhs.ult(rhs)) { remainder = lhs; // X % Y ===> X, iff X < Y quotient = ApInt(bitWidth, 0); // X / Y ===> 0, iff X < Y return; } if (lhs == rhs) { quotient = ApInt(bitWidth, 1); // X / X ===> 1 remainder = ApInt(bitWidth, 0); // X % X ===> 0; return; } // Make sure there is enough space to hold the results. // NOTE: This assumes that reallocate won't affect any bits if it doesn't // change the size. This is necessary if quotient or remainder is aliased // with lhs or rhs. quotient.reallocate(bitWidth); remainder.reallocate(bitWidth); if (lhsWords == 1) { // rhsWords is 1 if lhsWords is 1. // There is only one word to consider so use the native versions. uint64_t lhsValue = lhs.m_intValue.m_pValue[0]; uint64_t rhsValue = rhs.m_intValue.m_pValue[0]; quotient = lhsValue / rhsValue; remainder = lhsValue % rhsValue; return; } // Okay, lets do it the long way divide(lhs.m_intValue.m_pValue, lhsWords, rhs.m_intValue.m_pValue, rhsWords, quotient.m_intValue.m_pValue, remainder.m_intValue.m_pValue); // Clear the rest of the quotient and remainder. std::memset(quotient.m_intValue.m_pValue + lhsWords, 0, (getNumWords(bitWidth) - lhsWords) * APINT_WORD_SIZE); std::memset(remainder.m_intValue.m_pValue + rhsWords, 0, (getNumWords(bitWidth) - rhsWords) * APINT_WORD_SIZE); } void ApInt::udivrem(const ApInt &lhs, uint64_t rhs, ApInt &quotient, uint64_t &remainder) { assert(rhs != 0 && "Divide by zero?"); unsigned bitWidth = lhs.m_bitWidth; // First, deal with the easy case if (lhs.isSingleWord()) { uint64_t quotVal = lhs.m_intValue.m_value / rhs; remainder = lhs.m_intValue.m_value % rhs; quotient = ApInt(bitWidth, quotVal); return; } // Get some size facts about the dividend and divisor unsigned lhsWords = getNumWords(lhs.getActiveBits()); // Check the degenerate cases if (lhsWords == 0) { quotient = ApInt(bitWidth, 0); // 0 / Y ===> 0 remainder = 0; // 0 % Y ===> 0 return; } if (rhs == 1) { quotient = lhs; // X / 1 ===> X remainder = 0; // X % 1 ===> 0 } if (lhs.ult(rhs)) { remainder = lhs.getZeroExtValue(); // X % Y ===> X, iff X < Y quotient = ApInt(bitWidth, 0); // X / Y ===> 0, iff X < Y return; } if (lhs == rhs) { quotient = ApInt(bitWidth, 1); // X / X ===> 1 remainder = 0; // X % X ===> 0; return; } // Make sure there is enough space to hold the results. // NOTE: This assumes that reallocate won't affect any bits if it doesn't // change the size. This is necessary if quotient is aliased with lhs. quotient.reallocate(bitWidth); if (lhsWords == 1) { // rhsWords is 1 if lhsWords is 1. // There is only one word to consider so use the native versions. uint64_t lhsValue = lhs.m_intValue.m_pValue[0]; quotient = lhsValue / rhs; remainder = lhsValue % rhs; return; } // Okay, lets do it the long way divide(lhs.m_intValue.m_pValue, lhsWords, &rhs, 1, quotient.m_intValue.m_pValue, &remainder); // Clear the rest of the quotient. std::memset(quotient.m_intValue.m_pValue + lhsWords, 0, (getNumWords(bitWidth) - lhsWords) * APINT_WORD_SIZE); } void ApInt::sdivrem(const ApInt &lhs, const ApInt &rhs, ApInt &quotient, ApInt &remainder) { if (lhs.isNegative()) { if (rhs.isNegative()) ApInt::udivrem(-lhs, -rhs, quotient, remainder); else { ApInt::udivrem(-lhs, rhs, quotient, remainder); quotient.negate(); } remainder.negate(); } else if (rhs.isNegative()) { ApInt::udivrem(lhs, -rhs, quotient, remainder); quotient.negate(); } else { ApInt::udivrem(lhs, rhs, quotient, remainder); } } void ApInt::sdivrem(const ApInt &lhs, int64_t rhs, ApInt &quotient, int64_t &remainder) { uint64_t ret = remainder; if (lhs.isNegative()) { if (rhs < 0) ApInt::udivrem(-lhs, -rhs, quotient, ret); else { ApInt::udivrem(-lhs, rhs, quotient, ret); quotient.negate(); } ret = -ret; } else if (rhs < 0) { ApInt::udivrem(lhs, -rhs, quotient, ret); quotient.negate(); } else { ApInt::udivrem(lhs, rhs, quotient, ret); } remainder = ret; } ApInt ApInt::saddOverflow(const ApInt &rhs, bool &overflow) const { ApInt res = *this+rhs; overflow = isNonNegative() == rhs.isNonNegative() && res.isNonNegative() != isNonNegative(); return res; } ApInt ApInt::uaddOverflow(const ApInt &rhs, bool &overflow) const { ApInt res = *this+rhs; overflow = res.ult(rhs); return res; } ApInt ApInt::ssubOverflow(const ApInt &rhs, bool &overflow) const { ApInt res = *this - rhs; overflow = isNonNegative() != rhs.isNonNegative() && res.isNonNegative() != isNonNegative(); return res; } ApInt ApInt::usubOverflow(const ApInt &rhs, bool &overflow) const { ApInt res = *this-rhs; overflow = res.ugt(*this); return res; } ApInt ApInt::sdivOverflow(const ApInt &rhs, bool &overflow) const { // MININT/-1 --> overflow. overflow = isMinSignedValue() && rhs.isAllOnesValue(); return sdiv(rhs); } ApInt ApInt::smulOverflow(const ApInt &rhs, bool &overflow) const { ApInt res = *this * rhs; if (*this != 0 && rhs != 0) { overflow = res.sdiv(rhs) != *this || res.sdiv(*this) != rhs; } else { overflow = false; } return res; } ApInt ApInt::umulOverflow(const ApInt &rhs, bool &overflow) const { ApInt res = *this * rhs; if (*this != 0 && rhs != 0) { overflow = res.udiv(rhs) != *this || res.udiv(*this) != rhs; } else { overflow = false; } return res; } ApInt ApInt::sshlOverflow(const ApInt &shAmt, bool &overflow) const { overflow = shAmt.uge(getBitWidth()); if (overflow) { return ApInt(m_bitWidth, 0); } if (isNonNegative()) {// Don't allow sign change. overflow = shAmt.uge(countLeadingZeros()); } else { overflow = shAmt.uge(countLeadingOnes()); } return *this << shAmt; } ApInt ApInt::ushlOverflow(const ApInt &shAmt, bool &overflow) const { overflow = shAmt.uge(getBitWidth()); if (overflow) { return ApInt(m_bitWidth, 0); } overflow = shAmt.ugt(countLeadingZeros()); return *this << shAmt; } ApInt ApInt::saddSaturate(const ApInt &rhs) const { bool overflow; ApInt result = saddOverflow(rhs, overflow); if (!overflow) { return result; } return isNegative() ? ApInt::getSignedMinValue(m_bitWidth) : ApInt::getSignedMaxValue(m_bitWidth); } ApInt ApInt::uaddSaturate(const ApInt &rhs) const { bool overflow; ApInt result = uaddOverflow(rhs, overflow); if (!overflow) { return result; } return ApInt::getMaxValue(m_bitWidth); } ApInt ApInt::ssubSaturate(const ApInt &rhs) const { bool overflow; ApInt result = ssubOverflow(rhs, overflow); if (!overflow) { return result; } return isNegative() ? ApInt::getSignedMinValue(m_bitWidth) : ApInt::getSignedMaxValue(m_bitWidth); } ApInt ApInt::usubSaturate(const ApInt &rhs) const { bool overflow; ApInt result = usubOverflow(rhs, overflow); if (!overflow) { return result; } return ApInt(m_bitWidth, 0); } void ApInt::fromString(unsigned numbits, StringRef str, uint8_t radix) { // Check our assumptions here assert(!str.empty() && "Invalid string length"); assert((radix == 10 || radix == 8 || radix == 16 || radix == 2 || radix == 36) && "Radix should be 2, 8, 10, 16, or 36!"); StringRef::iterator p = str.begin(); size_t slen = str.getSize(); bool isNeg = *p == '-'; if (*p == '-' || *p == '+') { p++; slen--; assert(slen && "String is only a sign, needs a value."); } assert((slen <= numbits || radix != 2) && "Insufficient bit width"); assert(((slen-1)*3 <= numbits || radix != 8) && "Insufficient bit width"); assert(((slen-1)*4 <= numbits || radix != 16) && "Insufficient bit width"); assert((((slen-1)*64)/22 <= numbits || radix != 10) && "Insufficient bit width"); // Allocate memory if needed if (isSingleWord()) { m_intValue.m_value = 0; } else { m_intValue.m_pValue = get_cleared_memory(getNumWords()); } // Figure out if we can shift instead of multiply unsigned shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0); // Enter digit traversal loop for (StringRef::iterator e = str.end(); p != e; ++p) { unsigned digit = get_digit(*p, radix); assert(digit < radix && "Invalid character in digit string"); // Shift or multiply the value by the radix if (slen > 1) { if (shift) { *this <<= shift; } else { *this *= radix; } } // Add in the digit we just interpreted *this += digit; } // If its negative, put it in two's complement form if (isNeg) { this->negate(); } } void ApInt::toString(SmallVectorImpl<char> &str, unsigned radix, bool isSigned, bool formatAsCLiteral) const { assert((radix == 10 || radix == 8 || radix == 16 || radix == 2 || radix == 36) && "Radix should be 2, 8, 10, 16, or 36!"); const char *prefix = ""; if (formatAsCLiteral) { switch (radix) { case 2: // Binary literals are a non-standard extension added in gcc 4.3: // http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Binary-constants.html prefix = "0b"; break; case 8: prefix = "0"; break; case 10: break; // No prefix case 16: prefix = "0x"; break; default: polar_unreachable("Invalid radix!"); } } // First, check for a zero value and just short circuit the logic below. if (*this == 0) { while (*prefix) { str.push_back(*prefix); ++prefix; }; str.push_back('0'); return; } static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (isSingleWord()) { char buffer[65]; char *bufPtr = std::end(buffer); uint64_t num; if (!isSigned) { num = getZeroExtValue(); } else { int64_t intValue = getSignExtValue(); if (intValue >= 0) { num = intValue; } else { str.push_back('-'); num = -(uint64_t)intValue; } } while (*prefix) { str.push_back(*prefix); ++prefix; }; while (num) { *--bufPtr = digits[num % radix]; num /= radix; } str.append(bufPtr, std::end(buffer)); return; } ApInt temp(*this); if (isSigned && isNegative()) { // They want to print the signed version and it is a negative value // Flip the bits and add one to turn it into the equivalent positive // value and put a '-' in the result. temp.negate(); str.push_back('-'); } while (*prefix) { str.push_back(*prefix); ++prefix; }; // We insert the digits backward, then reverse them to get the right order. unsigned startDig = str.getSize(); // For the 2, 8 and 16 bit cases, we can just shift instead of divide // because the number of bits per digit (1, 3 and 4 respectively) divides // equally. We just shift until the value is zero. if (radix == 2 || radix == 8 || radix == 16) { // Just shift tmp right for each digit width until it becomes zero unsigned shiftAmt = (radix == 16 ? 4 : (radix == 8 ? 3 : 1)); unsigned maskAmt = radix - 1; while (temp.getBoolValue()) { unsigned digit = unsigned(temp.getRawData()[0]) & maskAmt; str.push_back(digits[digit]); temp.lshrInPlace(shiftAmt); } } else { while (temp.getBoolValue()) { uint64_t digit; udivrem(temp, radix, temp, digit); assert(digit < radix && "divide failed"); str.push_back(digits[digit]); } } // Reverse the digits before returning. std::reverse(str.begin()+startDig, str.end()); } /// Returns the ApInt as a std::string. Note that this is an inefficient method. /// It is better to pass in a SmallVector/SmallString to the methods above. std::string ApInt::toString(unsigned radix = 10, bool isSigned = true) const { SmallString<40> str; toString(str, radix, isSigned, /* formatAsCLiteral = */false); return str.getStr(); } #if !defined(NDEBUG) || defined(POLAR_ENABLE_DUMP) POLAR_DUMP_METHOD void ApInt::dump() const { SmallString<40> str, unsigedStr; this->toStringUnsigned(unsigedStr); this->toStringSigned(str); debug_stream() << "ApInt(" << m_bitWidth << "b, " << unsigedStr << "u " << str << "s)\n"; } #endif void ApInt::print(RawOutStream &outstream, bool isSigned) const { SmallString<40> str; this->toString(str, 10, isSigned, /* formatAsCLiteral = */false); outstream << str; } namespace { // This implements a variety of operations on a representation of // arbitrary precision, two's-complement, bignum integer values. // Assumed by low_half, high_half, part_msb and part_lsb. A fairly safe // and unrestricting assumption. static_assert(ApInt::APINT_BITS_PER_WORD % 2 == 0, "Part width must be divisible by 2!"); /* Some handy functions local to this file. */ /* Returns the integer part with the least significant BITS set. BITS cannot be zero. */ inline ApInt::WordType low_bit_mask(unsigned bits) { assert(bits != 0 && bits <= ApInt::APINT_BITS_PER_WORD); return ~(ApInt::WordType) 0 >> (ApInt::APINT_BITS_PER_WORD - bits); } /* Returns the value of the lower half of PART. */ inline ApInt::WordType low_half(ApInt::WordType part) { return part & low_bit_mask(ApInt::APINT_BITS_PER_WORD / 2); } /* Returns the value of the upper half of PART. */ inline ApInt::WordType high_half(ApInt::WordType part) { return part >> (ApInt::APINT_BITS_PER_WORD / 2); } /* Returns the bit number of the most significant set bit of a part. If the input number has no bits set -1U is returned. */ unsigned part_msb(ApInt::WordType value) { return find_last_set(value, ZeroBehavior::ZB_Max); } /* Returns the bit number of the least significant set bit of a part. If the input number has no bits set -1U is returned. */ unsigned part_lsb(ApInt::WordType value) { return find_first_set(value, ZeroBehavior::ZB_Max); } } // anonymous namespace /* Sets the least significant part of a bignum to the input value, and zeroes out higher parts. */ void ApInt::tcSet(WordType *dst, WordType part, unsigned parts) { assert(parts > 0); dst[0] = part; for (unsigned i = 1; i < parts; i++) { dst[i] = 0; } } /* Assign one bignum to another. */ void ApInt::tcAssign(WordType *dst, const WordType *src, unsigned parts) { for (unsigned i = 0; i < parts; i++) { dst[i] = src[i]; } } /* Returns true if a bignum is zero, false otherwise. */ bool ApInt::tcIsZero(const WordType *src, unsigned parts) { for (unsigned i = 0; i < parts; i++) { if (src[i]) { return false; } } return true; } /* Extract the given bit of a bignum; returns 0 or 1. */ int ApInt::tcExtractBit(const WordType *parts, unsigned bit) { return (parts[whichWord(bit)] & maskBit(bit)) != 0; } /* Set the given bit of a bignum. */ void ApInt::tcSetBit(WordType *parts, unsigned bit) { parts[whichWord(bit)] |= maskBit(bit); } /* Clears the given bit of a bignum. */ void ApInt::tcClearBit(WordType *parts, unsigned bit) { parts[whichWord(bit)] &= ~maskBit(bit); } /* Returns the bit number of the least significant set bit of a number. If the input number has no bits set -1U is returned. */ unsigned ApInt::tcLsb(const WordType *parts, unsigned n) { for (unsigned i = 0; i < n; i++) { if (parts[i] != 0) { unsigned lsb = part_lsb(parts[i]); return lsb + i * APINT_BITS_PER_WORD; } } return -1U; } /* Returns the bit number of the most significant set bit of a number. If the input number has no bits set -1U is returned. */ unsigned ApInt::tcMsb(const WordType *parts, unsigned n) { do { --n; if (parts[n] != 0) { unsigned msb = part_msb(parts[n]); return msb + n * APINT_BITS_PER_WORD; } } while (n); return -1U; } /* Copy the bit vector of width srcBITS from SRC, starting at bit srcLSB, to DST, of dstCOUNT parts, such that the bit srcLSB becomes the least significant bit of DST. All high bits above srcBITS in DST are zero-filled. */ void ApInt::tcExtract(WordType *dst, unsigned dstCount, const WordType *src, unsigned srcBits, unsigned srcLSB) { unsigned dstParts = (srcBits + APINT_BITS_PER_WORD - 1) / APINT_BITS_PER_WORD; assert(dstParts <= dstCount); unsigned firstSrcPart = srcLSB / APINT_BITS_PER_WORD; tcAssign (dst, src + firstSrcPart, dstParts); unsigned shift = srcLSB % APINT_BITS_PER_WORD; tcShiftRight (dst, dstParts, shift); /* We now have (dstParts * APINT_BITS_PER_WORD - shift) bits from SRC in DST. If this is less that srcBits, append the rest, else clear the high bits. */ unsigned n = dstParts * APINT_BITS_PER_WORD - shift; if (n < srcBits) { WordType mask = low_bit_mask(srcBits - n); dst[dstParts - 1] |= ((src[firstSrcPart + dstParts] & mask) << n % APINT_BITS_PER_WORD); } else if (n > srcBits) { if (srcBits % APINT_BITS_PER_WORD) { dst[dstParts - 1] &= low_bit_mask(srcBits % APINT_BITS_PER_WORD); } } /* Clear high parts. */ while (dstParts < dstCount) { dst[dstParts++] = 0; } } /* DST += rhs + C where C is zero or one. Returns the carry flag. */ ApInt::WordType ApInt::tcAdd(WordType *dst, const WordType *rhs, WordType c, unsigned parts) { assert(c <= 1); for (unsigned i = 0; i < parts; i++) { WordType l = dst[i]; if (c) { dst[i] += rhs[i] + 1; c = (dst[i] <= l); } else { dst[i] += rhs[i]; c = (dst[i] < l); } } return c; } /// This function adds a single "word" integer, src, to the multiple /// "word" integer array, dst[]. dst[] is modified to reflect the addition and /// 1 is returned if there is a carry out, otherwise 0 is returned. /// @returns the carry of the addition. ApInt::WordType ApInt::tcAddPart(WordType *dst, WordType src, unsigned parts) { for (unsigned i = 0; i < parts; ++i) { dst[i] += src; if (dst[i] >= src) { return 0; // No need to carry so exit early. } src = 1; // Carry one to next digit. } return 1; } /* DST -= rhs + C where C is zero or one. Returns the carry flag. */ ApInt::WordType ApInt::tcSubtract(WordType *dst, const WordType *rhs, WordType c, unsigned parts) { assert(c <= 1); for (unsigned i = 0; i < parts; i++) { WordType l = dst[i]; if (c) { dst[i] -= rhs[i] + 1; c = (dst[i] >= l); } else { dst[i] -= rhs[i]; c = (dst[i] > l); } } return c; } /// This function subtracts a single "word" (64-bit word), src, from /// the multi-word integer array, dst[], propagating the borrowed 1 value until /// no further borrowing is needed or it runs out of "words" in dst. The result /// is 1 if "borrowing" exhausted the digits in dst, or 0 if dst was not /// exhausted. In other words, if src > dst then this function returns 1, /// otherwise 0. /// @returns the borrow out of the subtraction ApInt::WordType ApInt::tcSubtractPart(WordType *dest, WordType src, unsigned parts) { for (unsigned i = 0; i < parts; ++i) { WordType item = dest[i]; dest[i] -= src; if (src <= item) { return 0; // No need to borrow so exit early. } src = 1; // We have to "borrow 1" from next "word" } return 1; } /* Negate a bignum in-place. */ void ApInt::tcNegate(WordType *dst, unsigned parts) { tcComplement(dst, parts); tcIncrement(dst, parts); } /* DST += SRC * MULTIPLIER + CARRY if add is true DST = SRC * MULTIPLIER + CARRY if add is false Requires 0 <= DSTPARTS <= SRCPARTS + 1. If DST overlaps SRC they must start at the same point, i.e. DST == SRC. If DSTPARTS == SRCPARTS + 1 no overflow occurs and zero is returned. Otherwise DST is filled with the least significant DSTPARTS parts of the result, and if all of the omitted higher parts were zero return zero, otherwise overflow occurred and return one. */ int ApInt::tcMultiplyPart(WordType *dst, const WordType *src, WordType multiplier, WordType carry, unsigned srcParts, unsigned dstParts, bool add) { /* Otherwise our writes of DST kill our later reads of SRC. */ assert(dst <= src || dst >= src + srcParts); assert(dstParts <= srcParts + 1); /* N loops; minimum of dstParts and srcParts. */ unsigned n = std::min(dstParts, srcParts); for (unsigned i = 0; i < n; i++) { WordType low, mid, high, srcPart; /* [ LOW, HIGH ] = MULTIPLIER * SRC[i] + DST[i] + CARRY. This cannot overflow, because (n - 1) * (n - 1) + 2 (n - 1) = (n - 1) * (n + 1) which is less than n^2. */ srcPart = src[i]; if (multiplier == 0 || srcPart == 0) { low = carry; high = 0; } else { low = low_half(srcPart) * low_half(multiplier); high = high_half(srcPart) * high_half(multiplier); mid = low_half(srcPart) * high_half(multiplier); high += high_half(mid); mid <<= APINT_BITS_PER_WORD / 2; if (low + mid < low) high++; low += mid; mid = high_half(srcPart) * low_half(multiplier); high += high_half(mid); mid <<= APINT_BITS_PER_WORD / 2; if (low + mid < low) { high++; } low += mid; /* Now add carry. */ if (low + carry < low) { high++; } low += carry; } if (add) { /* And now DST[i], and store the new low part there. */ if (low + dst[i] < low) { high++; } dst[i] += low; } else { dst[i] = low; } carry = high; } if (srcParts < dstParts) { /* Full multiplication, there is no overflow. */ assert(srcParts + 1 == dstParts); dst[srcParts] = carry; return 0; } /* We overflowed if there is carry. */ if (carry) return 1; /* We would overflow if any significant unwritten parts would be non-zero. This is true if any remaining src parts are non-zero and the multiplier is non-zero. */ if (multiplier) { for (unsigned i = dstParts; i < srcParts; i++) { if (src[i]) { return 1; } } } /* We fitted in the narrow destination. */ return 0; } /* DST = lhs * rhs, where DST has the same width as the operands and is filled with the least significant parts of the result. Returns one if overflow occurred, otherwise zero. DST must be disjoint from both operands. */ int ApInt::tcMultiply(WordType *dst, const WordType *lhs, const WordType *rhs, unsigned parts) { assert(dst != lhs && dst != rhs); int overflow = 0; tcSet(dst, 0, parts); for (unsigned i = 0; i < parts; i++) { overflow |= tcMultiplyPart(&dst[i], lhs, rhs[i], 0, parts, parts - i, true); } return overflow; } /// DST = lhs * rhs, where DST has width the sum of the widths of the /// operands. No overflow occurs. DST must be disjoint from both operands. void ApInt::tcFullMultiply(WordType *dst, const WordType *lhs, const WordType *rhs, unsigned lhsParts, unsigned rhsParts) { /* Put the narrower number on the lhs for less loops below. */ if (lhsParts > rhsParts) { return tcFullMultiply (dst, rhs, lhs, rhsParts, lhsParts); } assert(dst != lhs && dst != rhs); tcSet(dst, 0, rhsParts); for (unsigned i = 0; i < lhsParts; i++) { tcMultiplyPart(&dst[i], rhs, lhs[i], 0, rhsParts, rhsParts + 1, true); } } /* If rhs is zero lhs and remainder are left unchanged, return one. Otherwise set lhs to lhs / rhs with the fractional part discarded, set remainder to the remainder, return zero. i.e. OLD_lhs = rhs * lhs + remainder SCRATCH is a bignum of the same size as the operands and result for use by the routine; its contents need not be initialized and are destroyed. lhs, remainder and SCRATCH must be distinct. */ int ApInt::tcDivide(WordType *lhs, const WordType *rhs, WordType *remainder, WordType *scratch, unsigned parts) { assert(lhs != remainder && lhs != scratch && remainder != scratch); unsigned shiftCount = tcMsb(rhs, parts) + 1; if (shiftCount == 0) { return true; } shiftCount = parts * APINT_BITS_PER_WORD - shiftCount; unsigned n = shiftCount / APINT_BITS_PER_WORD; WordType mask = (WordType) 1 << (shiftCount % APINT_BITS_PER_WORD); tcAssign(scratch, rhs, parts); tcShiftLeft(scratch, parts, shiftCount); tcAssign(remainder, lhs, parts); tcSet(lhs, 0, parts); /* Loop, subtracting scratch if remainder is greater and adding that to the total. */ for (;;) { int compare = tcCompare(remainder, scratch, parts); if (compare >= 0) { tcSubtract(remainder, scratch, 0, parts); lhs[n] |= mask; } if (shiftCount == 0) { break; } shiftCount--; tcShiftRight(scratch, parts, 1); if ((mask >>= 1) == 0) { mask = (WordType) 1 << (APINT_BITS_PER_WORD - 1); n--; } } return false; } /// Shift a bignum left Cound bits in-place. Shifted in bits are zero. There are /// no restrictions on count. void ApInt::tcShiftLeft(WordType *dst, unsigned words, unsigned count) { // Don't bother performing a no-op shift. if (!count) { return; } // wordshift is the inter-part shift; BitShift is the intra-part shift. unsigned wordshift = std::min(count / APINT_BITS_PER_WORD, words); unsigned bitShift = count % APINT_BITS_PER_WORD; // Fastpath for moving by whole words. if (bitShift == 0) { std::memmove(dst + wordshift, dst, (words - wordshift) * APINT_WORD_SIZE); } else { while (words-- > wordshift) { dst[words] = dst[words - wordshift] << bitShift; if (words > wordshift) { dst[words] |= dst[words - wordshift - 1] >> (APINT_BITS_PER_WORD - bitShift); } } } // Fill in the remainder with 0s. std::memset(dst, 0, wordshift * APINT_WORD_SIZE); } /// Shift a bignum right count bits in-place. Shifted in bits are zero. There /// are no restrictions on count. void ApInt::tcShiftRight(WordType *dest, unsigned words, unsigned count) { // Don't bother performing a no-op shift. if (!count) { return; } // wordshift is the inter-part shift; BitShift is the intra-part shift. unsigned wordshift = std::min(count / APINT_BITS_PER_WORD, words); unsigned bitShift = count % APINT_BITS_PER_WORD; unsigned wordsToMove = words - wordshift; // Fastpath for moving by whole words. if (bitShift == 0) { std::memmove(dest, dest + wordshift, wordsToMove * APINT_WORD_SIZE); } else { for (unsigned i = 0; i != wordsToMove; ++i) { dest[i] = dest[i + wordshift] >> bitShift; if (i + 1 != wordsToMove) { dest[i] |= dest[i + wordshift + 1] << (APINT_BITS_PER_WORD - bitShift); } } } // Fill in the remainder with 0s. std::memset(dest + wordsToMove, 0, wordshift * APINT_WORD_SIZE); } /* Bitwise and of two bignums. */ void ApInt::tcAnd(WordType *dst, const WordType *rhs, unsigned parts) { for (unsigned i = 0; i < parts; i++) { dst[i] &= rhs[i]; } } /* Bitwise inclusive or of two bignums. */ void ApInt::tcOr(WordType *dst, const WordType *rhs, unsigned parts) { for (unsigned i = 0; i < parts; i++) { dst[i] |= rhs[i]; } } /* Bitwise exclusive or of two bignums. */ void ApInt::tcXor(WordType *dst, const WordType *rhs, unsigned parts) { for (unsigned i = 0; i < parts; i++) { dst[i] ^= rhs[i]; } } /* Complement a bignum in-place. */ void ApInt::tcComplement(WordType *dst, unsigned parts) { for (unsigned i = 0; i < parts; i++) { dst[i] = ~dst[i]; } } /* Comparison (unsigned) of two bignums. */ int ApInt::tcCompare(const WordType *lhs, const WordType *rhs, unsigned parts) { while (parts) { parts--; if (lhs[parts] != rhs[parts]) { return (lhs[parts] > rhs[parts]) ? 1 : -1; } } return 0; } /* Set the least significant BITS bits of a bignum, clear the rest. */ void ApInt::tcSetLeastSignificantBits(WordType *dst, unsigned parts, unsigned bits) { unsigned i = 0; while (bits > APINT_BITS_PER_WORD) { dst[i++] = ~(WordType) 0; bits -= APINT_BITS_PER_WORD; } if (bits) { dst[i++] = ~(WordType) 0 >> (APINT_BITS_PER_WORD - bits); } while (i < parts) { dst[i++] = 0; } } ApInt apintops::rounding_udiv(const ApInt &lhs, const ApInt &rhs, ApInt::Rounding rm) { // Currently udivrem always rounds down. switch (rm) { case ApInt::Rounding::DOWN: case ApInt::Rounding::TOWARD_ZERO: return lhs.udiv(rhs); case ApInt::Rounding::UP: { ApInt quo, rem; ApInt::udivrem(lhs, rhs, quo, rem); if (rem == 0) return quo; return quo + 1; } } polar_unreachable("Unknown ApInt::Rounding enum"); } ApInt apintops::rounding_sdiv(const ApInt &lhs, const ApInt &rhs, ApInt::Rounding rm) { switch (rm) { case ApInt::Rounding::DOWN: case ApInt::Rounding::UP: { ApInt quo, rem; ApInt::sdivrem(lhs, rhs, quo, rem); if (rem == 0) return quo; // This algorithm deals with arbitrary rounding mode used by sdivrem. // We want to check whether the non-integer part of the mathematical value // is negative or not. If the non-integer part is negative, we need to round // down from quo; otherwise, if it's positive or 0, we return quo, as it's // already rounded down. if (rm == ApInt::Rounding::DOWN) { if (rem.isNegative() != rhs.isNegative()) { return quo - 1; } return quo; } if (rem.isNegative() != rhs.isNegative()) { return quo; } return quo + 1; } // Currently sdiv rounds twards zero. case ApInt::Rounding::TOWARD_ZERO: return lhs.sdiv(rhs); } polar_unreachable("Unknown ApInt::Rounding enum"); } std::optional<ApInt> apintops::solve_quadratic_equation_wrap(ApInt A, ApInt B, ApInt C, unsigned rangeWidth) { unsigned CoeffWidth = A.getBitWidth(); assert(CoeffWidth == B.getBitWidth() && CoeffWidth == C.getBitWidth()); assert(rangeWidth <= CoeffWidth && "Value range width should be less than coefficient width"); assert(rangeWidth > 1 && "Value range bit width should be > 1"); POLAR_DEBUG(debug_stream() << __func__ << ": solving " << A << "x^2 + " << B << "x + " << C << ", rw:" << rangeWidth << '\n'); // Identify 0 as a (non)solution immediately. if (C.sextOrTrunc(rangeWidth).isNullValue() ) { POLAR_DEBUG(debug_stream() << __func__ << ": zero solution\n"); return ApInt(CoeffWidth, 0); } // The result of ApInt arithmetic has the same bit width as the operands, // so it can actually lose high bits. A product of two n-bit integers needs // 2n-1 bits to represent the full value. // The operation done below (on quadratic coefficients) that can produce // the largest value is the evaluation of the equation during bisection, // which needs 3 times the bitwidth of the coefficient, so the total number // of required bits is 3n. // // The purpose of this extension is to simulate the set Z of all integers, // where n+1 > n for all n in Z. In Z it makes sense to talk about positive // and negative numbers (not so much in a modulo arithmetic). The method // used to solve the equation is based on the standard formula for real // numbers, and uses the concepts of "positive" and "negative" with their // usual meanings. CoeffWidth *= 3; A = A.sext(CoeffWidth); B = B.sext(CoeffWidth); C = C.sext(CoeffWidth); // Make A > 0 for simplicity. Negate cannot overflow at this point because // the bit width has increased. if (A.isNegative()) { A.negate(); B.negate(); C.negate(); } // Solving an equation q(x) = 0 with coefficients in modular arithmetic // is really solving a set of equations q(x) = kR for k = 0, 1, 2, ..., // and R = 2^m_bitWidth. // Since we're trying not only to find exact solutions, but also values // that "wrap around", such a set will always have a solution, i.e. an x // that satisfies at least one of the equations, or such that |q(x)| // exceeds kR, while |q(x-1)| for the same k does not. // // We need to find a value k, such that Ax^2 + Bx + C = kR will have a // positive solution n (in the above sense), and also such that the n // will be the least among all solutions corresponding to k = 0, 1, ... // (more precisely, the least element in the set // { n(k) | k is such that a solution n(k) exists }). // // Consider the parabola (over real numbers) that corresponds to the // quadratic equation. Since A > 0, the arms of the parabola will point // up. Picking different values of k will shift it up and down by R. // // We want to shift the parabola in such a way as to reduce the problem // of solving q(x) = kR to solving shifted_q(x) = 0. // (The interesting solutions are the ceilings of the real number // solutions.) ApInt R = ApInt::getOneBitSet(CoeffWidth, rangeWidth); ApInt TwoA = 2 * A; ApInt SqrB = B * B; bool PickLow; auto RoundUp = [] (const ApInt &V, const ApInt &A) -> ApInt { assert(A.isStrictlyPositive()); ApInt T = V.abs().urem(A); if (T.isNullValue()) { return V; } return V.isNegative() ? V+T : V+(A-T); }; // The vertex of the parabola is at -B/2A, but since A > 0, it's negative // iff B is positive. if (B.isNonNegative()) { // If B >= 0, the vertex it at a negative location (or at 0), so in // order to have a non-negative solution we need to pick k that makes // C-kR negative. To satisfy all the requirements for the solution // that we are looking for, it needs to be closest to 0 of all k. C = C.srem(R); if (C.isStrictlyPositive()) { C -= R; } // Pick the greater solution. PickLow = false; } else { // If B < 0, the vertex is at a positive location. For any solution // to exist, the discriminant must be non-negative. This means that // C-kR <= B^2/4A is a necessary condition for k, i.e. there is a // lower bound on values of k: kR >= C - B^2/4A. ApInt LowkR = C - SqrB.udiv(2*TwoA); // udiv because all values > 0. // Round LowkR up (towards +inf) to the nearest kR. LowkR = RoundUp(LowkR, R); // If there exists k meeting the condition above, and such that // C-kR > 0, there will be two positive real number solutions of // q(x) = kR. Out of all such values of k, pick the one that makes // C-kR closest to 0, (i.e. pick maximum k such that C-kR > 0). // In other words, find maximum k such that LowkR <= kR < C. if (C.sgt(LowkR)) { // If LowkR < C, then such a k is guaranteed to exist because // LowkR itself is a multiple of R. C -= -RoundUp(-C, R); // C = C - RoundDown(C, R) // Pick the smaller solution. PickLow = true; } else { // If C-kR < 0 for all potential k's, it means that one solution // will be negative, while the other will be positive. The positive // solution will shift towards 0 if the parabola is moved up. // Pick the kR closest to the lower bound (i.e. make C-kR closest // to 0, or in other words, out of all parabolas that have solutions, // pick the one that is the farthest "up"). // Since LowkR is itself a multiple of R, simply take C-LowkR. C -= LowkR; // Pick the greater solution. PickLow = false; } } POLAR_DEBUG(debug_stream() << __func__ << ": updated coefficients " << A << "x^2 + " << B << "x + " << C << ", rw:" << rangeWidth << '\n'); ApInt D = SqrB - 4*A*C; assert(D.isNonNegative() && "Negative discriminant"); ApInt SQ = D.sqrt(); ApInt Q = SQ * SQ; bool InexactSQ = Q != D; // The calculated SQ may actually be greater than the exact (non-integer) // value. If that's the case, decremement SQ to get a value that is lower. if (Q.sgt(D)) { SQ -= 1; } ApInt X; ApInt Rem; // SQ is rounded down (i.e SQ * SQ <= D), so the roots may be inexact. // When using the quadratic formula directly, the calculated low root // may be greater than the exact one, since we would be subtracting SQ. // To make sure that the calculated root is not greater than the exact // one, subtract SQ+1 when calculating the low root (for inexact value // of SQ). if (PickLow) { ApInt::sdivrem(-B - (SQ+InexactSQ), TwoA, X, Rem); } else { ApInt::sdivrem(-B + SQ, TwoA, X, Rem); } // The updated coefficients should be such that the (exact) solution is // positive. Since ApInt division rounds towards 0, the calculated one // can be 0, but cannot be negative. assert(X.isNonNegative() && "Solution should be non-negative"); if (!InexactSQ && Rem.isNullValue()) { POLAR_DEBUG(debug_stream() << __func__ << ": solution (root): " << X << '\n'); return X; } assert((SQ*SQ).sle(D) && "SQ = |_sqrt(D)_|, so SQ*SQ <= D"); // The exact value of the square root of D should be between SQ and SQ+1. // This implies that the solution should be between that corresponding to // SQ (i.e. X) and that corresponding to SQ+1. // // The calculated X cannot be greater than the exact (real) solution. // Actually it must be strictly less than the exact solution, while // X+1 will be greater than or equal to it. ApInt VX = (A*X + B)*X + C; ApInt VY = VX + TwoA*X + A + B; bool SignChange = VX.isNegative() != VY.isNegative() || VX.isNullValue() != VY.isNullValue(); // If the sign did not change between X and X+1, X is not a valid solution. // This could happen when the actual (exact) roots don't have an integer // between them, so they would both be contained between X and X+1. if (!SignChange) { POLAR_DEBUG(debug_stream() << __func__ << ": no valid solution\n"); return std::nullopt; } X += 1; POLAR_DEBUG(debug_stream() << __func__ << ": solution (wrap): " << X << '\n'); return X; } } // basic } // polar
35.688656
118
0.613704
[ "vector" ]
5b161dc6016d751c087af4c746e45fcd2c08b334
1,025
cpp
C++
Src/Greedy/135_Candy.cpp
HATTER-LONG/https---github.com-HATTER-LONG-AlgorithmTraining
bd2773c066352bab46ac019cef9fbbff8761c147
[ "Apache-2.0" ]
2
2021-02-07T07:03:43.000Z
2021-02-08T16:04:42.000Z
Src/Greedy/135_Candy.cpp
HATTER-LONG/https---github.com-HATTER-LONG-AlgorithmTraining
bd2773c066352bab46ac019cef9fbbff8761c147
[ "Apache-2.0" ]
null
null
null
Src/Greedy/135_Candy.cpp
HATTER-LONG/https---github.com-HATTER-LONG-AlgorithmTraining
bd2773c066352bab46ac019cef9fbbff8761c147
[ "Apache-2.0" ]
1
2021-02-24T09:48:26.000Z
2021-02-24T09:48:26.000Z
#include <algorithm> #include <catch2/catch.hpp> #include <numeric> using namespace std; /* * 题目描述 * 一群孩子站成一排,每一个孩子有自己的评分。 * 现在需要给这些孩子发糖果,规则是如果一个孩子的评分比自己身旁的一个孩子要高, * 那么这个孩子就必须得到比身旁孩子更多的糖果;所有孩子至少要有一个糖果。 * 求解最少需要多少个糖果。 * * 输入输出样例 * 输入是一个数组,表示孩子的评分。输出是最少糖果的数量。 * Input: [1,0,2] * Output: 5 * * 在这个样例中,最少的糖果分法是 [2,1,2]。 */ int candy(std::vector<int>& ratings) { int size = ratings.size(); if (size < 2) { return size; } vector<int> num(size, 1); // 左侧遍历 for (int i = 1; i < size; i++) { if (ratings[i] > ratings[i - 1]) { num[i] = num[i - 1] + 1; } } //右侧遍历 for (int i = size - 1; i > 0; i--) { if (ratings[i] < ratings[i - 1]) { num[i - 1] = max(num[i - 1], num[i] + 1); } } return accumulate(num.begin(), num.end(), 0); } TEST_CASE("Distribute candy") { std::vector<int> ratings { 1, 0, 2 }; int resultCandy = 5; REQUIRE(candy(ratings) == resultCandy); }
18.303571
53
0.523902
[ "vector" ]
5b32b1053fd13090c2d55bb0849d7502609c0574
1,487
cpp
C++
Examples/Cpp/source/POP3/SaveToDiskWithoutParsing.cpp
kashifiqb/Aspose.Email-for-C
96684cb6ed9f4e321a00c74ca219440baaef8ba8
[ "MIT" ]
4
2019-12-01T16:19:12.000Z
2022-03-28T18:51:42.000Z
Examples/Cpp/source/POP3/SaveToDiskWithoutParsing.cpp
kashifiqb/Aspose.Email-for-C
96684cb6ed9f4e321a00c74ca219440baaef8ba8
[ "MIT" ]
1
2022-02-15T01:02:15.000Z
2022-02-15T01:02:15.000Z
Examples/Cpp/source/POP3/SaveToDiskWithoutParsing.cpp
kashifiqb/Aspose.Email-for-C
96684cb6ed9f4e321a00c74ca219440baaef8ba8
[ "MIT" ]
5
2017-09-27T14:43:20.000Z
2021-11-16T06:47:11.000Z
#include <system/string.h> #include <system/shared_ptr.h> #include <system/object.h> #include <system/exceptions.h> #include <system/environment.h> #include <system/console.h> #include <cstdint> #include <Clients/SecurityOptions.h> #include <Clients/Pop3/Pop3Client/Pop3Client.h> #include "Examples.h" using namespace Aspose::Email::Clients::Pop3; using namespace Aspose::Email::Clients; void SaveToDiskWithoutParsing() { //ExStart:SaveToDiskWithoutParsing // The path to the File directory. System::String dataDir = GetDataDir_POP3(); System::String dstEmail = dataDir + u"InsertHeaders.eml"; // Create an instance of the Pop3Client class System::SharedPtr<Pop3Client> client = System::MakeObject<Pop3Client>(); // Specify host, username, password, Port and SecurityOptions for your client client->set_Host(u"pop.gmail.com"); client->set_Username(u"your.username@gmail.com"); client->set_Password(u"your.password"); client->set_Port(995); client->set_SecurityOptions(Aspose::Email::Clients::SecurityOptions::Auto); try { // Save message to disk by message sequence number client->SaveMessage(1, dstEmail); client->Dispose(); } catch (System::Exception& ex) { System::Console::WriteLine(ex->get_Message()); } System::Console::WriteLine(System::Environment::get_NewLine() + u"Retrieved email messages using POP3 "); //ExEnd:SaveToDiskWithoutParsing }
30.979167
109
0.701412
[ "object" ]
5b332444f556ae68850b2e8f933551985e1f1714
1,615
cpp
C++
Code/Engine/Resource/Mesh/Loader/IMeshResourceLoader.cpp
WarzesProject/Micro3DRPG
36604d51d5dd640836cad77995abbfecfe4bdccc
[ "MIT" ]
3
2020-05-12T04:36:38.000Z
2021-04-04T07:21:44.000Z
Code/Engine/Resource/Mesh/Loader/IMeshResourceLoader.cpp
WarzesProject/Micro3DRPG
36604d51d5dd640836cad77995abbfecfe4bdccc
[ "MIT" ]
null
null
null
Code/Engine/Resource/Mesh/Loader/IMeshResourceLoader.cpp
WarzesProject/Micro3DRPG
36604d51d5dd640836cad77995abbfecfe4bdccc
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "Resource/Mesh/Loader/IMeshResourceLoader.h" #include "Resource/Mesh/MeshResource.h" #include "Resource/Material/MaterialResourceManager.h" #include "IRendererRuntime.h" //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] namespace RendererRuntime { //[-------------------------------------------------------] //[ Public virtual RendererRuntime::IResourceLoader methods ] //[-------------------------------------------------------] void IMeshResourceLoader::initialize(const Asset& asset, bool reload, IResource& resource) { IResourceLoader::initialize(asset, reload); mMeshResource = static_cast<MeshResource*>(&resource); } bool IMeshResourceLoader::isFullyLoaded() { // Fully loaded? const MaterialResourceManager& materialResourceManager = mRendererRuntime.getMaterialResourceManager(); const SubMeshes& subMeshes = mMeshResource->getSubMeshes(); const uint32_t numberOfUsedSubMeshes = static_cast<uint32_t>(subMeshes.size()); for (uint32_t i = 0; i < numberOfUsedSubMeshes; ++i) { if (IResource::LoadingState::LOADED != materialResourceManager.getResourceByResourceId(subMeshes[i].getMaterialResourceId()).getLoadingState()) { // Not fully loaded return false; } } // Fully loaded return true; } //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] } // RendererRuntime
33.645833
146
0.545511
[ "mesh" ]
5b369623e44fe1ad7cb868a6646cc9fcd13c17ed
6,646
cpp
C++
compiler/nnc/driver/Driver.cpp
wateret/ONE_private
9789c52633e665d2e10273d88d6f7970faa8aee9
[ "Apache-2.0" ]
null
null
null
compiler/nnc/driver/Driver.cpp
wateret/ONE_private
9789c52633e665d2e10273d88d6f7970faa8aee9
[ "Apache-2.0" ]
null
null
null
compiler/nnc/driver/Driver.cpp
wateret/ONE_private
9789c52633e665d2e10273d88d6f7970faa8aee9
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "pass/PassData.h" #include "passes/transformations/DataFormatSwitcher.h" #include "passes/transformations/LowerConv2D.h" #include "backends/interpreter/InterpreterBackend.h" #include "backends/soft_backend/CPPGenerator.h" #include "passes/dot_dumper/DumperPass.h" #include "backends/acl_soft_backend/AclCppGenerator.h" #include "passes/optimizations/CombineTransposes.h" #include "passes/optimizations/ConstantFoldTranspose.h" #include "passes/optimizations/DeadCodeElimination.h" #include "passes/optimizations/FuseArithmeticOps.h" #include "passes/optimizations/SinkRelu.h" #include "passes/optimizations/SinkTranspose.h" #include "support/CommandLine.h" #include "Definitions.h" #include "Options.h" #include "Driver.h" #ifdef NNC_FRONTEND_CAFFE2_ENABLED #include <caffe2_importer.h> #endif // NNC_FRONTEND_CAFFE2_ENABLED #ifdef NNC_FRONTEND_CAFFE_ENABLED #include <caffe_importer.h> #endif // NNC_FRONTEND_CAFFE_ENABLED #ifdef NNC_FRONTEND_TFLITE_ENABLED #include <tflite_importer.h> #endif // NNC_FRONTEND_TFLITE_ENABLED #ifdef NNC_FRONTEND_ONNX_ENABLED #include <ONNXImporterImpl.h> #endif // NNC_FRONTEND_ONNX_ENABLED #include <stdex/Memory.h> namespace nnc { static std::string getFrontendOptionsString() { std::string res; if (!cli::caffeFrontend.isDisabled()) res += "'" + cli::caffeFrontend.getNames()[0] + "' "; if (!cli::caffe2Frontend.isDisabled()) res += "'" + cli::caffe2Frontend.getNames()[0] + "' "; if (!cli::onnxFrontend.isDisabled()) res += "'" + cli::onnxFrontend.getNames()[0] + "' "; if (!cli::tflFrontend.isDisabled()) res += "'" + cli::tflFrontend.getNames()[0] + "'"; return res; } static std::unique_ptr<mir::Graph> importModel() { // For bool, the value false is converted to zero and the value true is converted to one if (cli::caffeFrontend + cli::caffe2Frontend + cli::tflFrontend + cli::onnxFrontend != 1) throw DriverException("One and only one of the following options are allowed and have to be set" "in the same time: " + getFrontendOptionsString()); if (cli::caffeFrontend) { #ifdef NNC_FRONTEND_CAFFE_ENABLED return mir_caffe::loadModel(cli::inputFile.getRawValue()); #endif // NNC_FRONTEND_CAFFE_ENABLED } else if (cli::caffe2Frontend) { #ifdef NNC_FRONTEND_CAFFE2_ENABLED // FIXME: caffe2 input shapes are not provided by model and must be set from cli // current 'inputShapes' could provide only one shape, while model could has several inputs return mir_caffe2::loadModel(cli::inputFile.getRawValue(), cli::initNet.getRawValue(), {cli::inputShapes.getRawValue()}); #endif // NNC_FRONTEND_CAFFE2_ENABLED } else if (cli::onnxFrontend) { #ifdef NNC_FRONTEND_ONNX_ENABLED return mir_onnx::loadModel(cli::inputFile.getRawValue()); #endif // NNC_FRONTEND_ONNX_ENABLED } else if (cli::tflFrontend) { #ifdef NNC_FRONTEND_TFLITE_ENABLED return mir_tflite::loadModel(cli::inputFile.getRawValue()); #endif // NNC_FRONTEND_TFLITE_ENABLED } assert(false); return nullptr; } static void backend(mir::Graph *graph) { if (cli::target == NNC_TARGET_ARM_CPP || cli::target == NNC_TARGET_X86_CPP) { CPPCodeGenerator(cli::artifactDir, cli::artifactName).run(graph); } else if (cli::target == NNC_TARGET_ARM_GPU_CPP) { AclCppCodeGenerator(cli::artifactDir, cli::artifactName).run(graph); } else if (cli::target == NNC_TARGET_INTERPRETER) { InterpreterBackend(cli::interInputDataDir, cli::artifactDir).run(graph); } else { assert(false && "invalid option value"); } } /** * @brief run all registered passes * @throw PassException, if errors occured */ void Driver::runPasses() { auto graph = importModel(); PassData pass_data(graph.get()); for (const auto &pass : _passManager.getPasses()) { pass_data = pass->run(pass_data); if (cli::dumpGraph && static_cast<mir::Graph *>(pass_data)) { DumperPass d(pass->getName()); d.run(pass_data); } } backend(pass_data); // NOTE. Now we destroy data of all passes when PassManager is destroyed. // In future to reduce memory consumption we can destory it when passes are being performed } // runPasses /** * @brief Register backend specific passes * @throw DriverException if errors occurred */ void Driver::registerBackendSpecificPasses() { std::unique_ptr<Pass> data_format_pass; if (cli::target == NNC_TARGET_ARM_CPP || cli::target == NNC_TARGET_X86_CPP) { _passManager.registerPass(stdex::make_unique<LowerConv2D>()); _passManager.registerPass(stdex::make_unique<DataFormatSwitcher>(mir::DataFormat::NHWC)); } else if (cli::target == NNC_TARGET_ARM_GPU_CPP) { _passManager.registerPass(stdex::make_unique<LowerConv2D>()); _passManager.registerPass(stdex::make_unique<ConstantFoldTranspose>()); // TODO Change to DataFormat::NCHW when fix it in ACL _passManager.registerPass(stdex::make_unique<DataFormatSwitcher>(mir::DataFormat::NHWC)); } else if (cli::target == NNC_TARGET_INTERPRETER) { _passManager.registerPass(stdex::make_unique<DataFormatSwitcher>(mir::DataFormat::NHWC)); } else { assert(false && "invalid option value"); } } void Driver::registerOptimizationPass() { if (cli::doOptimizationPass) { // TODO: maybe we should start managing the optimizations more intelligently? _passManager.registerPass(std::unique_ptr<Pass>(new CombineTransposes())); _passManager.registerPass(std::unique_ptr<Pass>(new SinkTranspose())); _passManager.registerPass(std::unique_ptr<Pass>(new SinkRelu())); #if 0 // TODO Support broadcasting. _passManager.registerPass(std::unique_ptr<Pass>(new FuseArithmeticOps())); #endif _passManager.registerPass(std::unique_ptr<Pass>(new DeadCodeElimination())); } } // registerOptimizationPass void Driver::runDriver() { registerOptimizationPass(); registerBackendSpecificPasses(); runPasses(); } } // namespace nnc
30.626728
100
0.724496
[ "shape", "model" ]
5b3eeade0bf8972c75847aec6c325830c642d9e5
3,491
cpp
C++
app/ShortestEdgeCollapse/app/main.cpp
wildmeshing/wildmeshing-toolkit
7f4c60e5a6d366d9c3850b720b42b610e10600c2
[ "MIT" ]
8
2021-12-10T08:26:45.000Z
2022-03-24T00:19:41.000Z
app/ShortestEdgeCollapse/app/main.cpp
wildmeshing/wildmeshing-toolkit
7f4c60e5a6d366d9c3850b720b42b610e10600c2
[ "MIT" ]
86
2021-12-03T01:46:30.000Z
2022-03-23T19:33:17.000Z
app/ShortestEdgeCollapse/app/main.cpp
wildmeshing/wildmeshing-toolkit
7f4c60e5a6d366d9c3850b720b42b610e10600c2
[ "MIT" ]
2
2021-11-26T08:29:38.000Z
2022-01-03T22:10:42.000Z
#include <sec/ShortestEdgeCollapse.h> #include <wmtk/utils/ManifoldUtils.hpp> #include <CLI/CLI.hpp> #include <igl/Timer.h> #include <igl/is_edge_manifold.h> #include <igl/is_vertex_manifold.h> #include <igl/readOFF.h> #include <igl/read_triangle_mesh.h> #include <igl/remove_duplicate_vertices.h> #include <igl/writeDMAT.h> #include <stdlib.h> #include <chrono> #include <cstdlib> #include <iostream> using namespace wmtk; using namespace sec; using namespace std::chrono; void run_shortest_collapse( std::string input, int target, std::string output, ShortestEdgeCollapse& m) { auto start = high_resolution_clock::now(); wmtk::logger().info("target number of verts: {}", target); assert(m.check_mesh_connectivity_validity()); wmtk::logger().info("mesh is valid"); m.collapse_shortest(target); wmtk::logger().info("collapsed"); auto stop = high_resolution_clock::now(); auto duration = duration_cast<milliseconds>(stop - start); wmtk::logger().info("runtime {}", duration.count()); m.consolidate_mesh(); m.write_triangle_mesh(output); wmtk::logger().info( "After_vertices#: {} \n After_tris#: {}", m.vert_capacity(), m.tri_capacity()); } int main(int argc, char** argv) { std::string path = ""; std::string output = "out.obj"; double env_rel = -1; double target_pec = 0.1; int thread = 1; CLI::App app{argv[0]}; app.add_option("input", path, "Input mesh.")->check(CLI::ExistingFile); app.add_option("output", output, "output mesh."); app.add_option("-e,--envelope", env_rel, "Relative envelope size, negative to disable"); app.add_option("-j, --thread", thread, "thread."); app.add_option("-t, --target", target_pec, "Percentage of input vertices in output."); CLI11_PARSE(app, argc, argv); Eigen::MatrixXd V; Eigen::MatrixXi F; bool ok = igl::read_triangle_mesh(path, V, F); Eigen::VectorXi SVI, SVJ; Eigen::MatrixXd temp_V = V; // for STL file igl::remove_duplicate_vertices(temp_V, 0, V, SVI, SVJ); for (int i = 0; i < F.rows(); i++) for (int j : {0, 1, 2}) F(i, j) = SVJ[F(i, j)]; wmtk::logger().info("Before_vertices#: {} \n Before_tris#: {}", V.rows(), F.rows()); std::vector<Eigen::Vector3d> v(V.rows()); std::vector<std::array<size_t, 3>> tri(F.rows()); for (int i = 0; i < V.rows(); i++) { v[i] = V.row(i); } for (int i = 0; i < F.rows(); i++) { for (int j = 0; j < 3; j++) tri[i][j] = (size_t)F(i, j); } const Eigen::MatrixXd box_min = V.colwise().minCoeff(); const Eigen::MatrixXd box_max = V.colwise().maxCoeff(); const double diag = (box_max - box_min).norm(); const double envelope_size = env_rel * diag; Eigen::VectorXi dummy; std::vector<size_t> modified_v; if (!igl::is_edge_manifold(F) || !igl::is_vertex_manifold(F, dummy)) { auto v1 = v; auto tri1 = tri; wmtk::separate_to_manifold(v1, tri1, v, tri, modified_v); } ShortestEdgeCollapse m(v, thread); m.create_mesh(v.size(), tri, modified_v, envelope_size); assert(m.check_mesh_connectivity_validity()); wmtk::logger().info("collapsing mesh {}", path); int target_verts = v.size() * target_pec; igl::Timer timer; timer.start(); run_shortest_collapse(path, target_verts, output, m); timer.stop(); logger().info("Took {}", timer.getElapsedTimeInSec()); m.consolidate_mesh(); return 0; }
31.45045
92
0.633056
[ "mesh", "vector" ]
5b5233b059c6ce599790fb4df89dedc5ad65dce4
3,013
cpp
C++
src/engine/tile.cpp
flamechain/AwesomeGame
0ae50dd3e5f224b22d94b2095f97444a630a0e04
[ "MIT" ]
1
2022-01-08T22:06:11.000Z
2022-01-08T22:06:11.000Z
src/engine/tile.cpp
flamechain/AwesomeGame
0ae50dd3e5f224b22d94b2095f97444a630a0e04
[ "MIT" ]
null
null
null
src/engine/tile.cpp
flamechain/AwesomeGame
0ae50dd3e5f224b22d94b2095f97444a630a0e04
[ "MIT" ]
null
null
null
#include "tile.h" GAME_START vector<SDL_Rect> InitTiles() { const int kTileCount = 20; vector<SDL_Rect> tiles; for (int i=0; i<kTileCount; i++) { SDL_Rect temp; temp.w = SPRITE_SIZE; temp.h = SPRITE_SIZE; tiles.push_back(temp); } tiles[static_cast<int>(TileType::None)].x = 0; tiles[static_cast<int>(TileType::None)].y = 0; tiles[static_cast<int>(TileType::None)].w = 0; tiles[static_cast<int>(TileType::None)].h = 0; tiles[static_cast<int>(TileType::Floor)].x = 0; tiles[static_cast<int>(TileType::Floor)].y = 0; tiles[static_cast<int>(TileType::FloorCrack1)].x = SPRITE_SIZE; tiles[static_cast<int>(TileType::FloorCrack1)].y = 0; tiles[static_cast<int>(TileType::FloorCrack2)].x = SPRITE_SIZE*2; tiles[static_cast<int>(TileType::FloorCrack2)].y = 0; tiles[static_cast<int>(TileType::FloorCrack3)].x = SPRITE_SIZE*3; tiles[static_cast<int>(TileType::FloorCrack3)].y = 0; tiles[static_cast<int>(TileType::Roof)].x = SPRITE_SIZE*4; tiles[static_cast<int>(TileType::Roof)].y = 0; tiles[static_cast<int>(TileType::Roof1)].x = SPRITE_SIZE*5; tiles[static_cast<int>(TileType::Roof1)].y = 0; tiles[static_cast<int>(TileType::Roof2)].x = SPRITE_SIZE*6; tiles[static_cast<int>(TileType::Roof2)].y = 0; tiles[static_cast<int>(TileType::Roof3)].x = SPRITE_SIZE*7; tiles[static_cast<int>(TileType::Roof3)].y = 0; tiles[static_cast<int>(TileType::Roof4)].x = SPRITE_SIZE*8; tiles[static_cast<int>(TileType::Roof4)].y = 0; tiles[static_cast<int>(TileType::Brick)].x = SPRITE_SIZE*9; tiles[static_cast<int>(TileType::Brick)].y = 0; tiles[static_cast<int>(TileType::BrickCrack1)].x = SPRITE_SIZE*10; tiles[static_cast<int>(TileType::BrickCrack1)].y = 0; tiles[static_cast<int>(TileType::BrickCrack2)].x = SPRITE_SIZE*11; tiles[static_cast<int>(TileType::BrickCrack2)].y = 0; tiles[static_cast<int>(TileType::BrickCrack3)].x = SPRITE_SIZE*12; tiles[static_cast<int>(TileType::BrickCrack3)].y = 0; // TODO rearrange tilesheet so these values aren't all over the place tiles[static_cast<int>(TileType::PlayerLeftStill)].x = SPRITE_SIZE*4; tiles[static_cast<int>(TileType::PlayerLeftStill)].y = SPRITE_SIZE; tiles[static_cast<int>(TileType::PlayerLeft1)].x = 0; tiles[static_cast<int>(TileType::PlayerLeft1)].y = SPRITE_SIZE; tiles[static_cast<int>(TileType::PlayerLeft2)].x = SPRITE_SIZE*2; tiles[static_cast<int>(TileType::PlayerLeft2)].y = SPRITE_SIZE; tiles[static_cast<int>(TileType::PlayerRightStill)].x = SPRITE_SIZE*5; tiles[static_cast<int>(TileType::PlayerRightStill)].y = SPRITE_SIZE; tiles[static_cast<int>(TileType::PlayerRight1)].x = SPRITE_SIZE; tiles[static_cast<int>(TileType::PlayerRight1)].y = SPRITE_SIZE; tiles[static_cast<int>(TileType::PlayerRight2)].x = SPRITE_SIZE*3; tiles[static_cast<int>(TileType::PlayerRight2)].y = SPRITE_SIZE; return tiles; } GAME_END
36.301205
74
0.689014
[ "vector" ]
5b5665d5859f24b5d1138016bc44c3ed8d1051cd
9,407
cpp
C++
test/test_cross.cpp
disenone/AoiTesting
3e72c211ae6e83f9acf2bc480d8e9689dd74d7b6
[ "MIT" ]
null
null
null
test/test_cross.cpp
disenone/AoiTesting
3e72c211ae6e83f9acf2bc480d8e9689dd74d7b6
[ "MIT" ]
null
null
null
test/test_cross.cpp
disenone/AoiTesting
3e72c211ae6e83f9acf2bc480d8e9689dd74d7b6
[ "MIT" ]
null
null
null
// Copyright <disenone> #include <unordered_map> #include <iostream> #include <vector> #include <cmath> #define BOOST_TEST_MODULE test_cross #define BOOST_TEST_DYN_LINK #include <boost/test/included/unit_test.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_real_distribution.hpp> #include <boost/timer/timer.hpp> #include <boost/range/irange.hpp> #include <common/nuid.hpp> #include <common/silence_unused.hpp> #include <cross/cross.hpp> // #include <gperftools/profiler.h> using namespace aoi; using namespace aoi::cross; BOOST_AUTO_TEST_SUITE(test_cross) class Player; class CrossAoiTest: public CrossAoi { public: CrossAoiTest(): CrossAoi(0, 0, 0, 0, 0, 0, 0) {} CrossAoiTest(float map_bound_xmin, float map_bound_xmax, float map_bound_zmin, float map_bound_zmax, size_t beacon_x, size_t beacon_z, float beacon_radius) : CrossAoi(map_bound_xmin, map_bound_xmax, map_bound_zmin, map_bound_zmax, beacon_x, beacon_z, beacon_radius) {} friend class Player; }; class Player { public: Player() : nuid_(GenNuid()), pos_(0, 0, 0) {} Player(Nuid nuid, Pos pos) : nuid_(nuid), pos_(pos) {} public: inline Nuid AddSensor(float radius, bool log = false) { auto sensor_id = GenNuid(); aoi_->AddSensor(nuid_, sensor_id, radius); if (log) { printf("Player %lu Add Sensor %lu, radius %f\n", nuid_, sensor_id, radius); } return sensor_id; } inline void AddToAoi(CrossAoiTest* aoi, bool log = false) { aoi_ = aoi; aoi_->AddPlayer(nuid_, pos_.x, pos_.y, pos_.z); player_aoi_ = aoi_->player_map_.find(nuid_)->second.get(); if (log) { printf("Add Player: %lu, Pos(%f, %f, %f)\n", nuid_, pos_.x, pos_.y, pos_.z); } } inline void RemoveFromAoi(bool log = false) { if (log) { printf("Remove Player: %lu, Pos(%f, %f, %f)\n", nuid_, pos_.x, pos_.y, pos_.z); } aoi_->RemovePlayer(nuid_); aoi_ = nullptr; player_aoi_ = nullptr; } inline void MoveDelta(float x, float y, float z) { MoveTo(pos_.x + x, pos_.y + y, pos_.z + z); } inline void MoveTo(float x, float y, float z, bool log = false) { pos_.Set(x, y, z); if (aoi_) { aoi_->UpdatePos(nuid_, x, y, z); } if (log) { printf("Player %lu MoveTo (%f, %f, %f)\n", nuid_, x, y, z); } } public: Nuid nuid_; Pos pos_; PlayerAoi *player_aoi_; CrossAoiTest *aoi_; }; void PrintAoiUpdateInfos(const AoiUpdateInfos &info) { printf("=========================== update_infos\n"); for (auto &elem : info) { auto& update_info = elem.second; printf("Player: %lu; update sensors size: %lu\n", update_info.nuid, update_info.sensor_update_list.size()); for (auto &sensor : update_info.sensor_update_list) { printf(" Sensor_id: %lu, \n", sensor.sensor_id); printf(" enters: (%lu)[", sensor.enters.size()); for (auto &nuid : sensor.enters) { printf("%lu, ", nuid); } printf("]\n"); printf(" leaves: (%lu)[", sensor.leaves.size()); for (auto &nuid : sensor.leaves) { printf("%lu,", nuid); } printf("]\n"); } } printf("===========================\n\n"); } void CheckUpdateInfos(const AoiUpdateInfos &update_infos, const AoiUpdateInfos &require_infos) { // BOOST_TEST_REQUIRE((update_infos == require_infos)); BOOST_TEST_REQUIRE((update_infos.size() == require_infos.size())); for (const auto &pair : update_infos) { auto &update_info = pair.second; BOOST_TEST_REQUIRE((require_infos.find(update_info.nuid) != require_infos.end())); auto &require_info = require_infos.find(update_info.nuid)->second; BOOST_TEST_REQUIRE( (update_info.sensor_update_list.size() == require_info.sensor_update_list.size())); for (size_t i =0; i < update_info.sensor_update_list.size(); ++i) { auto &sensor_info = update_info.sensor_update_list[i]; auto &require_sensor_info = require_info.sensor_update_list[i]; BOOST_TEST_REQUIRE((sensor_info.sensor_id == require_sensor_info.sensor_id)); BOOST_TEST_REQUIRE((sensor_info.enters == require_sensor_info.enters)); BOOST_TEST_REQUIRE((sensor_info.leaves == require_sensor_info.leaves)); } } } void TestSimple(bool log = false) { CrossAoiTest cross_aoi(-1000, 1000, -1000, 1000, 3, 3, 5); Player player1{GenNuid(), {0, 0, 0}}; player1.AddToAoi(&cross_aoi, log); auto sensor_id1 = player1.AddSensor(10, log); Player player2{GenNuid(), {0, 0, 0}}; player2.AddToAoi(&cross_aoi, log); auto sensor_id2 = player2.AddSensor(5, log); auto update_infos = cross_aoi.Tick(); if (log) PrintAoiUpdateInfos(update_infos); if (log) cross_aoi.PrintAllNodeList(); AoiUpdateInfos require_infos = { {player1.nuid_, {player1.nuid_, {{sensor_id1, {player2.nuid_}, {}}}}}, {player2.nuid_, {player2.nuid_, {{sensor_id2, {player1.nuid_}, {}}}}}, }; CheckUpdateInfos(update_infos, require_infos); // player2 move to (6, 0, 0) player2.MoveTo(6, 0, 0, log); update_infos = cross_aoi.Tick(); if (log) PrintAoiUpdateInfos(update_infos); require_infos = { {player2.nuid_, {player2.nuid_, {{sensor_id2, {}, {player1.nuid_}}}}}, }; CheckUpdateInfos(update_infos, require_infos); // player2 move to (600, 0, 100) if (log) cross_aoi.PrintAllNodeList(); player2.MoveTo(600, 0, 100, log); update_infos = cross_aoi.Tick(); if (log) cross_aoi.PrintAllNodeList(); if (log) PrintAoiUpdateInfos(update_infos); require_infos = { {player1.nuid_, {player1.nuid_, {{sensor_id1, {}, {player2.nuid_}}}}}, }; CheckUpdateInfos(update_infos, require_infos); player1.MoveTo(601, 100, 101, log); if (log) cross_aoi.PrintAllNodeList(); update_infos = cross_aoi.Tick(); if (log) PrintAoiUpdateInfos(update_infos); require_infos = { {player1.nuid_, {player1.nuid_, {{sensor_id1, {player2.nuid_}, {}}}}}, {player2.nuid_, {player2.nuid_, {{sensor_id2, {player1.nuid_}, {}}}}}, }; CheckUpdateInfos(update_infos, require_infos); player2.RemoveFromAoi(log); update_infos = cross_aoi.Tick(); if (log) PrintAoiUpdateInfos(update_infos); require_infos = { {player1.nuid_, {player1.nuid_, {{sensor_id1, {}, {player2.nuid_}}}}}, }; CheckUpdateInfos(update_infos, require_infos); if (log) cross_aoi.PrintAllNodeList(); } BOOST_AUTO_TEST_CASE(test_simple) { bool log = false; TestSimple(log); } std::vector<Player> GenPlayers(const size_t player_num, const float map_size) { std::vector<Player> players(player_num); boost::random::mt19937 random_generator(std::time(0)); boost::random::uniform_real_distribution<float> pos_generator(-map_size, map_size); for (int i : boost::irange(player_num)) { auto &player = players[i]; player.pos_.Set(pos_generator(random_generator), 0, pos_generator(random_generator)); } BOOST_TEST_REQUIRE((players.size() == player_num)); return players; } std::vector<Pos> GenMovements(const size_t player_num, const float length) { std::vector<Pos> movements; movements.reserve(player_num); boost::random::mt19937 random_generator(std::time(0)); boost::random::uniform_real_distribution<float> angle_gen(0, 360); for (int UNUSED(i) : boost::irange(player_num)) { float angle = angle_gen(random_generator); float radian = 2 * M_PI * angle / 360; movements.emplace_back(std::cos(radian) * length, 0, std::sin(radian) * length); } return movements; } void TestOneMilestone(std::vector<Player> *players, const size_t player_num, const float map_size) { printf("\n===Begin Milestore: player_num = %lu, map_size = (%f, %f)\n", player_num, -map_size, map_size); boost::timer::cpu_timer run_timer; int times = 1; std::vector<CrossAoiTest> cross_aois; for (auto UNUSED(i) : boost::irange(times)) { cross_aois.emplace_back(-map_size, map_size, -map_size, map_size, 3, 3, 100); } // ProfilerStart("a.prof"); for (auto &cross_aoi : cross_aois) { for (auto &player : *players) { player.AddToAoi(&cross_aoi); player.AddSensor(100); } BOOST_TEST_REQUIRE((cross_aoi.GetPlayerMap().size() == player_num + 9)); } // ProfilerStop(); run_timer.stop(); printf("Add Player (%i times)", times); std::cout << run_timer.format(); for (auto &cross_aoi : cross_aois) { cross_aoi.Tick(); } run_timer.start(); for (auto &cross_aoi : cross_aois) { cross_aoi.Tick(); } run_timer.stop(); printf("Tick (%i times)", times); std::cout << run_timer.format(); float speed = 6; float delta_time = 0.1; auto movements = GenMovements(player_num, delta_time * speed); times = 1 / delta_time; run_timer.start(); for (int UNUSED(t) : boost::irange(times)) { for (int i : boost::irange(player_num)) { auto &player = players->at(i); auto &move = movements[i]; player.MoveDelta(move.x, move.y, move.z); } } run_timer.stop(); printf("Update Pos (%i times)", times); std::cout << run_timer.format(); printf("===End Milestore\n"); } BOOST_AUTO_TEST_CASE(test_milestone) { for (size_t player_num : {100, 1000, 10000}) { for (float map_size : {50, 100, 1000, 10000}) { auto players = GenPlayers(player_num, map_size); TestOneMilestone(&players, player_num, map_size); } } } BOOST_AUTO_TEST_SUITE_END()
29.305296
96
0.659828
[ "vector" ]
5b623e8abd73ddb0c440f2aed6030fbd4c732c66
2,754
cpp
C++
sort/BucketSort.cpp
kongshuiJ/practice_algorithm
be850ff29eaea1d07d6750d3a4068acd76a4954c
[ "MIT" ]
1
2022-01-13T09:03:13.000Z
2022-01-13T09:03:13.000Z
sort/BucketSort.cpp
kongshuiJ/practice_algorithm
be850ff29eaea1d07d6750d3a4068acd76a4954c
[ "MIT" ]
null
null
null
sort/BucketSort.cpp
kongshuiJ/practice_algorithm
be850ff29eaea1d07d6750d3a4068acd76a4954c
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <random> #include <algorithm> #include <forward_list> struct ListNode { ListNode() : value(0), next_node(nullptr){} ListNode(int tmp_value) : value(tmp_value), next_node(nullptr){} ListNode(struct ListNode *node) { if (node != nullptr) { value = node->value; next_node = node; } } int value; struct ListNode *next_node; }; constexpr int bucket_num = 10; struct ListNode *insertNodeToList(struct ListNode *head, int value) { struct ListNode *new_node = new struct ListNode(value); if (head == nullptr) return new_node; struct ListNode dummy_node(0); dummy_node.next_node = head; struct ListNode *pre_node = &dummy_node; struct ListNode *cur_node = head; while (cur_node != nullptr && cur_node->value <= value) { pre_node = cur_node; cur_node = cur_node->next_node; } pre_node->next_node = new_node; new_node->next_node = cur_node; return dummy_node.next_node; } void mergeLists(std::vector<int> &vec, const std::vector<struct ListNode *> vec_nodes) { vec.clear(); for (size_t idx = 0; idx < vec_nodes.size(); ++idx) { struct ListNode *tmp = vec_nodes[idx]; while (tmp != nullptr) { vec.emplace_back(tmp->value); tmp = tmp->next_node; } } } void BucketSort(std::vector<int> &vec) { std::vector<struct ListNode *> vec_nodes(bucket_num, (struct ListNode *) (0)); for(size_t idx = 0; idx < vec.size(); ++ idx) { int bucket_idx = vec[idx] / bucket_num; vec_nodes[bucket_idx] = insertNodeToList(vec_nodes[bucket_idx], vec[idx]); } std::cout << std::endl << "=====Bucket Sort List=====" << std::endl; for (size_t idx = 0; idx < vec_nodes.size(); ++idx) { struct ListNode *tmp = vec_nodes[idx]; std::cout << "List " << idx << ": "; while (tmp != nullptr) { std::cout << tmp->value << " "; tmp = tmp->next_node; } std::cout << std::endl; } std::cout << std::endl << "=====Bucket Sort List=====" << std::endl; mergeLists(vec, vec_nodes); } int main() { std::vector<int> vec; vec.resize(15); std::random_device rd; for (size_t i = 0; i < vec.size(); i++) { vec[i] = rd() % 99; } std::cout << "old: "; for (auto tmp: vec) { std::cout << tmp << " "; } std::cout << std::endl; BucketSort(vec); std::cout << "new: "; for (auto tmp: vec) { std::cout << tmp << " "; } std::cout << std::endl; return 0; }
22.209677
86
0.539579
[ "vector" ]
5b6c1d0e92395ad1fff7927d763a1379ace356d4
9,714
cpp
C++
vk_device_generated_cmds/renderer_vk.cpp
yangtzehina/VulkanStudy
76af12e46ecbba0a2d22812ebec3faa7383b0328
[ "MIT" ]
1
2021-11-11T13:33:54.000Z
2021-11-11T13:33:54.000Z
vk_device_generated_cmds/renderer_vk.cpp
yangtzehina/VulkanStudy
76af12e46ecbba0a2d22812ebec3faa7383b0328
[ "MIT" ]
null
null
null
vk_device_generated_cmds/renderer_vk.cpp
yangtzehina/VulkanStudy
76af12e46ecbba0a2d22812ebec3faa7383b0328
[ "MIT" ]
null
null
null
/* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of NVIDIA CORPORATION nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Contact ckubisch@nvidia.com (Christoph Kubisch) for feedback */ #include <algorithm> #include <assert.h> #include "renderer.hpp" #include "resources_vk.hpp" #include <nvh/nvprint.hpp> #include <nvmath/nvmath_glsltypes.h> #include "common.h" namespace generatedcmds { ////////////////////////////////////////////////////////////////////////// class RendererVK : public Renderer { public: enum Mode { MODE_CMD_SINGLE, }; class TypeCmd : public Renderer::Type { bool isAvailable(const nvvk::Context& context) const { return true; } const char* name() const { return "re-used cmds"; } Renderer* create() const { RendererVK* renderer = new RendererVK(); renderer->m_mode = MODE_CMD_SINGLE; return renderer; } unsigned int priority() const { return 8; } Resources* resources() { return ResourcesVK::get(); } }; public: void init(const CadScene* NV_RESTRICT scene, Resources* resources, const Config& config, Stats& stats) override; void deinit() override; void draw(const Resources::Global& global, Stats& stats) override; uint32_t supportedBindingModes() override { return (1 << BINDINGMODE_DSETS) | (1 << BINDINGMODE_PUSHADDRESS); }; Mode m_mode; RendererVK() : m_mode(MODE_CMD_SINGLE) { } private: struct DrawSetup { BindingMode bindingMode; VkCommandBuffer cmdBuffer; size_t fboChangeID; size_t pipeChangeID; }; std::vector<DrawItem> m_drawItems; std::vector<uint32_t> m_seqIndices; VkCommandPool m_cmdPool; DrawSetup m_draw; ResourcesVK* NV_RESTRICT m_resources; void fillCmdBuffer(VkCommandBuffer cmd, const DrawItem* NV_RESTRICT drawItems, size_t drawCount) { const ResourcesVK* res = m_resources; const CadSceneVK& scene = res->m_scene; BindingMode bindingMode = m_config.bindingMode; int lastMaterial = -1; int lastGeometry = -1; int lastMatrix = -1; int lastObject = -1; int lastShader = -1; VkBufferDeviceAddressInfoEXT addressInfo = {VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT}; addressInfo.buffer = scene.m_buffers.matrices; VkDeviceAddress matrixAddress = vkGetBufferDeviceAddressEXT(res->m_device, &addressInfo); addressInfo.buffer = scene.m_buffers.materials; VkDeviceAddress materialAddress = vkGetBufferDeviceAddressEXT(res->m_device, &addressInfo); if(bindingMode == BINDINGMODE_DSETS) { vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, res->m_drawBind.getPipeLayout(), DRAW_UBO_SCENE, 1, res->m_drawBind.at(DRAW_UBO_SCENE).getSets(), 0, NULL); } else if(bindingMode == BINDINGMODE_PUSHADDRESS) { vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, res->m_drawPush.getPipeLayout(), DRAW_UBO_SCENE, 1, res->m_drawPush.getSets(), 0, NULL); } for(size_t i = 0; i < drawCount; i++) { uint32_t idx = m_config.permutated ? m_seqIndices[i] : uint32_t(i); const DrawItem& di = drawItems[idx]; if(di.shaderIndex != lastShader) { vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, res->m_drawShading[bindingMode].pipelines[di.shaderIndex]); } if(lastGeometry != di.geometryIndex) { const CadSceneVK::Geometry& geo = scene.m_geometry[di.geometryIndex]; vkCmdBindVertexBuffers(cmd, 0, 1, &geo.vbo.buffer, &geo.vbo.offset); vkCmdBindIndexBuffer(cmd, geo.ibo.buffer, geo.ibo.offset, VK_INDEX_TYPE_UINT32); lastGeometry = di.geometryIndex; } if(bindingMode == BINDINGMODE_DSETS) { if(lastMatrix != di.matrixIndex) { uint32_t offset = di.matrixIndex * res->m_alignedMatrixSize; vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, res->m_drawBind.getPipeLayout(), DRAW_UBO_MATRIX, 1, res->m_drawBind.at(DRAW_UBO_MATRIX).getSets(), 1, &offset); lastMatrix = di.matrixIndex; } if(lastMaterial != di.materialIndex) { uint32_t offset = di.materialIndex * res->m_alignedMaterialSize; vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, res->m_drawBind.getPipeLayout(), DRAW_UBO_MATERIAL, 1, res->m_drawBind.at(DRAW_UBO_MATERIAL).getSets(), 1, &offset); lastMaterial = di.materialIndex; } } else if(bindingMode == BINDINGMODE_PUSHADDRESS) { if(lastMatrix != di.matrixIndex) { VkDeviceAddress address = matrixAddress + sizeof(CadScene::MatrixNode) * di.matrixIndex; vkCmdPushConstants(cmd, res->m_drawPush.getPipeLayout(), VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VkDeviceAddress), &address); lastMatrix = di.matrixIndex; } if(lastMaterial != di.materialIndex) { VkDeviceAddress address = materialAddress + sizeof(CadScene::Material) * di.materialIndex; vkCmdPushConstants(cmd, res->m_drawPush.getPipeLayout(), VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(VkDeviceAddress), sizeof(VkDeviceAddress), &address); lastMaterial = di.materialIndex; } } // drawcall vkCmdDrawIndexed(cmd, di.range.count, 1, uint32_t(di.range.offset / sizeof(uint32_t)), 0, 0); lastShader = di.shaderIndex; } } void setupCmdBuffer(const DrawItem* NV_RESTRICT drawItems, size_t drawCount) { const ResourcesVK* res = m_resources; VkCommandBuffer cmd = res->createCmdBuffer(m_cmdPool, false, false, true); res->cmdDynamicState(cmd); fillCmdBuffer(cmd, drawItems, drawCount); vkEndCommandBuffer(cmd); m_draw.cmdBuffer = cmd; m_draw.fboChangeID = res->m_fboChangeID; m_draw.pipeChangeID = res->m_pipeChangeID; } void deleteCmdBuffer() { vkFreeCommandBuffers(m_resources->m_device, m_cmdPool, 1, &m_draw.cmdBuffer); } }; static RendererVK::TypeCmd s_type_cmdbuffer_vk; void RendererVK::init(const CadScene* NV_RESTRICT scene, Resources* resources, const Config& config, Stats& stats) { ResourcesVK* NV_RESTRICT res = (ResourcesVK*)resources; m_resources = res; m_scene = scene; m_config = config; stats.cmdBuffers = 1; VkResult result; VkCommandPoolCreateInfo cmdPoolInfo = {VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO}; cmdPoolInfo.queueFamilyIndex = 0; result = vkCreateCommandPool(res->m_device, &cmdPoolInfo, NULL, &m_cmdPool); assert(result == VK_SUCCESS); fillDrawItems(m_drawItems, scene, config, stats); if(config.permutated) { m_seqIndices.resize(m_drawItems.size()); fillRandomPermutation(m_drawItems.size(), m_seqIndices.data(), m_drawItems.data(), stats); } setupCmdBuffer(m_drawItems.data(), m_drawItems.size()); } void RendererVK::deinit() { deleteCmdBuffer(); vkDestroyCommandPool(m_resources->m_device, m_cmdPool, NULL); } void RendererVK::draw(const Resources::Global& global, Stats& stats) { ResourcesVK* NV_RESTRICT res = m_resources; if(m_draw.pipeChangeID != res->m_pipeChangeID || m_draw.fboChangeID != res->m_fboChangeID) { deleteCmdBuffer(); setupCmdBuffer(m_drawItems.data(), m_drawItems.size()); } VkCommandBuffer primary = res->createTempCmdBuffer(); { nvvk::ProfilerVK::Section profile(res->m_profilerVK, "Render", primary); { nvvk::ProfilerVK::Section profile(res->m_profilerVK, "Draw", primary); vkCmdUpdateBuffer(primary, res->m_common.viewBuffer, 0, sizeof(SceneData), (const uint32_t*)&global.sceneUbo); res->cmdPipelineBarrier(primary); // clear via pass res->cmdBeginRenderPass(primary, true, true); vkCmdExecuteCommands(primary, 1, &m_draw.cmdBuffer); vkCmdEndRenderPass(primary); } } vkEndCommandBuffer(primary); res->submissionEnqueue(primary); } } // namespace generatedcmds
34.446809
133
0.677888
[ "geometry", "render", "vector" ]
5b6c3a4db0a027edddd103dc937e7ca8d63f0336
7,697
cpp
C++
src/graphics/tcDisplayModes.cpp
dhanin/friendly-bassoon
fafcfd3921805baddc1889dc0ee2fa367ad882f8
[ "BSD-3-Clause" ]
2
2021-11-17T10:59:38.000Z
2021-11-17T10:59:45.000Z
src/graphics/tcDisplayModes.cpp
dhanin/nws
87a3f24a7887d84b9884635064b48d456b4184e2
[ "BSD-3-Clause" ]
null
null
null
src/graphics/tcDisplayModes.cpp
dhanin/nws
87a3f24a7887d84b9884635064b48d456b4184e2
[ "BSD-3-Clause" ]
null
null
null
/** @file tcDisplayModes.cpp */ /* ** Copyright (c) 2014, GCBLUE PROJECT ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ** ** 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. ** ** 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from ** this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT ** NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #else #error "tcDisplayModes is Windows only at the moment" #endif #include "tcDisplayModes.h" #include "tcOptions.h" #ifdef _DEBUG #define new DEBUG_NEW #endif /** * Accessor for singleton instance */ tcDisplayModes* tcDisplayModes::Get() { static tcDisplayModes instance; return &instance; } void tcDisplayModes::ChangeMode(unsigned width, unsigned height, unsigned bits, unsigned freq) { DEVMODE winModeInfo; winModeInfo.dmSize = sizeof(DEVMODE); winModeInfo.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; winModeInfo.dmBitsPerPel = bits; winModeInfo.dmPelsHeight = height; winModeInfo.dmPelsWidth = width; winModeInfo.dmDisplayFrequency = freq; if (!IsModeValid(width, height, bits, freq)) { fprintf(stderr, "tcDisplayModes::ChangeMode - Invalid mode: " "W:%d, H:%d, Bits:%d, Freq:%d\n", width, height, bits, freq); return; } long result = ChangeDisplaySettings(&winModeInfo, 0); // change dynamically if (result == DISP_CHANGE_SUCCESSFUL) { currentMode.bits = bits; currentMode.width = width; currentMode.height = height; currentMode.frequency = freq; } else if (result == DISP_CHANGE_BADMODE) { fprintf(stderr, "tcDisplayModes::ChangeMode - Mode not supported: " "W:%d, H:%d, Bits:%d Freq:%d\n", width, height, bits, freq); } else { fprintf(stderr, "tcDisplayModes::ChangeMode - Mode change failed (%d)", result); } } /** * Changes display mode info in options xml file. Mode will take effect * after restart of game (if mode is valid). */ void tcDisplayModes::ChangeOptionsMode(unsigned width, unsigned height, unsigned bits, unsigned freq) { if (!IsModeValid(width, height, bits, freq)) { fprintf(stderr, "tcDisplayModes::ChangeOptionsMode - Invalid mode: " "W:%d, H:%d, Bits:%d Freq:%d\n", width, height, bits, freq); return; } wxString modeString = wxString::Format("%d %d %d %d", width, height, bits, freq); tcOptions::Get()->SetOptionString("DisplaySettings", modeString.GetData()); } /** * @return number of display modes (width, height, bits) */ unsigned int tcDisplayModes::GetModeCount() const { return (unsigned int)modeInfo.size(); } const tcDisplayModes::Info& tcDisplayModes::GetCurrentModeInfo() const { return currentMode; } const tcDisplayModes::Info& tcDisplayModes::GetModeInfo(unsigned int n) const { if (n >= modeInfo.size()) { fprintf(stderr, "tcDisplayModes::GetModeInfo - index out of bounds\n"); wxASSERT(0); } return modeInfo[n]; } bool tcDisplayModes::IsCurrentMode(unsigned n) const { if (n >= GetModeCount()) return false; tcDisplayModes::Info mode_n = modeInfo[n]; return ((mode_n.bits == currentMode.bits)&& (mode_n.height == currentMode.height)&& (mode_n.width == currentMode.width)&& (mode_n.frequency == currentMode.frequency)); } /** * @return true if mode params match at least one of the modes in modeInfo */ bool tcDisplayModes::IsModeValid(unsigned width, unsigned height, unsigned bits, unsigned freq) { unsigned int modeCount = GetModeCount(); for (unsigned int n=0; n<modeCount; n++) { tcDisplayModes::Info& info = modeInfo[n]; if ((info.bits == bits)&& (info.width == width)&& (info.height == height)&& (info.frequency == freq)) { return true; } } return false; } void tcDisplayModes::LoadModeFromOptions() { const char* modeString = tcOptions::Get()->GetOptionString("DisplaySettings"); int width; int height; int bits; int freq; if (sscanf(modeString, "%d %d %d %d", &width, &height, &bits, &freq) < 4) { return; } ChangeMode(width, height, bits, freq); } /** * Writes modeInfo to stdout. PopulateModeInfo should be called first */ void tcDisplayModes::LogModeInfo() { unsigned int modeCount = GetModeCount(); for (unsigned int n=0; n<modeCount; n++) { tcDisplayModes::Info& info = modeInfo[n]; fprintf(stdout, "Display mode %d: W: %d, H: %d, Bits: %d Freq: %d (%s)\n", n, info.width, info.height, info.bits, info.frequency, info.deviceDescription.c_str()); } } /** * Initializes modeInfo vector with info on display modes. Ignores * modes with less than 16 bits per pixel and modes with width < 800. * WINDOWS ONLY for now. Next version of wxWidgets should have a * cross-platform version of these functions that we can use instead. * * 23 FEB 2006, Can use wxDisplay, wxVideoMode for this */ void tcDisplayModes::PopulateModeInfo() { modeInfo.clear(); DEVMODE winModeInfo; winModeInfo.dmSize = sizeof(DEVMODE); unsigned lastBits = 0; unsigned lastWidth = 0; unsigned lastHeight = 0; unsigned lastFreq = 0; int i = 0; while ( EnumDisplaySettings(0, i++, &winModeInfo) ) { tcDisplayModes::Info info; info.bits = winModeInfo.dmBitsPerPel; info.height = winModeInfo.dmPelsHeight; info.width = winModeInfo.dmPelsWidth; info.frequency = winModeInfo.dmDisplayFrequency; unsigned int driverVersion = winModeInfo.dmDriverVersion; wxString description = wxString::Format("%s %d.%d", winModeInfo.dmDeviceName, (driverVersion & 0xFF), ((driverVersion >> 8) & 0xFF)); info.deviceDescription = description.c_str(); bool matchesLast = ((info.bits == lastBits)&& (info.width == lastWidth)&& (info.height == lastHeight)&& (info.frequency == lastFreq)); if ((info.bits >= 16)&&(info.width >= 800)&&(!matchesLast)) { modeInfo.push_back(info); } lastBits = info.bits; lastWidth = info.width; lastHeight = info.height; lastFreq = info.frequency; } // ENUM_CURRENT_SETTINGS is defined as ((DWORD)-1) in windows.h EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &winModeInfo); currentMode.bits = winModeInfo.dmBitsPerPel; currentMode.height = winModeInfo.dmPelsHeight; currentMode.width = winModeInfo.dmPelsWidth; currentMode.frequency = winModeInfo.dmDisplayFrequency; } tcDisplayModes::tcDisplayModes() { PopulateModeInfo(); startMode = currentMode; } tcDisplayModes::~tcDisplayModes() { ChangeMode(startMode.width, startMode.height, startMode.bits, startMode.frequency); }
28.93609
146
0.72171
[ "vector" ]
ac8c919b2e661a1f439d56bb68e8458032ca9362
25,389
cpp
C++
Common/interpreter/virtualmachine.cpp
jjuiddong/Common
2518fa05474222f84c474707b4511f190a34f574
[ "MIT" ]
2
2017-11-24T12:34:14.000Z
2021-09-10T02:18:34.000Z
Common/interpreter/virtualmachine.cpp
jjuiddong/Common
2518fa05474222f84c474707b4511f190a34f574
[ "MIT" ]
null
null
null
Common/interpreter/virtualmachine.cpp
jjuiddong/Common
2518fa05474222f84c474707b4511f190a34f574
[ "MIT" ]
6
2017-11-24T12:34:56.000Z
2022-03-22T10:05:45.000Z
#include "stdafx.h" #include "virtualmachine.h" using namespace common; using namespace common::script; cVirtualMachine::cVirtualMachine(const string &name) : m_id(common::GenerateId()) , m_state(eState::Stop) , m_name(name) , m_isCodeTraceLog(false) , m_isDebugging(false) , m_events(128) // maximum queue size { } cVirtualMachine::~cVirtualMachine() { Clear(); } // initialize virtual machine bool cVirtualMachine::Init(const cIntermediateCode &code) { Clear(); m_reg.idx = 0; m_reg.exeIdx = 0; m_reg.cmp = false; m_code = code; m_symbTable = code.m_variables; // initial variable // update tick/timer for (auto &tick : m_code.m_timer1Events) { m_ticks.push_back( { common::GenerateId() , tick.first // tick name , tick.second / 1000.f // tick interval (convert seconds unit) , (float)tick.second / 1000.f } // tick decrease time (convert seconds unit) ); } for (auto &time : m_code.m_timer2Events) { m_timerId = time.first.c_str(); // timer id: node name + node id break; } m_stack.reserve(32); return true; } // add function execute module bool cVirtualMachine::AddModule(iModule *mod) { auto it = std::find(m_modules.begin(), m_modules.end(), mod); if (m_modules.end() != it) return false; // already exist m_modules.push_back(mod); return true; } // remove function execute module bool cVirtualMachine::RemoveModule(iModule *mod) { auto it = std::find(m_modules.begin(), m_modules.end(), mod); if (m_modules.end() == it) return false; // not exist (*it)->CloseModule(*this); m_modules.erase(it); return true; } // execute event, instruction bool cVirtualMachine::Process(const float deltaSeconds) { RETV((eState::Stop == m_state) || (eState::WaitCallback == m_state), true); RETV(!m_code.IsLoaded(), true); ProcessEvent(deltaSeconds); ProcessTimer(deltaSeconds); ExecuteInstruction(deltaSeconds, m_reg); if (m_isCodeTraceLog) CodeTraceLog(m_trace); if (m_isDebugging) CodeTraceLog(m_trace2); return true; } // start virtual machine bool cVirtualMachine::Run() { RETV(eState::Run == m_state, false); // already run m_state = eState::Run; // jump to entry point auto it = m_code.m_jmpMap.find("main"); if (m_code.m_jmpMap.end() != it) m_reg.idx = it->second + 1; // +1 next to label command m_reg.cmp = false; return true; } // resume process bool cVirtualMachine::Resume() { RETV(eState::WaitCallback != m_state, false); m_state = eState::Run; ++m_reg.idx; // goto next instruction return true; } // stop virtual machine bool cVirtualMachine::Stop() { m_state = eState::Stop; m_reg.idx = UINT_MAX; m_reg.exeIdx = UINT_MAX; // clear event, timer, stack m_events.clear(); m_timers.clear(); m_ticks.clear(); m_stack.clear(); // close vm module for (auto &mod : m_modules) mod->CloseModule(*this); return true; } bool cVirtualMachine::PushEvent(const cEvent &evt) { // check same event if (evt.m_isUnique) { uint cnt = 0; uint i = m_events.m_front; uint size = m_events.size(); while (cnt++ < size) { const auto &e = m_events.m_buffer[i]; if (e.m_name != evt.m_name) continue; bool isSame = true; for (auto &kv : evt.m_vars) { auto it = e.m_vars.find(kv.first); if (e.m_vars.end() == it) { isSame = false; break; } if (it->second != kv.second) { isSame = false; break; } } if (isSame) return false; // already exist same event i = (i + 1) % m_events.SIZE; } } m_events.push(evt); return true; } // set timer bool cVirtualMachine::SetTimer(const int timerId, const int timeMillis) { if (m_timerId.empty()) return false; // error, no has timer event code block auto it = std::find_if(m_timers.begin(), m_timers.end() , [&](const auto &a) { return a.id == timerId; }); if (m_timers.end() != it) return false; // already exist m_timers.push_back( { timerId , common::format("timer%d", timerId) // timer name , timeMillis / 1000.f // timer interval (convert seconds unit) , (float)timeMillis / 1000.f } // timer decrease time (convert seconds unit) ); return true; } // stop timer bool cVirtualMachine::StopTimer(const int timerId) { auto it = std::find_if(m_timers.begin(), m_timers.end() , [&](const auto &a) { return a.id == timerId; }); if (m_timers.end() == it) return false; m_timers.erase(it); return true; } // stop tick bool cVirtualMachine::StopTick(const int tickId) { auto it = std::find_if(m_ticks.begin(), m_ticks.end() , [&](const auto &a) { return a.id == tickId; }); if (m_ticks.end() == it) return false; m_ticks.erase(it); return true; } // process event // execute event only waitting state // waitting state is nop instruction state bool cVirtualMachine::ProcessEvent(const float deltaSeconds) { RETV(eState::Wait != m_state, false); RETV(m_events.empty(), false); auto &evt = m_events.front(); const uint addr = m_code.FindJumpAddress(evt.m_name); if (UINT_MAX != addr) { // update symboltable for (auto &kv : evt.m_vars) { vector<string> out; common::tokenizer(kv.first.c_str(), "::", "", out); if (out.size() >= 2) m_symbTable.Set(out[0].c_str(), out[1].c_str(), kv.second); } for (auto &kv : evt.m_vars2) { vector<string> out; common::tokenizer(kv.first.c_str(), "::", "", out); if (out.size() >= 2) m_symbTable.Set(out[0].c_str(), out[1].c_str(), kv.second); } m_reg.idx = addr; // jump instruction code m_state = eState::Run; } else { // error occurred!! // not found event handling //dbg::Logc(1, "cVirtualMachine::Update(), Not Found EventHandling evt:%s \n" // , evt.m_name.c_str()); } m_events.pop(); return true; } // process tick / timer // check tick interval time, call tick event // check timer delay time, call timer event // execute event only waitting state bool cVirtualMachine::ProcessTimer(const float deltaSeconds) { RETV(eState::Wait != m_state, false); if (!m_ticks.empty()) { for (auto &tick : m_ticks) { tick.t -= deltaSeconds; if (tick.t < 0.f) { // tick event trigger // tick id output const string scopeName = (tick.name + "::id").c_str(); PushEvent(cEvent(tick.name, { {scopeName, tick.id} })); tick.t = tick.interval; //break; } } } if (!m_timers.empty()) { auto it = m_timers.begin(); while (it != m_timers.end()) { auto &timer = *it; timer.t -= deltaSeconds; if (timer.t < 0.f) { // timer event trigger // timer id output const string scopeName = (m_timerId + "::id").c_str(); PushEvent(cEvent(m_timerId, { {scopeName, timer.id} })); it = m_timers.erase(it); // remove this timer } else { ++it; } } } return true; } // execute intermediate code instruction bool cVirtualMachine::ExecuteInstruction(const float deltaSeconds, sRegister &reg) { if (m_code.m_codes.size() <= reg.idx) return false; // end of code reg.exeIdx = reg.idx; sInstruction &code = m_code.m_codes[reg.idx]; const VARTYPE varType = GetVarType(code.cmd); // variant type switch (code.cmd) { case eCommand::ldbc: case eCommand::ldic: case eCommand::ldfc: case eCommand::ldsc: case eCommand::ldac: case eCommand::ldmc: if (reg.reg.size() <= code.reg1) goto $error_memory; if (varType != code.var1.vt) goto $error_semantic; reg.reg[code.reg1] = code.var1; ++reg.idx; break; case eCommand::ldcmp: case eCommand::ldncmp: { if (reg.reg.size() <= code.reg1) goto $error_memory; const bool cmp = (code.cmd == eCommand::ldncmp) ? !reg.cmp : reg.cmp; reg.reg[code.reg1] = cmp ? variant_t((bool)true) : variant_t((bool)false); ++reg.idx; } break; case eCommand::ldtim: { if (reg.reg.size() <= code.reg1) goto $error_memory; reg.tim = (float)reg.reg[code.reg1]; ++reg.idx; } break; case eCommand::getb: case eCommand::gets: if (reg.reg.size() <= code.reg1) goto $error_memory; if (m_symbTable.Get(code.str1, code.str2, reg.reg[code.reg1])) { if (varType != reg.reg[code.reg1].vt) goto $error_semantic; ++reg.idx; } else { goto $error; } break; case eCommand::geti: if (reg.reg.size() <= code.reg1) goto $error_memory; if (m_symbTable.Get(code.str1, code.str2, reg.reg[code.reg1])) { if (varType == reg.reg[code.reg1].vt) { ++reg.idx; } else if (IsAssignable(reg.reg[code.reg1].vt, varType)) { reg.reg[code.reg1] = (int)reg.reg[code.reg1]; ++reg.idx; } else { goto $error_semantic; } } else { goto $error; } break; case eCommand::getf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (m_symbTable.Get(code.str1, code.str2, reg.reg[code.reg1])) { if (varType == reg.reg[code.reg1].vt) { ++reg.idx; } else if (IsAssignable(reg.reg[code.reg1].vt, varType)) { reg.reg[code.reg1] = (float)reg.reg[code.reg1]; ++reg.idx; } else { goto $error_semantic; } } else { goto $error; } break; case eCommand::geta: if (reg.reg.size() <= code.reg1) goto $error_memory; if (m_symbTable.Get(code.str1, code.str2, reg.reg[code.reg1])) { const bool isArrayType = (reg.reg[code.reg1].vt & VT_BYREF); // VT_ARRAY? ticky code if (!isArrayType) goto $error_semantic; ++reg.idx; } else { goto $error; } break; case eCommand::getm: if (reg.reg.size() <= code.reg1) goto $error_memory; if (m_symbTable.Get(code.str1, code.str2, reg.reg[code.reg1])) { // ticky code, check map type const bool isMapType = (reg.reg[code.reg1].vt & VT_BYREF); if (!isMapType) goto $error_semantic; ++reg.idx; } else { goto $error; } break; case eCommand::setb: case eCommand::sets: if (reg.reg.size() <= code.reg1) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (m_symbTable.Set(code.str1, code.str2, reg.reg[code.reg1])) ++reg.idx; else goto $error; break; case eCommand::seti: if (reg.reg.size() <= code.reg1) goto $error_memory; if (varType == reg.reg[code.reg1].vt) { if (!m_symbTable.Set(code.str1, code.str2, reg.reg[code.reg1])) goto $error; } else if (IsAssignable(reg.reg[code.reg1].vt, varType)) { if (!m_symbTable.Set(code.str1, code.str2, (int)reg.reg[code.reg1])) goto $error; } else { goto $error_semantic; } ++reg.idx; break; case eCommand::setf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (varType == reg.reg[code.reg1].vt) { if (!m_symbTable.Set(code.str1, code.str2, reg.reg[code.reg1])) goto $error; } else if (IsAssignable(reg.reg[code.reg1].vt, varType)) { if (!m_symbTable.Set(code.str1, code.str2, (float)reg.reg[code.reg1])) goto $error; } else { goto $error_semantic; } ++reg.idx; break; case eCommand::seta: if (reg.reg.size() <= code.reg1) goto $error_memory; if (!(reg.reg[code.reg1].vt & VT_BYREF)) //VT_ARRAY? (tricky code) goto $error_semantic; if (m_symbTable.Set(code.str1, code.str2, reg.reg[code.reg1])) { ++reg.idx; } else { goto $error; } break; case eCommand::setm: if (reg.reg.size() <= code.reg1) goto $error_memory; // tricky code, check map type if (!(reg.reg[code.reg1].vt & VT_BYREF)) goto $error_semantic; if (m_symbTable.Set(code.str1, code.str2, reg.reg[code.reg1])) { ++reg.idx; } else { goto $error; } break; case eCommand::copya: if (reg.reg.size() <= code.reg1) goto $error_memory; if (!(reg.reg[code.reg1].vt & VT_BYREF)) //VT_ARRAY? (tricky code) goto $error_semantic; if (m_symbTable.CopyArray(code.str1, code.str2, reg.reg[code.reg1])) { ++reg.idx; } else { goto $error; } break; case eCommand::copym: if (reg.reg.size() <= code.reg1) goto $error_memory; // tricky code, check map type if (!(reg.reg[code.reg1].vt & VT_BYREF)) goto $error_semantic; if (m_symbTable.CopyMap(code.str1, code.str2, reg.reg[code.reg1])) { ++reg.idx; } else { goto $error; } break; case eCommand::addi: case eCommand::subi: case eCommand::muli: case eCommand::divi: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; switch (code.cmd) { case eCommand::addi: reg.reg[9] = reg.reg[code.reg1].intVal + reg.reg[code.reg2].intVal; break; case eCommand::subi: reg.reg[9] = reg.reg[code.reg1].intVal - reg.reg[code.reg2].intVal; break; case eCommand::muli: reg.reg[9] = reg.reg[code.reg1].intVal * reg.reg[code.reg2].intVal; break; case eCommand::divi: reg.reg[9] = reg.reg[code.reg1].intVal / reg.reg[code.reg2].intVal; break; } ++reg.idx; break; case eCommand::addf: case eCommand::subf: case eCommand::mulf: case eCommand::divf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; switch (code.cmd) { case eCommand::addf: reg.reg[9] = reg.reg[code.reg1].fltVal + reg.reg[code.reg2].fltVal; break; case eCommand::subf: reg.reg[9] = reg.reg[code.reg1].fltVal - reg.reg[code.reg2].fltVal; break; case eCommand::mulf: reg.reg[9] = reg.reg[code.reg1].fltVal * reg.reg[code.reg2].fltVal; break; case eCommand::divf: if (0 == reg.reg[code.reg2].fltVal) break; reg.reg[9] = reg.reg[code.reg1].fltVal / reg.reg[code.reg2].fltVal; break; } ++reg.idx; break; case eCommand::negate: if (reg.reg.size() <= code.reg1) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; reg.reg[9] = !((bool)reg.reg[code.reg1]); ++reg.idx; break; case eCommand::adds: { if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; const string s0 = variant2str(reg.reg[code.reg1]); const string s1 = variant2str(reg.reg[code.reg2]); reg.reg[9] = (s0 + s1).c_str(); ++reg.idx; } break; case eCommand::eqi: case eCommand::eqf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (reg.reg[code.reg1].vt == VT_BOOL) { // force converting int reg.reg[code.reg1] = ((bool)reg.reg[code.reg1]) ? 1 : 0; } if (reg.reg[code.reg2].vt == VT_BOOL) { // force converting int reg.reg[code.reg2] = ((bool)reg.reg[code.reg2]) ? 1 : 0; } if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1] == reg.reg[code.reg2]); ++reg.idx; break; case eCommand::eqs: { if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; const string str1 = common::variant2str(reg.reg[code.reg1]); const string str2 = common::variant2str(reg.reg[code.reg2]); reg.cmp = (str1 == str2); ++reg.idx; } break; case eCommand::eqic: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg[code.reg1].vt == VT_BOOL) { // force converting integer reg.reg[code.reg1] = (int)((bool)reg.reg[code.reg1]) ? 1 : 0; } //if (varType != reg.reg[code.reg1].vt) // goto $error_semantic; //if (varType != code.var1.vt) // goto $error_semantic; // can compare int, float if ((VT_INT != reg.reg[code.reg1].vt) && (VT_R4 != reg.reg[code.reg1].vt)) goto $error_semantic; if ((VT_INT != code.var1.vt) && (VT_R4 != code.var1.vt)) goto $error_semantic; reg.cmp = (int)reg.reg[code.reg1] == (int)code.var1; ++reg.idx; break; case eCommand::eqfc: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg[code.reg1].vt == VT_BOOL) { // force converting float reg.reg[code.reg1] = ((bool)reg.reg[code.reg1]) ? 1.f : 0.f; } // can compare int, float if ((VT_INT != reg.reg[code.reg1].vt) && (VT_R4 != reg.reg[code.reg1].vt)) goto $error_semantic; if ((VT_INT != code.var1.vt) && (VT_R4 != code.var1.vt)) goto $error_semantic; reg.cmp = (float)reg.reg[code.reg1] == (float)code.var1; ++reg.idx; break; case eCommand::eqsc: { if (reg.reg.size() <= code.reg1) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != code.var1.vt) goto $error_semantic; reg.cmp = reg.reg[code.reg1] == code.var1; ++reg.idx; } break; case eCommand::lesi: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].intVal < reg.reg[code.reg2].intVal); ++reg.idx; break; case eCommand::lesf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].fltVal < reg.reg[code.reg2].fltVal); ++reg.idx; break; case eCommand::leqi: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].intVal <= reg.reg[code.reg2].intVal); ++reg.idx; break; case eCommand::leqf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].fltVal <= reg.reg[code.reg2].fltVal); ++reg.idx; break; case eCommand::gri: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].intVal > reg.reg[code.reg2].intVal); ++reg.idx; break; case eCommand::grf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].fltVal > reg.reg[code.reg2].fltVal); ++reg.idx; break; case eCommand::greqi: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].intVal >= reg.reg[code.reg2].intVal); ++reg.idx; break; case eCommand::greqf: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; reg.cmp = (reg.reg[code.reg1].fltVal >= reg.reg[code.reg2].fltVal); ++reg.idx; break; case eCommand::opand: case eCommand::opor: if (reg.reg.size() <= code.reg1) goto $error_memory; if (reg.reg.size() <= code.reg2) goto $error_memory; if (varType != reg.reg[code.reg1].vt) goto $error_semantic; if (varType != reg.reg[code.reg2].vt) goto $error_semantic; if (eCommand::opand == code.cmd) reg.cmp = ((bool)reg.reg[code.reg1] && (bool)reg.reg[code.reg2]); else reg.cmp = ((bool)reg.reg[code.reg1] || (bool)reg.reg[code.reg2]); reg.reg[9] = reg.cmp; ++reg.idx; break; case eCommand::jnz: // jump, if reg.cmp true if (reg.cmp) { auto it = m_code.m_jmpMap.find(code.str1); if (m_code.m_jmpMap.end() == it) goto $error; // not found jump address reg.idx = it->second; // jump instruction code } else { ++reg.idx; } break; case eCommand::jmp: { // jump, label code.str1 auto it = m_code.m_jmpMap.find(code.str1); if (m_code.m_jmpMap.end() == it) goto $error; // not found jump address reg.idx = it->second; // jump instruction code } break; case eCommand::call: { string funcName; int nodeId; std::tie(funcName, nodeId) = cSymbolTable::ParseScopeName(code.str1); if (funcName.empty()) goto $error; bool isFind = false; for (auto &mod : m_modules) { const eModuleResult res = mod->Execute(*this, code.str1, funcName); if ((eModuleResult::None == res) || (eModuleResult::NoHandler == res)) continue; isFind = true; if (eModuleResult::Wait == res) m_state = eState::WaitCallback; // wait until resume else ++reg.idx; break; } if (!isFind) goto $error_call; } break; case eCommand::pushic: { if (varType != code.var1.vt) goto $error_semantic; m_stack.push_back((int)code.var1); ++reg.idx; } break; case eCommand::pop: { if (!m_stack.empty()) m_stack.pop_back(); ++reg.idx; } break; case eCommand::sret: { if (m_stack.empty()) { // no target to jump?, next instruction ++reg.idx; } else { // no pop stack const int idx = m_stack.back(); if (m_code.m_codes.size() > (uint)idx) reg.idx = idx; // jump instruction index } } break; case eCommand::cstack: { m_stack.clear(); ++reg.idx; } break; case eCommand::delay: reg.tim -= (deltaSeconds * 1000.f); // second -> millisecond unit if (reg.tim < 0.f) ++reg.idx; // goto next instruction break; case eCommand::label: case eCommand::cmt: ++reg.idx; // no operation break; case eCommand::nop: // no operation, change wait state m_state = eState::Wait; break; default: goto $error; } return true; $error: dbg::Logc(3, "Error cVirtualMachine::Execute() not valid command. '%s' index=%d, cmd=%d\n" , m_code.m_fileName.c_str(), reg.idx, (int)code.cmd); WriteTraceLog(m_trace2); m_state = eState::Stop; return false; $error_semantic: dbg::Logc(3, "Error cVirtualMachine::Execute() Semantic Error.' %s', index=%d, cmd=%d\n" , m_code.m_fileName.c_str(), reg.idx, (int)code.cmd); WriteTraceLog(m_trace2); m_state = eState::Stop; return false; $error_memory: dbg::Logc(3, "Error cVirtualMachine::Execute() Memory Error. '%s', index=%d, type=%d, reg1=%d, reg2=%d\n" , m_code.m_fileName.c_str(), reg.idx, (int)code.cmd, code.reg1, code.reg2); WriteTraceLog(m_trace2); m_state = eState::Stop; return false; $error_call: dbg::Logc(3, "Error cVirtualMachine::Execute() Calling Function Error. '%s', index=%d, type=%d, reg1=%d, reg2=%d\n" , m_code.m_fileName.c_str(), reg.idx, (int)code.cmd, code.reg1, code.reg2); WriteTraceLog(m_trace2); // vm working, no stop // todo: send error message return false; } // executed code index log // ex) 0-10, 15-20, 101-101 void cVirtualMachine::CodeTraceLog(vector<ushort> &trace) { if (trace.empty()) { // start idx-idx trace.push_back(m_reg.idx); trace.push_back(m_reg.idx); } else { const int curIdx = trace.back(); if (curIdx == m_reg.idx) return; // nothing~ // contineous instruction index? if ((curIdx + 1) == m_reg.idx) { trace.back() = m_reg.idx; } else { // jump instruction index trace.push_back(m_reg.idx); trace.push_back(m_reg.idx); } } } // write tracelog for debugging void cVirtualMachine::WriteTraceLog(const vector<ushort> &trace) { if (trace.empty()) return; StrPath fileName = m_code.m_fileName.GetFileNameExceptExt2(); fileName += ".trace"; std::ofstream ofs(fileName.c_str()); if (!ofs.is_open()) return; for (auto t : trace) ofs << t << std::endl; } // is assignable? // srcVarType: source variable type // dstVarType: destination variable type // dstVarType = srcVarType bool cVirtualMachine::IsAssignable(const VARTYPE srcVarType, const VARTYPE dstVarType) { if (srcVarType == dstVarType) return true; switch (srcVarType) { case VT_INT: switch (dstVarType) { case VT_R4: return true; } break; case VT_R4: return IsAssignable(dstVarType, srcVarType); } return false; } // enable executed code index log on/off void cVirtualMachine::SetCodeTrace(const bool isCodeTrace) { m_isCodeTraceLog = isCodeTrace; } // clear executed code index log // isTakeLast: m_trace.back() take, clear remains void cVirtualMachine::ClearCodeTrace( const bool isTakeLast //=false ) { const int back = (isTakeLast && !m_trace.empty()) ? m_trace.back() : -1; m_trace.clear(); if (isTakeLast) { m_trace.push_back(back); m_trace.push_back(back); } } void cVirtualMachine::Clear() { Stop(); m_symbTable.Clear(); m_code.Clear(); m_events.clear(); m_timers.clear(); m_ticks.clear(); m_stack.clear(); for (auto &mod : m_modules) mod->CloseModule(*this); m_modules.clear(); m_timerId.clear(); }
22.115854
116
0.640474
[ "vector" ]
ac8d9e4a9d656f43507341d546e6b0d90e95de63
301
cpp
C++
atcoder/abc042/B.cpp
Siddhant-K-code/Competitive-Programing-Submissions
336d73bb1164a85ed247898fa040f44b0dbcc431
[ "Apache-2.0" ]
2
2020-12-24T14:06:07.000Z
2021-02-21T20:07:11.000Z
atcoder/abc042/B.cpp
Siddhant-K-code/Competitive-Programing-Submissions
336d73bb1164a85ed247898fa040f44b0dbcc431
[ "Apache-2.0" ]
null
null
null
atcoder/abc042/B.cpp
Siddhant-K-code/Competitive-Programing-Submissions
336d73bb1164a85ed247898fa040f44b0dbcc431
[ "Apache-2.0" ]
4
2021-04-11T15:11:28.000Z
2021-06-12T18:30:24.000Z
#include <bits/stdc++.h> using namespace std; int main(){ int L, N; cin >> N >> L; vector<string> str(N); for(int i = 0; i < N; i++){ cin >> str.at(i); } sort(str.begin(), str.end()); for(int i = 0; i < N; i++){ cout << str.at(i); } cout << endl; }
18.8125
33
0.44186
[ "vector" ]
ac9dec221286a7a65ed6643105693fd90f8c14e5
2,206
cpp
C++
pybind11/server/server.cpp
DeqiTang/build-test-atomsciflow
6fb65c79e74993e2100fbbca31b910d495076805
[ "MIT" ]
1
2022-01-25T01:44:32.000Z
2022-01-25T01:44:32.000Z
pybind11/server/server.cpp
DeqiTang/build-test-atomsciflow
6fb65c79e74993e2100fbbca31b910d495076805
[ "MIT" ]
null
null
null
pybind11/server/server.cpp
DeqiTang/build-test-atomsciflow
6fb65c79e74993e2100fbbca31b910d495076805
[ "MIT" ]
null
null
null
// @file pybind11/server/server.cpp // @author: DeqiTang // Mail: deqitang@gmail.com // Created Time: Thu 17 Mar 2022 09:02:12 PM CST #include <iostream> #include <pybind11/pybind11.h> #include <pybind11/stl.h> // needed for automatical handling with STL #include "atomsciflow/server/job_scheduler.h" namespace py = pybind11; void add_class_job_scheduler(py::module& m) { py::class_<atomsciflow::JobScheduler>(m, "JobScheduler") .def(py::init<>()) .def("set_run", py::overload_cast<std::string, std::string>(&atomsciflow::JobScheduler::py_set_run)) .def("set_run", py::overload_cast<std::string, int>(&atomsciflow::JobScheduler::py_set_run)) .def("set_run", py::overload_cast<std::string, float>(&atomsciflow::JobScheduler::py_set_run)) .def("set_run", py::overload_cast<std::string, double>(&atomsciflow::JobScheduler::py_set_run)) .def("set_run_default", &atomsciflow::JobScheduler::set_run_default) .def("gen_llhpc", &atomsciflow::JobScheduler::gen_llhpc) .def("gen_yh", &atomsciflow::JobScheduler::gen_yh) .def("gen_pbs", &atomsciflow::JobScheduler::gen_pbs) .def("gen_bash", &atomsciflow::JobScheduler::gen_bash) .def("gen_lsf_sz", &atomsciflow::JobScheduler::gen_lsf_sz) .def("gen_lsf_sustc", &atomsciflow::JobScheduler::gen_lsf_sustc) .def("gen_cdcloud", &atomsciflow::JobScheduler::gen_cdcloud) .def("run", &atomsciflow::JobScheduler::run) // according to pybind11, atomsciflow::JobScheduler::steps is a std::vector // when exposed to python, steps.append method will not work or take effect // so we define append_step method to allow append new step to // atomsciflow::JobScheduler::steps in python interface .def("append_step", [&](atomsciflow::JobScheduler& _this, std::string step) { _this.steps.push_back(step); }) .def_readwrite("steps", &atomsciflow::JobScheduler::steps) .def_readwrite("run_params", &atomsciflow::JobScheduler::run_params) ; } PYBIND11_MODULE(server, m) { m.doc() = "server module"; m.attr("__version__") = "0.0.1"; add_class_job_scheduler(m); }
44.12
108
0.67815
[ "vector" ]
ac9e067a589325a36a0948e887d299fe4d2b37df
8,270
cpp
C++
test/unit/math/rev/core/deep_copy_vars_test.cpp
LaudateCorpus1/math
990a66b3cccd27a5fd48626360bb91093a48278b
[ "BSD-3-Clause" ]
1
2020-06-14T14:33:37.000Z
2020-06-14T14:33:37.000Z
test/unit/math/rev/core/deep_copy_vars_test.cpp
LaudateCorpus1/math
990a66b3cccd27a5fd48626360bb91093a48278b
[ "BSD-3-Clause" ]
2
2019-07-23T12:45:30.000Z
2020-05-01T20:43:03.000Z
test/unit/math/rev/core/deep_copy_vars_test.cpp
LaudateCorpus1/math
990a66b3cccd27a5fd48626360bb91093a48278b
[ "BSD-3-Clause" ]
1
2020-05-10T12:55:07.000Z
2020-05-10T12:55:07.000Z
#include <gtest/gtest.h> #include <stan/math/rev/core.hpp> #include <stan/math.hpp> #include <vector> using stan::math::var; using stan::math::vari; TEST(AgradRev_deep_copy_vars, int_arg) { int arg = 5; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, double_arg) { double arg = 5.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, std_vector_int_arg) { std::vector<int> arg(5, 10); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, std_vector_double_arg) { std::vector<double> arg(5, 10.0); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, eigen_vector_arg) { Eigen::VectorXd arg = Eigen::VectorXd::Ones(5); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, eigen_row_vector_arg) { Eigen::RowVectorXd arg = Eigen::RowVectorXd::Ones(5); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, eigen_matrix_arg) { Eigen::MatrixXd arg = Eigen::MatrixXd::Ones(5, 5); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, std_vector_std_vector_double_arg) { std::vector<std::vector<double>> arg(5, std::vector<double>(5, 10.0)); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, std_vector_eigen_vector_arg) { std::vector<Eigen::VectorXd> arg(2, Eigen::VectorXd::Ones(5)); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, std_vector_eigen_row_vector_arg) { std::vector<Eigen::RowVectorXd> arg(2, Eigen::VectorXd::Ones(5)); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, std_vector_eigen_matrix_arg) { std::vector<Eigen::MatrixXd> arg(2, Eigen::MatrixXd::Ones(5, 3)); decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); EXPECT_EQ(&out, &arg); } TEST(AgradRev_deep_copy_vars, var_arg) { var arg(5.0); arg.vi_->adj_ = 2.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); out.grad(); EXPECT_EQ(out.vi_->adj_, 1.0); EXPECT_EQ(arg.vi_->adj_, 2.0); EXPECT_EQ(out, arg); EXPECT_NE(out.vi_, arg.vi_); } TEST(AgradRev_deep_copy_vars, std_vector_var_arg) { std::vector<var> arg(5); for (size_t i = 0; i < arg.size(); ++i) arg[i] = i + 1.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) { stan::math::set_zero_all_adjoints(); arg[i].vi_->adj_ = 2.0; out[i].grad(); EXPECT_EQ(out[i].vi_->adj_, 1.0); EXPECT_EQ(arg[i].vi_->adj_, 2.0); EXPECT_EQ(out[i], arg[i]); EXPECT_NE(out[i].vi_, arg[i].vi_); } } TEST(AgradRev_deep_copy_vars, eigen_vector_var_arg) { Eigen::Matrix<var, Eigen::Dynamic, 1> arg(5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = i + 1.0; arg(i).vi_->adj_ = i + 1.0; } decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) { stan::math::set_zero_all_adjoints(); arg(i).vi_->adj_ = 2.0; out(i).grad(); EXPECT_EQ(out(i).vi_->adj_, 1.0); EXPECT_EQ(arg(i).vi_->adj_, 2.0); EXPECT_EQ(out(i), arg(i)); EXPECT_NE(out(i).vi_, arg(i).vi_); } } TEST(AgradRev_deep_copy_vars, eigen_row_vector_var_arg) { Eigen::Matrix<var, 1, Eigen::Dynamic> arg(5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = i + 1.0; arg(i).vi_->adj_ = i + 1.0; } decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) { stan::math::set_zero_all_adjoints(); arg(i).vi_->adj_ = 2.0; out(i).grad(); EXPECT_EQ(out(i).vi_->adj_, 1.0); EXPECT_EQ(arg(i).vi_->adj_, 2.0); EXPECT_EQ(out(i), arg(i)); EXPECT_NE(out(i).vi_, arg(i).vi_); } } TEST(AgradRev_deep_copy_vars, eigen_matrix_var_arg) { Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic> arg(5, 5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = i + 1.0; arg(i).vi_->adj_ = i + 1.0; } decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) { stan::math::set_zero_all_adjoints(); arg(i).vi_->adj_ = 2.0; out(i).grad(); EXPECT_EQ(out(i).vi_->adj_, 1.0); EXPECT_EQ(arg(i).vi_->adj_, 2.0); EXPECT_EQ(out(i), arg(i)); EXPECT_NE(out(i).vi_, arg(i).vi_); } } TEST(AgradRev_deep_copy_vars, std_vector_std_vector_var_arg) { std::vector<var> arg_(5); std::vector<std::vector<var>> arg(5, arg_); for (size_t i = 0; i < arg.size(); ++i) for (size_t j = 0; j < arg[i].size(); ++j) arg[i][j] = i * arg[i].size() + j + 5.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) for (int j = 0; j < arg[i].size(); ++j) { stan::math::set_zero_all_adjoints(); arg[i][j].vi_->adj_ = 2.0; out[i][j].grad(); EXPECT_EQ(out[i][j].vi_->adj_, 1.0); EXPECT_EQ(arg[i][j].vi_->adj_, 2.0); EXPECT_EQ(out[i][j], arg[i][j]); EXPECT_NE(out[i][j].vi_, arg[i][j].vi_); } } TEST(AgradRev_deep_copy_vars, std_vector_eigen_vector_var_arg) { Eigen::Matrix<var, Eigen::Dynamic, 1> arg_(5); std::vector<Eigen::Matrix<var, Eigen::Dynamic, 1>> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) for (size_t j = 0; j < arg[i].size(); ++j) arg[i](j) = i * arg[i].size() + j + 5.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) for (int j = 0; j < arg[i].size(); ++j) { stan::math::set_zero_all_adjoints(); arg[i](j).vi_->adj_ = 2.0; out[i](j).grad(); EXPECT_EQ(out[i](j).vi_->adj_, 1.0); EXPECT_EQ(arg[i](j).vi_->adj_, 2.0); EXPECT_EQ(out[i](j), arg[i](j)); EXPECT_NE(out[i](j).vi_, arg[i](j).vi_); } } TEST(AgradRev_deep_copy_vars, std_vector_eigen_row_vector_var_arg) { Eigen::Matrix<var, 1, Eigen::Dynamic> arg_(5); std::vector<Eigen::Matrix<var, 1, Eigen::Dynamic>> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) for (size_t j = 0; j < arg[i].size(); ++j) arg[i](j) = i * arg[i].size() + j + 5.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) for (int j = 0; j < arg[i].size(); ++j) { stan::math::set_zero_all_adjoints(); arg[i](j).vi_->adj_ = 2.0; out[i](j).grad(); EXPECT_EQ(out[i](j).vi_->adj_, 1.0); EXPECT_EQ(arg[i](j).vi_->adj_, 2.0); EXPECT_EQ(out[i](j), arg[i](j)); EXPECT_NE(out[i](j).vi_, arg[i](j).vi_); } } TEST(AgradRev_deep_copy_vars, std_vector_eigen_matrix_var_arg) { Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic> arg_(5, 3); std::vector<Eigen::Matrix<var, Eigen::Dynamic, Eigen::Dynamic>> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) for (size_t j = 0; j < arg[i].size(); ++j) arg[i](j) = i * arg[i].size() + j + 5.0; decltype(stan::math::deep_copy_vars(arg)) out = stan::math::deep_copy_vars(arg); for (int i = 0; i < arg.size(); ++i) for (int j = 0; j < arg[i].size(); ++j) { stan::math::set_zero_all_adjoints(); arg[i](j).vi_->adj_ = 2.0; out[i](j).grad(); EXPECT_EQ(out[i](j).vi_->adj_, 1.0); EXPECT_EQ(arg[i](j).vi_->adj_, 2.0); EXPECT_EQ(out[i](j), arg[i](j)); EXPECT_NE(out[i](j).vi_, arg[i](j).vi_); } }
26.850649
79
0.609311
[ "vector" ]
aca1b4bccfbfb4d9f42a3cf8db248570bb8dccf8
10,664
cpp
C++
VortexBaseRuntime/VortexBase/Router.cpp
d0si/vortex
a97031227d4e867986918d39eeb2d184147cf118
[ "MIT" ]
2
2019-12-27T22:06:25.000Z
2020-01-13T18:43:29.000Z
VortexBaseRuntime/VortexBase/Router.cpp
D0si/Vortex
a97031227d4e867986918d39eeb2d184147cf118
[ "MIT" ]
25
2020-01-29T23:04:23.000Z
2020-04-17T06:40:11.000Z
VortexBaseRuntime/VortexBase/Router.cpp
D0si/Vortex
a97031227d4e867986918d39eeb2d184147cf118
[ "MIT" ]
1
2022-03-09T09:14:47.000Z
2022-03-09T09:14:47.000Z
#include <VortexBase/Router.h> #include <Core/Modules/DependencyInjection.h> using Vortex::Core::RuntimeInterface; namespace VortexBase { Router::Router(RuntimeInterface* runtime) : RouterInterface(runtime) { _router_data.lang = "en"; _router_data.controller = "index"; std::string target = _runtime->request()->target().to_string(); _router_data.request_uri = target.substr(1, target.length() - 1); } void Router::init() { Maze::Element router_config = _runtime->config()->get("router", Maze::Type::Object); if (_runtime->di()->plugin_manager()->on_router_init_before(_runtime)) return; if (router_config.is_object("routes")) { Maze::Element routes = router_config.get("routes", Maze::Type::Object); for (auto it = routes.keys_begin(); it != routes.keys_end(); ++it) { const std::string& route_url = *it; const Maze::Element& route = routes.get(route_url); if (route.is_object() && _router_data.request_uri.substr(0, route_url.length()) == route_url) { if (route.is_string("default_lang")) { _router_data.lang = route.get("default_lang").s(); } if (route.is_string("default_controller")) { _router_data.controller = route.get("default_controller").s(); } if (route.is_array("url_schemes")) { router_config.set("url_schemes", route.get("url_schemes")); } } } } if (!router_config.is_array("url_schemes")) { router_config.set("url_schemes", Maze::Element({ "lang", Maze::Element({"type", "default_value"}, {"controller", "index"}), "controller", "args" })); } std::vector<std::string> request_uri_parts; std::string request_uri_part; for (const char& it : _router_data.request_uri) { if (it == '/') { request_uri_parts.push_back(request_uri_part); request_uri_part = ""; } else if (it == '?') { break; } else if (it == '#') { break; } else { request_uri_part += it; } } if (request_uri_part.length() > 0) { request_uri_parts.push_back(request_uri_part); } int i = 0; int parts_count = (int)request_uri_parts.size(); std::vector<std::string> controller_parts; Maze::Element url_schemes = router_config.get("url_schemes", Maze::Type::Array); for (auto url_scheme = url_schemes.begin(); url_scheme != url_schemes.end(); url_scheme++) { if (url_scheme->is_string()) { std::string type = url_scheme->get_string(); if (type == "lang" && i < parts_count) { _router_data.lang = request_uri_parts[i]; } else if (type == "controller" && i < parts_count) { controller_parts.push_back(request_uri_parts[i]); } else if (type == "args" && i < parts_count) { for (; i < parts_count; i++) { _router_data.args.push_back(request_uri_parts[i]); } } else if (type == "arg" && i < parts_count) { _router_data.args.push_back(request_uri_parts[i]); } } else if (url_scheme->is_object()) { if (url_scheme->is_string("type")) { std::string type = url_scheme->get("type").s(); if (type == "lang") { if (url_scheme->is_string("value")) { _router_data.lang = url_scheme->get("value").s(); } else if (i < parts_count) { std::string lang; if (url_scheme->is_string("prefix")) { lang += url_scheme->get("prefix").s(); } lang += request_uri_parts[i]; if (url_scheme->is_string("suffix")) { lang += url_scheme->get("suffix").s(); } _router_data.lang = lang; } else if (url_scheme->is_string("default_value")) { _router_data.lang = url_scheme->get("default_value").s(); } } else if (type == "controller") { if (url_scheme->is_string("value")) { controller_parts.push_back(url_scheme->get("value").s()); } else if (i < parts_count) { std::string controller; if (url_scheme->is_string("prefix")) { controller += url_scheme->get("prefix").s(); } controller += request_uri_parts[i]; if (url_scheme->is_string("suffix")) { controller += url_scheme->get("suffix").s(); } controller_parts.push_back(controller); } else if (url_scheme->is_string("default_value")) { controller_parts.push_back(url_scheme->get("default_value").s()); } } else if (type == "args") { if (i < parts_count) { if (url_scheme->is_int("count")) { int arg_count = url_scheme->get("count").i(); for (int ix = 0; ix < arg_count; ++ix) { if (i < parts_count) { _router_data.args.push_back(request_uri_parts[i]); i++; } } } else { for (; i < parts_count; ++i) { _router_data.args.push_back(request_uri_parts[i]); } } } } else if (type == "arg") { if (url_scheme->is_string("value")) { _router_data.args.push_back(url_scheme->get("value").s()); } else if (i < parts_count) { std::string arg; if (url_scheme->is_string("prefix")) { arg += url_scheme->get("prefix").s(); } arg += request_uri_parts[i]; if (url_scheme->is_string("suffix")) { arg += url_scheme->get("suffix").s(); } _router_data.args.push_back(arg); } else if (url_scheme->is_string("default_value")) { _router_data.args.push_back(url_scheme->get("default_value").s()); } } } } i++; } if (controller_parts.size() > 0) { std::string controller_str; for (int i = 0; i < controller_parts.size(); ++i) { controller_str += controller_parts[i] + "/"; } controller_str.erase(controller_str.length() - 1); _router_data.controller = controller_str; } _runtime->di()->plugin_manager()->on_router_init_after(_runtime); } std::string Router::hostname() { return _runtime->request()->base()[boost::beast::http::field::host].to_string(); } std::string Router::lang() { return _router_data.lang; } std::string Router::controller() { return _router_data.controller; } std::vector<std::string> Router::args() { return _router_data.args; } std::string Router::request_post_body() { return _runtime->request()->body(); } std::map<std::string, std::string> Router::cookies() { if (!_cookies_initialized) { std::string cookies_string = _runtime->request()->base()[boost::beast::http::field::cookie].to_string(); std::string key = ""; std::string value = ""; bool grabbing_value_part = false; for (unsigned int i = 0; i < cookies_string.length(); ++i) { char val = cookies_string[i]; if (val == ';') { _router_data.cookies.emplace(std::make_pair(key, value)); key.clear(); value.clear(); grabbing_value_part = false; while (cookies_string[(size_t)i + 1] == ' ') { ++i; } } else if (val == '=') { grabbing_value_part = true; } else { if (!grabbing_value_part) { key += val; } else { value += val; } } } if (!key.empty()) { _router_data.cookies.emplace(std::make_pair(key, value)); } } return _router_data.cookies; } std::string Router::cookie(const std::string& cookie_name, bool* cookie_exists) { const auto& cookies = this->cookies(); const auto& it = cookies.find(cookie_name); if (it != cookies.end()) { if (cookie_exists != nullptr) { *cookie_exists = true; } return it->second; } if (cookie_exists != nullptr) { *cookie_exists = false; } return ""; } }
36.272109
116
0.425075
[ "object", "vector" ]
aca24a36e2ed80b4ae69a9a53b4f730863ba19ec
15,905
cpp
C++
core/BVH.cpp
snumrl/WAD
a217aadcea0a5624b5ba68cbbec70ce2037b3f51
[ "Apache-2.0" ]
null
null
null
core/BVH.cpp
snumrl/WAD
a217aadcea0a5624b5ba68cbbec70ce2037b3f51
[ "Apache-2.0" ]
null
null
null
core/BVH.cpp
snumrl/WAD
a217aadcea0a5624b5ba68cbbec70ce2037b3f51
[ "Apache-2.0" ]
null
null
null
#include "BVH.h" #include <iostream> namespace MASS { Eigen::Matrix3d R_x(double x); Eigen::Matrix3d R_y(double y); Eigen::Matrix3d R_z(double z); Eigen::Matrix3d R_x(double x) { double cosa = cos(x*3.141592/180.0); double sina = sin(x*3.141592/180.0); Eigen::Matrix3d R; R<< 1,0 ,0 , 0,cosa ,-sina, 0,sina ,cosa ; return R; } Eigen::Matrix3d R_y(double y) { double cosa = cos(y*3.141592/180.0); double sina = sin(y*3.141592/180.0); Eigen::Matrix3d R; R <<cosa ,0,sina, 0 ,1, 0, -sina,0,cosa; return R; } Eigen::Matrix3d R_z(double z) { double cosa = cos(z*3.141592/180.0); double sina = sin(z*3.141592/180.0); Eigen::Matrix3d R; R<< cosa,-sina,0, sina,cosa ,0, 0 ,0 ,1; return R; } BVHNode:: BVHNode(const std::string& name,BVHNode* parent) :mParent(parent),mName(name),mChannelOffset(0),mNumChannels(0) { CHANNEL_NAME = { {"Xposition",Xpos},{"XPOSITION",Xpos}, {"Yposition",Ypos},{"YPOSITION",Ypos}, {"Zposition",Zpos},{"ZPOSITION",Zpos}, {"Xrotation",Xrot},{"XROTATION",Xrot}, {"Yrotation",Yrot},{"YROTATION",Yrot}, {"Zrotation",Zrot},{"ZROTATION",Zrot} }; } void BVHNode:: SetChannel(int c_offset,std::vector<std::string>& c_name) { mChannelOffset = c_offset; mNumChannels = c_name.size(); for(const auto& cn : c_name) mChannel.push_back(CHANNEL_NAME[cn]); } void BVHNode:: Set(const Eigen::VectorXd& m_t) { mR.setIdentity(); for(int i=0;i<mNumChannels;i++) { switch(mChannel[i]) { case Xpos:break; case Ypos:break; case Zpos:break; case Xrot:mR = mR*R_x(m_t[mChannelOffset+i]);break; case Yrot:mR = mR*R_y(m_t[mChannelOffset+i]);break; case Zrot:mR = mR*R_z(m_t[mChannelOffset+i]);break; default:break; } } } void BVHNode:: Set(const Eigen::Matrix3d& R_t) { mR = R_t; } void BVHNode:: SetOffset(double x, double y, double z) { mOffset[0] = x; mOffset[1] = y; mOffset[2] = z; } const Eigen::Matrix3d& BVHNode:: Get() { return mR; } void BVHNode:: AddChild(BVHNode* child) { mChildren.push_back(child); } BVHNode* BVHNode:: GetNode(const std::string& name) { if(!mName.compare(name)) return this; for(auto& c : mChildren) { BVHNode* bn = c->GetNode(name); if(bn!=nullptr) return bn; } return nullptr; } BVH:: BVH(const SkeletonPtr& skel,const std::map<std::string,std::string>& bvh_map) :mSkeleton(skel),mBVHMap(bvh_map),mCyclic(true),mParse(false) { } BVHNode* BVH:: ReadHierarchy(BVHNode* parent, const std::string& name,int& channel_offset,std::ifstream& is) { char buffer[256]; double offset[3]; std::vector<std::string> c_name; BVHNode* new_node = new BVHNode(name,parent); mMap.insert(std::make_pair(name,new_node)); is>>buffer; //{ while(is>>buffer) { if(!strcmp(buffer,"}")) break; if(!strcmp(buffer,"OFFSET")) { //Ignore double x,y,z; is>>x; is>>y; is>>z; new_node->SetOffset(6.0*x,6.0*y,6.0*z); } else if(!strcmp(buffer,"CHANNELS")) { is>>buffer; int n; n= atoi(buffer); for(int i=0;i<n;i++) { is>>buffer; c_name.push_back(std::string(buffer)); } new_node->SetChannel(channel_offset,c_name); channel_offset += n; } else if(!strcmp(buffer,"JOINT")) { is>>buffer; BVHNode* child = ReadHierarchy(new_node,std::string(buffer),channel_offset,is); new_node->AddChild(child); } else if(!strcmp(buffer,"End")) { is>>buffer; BVHNode* child = ReadHierarchy(new_node,std::string("EndEffector"),channel_offset,is); new_node->AddChild(child); } } return new_node; } void BVH:: Parse(const std::string& file, bool cyclic) { mParse = true; mCyclic = cyclic; std::ifstream is(file); char buffer[256]; if(!is) { std::cout<<"Can't Open BVH File"<<std::endl; return; } while(is>>buffer) { if(!strcmp(buffer,"HIERARCHY")) { is>>buffer;//Root is>>buffer;//Name int c_offset = 0; mRoot = ReadHierarchy(nullptr,buffer,c_offset,is); mNumTotalChannels = c_offset; } else if(!strcmp(buffer,"MOTION")) { is>>buffer; //Frames: is>>buffer; //num_frames mNumTotalFrames = atoi(buffer); is>>buffer; //Frame is>>buffer; //Time: is>>buffer; //time step mTimeStep = atof(buffer); mTimeStep = 1.0/30.0; mMotions.resize(mNumTotalFrames/4+1); for(auto& m_t : mMotions) m_t = Eigen::VectorXd::Zero(mNumTotalChannels); double val; for(int i=0; i<mNumTotalFrames; i++) { for(int j=0; j<mNumTotalChannels; j++) { is>>val; if(i%4==0) mMotions[i/4][j] = val; if(i==mNumTotalFrames-1) mMotions[i/4+1][j] = val; } } mNumTotalFrames = mNumTotalFrames/4+1; } } is.close(); this->SetMotionTransform(); this->SetMotionFrames(); if(mCyclic) { this->SetMotionVelFrames(); } else{ this->SetMotionFramesNonCyclic(1000, true); this->SetMotionVelFramesNonCyclic(1000, true); } } Eigen::Matrix3d BVH:: Get(const std::string& bvh_node) { return mMap[bvh_node]->Get(); } void BVH:: SetMotionTransform() { BodyNode* root = mSkeleton->getRootBodyNode(); std::string root_bvh_name = mBVHMap[root->getName()]; Eigen::VectorXd mData = mMotions[0]; mMap[root_bvh_name]->Set(mData); T0.linear() = this->Get(root_bvh_name); T0.translation() = 0.01*mData.segment<3>(0); Eigen::VectorXd mDataLast = mMotions[mNumTotalFrames-1]; mMap[root_bvh_name]->Set(mDataLast); T1.linear() = this->Get(root_bvh_name); T1.translation() = 0.01*(mDataLast.segment<3>(0)); mCycleOffset = T1.translation() + 0.01*(mMotions[1]-mMotions[0]).segment<3>(0) - T0.translation(); } void BVH:: SetMotionFrames() { int dof = mSkeleton->getNumDofs(); mMotionFrames.resize(mNumTotalFrames); mMotionFramesNonCyclic.resize(1000); for(int i=0; i<mNumTotalFrames; i++) { Eigen::VectorXd m_t = mMotions[i]; for(auto& bn: mMap) bn.second->Set(m_t); Eigen::VectorXd p = Eigen::VectorXd::Zero(dof); for(auto ss : mBVHMap) { BodyNode* bn = mSkeleton->getBodyNode(ss.first); Eigen::Matrix3d R = this->Get(ss.second); Joint* jn = bn->getParentJoint(); int idx = jn->getIndexInSkeleton(0); std::string jointName = jn->getName(); if(jn->getType()=="FreeJoint") { Eigen::Isometry3d T; T.translation() = 0.01*m_t.segment<3>(0); T.linear() = R; p.segment<6>(idx) = FreeJoint::convertToPositions(T); if(jointName == "Pelvis"){ if(p[idx+2] > 0) p[idx+2] *= 0.8; else p[idx+2] *= 0.5; } } else if(jn->getType()=="BallJoint"){ p.segment<3>(idx) = BallJoint::convertToPositions(R); if(jointName == "Spine"){ p[idx] -= 0.06; // p[idx] += 0.25; } if(jointName == "Torso"){ // p[idx] += 0.3; if(p[idx+2] > 0) p[idx+2] *= 0.3; } // if(jointName == "ShoulderL" || jointName == "ShoulderR") // p[idx] -= 0.3; if(jointName == "ArmL") p[idx+2] -= 0.05; if(jointName == "ArmR") p[idx+2] += 0.05; if(jointName == "FemurL" || jointName == "FemurR"){ if(p[idx+2] > 0) p[idx+2] *= 0.5; } } else if(jn->getType()=="RevoluteJoint") { Eigen::Vector3d u = dynamic_cast<RevoluteJoint*>(jn)->getAxis(); Eigen::Vector3d aa = BallJoint::convertToPositions(R); double val; if((u-Eigen::Vector3d::UnitX()).norm()<1E-4) val = aa[0]; else if((u-Eigen::Vector3d::UnitY()).norm()<1E-4) val = aa[1]; else val = aa[2]; if(val>M_PI) val -= 2*M_PI; else if(val<-M_PI) val += 2*M_PI; p[idx] = val; } } mMotionFrames[i] = p; mMotionFrames[i][4] -= 0.02; } } void BVH:: SetMotionFramesNonCyclic(int frames, bool blend) { Eigen::VectorXd save_pos = mSkeleton->getPositions(); mSkeleton->setPositions(mMotionFrames[0]); mSkeleton->computeForwardKinematics(true,false,false); Eigen::Vector3d p0_footl = mSkeleton->getBodyNode("TalusL")->getWorldTransform().translation(); Eigen::Vector3d p0_footr = mSkeleton->getBodyNode("TalusR")->getWorldTransform().translation(); Eigen::Isometry3d T0_phase = FreeJoint::convertToTransform(mMotionFrames[0].head<6>()); Eigen::Isometry3d T1_phase = FreeJoint::convertToTransform(mMotionFrames.back().head<6>()); Eigen::Isometry3d T0_nc = T0_phase; Eigen::Isometry3d T01 = T1_phase*T0_phase.inverse(); Eigen::Vector3d p01 = dart::math::logMap(T01.linear()); T01.linear() = dart::math::expMapRot(Utils::projectToXZ(p01)); T01.translation()[1] = 0; int totalLength = mMotionFrames.size(); int smooth_time = 15; for(int i = 0; i < frames; i++) { int phase = i % totalLength; Eigen::VectorXd newMotion; if(i < totalLength) { newMotion = mMotionFrames[i]; mMotionFramesNonCyclic.at(i) = newMotion; } else { Eigen::VectorXd pos; if(phase == 0) { std::vector<std::tuple<std::string, Eigen::Vector3d, Eigen::Vector3d>> constraints; mSkeleton->setPositions(mMotionFramesNonCyclic.at(i-1)); mSkeleton->computeForwardKinematics(true,false,false); Eigen::Vector3d p_footl = mSkeleton->getBodyNode("TalusL")->getWorldTransform().translation(); Eigen::Vector3d p_footr = mSkeleton->getBodyNode("TalusR")->getWorldTransform().translation(); constraints.push_back(std::tuple<std::string, Eigen::Vector3d, Eigen::Vector3d>("TalusL", p_footl, Eigen::Vector3d(0, 0, 0))); constraints.push_back(std::tuple<std::string, Eigen::Vector3d, Eigen::Vector3d>("TalusR", p_footr, Eigen::Vector3d(0, 0, 0))); Eigen::VectorXd p = mMotionFrames[phase]; p.segment<3>(3) = mMotionFramesNonCyclic.at(i-3).segment<3>(3); mSkeleton->setPositions(p); mSkeleton->computeForwardKinematics(true,false,false); //// rotate "root" to seamlessly stitch foot pos = Utils::solveMCIKRoot(mSkeleton, constraints); pos[4] -= 0.006; T0_nc = FreeJoint::convertToTransform(pos.head<6>()); } else { pos = mMotionFrames[phase]; Eigen::Isometry3d T_current = FreeJoint::convertToTransform(pos.head<6>()); Eigen::Isometry3d T0_phase_nc = T0_nc * T0_phase.inverse(); if(phase < smooth_time) { Eigen::Quaterniond Q0_phase_nc(T0_phase_nc.linear()); double slerp_t = (double)phase/smooth_time; slerp_t = 0.5*(1-cos(M_PI*slerp_t)); //smooth slerp t [0,1] Eigen::Quaterniond Q_blend = Q0_phase_nc.slerp(slerp_t, Eigen::Quaterniond::Identity()); T0_phase_nc.linear() = Eigen::Matrix3d(Q_blend); T_current = T0_phase_nc* T_current; } else { T0_phase_nc.linear() = Eigen::Matrix3d::Identity(); T_current = T0_phase_nc* T_current; } pos.head<6>() = FreeJoint::convertToPositions(T_current); pos[28] -= phase * 0.002; pos[4] += 0.002; if(phase == 31 || phase == 1) pos[4] += 0.005; if(phase == 30 || phase == 2) pos[4] += 0.004; if(phase == 29 || phase == 3) pos[4] += 0.003; if(phase == 28 || phase == 4) pos[4] += 0.002; if(phase == 16 || phase == 20) pos[4] += 0.002; if(phase == 17 || phase == 19) pos[4] += 0.004; if(phase == 18) pos[4] += 0.005; } mMotionFramesNonCyclic.at(i) = pos; int mBlendingInterval = 3; if(blend && phase == 0) { for(int j = mBlendingInterval; j > 0; j--) { double weight = 1.0 - j/(double)(mBlendingInterval+1); Eigen::VectorXd prevPos = mMotionFramesNonCyclic[i-j]; mMotionFramesNonCyclic[i-j] = Utils::BlendPosition(prevPos, pos, weight, true); } } } } int idx = 0; for(int i=0; i<1000; i++) { double rem = i%34; if(rem == 32 || rem == 33){ continue; } else{ if(rem == 12) mMotionFramesNonCyclic[i][5] += 0.007; if(rem == 13) mMotionFramesNonCyclic[i][5] += 0.009; if(rem == 14) mMotionFramesNonCyclic[i][5] += 0.010; if(rem == 15) mMotionFramesNonCyclic[i][5] += 0.011; if(rem == 16) mMotionFramesNonCyclic[i][5] += 0.012; if(rem == 17) mMotionFramesNonCyclic[i][5] += 0.013; if(rem == 18) mMotionFramesNonCyclic[i][5] += 0.013; if(rem == 19) mMotionFramesNonCyclic[i][5] += 0.014; if(rem == 20) mMotionFramesNonCyclic[i][5] += 0.015; if(rem == 21) mMotionFramesNonCyclic[i][5] += 0.016; if(rem == 22) mMotionFramesNonCyclic[i][5] += 0.017; if(rem == 23) mMotionFramesNonCyclic[i][5] += 0.020; if(rem == 24) mMotionFramesNonCyclic[i][5] += 0.018; if(rem == 25) mMotionFramesNonCyclic[i][5] += 0.015; if(rem == 26) mMotionFramesNonCyclic[i][5] += 0.011; if(rem == 27) mMotionFramesNonCyclic[i][5] += 0.010; if(rem == 28) mMotionFramesNonCyclic[i][5] += 0.009; if(rem == 29) mMotionFramesNonCyclic[i][5] += 0.006; if(rem == 30) mMotionFramesNonCyclic[i][5] += 0.005; if(rem == 31) mMotionFramesNonCyclic[i][5] += 0.003; mMotionFramesNonCyclic[i][4] += idx*0.0002; mMotionFramesNonCyclicTmp.push_back(mMotionFramesNonCyclic[i]); idx++; } } mSkeleton->setPositions(save_pos); mSkeleton->computeForwardKinematics(true,false,false); } const Eigen::VectorXd& BVH:: GetMotion(int k) { if(mCyclic) return mMotionFrames[k]; else return mMotionFramesNonCyclicTmp[k]; } void BVH:: SetMotionVelFrames() { int dof = mSkeleton->getNumDofs(); mMotionVelFrames = Eigen::MatrixXd::Zero(mNumTotalFrames, dof); int num_joint = mSkeleton->getNumJoints(); for(int i=0; i<mNumTotalFrames-1; i++) { Eigen::VectorXd p0 = mMotionFrames[i]; Eigen::VectorXd p1 = mMotionFrames[i+1]; Eigen::VectorXd v = Eigen::VectorXd::Zero(dof); int offset = 0; for(int j=0; j<num_joint; j++) { Joint* jn = mSkeleton->getJoint(j); if(jn->getType() == "FreeJoint"){ v.segment<3>(offset) = Utils::CalcQuaternionVel(p0.segment<3>(offset+3),p1.segment<3>(offset+3),mTimeStep); v.segment<3>(offset+3) = (p1.segment<3>(offset+3)-p0.segment<3>(offset+3))/mTimeStep; offset += 6; } else if(jn->getType() == "BallJoint") { v.segment<3>(offset) = Utils::CalcQuaternionVelRel(p0.segment<3>(offset+3),p1.segment<3>(offset+3),mTimeStep); offset += 3; } else if(jn->getType() == "RevoluteJoint") { v[offset] = (p1[offset]-p0[offset])/mTimeStep; offset += 1; } } mMotionVelFrames.row(i) = v; } mMotionVelFrames.row(mNumTotalFrames-1) = mMotionVelFrames.row(mNumTotalFrames-2); for (int i=0; i<dof; ++i) { Eigen::VectorXd x = mMotionVelFrames.col(i); Utils::ButterworthFilter(mTimeStep, 6, x); mMotionVelFrames.col(i) = x; } } Eigen::VectorXd BVH:: GetMotionVel(int k) { if(mCyclic) return mMotionVelFrames.row(k); else return mMotionVelFramesNonCyclic.row(k); } void BVH:: SetMotionVelFramesNonCyclic(int frames, bool blend) { int dof = mSkeleton->getNumDofs(); mMotionVelFramesNonCyclic = Eigen::MatrixXd::Zero(frames, dof); frames = mMotionFramesNonCyclicTmp.size(); int num_joint = mSkeleton->getNumJoints(); for(int i=0; i<frames-1; i++) { Eigen::VectorXd p0 = mMotionFramesNonCyclicTmp[i]; Eigen::VectorXd p1 = mMotionFramesNonCyclicTmp[i+1]; Eigen::VectorXd vel = Eigen::VectorXd::Zero(dof); int offset = 0; for(int j=0; j<num_joint; j++) { Joint* jn = mSkeleton->getJoint(j); if(jn->getType() == "FreeJoint"){ vel.segment<3>(offset) = Utils::CalcQuaternionVel(p0.segment<3>(offset+3),p1.segment<3>(offset+3),mTimeStep); vel.segment<3>(offset+3) = (p1.segment<3>(offset+3)-p0.segment<3>(offset+3))/mTimeStep; offset += 6; } else if(jn->getType() == "BallJoint") { vel.segment<3>(offset) = Utils::CalcQuaternionVelRel(p0.segment<3>(offset+3),p1.segment<3>(offset+3),mTimeStep); offset += 3; } else if(jn->getType() == "RevoluteJoint") { vel[offset] = (p1[offset]-p0[offset])/mTimeStep; offset += 1; } } mMotionVelFramesNonCyclic.row(i) = vel; } mMotionVelFramesNonCyclic.row(frames-1) = mMotionVelFramesNonCyclic.row(frames-2); for (int i=0; i<dof; ++i) { Eigen::VectorXd x = mMotionVelFramesNonCyclic.col(i); Utils::ButterworthFilter(mTimeStep, 6, x); mMotionVelFramesNonCyclic.col(i) = x; } } }
23.424153
130
0.636907
[ "vector" ]
aca7f8d340b781782018cf9055c4c5e6cd9d7de3
1,151
cpp
C++
plugins/community/repos/AS/src/BlankPanel4.cpp
guillaume-plantevin/VeeSeeVSTRack
76fafc8e721613669d6f5ae82a0f58ce923a91e1
[ "Zlib", "BSD-3-Clause" ]
233
2018-07-02T16:49:36.000Z
2022-02-27T21:45:39.000Z
plugins/community/repos/AS/src/BlankPanel4.cpp
guillaume-plantevin/VeeSeeVSTRack
76fafc8e721613669d6f5ae82a0f58ce923a91e1
[ "Zlib", "BSD-3-Clause" ]
24
2018-07-09T11:32:15.000Z
2022-01-07T01:45:43.000Z
plugins/community/repos/AS/src/BlankPanel4.cpp
guillaume-plantevin/VeeSeeVSTRack
76fafc8e721613669d6f5ae82a0f58ce923a91e1
[ "Zlib", "BSD-3-Clause" ]
24
2018-07-14T21:55:30.000Z
2021-05-04T04:20:34.000Z
#include "AS.hpp" struct BlankPanel4 : Module { enum ParamIds { NUM_PARAMS }; enum InputIds { NUM_INPUTS }; enum OutputIds { NUM_OUTPUTS }; enum LightIds { BLINK_LIGHT, NUM_LIGHTS }; BlankPanel4() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {} void step() override; }; void BlankPanel4::step() { } struct BlankPanel4Widget : ModuleWidget { BlankPanel4Widget(BlankPanel4 *module); }; BlankPanel4Widget::BlankPanel4Widget(BlankPanel4 *module) : ModuleWidget(module) { setPanel(SVG::load(assetPlugin(plugin, "res/Blanks/BlankPanel4.svg"))); //SCREWS - MOD SPACING FOR RACK WIDTH*4 addChild(Widget::create<as_HexScrew>(Vec(0, 0))); addChild(Widget::create<as_HexScrew>(Vec(box.size.x - RACK_GRID_WIDTH, 0))); addChild(Widget::create<as_HexScrew>(Vec(0, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(Widget::create<as_HexScrew>(Vec(box.size.x - RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); } RACK_PLUGIN_MODEL_INIT(AS, BlankPanel4) { Model *modelBlankPanel4 = Model::create<BlankPanel4, BlankPanel4Widget>("AS", "BlankPanel4", "BlankPanel 4", BLANK_TAG); return modelBlankPanel4; }
25.021739
123
0.737619
[ "model" ]
acac966cea27f3a9e9044a90160cd6738954fc11
1,485
cpp
C++
aws-cpp-sdk-appmesh/source/model/GatewayRouteHostnameRewrite.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-appmesh/source/model/GatewayRouteHostnameRewrite.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-appmesh/source/model/GatewayRouteHostnameRewrite.cpp
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-12-30T04:25:33.000Z
2021-12-30T04:25:33.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/appmesh/model/GatewayRouteHostnameRewrite.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace AppMesh { namespace Model { GatewayRouteHostnameRewrite::GatewayRouteHostnameRewrite() : m_defaultTargetHostname(DefaultGatewayRouteRewrite::NOT_SET), m_defaultTargetHostnameHasBeenSet(false) { } GatewayRouteHostnameRewrite::GatewayRouteHostnameRewrite(JsonView jsonValue) : m_defaultTargetHostname(DefaultGatewayRouteRewrite::NOT_SET), m_defaultTargetHostnameHasBeenSet(false) { *this = jsonValue; } GatewayRouteHostnameRewrite& GatewayRouteHostnameRewrite::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("defaultTargetHostname")) { m_defaultTargetHostname = DefaultGatewayRouteRewriteMapper::GetDefaultGatewayRouteRewriteForName(jsonValue.GetString("defaultTargetHostname")); m_defaultTargetHostnameHasBeenSet = true; } return *this; } JsonValue GatewayRouteHostnameRewrite::Jsonize() const { JsonValue payload; if(m_defaultTargetHostnameHasBeenSet) { payload.WithString("defaultTargetHostname", DefaultGatewayRouteRewriteMapper::GetNameForDefaultGatewayRouteRewrite(m_defaultTargetHostname)); } return payload; } } // namespace Model } // namespace AppMesh } // namespace Aws
24.344262
147
0.79596
[ "model" ]
acbd3bc063f7c60e6144fab1853a316b030b6f82
630
hpp
C++
include/object.hpp
important-sample/path-tracer
a52c9e27563ea3d8bcc2b0f4c26bfebb22c9d8c1
[ "MIT" ]
null
null
null
include/object.hpp
important-sample/path-tracer
a52c9e27563ea3d8bcc2b0f4c26bfebb22c9d8c1
[ "MIT" ]
null
null
null
include/object.hpp
important-sample/path-tracer
a52c9e27563ea3d8bcc2b0f4c26bfebb22c9d8c1
[ "MIT" ]
null
null
null
#pragma once #include <memory> class BaseMaterial; class Vector; class RNG; class Ray; class Object { public: std::shared_ptr<BaseMaterial> material; Object(); Object(std::shared_ptr<BaseMaterial> mat): material(mat) {} virtual float intersect(const Ray& ray) const = 0; virtual Vector getNormalAt(const Vector &point) const = 0; virtual void getUVAt(const Vector &point, float& u, float& v) const = 0; virtual bool isFinite() const = 0; virtual Vector getSample(RNG& rng) const = 0; virtual void getSamples(RNG& rng, int s1, int s2, Vector* samples) const = 0; virtual float getInversePDF() const = 0; };
25.2
79
0.714286
[ "object", "vector" ]
acbf38cc77f0d0aa269e2e0858659a9ce06f5c92
10,975
cpp
C++
src/propagators/UnfoundedBasedCheck.cpp
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
19
2015-12-03T08:53:45.000Z
2022-03-31T02:09:43.000Z
src/propagators/UnfoundedBasedCheck.cpp
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
80
2017-11-25T07:57:32.000Z
2018-06-10T19:03:30.000Z
src/propagators/UnfoundedBasedCheck.cpp
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
6
2015-01-15T07:51:48.000Z
2020-06-18T14:47:48.000Z
#include "UnfoundedBasedCheck.h" #include "../Solver.h" #include "../util/WaspTrace.h" #include "../util/WaspOptions.h" #include "../input/Rule.h" UnfoundedBasedCheck::UnfoundedBasedCheck( vector< GUSData* >& gusData_, Solver& s, unsigned numberOfInputAtoms ) : HCComponent( gusData_, s ) { varsAtLevelZero = 0; numberOfAttachedVars = 0; inUnfoundedSet.push_back( 0 ); while( checker.numberOfVariables() < numberOfInputAtoms ) { checker.addVariable(); inUnfoundedSet.push_back( 0 ); } assert_msg( checker.numberOfVariables() == numberOfInputAtoms, checker.numberOfVariables() << " != " << numberOfInputAtoms ); assert( checker.numberOfVariables() == inUnfoundedSet.size() - 1 ); initChecker(); } bool UnfoundedBasedCheck::onLiteralFalse( Literal literal ) { if( solver.getCurrentDecisionLevel() > 0 ) trail.push_back( literal ); else varsAtLevelZero++; //disabled partial checks // if( wasp::Options::forwardPartialChecks ) // { // hasToTestModel = true; // return true; // } if( trail.size() + varsAtLevelZero == ( numberOfAttachedVars ) ) { hasToTestModel = true; return true; } return false; } void UnfoundedBasedCheck::testModel() { trace_msg( modelchecker, 1, "Check component " << *this ); if( numberOfCalls++ == 0 ) initDataStructures(); //The checker will return always unsat if( isConflictual ) return; vector< Literal > assumptions; computeAssumptions( assumptions ); //The checker will return always unsat if( isConflictual ) return; checkModel( assumptions ); assert( !checker.conflictDetected() ); } void UnfoundedBasedCheck::computeAssumptions( vector< Literal >& assumptions ) { trace_msg( modelchecker, 1, "Computing assumptions" ); iterationInternalLiterals( assumptions ); iterationExternalLiterals( assumptions ); statistics( &checker, assumptions( assumptions.size() ) ); } void UnfoundedBasedCheck::iterationInternalLiterals( vector< Literal >& assumptions ) { trace_msg( modelchecker, 2, "Iteration on " << hcVariablesNotTrueAtLevelZero.size() << " internal variables" ); for( unsigned int i = 0; i < hcVariablesNotTrueAtLevelZero.size(); i++ ) { Var v = hcVariablesNotTrueAtLevelZero[ i ]; if( solver.isUndefined( v ) ) continue; if( solver.isTrue( v ) ) assumptions.push_back( Literal( v, POSITIVE ) ); else if( solver.isFalse( v ) ) { assumptions.push_back( Literal( v, NEGATIVE ) ); assumptions.push_back( Literal( getGUSData( v ).unfoundedVarForHCC, NEGATIVE ) ); } } } void UnfoundedBasedCheck::iterationExternalLiterals( vector< Literal >& assumptions ) { trace_msg( modelchecker, 2, "Iteration on " << externalVars.size() << " external variables" ); int j = 0; for( unsigned int i = 0; i < externalVars.size(); i++ ) { Var v = externalVars[ j ] = externalVars[ i ]; if( solver.isUndefined( v ) ) { j++; continue; } if( solver.getDecisionLevel( v ) > 0 ) { assumptions.push_back( Literal( v, solver.isTrue( v ) ? POSITIVE : NEGATIVE ) ); j++; } else { isConflictual = !checker.addClauseRuntime( Literal( v, solver.isTrue( v ) ? POSITIVE : NEGATIVE ) ); if( isConflictual ) return; } } externalVars.resize( j ); } void UnfoundedBasedCheck::addClausesForHCAtoms() { trace_msg( modelchecker, 1, "Simplifying Head Cycle variables" ); if( isConflictual ) return; Clause* clause = new Clause( hcVariables.size() ); for( unsigned int i = 0; i < hcVariables.size(); i++ ) { Var v = hcVariables[ i ]; Var uv = getGUSData( v ).unfoundedVarForHCC; Var hv = getGUSData( v ).headVarForHCC; clause->addLiteral( Literal( uv, POSITIVE ) ); Clause* c = new Clause( 3 ); c->addLiteral( Literal( uv, POSITIVE ) ); c->addLiteral( Literal( hv, POSITIVE ) ); c->addLiteral( Literal( v, NEGATIVE ) ); isConflictual = !checker.addClause( Literal( uv, NEGATIVE ), Literal( hv, NEGATIVE ) ) || !checker.addClause( Literal( v, POSITIVE ), Literal( hv, NEGATIVE ) ) || !checker.addClause( c ); trace_msg( modelchecker, 2, "Adding clause: " << *c ); trace_msg( modelchecker, 2, "Adding clause: [ " << Literal( uv, NEGATIVE ) << " | " << Literal( hv, NEGATIVE ) << " ]"); trace_msg( modelchecker, 2, "Adding clause: [ " << Literal( v, POSITIVE ) << " | " << Literal( hv, NEGATIVE ) << " ]"); if( isConflictual ) { delete clause; return; } if( !solver.isUndefined( v ) && solver.getDecisionLevel( v ) == 0 ) { if( solver.isTrue( v ) ) isConflictual = !checker.addClause( Literal( v, POSITIVE ) ); else { isConflictual = !checker.addClause( Literal( v, NEGATIVE ) ) || !checker.addClause( Literal( getGUSData( v ).unfoundedVarForHCC, NEGATIVE ) ); } if( isConflictual ) { delete clause; return; } } else { hcVariablesNotTrueAtLevelZero.push_back( v ); } } trace_action( modelchecker, 2, { trace_tag( cerr, modelchecker, 2 ); if( hcVariables.size() == 0 ) cerr << "Adding clause: []" << endl; else { cerr << "Adding clause: [ "; cerr << "u" << Literal( hcVariables[ 0 ], POSITIVE ); for( unsigned int i = 1; i < hcVariables.size(); i++ ) cerr << " | u" << Literal( hcVariables[ i ], POSITIVE ); cerr << " ]" << endl; } } ); isConflictual = !checker.cleanAndAddClause( clause ); } void UnfoundedBasedCheck::initDataStructures() { trace_msg( modelchecker, 2, "First call. Removing unused variables" ); if( isConflictual ) return; addClausesForHCAtoms(); if( !isConflictual ) isConflictual = !checker.preprocessing(); checker.turnOffSimplifications(); } void UnfoundedBasedCheck::checkModel( vector< Literal >& assumptions ) { assert( !checker.conflictDetected() ); assert( checker.getCurrentDecisionLevel() == 0 ); trace_action( modelchecker, 2, { printVector( assumptions, "Assumptions" ); } ); statistics( &checker, startCheckerInvocation( trail.size() != ( hcVariables.size() + externalVars.size() ), time( 0 ) ) ); checker.clearConflictStatus(); if( checker.solve( assumptions ) == COHERENT ) { trace_msg( modelchecker, 1, "SATISFIABLE: the model is not stable." ); for( unsigned int i = 0; i < hcVariables.size(); i++ ) if( checker.isTrue( getGUSData( hcVariables[ i ] ).unfoundedVarForHCC ) ) setInUnfoundedSet( hcVariables[ i ] ); trace_action( modelchecker, 2, { printVector( unfoundedSet, "Unfounded set" ); } ); statistics( &checker, foundUS( trail.size() != ( hcVariables.size() + externalVars.size() ), unfoundedSet.size() ) ); assert( !unfoundedSet.empty() ); } else { trace_msg( modelchecker, 1, "UNSATISFIABLE: the model is stable." ); checker.clearConflictStatus(); } assert( !checker.conflictDetected() ); checker.unrollToZero(); statistics( &checker, endCheckerInvocation( time( 0 ) ) ); } void UnfoundedBasedCheck::processRule( Rule* rule ) { Clause* clause = new Clause(); Clause* c = new Clause(); vector< Var > headAtoms; for( unsigned int k = 0; k < rule->size(); k++ ) { Literal lit = rule->literals[ k ]; Var v = lit.getVariable(); clause->addLiteral( lit ); if( !sameComponent( v ) ) addExternalVariable( v ); else if( lit.isHeadAtom() ) { c->addLiteral( Literal( getGUSData( v ).headVarForHCC, POSITIVE ) ); headAtoms.push_back( v ); } else if( lit.isPositiveBodyLiteral() ) c->addLiteral( Literal( getGUSData( v ).unfoundedVarForHCC, POSITIVE ) ); //body literal with opposite polarity if( !lit.isHeadAtom() || !sameComponent( v ) ) c->addLiteral( lit ); } clause->removeDuplicates(); assert( headAtoms.size() > 0 ); if( headAtoms.size() == 1 ) { c->addLiteral( Literal( headAtoms[ 0 ], NEGATIVE ) ); getGUSData( headAtoms[ 0 ] ).definingRulesForNonHCFAtom.push_back( clause ); Literal defLit = solver.getLiteral( rule->getBodyAux() ); if( defLit.getVariable() != 0 ) solver.setFrozen( defLit.getVariable() ); getGUSData( headAtoms[ 0 ] ).definingLiteralsForNonHCFAtom.push_back( defLit ); } else { checker.addVariable(); Var freshVar = checker.numberOfVariables(); c->addLiteral( Literal( freshVar, NEGATIVE ) ); for( unsigned int k = 0; k < headAtoms.size(); k++ ) { Var v = headAtoms[ k ]; assert( sameComponent( v ) ); getGUSData( v ).definingRulesForNonHCFAtom.push_back( clause ); Literal defLit = solver.getLiteral( rule->getBodyAux() ); if( defLit.getVariable() != 0 ) solver.setFrozen( defLit.getVariable() ); getGUSData( v ).definingLiteralsForNonHCFAtom.push_back( defLit ); trace_msg( modelchecker, 2, "Adding clause: [ " << Literal( getGUSData( v ).unfoundedVarForHCC, NEGATIVE ) << " | " << Literal( freshVar, POSITIVE ) << " ]" ); checker.addClause( Literal( getGUSData( v ).unfoundedVarForHCC, NEGATIVE ), Literal( freshVar, POSITIVE ) ); } } c->removeDuplicates(); checker.addClause( c ); trace_msg( modelchecker, 2, "Adding clause " << *c ); toDelete.push_back( clause ); } void UnfoundedBasedCheck::processComponentBeforeStarting() { for( unsigned int j = 0; j < hcVariables.size(); j++ ) { Var v = hcVariables[ j ]; if( solver.isTrue( v ) ) onLiteralFalse( Literal( v, NEGATIVE ) ); else if( solver.isFalse( v ) ) onLiteralFalse( Literal( v, POSITIVE ) ); } for( unsigned int j = 0; j < externalVars.size(); j++ ) { Var v = externalVars[ j ]; if( solver.isTrue( v ) ) onLiteralFalse( Literal( v, NEGATIVE ) ); else if( solver.isFalse( v ) ) onLiteralFalse( Literal( v, POSITIVE ) ); } }
33.057229
171
0.573121
[ "vector", "model" ]
acc2b217d272d987e1d9edcb99724d18d4321954
681
cpp
C++
Bridge Graph.cpp
atig05/HACKTOBERFEST-2021
a13b4a72c3c13760643f0f2aa4d5dcd8bf2c79dc
[ "MIT" ]
2
2021-10-02T16:48:56.000Z
2021-10-02T17:14:26.000Z
Bridge Graph.cpp
atig05/HACKTOBERFEST-2021
a13b4a72c3c13760643f0f2aa4d5dcd8bf2c79dc
[ "MIT" ]
3
2021-10-30T17:35:27.000Z
2021-10-31T13:43:04.000Z
Bridge Graph.cpp
atig05/HACKTOBERFEST-2021
a13b4a72c3c13760643f0f2aa4d5dcd8bf2c79dc
[ "MIT" ]
4
2021-10-30T08:55:42.000Z
2021-11-10T04:37:51.000Z
#include <bits/stdc++.h> using namespace std; //creating local elemenst just to perform int tim=0; int u[N], v[N], vis[N]; int travin[N], tout[N], isBridge[M], ancestorleast[N]; vector<pair<int, int> > g[N]; //vertex, index of edge void dfs(int k, int par) { vis[k]=1; travin[k]=++tim; ancestorleast[k]=travin[k]; for(auto it:g[k]) { if(it.first==par) continue; if(vis[it.first]) { ancestorleast[k]=min(ancestorleast[k], travin[it.first]); continue; } dfs(it.first, k); ancestorleast[k]=min(ancestorleast[k], ancestorleast[it.first]); if(ancestorleast[it.first]>travin[k]) isBridge[it.second]=1; } tout[k]=tim; }
21.28125
67
0.619677
[ "vector" ]
acc5619d9621429a61aeccdfb53e1e882c090964
744
cc
C++
CPP/No396.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
CPP/No396.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
CPP/No396.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
/** * Created by Xiaozhong on 2020/9/12. * Copyright (c) 2020/9/12 Xiaozhong. All rights reserved. */ #include "vector" #include "iostream" using namespace std; class Solution { public: int maxRotateFunction(vector<int> &A) { int n = A.size(); long s = 0; long f = 0; for (int i = 0; i < n; ++i) { s += A[i]; f += i * A[i]; // F[k] } long ans = f; for (int i = n - 1; i >= 0; --i) { // F[k + 1] = F[k] + Sum[B] - n * B[n - 1] f += s - n * (long) A[i]; ans = max(ans, f); } return ans; } }; int main() { Solution s; vector<int> A = {4, 3, 2, 6}; cout << s.maxRotateFunction(A) << endl; }
21.882353
58
0.43414
[ "vector" ]
acc7011cce4b4d203e7af5138fae1be36a06e0d9
13,418
cpp
C++
instrumentation/metrics_discovery/common/internal/md_information.cpp
Mu-L/metrics-discovery
1e560b60a99b866c941c114cd633f224c1614f3b
[ "MIT" ]
null
null
null
instrumentation/metrics_discovery/common/internal/md_information.cpp
Mu-L/metrics-discovery
1e560b60a99b866c941c114cd633f224c1614f3b
[ "MIT" ]
null
null
null
instrumentation/metrics_discovery/common/internal/md_information.cpp
Mu-L/metrics-discovery
1e560b60a99b866c941c114cd633f224c1614f3b
[ "MIT" ]
null
null
null
/*========================== begin_copyright_notice ============================ Copyright (C) 2022 Intel Corporation SPDX-License-Identifier: MIT ============================= end_copyright_notice ===========================*/ // File Name: md_information.h // Abstract: C++ Metrics Discovery internal information implementation #include "md_information.h" #include "md_adapter.h" #include "md_equation.h" #include "md_metrics_device.h" #include "md_utils.h" namespace MetricsDiscoveryInternal { ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // CInformation constructor // // Description: // Constructor. // // Input: // CMetricsDevice * device - // uint32_t id - // const char* name - // const char* shortName - // const char* longName - // const char* group - // uint32_t apiMask - // TInformationType informationType - // ////////////////////////////////////////////////////////////////////////////// CInformation::CInformation( CMetricsDevice* device, uint32_t id, const char* name, const char* shortName, const char* longName, const char* group, uint32_t apiMask, TInformationType informationType, const char* informationUnits ) { m_params_1_0.IdInSet = id; // filtered, equal to original on creation m_id = id; // original, equal to filtered on creation m_params_1_0.SymbolName = GetCopiedCString( name ); m_params_1_0.ShortName = GetCopiedCString( shortName ); m_params_1_0.LongName = GetCopiedCString( longName ); m_params_1_0.GroupName = GetCopiedCString( group ); m_params_1_0.ApiMask = apiMask; m_params_1_0.InfoType = informationType; m_params_1_0.InfoUnits = GetCopiedCString( informationUnits ); m_params_1_0.OverflowFunction.FunctionType = DELTA_FUNCTION_NULL; m_params_1_0.IoReadEquation = nullptr; m_params_1_0.QueryReadEquation = nullptr; m_availabilityEquation = nullptr; m_ioReadEquation = nullptr; m_queryReadEquation = nullptr; m_device = device; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // CInformation copy constructor // // Description: // Copy constructor. // ////////////////////////////////////////////////////////////////////////////// CInformation::CInformation( const CInformation& other ) : m_device( other.m_device ) { m_params_1_0.IdInSet = other.m_params_1_0.IdInSet; // id after filterings m_id = other.m_id; // initial id before filterings m_params_1_0.SymbolName = GetCopiedCString( other.m_params_1_0.SymbolName ); m_params_1_0.ShortName = GetCopiedCString( other.m_params_1_0.ShortName ); m_params_1_0.GroupName = GetCopiedCString( other.m_params_1_0.GroupName ); m_params_1_0.LongName = GetCopiedCString( other.m_params_1_0.LongName ); m_params_1_0.ApiMask = other.m_params_1_0.ApiMask; m_params_1_0.InfoType = other.m_params_1_0.InfoType; m_params_1_0.InfoUnits = GetCopiedCString( other.m_params_1_0.InfoUnits ); m_params_1_0.OverflowFunction = other.m_params_1_0.OverflowFunction; m_availabilityEquation = ( other.m_availabilityEquation ) ? new( std::nothrow ) CEquation( *other.m_availabilityEquation ) : nullptr; m_ioReadEquation = ( other.m_ioReadEquation ) ? new( std::nothrow ) CEquation( *other.m_ioReadEquation ) : nullptr; m_queryReadEquation = ( other.m_queryReadEquation ) ? new( std::nothrow ) CEquation( *other.m_queryReadEquation ) : nullptr; m_params_1_0.IoReadEquation = (IEquation_1_0*) m_ioReadEquation; m_params_1_0.QueryReadEquation = (IEquation_1_0*) m_queryReadEquation; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // ~CInformation destructor // // Description: // Deallocates memory. // ////////////////////////////////////////////////////////////////////////////// CInformation::~CInformation() { MD_SAFE_DELETE_ARRAY( m_params_1_0.SymbolName ); MD_SAFE_DELETE_ARRAY( m_params_1_0.ShortName ); MD_SAFE_DELETE_ARRAY( m_params_1_0.LongName ); MD_SAFE_DELETE_ARRAY( m_params_1_0.GroupName ); MD_SAFE_DELETE_ARRAY( m_params_1_0.InfoUnits ); MD_SAFE_DELETE( m_availabilityEquation ); MD_SAFE_DELETE( m_ioReadEquation ); MD_SAFE_DELETE( m_queryReadEquation ); } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // GetParams // // Description: // Returns the information params. // // Output: // TInformationParams_1_0* - pointer to the information params // ////////////////////////////////////////////////////////////////////////////// TInformationParams_1_0* CInformation::GetParams( void ) { return &m_params_1_0; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // SetSnapshotReportReadEquation // // Description: // Sets the snapshot (IO) read equation in the information. // // Input: // const char * equationString - equation string, could be empty // // Output: // TCompletionCode - result of the operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::SetSnapshotReportReadEquation( const char* equationString ) { TCompletionCode ret = SetEquation( m_device, &m_ioReadEquation, equationString ); m_params_1_0.IoReadEquation = (IEquation_1_0*) m_ioReadEquation; return ret; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // SetDeltaReportReadEquation // // Description: // Sets the delta (query) read equation in the information. // // Input: // const char * equationString - equation string, could be empty // // Output: // TCompletionCode - result of the operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::SetDeltaReportReadEquation( const char* equationString ) { TCompletionCode ret = SetEquation( m_device, &m_queryReadEquation, equationString ); m_params_1_0.QueryReadEquation = (IEquation_1_0*) m_queryReadEquation; return ret; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // SetAvailabilityEquation // // Description: // Sets the availability equation in the information. It's used to determine if // the information is available on the current platform. // // Input: // const char * equationString - equation string, could be empty // // Output: // TCompletionCode - result of the operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::SetAvailabilityEquation( const char* equationString ) { TCompletionCode ret = SetEquation( m_device, &m_availabilityEquation, equationString ); return ret; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CMetric // // Method: // SetOverflowFunction // // Description: // Sets the overflow delta equation in the information. // It's an equation to calculate whether the overflow occurs. // // Input: // const char* equationString - equation string, could be empty // // Output: // TCompletionCode - result of the operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::SetOverflowFunction( const char* equationString ) { return SetDeltaFunction( equationString, &m_params_1_0.OverflowFunction ); } ////////////////////////////////////////////////////////////////////////////// // // Class: // CMetric // // Method: // SetOverflowFunction // // Description: // Sets the overflow delta equation in the information. // It's an equation to calculate whether the overflow occurs. // // Input: // const char* equationString - equation string, could be empty // // Output: // TCompletionCode - result of the operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::SetOverflowFunction( TDeltaFunction_1_0 overflowFunction ) { m_params_1_0.OverflowFunction = overflowFunction; return CC_OK; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // WriteCInformationToFile // // Description: // Write the information object to file. // // Input: // FILE* metricFile - handle to metric file // // Output: // TCompletionCode - result of the operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::WriteCInformationToFile( FILE* metricFile ) { if( metricFile == nullptr ) { MD_ASSERT_A( m_device->GetAdapter().GetAdapterId(), metricFile != nullptr ); return CC_ERROR_INVALID_PARAMETER; } // m_params_1_0 WriteCStringToFile( m_params_1_0.SymbolName, metricFile ); WriteCStringToFile( m_params_1_0.ShortName, metricFile ); WriteCStringToFile( m_params_1_0.GroupName, metricFile ); WriteCStringToFile( m_params_1_0.LongName, metricFile ); fwrite( &m_params_1_0.ApiMask, sizeof( m_params_1_0.ApiMask ), 1, metricFile ); fwrite( &m_params_1_0.InfoType, sizeof( m_params_1_0.InfoType ), 1, metricFile ); WriteCStringToFile( m_params_1_0.InfoUnits, metricFile ); // Availability equation WriteEquationToFile( m_availabilityEquation, metricFile ); // OverflowFunction fwrite( &m_params_1_0.OverflowFunction.FunctionType, sizeof( m_params_1_0.OverflowFunction.FunctionType ), 1, metricFile ); fwrite( &m_params_1_0.OverflowFunction.BitsCount, sizeof( m_params_1_0.OverflowFunction.BitsCount ), 1, metricFile ); // Equations WriteEquationToFile( m_ioReadEquation, metricFile ); WriteEquationToFile( m_queryReadEquation, metricFile ); return CC_OK; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // SetInformationValue // // Description: // Sets the value for the information as a given equation. // // Input: // uint32_t value - information value // TEquationType equationType - equation to be set // // Output: // TCompletionCode - result of operation // ////////////////////////////////////////////////////////////////////////////// TCompletionCode CInformation::SetInformationValue( uint32_t value, TEquationType equationType ) { TCompletionCode ret = CC_OK; char strValue[11]; // Max string length for decimal uint32_t iu_sprintf_s( strValue, sizeof( strValue ), "%d", value ); if( equationType == EQUATION_IO_READ ) { ret = SetSnapshotReportReadEquation( strValue ); } else if( equationType == EQUATION_QUERY_READ ) { ret = SetDeltaReportReadEquation( strValue ); } else { ret = CC_ERROR_INVALID_PARAMETER; } return ret; } ////////////////////////////////////////////////////////////////////////////// // // Class: // CInformation // // Method: // SetIdInSetParam // // Description: // Updates IdInSet parameter in the information element. // // Input: // uint32_t id - id in current information set // // Output: // void - return values is absent // ////////////////////////////////////////////////////////////////////////////// void CInformation::SetIdInSetParam( uint32_t id ) { m_params_1_0.IdInSet = id; } } // namespace MetricsDiscoveryInternal
34.405128
233
0.51893
[ "object" ]
acc773b627272c557167063a93a81982586e3c76
3,655
hpp
C++
include/robotoc/riccati/unconstr_riccati_factorizer.hpp
mcx/robotoc
4a1d2f522ecc8f9aa8dea17330b97148a2085270
[ "BSD-3-Clause" ]
58
2021-11-11T09:47:02.000Z
2022-03-27T20:13:08.000Z
include/robotoc/riccati/unconstr_riccati_factorizer.hpp
mcx/robotoc
4a1d2f522ecc8f9aa8dea17330b97148a2085270
[ "BSD-3-Clause" ]
30
2021-10-30T10:31:38.000Z
2022-03-28T14:12:08.000Z
include/robotoc/riccati/unconstr_riccati_factorizer.hpp
mcx/robotoc
4a1d2f522ecc8f9aa8dea17330b97148a2085270
[ "BSD-3-Clause" ]
12
2021-11-17T10:59:20.000Z
2022-03-18T07:34:02.000Z
#ifndef ROBOTOC_UNCONSTR_RICCATI_FACTORIZER_HPP_ #define ROBOTOC_UNCONSTR_RICCATI_FACTORIZER_HPP_ #include "Eigen/Core" #include "Eigen/LU" #include "robotoc/robot/robot.hpp" #include "robotoc/ocp/split_kkt_matrix.hpp" #include "robotoc/ocp/split_kkt_residual.hpp" #include "robotoc/ocp/split_direction.hpp" #include "robotoc/riccati/split_riccati_factorization.hpp" #include "robotoc/riccati/lqr_policy.hpp" #include "robotoc/riccati/unconstr_backward_riccati_recursion_factorizer.hpp" #include <limits> #include <cmath> namespace robotoc { /// /// @class UnconstrRiccatiFactorizer /// @brief Riccati factorizer for a time stage. /// class UnconstrRiccatiFactorizer { public: /// /// @brief Constructs a factorizer. /// @param[in] robot Robot model. /// UnconstrRiccatiFactorizer(const Robot& robot); /// /// @brief Default constructor. /// UnconstrRiccatiFactorizer(); /// /// @brief Destructor. /// ~UnconstrRiccatiFactorizer(); /// /// @brief Default copy constructor. /// UnconstrRiccatiFactorizer(const UnconstrRiccatiFactorizer&) = default; /// /// @brief Default copy operator. /// UnconstrRiccatiFactorizer& operator=( const UnconstrRiccatiFactorizer&) = default; /// /// @brief Default move constructor. /// UnconstrRiccatiFactorizer(UnconstrRiccatiFactorizer&&) noexcept = default; /// /// @brief Default move assign operator. /// UnconstrRiccatiFactorizer& operator=( UnconstrRiccatiFactorizer&&) noexcept = default; /// /// @brief Performs the backward Riccati recursion. /// @param[in] riccati_next Riccati factorization at the next time stage. /// @param[in] dt Time step between the current time stage and the next /// @param[in, out] kkt_matrix KKT matrix at the this time stage. /// @param[in, out] kkt_residual KKT residual at the this time stage. /// @param[out] riccati Riccati factorization at the this time stage. /// @param[out] lqr_policy The state feedback control policy of the LQR /// subproblem. /// void backwardRiccatiRecursion(const SplitRiccatiFactorization& riccati_next, const double dt, SplitKKTMatrix& kkt_matrix, SplitKKTResidual& kkt_residual, SplitRiccatiFactorization& riccati, LQRPolicy& lqr_policy); /// /// @brief Performs forward Riccati recursion and computes state direction. /// @param[in] kkt_residual KKT residual at the current time stage. /// @param[in] dt Time step between the current time stage and the next /// @param[in] lqr_policy The state feedback control policy of the LQR /// subproblem. /// @param[in, out] d Split direction at the current time stage. /// @param[out] d_next Split direction at the next time stage. /// void forwardRiccatiRecursion(const SplitKKTResidual& kkt_residual, const double dt, const LQRPolicy& lqr_policy, SplitDirection& d, SplitDirection& d_next) const; /// /// @brief Computes the Newton direction of the costate vector. /// @param[in] riccati Riccati factorization at the current stage. /// @param[in, out] d Split direction of the current this time stage. /// static void computeCostateDirection(const SplitRiccatiFactorization& riccati, SplitDirection& d); private: int dimv_; Eigen::LLT<Eigen::MatrixXd> llt_; UnconstrBackwardRiccatiRecursionFactorizer backward_recursion_; }; } // namespace robotoc #endif // ROBOTOC_UNCONSTR_RICCATI_FACTORIZER_HPP_
32.927928
81
0.688372
[ "vector", "model" ]
acd48f3b974748077ec6cefb6b92b3fe8116ba79
696
cc
C++
Algorithms/Implementation/JumpingOnTheCloudsRevisited/JumpingOnTheCloudsRevisited.cc
simba101/hackerrank
09e5a3b62ee4aca5fe0fcc02e674a3f495419ae6
[ "MIT" ]
null
null
null
Algorithms/Implementation/JumpingOnTheCloudsRevisited/JumpingOnTheCloudsRevisited.cc
simba101/hackerrank
09e5a3b62ee4aca5fe0fcc02e674a3f495419ae6
[ "MIT" ]
null
null
null
Algorithms/Implementation/JumpingOnTheCloudsRevisited/JumpingOnTheCloudsRevisited.cc
simba101/hackerrank
09e5a3b62ee4aca5fe0fcc02e674a3f495419ae6
[ "MIT" ]
null
null
null
/* Solution to the "JumpingOnTheCloudsRevisited" challenge by HackerRank: https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited by simba (szczerbiakadam@gmail.com). */ #include <iostream> #include <vector> int main(int argc, char **argv) { int N, K; std::cin >> N >> K; std::vector<int> clouds; clouds.resize(N); for(int n = 0; n < N; ++n) { std::cin >> clouds[n]; } int pos = 0; int energy = 100; do { pos += K; pos %= N; energy -= 1; // Additional energy penalty (-2) for landing on a thundercloud: if(1 == clouds[pos]) { energy -= 2; } } while(pos != 0); std::cout << energy << std::endl; return 0; }
16.186047
70
0.583333
[ "vector" ]
acd531af6768b7a7a9a2b8c4eadaeecb1602dfff
57,875
cc
C++
software/dtb_expert/pixel_dtb.cc
EJDomi/pixel-dtb-firmware-readout-chain-master
8b1380d002c8deec7d109aa6c1eab59ef6474d9d
[ "Unlicense" ]
1
2017-06-20T17:43:38.000Z
2017-06-20T17:43:38.000Z
software/dtb_expert/pixel_dtb.cc
EJDomi/pixel-dtb-firmware-readout-chain-master
8b1380d002c8deec7d109aa6c1eab59ef6474d9d
[ "Unlicense" ]
null
null
null
software/dtb_expert/pixel_dtb.cc
EJDomi/pixel-dtb-firmware-readout-chain-master
8b1380d002c8deec7d109aa6c1eab59ef6474d9d
[ "Unlicense" ]
null
null
null
// pixel_dtb.cpp #include "dtb_hal.h" #include "pixel_dtb.h" #include "dtb_config.h" #include "rpc.h" #include "SRecordReader.h" #include "sys/alt_cache.h" const int delayAdjust = 4; const int deserAdjust = 4; const int daq_read_size = 32768; // read sizedaq_read_size = 32768; // === DTB identification =================================================== uint16_t CTestboard::GetRpcVersion() { return rpc_GetRpcVersion(); } int32_t CTestboard::GetRpcCallId(string &cmdName) { return rpc_GetRpcCallId(cmdName); } void CTestboard::GetRpcTimestamp(stringR &t) { t = rpc_timestamp; } int32_t CTestboard::GetRpcCallCount() { return rpc_cmdListSize; } bool CTestboard::GetRpcCallName(int32_t id, stringR &callName) { if (id < 0 || id >= rpc_cmdListSize) { callName.clear(); return false; } callName = rpc_cmdlist[id].name; return true; } uint32_t CTestboard::GetRpcCallHash() { uint32_t hash = 0; for(int i = 0; i < rpc_cmdListSize; i++) { hash += ((i+1)*GetHashForString(rpc_cmdlist[i].name)); } return hash; } uint32_t CTestboard::GetHashForString(const char * s) { uint32_t h = 31; while (*s) { h = (h * 54059) ^ (s[0] * 76963); s++; } return h%86969; } #define CLINE(text) text "\n" void CTestboard::GetInfo(stringR &info) { int fw = fw_version; int sw = sw_version; char s[256]; snprintf(s, 255, "Board id: %i\n", dtbConfig.board); info = s; snprintf(s, 255, "HW version: %s\n", dtbConfig.hw_version.c_str()); info += s; snprintf(s, 255, "FW version: %i.%i\n", fw/256, fw & 0xff); info += s; snprintf(s, 255, "SW version: %i.%i\n", sw/256, sw & 0xff); info += s; snprintf(s, 255, "USB id: %s\n", dtbConfig.usb_id.c_str()); info += s; snprintf(s, 255, "MAC address: %012llX\n", dtbConfig.mac_address); info += s; snprintf(s, 255, "Hostname: %s\n", dtbConfig.hostname.c_str()); info += s; snprintf(s, 255, "Comment: %s\n", dtbConfig.comment.c_str()); info += s; } uint16_t CTestboard::GetBoardId() { return dtbConfig.board; } void CTestboard::GetHWVersion(stringR &version) { version = dtbConfig.hw_version; } uint16_t CTestboard::GetFWVersion() { return fw_version; } uint16_t CTestboard::GetSWVersion() { return sw_version; } // === service ============================================================== void CTestboard::Welcome() { _SetLED(0x01); mDelay(60); _SetLED(0x02); mDelay(60); _SetLED(0x08); mDelay(60); _SetLED(0x04); mDelay(60); _SetLED(0x01); mDelay(60); _SetLED(0x02); mDelay(60); _SetLED(0x08); mDelay(60); _SetLED(0x04); mDelay(60); _SetLED(0x01); mDelay(60); _SetLED(0x03); mDelay(60); _SetLED(0x0b); mDelay(60); _SetLED(0x0f); mDelay(200); _SetLED(0x00); } void CTestboard::SetLed(uint8_t x) { _SetLED(x); } // Turn on/off specific LED, negative is off, positive is on void CTestboard::ToggleLed(uint8_t x, bool on) { if(on) { ledstatus |= x; } else { ledstatus &= ~x; } _SetLED(ledstatus); } const uint16_t CTestboard::flashUpgradeVersion = 0x0100; uint16_t CTestboard::UpgradeGetVersion() { return flashUpgradeVersion; } uint8_t CTestboard::UpgradeStart(uint16_t version) { if (version != flashUpgradeVersion) THROW_UGR(ERR_VERSION, flash_error.GetErrorNr()); flash_error.Reset(); flashMem = new CFlashMemory(); flashMem->Assign(2097152); // 2 MB (EPCS16) ugRecordCounter = 0; return flash_error.GetErrorNr(); } uint8_t CTestboard::UpgradeData(string &record) { if (!flashMem) THROW_UGR(ERR_MEMASSIGN, flash_error.GetErrorNr()); CSRecordReader rec; rec.Translate(record.data(), *flashMem); if (IS_ERROR_UG) { delete flashMem; flashMem = 0; } ugRecordCounter++; return flash_error.GetErrorNr(); } uint8_t CTestboard::UpgradeError() { return flash_error.GetErrorNr(); } void CTestboard::UpgradeErrorMsg(stringR &msg) { msg = flash_error.GetErrorMsg(); } void CTestboard::UpgradeExec(uint16_t recordCount) { if (!flashMem) THROW_UG(ERR_MEMASSIGN); if (ugRecordCounter != recordCount) THROW_UG(ERR_RECCOUNT); SetLed(15); flashMem->WriteFlash(); SetLed(0); } // === DTB initialization =================================================== CTestboard::CTestboard() { rpc_io = &usb; // USB default interface flashMem = 0; // no memory assigned for upgrade for (unsigned int i=0; i<8; i++) { daq_mem_base[i] = 0; daq_mem_size[i] = 0; } // stop all DMA channels DAQ_WRITE(DAQ_DMA_0_BASE, DAQ_CONTROL, 0); DAQ_WRITE(DAQ_DMA_1_BASE, DAQ_CONTROL, 0); DAQ_WRITE(DAQ_DMA_2_BASE, DAQ_CONTROL, 0); DAQ_WRITE(DAQ_DMA_3_BASE, DAQ_CONTROL, 0); DAQ_WRITE(DAQ_DMA_4_BASE, DAQ_CONTROL, 0); DAQ_WRITE(DAQ_DMA_5_BASE, DAQ_CONTROL, 0); // *3SDATA // DAQ_WRITE(DAQ_DMA_6_BASE, DAQ_CONTROL, 0); // DAQ_WRITE(DAQ_DMA_7_BASE, DAQ_CONTROL, 0); Init(); } void CTestboard::Init() { // delete assigned memory for flash upgrade if (flashMem) { delete flashMem; flashMem = 0; } // stop pattern generator Pg_Stop(); Pg_SetCmd(0, 0); pg_delaysum = 0; // --- shutdown DAQ --------------------------------- // close all open DAQ channels Daq_Close(0); Daq_Close(1); Daq_Close(2); Daq_Close(3); Daq_Close(4); Daq_Close(5); // *SDATA // Daq_Close(6); // Daq_Close(7); Daq_DeselectAll(); ChipId = 0; TBM_present = false; MOD_present = false; HUB_address = 0; currentClock = MHZ_40; SetClock_(MHZ_1_25); SetClockStretch(0,0,0); // --- clear main control register mainCtrl = 0; _MainControl(0); SetClockSource(0); isPowerOn = false; // --- signal settings sig_level_clk = 5; sig_level_ctr = 5; sig_level_sda = 5; sig_level_tin = 5; sig_offset = 8; Sig_Off(); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x40); // tout ena while(IORD_8DIRECT(LCDS_IO_BASE, 0)); Sig_SetDelay(SIG_CLK, 0, 0); Sig_SetDelay(SIG_CTR, 0, 0); Sig_SetDelay(SIG_SDA, 0, 0); Sig_SetDelay(SIG_TIN, 0, 0); Sig_SetMode(SIG_CLK, SIG_MODE_NORMAL); Sig_SetMode(SIG_CTR, SIG_MODE_NORMAL); Sig_SetMode(SIG_SDA, SIG_MODE_NORMAL); Sig_SetMode(SIG_TIN, SIG_MODE_NORMAL); Sig_SetRdaToutDelay(0); // --- signal probe SignalProbeD1(PROBE_OFF); SignalProbeD2(PROBE_OFF); Adv3224Init(); // --- switch all LEDs off _SetLED(0x00); // --- setup I2C master controller I2C_Main_Init(); I2C_External_Init(); // --- default VD, VA settings vd = mV_to_DAC(2500); // mV id = uA100_to_DAC(3000); // *100 uA va = mV_to_DAC(1500); // mV ia = uA100_to_DAC(3000); // *100 uA InitDac(); for (uint8_t i=0; i<28; i++) SetDac(i,0); Poff(); roc_pixeladdress_inverted = false; // -- default Test Loop parameter settings SetLoopTriggerDelay(0); LoopInterruptReset(); // Reset loop interrupt to none. // -- default ROC_I2C_ADDRESSES for a module: 0-15 for(int i = 0; i < 16; i++) { ROC_I2C_ADDRESSES[i] = i; } } // === timing =============================================================== void CTestboard::cDelay(uint16_t clocks) { uint16_t us = clocks / 40; if (us == 0) us = 1; uDelay(us); } void CTestboard::uDelay(uint16_t us) { usleep(us); } void CTestboard::mDelay(uint16_t ms) { uint16_t i; for (i=0; i<ms; i++) usleep(1000); } void CTestboard::SetClockSource(uint8_t source) { if (source > 1) return; if (((source == 0) && (_MainStatus() & MAINSTATUS_CLK_ACTIVE_DAQ)) || ((source == 1) && !(_MainStatus() & MAINSTATUS_CLK_ACTIVE_DAQ))) mainCtrl |= MAINCTRL_CLK_SEL_DAQ; if (((source == 0) && (_MainStatus() & MAINSTATUS_CLK_ACTIVE_SMPL)) || ((source == 1) && !(_MainStatus() & MAINSTATUS_CLK_ACTIVE_SMPL))) mainCtrl |= MAINCTRL_CLK_SEL_SMPL; if (mainCtrl & (MAINCTRL_CLK_SEL_DAQ | MAINCTRL_CLK_SEL_SMPL)) { _MainControl(mainCtrl); uDelay(1); mainCtrl &= ~(MAINCTRL_CLK_SEL_DAQ | MAINCTRL_CLK_SEL_SMPL); _MainControl(mainCtrl); uDelay(1); _MainControl(mainCtrl | MAINCTRL_PLL_RESET); uDelay(1); _MainControl(mainCtrl); uDelay(10); } } bool CTestboard::IsClockPresent() { return (_MainStatus() & MAINSTATUS_CLK_EXT_BAD) == 0; } void CTestboard::SetClock_(unsigned char MHz) { SetClkDiv(((MHz & 7)<<3) + (MHz & 7)); } void CTestboard::SetClock(unsigned char MHz) { currentClock = MHz; if (isPowerOn) SetClock_(currentClock); } void CTestboard::SetClockStretch(uint8_t src, uint16_t delay, uint16_t width) { if (width > 0) { SetClockStretchReg(0, src|0x04); if (delay > 1022) delay = 1022; delay++; SetClockStretchReg(1, delay); SetClockStretchReg(2, width); } else { SetClockStretchReg(0,0); SetClockStretchReg(1,1); SetClockStretchReg(2,1); } } // === Signal Delay ========================================================= const unsigned short delayConv[] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0006, 0x0007, 0x000e, 0x000f, 0x001e, 0x001f, 0x003e, 0x003f, 0x007e, 0x007f, 0x00fe, 0x00ff, 0x01fe, 0x01ff, 0x03fe, 0x03ff, 0x07fe, 0x07ff, 0x0ffe, 0x0fff, 0x1ffe, 0x1fff }; void CTestboard::Sig_SetDelay(uint8_t signal, uint16_t delay, int8_t duty) { short *sig; switch (signal) { case SIG_CLK: sig = (short*)DELAY_CLK_BASE; break; case SIG_CTR: sig = (short*)DELAY_CTR_BASE; break; case SIG_SDA: sig = (short*)DELAY_SDA_BASE; break; case SIG_TIN: sig = (short*)DELAY_TIN_BASE; break; default: return; } if (delay > 300) delay = 300; if (duty < -8) duty = -8; else if (duty > 8) duty = 8; int16_t delayC = delay / 10; int16_t delayR = (delay % 10) + 8; int16_t delayF = delayR + duty; IOWR_16DIRECT(sig, 0, delayConv[delayF]); IOWR_16DIRECT(sig, 2, delayConv[delayR]); IOWR_16DIRECT(sig, 4, delayC); IOWR_16DIRECT(sig, 6, 0); } void CTestboard::Sig_SetMode(uint8_t signal, uint8_t mode) { short *sig; switch (signal) { case SIG_CLK: sig = (short*)DELAY_CLK_BASE; break; case SIG_CTR: sig = (short*)DELAY_CTR_BASE; break; case SIG_SDA: sig = (short*)DELAY_SDA_BASE; break; case SIG_TIN: sig = (short*)DELAY_TIN_BASE; break; default: return; } switch (mode) { case 0: IOWR_16DIRECT(sig, 6, 0); break; case 1: IOWR_16DIRECT(sig, 6, 1); break; case 2: IOWR_16DIRECT(sig, 6, 3); break; } } void CTestboard::Sig_SetPRBS(uint8_t signal, uint8_t speed) { short *sig; switch (signal) { case SIG_CLK: sig = (short*)DELAY_CLK_BASE; break; case SIG_CTR: sig = (short*)DELAY_CTR_BASE; break; case SIG_SDA: sig = (short*)DELAY_SDA_BASE; break; case SIG_TIN: sig = (short*)DELAY_TIN_BASE; break; default: return; } IOWR_16DIRECT(sig, 6, (speed & 0x1f)<<2 | 0x80); } /* LVDS2LCDS Chip DACs: 0 Bit 3..0: CLK amplitude 1 Bit 3..0: CTR amplitude 2 Bit 3..0: SDA amplitude 3 Bit 3..0: TIN amplitude 4 Bit 0: TIN LVDS select 5 Bit 3..0: signal offset for CLK, CTR, SDA, TIN */ void CTestboard::Sig_SetLevel(uint8_t signal, uint8_t level) { if (level > 15) level = 15; unsigned char dac; switch (signal) { case SIG_CLK: sig_level_clk = level; dac = 0x00; break; case SIG_CTR: sig_level_ctr = level; dac = 0x10; break; case SIG_SDA: sig_level_sda = level; dac = 0x20; break; case SIG_TIN: sig_level_tin = level; dac = 0x30; break; default: return; } if (isPowerOn) { IOWR_8DIRECT(LCDS_IO_BASE, 0, dac + level); while(IORD_8DIRECT(LCDS_IO_BASE, 0)); } } void CTestboard::Sig_SetOffset(uint8_t offset) { if (offset > 15) offset = 15; sig_offset = offset; if (isPowerOn) { IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x50 + offset); while(IORD_8DIRECT(LCDS_IO_BASE, 0)); } } void CTestboard::Sig_Off() { // configure lvds2lcds IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x00); // clk while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x10); // ctr while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x20); // sda while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x30); // tin while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x50); // offset while(IORD_8DIRECT(LCDS_IO_BASE, 0)); } void CTestboard::Sig_Restore() { // configure lvds2lcds IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x00 + sig_level_clk); // clk while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x10 + sig_level_ctr); // ctr while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x20 + sig_level_sda); // sda while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x30 + sig_level_tin); // tin while(IORD_8DIRECT(LCDS_IO_BASE, 0)); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x50 + sig_offset); // offset while(IORD_8DIRECT(LCDS_IO_BASE, 0)); } void CTestboard::Sig_SetLVDS() { mainCtrl &= ~MAINCTRL_TERM; _MainControl(mainCtrl); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x41); } void CTestboard::Sig_SetLCDS() { mainCtrl |= MAINCTRL_TERM; _MainControl(mainCtrl); IOWR_8DIRECT(LCDS_IO_BASE, 0, 0x40); } void CTestboard::Sig_SetRdaToutDelay(uint8_t delay) { static const unsigned char delayStep[20] = { 0x00, // 0: 0.00 ns 0x01, // 1: 1.25 ns 0x02, // 2: 2.50 ns 0x03, // 3: 3.75 ns 0x06, // 4: 5.00 ns 0x07, // 5: 6.25 ns 0x0e, // 6: 7.50 ns 0x0f, // 7: 8.75 ns 0x1e, // 8: 10.00 ns 0x1f, // 9: 11.25 ns 0x20, // 10: 12.50 ns 0x21, // 11: 13.75 ns 0x22, // 12: 15.00 ns 0x23, // 13: 16.25 ns 0x26, // 14: 17.50 ns 0x27, // 15: 18.75 ns 0x2e, // 16: 20.00 ns 0x2f, // 17: 21.25 ns 0x3e, // 18: 22.50 ns 0x3f // 19: 23.75 ns }; if (delay >= 20) delay = 20; SetToutRdbDelay(delayStep[delay]); } // === VD/VA power supply control =========================================== // DAC calibration #define DAC_V0 625 // DAC value for V = 0 #define DAC_VS 5103 // DAC voltage scale factor #define DAC_I0 0 // DAC value for I = 0 #define DAC_IS 1030 // DAC current scale factor // ADC calibration #define ADC_uV 1007 // ADC voltage step [uV] #define ADC_uA 804 // ADC current step [uA] void CTestboard::Pon() { SetClock_(currentClock); if (isPowerOn) return; SetDac(0, 184); // va = 1V; SetDac(2, 184); // vd = 1V; mainCtrl |= MAINCTRL_PWR_ON; if (daq_select_adc) mainCtrl |= MAINCTRL_ADCENA; _MainControl(mainCtrl); isPowerOn = true; SetDac(1, ia); SetDac(0, va); SetDac(3, id); SetDac(2, vd); Sig_Restore(); } void CTestboard::Poff() { Sig_Off(); SetDac(0, 184); // va = 1V; SetDac(2, 184); // vd = 1V; mainCtrl &= ~(MAINCTRL_PWR_ON | MAINCTRL_ADCENA); _MainControl(mainCtrl); isPowerOn = false; Daq_Close(0); Daq_Close(1); Daq_Close(2); Daq_Close(3); Daq_Close(4); Daq_Close(5); // *3SDATA // Daq_Close(6); // Daq_Close(7); SetClock_(MHZ_1_25); } void CTestboard::_SetVD(uint16_t mV) { vd = mV_to_DAC(mV); if (isPowerOn) SetDac(2,vd); } void CTestboard::_SetVA(uint16_t mV) { va = mV_to_DAC(mV); if (isPowerOn) SetDac(0,va); } uint16_t CTestboard::_GetVD() { return ADC_to_mV(ReadADC(2)); } uint16_t CTestboard::_GetVA() { return ADC_to_mV(ReadADC(0)); } void CTestboard::_SetID(uint16_t uA100) { id = uA100_to_DAC(uA100); if (isPowerOn) SetDac(3,id); } void CTestboard::_SetIA(uint16_t uA100) { ia = uA100_to_DAC(uA100); if (isPowerOn) SetDac(1,ia); } uint16_t CTestboard::_GetID() // get VD current in 100 uA { return ADC_to_uA100(ReadADC(3)); } uint16_t CTestboard::_GetIA() // get VA current in 100 uA { return ADC_to_uA100(ReadADC(1)); } unsigned int CTestboard::mV_to_DAC(int mV) { if (mV > 4000) mV = 4000; else if (mV < 0) mV = 0; long dac = (752817-229*(long)mV)/3333; if (dac>1023) dac = 1023; else if (dac<0) dac = 0; return (unsigned int)dac; } unsigned int CTestboard::uA100_to_DAC(int ua100) { if (ua100 > 12000) ua100 = 12000; else if (ua100 < 0) ua100 = 0; unsigned long dac = (105*(unsigned long)ua100)/3300; if (dac>1023) dac = 1023; else if (dac<0) dac = 0; return (unsigned int)dac; } int CTestboard::ADC_to_mV(unsigned int dac) { return (dac*ADC_uV)/1000; } int CTestboard::ADC_to_uA100(unsigned int dac) { return (dac*ADC_uA)/100; } void CTestboard::InitDac() { int res; // --- 0111100(0) 1 11110000 1 00111100 // send slave address 0x3c IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0x78); IOWR_8DIRECT(I2C_MAIN_BASE, CR, STA|WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // switch to extended command IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0xf0); IOWR_8DIRECT(I2C_MAIN_BASE, CR, WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // all channels power up IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0x3c); IOWR_8DIRECT(I2C_MAIN_BASE, CR, WR|STO); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); } void CTestboard::SetDac(int addr, int value) { int res; value &= 0x3ff; // send slave address 0x3d IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0x78); IOWR_8DIRECT(I2C_MAIN_BASE, CR, STA|WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // load dac addr and data D9...D6 IOWR_8DIRECT(I2C_MAIN_BASE, TXR, ((addr&3)<<4) | (value>>6)); IOWR_8DIRECT(I2C_MAIN_BASE, CR, WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // send data D5...D0 IOWR_8DIRECT(I2C_MAIN_BASE, TXR, value <<2); IOWR_8DIRECT(I2C_MAIN_BASE, CR, WR|STO); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); } uint16_t CTestboard::GetADC(uint8_t addr) { return ReadADC(addr); } unsigned int CTestboard::ReadADC(unsigned char addr) { int res; // send slave address 0x35 IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0x6a); IOWR_8DIRECT(I2C_MAIN_BASE, CR, STA|WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // setup 11010010: internal reference, internal clock, unipolar IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0xd2); IOWR_8DIRECT(I2C_MAIN_BASE, CR, WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // configuration 011aaaa1: single channel addr, single ended IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0x61|((addr&0x0f)<<1)); IOWR_8DIRECT(I2C_MAIN_BASE, CR, WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // send slave address 0x35 (read) IOWR_8DIRECT(I2C_MAIN_BASE, TXR, 0x6b); IOWR_8DIRECT(I2C_MAIN_BASE, CR, STA|WR); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); // read D11...D8 IOWR_8DIRECT(I2C_MAIN_BASE, CR, RD); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); unsigned int value = IORD_8DIRECT(I2C_MAIN_BASE, RXR) & 0x0f; // read D7...D0 IOWR_8DIRECT(I2C_MAIN_BASE, CR, RD|ACK|STO); while ((res = IORD_8DIRECT(I2C_MAIN_BASE, SR)) & TIP); value = (value << 8) | IORD_8DIRECT(I2C_MAIN_BASE, RXR); return value; } void CTestboard::HVon() { mainCtrl |= MAINCTRL_HV_ON; _MainControl(mainCtrl); } void CTestboard::HVoff() { mainCtrl &= ~MAINCTRL_HV_ON; _MainControl(mainCtrl); } void CTestboard::ResetOn() { mainCtrl |= MAINCTRL_DUT_nRES; _MainControl(mainCtrl); } void CTestboard::ResetOff() { mainCtrl &= ~MAINCTRL_DUT_nRES; _MainControl(mainCtrl); } uint8_t CTestboard::GetStatus() { return _MainStatus(); } void CTestboard::SetRocAddress(uint8_t addr) { IOWR_ALTERA_AVALON_PIO_DATA(ROC_ADDR_BASE, addr); } // === digital signal probe ================================================= void CTestboard::SignalProbeD1(uint8_t signal) { _Probe1(signal); } void CTestboard::SignalProbeD2(uint8_t signal) { _Probe2(signal); } // === analog signal probe ============================================= void CTestboard::SignalProbeA1(uint8_t signal) { uint8_t sig = signal << 1; uint16_t delay = 200; while (IORD(CROSSPOINT_SWITCH_BASE, 0) & 1) { uDelay(1); if (--delay == 0) return; } IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 4, sig); // A1+ IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 5, sig+1); // A1- IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, 0xFF); } void CTestboard::SignalProbeA2(uint8_t signal) { uint8_t sig = signal << 1; uint16_t delay = 200; while (IORD(CROSSPOINT_SWITCH_BASE, 0) & 1) { uDelay(1); if (--delay == 0) return; } IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 6, sig); // A2+ IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 7, sig+1); // A2- IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, 0xFF); } void CTestboard::SignalProbeADC(uint8_t signal, uint8_t gain) { if (signal >= 8) return; if (gain > 3) gain = 3; uint8_t sig = signal << 1; uint16_t delay = 200; while (IORD(CROSSPOINT_SWITCH_BASE, 0) & 1) { uDelay(1); if (--delay == 0) return; } switch (gain) { case 0: // x1 IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, 16); // ADC+ (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 1, 16); // ADC- (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 2, sig+1); // ADC+ (x1) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 3, sig); // ADC- (x1) break; case 1: // x2 IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, sig+1); // ADC+ (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 1, sig); // ADC- (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 2, sig); // ADC+ (x1) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 3, sig+1); // ADC- (x1) break; case 2: // x3 IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, sig+1); // ADC+ (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 1, sig); // ADC- (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 2, 16); // ADC+ (x1) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 3, 16); // ADC- (x1) break; case 3: // x4 IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, sig+1); // ADC+ (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 1, sig); // ADC- (x3) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 2, sig+1); // ADC+ (x1) IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 3, sig); // ADC- (x1) break; } IOWR_8DIRECT(CROSSPOINT_SWITCH_BASE, 0, 0xFF); } // == pulse pattern generator =========================================== void CTestboard::Pg_SetCmd(unsigned short addr, unsigned short cmd) { if (addr < 256) IOWR_16DIRECT(PATTERNGEN_DATA_BASE, 2*addr, cmd); } void CTestboard::Pg_SetCmdAll(vector<uint16_t> &cmd) { uint16_t count = cmd.size(); if (count > 255) return; for (unsigned short i=0; i<count; i++) { IOWR_16DIRECT(PATTERNGEN_DATA_BASE, 2*i, cmd[i]); } } void CTestboard::Pg_SetSum(uint16_t delays) { pg_delaysum = delays; } void CTestboard::Pg_Stop() { IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x00); } void CTestboard::Pg_Single() { IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x00); IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x81); } void CTestboard::Pg_Trigger() { IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x00); IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x82); } void CTestboard::Pg_Triggers(uint32_t triggers, uint16_t period) { for (uint32_t k = 0; k < triggers; k++) { Pg_Single(); cDelay(period); } } void CTestboard::Pg_Loop(unsigned short period) { IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x00); IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 4, period); IOWR_32DIRECT(PATTERNGEN_CTRL_BASE, 0, 0x84); } // === ROC/Module Communication ========================================= // --- ROC functions ---------------------------------------------------- const unsigned char CTestboard::MODCONF[16] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3 }; // -- set the i2c address for the following commands void CTestboard::roc_I2cAddr(uint8_t id) { ChipId = id & 0x0f; ChipId = id << 4; if (MOD_present) HUB_address = (HUB_address & 0xf8) + MODCONF[id]; } // -- sends "ClrCal" command to ROC void CTestboard::roc_ClrCal() { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(5, 0x01 + ChipId); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } // -- sets a single (DAC) register void CTestboard::roc_SetDAC(uint8_t reg, uint8_t value) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x08 + ChipId); SetI2cHs(2, reg); SetI2cHs(4, value); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } // -- set pixel bits (count <= 60) // M - - - 8 4 2 1 void CTestboard::roc_Pix(uint8_t col, uint8_t row, uint8_t value) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x04 + ChipId); SetI2cHs(2, COLCODE(col)); SetI2cHs(2, ROWCODE(row)); SetI2cHs(4, value & 0x8f); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } // -- trimm a single pixel (count < =60) void CTestboard::roc_Pix_Trim(uint8_t col, uint8_t row, uint8_t value) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x04 + ChipId); SetI2cHs(2, COLCODE(col)); SetI2cHs(2, ROWCODE(row)); SetI2cHs(4, (value & 0x0f) | 0x80); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } // -- mask a single pixel (count <= 60) void CTestboard::roc_Pix_Mask(uint8_t col, uint8_t row) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x04 + ChipId); SetI2cHs(2, COLCODE(col)); SetI2cHs(2, ROWCODE(row)); SetI2cHs(4, 0x0f); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } // -- set calibrate at specific column and row void CTestboard::roc_Pix_Cal(uint8_t col, uint8_t row, bool sensor_cal) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x02 + ChipId); SetI2cHs(2, COLCODE(col)); SetI2cHs(2, ROWCODE(row)); SetI2cHs(4, 0x01); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); if (sensor_cal) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x02 + ChipId); SetI2cHs(2, COLCODE(col)); SetI2cHs(2, ROWCODE(row)); SetI2cHs(4, 0x02); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } } // -- enable/disable a double column void CTestboard::roc_Col_Enable(uint8_t col, bool on) { while (GetI2cHs(0) & 1); if (TBM_present) SetI2cHs(3, HUB_address); SetI2cHs(3, 0x04 + ChipId); SetI2cHs(2, COLCODE(col) & 0xfe); SetI2cHs(2, 0x40); SetI2cHs(4, on ? 0x80 : 0x00); SetI2cHs(1, 0); SetI2cHs(0, TBM_present?3:1); } // -- mask all pixels of a column and the coresponding double column void CTestboard::roc_Col_Mask(uint8_t col) { int row; roc_Col_Enable(col,false); for (row=0; row<ROC_NUMROWS; row++) { roc_Pix_Mask(col, row); } } // -- mask all pixels and columns of the chip void CTestboard::roc_Chip_Mask() { int row, col; for (col=0; col<ROC_NUMCOLS; col+=2) { roc_Col_Enable(col,false); cDelay(5); } for (col=0; col<ROC_NUMCOLS; col++) for (row=0; row<ROC_NUMROWS; row++) { roc_Pix_Mask(col, row); cDelay(5); } } // -- TBM functions -- // selects if you want to use the TBM // Note: MOD_present is used for automatic address assignment. Works with standard BPix modules only bool CTestboard::TBM_Present() { return TBM_present; } void CTestboard::tbm_Enable(bool on) { TBM_present = on; if (!TBM_present) MOD_present = 0; } void CTestboard::tbm_Addr(uint8_t hub, uint8_t port) { MOD_present = false; HUB_address = ((hub & 0x1f)<<3) + (port & 0x07); } void CTestboard::mod_Addr(uint8_t hub) { MOD_present = true; HUB_address = ((hub & 0x1f)<<3); } void CTestboard::tbm_Set(uint8_t reg, uint8_t value) { if (!TBM_present) return; while (GetI2cHs(0) & 1); SetI2cHs(3, (HUB_address & (0x1f<<3)) + 4); // 4 is the TBM address SetI2cHs(3, reg); SetI2cHs(4, value); SetI2cHs(0, 3); } bool CTestboard::tbm_GetRaw(uint8_t reg, uint32_t &value) { if (!TBM_present) { value = -1; return false; } while (GetI2cHs(0) & 1); SetI2cHs(3, (HUB_address & (0x1f<<3)) + 4); SetI2cHs(3, reg | 1); SetI2cHs(4, 0x7ff); SetI2cHs(0, 3); short count = 0; cDelay(5); while ((GetI2cHs(0) & 1) && count<500) count++; value = GetI2cHs(1); return value >= 0; } bool CTestboard::tbm_Get(uint8_t reg, uint8_t &value) { uint32_t x; reg |= 1; if (!tbm_GetRaw(reg, x)) return false; unsigned int y = (((HUB_address & (0x1f<<3)) + 4) << 8) + reg; if (((x>>8) & 0xffff) != y) return false; value = (unsigned char)(x & 0xff); return true; } // --- i2c LLD functions -------------------------------------------------- void CTestboard::LLD_Write(uint8_t reg, uint8_t value) { //S A6 A5 A4 A3 A2 A1 A0 RW=0 ACK DDDDDD00 ACK P //send address IOWR_8DIRECT(I2C_EXTERNAL_BASE, TXR, reg<<1); IOWR_8DIRECT(I2C_EXTERNAL_BASE, CR, STA|WR); while (IORD_8DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); //send value IOWR_8DIRECT(I2C_EXTERNAL_BASE, TXR, value); IOWR_8DIRECT(I2C_EXTERNAL_BASE, CR, WR|STO); while (IORD_8DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); /* IOWR_32DIRECT(I2C_EXTERNAL_BASE, TXR, reg<<1); IOWR_32DIRECT(I2C_EXTERNAL_BASE, CR, STA|WR); while (IORD_32DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); //send value IOWR_32DIRECT(I2C_EXTERNAL_BASE, TXR, value); IOWR_32DIRECT(I2C_EXTERNAL_BASE, CR, WR|STO); while (IORD_32DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); */ } uint8_t CTestboard::LLD_Read(uint8_t reg) { // S A6 A5 A4 A3 A2 A1 A0 RW=1 ACK DDDDDD00 ACK P // Make spaace for R/W bit reg <<= 1; // R/W bit = 1 reg += 1; // send address IOWR_8DIRECT(I2C_EXTERNAL_BASE, TXR, reg); IOWR_8DIRECT(I2C_EXTERNAL_BASE, CR, STA|WR); while (IORD_8DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); // read value uint8_t value; IOWR_8DIRECT(I2C_EXTERNAL_BASE, CR, RD|STO); while (IORD_8DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); value = IORD_8DIRECT(I2C_EXTERNAL_BASE, RXR); return value; /* IOWR_32DIRECT(I2C_EXTERNAL_BASE, TXR, reg); IOWR_32DIRECT(I2C_EXTERNAL_BASE, CR, STA|WR); while (IORD_32DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); // read value uint8_t value; IOWR_32DIRECT(I2C_EXTERNAL_BASE, CR, RD|STO); while (IORD_32DIRECT(I2C_EXTERNAL_BASE, SR) & TIP); value = IORD_32DIRECT(I2C_EXTERNAL_BASE, RXR); return value; */ } // --- Data aquisition ------------------------------------------------------ // *3SDATA uint8_t CTestboard::Daq_FillLevel(uint8_t channel) { if (channel >= DAQ_CHANNELS) return 0; if (daq_mem_base[channel] == 0) return 0; return (uint8_t)((double)Daq_GetSize(channel)/daq_mem_size[channel]*100); } uint8_t CTestboard::Daq_FillLevel() { uint8_t maxlevel = 0; for (uint8_t channel = 0; channel < DAQ_CHANNELS; channel++) { if (daq_mem_base[channel] == 0) continue; uint8_t level = (uint8_t)((double)Daq_GetSize(channel)/daq_mem_size[channel]*100); if(level > maxlevel) maxlevel = level; } return maxlevel; } uint32_t CTestboard::Daq_Open(uint32_t buffersize, uint8_t channel) { if (channel >= DAQ_CHANNELS) return 0; // close last DAQ session if still active Daq_Close(channel); // set size limits for memory allocation if (buffersize > 50000000) buffersize = 50000000; // max 50 Mio samples if (buffersize < 8192) buffersize = 8192; // min 8192 samples // allocate memory daq_mem_base[channel] = new uint16_t[buffersize]; if (daq_mem_base[channel] == 0) return 0; daq_mem_size[channel] = buffersize; // set DMA to allocated memory unsigned int daq_base = DAQ_DMA_BASE[channel]; DAQ_WRITE(daq_base, DAQ_MEM_BASE, (unsigned long)(daq_mem_base[channel])); DAQ_WRITE(daq_base, DAQ_MEM_SIZE, daq_mem_size[channel]); alt_dcache_flush(daq_mem_base[channel], buffersize*2); return daq_mem_size[channel]; } void CTestboard::Daq_Close(uint8_t channel) { if (channel >= DAQ_CHANNELS) return; if (daq_mem_base[channel]) { Daq_DeselectAll(); Daq_Stop(channel); IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, 0); // FIFO reset uDelay(1); delete[] daq_mem_base[channel]; daq_mem_base[channel] = 0; } // Reset possible leftover Loop interrupt: LoopInterruptReset(); } void CTestboard::Daq_Start(uint8_t channel) { if (channel >= DAQ_CHANNELS) return; if (daq_mem_base[channel]) { // clear buffer and enable daq unsigned int daq_base = DAQ_DMA_BASE[channel]; DAQ_WRITE(daq_base, DAQ_CONTROL, 1); // switch on data sources // IOWR_ALTERA_AVALON_PIO_DATA(ADC_BASE, daq_adc_state); // IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, daq_deser160_state); } // Show DAQ status on LEDs, turn on DAQ LED: ToggleLed(1,true); } void CTestboard::Daq_Stop(uint8_t channel) { if (channel >= DAQ_CHANNELS) return; if (daq_mem_base[channel]) { // switch of data sources // IOWR_ALTERA_AVALON_PIO_DATA(ADC_BASE, 0); // IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, 0); // stop daq unsigned int daq_base = DAQ_DMA_BASE[channel]; DAQ_WRITE(daq_base, DAQ_CONTROL, 0); } // Show DAQ status on LEDs, turn on DAQ LED: ToggleLed(1,false); } uint32_t CTestboard::Daq_GetSize(uint8_t channel) { if (channel >= DAQ_CHANNELS) return 0; if (daq_mem_base[channel] == 0) return 0; // read dma status unsigned int daq_base = DAQ_DMA_BASE[channel]; int32_t status = DAQ_READ(daq_base, DAQ_CONTROL); int32_t rp = DAQ_READ(daq_base, DAQ_MEM_READ); int32_t wp = DAQ_READ(daq_base, DAQ_MEM_WRITE); // correct write pointer overrun at memory overflow if (status & DAQ_MEM_OVFL) if (--wp < 0) wp += daq_mem_size[channel]; // calculate available words in memory (-> fifosize) int32_t diff = wp - rp; int32_t fifosize = diff; if (fifosize < 0) fifosize += daq_mem_size[channel]; return fifosize; } template <class T> inline T* Uncache(T *x) { return (T*)(((unsigned long)x) | 0x80000000); } uint8_t CTestboard::Daq_Read(vectorR<uint16_t> &data, uint32_t blocksize, uint8_t channel) { uint32_t availsize; return Daq_Read(data, blocksize, availsize, channel); } uint8_t CTestboard::Daq_Read(vectorR<uint16_t> &data, uint32_t blocksize, uint32_t &availsize, uint8_t channel) { data.clear(); if (channel >= DAQ_CHANNELS) { availsize = 0; return 0; } if (daq_mem_base[channel] == 0) { availsize = 0; return 0; } // limit maximal block size if (blocksize > 0x800000) blocksize = 0x800000; if (blocksize > daq_mem_size[channel]) blocksize = daq_mem_size[channel]; // read dma status unsigned int daq_base = DAQ_DMA_BASE[channel]; int32_t status = DAQ_READ(daq_base, DAQ_CONTROL) ^ 1; int32_t rp = DAQ_READ(daq_base, DAQ_MEM_READ); int32_t wp = DAQ_READ(daq_base, DAQ_MEM_WRITE); // correct write pointer overrun at memory overflow if (status & DAQ_MEM_OVFL) if (--wp < 0) wp += daq_mem_size[channel]; // calculate available words in memory (-> fifosize) int32_t fifosize = wp - rp; if (fifosize < 0) fifosize += daq_mem_size[channel]; // calculate transfer block size (-> blocksize) if (int32_t(blocksize) > fifosize) blocksize = fifosize; // return remaining data size availsize = fifosize - blocksize; // allocate space in vector or return empty data if (blocksize > 0) data.reserve(blocksize); else return uint8_t(status); // --- send 1st part of the data block int32_t size1 = daq_mem_size[channel] - rp; if (size1 > int32_t(blocksize)) size1 = blocksize; // copy data to vector uint16_t *p = Uncache(daq_mem_base[channel]) + rp; data.insert(data.end(), p, p + size1); blocksize -= size1; // --- send 2ns part of the data block if (blocksize > 0) { p = Uncache(daq_mem_base[channel]); data.insert(data.end(), p, p + blocksize); rp = blocksize; } else rp += size1; // update read pointer DAQ_WRITE(daq_base, DAQ_MEM_READ, rp); // dump data // printf("Daq_Read = %02X\n", int(status)); // for (unsigned int i=0; i<data.size(); i++) printf(" %04X", int(data[i])); // printf(" }\n"); return uint8_t(status); } uint8_t CTestboard::Daq_Read(HWvectorR<uint16_t> &data, uint32_t blocksize, uint8_t channel) { uint32_t availsize; return Daq_Read(data, blocksize, availsize, channel); } uint8_t CTestboard::Daq_Read(HWvectorR<uint16_t> &data, uint32_t blocksize, uint32_t &availsize, uint8_t channel) { data.base = 0; data.s1 = 0; data.s2 = 0; if (channel >= DAQ_CHANNELS) { availsize = 0; return 0; } if (daq_mem_base[channel] == 0) { availsize = 0; return 0; } // limit maximal block size if (blocksize > 0x800000) blocksize = 0x800000; if (blocksize > daq_mem_size[channel]) blocksize = daq_mem_size[channel]; // read dma status data.base = DAQ_DMA_BASE[channel]; int32_t status = DAQ_READ(data.base, DAQ_CONTROL) ^ 1; data.rp = DAQ_READ(data.base, DAQ_MEM_READ); int32_t wp = DAQ_READ(data.base, DAQ_MEM_WRITE); // correct write pointer overrun at memory overflow if (status & DAQ_MEM_OVFL) if (--wp < 0) wp += daq_mem_size[channel]; // calculate available words in memory (-> fifosize) int32_t fifosize = wp - data.rp; if (fifosize < 0) fifosize += daq_mem_size[channel]; // calculate transfer block size (-> blocksize) if (int32_t(blocksize) > fifosize) blocksize = fifosize; // return remaining data size availsize = fifosize - blocksize; // allocate space in vector or return empty data if (blocksize == 0) return uint8_t(status); // --- send 1st part of the data block int32_t size1 = daq_mem_size[channel] - data.rp; if (size1 > int32_t(blocksize)) size1 = blocksize; // data block 1 data.p1 = daq_mem_base[channel] + data.rp; data.s1 = size1; blocksize -= size1; // --- data block 2 if (blocksize > 0) { data.p2 = daq_mem_base[channel]; data.s2 = blocksize; data.rp = blocksize; } else data.rp += size1; return uint8_t(status); } void CTestboard::Daq_Read_DeleteData(uint32_t daq_base, int32_t rp) { // update read pointer DAQ_WRITE(daq_base, DAQ_MEM_READ, rp); } void CTestboard::Daq_Select_ADC(uint16_t blocksize, uint8_t source, uint8_t start, uint8_t stop) { if (blocksize < 2) blocksize = 2; else if (blocksize > 65534) blocksize = 65533; blocksize--; if (start > 63) start = 63; if (stop > 63) stop = 63; unsigned short s = start; unsigned short p = stop; switch (source) { case 0: // tin -> tout s |= 0xc000; p |= 0x4000; break; case 1: // trig1 s |= 0x4000; break; case 2: // trig2 s |= 0x8000; break; } // disable deser160 daq_select_deser160 = false; IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, 0); // disable deser400 daq_select_deser400 = false; _Deser400_Control(DESER400_RESET|DESER400_REG_RESET); // enable adc daq_select_adc = true; if (isPowerOn) mainCtrl |= MAINCTRL_ADCENA; _MainControl(mainCtrl); // config ADC ADC_WRITE(ADC_LEN, blocksize); ADC_WRITE(ADC_START, s); ADC_WRITE(ADC_STOP, p); ADC_WRITE(ADC_CTRL, 1); } void CTestboard::Daq_DeselectAll() { // disable deser400 daq_select_deser400 = false; _Deser400_Control(DESER400_RESET|DESER400_REG_RESET); // disable deser160 daq_select_deser160 = false; IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, 0); // disable adc daq_select_adc = false; mainCtrl &= ~MAINCTRL_ADCENA; _MainControl(mainCtrl); ADC_WRITE(ADC_CTRL, 1); // disable data simulator daq_select_datasim = false; IOWR_32DIRECT(EVENTGEN_BASE, 0, 0); } void CTestboard::Daq_Select_Deser160(uint8_t shift) { // disable deser400 daq_select_deser400 = false; _Deser400_Control(DESER400_RESET|DESER400_REG_RESET); // disable adc daq_select_adc = false; mainCtrl &= ~MAINCTRL_ADCENA; _MainControl(mainCtrl); ADC_WRITE(ADC_CTRL, 1); // disable data simulator daq_select_datasim = false; IOWR_32DIRECT(EVENTGEN_BASE, 0, 0); // enable deser160 daq_select_deser160 = true; IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, (shift & 0x7) | 0x8); } void CTestboard::Daq_Select_Deser400() { // disable adc daq_select_adc = false; mainCtrl &= ~MAINCTRL_ADCENA; _MainControl(mainCtrl); ADC_WRITE(ADC_CTRL, 1); // disable deser160 daq_select_deser160 = false; IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, 0); // disable data simulator daq_select_datasim = false; IOWR_32DIRECT(EVENTGEN_BASE, 0, 0); // enable deser400 daq_select_deser400 = true; Daq_Deser400_Reset(); } void CTestboard::Daq_Deser400_OldFormat(bool old) { if (old) mainCtrl |= MAINCTRL_DESER400_OLD; else mainCtrl &= ~MAINCTRL_DESER400_OLD; _MainControl(mainCtrl); } void CTestboard::Daq_Deser400_Reset(uint8_t reset) { if (daq_select_deser400) { _Deser400_Control(DESER400_SEL_MOD0 | (reset & 3)); uDelay(5); _Deser400_Control(DESER400_SEL_MOD0); } } void CTestboard::Daq_Select_Datagenerator(uint16_t startvalue) { // disable adc daq_select_adc = false; mainCtrl &= ~MAINCTRL_ADCENA; _MainControl(mainCtrl); ADC_WRITE(ADC_CTRL, 1); // disable deser160 daq_select_deser160 = false; IOWR_ALTERA_AVALON_PIO_DATA(DESER160_BASE, 0); // disable deser400 daq_select_deser400 = false; _Deser400_Control(DESER400_RESET|DESER400_REG_RESET); // enable data generator daq_select_datasim = true; IOWR_32DIRECT(EVENTGEN_BASE, 0, 0); IOWR_32DIRECT(EVENTGEN_BASE, 1, startvalue); IOWR_32DIRECT(EVENTGEN_BASE, 0, 1); } bool CTestboard::GetPixelAddressInverted() { return roc_pixeladdress_inverted; } void CTestboard::SetPixelAddressInverted(bool status) { roc_pixeladdress_inverted = status; } // ================ ROC TESTING ================ int16_t CTestboard::DecodePixel(vector<uint16_t> &data, int16_t &pos, int16_t &n, int16_t &ph, int16_t &col, int16_t &row) { unsigned int raw = 0; n = 0; // check header if (pos >= int(data.size())) return -1; // missing data if ((data[pos] & 0x8ffc) != 0x87f8) return -2; // wrong header pos++; //int hdr = data[pos++] & 0xfff; if (pos >= int(data.size()) || (data[pos] & 0x8000)) return 0; // empty data readout // read first pixel raw = (data[pos++] & 0xfff) << 12; if (pos >= int(data.size()) || (data[pos] & 0x8000)) return -3; // incomplete data raw += data[pos++] & 0xfff; n++; // read additional noisy pixel int cnt = 0; while (!(pos >= int(data.size()) || (data[pos] & 0x8000))) { pos++; cnt++; } n += cnt / 2; ph = (raw & 0x0f) + ((raw >> 1) & 0xf0); raw >>= 9; int c = (raw >> 12) & 7; c = c * 6 + ((raw >> 9) & 7); int r2 = (raw >> 6) & 7; if(roc_pixeladdress_inverted) r2 ^= 0x7; int r1 = (raw >> 3) & 7; if(roc_pixeladdress_inverted) r1 ^= 0x7; int r0 = (raw) & 7; if(roc_pixeladdress_inverted) r0 ^= 0x7; int r = r2*36 + r1*6 + r0; row = 80 - r / 2; col = 2 * c + (r & 1); return 1; } int16_t CTestboard::DecodeReadout(vector<uint16_t> &data, int16_t &pos, vector< uint16_t> &ph, vector<uint16_t> &col, vector<uint16_t> &row) { unsigned int raw = 0; // check header if (pos >= int(data.size())) return -1; // missing data if ((data[pos] & 0x8ffc) != 0x87f8) return -2; // wrong header pos++; //int hdr = data[pos++] & 0xfff; if (pos >= int(data.size()) || (data[pos] & 0x8000)) return 0; // empty data readout // read pixels while not data end or trailer while (!(pos >= int(data.size()) || (data[pos] & 0x8000))) { // store 24 bits in raw raw = (data[pos++] & 0xfff) << 12; if (pos >= int(data.size()) || (data[pos] & 0x8000)) return -3; // incomplete data raw += data[pos++] & 0xfff; //decode raw and append to vectors ph.push_back((raw & 0x0f) + ((raw >> 1) & 0xf0)); raw >>= 9; int c = (raw >> 12) & 7; c = c * 6 + ((raw >> 9) & 7); int r2 = (raw >> 6) & 7; if(roc_pixeladdress_inverted) r2 ^= 0x7; int r1 = (raw >> 3) & 7; if(roc_pixeladdress_inverted) r1 ^= 0x7; int r0 = (raw) & 7; if(roc_pixeladdress_inverted) r0 ^= 0x7; int r = r2*36 + r1*6 + r0; row.push_back(80 - r / 2); col.push_back(2 * c + (r & 1)); } return 1; } // to be renamed after kicking out psi46expert dependency void CTestboard::Daq_Enable2(int32_t block) { if (!TBM_Present()){ Daq_Select_Deser160(deserAdjust); } //Daq_Select_Deser400(); Daq_Open(block, 0); Daq_Start(0); if (TBM_Present()){ Daq_Open(block, 1); Daq_Start(1); } } // to be renamed after kicking out psi46expert dependency void CTestboard::Daq_Disable2() { Daq_Stop(0); Daq_Close(0); if (TBM_Present()){ Daq_Stop(1); Daq_Close(1); } } int8_t CTestboard::Daq_Read2(vector<uint16_t> &data, uint16_t daq_read_size_2, uint32_t &n) { int8_t status; n=0; status = Daq_Read(data, daq_read_size_2, n, 0); if (TBM_Present()){ vector<uint16_t> data1; data1.clear(); n=0; status += Daq_Read(data1, daq_read_size_2, n, 1); data.insert( data.end(), data1.begin(), data1.end() ); } return status; } int16_t CTestboard::TrimChip(vector<int16_t> &trim) { // trim pixel to value or mask pixel if value = -1 int16_t value; for (int8_t col = 0; col < ROC_NUMCOLS; col++) { for (int8_t row = 0; row < ROC_NUMROWS; row++) { value = trim[col * ROC_NUMROWS + row]; if (value == -1){ roc_Pix_Mask(col, row); } else { roc_Pix_Trim(col, row, value); } } } trim.clear(); return 1; } void CTestboard::DecodeTbmHeader(unsigned int raw, int16_t &evNr, int16_t &stkCnt) { evNr = raw >> 8; stkCnt = raw & 6; } void CTestboard::DecodeTbmTrailer(unsigned int raw, int16_t &dataId, int16_t &data) { dataId = (raw >> 6) & 0x3; data = raw & 0x3f; } void CTestboard::DecodePixel(unsigned int raw, int16_t &n, int16_t &ph, int16_t &col, int16_t &row) { n = 1; ph = (raw & 0x0f) + ((raw >> 1) & 0xf0); raw >>= 9; int c = (raw >> 12) & 7; c = c * 6 + ((raw >> 9) & 7); int r2 = (raw >> 6) & 7; if(roc_pixeladdress_inverted) r2 ^= 0x7; int r1 = (raw >> 3) & 7; if(roc_pixeladdress_inverted) r1 ^= 0x7; int r0 = (raw) & 7; if(roc_pixeladdress_inverted) r0 ^= 0x7; int r = r2*36 + r1*6 + r0; row = 80 - r / 2; col = 2 * c + (r & 1); } int8_t CTestboard::Decode(const vector<uint16_t> &data, vector<uint16_t> &n, vector<uint16_t> &ph, vector<uint32_t> &adr, uint8_t channel) { //uint32_t words_remaining = 0; uint16_t hdr, trl; unsigned int raw = 0; int16_t n_pix = 0, ph_pix = 0, col = 0, row = 0, evNr = 0, stkCnt = 0, dataId = 0, dataNr = 0; int16_t roc_n = -1 + channel * 8; // Get the right ROC id, channel 0: 0-7, channel 1: 8-15 int16_t tbm_n = 1; uint32_t address; int pos = 0; //Module readout if (TBM_Present()){ for (unsigned int i=0; i<data.size(); i++) { int d = data[i] & 0xf; int q = (data[i]>>4) & 0xf; switch (q) { case 0: break; case 1: raw = d; break; case 2: raw = (raw<<4) + d; break; case 3: raw = (raw<<4) + d; break; case 4: raw = (raw<<4) + d; break; case 5: raw = (raw<<4) + d; break; case 6: raw = (raw<<4) + d; DecodePixel(raw, n_pix, ph_pix, col, row); n.push_back(n_pix); ph.push_back(ph_pix); address = tbm_n; address = (address << 8) + roc_n; address = (address << 8) + col; address = (address << 8) + row; adr.push_back(address); break; case 7: roc_n++; break; case 8: hdr = d; break; case 9: hdr = (hdr<<4) + d; break; case 10: hdr = (hdr<<4) + d; break; case 11: hdr = (hdr<<4) + d; DecodeTbmHeader(hdr, evNr, stkCnt); tbm_n = tbm_n ^ 1; roc_n = -1 + channel * 8; break; case 12: trl = d; break; case 13: trl = (trl<<4) + d; break; case 14: trl = (trl<<4) + d; break; case 15: trl = (trl<<4) + d; DecodeTbmTrailer(trl, dataId, dataNr); break; } } } //Single ROC else { while (!(pos >= int(data.size()))) { // check header if ((data[pos] & 0x8ffc) != 0x87f8) return -2; // wrong header pos++; //int hdr = data[pos++] & 0xfff; // read pixels while not data end or trailer while (!(pos >= int(data.size()) || (data[pos] & 0x8000))) { // store 24 bits in raw raw = (data[pos++] & 0xfff) << 12; if (pos >= int(data.size()) || (data[pos] & 0x8000)) return -3; // incomplete data raw += data[pos++] & 0xfff; DecodePixel(raw, n_pix, ph_pix, col, row); n.push_back(n_pix); ph.push_back(ph_pix); address = 0; address = (address << 8) ; address = (address << 8) + col; address = (address << 8) + row; adr.push_back(address); } } } return 1; } int32_t CTestboard::CountReadouts(int32_t nTriggers) { int32_t nHits = 0; vector<uint16_t> data, data2, ph, n_hits; vector<uint32_t> adr; //data.clear(); uint32_t avail_size = 0; for (int16_t i = 0; i < nTriggers; i++) { Pg_Single(); uDelay(4); } //Daq_Read2(data, daq_read_size, avail_size); Daq_Read(data, daq_read_size, avail_size, 0); if (TBM_Present()) { avail_size=0; Daq_Read(data2, daq_read_size, avail_size, 1); } Decode(data, n_hits, ph, adr, 0); Decode(data2, n_hits, ph, adr, 1); for (unsigned int i = 0; i < adr.size(); i++){ nHits+=n_hits[i]; } return nHits; } int8_t CTestboard::CalibrateReadouts(int16_t nTriggers, int16_t &nReadouts, int32_t &PHsum){ nReadouts = 0; PHsum = 0; //uint16_t daq_read_size = 32768; uint32_t avail_size = 0; vector<uint16_t> nhits, ph; vector<uint32_t> adr; vector<uint16_t> data, data2; uDelay(5); for (int16_t i = 0; i < nTriggers; i++) { Pg_Single(); uDelay(4); } Daq_Read2(data, daq_read_size, avail_size); Daq_Read(data, daq_read_size, avail_size, 0); if (TBM_Present()){ avail_size=0; Daq_Read(data2, daq_read_size, avail_size, 1); } Decode(data, nhits, ph, adr, 0); Decode(data2, nhits, ph, adr, 1); for (unsigned int i = 0; i < adr.size(); i++) { nReadouts+= nhits[i]; PHsum+= ph[i];; } return 1; } int8_t CTestboard::CalibratePixel(int16_t nTriggers, int16_t col, int16_t row, int16_t &nReadouts, int32_t &PHsum) { roc_Col_Enable(col, true); roc_Pix_Cal(col, row, false); uDelay(5); Daq_Enable2(daq_read_size); CalibrateReadouts(nTriggers, nReadouts, PHsum); Daq_Disable2(); roc_ClrCal(); roc_Col_Enable(col, false); return 1; } int8_t CTestboard::CalibrateDacScan(int16_t nTriggers, int16_t col, int16_t row, int16_t dacReg1, int16_t dacLower1, int16_t dacUpper1, vectorR<int16_t> &nReadouts, vectorR<int32_t> &PHsum) { //nReadouts.clear(); //PHsum.clear(); int16_t n; int32_t ph; roc_Col_Enable(col, true); roc_Pix_Cal(col, row, false); uDelay(5); Daq_Enable2(daq_read_size); for (int i = dacLower1; i < dacUpper1; i++) { roc_SetDAC(dacReg1, i); CalibrateReadouts(nTriggers, n, ph); nReadouts.push_back(n); PHsum.push_back(ph); } Daq_Disable2(); roc_ClrCal(); roc_Col_Enable(col, false); return 1; } int8_t CTestboard::CalibrateDacDacScan(int16_t nTriggers, int16_t col, int16_t row, int16_t dacReg1, int16_t dacLower1, int16_t dacUpper1, int16_t dacReg2, int16_t dacLower2, int16_t dacUpper2, vectorR<int16_t> &nReadouts, vectorR<int32_t> &PHsum) { int16_t n; int32_t ph; roc_Col_Enable(col, true); roc_Pix_Cal(col, row, false); uDelay(5); Daq_Enable2(daq_read_size); for (int i = dacLower1; i < dacUpper1; i++) { roc_SetDAC(dacReg1, i); for (int k = dacLower1; k < dacUpper2; k++) { roc_SetDAC(dacReg2, k); CalibrateReadouts(nTriggers, n, ph); nReadouts.push_back(n); PHsum.push_back(ph); } } Daq_Disable2(); roc_ClrCal(); roc_Col_Enable(col, false); return 1; } int16_t CTestboard::CalibrateMap(int16_t nTriggers, vectorR<int16_t> &nReadouts, vectorR<int32_t> &PHsum, vectorR<uint32_t> &adress) { uint32_t avail_size = 0; nReadouts.clear(); PHsum.clear(); adress.clear(); nReadouts.resize(ROC_NUMCOLS * ROC_NUMROWS, 0); PHsum.resize(ROC_NUMCOLS * ROC_NUMROWS, 0); adress.resize(ROC_NUMCOLS * ROC_NUMROWS, 0); Daq_Enable2(daq_read_size); vector<uint16_t> data; vector<uint16_t> data2; vector<uint16_t> n; vector<uint16_t> ph; vector<uint32_t> adr; for (uint8_t col = 0; col < ROC_NUMCOLS; col++) { roc_Col_Enable(col, true); for (uint8_t row = 0; row < ROC_NUMROWS; row++) { //for (uint8_t row = 0; row < 20; row++) { //arm roc_Pix_Cal(col, row, false); uDelay(5); for (uint8_t trigger = 0; trigger < nTriggers; trigger++) { //send triggers Pg_Single(); uDelay(4); } // clear roc_ClrCal(); } //read data data.clear(); data2.clear(); //Daq_Read2(data, daq_read_size, avail_size); Daq_Read(data, daq_read_size, avail_size, 0); if (TBM_Present()){ avail_size=0; Daq_Read(data2, daq_read_size, avail_size, 1); } //decode readouts n.clear(); ph.clear(); adr.clear(); Decode(data, n, ph, adr); Decode(data2, n, ph, adr); int colR = -1, rowR = -1; for (unsigned int i = 0; i<adr.size();i++){ rowR = adr[i] & 0xff; colR = (adr[i] >> 8) & 0xff; if (0 <= colR && colR < ROC_NUMCOLS && 0 <= rowR && rowR < ROC_NUMROWS){ nReadouts[colR * ROC_NUMROWS + rowR] += n[i]; PHsum[colR * ROC_NUMROWS + rowR] += ph[i]; adress[colR * ROC_NUMROWS + rowR] = adr[i]; } } roc_Col_Enable(col, false); } Daq_Disable2(); return 1; } int16_t CTestboard::TriggerRow(int16_t nTriggers, int16_t col, vector<int16_t> &rocs, int16_t delay){ for (uint16_t i = 0; i < rocs.size(); i++){ roc_I2cAddr(rocs[i]); roc_Col_Enable(col, true); } for (uint8_t row = 0; row < ROC_NUMROWS; row++) { //arm for (uint16_t i = 0; i < rocs.size(); i++){ roc_I2cAddr(rocs[i]); roc_Pix_Cal(col, row, false); // this delay is realy needed uDelay(delay); } for (uint8_t trigger = 0; trigger < nTriggers; trigger++) { //send triggers Pg_Single(); uDelay(delay); } // clear for (uint16_t i = 0; i < rocs.size(); i++){ roc_I2cAddr(rocs[i]); roc_ClrCal(); } } for (uint16_t i = 0; i < rocs.size(); i++){ roc_I2cAddr(rocs[i]); roc_Col_Enable(col, false); } return 1; } // To be removed int32_t CTestboard::CountReadouts(int32_t nTrig, int32_t chipId) { roc_I2cAddr(chipId); return CountReadouts(nTrig); } // To be removed int32_t CTestboard::CountReadouts(int32_t nTrig, int32_t dacReg, int32_t dacValue) { roc_SetDAC(dacReg, dacValue); return CountReadouts(nTrig); } // To be removed int32_t CTestboard::PH(int32_t col, int32_t row, int32_t trim, int16_t nTriggers) { Daq_Open(50000); Daq_Select_Deser160(deserAdjust); uDelay(100); Daq_Start(); uDelay(100); roc_Col_Enable(col, true); roc_Pix_Trim(col, row, trim); roc_Pix_Cal(col, row, false); vector<uint16_t> data; //roc_SetDAC(Vcal, vcal); uDelay(100); for (int16_t k = 0; k < nTriggers; k++) { Pg_Single(); uDelay(20); } roc_Pix_Mask(col, row); roc_Col_Enable(col, false); roc_ClrCal(); Daq_Stop(); Daq_Read(data, 4000); Daq_Close(); // --- analyze data int cnt = 0; double yi = 0.0; int16_t ok = -1, pos = 0, n = 0, ph = 0, colR = 0, rowR = 0; for (int16_t i = 0; i < nTriggers; i++) { ok = DecodePixel(data, pos, n, ph, colR, rowR); if (n > 0 and ok) { yi += ph; cnt++; } } if (cnt > 0) return (int32_t) yi / cnt; else return -9999; } // == Thresholds =================================================== int32_t CTestboard::Threshold(int32_t start, int32_t step, int32_t thrLevel, int32_t nTrig, int32_t dacReg) { int32_t threshold = start, newValue, oldValue, result; int stepAbs; if (step < 0) stepAbs = -step; else stepAbs = step; newValue = CountReadouts(nTrig, dacReg, threshold); if (newValue > thrLevel) { do { threshold -= step; oldValue = newValue; newValue = CountReadouts(nTrig, dacReg, threshold); } while ((newValue > thrLevel) && (threshold > (stepAbs - 1)) && (threshold < (256 - stepAbs))); if (oldValue - thrLevel > thrLevel - newValue) result = threshold; else result = threshold + step; } else { do { threshold += step; oldValue = newValue; newValue = CountReadouts(nTrig, dacReg, threshold); } while ((newValue <= thrLevel) && (threshold > (stepAbs - 1)) && (threshold < (256 - stepAbs))); if (thrLevel - oldValue > newValue - thrLevel) result = threshold; else result = threshold - step; } if (result > 255) result = 255; if (result < 0) result = 0; return result; } int32_t CTestboard::PixelThreshold(int32_t col, int32_t row, int32_t start, int32_t step, int32_t thrLevel, int32_t nTrig, int32_t dacReg, bool xtalk, bool cals) { Daq_Enable2(daq_read_size); int calRow = row; if (xtalk) { if (row == ROC_NUMROWS - 1) calRow = row - 1; else calRow = row + 1; } roc_Pix_Cal(col, calRow, cals); int32_t res = Threshold(start, step, thrLevel, nTrig, dacReg); roc_ClrCal(); Daq_Disable2(); return res; } // to be replaced bool CTestboard::test_pixel_address(int32_t col, int32_t row) { Daq_Open(5000); Daq_Select_Deser160(deserAdjust); uDelay(100); Daq_Start(); uDelay(100); roc_Col_Enable(col, true); uDelay(20); roc_Pix_Trim(col, row, 15); roc_Pix_Cal(col, row, false); uDelay(20); Pg_Single(); uDelay(5); roc_ClrCal(); roc_Pix_Mask(col, row); uDelay(20); roc_Col_Enable(col, false); uDelay(100); Daq_Stop(); vector<uint16_t> data; Daq_Read(data, 5000); Daq_Close(); // --- analyze data int16_t ok = -1, pos = 0, n = 0, ph = 0, colR = -1, rowR = -1; ok = DecodePixel(data, pos, n, ph, colR, rowR); if (n > 0 and ok) { return (col == colR && row == rowR); } return false; } void CTestboard::ChipThresholdIntern(int32_t start[], int32_t step, int32_t thrLevel, int32_t nTrig, int32_t dacReg, bool xtalk, bool cals, int32_t res[]) { int32_t thr, startValue; for (int col = 0; col < ROC_NUMCOLS; col++) { roc_Col_Enable(col, 1); for (int row = 0; row < ROC_NUMROWS; row++) { if (step < 0) startValue = start[col*ROC_NUMROWS + row] + 10; else startValue = start[col*ROC_NUMROWS + row]; if (startValue < 0) startValue = 0; else if (startValue > 255) startValue = 255; thr = PixelThreshold(col, row, startValue, step, thrLevel, nTrig, dacReg, xtalk, cals); res[col*ROC_NUMROWS + row] = thr; } roc_Col_Enable(col, 0); } } int8_t CTestboard::ThresholdMap(int32_t nTrig, int32_t dacReg, bool rising, bool xtalk, bool cals, vectorR<int16_t> &thrValue) { thrValue.clear(); int32_t startValue; int32_t step = 1; int32_t thrLevel = nTrig/2; int32_t roughThr[ROC_NUMROWS * ROC_NUMCOLS], res[ROC_NUMROWS * ROC_NUMCOLS], roughStep; if (!rising) { startValue = 255; roughStep = -4; printf("ThresholdMap\n"); } else { startValue = 0; roughStep = 4; } for (int i = 0; i < ROC_NUMROWS * ROC_NUMCOLS; i++) roughThr[i] = startValue; ChipThresholdIntern(roughThr, roughStep, 0, 1, dacReg, xtalk, cals, roughThr); ChipThresholdIntern(roughThr, step, thrLevel, nTrig, dacReg, xtalk, cals, res); for (int i = 0; i < ROC_NUMROWS * ROC_NUMCOLS; i++) thrValue.push_back(res[i]); return 1; } void CTestboard::VectorTest(vector<uint16_t> &in, vectorR<uint16_t> &out) { out = in; for (unsigned int i=0; i<out.size(); i++) out[i] += 1000; }
23.242972
154
0.657849
[ "vector" ]
acd58e401d607424dc4e47fb6b24daca5cbbe638
3,535
hpp
C++
third-party/casadi/casadi/solvers/linsol_ldl.hpp
dbdxnuliba/mit-biomimetics_Cheetah
f3b0c0f6a3835d33b7f2f345f00640b3fc256388
[ "MIT" ]
8
2020-02-18T09:07:48.000Z
2021-12-25T05:40:02.000Z
third-party/casadi/casadi/solvers/linsol_ldl.hpp
geekfeiw/Cheetah-Software
f3b0c0f6a3835d33b7f2f345f00640b3fc256388
[ "MIT" ]
null
null
null
third-party/casadi/casadi/solvers/linsol_ldl.hpp
geekfeiw/Cheetah-Software
f3b0c0f6a3835d33b7f2f345f00640b3fc256388
[ "MIT" ]
13
2019-08-25T12:32:06.000Z
2022-03-31T02:38:12.000Z
/* * This file is part of CasADi. * * CasADi -- A symbolic framework for dynamic optimization. * Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl, * K.U. Leuven. All rights reserved. * Copyright (C) 2011-2014 Greg Horn * * CasADi is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * CasADi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with CasADi; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef CASADI_LINSOL_LDL_HPP #define CASADI_LINSOL_LDL_HPP /** \defgroup plugin_Linsol_ldl * Linear solver using sparse direct LDL factorization */ /** \pluginsection{Linsol,ldl} */ /// \cond INTERNAL #include "casadi/core/linsol_internal.hpp" #include <casadi/solvers/casadi_linsol_ldl_export.h> namespace casadi { struct CASADI_LINSOL_LDL_EXPORT LinsolLdlMemory : public LinsolMemory { std::vector<double> l, d, w; }; /** \brief \pluginbrief{LinsolInternal,ldl} * @copydoc LinsolInternal_doc * @copydoc plugin_LinsolInternal_ldl */ class CASADI_LINSOL_LDL_EXPORT LinsolLdl : public LinsolInternal { public: // Create a linear solver given a sparsity pattern and a number of right hand sides LinsolLdl(const std::string& name, const Sparsity& sp); /** \brief Create a new LinsolInternal */ static LinsolInternal* creator(const std::string& name, const Sparsity& sp) { return new LinsolLdl(name, sp); } // Destructor ~LinsolLdl() override; // Initialize the solver void init(const Dict& opts) override; /** \brief Create memory block */ void* alloc_mem() const override { return new LinsolLdlMemory();} /** \brief Initalize memory block */ int init_mem(void* mem) const override; /** \brief Free memory block */ void free_mem(void *mem) const override { delete static_cast<LinsolLdlMemory*>(mem);} // Symbolic factorization int sfact(void* mem, const double* A) const override; // Factorize the linear system int nfact(void* mem, const double* A) const override; // Solve the linear system int solve(void* mem, const double* A, double* x, casadi_int nrhs, bool tr) const override; /// Generate C code void generate(CodeGenerator& g, const std::string& A, const std::string& x, casadi_int nrhs, bool tr) const override; /// Number of negative eigenvalues casadi_int neig(void* mem, const double* A) const override; /// Matrix rank casadi_int rank(void* mem, const double* A) const override; /// A documentation string static const std::string meta_doc; // Get name of the plugin const char* plugin_name() const override { return "ldl";} // Get name of the class std::string class_name() const override { return "LinsolLdl";} // Symbolic factorization std::vector<casadi_int> p_; Sparsity sp_Lt_; }; } // namespace casadi /// \endcond #endif // CASADI_LINSOL_LDL_HPP
31.5625
94
0.689109
[ "vector" ]
acd5c0a550f36c08f732536083beebd792b48d65
21,611
cpp
C++
rwamapview.cpp
funkerresch/rwacreator
f041028aef0570b90335538b4f41251313f0f198
[ "MIT" ]
null
null
null
rwamapview.cpp
funkerresch/rwacreator
f041028aef0570b90335538b4f41251313f0f198
[ "MIT" ]
null
null
null
rwamapview.cpp
funkerresch/rwacreator
f041028aef0570b90335538b4f41251313f0f198
[ "MIT" ]
null
null
null
#include "rwamapview.h" RwaMapView::RwaMapView(QWidget* parent, RwaScene *scene, QString name) : RwaGraphicsView(parent, scene, name) { mc->setParent(this); qint32 toolbarFlags = ( RWATOOLBAR_MAPEDITTOOLS | RWATOOLBAR_SCENEMENU | RWATOOLBAR_SIMULATORTOOLS | RWATOOLBAR_SCENEMENU | RWATOOLBAR_SELECTSCENEMENU | RWATOOLBAR_STATEMENU | RWATOOLBAR_SELECTSTATEMENU | RWATOOLBAR_MAINVOLUME | RWATOOLBAR_SUGGESTPLACES); stateLineEditVisible = true; assetsVisible = false; stateRadiusVisible = false; assetStartPointsVisible = false; sceneRadiusVisible = true; statesVisible = true; tool = RWATOOL_ARROW; layout = new QBoxLayout(QBoxLayout::TopToBottom,this); layout->setSpacing(1); layout->setContentsMargins(QMargins(1,1,1,1)); currentScene = nullptr; mc->setZoom(13); // MapControl Notifications connect(mc, SIGNAL(mouseEventCoordinate(const QMouseEvent*, const QPointF)), this, SLOT(receiveMouseMoveEvent(const QMouseEvent*, const QPointF))); connect(mc, SIGNAL(sendMouseDownEvent(const QMouseEvent*, const QPointF)), this, SLOT(receiveMouseDownEvent(const QMouseEvent*, const QPointF))); connect(mc, SIGNAL(sendSelectRect(QRectF)), this, SLOT(receiveSelectRect(QRectF))); connect(mc, SIGNAL(sendMouseReleaseEvent()), this, SLOT(receiveMouseReleaseEvent())); // Backend Notifications connect(this, SIGNAL(sendEntityPosition(QPointF)), backend, SLOT(receiveEntityPosition(QPointF))); connect(this, SIGNAL(sendMapPosition(QPointF)), backend, SLOT(receiveMapCoordinates(QPointF))); connect(this, SIGNAL(sendStateCoordinate(QPointF)), backend, SLOT(receiveStatePosition(QPointF))); connect(this, SIGNAL(sendStartStopSimulator(bool)), backend, SLOT(startStopSimulator(bool))); connect(this, SIGNAL(sendCurrentState(RwaState*)), backend, SLOT(receiveLastTouchedState(RwaState*))); connect(this, SIGNAL(sendCurrentScene(RwaScene*)), backend, SLOT(receiveLastTouchedScene(RwaScene*))); connect(this, SIGNAL(sendMoveCurrentState1(double, double)), backend, SLOT(receiveMoveCurrentState1(double, double))); connect(this, SIGNAL(sendAppendScene()), backend, SLOT(appendScene())); connect(this, SIGNAL(sendClearScene(RwaScene *)), backend, SLOT(clearScene(RwaScene *))); connect(this, SIGNAL(sendDuplicateScene(RwaScene *)), backend, SLOT(duplicateScene(RwaScene *))); connect(this, SIGNAL(sendRemoveScene(RwaScene *)), backend, SLOT(removeScene(RwaScene *))); connect(this, SIGNAL(sendSelectedStates(QStringList)), backend, SLOT(receiveSelectedStates(QStringList))); connect(backend, SIGNAL(sendMoveCurrentAsset1(double, double)), this, SLOT(movePixmapsOfCurrentAsset(double,double))); connect(backend, SIGNAL(updateScene(RwaScene *)), this, SLOT(setCurrentScene(RwaScene *))); connect(backend, SIGNAL(sendMoveCurrentState1(double, double)), this, SLOT(movePixmapsOfCurrentState(double,double))); connect(backend, SIGNAL(sendMoveCurrentAssetChannel(double, double, int)), this, SLOT(movePixmapsOfCurrentAssetChannel(double,double, int))); connect(backend, SIGNAL(sendMoveCurrentAssetReflection(double, double, int)), this, SLOT(movePixmapsOfCurrentAssetReflection(double,double, int))); connect(this, SIGNAL(sendCurrentStateRadiusEdited()), backend, SLOT(receiveCurrentStateRadiusEdited())); connect(this, SIGNAL(sendCurrentSceneRadiusEdited()), backend, SLOT(receiveCurrentSceneRadiusEdited())); connect(backend, SIGNAL(sendRedrawAssets()), this, SLOT(redrawAssets())); connect(backend, SIGNAL(sendCurrentStateRadiusEdited()), this, SLOT(receiveUpdateCurrentStateRadius())); connect(backend, SIGNAL(sendCurrentSceneRadiusEdited()), this, SLOT(receiveUpdateCurrentSceneRadius())); connect(backend, SIGNAL(sendHeroPositionEdited()), this, SLOT(receiveHeroPositionEdited())); layout->addWidget(setupToolbar(toolbarFlags)); layout->addWidget(mc); addZoomButtons(); // Toolbox Notifications connect(toolbar, SIGNAL(sendMapCoordinates(double,double)), this, SLOT(setMapCoordinates(double,double))); connect(this, SIGNAL(sendMapCoordinates(double,double)), toolbar, SLOT(receiveMapCoordinates(double,double))); } void RwaMapView::receiveStartStopSimulator(bool startStop) { emit sendStartStopSimulator(startStop); } void RwaMapView::receiveAppendScene() { emit sendAppendScene(); } void RwaMapView::receiveClearScene() { emit sendClearScene(currentScene); } void RwaMapView::receiveDuplicateScene() { emit sendDuplicateScene(currentScene); } void RwaMapView::receiveRemoveScene() { emit sendRemoveScene(currentScene); } void RwaMapView::setMapCoordinates(double lon, double lat) { mc->setView(QPointF(lon,lat)); if(currentScene) { redrawStates(); emit sendMapPosition(mc->currentCoordinate()); emit sendMapCoordinates(mc->currentCoordinate().x(), mc->currentCoordinate().y()); } } void RwaMapView::setMapCoordinates(QPointF coordinates) { mc->setView(coordinates); if(currentScene) { redrawStates(); emit sendMapPosition(mc->currentCoordinate()); } } void RwaMapView::zoomIn() { mc->zoomIn(); if(currentScene) currentScene->setZoom( mc->currentZoom()); if(stateRadiusVisible) redrawStateRadii(); redrawStates(); redrawSceneRadii(); } void RwaMapView::zoomOut() { mc->zoomOut(); if(currentScene) currentScene->setZoom( mc->currentZoom()); if(stateRadiusVisible) redrawStateRadii(); redrawStates(); redrawSceneRadii(); } void RwaMapView::setZoomLevel(qint32 zoomLevel) { mc->setZoom(zoomLevel); //qDebug() << "zoomlevel "; if(currentScene) currentScene->setZoom(zoomLevel); if(stateRadiusVisible) redrawStateRadii(); } void RwaMapView::adaptSize(qint32 width, qint32 height) { //resize(QSize(width, height)); mc->resize(QSize(width-20, height-70)); } void RwaMapView::moveCurrentScene(const QPointF myPoint) { double dx, dy; std::vector<double> lastCoordinate(2, 0.0); std::vector<double> tmp(2, 0.0); QmapPoint *geo = (QmapPoint *)currentScenePoint; if(geo) { if(currentScene->positionIsLocked()) return; geo->setCoordinate(myPoint); lastCoordinate = currentScene->getCoordinates(); tmp[0] = myPoint.x(); tmp[1] = myPoint.y(); currentScene->setCoordinates(tmp); dx = currentScene->getCoordinates()[0] - lastCoordinate[0]; dy = currentScene->getCoordinates()[1] - lastCoordinate[1]; geo->move(dx, dy); if(currentScene->childrenDoFollowMe()) { currentScene->moveMyChildren(dx, dy); movePixmapsOfCurrentScene(dx,dy); } currentScene->moveCorners(dx, dy); redrawSceneRadii(); return; } } void RwaMapView::moveCurrentState1(const QPointF myPoint) { double dx, dy; std::vector<double> lastCoordinate(2, 0.0); std::vector<double> tmp(2, 0.0); QmapPoint *geo = (QmapPoint *)currentStatePoint; if(geo) { if(currentState->positionIsLocked()) return; lastCoordinate = currentState->getCoordinates(); tmp[0] = myPoint.x(); tmp[1] = myPoint.y(); currentState->setCoordinates(tmp); dx = currentState->getCoordinates()[0] - lastCoordinate[0]; dy = currentState->getCoordinates()[1] - lastCoordinate[1]; if(currentState->childrenDoFollowMe()) currentState->moveMyChildren(dx, dy); emit sendMoveCurrentState1(dx, dy); emit sendStateCoordinate(myPoint); return; } } void RwaMapView::receiveMouseMoveEvent(const QMouseEvent*, const QPointF myPoint) { QmapPoint *geo; if(!backend->isSimulationRunning()) { geo = (QmapPoint *)currentStatePoint; if(geo) { moveCurrentState1(myPoint); if(!currentState->positionIsLocked()) setUndoAction("Move State"); return; } geo = (QmapPoint *)currentScenePoint; if(geo) { moveCurrentScene(myPoint); if(!currentScene->positionIsLocked()) setUndoAction("Move Scene"); return; } if(editArea) { if(editSceneArea) { resizeArea(myPoint, currentScene); setUndoAction("Resize Scene Area"); emit sendCurrentSceneRadiusEdited(); sceneRadiusLayer->setVisible(true); } if(editStateArea) { resizeArea(myPoint, currentState); setUndoAction("Resize State Area"); emit sendCurrentStateRadiusEdited(); stateRadiusLayer->setVisible(true); } return; } } geo = (QmapPoint *)currentEntityPoint; if(geo) { geo->setCoordinate(myPoint); currentEntity = (RwaEntity *)geo->data; std::vector<double> tmp {myPoint.x(), myPoint.y()}; currentEntity->setCoordinates(tmp); emit sendEntityPosition(myPoint); return; } if(tool == RWATOOL_PEN) { mc->setSelectSize(myPoint.x()-selectRectX, myPoint.y()-selectRectY); mc->updateRequestNew(); return; } emit sendMapPosition(mc->currentCoordinate()); emit sendMapCoordinates(mc->currentCoordinate().x(), mc->currentCoordinate().y()); RwaUtilities::copyLocationCoordinates2Clipboard(mc->currentCoordinate()); if(backend->logCoordinates) RwaUtilities::logLocationCoordinates(mc->currentCoordinate()); } bool RwaMapView::mouseDownEntities(const QPointF myPoint) { currentEntityPoint = NULL; QmapPoint* tmppoint = new QmapPoint(myPoint.x(), myPoint.y()); for (int i=0; i<entityLayer->geometries.count(); i++) { if (entityLayer->geometries.at(i)->isVisible() && entityLayer->geometries.at(i)->Touches(tmppoint, mapadapter)) { currentEntityPoint = (QmapPoint *)entityLayer->geometries.at(i); currentEntity= (RwaEntity *)currentEntityPoint->data; mc->setMouseMode(MapControl::None); break; } } if(currentEntityPoint) { delete tmppoint; return true; } else return false; } bool RwaMapView::mouseDownScenes(const QPointF myPoint) { currentScenePoint = nullptr; QmapPoint* tmppoint = new QmapPoint(myPoint.x(), myPoint.y()); for (int i=0; i<scenesLayer->geometries.count(); i++) { if (scenesLayer->geometries.at(i)->isVisible() && scenesLayer->geometries.at(i)->Touches(tmppoint, mapadapter)) { currentScenePoint = (QmapPoint *)scenesLayer->geometries.at(i); currentScene = (RwaScene *)currentScenePoint->data; mc->setMouseMode(MapControl::None); scenesLayer->setVisible(true); } } if(currentScenePoint) { delete tmppoint; return true; } else return false; } bool RwaMapView::mouseDownStates(const QPointF myPoint) { currentStatePoint = nullptr; QmapPoint* tmppoint = new QmapPoint(myPoint.x(), myPoint.y()); for (int i=0; i<statesLayer->geometries.count(); i++) { if (statesLayer->geometries.at(i)->isVisible() && statesLayer->geometries.at(i)->Touches(tmppoint, mapadapter)) { currentStatePoint = (QmapPoint *)statesLayer->geometries.at(i); currentState = (RwaState *)currentStatePoint->data; mc->setMouseMode(MapControl::None); tmpObjectName = QString::fromStdString( currentState->objectName()); setCurrentState(currentState); statesLayer->setVisible(true); } } if(currentStatePoint) { delete tmppoint; return true; } else return false; } void RwaMapView::receiveSelectRect(QRectF selectRect) { RwaState *state; foreach (state, currentScene->getStates()) { QRectF tmp; tmp.setX(state->getCoordinates()[0]); tmp.setY(state->getCoordinates()[1]); tmp.setWidth(0.0000001);tmp.setHeight(0.0000001); if(selectRect.contains(tmp)) { state->select(true); //qDebug("%d", state->getSta); } } } void RwaMapView::mouseDownMarkee(const QMouseEvent *event, const QPointF myPoint) { if (event->button() == Qt::LeftButton && event->type() == QEvent::MouseButtonPress) { mc->setMouseMode(MapControl::Dragging); /*mc->setSelectOrigin(myPoint.x(), myPoint.y()); selectRectX = myPoint.x(); selectRectY = myPoint.y(); qDebug("%f", myPoint.x());*/ } } void RwaMapView::mouseDownArrow(const QMouseEvent *event, const QPointF myPoint) { if (event->button() == Qt::LeftButton && event->type() == QEvent::MouseButtonPress) { if(mouseDownEntities(myPoint)) // entities have priority return; if(!backend->isSimulationRunning()) { if(mouseDownStates(myPoint)) return; if(mouseDownScenes(myPoint)) return; if(mouseDownArea(myPoint, currentScene)) return; if(mouseDownArea(myPoint, currentState)) return; } } if (event->button() == Qt::LeftButton && event->type() == QEvent::MouseButtonDblClick && !backend->isSimulationRunning()) { if(mouseDoubleClickArea(myPoint, currentScene)) { setUndoAction("Edit Scene area."); sceneRadiusLayer->setVisible(true); return; } if(mouseDoubleClickArea(myPoint, currentState)) { setUndoAction("Edit State area."); sceneRadiusLayer->setVisible(true); emit sendCurrentStateRadiusEdited(); return; } std::vector<double> tmp(2, 0.0); tmp[0] = myPoint.x(); tmp[1] = myPoint.y(); std::string stateName("State "+ std::to_string( RwaBackend::getStateNameCounter(currentScene->getStates()))); RwaState *newState = currentScene->addState(stateName, tmp); setCurrentState(newState); setCurrentScene(currentScene); mc->setMouseMode(MapControl::None); setUndoAction("New State"); } } void RwaMapView::mouseDownRubber(const QMouseEvent *event, const QPointF myPoint) { QmapPoint* tmppoint = new QmapPoint(myPoint.x(), myPoint.y()); if (event->button() == Qt::LeftButton && event->type() == QEvent::MouseButtonPress) { for (int i=0; i<statesLayer->geometries.count(); i++) { if (statesLayer->geometries.at(i)->isVisible() && statesLayer->geometries.at(i)->Touches(tmppoint, mapadapter)) { currentStatePoint = (QmapPoint *)statesLayer->geometries.at(i); RwaState *state = (RwaState *)currentStatePoint->data; currentScene->removeState(state); emit sendCurrentScene(currentScene); setUndoAction("Remove State"); delete tmppoint; return; } } } delete tmppoint; } void RwaMapView::receiveMouseDownEvent(const QMouseEvent *event, const QPointF myPoint) { RwaUtilities::copyLocationCoordinates2Clipboard(myPoint); if(backend->logCoordinates) RwaUtilities::logLocationCoordinates(myPoint); currentStatePoint = nullptr; switch(tool) { case RWATOOL_ARROW: { mouseDownArrow(event, myPoint); break; } case RWATOOL_RUBBER: { if(!backend->isSimulationRunning()) mouseDownRubber(event, myPoint); break; } case RWATOOL_PEN: { mouseDownMarkee(event, myPoint); break; } default:break; } } void RwaMapView::receiveMouseReleaseEvent() { if(tool == RWATOOL_PEN) { QStringList states; for (int i=0; i<statesLayer->geometries.count(); i++) { currentStatePoint = (QmapPoint *)statesLayer->geometries.at(i); std::vector<double> position = std::vector<double>(2, 0.0); position[0] = currentStatePoint->coordinate().x(); position[1] = currentStatePoint->coordinate().y(); std::vector<double> topLeft = std::vector<double>(2, 0.0); topLeft[0] = mc->getSelectRect().topLeft().x(); topLeft[1] = mc->getSelectRect().topLeft().y(); std::vector<double> bottomRight = std::vector<double>(2, 0.0); bottomRight[0] = mc->getSelectRect().bottomRight().x(); bottomRight[1] = mc->getSelectRect().bottomRight().y(); if(RwaUtilities::coordinateWithinRectangle1(position, topLeft, bottomRight)) { RwaState *state = (RwaState *)currentStatePoint->data; states << QString::fromStdString(state->objectName()); } } mc->updateRequestNew(); if(!(QObject::sender() == this->backend)) { emit sendSelectedStates(states); } return; } mc->setMouseMode(MapControl::Panning); if(currentScene) { currentScene->deselectAllStates(); if(editArea) currentScene->setAreaType(currentScene->getAreaType()); } currentEntityPoint = nullptr; currentStatePoint = nullptr; currentScenePoint = nullptr; editAreaRadius = false; editAreaHeight = false; editAreaWidth = false; editAreaCorner = false; editArea = false; editSceneArea = false; editStateArea = false; areaCornerIndex2Edit = -1; writeUndo(); } void RwaMapView::receiveSceneName(QString name) { emit sendSceneName(currentScene, name); } void RwaMapView::receiveUpdateCurrentStateRadius() { if(stateRadiusVisible) redrawStateRadii(); } void RwaMapView::receiveHeroPositionEdited() { } void RwaMapView::receiveUpdateCurrentSceneRadius() { if(sceneRadiusVisible) redrawSceneRadii(); } void RwaMapView::setCurrentAsset(RwaAsset1 *asset) { if(asset) { this->currentAsset = asset; updateAssetPixmaps(); } } void RwaMapView::setCurrentState(qint32 stateNumber) { if(!currentScene) return; if(currentScene->getStates().empty()) return; auto statesList = currentScene->getStates().begin(); std::advance(statesList, stateNumber); RwaState *state = *statesList; RwaGraphicsView::setCurrentState(state); } void RwaMapView::setCurrentState(RwaState *state) { qDebug() << "Set Current State Map View"; RwaGraphicsView::setCurrentState(state); } void RwaMapView::setCurrentScene(RwaScene *scene) { if(scene) { QDockWidget *window = static_cast<QDockWidget *>(parent()); window->setWindowTitle("Map View - "+ QString::fromStdString(scene->objectName())); if(currentScene) { if(statesLayer) statesLayer->clearGeometries(); if(assetsVisible) assetLayer->clearGeometries(); if(stateRadiusVisible) stateRadiusLayer->clearGeometries(); sceneRadiusLayer->clearGeometries(); } if(currentScene != scene && !backend->isSimulationRunning()) setMapCoordinates(QPointF(scene->getCoordinates()[0], scene->getCoordinates()[1])); currentScene = scene; if(!backend->isSimulationRunning()) setZoomLevel(scene->getZoom()); if(stateRadiusVisible) redrawStateRadii(); if(assetsVisible) redrawAssets(); redrawStates(); redrawSceneRadii(); redrawScenes(); if(currentScene->lastTouchedState) setCurrentState(currentScene->lastTouchedState); else { if(!currentScene->getStates().empty()) setCurrentState(currentScene->getStates().front()); } if(!entityInitialized && currentScene->getCoordinates()[0] != 0) { redrawEntities(); entityInitialized = true; setMapCoordinates(QPointF(scene->getCoordinates()[0], scene->getCoordinates()[1])); } if(!(QObject::sender() == this->backend)) emit sendCurrentScene(scene); } } void RwaMapView::moveCurrentAsset() { if(assetsVisible) redrawAssets(); } void RwaMapView::setAssetsVisible(bool onOff) { this->assetsVisible = onOff; assetLayer->setVisible(onOff); redrawAssets(); } void RwaMapView::setRadiiVisible(bool onOff) { this->stateRadiusVisible = onOff; stateRadiusLayer->setVisible(onOff); redrawStateRadii(); }
29.164642
125
0.617001
[ "vector" ]
acd820681f6779ce8cc66939685bae15fef8fff1
4,034
cpp
C++
example/src/ofApp.cpp
jonasfehr/ofxRayComposer
7ac7cd03cd5030bd5e0c9001969fddbf4223d75d
[ "MIT" ]
5
2017-04-04T21:44:39.000Z
2021-08-04T20:24:04.000Z
example/src/ofApp.cpp
jonasfehr/ofxRayComposer
7ac7cd03cd5030bd5e0c9001969fddbf4223d75d
[ "MIT" ]
null
null
null
example/src/ofApp.cpp
jonasfehr/ofxRayComposer
7ac7cd03cd5030bd5e0c9001969fddbf4223d75d
[ "MIT" ]
1
2021-08-04T20:24:05.000Z
2021-08-04T20:24:05.000Z
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ ofBackground(0); rayComposer.setup(); rayComposer.setPPS(30000); } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw() { // do your thang ildaFrame.update(); // draw to the screen ildaFrame.draw(0, 0, ofGetWidth(), ofGetHeight()); // send points to the etherdream rayComposer.setPoints(ildaFrame); ofSetColor(255); ofDrawBitmapString(ildaFrame.getString(), 10, 30); } //-------------------------------------------------------------- void ofApp::keyPressed(int key){ switch(key) { case 'f': ofToggleFullscreen(); break; // clear the frame case 'c': ildaFrame.clear(); break; // draw rectangle case 'r': { ofPolyline p = ofPolyline::fromRectangle(ofRectangle(ofRandomuf()/2, ofRandomuf()/2, ofRandomuf()/2, ofRandomuf()/2)); ildaFrame.addPoly(p); } break; // change color case 'R': ildaFrame.params.output.color.r = 1 - ildaFrame.params.output.color.r; break; case 'G': ildaFrame.params.output.color.g = 1 - ildaFrame.params.output.color.g; break; case 'B': ildaFrame.params.output.color.b = 1 - ildaFrame.params.output.color.b; break; // toggle draw lines (on screen only) case 'l': ildaFrame.params.draw.lines ^= true; break; // toggle loop for last poly case 'o': ildaFrame.getLastPoly().setClosed(ildaFrame.getLastPoly().isClosed()); break; // toggle draw points (on screen only) case 'p': ildaFrame.params.draw.points ^= true; break; // adjust point count case '.': ildaFrame.polyProcessor.params.targetPointCount++; break; case ',': if(ildaFrame.polyProcessor.params.targetPointCount > 10) ildaFrame.polyProcessor.params.targetPointCount--; break; // adjust point count quicker case '>': ildaFrame.polyProcessor.params.targetPointCount += 10; break; case '<': if(ildaFrame.polyProcessor.params.targetPointCount > 20) ildaFrame.polyProcessor.params.targetPointCount -= 10; break; // flip image case 'x': ildaFrame.params.output.transform.doFlipX ^= true; break; case 'y': ildaFrame.params.output.transform.doFlipY ^= true; break; // cap image case 'X': ildaFrame.params.output.doCapX ^= true; break; case 'Y': ildaFrame.params.output.doCapY ^= true; break; // move output around case OF_KEY_UP: ildaFrame.params.output.transform.offset.y -= 0.05; break; case OF_KEY_DOWN: ildaFrame.params.output.transform.offset.y += 0.05; break; case OF_KEY_LEFT: ildaFrame.params.output.transform.offset.x -= 0.05; break; case OF_KEY_RIGHT: ildaFrame.params.output.transform.offset.x += 0.05; break; // scale output case 'w': ildaFrame.params.output.transform.scale.y += 0.05; break; case 's': ildaFrame.params.output.transform.scale.y -= 0.05; break; case 'a': ildaFrame.params.output.transform.scale.x -= 0.05; break; case 'd': ildaFrame.params.output.transform.scale.x += 0.05; break; case 'C': ildaFrame.drawCalibration(); break; } } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ // draw a line to the mouse cursor (normalized coordinates) in the last poly created ildaFrame.getLastPoly().lineTo(x / (float)ofGetWidth(), y / (float)ofGetHeight()); } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ // create a new poly in the ILDA frame ildaFrame.addPoly(); }
38.056604
136
0.554536
[ "transform" ]
ace85d58432a2b7b9726e9a32680cc4154d899ad
13,231
cpp
C++
UtinniCore/swg/ui/imgui_impl.cpp
ModTheGalaxy/Utinni
6fc118d7d80667a6e12864fc5fffe5782eaacd58
[ "MIT" ]
2
2021-03-29T20:25:05.000Z
2021-03-29T20:25:54.000Z
UtinniCore/swg/ui/imgui_impl.cpp
ModTheGalaxy/Utinni
6fc118d7d80667a6e12864fc5fffe5782eaacd58
[ "MIT" ]
null
null
null
UtinniCore/swg/ui/imgui_impl.cpp
ModTheGalaxy/Utinni
6fc118d7d80667a6e12864fc5fffe5782eaacd58
[ "MIT" ]
null
null
null
/** * MIT License * * Copyright (c) 2020 Philip Klatt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. **/ #include "imgui_impl.h" #include "imgui/imgui.h" #include "imgui/imgui_impl_win32.h" #include "imgui/imgui_impl_dx9.h" #include "ImGuizmo/ImGuizmo.h" #include <vector> #include "swg/graphics/graphics.h" #include "swg/misc/direct_input.h" #include "swg/scene/ground_scene.h" #include "swg/misc/network.h" #include "swg/misc/config.h" #include "command_parser.h" #include "cui_io.h" #pragma comment(lib, "imgui/lib/imgui.lib") using namespace utinni; using namespace swg::math; namespace imgui_impl { static std::vector<void(*)()> renderCallbacks; bool enableUi; bool rendering; void enableInternalUi(bool enable) { enableUi = enable; } WNDPROC originalWndProcHandler = nullptr; IMGUI_API LRESULT hkWndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ImGuiIO& io = ImGui::GetIO(); switch (msg) { case WM_LBUTTONDOWN: io.MouseDown[0] = true; break; case WM_LBUTTONUP: io.MouseDown[0] = false; break; case WM_RBUTTONDOWN: io.MouseDown[1] = true; break; case WM_RBUTTONUP: io.MouseDown[1] = false; break; case WM_MBUTTONDOWN: io.MouseDown[2] = true; break; case WM_MBUTTONUP: io.MouseDown[2] = false; break; case WM_MOUSEWHEEL: io.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f; break; case WM_MOUSEMOVE: io.MousePos.x = (signed short)(lParam); io.MousePos.y = (signed short)(lParam >> 16); break; case WM_KEYDOWN: if (wParam < 256) io.KeysDown[wParam] = 1; break; case WM_KEYUP: if (wParam < 256) io.KeysDown[wParam] = 0; break; case WM_CHAR: // You can also use ToAscii()+GetKeyboardState() to retrieve characters. if (wParam > 0 && wParam < 0x10000) io.AddInputCharacter((unsigned short)wParam); break; } return CallWindowProc(originalWndProcHandler, hwnd, msg, wParam, lParam); } bool isSetup = false; void setup(IDirect3DDevice9* pDevice) { if (isSetup) return; D3DDEVICE_CREATION_PARAMETERS cParam; pDevice->GetCreationParameters(&cParam); IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGui_ImplWin32_Init(cParam.hFocusWindow); ImGui_ImplDX9_Init(pDevice); ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable; ImGui::GetIO().WantCaptureKeyboard = true; ImGui::GetIO().WantCaptureMouse = true; ImGui::GetIO().WantTextInput = true; originalWndProcHandler = (WNDPROC)SetWindowLongPtr(cParam.hFocusWindow, GWL_WNDPROC, (LONG)hkWndProcHandler); ImGui::GetIO().Fonts->AddFontFromFileTTF("C:/Windows/Fonts/micross.ttf", 14); ImGuiStyle& style = ImGui::GetStyle(); style.Colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); // ImVec4(0.78f, 0.78f, 0.78f, 1.00f); style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.59f, 0.59f, 0.59f, 1.00f); style.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f); style.Colors[ImGuiCol_ChildBg] = ImVec4(0.11f, 0.11f, 0.11f, 1.00f); style.Colors[ImGuiCol_Border] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); style.Colors[ImGuiCol_FrameBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.09f); style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f); style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.04f, 0.04f, 0.04f, 0.88f); style.Colors[ImGuiCol_TitleBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.20f); style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.00f, 0.48f, 0.80f, 1.00f); //ImVec4(0.00f, 0.00f, 0.00f, 1.00f); style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f); style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f); style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.80f, 0.09f); //ImVec4(0.24f, 0.40f, 0.95f, 1.00f); style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.80f, 0.80f, 0.80f, 0.09f); //ImVec4(0.24f, 0.40f, 0.95f, 0.59f); style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); style.Colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.59f); style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.80f, 0.80f, 0.80f, 0.09f); //ImVec4(0.24f, 0.40f, 0.95f, 1.00f); style.Colors[ImGuiCol_Button] = ImVec4(0.80f, 0.80f, 0.80f, 0.09f); //ImVec4(0.24f, 0.40f, 0.95f, 1.00f); style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f); //ImVec4(0.24f, 0.40f, 0.95f, 0.59f); style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.04f, 0.04f, 0.04f, 0.88f); //ImVec4(0.39f, 0.39f, 0.39f, 1.00f); style.Colors[ImGuiCol_Header] = ImVec4(0.00f, 0.48f, 0.80f, 1.00f); //ImVec4(0.24f, 0.40f, 0.95f, 1.00f); style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.80f, 0.80f, 0.80f, 0.09f); //ImVec4(0.24f, 0.40f, 0.95f, 0.59f); style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f); style.WindowRounding = 0.f; style.FramePadding = ImVec2(4, 1); style.ScrollbarSize = 10.f; style.ScrollbarRounding = 0.f; style.GrabMinSize = 5.f; isSetup = true; } static bool imguiHasHover = false; bool gameInputSuspended = false; void render() { if (isSetup) { rendering = true; ImGui_ImplDX9_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); if (enableUi) { //ImGui::Begin("Tests", 0, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); // ImVec2(250, 300), 0.9f, ImGuiWindowFlags_NoResize | //{ // if (ImGui::Button("Test")) // { // } //} for (const auto& func : renderCallbacks) // ToDo add an additional callback to host controls in the future main ImGui window { func(); } } imgui_gizmo::draw(); imguiHasHover = ImGui::IsAnyWindowHovered(); if (imguiHasHover && !gameInputSuspended) { gameInputSuspended = true; DirectInput::suspend(); Graphics::showMouseCursor(false); SetCursor(LoadCursor(nullptr, IDC_ARROW)); } else if (!imguiHasHover && gameInputSuspended) { gameInputSuspended = false; DirectInput::resume(); Graphics::showMouseCursor(true); SetCursor(nullptr); } ImGui::End(); ImGui::EndFrame(); ImGui::Render(); ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); rendering = false; } } bool isRendering() { return rendering; } void addRenderCallback(void(*func)()) { renderCallbacks.emplace_back(func); } bool isInternalUiHovered() { return imguiHasHover; } } static std::vector<void(*)()> onGizmoEnabledCallbacks; static std::vector<void(*)()> onGizmoDisabledCallbacks; static std::vector<void(*)()> onGizmoPositionChangedCallbacks; static std::vector<void(*)()> onGizmoRotationChangedCallbacks; namespace imgui_gizmo { bool enabled = false; bool gizmoHasMouseHover = false; bool wasUsed = false; static Transform originalTransform; static Object* object = nullptr; static ImGuizmo::MODE gizmoMode(ImGuizmo::MODE::LOCAL); static ImGuizmo::OPERATION operationMode(ImGuizmo::TRANSLATE); static bool useSnap = false; static float snap[3] = { 1, 1, 1 }; void enable(Object* obj) { object = obj; enabled = true; for (const auto& func : onGizmoEnabledCallbacks) { func(); } } void disable() { enabled = false; object = nullptr; for (const auto& func : onGizmoDisabledCallbacks) { func(); } // Ensure it's set to false in case the gizmo is disabled with mouse hovered gizmoHasMouseHover = false; } bool isEnabled() { return enabled; } bool hasMouseHover() { return gizmoHasMouseHover; } void addOnEnabledCallback(void(*func)()) { onGizmoEnabledCallbacks.emplace_back(func); } void addOnDisabledCallback(void(*func)()) { onGizmoDisabledCallbacks.emplace_back(func); } void addOnPositionChangedCallback(void(*func)()) { onGizmoPositionChangedCallbacks.emplace_back(func); } void addOnRotationChangedCallback(void(*func)()) { onGizmoRotationChangedCallbacks.emplace_back(func); } void toggleGizmoMode() { if (gizmoMode != ImGuizmo::MODE::LOCAL) { gizmoMode = ImGuizmo::MODE::LOCAL; } else { gizmoMode = ImGuizmo::MODE::WORLD; } } void toggleOperationMode() { if (operationMode != ImGuizmo::TRANSLATE) { operationMode = ImGuizmo::TRANSLATE; } else { operationMode = ImGuizmo::ROTATE; } } void setGizmoModeToWorld() { gizmoMode = ImGuizmo::MODE::WORLD; } void setGizmoModeToLocal() { gizmoMode = ImGuizmo::MODE::LOCAL; } bool isGizmoModeToLocal() { return gizmoMode == ImGuizmo::MODE::LOCAL; } bool isGizmoModeToWorld() { return gizmoMode == ImGuizmo::MODE::WORLD; } void setOperationModeToTranslate() { operationMode = ImGuizmo::TRANSLATE; } void setOperationModeToRotate() { operationMode = ImGuizmo::ROTATE; } bool isOperationModeTransform() { return operationMode == ImGuizmo::TRANSLATE; } bool isOperationModeRotate() { return operationMode == ImGuizmo::ROTATE; } void toggleSnap() { useSnap = !useSnap; } void enableSnap(bool value) { useSnap = value; } bool isSnapOn() { return useSnap; } void setSnapSize(float value) { snap[0] = value; snap[1] = value; snap[2] = value; } void editTransform(const float* cameraView, float* cameraProjection, float* matrix) { static float bounds[] = { -0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f }; static float boundsSnap[] = { 0.1f, 0.1f, 0.1f }; static bool boundSizing = false; static bool boundSizingSnap = false; ImGuizmo::Manipulate(cameraView, cameraProjection, operationMode, gizmoMode, matrix, nullptr, useSnap ? &snap[0] : nullptr, boundSizing ? bounds : nullptr, boundSizingSnap ? boundsSnap : nullptr); } void draw() { if (GroundScene::get() == nullptr || object == nullptr || !enabled) { return; } Camera* camera = GroundScene::get()->getCurrentCamera(); // Set up the matrices for the gizmo Transform w2c; w2c.invert(*camera->getTransform_o2w()); const Matrix4x4 view = Matrix4x4(w2c); const Matrix4x4 objectMatrix = Matrix4x4(*object->getTransform_o2w()); float* viewMatrix = &Matrix4x4().matrix[0][0]; float* projMatrix = &Matrix4x4().matrix[0][0]; float* objMatrix = &Matrix4x4().matrix[0][0]; Matrix4x4::transpose(&view.matrix[0][0], viewMatrix); Matrix4x4::transpose(&camera->projectionMatrix.matrix[0][0], projMatrix); Matrix4x4::transpose(&objectMatrix.matrix[0][0], objMatrix); // Enable and draw the gizmo ImGuizmo::SetRect(0, 0, Graphics::getCurrentRenderTargetWidth(), Graphics::getCurrentRenderTargetHeight()); ImGuizmo::BeginFrame(); ImGuizmo::Enable(true); editTransform(viewMatrix, projMatrix, objMatrix); gizmoHasMouseHover = ImGuizmo::IsOver(); if (ImGuizmo::IsUsing()) { // If the mouse went up or it's the initial use, store the original transform if (!wasUsed) { originalTransform = Transform(*object->getTransform_o2w()); } if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape))) { object->setTransform_o2w(originalTransform); Vector originalPos = originalTransform.getPosition(); object->positionAndRotationChanged(false, originalPos); wasUsed = false; ImGuizmo::Enable(false); ImGuizmo::Enable(true); return; } // Pass the updated matrix back to the object float* updatedObjMatrix = &Matrix4x4().matrix[0][0]; Matrix4x4::transpose(objMatrix, updatedObjMatrix); Transform previousTransform = Transform(*object->getTransform_o2w()); object->setTransform_o2w(*(Transform*)updatedObjMatrix); Vector oldPos = previousTransform.getPosition(); object->positionAndRotationChanged(false, oldPos); wasUsed = true; } else { // If there the gizmo was used and there was a change, notify the callbacks if (wasUsed) { if (originalTransform.getPosition() != object->getTransform_o2w()->getPosition()) { for (const auto& func : onGizmoPositionChangedCallbacks) { func(); } } if (!object->getTransform_o2w()->isRotationEqual(originalTransform)) { for (const auto& func : onGizmoRotationChangedCallbacks) { func(); } } } wasUsed = false; } } }
26.783401
198
0.693069
[ "render", "object", "vector", "transform" ]
acea3d7a285a709362110763cc876ff59a777d6a
20,839
cpp
C++
couples/ofxKinect/ofxKinectAutoCalibrator.cpp
MiliGaricoits/ofxNIMPComposer
7eb5ef7054f472066c349dc995d3d30802b33d7e
[ "MIT" ]
20
2015-07-12T08:12:16.000Z
2021-12-16T16:02:26.000Z
couples/ofxKinect/ofxKinectAutoCalibrator.cpp
MiliGaricoits/ofxNIMPComposer
7eb5ef7054f472066c349dc995d3d30802b33d7e
[ "MIT" ]
2
2016-05-28T15:50:44.000Z
2018-01-08T05:58:47.000Z
couples/ofxKinect/ofxKinectAutoCalibrator.cpp
MiliGaricoits/ofxNIMPComposer
7eb5ef7054f472066c349dc995d3d30802b33d7e
[ "MIT" ]
6
2015-06-08T00:15:45.000Z
2017-05-18T04:49:03.000Z
// // ofxKinectAutoCalibrator.cpp // mdt-Core // // Created by Patricio González Vivo on 3/28/12. // Copyright (c) 2012 PatricioGonzalezVivo.com. All rights reserved. // #include "ofxKinectAutoCalibrator.h" ofxKinectAutoCalibrator::ofxKinectAutoCalibrator(){ nStep = 0; } void ofxKinectAutoCalibrator::init(ofxKinect *_kinect, int _aproxSurfaceArea){ kinect = _kinect; surfaceMinArea = _aproxSurfaceArea; // Aprox minimal Area of the surface surfaceMinDistance = 500; // mm surfaceMaxDistance = 600; // mm scanningSliceHeight = 10.0; // mm scanningStepingDistance = 0.5; // mm surfaceDistance = surfaceMaxDistance; // kinect->setDepthClipping(surfaceDistance-scanningSliceHeight,surfaceDistance); redThreshold = 255; minDotArea = 50; maxDotArea = 100; scannedDot = 0; grayImage.allocate(kinect->getWidth(), kinect->getHeight()); colorImage.allocate(kinect->getWidth(), kinect->getHeight()); fbo.allocate(kinect->getWidth(), kinect->getHeight()); fbo.begin(); ofClear(0,255); fbo.end(); debugFbo.allocate(kinect->getWidth(), kinect->getHeight()); debugFbo.begin(); ofClear(0,255); debugFbo.end(); nStep = 0; bDone = false; } bool ofxKinectAutoCalibrator::update(ofxPatch *_patch){ if (nStep == 0){ if ( doStep0() ){ // Reset the mask of the patch // ofPolyline maskCorners; maskCorners.addVertex(0.0,0.0); maskCorners.addVertex(1.0,0.0); maskCorners.addVertex(1.0,1.0); maskCorners.addVertex(0.0,1.0); _patch->setMask(maskCorners); nStep++; } } else if (nStep == 1){ if ( doStep1() ){ // Normalize the position of each vertex with the image width and height // ofPolyline normalizedContour; for (int i = 0; i < surfaceContour.size(); i++){ normalizedContour.addVertex(surfaceContour[i].x/kinect->getWidth(), surfaceContour[i].y/kinect->getHeight()); } // Pass it to a ofxPatch::maskCorners // _patch->setMask(normalizedContour); nStep++; } } else if (nStep == 2){ if ( doStep2() ){ // Once it found it get the real dots position in relation with the screen. // for (int i = 0; i < 4; i++){ screenDots[i] = _patch->getSurfaceToScreen(realDots[i]); } nStep++; } } else if (nStep == 3){ if ( doStep3() ) nStep++; } else if (nStep == 4){ if ( doStep4() ) nStep++; } else if (nStep == 5){ // Make the transformation matrix // kinectToScreenMatrix = getHomographyMatrix(trackedDots,screenDots); // Aply the matrix to each corner of the patch // ofPoint coorners[4]; coorners[0].set(0,0); coorners[1].set(kinect->getWidth(),0); coorners[2].set(kinect->getWidth(),kinect->getHeight()); coorners[3].set(0,kinect->getHeight()); for (int i = 0; i < 4; i++){ coorners[i] = getkinectToScreen(coorners[i]); } _patch->setCoorners(coorners); // Clear the fbo // fbo.begin(); ofClear(0,255); fbo.end(); // Job well done // bDone = true; } _patch->setTexture(fbo.getTextureReference()); return bDone; } bool ofxKinectAutoCalibrator::doStep0(){ string msg = "Step 0: Searching for an empty space at " + ofToString(surfaceDistance*0.1) + "cm"; // Make a "slice cut" of depth data at the minim distance to find if everthing it´s all right // kinect->setDepthClipping(surfaceMinDistance,surfaceDistance); grayImage.setFromPixels(kinect->getDepthPixelsRef()); // Console feedback // ofLog(OF_LOG_NOTICE,msg); // Visual feedback // fbo.begin(); ofClear(0,255); ofSetColor(150); grayImage.draw(0, 0); contourFinder.draw(); ofSetColor(255); ofDrawBitmapString(msg, 15, 15); fbo.end(); // If it found a black screen, jump to the next step if ( isClean(grayImage) ){ ofLog(OF_LOG_NOTICE, "Step 0: COMPLETED. Empty space found at " + ofToString(surfaceDistance*0.1) + "cm" ); surfaceMinDistance = surfaceDistance; return true; } else { surfaceDistance--; return false; } } bool ofxKinectAutoCalibrator::doStep1(){ bool rta = false; string msg = "Step 1: Searching for a BIG surface (more than " + ofToString(surfaceMinArea) + ") at " + ofToString(surfaceDistance*0.1) + "cm"; bool found = false; // Make a "slice cut" of depth data at a progressive distance... // kinect->setDepthClipping(surfaceDistance-scanningSliceHeight,surfaceDistance); grayImage.setFromPixels(kinect->getDepthPixelsRef()); // ... searching for ONE big ( surfaceMinArea ) almost white blob ( the "posible" table ) // contourFinder.findContours(grayImage, surfaceMinArea, (640*480), 1, false); // Console Feedback // ofLog(OF_LOG_NOTICE,msg); // Visual Feedback // fbo.begin(); ofClear(0,255); ofSetColor(255); grayImage.draw(0, 0); contourFinder.draw(); ofDrawBitmapString(msg, 15, 15); fbo.end(); // if ONE big blob it´s found ... // if ( contourFinder.nBlobs == 1 ){ // ... check if it´s almost solid white or if need more distance to get good sharp edges. // if ( isBlobSolid(grayImage, contourFinder.blobs[0], 0.99)){ ofLog(OF_LOG_NOTICE, "Step 1: COMPLETED. Surface found at " + ofToString( surfaceDistance*0.1) + "cm" ); found = true; // a. Store ofPolyLine of the contour of that figure. // surfaceContour.clear(); surfaceContour.addVertexes(contourFinder.blobs[0].pts); surfaceContour.simplify(1); // b. Reset the scale factor of the surface area to 1.0 (non-scalation).Because on next step // it´s going to search for the right amount of scalation in order to place the dots // inside the surface. // scaleAreaFactor = 1.0; // c. Move to the next step rta = true; } } if (!found){ // If the surface it´s not found it will decende one steping distance and search again // surfaceDistance += scanningStepingDistance; // If it´s too far away it will start again (back to step 0) but form a little longer // max distance // if (surfaceDistance >= surfaceMaxDistance){ surfaceMinDistance = 500; surfaceMaxDistance += 100; surfaceDistance = surfaceMaxDistance; fbo.begin(); ofClear(0,255); fbo.end(); kinect->setDepthClipping(surfaceMinDistance,surfaceDistance); nStep = 0; } } return rta; } bool ofxKinectAutoCalibrator::doStep2(){ bool rta = false; string msg = "Step 2: Calculate the dot´s position ( scale " + ofToString(scaleAreaFactor) + " factor from coorners )"; // Extract the boundingBox of the tracked surfaceContour and scale progressively // until it found the right amount of scalation. // ofRectangle surfaceArea; surfaceArea.setFromCenter(surfaceContour.getBoundingBox().getCenter(), surfaceContour.getBoundingBox().width * scaleAreaFactor, surfaceContour.getBoundingBox().height * scaleAreaFactor); // Place the dots on the coorners of the scaled boundingBox // realDots[0].set(surfaceArea.x, surfaceArea.y); realDots[1].set(surfaceArea.x+surfaceArea.width, surfaceArea.y); realDots[2].set(surfaceArea.x+surfaceArea.width, surfaceArea.y+surfaceArea.height); realDots[3].set(surfaceArea.x, surfaceArea.y+surfaceArea.height); // Console Feedback // ofLog(OF_LOG_NOTICE,msg); // Visual Feedback // fbo.begin(); ofClear(0,255); ofPushStyle(); ofSetColor(255, 0, 0); for (int i = 0; i < 4; i++){ ofCircle(realDots[i], 20); } ofPopStyle(); ofSetColor(255); ofDrawBitmapString(msg, 15, 15); fbo.end(); // Check if every one it´s insde the the surfaceContour // int insideCount = 0; for (int i = 0; i < 4; i++){ if ( surfaceContour.inside( realDots[i] ) ){ insideCount++; } } if (insideCount == 4){ ofLog(OF_LOG_NOTICE, "Step 2: COMPLETED. Points placed on a scale " + ofToString(scaleAreaFactor) + " factor from coorners"); // Set some defaul valuables for next time // countDown = 100; // Number of times it have to see the 4 dot´s in order to be sure that it´s ok // Proced to next step // rta = true; } scaleAreaFactor -= 0.2; return rta; } bool ofxKinectAutoCalibrator::doStep3(){ bool rta = false; string msg1 = "Step 3: Searching for a clear view at threshold " + ofToString( redThreshold ); string msg2 = " and aprox. area of " + ofToString(minDotArea) + "-" + ofToString(maxDotArea); // Grab the RGB image of the kinect, take the RED channel, do a threshold and check // That are no dot´s // colorImage.setFromPixels(kinect->getPixelsRef()); grayImage.setFromPixels( colorImage.getPixelsRef().getChannel(0) ); grayImage.threshold(redThreshold); contourFinder.findContours(grayImage, 20, surfaceMinArea*0.25, 10, false); // Console Feedback // ofLog(OF_LOG_NOTICE,msg1); ofLog(OF_LOG_NOTICE,msg2); fbo.begin(); ofClear(0,255); ofFill(); // Draw the red dots. // ofSetColor(255, 0, 0,255); for (int i = 0; i < 4; i++){ ofCircle(realDots[i], 20); } ofPopStyle(); fbo.end(); debugFbo.begin(); ofClear(0,255); ofPushStyle(); ofSetColor(255, 255); grayImage.draw(0, 0); contourFinder.draw(); // For each circular dot extract the area and make an average // int circularBlobs = 0; for (int i = 0; i < contourFinder.nBlobs; i++){ if ( isBlobCircular(contourFinder.blobs[i]) ){ ofPushStyle(); ofSetColor(255,0,0, 255); ofDrawBitmapString("Dot", contourFinder.blobs[i].boundingRect.x, contourFinder.blobs[i].boundingRect.y ); float area = contourFinder.blobs[i].area; if ( area < minDotArea ) minDotArea = area - 1; if ( area > maxDotArea) maxDotArea = area + 1; ofPopStyle(); circularBlobs++; } } ofSetColor(255, 255); ofDrawBitmapString(msg1, 15, 15); ofDrawBitmapString(msg2, 15, 30); debugFbo.end(); if ( circularBlobs == 4){ if (countDown == 0){ ofLog(OF_LOG_NOTICE,"Setp 3: COMPLETED. 4 Dots found with an area between " + ofToString(minDotArea) + " and " + ofToString(maxDotArea) + " pixels."); // Prepare everthing for next step scannedDot = 0; // Start for first dot countDown = 100; // restart the timer // Passthrou to next step rta = true; } else { countDown--; // If found 4 circular dots count down } } else if (circularBlobs < 4){ countDown = 100; redThreshold--; if (redThreshold < 10) redThreshold = 255; } else if (circularBlobs > 4){ countDown = 100; redThreshold = ofClamp(redThreshold+1, 0, 255); } return rta; } bool ofxKinectAutoCalibrator::doStep4(){ bool rta = false; colorImage.setFromPixels(kinect->getPixelsRef()); grayImage.setFromPixels( colorImage.getPixelsRef().getChannel(0) ); grayImage.threshold(redThreshold); contourFinder.findContours(grayImage, minDotArea, maxDotArea , 10, false); // Visual Feedback // fbo.begin(); ofClear(0,255); ofPushStyle(); ofFill(); // Draw red circular dot to track ofSetColor(255, 0, 0,255); ofCircle(realDots[scannedDot], 20); // Draw blue marks to check for the consistency of the tracking blobs ofSetColor(0, 0, 255,255); for (int i = 0; i < contourFinder.nBlobs; i++){ ofLine(contourFinder.blobs[i].centroid.x-5,contourFinder.blobs[i].centroid.y,contourFinder.blobs[i].centroid.x+5,contourFinder.blobs[i].centroid.y); ofLine(contourFinder.blobs[i].centroid.x,contourFinder.blobs[i].centroid.y-5,contourFinder.blobs[i].centroid.x,contourFinder.blobs[i].centroid.y+5); } ofPopStyle(); fbo.end(); debugFbo.begin(); ofClear(0,255); grayImage.draw(0, 0); contourFinder.draw(); // Search for the only circular dot ( it have to be just one ) // if (contourFinder.nBlobs > 0){ ofPushStyle(); // Search for circular dots // int circularBlobs = 0; int circularBlobID = -1; for (int i = 0; i < contourFinder.nBlobs; i++){ if ( isBlobCircular(contourFinder.blobs[i]) ){ ofPushStyle(); ofSetColor(255,0,0, 255); ofDrawBitmapString("Dot", contourFinder.blobs[i].boundingRect.x, contourFinder.blobs[i].boundingRect.y ); circularBlobs++; circularBlobID = i; // store it position on the blob vector ofPopStyle(); } } // Check that it´s only one // if (circularBlobs == 1){ if (scannedDot < 4){ // For each dot make a counter for geting an average of here it founds it if (countDown != 0){ trackedDots[scannedDot] += contourFinder.blobs[circularBlobID].centroid; trackedDots[scannedDot] *= 0.5; countDown--; } else { // Once the timer it´s on 0 save the data and go to the next dot // ofLog(OF_LOG_NOTICE, "Step 4: Found dot nº " + ofToString(scannedDot + 1) + " at position " + ofToString(trackedDots[scannedDot])); scannedDot++; countDown = 100; } } else { // No more dots to track // ofLog(OF_LOG_NOTICE, "Step 4: COMPLETED. Four dots scanned succesfully"); rta = true; } } } ofPopStyle(); debugFbo.end(); return rta; } bool ofxKinectAutoCalibrator::isClean(ofxCvGrayscaleImage &img, float _normTolerance ){ bool rta = false; ofPolyline imgFrame; imgFrame.addVertex(0, 0); imgFrame.addVertex(img.getWidth(), 0); imgFrame.addVertex(img.getWidth(), img.getHeight()); imgFrame.addVertex(0, img.getHeight()); if ( (int) getAverage(img, imgFrame) == (255*_normTolerance)){ rta = true; } return rta; } bool ofxKinectAutoCalibrator::isBlobSolid(ofxCvGrayscaleImage &img, ofxCvBlob &blob, float _normTolerance){ bool rta = false; ofPolyline blobContour; blobContour.addVertexes(blob.pts); blobContour.simplify(5); ofLog(OF_LOG_NOTICE,"Searching for a blob with average brigness of " + ofToString(255*_normTolerance)); if (getAverage(img, blobContour) > (255*_normTolerance)){ rta = true; } return rta; } // Get the average of brightness of a specific blob // float ofxKinectAutoCalibrator::getAverage(ofxCvGrayscaleImage &img, ofPolyline &_polyline){ unsigned char * pixels = img.getPixels(); int imgWidth = img.getWidth(); int imgHeight = img.getHeight(); int totalPixles = imgWidth * imgHeight; int counter = 0; float average = 0; for (int x = 0; x < imgWidth ; x++) { for (int y = 0; y < imgHeight ; y++) { int pos = x + y * imgWidth; if (_polyline.inside(x, y)){ average += pixels[pos]; counter++; } } } average /= counter; ofLog(OF_LOG_NOTICE,"Just analize a Blob with a bright average of " + ofToString(average) ); return average; } bool ofxKinectAutoCalibrator::isBlobCircular(ofxCvBlob &blob){ bool rta = false; ofPoint center = blob.centroid; float area = blob.area; float maxDistance = 0; float minDistance = 10000; for(int i = 0; i < blob.pts.size(); i++){ float dist = center.distance( blob.pts[i] ); if (dist > maxDistance) maxDistance = dist; if (dist < minDistance) minDistance = dist; } float diff = abs(maxDistance - minDistance); if ( diff < 4 ) rta = true; return rta; } ofMatrix4x4 ofxKinectAutoCalibrator::getHomographyMatrix(ofPoint src[4], ofPoint dst[4]){ ofMatrix4x4 matrix; // create the equation system to be solved // // from: Multiple View Geometry in Computer Vision 2ed // Hartley R. and Zisserman A. // // x' = xH // where H is the homography: a 3 by 3 matrix // that transformed to inhomogeneous coordinates for each point // gives the following equations for each point: // // x' * (h31*x + h32*y + h33) = h11*x + h12*y + h13 // y' * (h31*x + h32*y + h33) = h21*x + h22*y + h23 // // as the homography is scale independent we can let h33 be 1 (indeed any of the terms) // so for 4 points we have 8 equations for 8 terms to solve: h11 - h32 // after ordering the terms it gives the following matrix // that can be solved with gaussian elimination: float P[8][9]={ {-src[0].x, -src[0].y, -1, 0, 0, 0, src[0].x*dst[0].x, src[0].y*dst[0].x, -dst[0].x }, // h11 { 0, 0, 0, -src[0].x, -src[0].y, -1, src[0].x*dst[0].y, src[0].y*dst[0].y, -dst[0].y }, // h12 {-src[1].x, -src[1].y, -1, 0, 0, 0, src[1].x*dst[1].x, src[1].y*dst[1].x, -dst[1].x }, // h13 { 0, 0, 0, -src[1].x, -src[1].y, -1, src[1].x*dst[1].y, src[1].y*dst[1].y, -dst[1].y }, // h21 {-src[2].x, -src[2].y, -1, 0, 0, 0, src[2].x*dst[2].x, src[2].y*dst[2].x, -dst[2].x }, // h22 { 0, 0, 0, -src[2].x, -src[2].y, -1, src[2].x*dst[2].y, src[2].y*dst[2].y, -dst[2].y }, // h23 {-src[3].x, -src[3].y, -1, 0, 0, 0, src[3].x*dst[3].x, src[3].y*dst[3].x, -dst[3].x }, // h31 { 0, 0, 0, -src[3].x, -src[3].y, -1, src[3].x*dst[3].y, src[3].y*dst[3].y, -dst[3].y }, // h32 }; getGaussianElimination(&P[0][0],9); matrix(0,0)=P[0][8]; matrix(0,1)=P[1][8]; matrix(0,2)=0; matrix(0,3)=P[2][8]; matrix(1,0)=P[3][8]; matrix(1,1)=P[4][8]; matrix(1,2)=0; matrix(1,3)=P[5][8]; matrix(2,0)=0; matrix(2,1)=0; matrix(2,2)=0; matrix(2,3)=0; matrix(3,0)=P[6][8]; matrix(3,1)=P[7][8]; matrix(3,2)=0; matrix(3,3)=1; return matrix; } void ofxKinectAutoCalibrator::getGaussianElimination(float *input, int n){ // ported to c from pseudocode in // http://en.wikipedia.org/wiki/Gaussian_elimination float * A = input; int i = 0; int j = 0; int m = n-1; while (i < m && j < n){ // Find pivot in column j, starting in row i: int maxi = i; for(int k = i+1; k<m; k++){ if(fabs(A[k*n+j]) > fabs(A[maxi*n+j])){ maxi = k; } } if (A[maxi*n+j] != 0){ //swap rows i and maxi, but do not change the value of i if(i!=maxi) for(int k=0;k<n;k++){ float aux = A[i*n+k]; A[i*n+k]=A[maxi*n+k]; A[maxi*n+k]=aux; } //Now A[i,j] will contain the old value of A[maxi,j]. //divide each entry in row i by A[i,j] float A_ij=A[i*n+j]; for(int k=0;k<n;k++){ A[i*n+k]/=A_ij; } //Now A[i,j] will have the value 1. for(int u = i+1; u< m; u++){ //subtract A[u,j] * row i from row u float A_uj = A[u*n+j]; for(int k=0;k<n;k++){ A[u*n+k]-=A_uj*A[i*n+k]; } //Now A[u,j] will be 0, since A[u,j] - A[i,j] * A[u,j] = A[u,j] - 1 * A[u,j] = 0. } i++; } j++; } //back substitution for(int i=m-2;i>=0;i--){ for(int j=i+1;j<n-1;j++){ A[i*n+m]-=A[i*n+j]*A[j*n+m]; //A[i*n+j]=0; } } }
30.333333
162
0.560727
[ "geometry", "vector", "solid" ]
aced4794e22a92344f6dc74b24abecbe8ff4e66c
1,630
hpp
C++
include/di/systems/display/message_box.hpp
acdemiralp/nano_engine
64069cf300af574efb0c979dbc97eb0a03cdc7a3
[ "MIT" ]
4
2021-02-24T14:13:47.000Z
2022-02-06T12:02:24.000Z
include/di/systems/display/message_box.hpp
acdemiralp/nano_engine
64069cf300af574efb0c979dbc97eb0a03cdc7a3
[ "MIT" ]
1
2018-01-06T11:52:16.000Z
2018-01-06T11:52:16.000Z
include/di/systems/display/message_box.hpp
acdemiralp/nano_engine
64069cf300af574efb0c979dbc97eb0a03cdc7a3
[ "MIT" ]
2
2018-02-11T14:51:17.000Z
2021-02-24T14:13:49.000Z
#ifndef DI_SYSTEMS_DISPLAY_MESSAGE_BOX_HPP_ #define DI_SYSTEMS_DISPLAY_MESSAGE_BOX_HPP_ #include <cstdint> #include <string> #include <vector> #include <SDL2/SDL_messagebox.h> #include <di/systems/display/message_box_color_scheme.hpp> #include <di/systems/display/message_box_level.hpp> namespace di { namespace message_box { inline void create( const std::string& title , const std::string& message , const message_box_level& level = message_box_level::information) { SDL_ShowSimpleMessageBox(static_cast<std::uint32_t>(level), title.c_str(), message.c_str(), nullptr); } inline std::string create( const std::string& title , const std::string& message , const std::vector<std::string>& buttons , const message_box_level& level = message_box_level::information, const message_box_color_scheme& color_scheme = message_box_color_scheme()) { std::vector<SDL_MessageBoxButtonData> native_buttons; for(int i = buttons.size() - 1; i >= 0; --i) native_buttons.push_back({0, i, buttons[i].c_str()}); auto native_color_scheme = color_scheme.native(); const SDL_MessageBoxData message_box_data { static_cast<std::uint32_t>(level), nullptr , title .c_str() , message.c_str() , static_cast<int>(buttons.size()) , native_buttons.data() , &native_color_scheme }; auto index = 0; SDL_ShowMessageBox(&message_box_data, &index); return buttons[index]; } } } #endif
28.596491
103
0.644785
[ "vector" ]
acee4be524bf00cf1c9b269154f383f63ee4fbf7
3,814
cpp
C++
src/laser_detection/src/cost_map_points.cpp
DLSHhaotian/RMAI2020-Planning
adfa76409acfa68e844995c708d1edc080eb180f
[ "MIT" ]
63
2020-09-23T14:31:33.000Z
2022-03-16T05:51:31.000Z
src/laser_detection/src/cost_map_points.cpp
DRL-CASIA/RoboRTS-Planning
3f5792cb091e13555fa23f9cbfdad4d11e60df82
[ "MIT" ]
6
2020-12-04T06:10:24.000Z
2021-06-01T08:37:05.000Z
src/laser_detection/src/cost_map_points.cpp
DRL-CASIA/RoboRTS-Planning
3f5792cb091e13555fa23f9cbfdad4d11e60df82
[ "MIT" ]
22
2020-09-23T11:31:58.000Z
2022-03-16T05:52:00.000Z
#include "laser_detection/cost_map.h" void CostMapCV::Map2World(unsigned int mx, unsigned int my, float &wx, float &wy){ wx = origin_x_ + (mx + 0.5) * resolution_; wy = origin_y_ + (my + 0.5) * resolution_; } bool CostMapCV::World2Map(float wx, float wy, unsigned int &mx, unsigned int &my){ if (wx < origin_x_ || wy < origin_y_) { return false; } mx = (int) ((wx - origin_x_) / resolution_); my = (int) ((wy - origin_y_) / resolution_); if (mx < size_x_ && my < size_y_) { return true; } return false; } void CostMapCV::GenerateSemiCircle(float r){ float begin_radius = 3.14159 / 2.0; float end_radius = 3.14159*3.0 / 2.0; float step = 0.01; int num_points = int((end_radius - begin_radius) / step) + 1; semi_circle.clear(); for(int i=0; i<num_points; i++){ float theta = begin_radius + step * float(i); cv::Point2f p; p.x = r * cos(theta); p.y = r * sin(theta); semi_circle.push_back(p); } } void CostMapCV::CostmapCallback(const nav_msgs::OccupancyGridConstPtr &msg){ std::cout<<"height: "<<msg->info.height<<" width: "<<msg->info.width<<std::endl; cv::Mat grid_map = cv::Mat(msg->info.height, msg->info.width,CV_8S, const_cast<int8_t*>(&msg->data[0]), (size_t)msg->info.width); cost_map.clear(); for(int i=0; i<msg->data.size(); i++){ cost_map.push_back(msg->data[i]); } cv::Point2f back_point; if(FindFeasiblePoint(1.5, back_point)){ unsigned int mx, my; if(World2Map(back_point.x, back_point.y, mx, my)){ std::cout<<"pixel: "<<mx<<" ,"<<my<<std::endl; cv::Point p_show(mx, my); cv::circle(grid_map, p_show, 3, cv::Scalar(0,255,0), -1, 8); } } cv::imshow("grid_map", grid_map); cv::waitKey(1); // cost_map = msg->data; } bool CostMapCV::FindFeasiblePoint(float r, cv::Point2f &point){ // lookup baselink tf::StampedTransform transform_base; try{ listener_.lookupTransform("/map", "/base_link", ros::Time(0), transform_base); }catch (tf::TransformException ex){ return false; } float base_x = transform_base.getOrigin().x(); float base_y = transform_base.getOrigin().y(); std::cout<<"current position: "<<base_x<<" ,"<<base_y<<std::endl; double roll, pitch, yaw; transform_base.getBasis().getEulerYPR(yaw, pitch, roll); yaw = -yaw; // generate circle points GenerateSemiCircle(r); // map points to pixels and find feasible points std::vector<cv::Point2f> feasible_points; for(int i=0; i<semi_circle.size(); i++){ float p_x = base_x + semi_circle[i].x * cos(yaw) + semi_circle[i].y * sin(yaw); float p_y = base_y - semi_circle[i].x * sin(yaw) + semi_circle[i].y * cos(yaw); unsigned int mx, my; cv::Point2f p; p.x = p_x; p.y = p_y; if(World2Map(p_x, p_y, mx, my)){ int cost = cost_map[GetIndex(mx, my)]; if(cost < 10) feasible_points.push_back(p); } } if (feasible_points.size() == 0){ std::printf("No feasible point! \n"); return false; }else{ // select best points float min_angle = 3.14; cv::Point2f best_point(base_x, base_y); for(int i=0; i<feasible_points.size(); i++){ float angle = atan((feasible_points[i].y - base_y) / (feasible_points[i].x - base_x)); if(fabs(angle)<fabs(min_angle)) { best_point.x = feasible_points[i].x; best_point.y = feasible_points[i].y; } } if((best_point.x == base_x) && (best_point.y == base_y)){ std::printf("Point is bad! \n"); return false; }else{ point.x = best_point.x; point.y = best_point.y; std::cout<<"feasible point: "<<point.x<<" ,"<<point.y<<std::endl; return true; } } } int main(int argc, char **argv) { ros::init(argc, argv, "cost_map_points"); CostMapCV cost_map_; ros::spin(); ROS_INFO("Hello world!"); }
32.87931
131
0.620608
[ "vector" ]
acf4aa4ab47186fcc0eddca7aa6c4675390924e6
7,472
cpp
C++
examples/dump/memory.cpp
CvX/hadesmem
d2c5164cc753dac37879ac8079f2ae23f2b8edb5
[ "MIT" ]
24
2018-08-18T18:05:37.000Z
2021-09-28T00:26:35.000Z
examples/dump/memory.cpp
CvX/hadesmem
d2c5164cc753dac37879ac8079f2ae23f2b8edb5
[ "MIT" ]
null
null
null
examples/dump/memory.cpp
CvX/hadesmem
d2c5164cc753dac37879ac8079f2ae23f2b8edb5
[ "MIT" ]
9
2018-04-16T09:53:09.000Z
2021-02-26T05:04:49.000Z
// Copyright (C) 2010-2014 Joshua Boyce. // See the file COPYING for copying permission. #include "headers.hpp" #include <cstdint> #include <fstream> #include <iostream> #include <limits> #include <hadesmem/config.hpp> #include <hadesmem/detail/str_conv.hpp> #include <hadesmem/pelib/dos_header.hpp> #include <hadesmem/pelib/import_dir.hpp> #include <hadesmem/pelib/import_dir_list.hpp> #include <hadesmem/pelib/import_thunk.hpp> #include <hadesmem/pelib/import_thunk_list.hpp> #include <hadesmem/pelib/nt_headers.hpp> #include <hadesmem/pelib/pe_file.hpp> #include <hadesmem/pelib/section.hpp> #include <hadesmem/pelib/section_list.hpp> #include <hadesmem/module.hpp> #include <hadesmem/module_list.hpp> #include <hadesmem/process.hpp> #include <hadesmem/process_helpers.hpp> #include "disassemble.hpp" #include "main.hpp" #include "print.hpp" #include "warning.hpp" namespace { std::uint64_t RoundUp(std::uint64_t n, std::uint64_t m) { if (!m) { return n; } auto const r = n % m; if (!r) { return n; } return n + m - r; } } void DumpMemory(hadesmem::Process const& process) { std::wostream& out = std::wcout; WriteNewline(out); WriteNormal(out, "Dumping image memory to disk.", 0); hadesmem::ModuleList modules(process); for (auto const& module : modules) { WriteNormal(out, "Checking for valid headers.", 0); try { hadesmem::PeFile const pe_file(process, module.GetHandle(), hadesmem::PeFileType::Image, static_cast<DWORD>(module.GetSize())); hadesmem::NtHeaders nt_headers(process, pe_file); } catch (std::exception const& /*e*/) { WriteNormal(out, "WARNING! Invalid headers.", 0); return; } WriteNormal(out, L"Reading memory.", 1); auto raw = hadesmem::ReadVectorEx<std::uint8_t>( process, module.GetHandle(), module.GetSize(), hadesmem::ReadFlags::kZeroFillReserved); hadesmem::Process const local_process(::GetCurrentProcessId()); hadesmem::PeFile const pe_file(local_process, raw.data(), hadesmem::PeFileType::Image, static_cast<DWORD>(raw.size())); hadesmem::NtHeaders nt_headers(local_process, pe_file); WriteNormal(out, L"Copying headers.", 1); std::vector<std::uint8_t> raw_new; std::copy(std::begin(raw), std::begin(raw) + nt_headers.GetSizeOfHeaders(), std::back_inserter(raw_new)); WriteNormal(out, L"Copying section data.", 1); hadesmem::SectionList const sections(local_process, pe_file); std::vector<std::pair<DWORD, DWORD>> raw_datas; for (auto const& section : sections) { auto const section_size = (std::max)(section.GetVirtualSize(), section.GetSizeOfRawData()); auto const ptr_raw_data_new = section.GetPointerToRawData() < raw_new.size() ? static_cast<DWORD>( RoundUp(raw_new.size(), nt_headers.GetFileAlignment())) : section.GetPointerToRawData(); raw_datas.emplace_back(ptr_raw_data_new, section_size); if (ptr_raw_data_new > raw_new.size()) { raw_new.resize(ptr_raw_data_new); } auto const raw_data = raw.data() + section.GetVirtualAddress(); auto const raw_data_end = raw_data + section_size; raw_new.reserve(raw_new.size() + section_size); std::copy(raw_data, raw_data_end, std::back_inserter(raw_new)); } HADESMEM_DETAIL_ASSERT(raw_new.size() < (std::numeric_limits<DWORD>::max)()); hadesmem::PeFile const pe_file_new(local_process, raw_new.data(), hadesmem::PeFileType::Data, static_cast<DWORD>(raw_new.size())); WriteNormal(out, L"Fixing NT headers.", 1); hadesmem::NtHeaders nt_headers_new(local_process, pe_file_new); nt_headers_new.SetImageBase( reinterpret_cast<ULONG_PTR>(module.GetHandle())); nt_headers_new.UpdateWrite(); WriteNormal(out, L"Fixing section headers.", 1); hadesmem::SectionList sections_new(local_process, pe_file_new); std::size_t n = 0; for (auto& section : sections_new) { section.SetPointerToRawData(raw_datas[n].first); section.SetSizeOfRawData(raw_datas[n].second); section.UpdateWrite(); ++n; } WriteNormal(out, L"Fixing imports.", 1); hadesmem::ImportDirList const import_dirs(local_process, pe_file); hadesmem::ImportDirList const import_dirs_new(local_process, pe_file_new); auto i = std::begin(import_dirs), j = std::begin(import_dirs_new); bool thunk_mismatch = false; for (; i != std::end(import_dirs) && j != std::end(import_dirs_new); ++i, ++j) { hadesmem::ImportThunkList const import_thunks( local_process, pe_file, i->GetOriginalFirstThunk()); hadesmem::ImportThunkList import_thunks_new( local_process, pe_file_new, j->GetFirstThunk()); auto a = std::begin(import_thunks); auto b = std::begin(import_thunks_new); for (; a != std::end(import_thunks) && b != std::end(import_thunks_new); ++a, ++b) { b->SetFunction(a->GetFunction()); b->UpdateWrite(); } thunk_mismatch = thunk_mismatch || ((a != std::end(import_thunks)) ^ (b != std::end(import_thunks_new))); } bool const dir_mismatch = (i != std::end(import_dirs)) ^ (j != std::end(import_dirs)); WriteNormal(out, L"Writing file.", 1); auto const proc_path = hadesmem::GetPath(process); auto const proc_name = proc_path.substr(proc_path.rfind(L'\\') + 1); auto const proc_pid_str = std::to_wstring(process.GetId()); std::wstring dump_path; std::uint32_t c = 0; do { dump_path = proc_name + L"_" + proc_pid_str + L"_" + module.GetName() + L"_" + std::to_wstring(c++) + L".dmp"; } while (hadesmem::detail::DoesFileExist(dump_path) && c < 10); auto const dump_file = hadesmem::detail::OpenFile<char>( dump_path, std::ios::out | std::ios::binary); if (!*dump_file) { HADESMEM_DETAIL_THROW_EXCEPTION(hadesmem::Error() << hadesmem::ErrorString( "Unable to open dump file.")); } if (!dump_file->write(reinterpret_cast<char const*>(raw_new.data()), raw_new.size())) { HADESMEM_DETAIL_THROW_EXCEPTION(hadesmem::Error() << hadesmem::ErrorString( "Unable to write to dump file.")); } if (dir_mismatch) { HADESMEM_DETAIL_THROW_EXCEPTION(hadesmem::Error() << hadesmem::ErrorString( "Mismatch in import dir processing.")); } if (thunk_mismatch) { HADESMEM_DETAIL_THROW_EXCEPTION( hadesmem::Error() << hadesmem::ErrorString( "Mismatch in import thunk processing.")); } } }
35.245283
80
0.589668
[ "vector" ]
acfe410ce7d36fe6f9baff751758ef50517046de
1,033
cpp
C++
Dev/asd_cpp/engine/ObjectSystem/3D/asd.MassModelObject3D.cpp
GCLemon/Altseed
b525740d64001aaed673552eb4ba3e98a321fcdf
[ "FTL" ]
37
2015-07-12T14:21:03.000Z
2020-10-17T03:08:17.000Z
Dev/asd_cpp/engine/ObjectSystem/3D/asd.MassModelObject3D.cpp
GCLemon/Altseed
b525740d64001aaed673552eb4ba3e98a321fcdf
[ "FTL" ]
91
2015-06-14T10:47:22.000Z
2020-06-29T18:05:21.000Z
Dev/asd_cpp/engine/ObjectSystem/3D/asd.MassModelObject3D.cpp
GCLemon/Altseed
b525740d64001aaed673552eb4ba3e98a321fcdf
[ "FTL" ]
14
2015-07-13T04:15:20.000Z
2021-09-30T01:34:51.000Z
#include "asd.MassModelObject3D.h" namespace asd { extern ObjectSystemFactory* g_objectSystemFactory; MassModelObject3D::MassModelObject3D() { m_coreObject = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateCoreMassModelObject3D()); m_commonObject = m_coreObject.get(); } MassModelObject3D::~MassModelObject3D() { } void MassModelObject3D::SetModel(std::shared_ptr<MassModel>& model) { m_coreObject->SetModel(model.get()); } void MassModelObject3D::PlayAnimation(const achar* name) { m_coreObject->PlayAnimation(name); } void MassModelObject3D::StopAnimation() { m_coreObject->StopAnimation(); } void MassModelObject3D::CrossFadeAnimation(const achar* name, float time) { m_coreObject->CrossFadeAnimation(name, time); } bool MassModelObject3D::GetIsAnimationPlaying() { return m_coreObject->GetIsAnimationPlaying(); } void MassModelObject3D::SetMaterialPropertyBlock(std::shared_ptr<MaterialPropertyBlock> block) { m_coreObject->SetMaterialPropertyBlock(block.get()); } }
21.978723
101
0.775411
[ "model" ]
4a0c2659b15fa606e9952c7d162a410df0f4ca2b
2,061
cpp
C++
code/554.cpp
Nightwish-cn/my_leetcode
40f206e346f3f734fb28f52b9cde0e0041436973
[ "MIT" ]
23
2020-03-30T05:44:56.000Z
2021-09-04T16:00:57.000Z
code/554.cpp
Nightwish-cn/my_leetcode
40f206e346f3f734fb28f52b9cde0e0041436973
[ "MIT" ]
1
2020-05-10T15:04:05.000Z
2020-06-14T01:21:44.000Z
code/554.cpp
Nightwish-cn/my_leetcode
40f206e346f3f734fb28f52b9cde0e0041436973
[ "MIT" ]
6
2020-03-30T05:45:04.000Z
2020-08-13T10:01:39.000Z
#include <bits/stdc++.h> #define INF 2000000000 using namespace std; typedef long long ll; int read(){ int f = 1, x = 0; char c = getchar(); while(c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();} while(c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar(); return f * x; } struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; bool isLeaf(TreeNode* root) { return root->left == NULL && root->right == NULL; } struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: int leastBricks(vector<vector<int>>& wall) { int n = wall.size(), m = wall[0].size(); for (int i = 0; i < n; ++i) for (int j = 1; j < wall[i].size(); ++j) wall[i][j] += wall[i][j - 1]; auto cmp = [&wall](pair<int, int> pi, pair<int, int> pj){ return wall[pi.first][pi.second] > wall[pj.first][pj.second]; }; priority_queue<pair<int, int>, vector<pair<int, int>>, decltype(cmp)> pq(cmp); for (int i = 0; i < n; ++i) pq.push(make_pair(i, 0)); int ans = n; while (!pq.empty()){ pair<int, int> pt = pq.top(); pq.pop(); int cnt = 1, val = wall[pt.first][pt.second]; while (!pq.empty()){ if (wall[pq.top().first][pq.top().second] != val) break; int id = pq.top().first, pos = pq.top().second; pq.pop(); if (pos != wall[id].size() - 1) pq.push(make_pair(id, pos + 1)); ++cnt; } if (pt.second != wall[pt.first].size() - 1) pq.push(make_pair(pt.first, pt.second + 1)); if (val < wall[0][m - 1]) ans = min(ans, n - cnt); } return ans; } }; Solution sol; void init(){ } void solve(){ // sol.convert(); } int main(){ init(); solve(); return 0; }
27.118421
86
0.464823
[ "vector" ]
4a0f023e9317c8b66a87b95700748860bae0aebc
1,024
cpp
C++
MFC++/SourceCodes/Chapter6/StringManipulationOp.cpp
CoodingPenguin/StudyMaterial
b6d8084fc38673ad6ffb54bc0bc60b2471168810
[ "MIT" ]
9
2019-02-21T20:20:25.000Z
2020-04-14T15:18:59.000Z
MFC++/SourceCodes/Chapter6/StringManipulationOp.cpp
CoodingPenguin/StudyMaterial
b6d8084fc38673ad6ffb54bc0bc60b2471168810
[ "MIT" ]
null
null
null
MFC++/SourceCodes/Chapter6/StringManipulationOp.cpp
CoodingPenguin/StudyMaterial
b6d8084fc38673ad6ffb54bc0bc60b2471168810
[ "MIT" ]
2
2019-07-09T02:01:37.000Z
2020-01-07T18:45:25.000Z
/* Written by @nErumin (Github) * 2016-11-29 * * Topic - string의 내용을 더 다양하게 조작해보자. */ #include <iostream> #include <string> #include <vector> #include <forward_list> #include <list> #include <deque> #include <array> using namespace std; int main() { string str; string anotherStr; auto startPos = 0; auto length = 0; str.insert(startPos, anotherStr); str.insert(startPos, anotherStr, startPos, length); str.insert(startPos, "Hello"); str.insert(startPos, "Hello", length); str.insert(startPos, 10, '!'); str.erase(startPos, length); str.assign(anotherStr); str.assign(anotherStr, startPos, length); str.assign("Hello!"); str.assign("Hello!", 2); str.append(anotherStr); str.append(anotherStr, startPos, length); str.append("Hello!"); str.append("Hello!", 5); str.append(10, 'c'); str.append(anotherStr.cbegin(), anotherStr.cend()); str.append({ "A", "B" }); str.replace(startPos, length, anotherStr); str.replace(str.begin(), str.end(), "Hello!", 6); // and anything else... return 0; }
20.897959
52
0.675781
[ "vector" ]
4a0f4d857f15d854462ed31fcd685349c3c248b4
11,996
cpp
C++
source/PostVoxelizerState.cpp
RobertBeckebans/CVCT_Vulkan
edd8e9865f126ffbdf474a6e419d46efc4c7f267
[ "MIT" ]
null
null
null
source/PostVoxelizerState.cpp
RobertBeckebans/CVCT_Vulkan
edd8e9865f126ffbdf474a6e419d46efc4c7f267
[ "MIT" ]
null
null
null
source/PostVoxelizerState.cpp
RobertBeckebans/CVCT_Vulkan
edd8e9865f126ffbdf474a6e419d46efc4c7f267
[ "MIT" ]
1
2021-04-09T09:20:20.000Z
2021-04-09T09:20:20.000Z
#include "PipelineStates.h" #include <glm/gtc/matrix_transform.hpp> #include "VCTPipelineDefines.h" #include "SwapChain.h" #include "VulkanCore.h" #include "Shader.h" #include "DataTypes.h" #include "AnisotropicVoxelTexture.h" #include "Camera.h" struct PushConstantComp { glm::vec3 gridres; // Resolution uint32_t cascadeNum; // Current cascade }; struct Parameter { AnisotropicVoxelTexture* avt; }; void BuildCommandBufferPostVoxelizerState( RenderState* renderstate, VkCommandPool commandpool, VulkanCore* core, uint32_t framebufferCount, VkFramebuffer* framebuffers, BYTE* parameters) { uint32_t width = core->GetSwapChain()->m_width; uint32_t height = core->GetSwapChain()->m_height; RenderState* renderState = renderstate; //////////////////////////////////////////////////////////////////////////////// // Rebuild the parameters //////////////////////////////////////////////////////////////////////////////// AnisotropicVoxelTexture* avt = ((Parameter*)parameters)->avt; //////////////////////////////////////////////////////////////////////////////// // Rebuild the command buffers //////////////////////////////////////////////////////////////////////////////// renderState->m_commandBufferCount = avt->m_cascadeCount; renderState->m_commandBuffers = (VkCommandBuffer*)malloc(sizeof(VkCommandBuffer)*renderState->m_commandBufferCount); for (uint32_t i = 0; i < renderState->m_commandBufferCount; i++) renderState->m_commandBuffers[i] = VKTools::Initializers::CreateCommandBuffer(commandpool, core->GetViewDevice(), VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); //////////////////////////////////////////////////////////////////////////////// // Record command buffer //////////////////////////////////////////////////////////////////////////////// VkCommandBufferBeginInfo cmdBufInfo = {}; cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; cmdBufInfo.pNext = NULL; for (uint32_t i = 0; i < renderState->m_commandBufferCount; i++) { VK_CHECK_RESULT(vkBeginCommandBuffer(renderState->m_commandBuffers[i], &cmdBufInfo)); vkCmdResetQueryPool(renderState->m_commandBuffers[i], renderState->m_queryPool, 0, 4); vkCmdWriteTimestamp(renderState->m_commandBuffers[i], VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, renderState->m_queryPool, 0); // Submit push constant PushConstantComp pc; pc.gridres = glm::vec3(avt->m_width, avt->m_height, avt->m_depth); pc.cascadeNum = i; vkCmdPushConstants(renderState->m_commandBuffers[i], renderState->m_pipelineLayout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(PushConstantComp), &pc); vkCmdBindPipeline(renderState->m_commandBuffers[i], VK_PIPELINE_BIND_POINT_COMPUTE, renderState->m_pipelines[0]); vkCmdBindDescriptorSets(renderState->m_commandBuffers[i], VK_PIPELINE_BIND_POINT_COMPUTE, renderState->m_pipelineLayout, 0, 1, &renderState->m_descriptorSets[0], 0, 0); uint32_t numdis = ((avt->m_width) / 8); vkCmdDispatch(renderState->m_commandBuffers[i], numdis * NUM_DIRECTIONS, numdis, numdis); vkCmdWriteTimestamp(renderState->m_commandBuffers[i], VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, renderState->m_queryPool, 1); vkEndCommandBuffer(renderState->m_commandBuffers[i]); } } void CreatePostVoxelizerState( RenderState& renderState, VulkanCore* core, VkCommandPool commandPool, VkDevice device, SwapChain* swapchain, AnisotropicVoxelTexture* avt) { uint32_t width = swapchain->m_width; uint32_t height = swapchain->m_height; //////////////////////////////////////////////////////////////////////////////// // Create queries //////////////////////////////////////////////////////////////////////////////// renderState.m_queryCount = 4; renderState.m_queryResults = (uint64_t*)malloc(sizeof(uint64_t)*renderState.m_queryCount); memset(renderState.m_queryResults, 0, sizeof(uint64_t)*renderState.m_queryCount); // Create query pool VkQueryPoolCreateInfo queryPoolInfo = {}; queryPoolInfo.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO; queryPoolInfo.queryType = VK_QUERY_TYPE_TIMESTAMP; queryPoolInfo.queryCount = renderState.m_queryCount; VK_CHECK_RESULT(vkCreateQueryPool(device, &queryPoolInfo, NULL, &renderState.m_queryPool)); //////////////////////////////////////////////////////////////////////////////// // Create the pipelineCache //////////////////////////////////////////////////////////////////////////////// // create a default pipelinecache VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {}; pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; VK_CHECK_RESULT(vkCreatePipelineCache(device, &pipelineCacheCreateInfo, NULL, &renderState.m_pipelineCache)); //////////////////////////////////////////////////////////////////////////////// // set framebuffers //////////////////////////////////////////////////////////////////////////////// renderState.m_framebufferCount = 0; renderState.m_framebuffers = NULL; //////////////////////////////////////////////////////////////////////////////// // Create semaphores //////////////////////////////////////////////////////////////////////////////// if (!renderState.m_semaphores) { renderState.m_semaphoreCount = avt->m_cascadeCount; renderState.m_semaphores = (VkSemaphore*)malloc(sizeof(VkSemaphore)*renderState.m_semaphoreCount); VkSemaphoreCreateInfo semInfo = VKTools::Initializers::SemaphoreCreateInfo(); for (uint32_t i = 0; i < renderState.m_semaphoreCount; i++) vkCreateSemaphore(core->GetViewDevice(), &semInfo, NULL, &renderState.m_semaphores[i]); } //////////////////////////////////////////////////////////////////////////////// // Create the Uniform Data //////////////////////////////////////////////////////////////////////////////// renderState.m_uniformData = NULL; renderState.m_uniformDataCount = 0; //////////////////////////////////////////////////////////////////////////////// // Set the descriptorset layout //////////////////////////////////////////////////////////////////////////////// if (!renderState.m_descriptorLayouts) { // Descriptorset renderState.m_descriptorLayoutCount = 1; renderState.m_descriptorLayouts = (VkDescriptorSetLayout*)malloc(renderState.m_descriptorLayoutCount * sizeof(VkDescriptorSetLayout)); VkDescriptorSetLayoutBinding layoutBinding[PostVoxelizerDescriptorLayout::POSTVOXELIZERDESCRIPTOR_COUNT]; // Binding 0 : Diffuse texture sampled image layoutBinding[POSTVOXELIZER_DESCRIPTOR_VOXELGRID_DIFFUSE] = { POSTVOXELIZER_DESCRIPTOR_VOXELGRID_DIFFUSE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL }; layoutBinding[POSTVOXELIZER_DESCRIPTOR_VOXELGRID_ALPHA] = { POSTVOXELIZER_DESCRIPTOR_VOXELGRID_ALPHA, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL }; // Create the descriptorlayout VkDescriptorSetLayoutCreateInfo descriptorLayout = VKTools::Initializers::DescriptorSetLayoutCreateInfo(0, PostVoxelizerDescriptorLayout::POSTVOXELIZERDESCRIPTOR_COUNT, layoutBinding); VK_CHECK_RESULT(vkCreateDescriptorSetLayout(device, &descriptorLayout, NULL, &renderState.m_descriptorLayouts[0])); } //////////////////////////////////////////////////////////////////////////////// // Create pipeline layout //////////////////////////////////////////////////////////////////////////////// if (!renderState.m_pipelineLayout) { VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo = VKTools::Initializers::PipelineLayoutCreateInfo(0, 1, &renderState.m_descriptorLayouts[0]); VkPushConstantRange pushConstantRange = VKTools::Initializers::PushConstantRange(VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(PushConstantComp)); pipelineLayoutCreateInfo.pushConstantRangeCount = 1; pipelineLayoutCreateInfo.pPushConstantRanges = &pushConstantRange; VK_CHECK_RESULT(vkCreatePipelineLayout(device, &pipelineLayoutCreateInfo, NULL, &renderState.m_pipelineLayout)); } //////////////////////////////////////////////////////////////////////////////// // Create descriptor pool //////////////////////////////////////////////////////////////////////////////// if (!renderState.m_descriptorPool) { VkDescriptorPoolSize poolSize[PostVoxelizerDescriptorLayout::POSTVOXELIZERDESCRIPTOR_COUNT]; poolSize[POSTVOXELIZER_DESCRIPTOR_VOXELGRID_DIFFUSE] = { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1 }; poolSize[POSTVOXELIZER_DESCRIPTOR_VOXELGRID_ALPHA] = { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1 }; VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = VKTools::Initializers::DescriptorPoolCreateInfo(0, 1, POSTVOXELIZERDESCRIPTOR_COUNT, poolSize); //create the descriptorPool VK_CHECK_RESULT(vkCreateDescriptorPool(device, &descriptorPoolCreateInfo, NULL, &renderState.m_descriptorPool)); } //////////////////////////////////////////////////////////////////////////////// // Create the descriptor set //////////////////////////////////////////////////////////////////////////////// if (!renderState.m_descriptorSets) { renderState.m_descriptorSetCount = 1; renderState.m_descriptorSets = (VkDescriptorSet*)malloc(renderState.m_descriptorSetCount * sizeof(VkDescriptorSet)); VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = VKTools::Initializers::DescriptorSetAllocateInfo(renderState.m_descriptorPool, 1, &renderState.m_descriptorLayouts[0]); //allocate the descriptorset with the pool VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &descriptorSetAllocateInfo, &renderState.m_descriptorSets[0])); /////////////////////////////////////////////////////// ///// Set/Update the image and uniform buffer descriptorsets /////////////////////////////////////////////////////// VkWriteDescriptorSet wds = {}; // Bind the 3D voxel textures { wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; wds.pNext = NULL; wds.dstSet = renderState.m_descriptorSets[0]; wds.dstBinding = POSTVOXELIZER_DESCRIPTOR_VOXELGRID_DIFFUSE; wds.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; wds.descriptorCount = 1; wds.dstArrayElement = 0; wds.pImageInfo = &avt->m_descriptor[0]; //update the descriptorset vkUpdateDescriptorSets(device, 1, &wds, 0, NULL); } { wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; wds.pNext = NULL; wds.dstSet = renderState.m_descriptorSets[0]; wds.dstBinding = POSTVOXELIZER_DESCRIPTOR_VOXELGRID_ALPHA; wds.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; wds.descriptorCount = 1; wds.dstArrayElement = 0; wds.pImageInfo = &avt->m_alphaDescriptor; //update the descriptorset vkUpdateDescriptorSets(device, 1, &wds, 0, NULL); } } /////////////////////////////////////////////////////// ///// Create the compute pipeline /////////////////////////////////////////////////////// if (!renderState.m_pipelines) { renderState.m_pipelineCount = 1; renderState.m_pipelines = (VkPipeline*)malloc(renderState.m_pipelineCount * sizeof(VkPipeline)); // Create pipeline VkComputePipelineCreateInfo computePipelineCreateInfo = VKTools::Initializers::ComputePipelineCreateInfo(renderState.m_pipelineLayout, VK_FLAGS_NONE); // Shaders are loaded from the SPIR-V format, which can be generated from glsl Shader shaderStage; shaderStage = VKTools::LoadShader("shaders/voxelizerpost.comp.spv", "main", device, VK_SHADER_STAGE_COMPUTE_BIT); computePipelineCreateInfo.stage = shaderStage.m_shaderStage; VK_CHECK_RESULT(vkCreateComputePipelines(device, renderState.m_pipelineCache, 1, &computePipelineCreateInfo, nullptr, &renderState.m_pipelines[0])); } //////////////////////////////////////////////////////////////////////////////// // Build command buffers //////////////////////////////////////////////////////////////////////////////// Parameter* parameter; parameter = (Parameter*)malloc(sizeof(Parameter)); parameter->avt = avt; renderState.m_cmdBufferParameters = (BYTE*)parameter; renderState.m_CreateCommandBufferFunc = &BuildCommandBufferPostVoxelizerState; renderState.m_CreateCommandBufferFunc(&renderState, commandPool, core, 0, NULL, renderState.m_cmdBufferParameters); }
47.984
186
0.646049
[ "3d" ]
4a123676246797a93050eecd1c6e32d8dc50d464
4,462
hpp
C++
boost/monotonic/forward_declarations.hpp
cschladetsch/Monotonic
ec37c3743862475719fdc8d2c3820fc0ab43c55a
[ "BSL-1.0" ]
12
2016-05-22T21:14:27.000Z
2021-08-05T21:28:17.000Z
boost/monotonic/forward_declarations.hpp
cschladetsch/Monotonic
ec37c3743862475719fdc8d2c3820fc0ab43c55a
[ "BSL-1.0" ]
5
2017-02-09T14:24:37.000Z
2020-10-31T14:38:45.000Z
boost/monotonic/forward_declarations.hpp
cschladetsch/Monotonic
ec37c3743862475719fdc8d2c3820fc0ab43c55a
[ "BSL-1.0" ]
1
2022-02-02T20:21:12.000Z
2022-02-02T20:21:12.000Z
// Copyright (C) 2009-2020 Christian@Schladetsch.com // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MONOTONIC_FORWARD_DECLARATIONS_HPP #define BOOST_MONOTONIC_FORWARD_DECLARATIONS_HPP #include <utility> #include <limits> #include <vector> //#include <boost/foreach.hpp> #include <boost/monotonic/detail/prefix.hpp> namespace boost { namespace monotonic { // fixed-sized storage for an allocator that is on the stack or heap template <size_t InlineSize = DefaultSizes::InlineSize> struct fixed_storage; // storage that can span the stack/heap boundary. // // allocation requests first use inline fixed_storage of InlineSize bytes. // once that is exhausted, later requests are serviced from the heap. // // all allocations remain valid until the storage goes out of scope. template < size_t InlineSize = DefaultSizes::InlineSize , size_t MinHeapIncrement = DefaultSizes::MinHeapIncrement , class Al = default_allocator > struct storage; // a fixed-size general stack template < size_t InlineSize = DefaultSizes::InlineSize> struct fixed_stack; // a growable stack-like object that starts on the stack and can grow to the heap template < size_t InlineSize = DefaultSizes::InlineSize , size_t MinHeapIncrement = DefaultSizes::MinHeapIncrement , class Al = default_allocator > struct stack; // tags for different storage regions struct default_region_tag { }; struct heap_region_tag { }; // tags for different access types struct default_access_tag { }; struct shared_access_tag { }; struct thread_local_access_tag { }; // selector to create a storage type given accessor namespace detail { template <class Region, class Access> struct storage_type; } // a RIIA structure for accessing and releasing storage template <class Region = default_region_tag, class Access = default_access_tag> struct local; // conventional, reclaimable storage template <size_t InlineSize = 0, size_t MinHeapIncrement = 0, class Al = default_allocator> struct reclaimable_storage; // thread-safe storage template <class Storage> struct shared_storage; // thread-local storage template <size_t InlineSize = DefaultSizes::InlineSize , size_t MinHeapIncrement = DefaultSizes::MinHeapIncrement , class Al = default_allocator > struct thread_local_storage; // a globally available storage buffer template <class Region = default_region_tag , class Access = default_access_tag , size_t InlineSize = DefaultSizes::/*Static*/InlineSize , size_t MinHeapIncrement = DefaultSizes::/*Static*/MinHeapIncrement , class Al = default_allocator > struct static_storage; /// common to other monotonic allocators for type T of type Derived template <class T, class Derived> struct allocator_base; // a monotonic allocator has a storage buffer and a no-op deallocate() method // // each region uses independent storage // // each region is also factored over which access to use: global, shared, or thread-local storage template <class T, class Region = default_region_tag, class Access = default_access_tag> struct allocator; // a monotonic shared_allocator has a shared storage buffer and a no-op deallocate() method // defaults to use static_storage_base<..., shared_storage> template <class T, class Region = default_region_tag> struct shared_allocator; // a monotonic thread_local_allocator has a shared storage buffer and a no-op deallocate() method // defaults to use static_storage_base<..., thread_local_storage> template <class T, class Region = default_region_tag> struct thread_local_allocator; } // namespace monotonic } // namespace boost #include <boost/monotonic/detail/postfix.hpp> #endif // BOOST_MONOTONIC_FORWARD_DECLARATIONS_HPP //EOF
36.57377
105
0.665397
[ "object", "vector" ]
4a205073da8084acd269764fbefd944e966e1632
4,534
cc
C++
orttraining/orttraining/test/training_ops/cuda/scale_test.cc
dennyac/onnxruntime
d5175795d2b7f2db18b0390f394a49238f814668
[ "MIT" ]
6,036
2019-05-07T06:03:57.000Z
2022-03-31T17:59:54.000Z
orttraining/orttraining/test/training_ops/cuda/scale_test.cc
dennyac/onnxruntime
d5175795d2b7f2db18b0390f394a49238f814668
[ "MIT" ]
5,730
2019-05-06T23:04:55.000Z
2022-03-31T23:55:56.000Z
orttraining/orttraining/test/training_ops/cuda/scale_test.cc
dennyac/onnxruntime
d5175795d2b7f2db18b0390f394a49238f814668
[ "MIT" ]
1,566
2019-05-07T01:30:07.000Z
2022-03-31T17:06:50.000Z
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #include "test/common/tensor_op_test_utils.h" #include "test/providers/provider_test_utils.h" namespace onnxruntime { namespace test { struct ScaleInputOutput { ScaleInputOutput() { input_half.resize(input_float.size()); output_up_half.resize(output_up_float.size()); output_down_half.resize(output_down_float.size()); scale_half.resize(scale_float.size()); ConvertFloatToMLFloat16(input_float.data(), input_half.data(), int(input_float.size())); ConvertFloatToMLFloat16(output_up_float.data(), output_up_half.data(), int(output_up_float.size())); ConvertFloatToMLFloat16(output_down_float.data(), output_down_half.data(), int(output_down_float.size())); ConvertFloatToMLFloat16(scale_float.data(), scale_half.data(), int(scale_float.size())); } // Fp32 Inputs/Output std::vector<float> scale_float = {2.0f}; std::vector<int64_t> scale_int64 = {2LL}; std::vector<int32_t> scale_int32 = {2}; std::vector<double> scale_double = {2.0}; std::vector<float> input_float = {1.0f, 2.0f, 3.0f}; std::vector<double> input_double = {1.0, 2.0, 3.0}; std::vector<float> output_up_float = {2.0f, 4.0f, 6.0f}; std::vector<float> output_down_float = {0.5f, 1.0f, 1.5f}; std::vector<double> output_up_double = {2.0, 4.0, 6.0}; std::vector<double> output_down_double = {0.5, 1.0, 1.5}; // Fp16 Inputs/Outputs std::vector<MLFloat16> input_half; std::vector<MLFloat16> output_up_half; std::vector<MLFloat16> output_down_half; std::vector<MLFloat16> scale_half; }; TEST(CudaKernelTest, ScaleFloatFloatScaleUp) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddInput<float>("input", {3}, data.input_float); test.AddInput<float>("scale", {1}, data.scale_float); test.AddOutput<float>("output", {3}, data.output_up_float); test.Run(); } TEST(CudaKernelTest, ScaleDoubleInt32ScaleUp) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddInput<double>("input", {3}, data.input_double); test.AddInput<int32_t>("scale", {1}, data.scale_int32); test.AddOutput<double>("output", {3}, data.output_up_double); test.Run(); } TEST(CudaKernelTest, ScaleHalfHalfScaleUp) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddAttribute("scale_down", int64_t(0)); test.AddInput<MLFloat16>("input", {3}, data.input_half); test.AddInput<MLFloat16>("scale", {1}, data.scale_half); test.AddOutput<MLFloat16>("output", {3}, data.output_up_half); test.Run(); } TEST(CudaKernelTest, ScaleHalfInt64ScaleUp) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddAttribute("scale_down", int64_t(0)); test.AddInput<MLFloat16>("input", {3}, data.input_half); test.AddInput<int64_t>("scale", {1}, data.scale_int64); test.AddOutput<MLFloat16>("output", {3}, data.output_up_half); test.Run(); } TEST(CudaKernelTest, ScaleFloatDoubleScaleDown) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddAttribute("scale_down", int64_t(1)); test.AddInput<float>("input", {3}, data.input_float); test.AddInput<double>("scale", {1}, data.scale_double); test.AddOutput<float>("output", {3}, data.output_down_float); test.Run(); } TEST(CudaKernelTest, ScaleDoubleInt64ScaleDown) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddAttribute("scale_down", int64_t(1)); test.AddInput<double>("input", {3}, data.input_double); test.AddInput<int64_t>("scale", {1}, data.scale_int64); test.AddOutput<double>("output", {3}, data.output_down_double); test.Run(); } TEST(CudaKernelTest, ScaleHalfHalfScaleDown) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddAttribute("scale_down", int64_t(1)); test.AddInput<MLFloat16>("input", {3}, data.input_half); test.AddInput<MLFloat16>("scale", {1}, data.scale_half); test.AddOutput<MLFloat16>("output", {3}, data.output_down_half); test.Run(); } TEST(CudaKernelTest, ScaleHalfInt64ScaleDown) { ScaleInputOutput data; OpTester test("Scale", 1, onnxruntime::kMSDomain); test.AddAttribute("scale_down", int64_t(1)); test.AddInput<MLFloat16>("input", {3}, data.input_half); test.AddInput<int64_t>("scale", {1}, data.scale_int64); test.AddOutput<MLFloat16>("output", {3}, data.output_down_half); test.Run(); } } // namespace test } // namespace onnxruntime
37.471074
110
0.720115
[ "vector" ]
4a247321116a507d39e356bcabef6aa35e22dd3b
22,721
cpp
C++
sis/src/v1/SisClient.cpp
ChenwxJay/huaweicloud-sdk-cpp-v3
f821ec6d269b50203e0c1638571ee1349c503c41
[ "Apache-2.0" ]
1
2021-11-30T09:31:16.000Z
2021-11-30T09:31:16.000Z
sis/src/v1/SisClient.cpp
ChenwxJay/huaweicloud-sdk-cpp-v3
f821ec6d269b50203e0c1638571ee1349c503c41
[ "Apache-2.0" ]
null
null
null
sis/src/v1/SisClient.cpp
ChenwxJay/huaweicloud-sdk-cpp-v3
f821ec6d269b50203e0c1638571ee1349c503c41
[ "Apache-2.0" ]
null
null
null
#include <huaweicloud/sis/v1/SisClient.h> #include <huaweicloud/core/utils/MultipartFormData.h> #include <unordered_set> #include <boost/algorithm/string/replace.hpp> template <typename T> std::string toString(const T value) { std::ostringstream out; out << std::setprecision(std::numeric_limits<T>::digits10) << std::fixed << value; return out.str(); } namespace HuaweiCloud { namespace Sdk { namespace Sis { namespace V1 { using namespace HuaweiCloud::Sdk::Sis::V1::Model; SisClient::SisClient() { } SisClient::~SisClient() { } ClientBuilder<SisClient> SisClient::newBuilder() { return ClientBuilder<SisClient>(""); } std::shared_ptr<CollectTranscriberJobResponse> SisClient::collectTranscriberJob(CollectTranscriberJobRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/transcriber/jobs/{job_id}"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; localVarPathParams["job_id"] = parameterToString(request.getJobId()); bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; std::unique_ptr<HttpResponse> res = callApi("GET", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<CollectTranscriberJobResponse> localVarResult = std::make_shared<CollectTranscriberJobResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<CreateVocabularyResponse> SisClient::createVocabulary(CreateVocabularyRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/vocabularies"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<CreateVocabularyResponse> localVarResult = std::make_shared<CreateVocabularyResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<DeleteVocabularyResponse> SisClient::deleteVocabulary(DeleteVocabularyRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/vocabularies/{vocabulary_id}"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; localVarPathParams["vocabulary_id"] = parameterToString(request.getVocabularyId()); bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; std::unique_ptr<HttpResponse> res = callApi("DELETE", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<DeleteVocabularyResponse> localVarResult = std::make_shared<DeleteVocabularyResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<PushTranscriberJobsResponse> SisClient::pushTranscriberJobs(PushTranscriberJobsRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/transcriber/jobs"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<PushTranscriberJobsResponse> localVarResult = std::make_shared<PushTranscriberJobsResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<RecognizeFlashAsrResponse> SisClient::recognizeFlashAsr(RecognizeFlashAsrRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/flash"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; if (request.propertyIsSet()) { localVarQueryParams["property"] = parameterToString(request.getProperty()); } if (request.audioFormatIsSet()) { localVarQueryParams["audio_format"] = parameterToString(request.getAudioFormat()); } if (request.addPuncIsSet()) { localVarQueryParams["add_punc"] = parameterToString(request.getAddPunc()); } if (request.digitNormIsSet()) { localVarQueryParams["digit_norm"] = parameterToString(request.getDigitNorm()); } if (request.needWordInfoIsSet()) { localVarQueryParams["need_word_info"] = parameterToString(request.getNeedWordInfo()); } if (request.vocabularyIdIsSet()) { localVarQueryParams["vocabulary_id"] = parameterToString(request.getVocabularyId()); } if (request.obsBucketNameIsSet()) { localVarQueryParams["obs_bucket_name"] = parameterToString(request.getObsBucketName()); } if (request.obsObjectKeyIsSet()) { localVarQueryParams["obs_object_key"] = parameterToString(request.getObsObjectKey()); } if (request.firstChannelOnlyIsSet()) { localVarQueryParams["first_channel_only"] = parameterToString(request.getFirstChannelOnly()); } std::string localVarHttpBody; std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<RecognizeFlashAsrResponse> localVarResult = std::make_shared<RecognizeFlashAsrResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<RecognizeShortAudioResponse> SisClient::recognizeShortAudio(RecognizeShortAudioRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/short-audio"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<RecognizeShortAudioResponse> localVarResult = std::make_shared<RecognizeShortAudioResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<RunAudioAssessmentResponse> SisClient::runAudioAssessment(RunAudioAssessmentRequest &request) { std::string localVarPath = "/v1/{project_id}/assessment/audio"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<RunAudioAssessmentResponse> localVarResult = std::make_shared<RunAudioAssessmentResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<RunMultiModalAssessmentResponse> SisClient::runMultiModalAssessment(RunMultiModalAssessmentRequest &request) { std::string localVarPath = "/v1/{project_id}/assessment/video"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<RunMultiModalAssessmentResponse> localVarResult = std::make_shared<RunMultiModalAssessmentResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<RunTtsResponse> SisClient::runTts(RunTtsRequest &request) { std::string localVarPath = "/v1/{project_id}/tts"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("POST", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<RunTtsResponse> localVarResult = std::make_shared<RunTtsResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<ShowVocabulariesResponse> SisClient::showVocabularies(ShowVocabulariesRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/vocabularies"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("GET", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<ShowVocabulariesResponse> localVarResult = std::make_shared<ShowVocabulariesResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<ShowVocabularyResponse> SisClient::showVocabulary(ShowVocabularyRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/vocabularies/{vocabulary_id}"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; localVarPathParams["vocabulary_id"] = parameterToString(request.getVocabularyId()); bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; std::unique_ptr<HttpResponse> res = callApi("GET", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<ShowVocabularyResponse> localVarResult = std::make_shared<ShowVocabularyResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } std::shared_ptr<UpdateVocabularyResponse> SisClient::updateVocabulary(UpdateVocabularyRequest &request) { std::string localVarPath = "/v1/{project_id}/asr/vocabularies/{vocabulary_id}"; std::map<std::string, std::string> localVarQueryParams; std::map<std::string, std::string> localVarHeaderParams; std::map<std::string, std::string> localVarFormParams; std::map<std::string, std::string> localVarPathParams; std::map<std::string, std::shared_ptr<HttpContent>> localVarFileParams; localVarPathParams["vocabulary_id"] = parameterToString(request.getVocabularyId()); bool isJson = false; bool isMultiPart = false; std::string contentType = getContentType("application/json;charset=UTF-8", isJson, isMultiPart); localVarHeaderParams["Content-Type"] = contentType; std::string localVarHttpBody; if (isJson) { web::json::value localVarJson; localVarJson = ModelBase::toJson(request.getBody()); localVarHttpBody = utility::conversions::to_utf8string(localVarJson.serialize()); } std::unique_ptr<HttpResponse> res = callApi("PUT", localVarPath, localVarPathParams, localVarQueryParams, localVarHeaderParams, localVarHttpBody); std::shared_ptr<UpdateVocabularyResponse> localVarResult = std::make_shared<UpdateVocabularyResponse>(); if (!res->getHttpBody().empty()) { utility::string_t localVarResponse = utility::conversions::to_string_t(res->getHttpBody()); web::json::value localVarJson = web::json::value::parse(localVarResponse); localVarResult->fromJson(localVarJson); } localVarResult->setStatusCode(res->getStatusCode()); localVarResult->setHeaderParams(res->getHeaderParams()); localVarResult->setHttpBody(res->getHttpBody()); return localVarResult; } #if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) std::string SisClient::parameterToString(utility::string_t value) { return utility::conversions::to_utf8string(value); } #endif std::string SisClient::parameterToString(std::string value) { return value; } std::string SisClient::parameterToString(int64_t value) { std::stringstream valueAsStringStream; valueAsStringStream << value; return valueAsStringStream.str(); } std::string SisClient::parameterToString(int32_t value) { std::stringstream valueAsStringStream; valueAsStringStream << value; return valueAsStringStream.str(); } std::string SisClient::parameterToString(float value) { return toString(value); } std::string SisClient::parameterToString(double value) { return toString(value); } std::string SisClient::parameterToString(const utility::datetime &value) { return utility::conversions::to_utf8string(value.to_string(utility::datetime::ISO_8601)); } } } } }
40.718638
153
0.731922
[ "model" ]
4a27137f39d54a14a67fc708afc952fd542adc70
60,911
cpp
C++
tk_textiler.cpp
joeld42/tk_textile
c971f39e8054d0504d43c1c5edd7a662fa5c544f
[ "MIT" ]
null
null
null
tk_textiler.cpp
joeld42/tk_textile
c971f39e8054d0504d43c1c5edd7a662fa5c544f
[ "MIT" ]
null
null
null
tk_textiler.cpp
joeld42/tk_textile
c971f39e8054d0504d43c1c5edd7a662fa5c544f
[ "MIT" ]
null
null
null
// // tk_textile.cpp // tk_textile // // Created by Joel Davis on 2/27/16. // Copyright © 2016 Joel Davis. All rights reserved. // #include <assert.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <limits.h> #include "tk_textiler.h" #include "stb_image.h" #include "stb_image_write.h" #include "jr_vectorfont.h" // TODO list -------- // - correspondence points in placeEdge // - handle open meshes // - make all things cmd line options // - #define TK_PI (3.1415926535897932384626433832795) #define TK_DEG2RAD (TK_PI/180.0) #define TK_RAD2DEG (180.0/TK_PI) #define TK_SQRT3_OVER_2 (0.86602540378443864676372) #define TK_SGN(x) ((x<0)?-1:((x>0)?1:0)) #define TK_ABS(x) (((x)<0)?-(x):(x)) #define TK_LERP(a,b,t) (((1.0-t)*(a)) + (t*(b))) static VectorFont *g_vectorFont = NULL; using namespace tapnik; // ================================================== # pragma mark - Misc // ================================================== static inline GLKVector3 lerpVec3( GLKVector3 a, GLKVector3 b, float t ) { return GLKVector3Make( TK_LERP(a.x,b.x,t), TK_LERP(a.y,b.y,t), TK_LERP(a.z,b.z,t) ); } static inline GLKVector4 lerpVec4( GLKVector4 a, GLKVector4 b, float t ) { return GLKVector4Make( TK_LERP(a.x,b.x,t), TK_LERP(a.y,b.y,t), TK_LERP(a.z,b.z,t), TK_LERP(a.w,b.w,t) ); } static inline float saturate( float x ) { if (x < 0.0) return 0.0; else if (x > 1.0) return 1.0; else return x; } static inline float smoothstep(float edge0, float edge1, float x) { // Scale, bias and saturate x to 0..1 range x = saturate((x - edge0)/(edge1 - edge0)); // Evaluate polynomial return x*x*(3 - 2*x); } static inline uint32_t min_u32( uint32_t a, uint32_t b ) { if (a < b) return a; else return b; } float randUniform() { return (float)rand() / (float)RAND_MAX; } float randUniform( float minVal, float maxVal ) { return minVal + (randUniform() * (maxVal-minVal)); } //http://gamedev.stackexchange.com/questions/23743/whats-the-most-efficient-way-to-find-barycentric-coordinates GLKVector3 barycentric( GLKVector3 a, GLKVector3 b, GLKVector3 c, GLKVector3 p ) { GLKVector3 result; GLKVector3 v0 = GLKVector3Subtract(b, a); GLKVector3 v1 = GLKVector3Subtract(c, a); GLKVector3 v2 = GLKVector3Subtract(p, a); float d00 = GLKVector3DotProduct( v0, v0 ); float d01 = GLKVector3DotProduct( v0, v1 ); float d11 = GLKVector3DotProduct( v1, v1 ); float d20 = GLKVector3DotProduct( v2, v0 ); float d21 = GLKVector3DotProduct( v2, v1 ); float denom = d00*d11 - d01*d01; result.y = (d11*d20 - d01*d21) / denom; result.z = (d00*d21 - d01*d20) / denom; result.x = 1.0f - result.y - result.z; return result; } static inline GLKVector4 floatColor( uint32_t pixelColor ) { // abgr(uint32) -> rgba (float) return GLKVector4Make( (float)(pixelColor & 0xff) / 255.0, (float)((pixelColor >> 8) & 0xff) / 255.0, (float)((pixelColor >> 16) & 0xff) / 255.0, (float)((pixelColor >> 24) & 0xff) / 255.0 ); } static inline uint32_t pixelColor( GLKVector4 floatColor ) { // rgba(float -> abgr(uint32) return ((int)(floatColor.a*0xff) << 24) | ((int)(floatColor.b*0xff) << 16) | ((int)(floatColor.g*0xff) << 8) | (int)(floatColor.r*0xff); } static inline float pixelError( uint32_t cA, uint32_t cB ) { GLKVector4 a = floatColor( cA ); GLKVector4 b = floatColor( cB ); // TODO: try Yuv or something to get more perceptual errors float err = fabs(a.x - b.x) + fabs(a.y - b.y) + fabs(a.z - b.z ); // float err = fabs(GLKVector4Length( a ) - GLKVector4Length(b)); return err*err; } void *readEntireFile( const char *filename, size_t *out_filesz ) { FILE *fp = fopen( filename, "r" ); if (!fp) return NULL; // Get file size fseek( fp, 0L, SEEK_END ); size_t filesz = ftell(fp); fseek( fp, 0L, SEEK_SET ); void *fileData = malloc( filesz ); if (fileData) { size_t result = fread( fileData, filesz, 1, fp ); // result is # of chunks read, we're asking for 1, fread // won't return partial reads, so it's all or nothing. if (!result) { free( fileData); fileData = NULL; } else { // read suceeded, set out filesize *out_filesz = filesz; } } return fileData; } void loadObjErrorMessage( size_t lineNum, const char *message, void *userData ) { Mesh *mesh = (Mesh*)userData; printf("Error loading OBJ file '%s' on line %zu: %s\n", mesh?mesh->filename_:"", lineNum, message ); } // ================================================== # pragma mark - Image // ================================================== Image::Image( uint32_t width, uint32_t height ) : width_(width), height_(height) { imgdata_ = (uint32_t*)malloc( sizeof(uint32_t)*4*width_*height_ ); } Image::~Image() { if (imgdata_) { free( imgdata_ ); } if (filename_) { free( filename_ ); } } void Image::clear( uint32_t color ) { // huh this is a neat function. i wonder if it's portable?? memset_pattern4( imgdata_, &color, sizeof(uint32_t)*4*width_*height_ ); } // for debugging use only inline void Image::drawPixelTinted( int32_t x, int32_t y, uint32_t origColor, uint32_t tintColor, float tintAmt ) { GLKVector4 origColorf = floatColor( origColor ); GLKVector4 tintColorf = floatColor(tintColor ); GLKVector4 colorf = lerpVec4( origColorf, tintColorf, tintAmt ); uint32_t color = pixelColor( colorf ); if ((x>=0) && (y>=0) && (x < width_) && (y < height_)) { imgdata_[ (y * width_) + x ] = color; } } inline void Image::drawPixel( int32_t x, int32_t y, uint32_t color ) { if ((x>=0) && (y>=0) && (x < width_) && (y < height_)) { imgdata_[ (y * width_) + x ] = color; } } inline uint32_t Image::getPixel( int32_t x, int32_t y ) { if ((x>=0) && (y>=0) && (x < width_) && (y < height_)) { return imgdata_[ (y * width_) + x ]; } else { return 0xff7effff; // noticable out of bounds color } } // shamelessly stolen off the internet void Image::drawLine( int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color ) { // return; // printf("drawline %d %d -> %d %d\n", x1, y1, x2, y2 ); int32_t dx=x2-x1; /* the horizontal distance of the line */ int32_t dy=y2-y1; /* the vertical distance of the line */ int32_t dxabs=TK_ABS(dx); int32_t dyabs=TK_ABS(dy); int32_t sdx=TK_SGN(dx); int32_t sdy=TK_SGN(dy); int32_t x=dyabs>>1; int32_t y=dxabs>>1; int32_t px=x1; int32_t py=y1; drawPixel(px,py,color ); if (dxabs>=dyabs) { /* the line is more horizontal than vertical */ for(int i=0;i<dxabs;i++) { y+=dyabs; if (y>=dxabs) { y-=dxabs; py+=sdy; } px+=sdx; drawPixel(px,py,color ); } } else { /* the line is more vertical than horizontal */ for(int i=0;i<dyabs;i++) { x+=dxabs; if (x>=dyabs) { x-=dyabs; px+=sdx; } py+=sdy; drawPixel(px,py,color ); } } } void foreach_line( int32_t x1, int32_t y1, int32_t x2, int32_t y2, void *userdata, void (*func)(void*,int,int) ) { // return; // printf("drawline %d %d -> %d %d\n", x1, y1, x2, y2 ); int32_t dx=x2-x1; /* the horizontal distance of the line */ int32_t dy=y2-y1; /* the vertical distance of the line */ int32_t dxabs=TK_ABS(dx); int32_t dyabs=TK_ABS(dy); int32_t sdx=TK_SGN(dx); int32_t sdy=TK_SGN(dy); int32_t x=dyabs>>1; int32_t y=dxabs>>1; int32_t px=x1; int32_t py=y1; func(userdata, px,py); if (dxabs>=dyabs) { /* the line is more horizontal than vertical */ for(int i=0;i<dxabs;i++) { y+=dyabs; if (y>=dxabs) { y-=dxabs; py+=sdy; } px+=sdx; func(userdata,px,py); } } else { /* the line is more vertical than horizontal */ for(int i=0;i<dyabs;i++) { x+=dxabs; if (x>=dyabs) { x-=dyabs; px+=sdx; } py+=sdy; func(userdata, px,py); } } } void Image::drawFatLine( int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color ) { for (int i=-2; i <= 2; i++) { for( int j=-2; j <= 2; j++) { drawLine( x1+i, y1+j, x2+i, y2+j, color ); } } } Image *Image::load( const char *filename ) { Image *img = new Image(); img->filename_ = strdup(filename); int comp; img->imgdata_ = (uint32_t*)stbi_load( filename, (int*)&img->width_, (int*)&img->height_, &comp, 4 ); if (!img->imgdata_) { printf("Error loading Image %s\n", filename ); delete img; img = nullptr; } else { printf("Loaded Image %s (%dx%d)\n", filename, img->width_, img->height_ ); } return img; } void Image::drawImage( int32_t x, int32_t y, tapnik::Image *img ) { for (int32_t j = 0; j < img->height_; j++) { for (int32_t i = 0; i < img->width_; i++) { // TODO: alpha blend. drawPixel( x+i, y+j, img->getPixel(i, j)); } } } void Image::save() { saveAs( filename_ ); } void Image::saveAs( const char *filename ) { if (stbi_write_png(filename , width_, height_, 4, imgdata_, width_*4 )) { // printf("Wrote output image: %s\n", filename_ ); } else { printf("Error writing output image: %s\n", filename_); } } // ================================================== # pragma mark - Mesh // ================================================== void meshProcessTriangle( TK_TriangleVert a, TK_TriangleVert b, TK_TriangleVert c, void *userData ) { Mesh *mesh = (Mesh*)userData; Triangle *t = mesh->meshTris_ + mesh->numMeshTris_++; t->A_ = a; t->B_ = b; t->C_ = c; t->dbgIndex_ = (int)(mesh->numMeshTris_ - 1); } Mesh *Mesh::load(const char *filename) { Mesh *result = new Mesh(); // Callbacks for API TK_ObjDelegate objDelegate = {}; objDelegate.userData = (void*)result; objDelegate.error = loadObjErrorMessage; size_t objFileSize = 0; void *objFileData = readEntireFile( filename, &objFileSize ); if (!objFileData) { printf("Could not open .OBJ file '%s'\n", filename ); } // Prepass to determine memory reqs TK_ParseObj( objFileData, objFileSize, &objDelegate ); printf("Scratch Mem: %zu\n", objDelegate.scratchMemSize ); objDelegate.scratchMem = malloc( objDelegate.scratchMemSize ); result->numMeshTris_ = 0; result->meshTris_ = new Triangle[ objDelegate.numTriangles ]; // Parse again with memory objDelegate.triangle = meshProcessTriangle; TK_ParseObj( objFileData, objFileSize, &objDelegate ); printf("Num Triangles %zu\n",result->numMeshTris_); return result; } void dbgPrintTri( Triangle *tri ) { printf("Index: %d packFlip %d packRot %d\n", tri->dbgIndex_, tri->packFlip_?1:0, tri->packRot_ ); } void Mesh::save( const char *filename, int32_t outMapSize ) { printf("Writing output mesh '%s'\n", filename ); FILE *fp = fopen(filename, "wt"); fprintf( fp, "# Saved from tk_textile\n"); fprintf( fp, "usemtl testoutmap\n"); // verts for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { fprintf( fp, "v %f %f %f\n", tri->A_.pos[0], tri->A_.pos[1],tri->A_.pos[2]); fprintf( fp, "v %f %f %f\n", tri->B_.pos[0], tri->B_.pos[1],tri->B_.pos[2]); fprintf( fp, "v %f %f %f\n\n", tri->C_.pos[0], tri->C_.pos[1],tri->C_.pos[2]); } // normals for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { fprintf( fp, "vn %f %f %f\n", tri->A_.nrm[0], tri->A_.nrm[1],tri->A_.nrm[2]); fprintf( fp, "vn %f %f %f\n", tri->B_.nrm[0], tri->B_.nrm[1],tri->B_.nrm[2]); fprintf( fp, "vn %f %f %f\n\n", tri->C_.nrm[0], tri->C_.nrm[1],tri->C_.nrm[2]); } // tex coords from tiles for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { Tile *tile = tri->tile_; int pr = tri->packFlip_?tri->packRot_:(3-tri->packRot_); GLKVector3 tileST[3]; if (!tri->packFlip_) { tileST[(pr+0)%3] = GLKVector3Make( tile->tileA_[0], tile->tileA_[1], 0.0); tileST[(pr+1)%3] = GLKVector3Make( tile->tileB_[0], tile->tileB_[1], 0.0); tileST[(pr+2)%3] = GLKVector3Make( tile->tileC_[0], tile->tileC_[1], 0.0); // printf ("packRot %d pr %d triA %d triB %d triC %d\n", // tri->packRot_, pr, // (pr+0)%3, (pr+1)%3, (pr+2)%3 ); } else { tileST[(pr+0)%3] = GLKVector3Make( tile->tileA_[0], tile->tileA_[1], 0.0); tileST[(pr+1)%3] = GLKVector3Make( tile->tileC_[0], tile->tileC_[1], 0.0); tileST[(pr+2)%3] = GLKVector3Make( tile->tileB_[0], tile->tileB_[1], 0.0); } float stA[2], stB[2], stC[2]; stA[0] = (float)(tile->packX_ + tileST[0].x ) / (float)outMapSize; stA[1] = 1.0 - (float)(tile->packY_ + tileST[0].y ) / (float)outMapSize; fprintf( fp, "vt %f %f\n", stA[0], stA[1] ); stB[0] = (float)(tile->packX_ + tileST[1].x ) / (float)outMapSize; stB[1] = 1.0 - (float)(tile->packY_ + tileST[1].y ) / (float)outMapSize; fprintf( fp, "vt %f %f\n", stB[0], stB[1] ); stC[0] = (float)(tile->packX_ + + tileST[2].x ) / (float)outMapSize; stC[1] = 1.0 - (float)(tile->packY_ + tileST[2].y ) / (float)outMapSize; fprintf( fp, "vt %f %f\n\n", stC[0], stC[1] ); } // And finally triangles size_t ndx = 1; for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { fprintf( fp, "f %zu/%zu/%zu %zu/%zu/%zu %zu/%zu/%zu\n", ndx, ndx, ndx, ndx+1, ndx+1, ndx+1, ndx+2, ndx+2, ndx+2 ); ndx += 3; } fclose( fp ); } Mesh::~Mesh() { if (filename_) { free(filename_); } } static inline bool vertMatch(TK_TriangleVert a, TK_TriangleVert b, float threshold = 0.001 ) { return ( (fabs(a.pos[0] - b.pos[0]) < threshold) && (fabs(a.pos[1] - b.pos[1]) < threshold) && (fabs(a.pos[2] - b.pos[2]) < threshold) ); } static inline bool edgeMatch( TK_TriangleVert a1, TK_TriangleVert b1, TK_TriangleVert a2, TK_TriangleVert b2 ) { return ( (vertMatch(a1, a2) && vertMatch(b1, b2)) || (vertMatch(a1, b2) && vertMatch(b1, a2)) ); } static inline void checkEdge(TK_TriangleVert a1, TK_TriangleVert b1, TK_TriangleVert a2, TK_TriangleVert b2, Triangle *triA, Triangle *triB, Triangle **targA, Triangle **targB ) { if ((!*targA)&&(edgeMatch(a1, b1, a2, b2))) { *targA = triB; *targB = triA; } } void Mesh::buildAdjacency() { printf("build adjacency...\n"); for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { for (Triangle *other = meshTris_; (other - meshTris_) < numMeshTris_; other++) { if (tri==other) continue; // If we found all of our neighbors, we're done if ((tri->nbAB_) && (tri->nbBC_) && (tri->nbCA_)) break; // Look for neighbor across AB checkEdge( tri->A_, tri->B_, other->A_, other->B_, tri, other, &(tri->nbAB_), &(other->nbAB_)); checkEdge( tri->A_, tri->B_, other->B_, other->C_, tri, other, &(tri->nbAB_), &(other->nbBC_)); checkEdge( tri->A_, tri->B_, other->C_, other->A_, tri, other, &(tri->nbAB_), &(other->nbCA_)); // Look for neighbor across BC checkEdge( tri->B_, tri->C_, other->A_, other->B_, tri, other, &(tri->nbBC_), &(other->nbAB_)); checkEdge( tri->B_, tri->C_, other->B_, other->C_, tri, other, &(tri->nbBC_), &(other->nbBC_)); checkEdge( tri->B_, tri->C_, other->C_, other->A_, tri, other, &(tri->nbBC_), &(other->nbCA_)); // Look for neighbor across CA checkEdge( tri->C_, tri->A_, other->A_, other->B_, tri, other, &(tri->nbCA_), &(other->nbAB_)); checkEdge( tri->C_, tri->A_, other->B_, other->C_, tri, other, &(tri->nbCA_), &(other->nbBC_)); checkEdge( tri->C_, tri->A_, other->C_, other->A_, tri, other, &(tri->nbCA_), &(other->nbCA_)); } } printf("build adjacency done...\n"); } // should be factorial of TK_MAX_EDGE_COLORS + 1 (the extra is just padding for a copy) #define TK_NUM_EDGE_PERMS (121) static int edgePerms[TK_NUM_EDGE_PERMS][TK_MAX_EDGE_COLORS]; static int nEdgePerms = 0; static void assignBackEdge( Triangle *tri, Triangle *nbr, EdgeInfo *edge, bool flipped ) { if (nbr->nbAB_ == tri) { nbr->ab_ = edge; nbr->flipped_[0] = flipped; } else if (nbr->nbBC_ == tri) { nbr->bc_ = edge; nbr->flipped_[1] = flipped; } else if (nbr->nbCA_ == tri) { nbr->ca_ = edge; nbr->flipped_[2] = flipped; } else { printf("WARN: couldn't find back edge for nbr.\n"); } } static inline bool checkNeighbor( Triangle *tri, int numEdgeColors ) { int count[TK_MAX_EDGE_COLORS] = {0}; if (tri->ab_) count[tri->ab_->edgeCode_]++; if (tri->bc_) count[tri->bc_->edgeCode_]++; if (tri->ca_) count[tri->ca_->edgeCode_]++; for (int i=0; i < numEdgeColors; i++) { if (count[i] > 1) { // printf("Edge %d used %d times...\n", i, count[i]); return false; } } return true; } void Mesh::doAssign( Triangle *tri, EdgeInfo *edges[TK_MAX_EDGE_COLORS], int numEdgeColors ) { // Pick a random order to assign in int p = (int)randUniform(0, TK_NUM_EDGE_PERMS-1); for (int xx = 0; xx < numEdgeColors; xx++) { for (int yy = 0; yy < numEdgeColors; yy++) { if (yy==xx) continue; for (int zz = 0; zz < numEdgeColors; zz++) { if ((zz==xx) || (zz==yy)) continue; // get permuted edge colors int x = edgePerms[p][xx]; int y = edgePerms[p][yy]; int z = edgePerms[p][zz]; // now we are trying to assign edges X, Y, Z to tri. // first, make sure any pre-assigned edges don't conflict. if ((tri->ab_) && (tri->ab_->edgeCode_ != x)) continue; if ((tri->bc_) && (tri->bc_->edgeCode_ != y)) continue; if ((tri->ca_) && (tri->ca_->edgeCode_ != z)) continue; bool assignedAB = false; bool assignedBC = false; bool assignedCA = false; // FIXME: handle triangles with open edges (null neighbors) // No previous assignment conflicts, go ahead and assign our edges bool badAssign = false; if (!tri->ab_) { assignedAB = true; tri->ab_ = edges[x]; assignBackEdge( tri, tri->nbAB_, tri->ab_, !tri->flipped_[0] ); if (!checkNeighbor(tri->nbAB_, numEdgeColors)) badAssign = true; } if ((!tri->bc_) && (!badAssign)) { assignedBC = true; tri->bc_ = edges[y]; assignBackEdge( tri, tri->nbBC_, tri->bc_, !tri->flipped_[1] ); if (!checkNeighbor(tri->nbBC_, numEdgeColors)) badAssign = true; } if ((!tri->ca_) && (!badAssign)) { assignedCA = true; tri->ca_ = edges[z]; assignBackEdge( tri, tri->nbCA_, tri->ca_, !tri->flipped_[2] ); if (!checkNeighbor(tri->nbCA_, numEdgeColors)) badAssign = true; } if (!badAssign) { // ok, we've assigned all our edges, call our neighbors to assign them tri->visited_ = true; solvedTris_++; static int logcount=0; if (logcount++>=1000) { printf("solved: %zu/%zu\n", solvedTris_, numMeshTris_); logcount = 0; } // If we've solved all but the last tri, we've really solved the whole thing because we // know it's a closed mesh and that last triangle will be colored by it's neighbors // FIXME: generalize this by checking solved by counting unique edges not triangles. if (solvedTris_==numMeshTris_-1) { solvedTris_ = numMeshTris_; } // Did we find a solution? if (solvedTris_ == numMeshTris_) return; if (!tri->nbAB_->visited_) doAssign( tri->nbAB_, edges, numEdgeColors ); if (solvedTris_ == numMeshTris_) return; if (!tri->nbBC_->visited_) doAssign( tri->nbBC_, edges, numEdgeColors ); if (solvedTris_ == numMeshTris_) return; if (!tri->nbCA_->visited_) doAssign( tri->nbCA_, edges, numEdgeColors ); if (solvedTris_ == numMeshTris_) return; // Couldn't find a solution, back out and try some more solvedTris_--; tri->visited_ = false; } // back out any assigments that we did if (assignedAB) { tri->ab_ = nullptr; assignBackEdge( tri, tri->nbAB_, nullptr, false ); } if (assignedBC) { tri->bc_ = nullptr; assignBackEdge( tri, tri->nbBC_, nullptr, false ); } if (assignedCA) { tri->ca_ = nullptr; assignBackEdge( tri, tri->nbCA_, nullptr, false ); } } } } } void makePermTable( int ndx, bool *used, int numEdgeColors ) { if (ndx==numEdgeColors) { // found a permutation, yay // printf("PERM %d: ", nEdgePerms ); for (int i = 0; i < ndx; i++) { // printf("%d ", edgePerms[nEdgePerms][i] ); edgePerms[nEdgePerms+1][i] = edgePerms[nEdgePerms][i]; } // printf("\n"); nEdgePerms++; } else { for (int i = 0; i < numEdgeColors; i++) { if (!used[i]) { used[i] = true; edgePerms[nEdgePerms][ndx] = i; makePermTable( ndx+1, used, numEdgeColors ); used[i] = false; } } } } void Mesh::assignEdges( EdgeInfo *edges[TK_MAX_EDGE_COLORS], int numEdgeColors ) { printf("Assign edges\n"); // generate permutation table nEdgePerms = 0; bool used[TK_MAX_EDGE_COLORS] = {0}; makePermTable( 0, used, numEdgeColors ); for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { tri->visited_ = false; } solvedTris_ = 0; doAssign( meshTris_, edges, numEdgeColors ); if (solvedTris_ == numMeshTris_) { printf("Yay found a solution...\n"); } else { printf("No edge coloring found. :(\n"); } for (Triangle *tri = meshTris_; (tri - meshTris_) < numMeshTris_; tri++) { // for now, just pick at random if (!tri->ab_) { tri->ab_ = edges[ rand() % 3 ]; assignBackEdge( tri, tri->nbAB_, tri->ab_, !tri->flipped_[0] ); } if (!tri->bc_) { tri->bc_ = edges[ rand() % 3 ]; assignBackEdge( tri, tri->nbBC_, tri->bc_, !tri->flipped_[1] ); } if (!tri->ca_) { tri->ca_ = edges[ rand() % 3 ]; assignBackEdge( tri, tri->nbCA_, tri->ca_, !tri->flipped_[2] ); } } printf("Assign edges done...\n"); } // ================================================== # pragma mark - Tile // ================================================== Tile::Tile() { img_ = nullptr; } void Tile::makeImage( int32_t edgeSize, int32_t margin ) { img_ = new tapnik::Image( edgeSize + (margin*2), (uint32_t)((float)edgeSize * TK_SQRT3_OVER_2) + (margin*2) ); tileA_[0] = margin + (img_->width_ / 2); tileA_[1] = margin; tileB_[0] = (img_->width_) - margin; tileB_[1] = (img_->height_-1) - margin; tileC_[0] = margin; tileC_[1] = (img_->height_-1) - margin; xform_ = GLKMatrix4Identity; } void Tile::debugDrawAnnotations() { img_->drawFatLine(tileA_[0], tileA_[1], tileB_[0], tileB_[1], edge_[0]->debugColor_ ); img_->drawFatLine(tileB_[0], tileB_[1], tileC_[0], tileC_[1], edge_[1]->debugColor_ ); img_->drawFatLine(tileC_[0], tileC_[1], tileA_[0], tileA_[1], edge_[2]->debugColor_ ); g_vectorFont->pen( 0xffffffff ); g_vectorFont->move( tileA_[0]-4, tileA_[1]+8 ); g_vectorFont->vprintf( img_, "A" ); g_vectorFont->move( tileB_[0]-21, tileB_[1] - 20 ); g_vectorFont->vprintf( img_, "B"); g_vectorFont->move( tileC_[0]+12, tileC_[1] - 20 ); g_vectorFont->vprintf( img_, "C %s", dbgIndexStr ); // g_vectorFont->move( (img_->width_/2) - 20, img_->height_/2 ); // g_vectorFont->vprintf( img_, "%s%s%s", flipped_[0]?"Y":"N", flipped_[1]?"Y":"N", flipped_[2]?"Y":"N" ); // // g_vectorFont->move( (img_->width_/2) - 20, img_->height_/2 + 20); // g_vectorFont->vprintf( img_, "FARE" ); } void combineBlend( GLKVector3 ta, GLKVector3 tb, GLKVector3 tc, Image *img, Image *overImg, bool leftCorner ) { float blendSharpness = 0.9; // higher value = more sharper edge // blend for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { GLKVector3 p = GLKVector3Make( (float)i, (float)j, 0.0 ); GLKVector3 b = barycentric(ta, tb, tc, p ); float ov = 0.1; if ((b.x >=-ov) && (b.x <=1.0+ov) && (b.y >=-ov) && (b.y <=1.0+ov) && (b.z >=-ov) && (b.z <=1.0+ov) ) { b.x = saturate(b.x); b.y = saturate(b.y); b.z = saturate(b.z); float aa = smoothstep( 0.0, leftCorner?b.x:b.y, b.z ); float bb = smoothstep( 0.0, leftCorner?b.x:b.y, leftCorner?b.y:b.x ); float blendVal = pow(aa*bb, blendSharpness); GLKVector4 baseColorf = floatColor( img->getPixel(i,j) ); GLKVector4 tileColorf = floatColor( overImg->getPixel(i, j)); GLKVector4 blendColorf = lerpVec4( baseColorf, tileColorf, blendVal ); blendColorf.a = 1.0; // fixme uint32_t blendColor = pixelColor(blendColorf ); img->drawPixel(i, j, blendColor ); } } } } // ====================================================== # pragma mark - Graphcut // ====================================================== enum { CutFlag_MASKED = 0x01, CutFlag_TARGET = 0x02, CutFlag_VISITED = 0x04, CutFlag_MARKED = 0x08, CutFlag_FILLED = 0x10, CutFlag_EDGE = 0x20, }; struct ImgPos { int x; int y; }; ImgPos ImgPosMake( int px, int py ) { ImgPos result; result.x = px; result.y = py; return result; } #define MAX_GC_QUEUE 10000 struct GraphCutInfo { Image *cutDbgImage_; Image *img_; Image *overImg_; ImgPos startPos_; float endError_; ImgPos endPos_; uint8_t *mask_; float *errorVal_; ImgPos *queue_; uint32_t queueSize_; uint32_t queueHead_; uint32_t queueTail_; float maxError_; }; static inline void enqueuePixel( GraphCutInfo *info, ImgPos pos ) { assert (info->queueSize_ < MAX_GC_QUEUE); info->queueSize_++; info->mask_[ (info->img_->width_ * pos.y) + pos.x] |= CutFlag_VISITED; info->queue_[info->queueHead_++] = pos; if (info->queueHead_==MAX_GC_QUEUE) info->queueHead_ = 0; } static inline ImgPos popPixelFront( GraphCutInfo *info ) { assert( info->queueSize_ > 0 ); info->queueSize_--; ImgPos p = info->queue_[info->queueHead_]; if (info->queueHead_==0) { info->queueHead_ = MAX_GC_QUEUE-1; } else { info->queueHead_--; } return p; } static inline ImgPos popPixel( GraphCutInfo *info ) { assert( info->queueSize_ > 0 ); info->queueSize_--; ImgPos p = info->queue_[info->queueTail_++]; if (info->queueTail_==MAX_GC_QUEUE) info->queueTail_ = 0; return p; } void targetInit( void *info, int x, int y) { GraphCutInfo *gcinfo = (GraphCutInfo*)info; size_t ndx = (y*gcinfo->img_->width_) + x; gcinfo->mask_[ndx] |= CutFlag_TARGET; gcinfo->cutDbgImage_->drawPixel(x,y, 0xffff00ff ); } void targetEval( void *info, int x, int y) { GraphCutInfo *gcinfo = (GraphCutInfo*)info; size_t ndx = (y*gcinfo->img_->width_) + x; if (gcinfo->errorVal_[ndx] < gcinfo->endError_) { gcinfo->endPos_ = ImgPosMake(x, y); gcinfo->endError_ = gcinfo->errorVal_[ndx]; } } void fillInit( void *info, int x, int y) { GraphCutInfo *gcinfo = (GraphCutInfo*)info; size_t ndx = (y*gcinfo->img_->width_) + x; // don't fill from start pixels that are on the edge if (!(gcinfo->mask_[ndx] & CutFlag_EDGE)) { gcinfo->mask_[ndx] |= (CutFlag_EDGE|CutFlag_FILLED); enqueuePixel( gcinfo, ImgPosMake(x, y) ); } } void cutPath( GraphCutInfo *gcinfo, ImgPos start, GLKVector3 targA, GLKVector3 targB ) { int width = gcinfo->img_->width_; gcinfo->startPos_.x = start.x; gcinfo->startPos_.y = start.y; foreach_line(targA.x, targA.y, targB.x, targB.y, gcinfo, targetInit ); enqueuePixel( gcinfo, ImgPosMake( start.x, start.y )); // fill out error values const float cfDist = 0.01; while ((gcinfo->queueSize_ > 0) && (gcinfo->queueSize_ < 9999)) { ImgPos curr = popPixel( gcinfo ); //printf("queue size: %u curr %d %d\n", gcinfo.queueSize_, curr.x, curr.y ); size_t ndx = (curr.y * gcinfo->img_->width_) + curr.x; gcinfo->mask_[ndx] |= CutFlag_MARKED; float bestNearbyErr = FLT_MAX; for (int j=-1; j <= 1; j++ ) { for (int i=-1; i <= 1; i++) { if ((i==0) && (j==0)) continue; size_t ndx = ((curr.y+j) * width) + (curr.x+i); // printf("%d %d : %s\n", curr.y+j, curr.x + i, (mask[ndx] & CutFlag_MARKED)?"MARKED":"no." ); if ((gcinfo->mask_[ndx] & CutFlag_MARKED) && (gcinfo->errorVal_[ndx]<bestNearbyErr)) { // printf("err: %f\n", errorVal[ndx] ); bestNearbyErr = gcinfo->errorVal_[ndx]; } } } // for the first pixel, no accumulated error if (bestNearbyErr == FLT_MAX) { bestNearbyErr = 0.0; } // printf("Best nearby: %f\n", bestNearbyErr ); // call error/dist for this pixel float d = sqrt( (float)((curr.x - start.x)*(curr.x - start.x) + (curr.y-start.y)*(curr.y - start.y)) ); d /= (float)width; // not really normalized, we just need small values float err = pixelError( gcinfo->img_->getPixel(curr.x, curr.y), gcinfo->overImg_->getPixel( curr.x, curr.y)) + cfDist*d; // float err = pixelError( gcinfo->img_->getPixel(curr.x, curr.y), gcinfo->overImg_->getPixel( curr.x, curr.y)); err += bestNearbyErr; if (err > gcinfo->maxError_) { gcinfo->maxError_ = err; } size_t endx = (curr.y * width) + curr.x; gcinfo->errorVal_[endx] = err; // floodfill neighbors for (int j=-1; j <= 1; j++ ) { for (int i=-1; i <= 1; i++) { if ((i==0) && (j==0)) continue; ImgPos p = ImgPosMake( curr.x + i, curr.y + j ); // shouldn't need this check because should be bounded by mask, but just in case... if ((p.x < 0) || (p.y < 0) || (p.x >= width) || (p.y >= gcinfo->img_->height_)) continue; size_t ndx = (p.y * width) + p.x; if (!(gcinfo->mask_[ndx] & (CutFlag_VISITED|CutFlag_MASKED)) ) { enqueuePixel( gcinfo, p ); } } } } for (int j=0; j < gcinfo->img_->height_; j++) { for (int i=0; i < width; i++) { size_t ndx = (j*width) + i; if (!(gcinfo->mask_[ndx] & CutFlag_MASKED)) { float ev =gcinfo->errorVal_[ndx]/gcinfo->maxError_; GLKVector4 c = GLKVector4Make( ev, ev, ev, 1.0 ); gcinfo->cutDbgImage_->drawPixel( i, j, pixelColor( c )); } } } // Find the best point on the end edge gcinfo->endError_ = FLT_MAX; foreach_line(targA.x, targA.y, targB.x, targB.y, gcinfo, targetEval ); // printf("End Pos %d %d\n", gcinfo->endPos_.x, gcinfo->endPos_.y ); // backtrack line ImgPos curr = gcinfo->endPos_; float currErr = gcinfo->endError_; int count = 1000; while ((curr.x != start.x) || (curr.y != start.y)) { gcinfo->cutDbgImage_->drawPixel(curr.x, curr.y, 0xffffffff ); // "fill" the cut line to act as a boundry for the final mask gcinfo->mask_[curr.y*width+curr.x] |= CutFlag_EDGE; // printf("count %d backtrack %d %d endErr %f \n", count, curr.x, curr.y, gcinfo->endError_ ); ImgPos next = curr; float nextErr = currErr; for (int j=-1; j <= 1; j++ ) { for (int i=-1; i <= 1; i++) { if ((i==0) && (j==0)) continue; size_t ndx = ((curr.y+j) * width) + (curr.x+i); if ((gcinfo->mask_[ndx] & CutFlag_MARKED) && (gcinfo->errorVal_[ndx] < nextErr)) { next = ImgPosMake( curr.x+i, curr.y+j ); nextErr = gcinfo->errorVal_[ndx]; } } } curr = next; currErr = nextErr; if (!count--) { printf("ERROR: too many steps...\n"); break; } } } void combineGraphCut( GLKVector3 ta, GLKVector3 tb, GLKVector3 tc, Image *img, Image *overImg, bool leftCorner, uint32_t marginSize ) { // // DBG // leftCorner = !leftCorner; // initialize error and build mask float *errorVal = (float*)malloc( img->height_*img->width_*sizeof(float)); uint8_t *mask = (uint8_t*)malloc(img->height_*img->width_*sizeof(uint8_t )); for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { size_t ndx = (j*img->width_) + i; errorVal[ndx] = 0; mask[ndx] = 0; GLKVector3 p = GLKVector3Make( (float)i, (float)j, 0.0 ); GLKVector3 b = barycentric(ta, tb, tc, p ); // use a much smaller overlap in this case, we want tight bounds on the mask float ov = 0.001; if ((b.x >=-ov) && (b.x <=1.0+ov) && (b.y >=-ov) && (b.y <=1.0+ov) && (b.z >=-ov) && (b.z <=1.0+ov) ) { errorVal[ndx] = 0.0; } else { mask[ndx] |= CutFlag_MASKED; errorVal[ndx] = FLT_MAX; } } } // make the debug image Image *cutDbgImage = new Image( img->width_, img->height_ ); for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { size_t ndx = (j*img->width_) + i; if (mask[ndx] & CutFlag_MASKED) { cutDbgImage->drawPixel(i, j, 0xff0000ff ); } else { cutDbgImage->drawPixel(i, j, 0xff000000 ); } } } // Set up the target edge GraphCutInfo gcinfo; gcinfo.mask_ = mask; gcinfo.errorVal_ = errorVal; gcinfo.cutDbgImage_ = cutDbgImage; gcinfo.img_ = img; gcinfo.overImg_ = overImg; gcinfo.queue_ = (ImgPos *)malloc(sizeof(ImgPos) * MAX_GC_QUEUE ); gcinfo.queueSize_ = 0; gcinfo.queueHead_ = 0; gcinfo.queueTail_ = 0; // Cut the paths ImgPos startPos; ImgPos startPos2; GLKVector3 targA1, targB1; GLKVector3 targA2, targB2; if (!leftCorner) { startPos.x = (int)tc.x; startPos.y = (int)tc.y; startPos2.x = (int)ta.x; startPos2.y = (int)ta.y; targA1 = ta; targB1 = tb; targA2 = tc; targB2 = tb; } else { startPos.x = (int)tc.x; startPos.y = (int)tc.y; startPos2.x = (int)tb.x; startPos2.y = (int)tb.y; targA1 = ta; targB1 = tb; targA2 = ta; targB2 = tc; } // Cut the first path cutPath( &gcinfo, startPos, targA1, targB1 ); cutDbgImage->drawPixel( startPos.x, startPos.y, 0xff00ff00 ); cutDbgImage->drawPixel( gcinfo.endPos_.x, gcinfo.endPos_.y, 0xff00ff00 ); // cutDbgImage->saveAs("cut_debug.png"); // reset the gcinfo gcinfo.maxError_ = 0.0; gcinfo.queueSize_ = 0; gcinfo.queueHead_ = 0; gcinfo.queueTail_ = 0; for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { size_t ndx = j*img->width_+i; // clear flags mask[ndx] &= ~(CutFlag_TARGET|CutFlag_VISITED|CutFlag_MARKED); errorVal[ndx] = FLT_MAX;; } } cutPath( &gcinfo, startPos2, targA2, targB2 ); cutDbgImage->drawPixel( startPos2.x, startPos2.y, 0xff00ff00 ); cutDbgImage->drawPixel( gcinfo.endPos_.x, gcinfo.endPos_.y, 0xff00ff00 ); //cutDbgImage->saveAs("cut_debug_zz.png"); // Seed our line fill gcinfo.queueSize_ = 0; gcinfo.queueHead_ = 0; gcinfo.queueTail_ = 0; foreach_line( startPos.x, startPos.y, startPos2.x, startPos2.y, &gcinfo, fillInit ); // exclude the start and end points so they don't leak popPixel( &gcinfo ); // exclude end point popPixelFront( &gcinfo ); // exclude start point // floodfill neighbors // int count = 1500; while (gcinfo.queueSize_ > 0) { if (gcinfo.queueSize_ >= 9999) { printf("QUEUE FULL!\n" ); break; } // fill current ImgPos curr = popPixel( &gcinfo ); // size_t ndx = (curr.y*img->width_) + curr.x; // gcinfo.mask_[ndx] |= CutFlag_FILLED; // enqueue reachable neigbors for (int j=-1; j <= 1; j++ ) { for (int i=-1; i <= 1; i++) { // fill non-diagonal neighbors, exactly one of i,j must be 0 if ((i==0) && (j==0)) continue; if ((i!=0) && (j!=0)) continue; ImgPos p = ImgPosMake( curr.x + i, curr.y + j ); // shouldn't need this check because should be bounded by mask, but just in case... if ((p.x < 0) || (p.y < 0) || (p.x >= img->width_) || (p.y >= img->height_)) continue; size_t ndx = (p.y * img->width_) + p.x; if (!(mask[ndx] & (CutFlag_FILLED|CutFlag_MASKED|CutFlag_EDGE)) ) { mask[ndx] |= CutFlag_FILLED; enqueuePixel( &gcinfo, p ); } } } // if (count--==0){ // break; // } } // draw filled pixels on debug mask for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { size_t ndx = (j * img->width_) + i; if ((mask[ndx] & CutFlag_EDGE) && (mask[ndx] & CutFlag_FILLED)) { cutDbgImage->drawPixel(i, j, 0xffffffff ); } else if (mask[ndx] & CutFlag_EDGE) { cutDbgImage->drawPixel(i, j, 0xffff7eff ); } else if (mask[ndx] & CutFlag_FILLED) { cutDbgImage->drawPixel(i, j, 0xffff7e0a ); } } } // cutDbgImage->saveAs("cut_debug2.png"); // Dilate the filled image into the mask for "margin" pixels // to help overlaps for (int k=0; k < marginSize; k++) { for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { size_t ndx = (j * img->width_) + i; if (mask[ndx] & (CutFlag_MASKED)) { for (int jj=-1; jj <= 1; jj++ ) { for (int ii=-1; ii <= 1; ii++) { // fill non-diagonal neighbors, exactly one of i,j must be 0 if ((i==0) && (j==0)) continue; if ((i!=0) && (j!=0)) continue; ImgPos p = ImgPosMake( i + ii, j + jj ); if ((p.x < 0) || (p.y < 0) || (p.x >= img->width_) || (p.y >= img->height_)) continue; size_t ndx2 = p.y*img->width_+p.x; if (mask[ndx2]&(CutFlag_FILLED|CutFlag_EDGE)) { mask[ndx] |= CutFlag_FILLED; goto pixel_done; } } } } pixel_done:; } } } // Finally, go through and blit over image where it overlaps for (int j=0; j < img->height_; j++) { for (int i=0; i < img->width_; i++) { size_t ndx = (j * img->width_) + i; if (mask[ndx] & (CutFlag_EDGE|CutFlag_FILLED)) { img->drawPixel( i,j, overImg->getPixel(i,j)); } } } free(mask); free(errorVal); free(gcinfo.queue_); } void combineTiles( GLKVector3 ta, GLKVector3 tb, GLKVector3 tc, Image *img, Image *overImg, bool leftCorner, BlendMode blendMode, uint32_t marginSize ) { if (blendMode == BlendMode_BLEND) { combineBlend(ta, tb, tc, img, overImg, leftCorner ); } else { combineGraphCut(ta, tb, tc, img, overImg, leftCorner, marginSize ); } } void Tile::paintFromSource(Image *srcImage, BlendMode blendMode, uint32_t marginSize ) { // Paint first edge onto the tile // int ndx = 0; // dbg crap // int targ = 3; // if (edge_[1]->edgeCode_ == targ) ndx = 1; // else if (edge_[2]->edgeCode_ == targ) ndx = 2; paintFromSourceEdge( img_, srcImage, 0 ); // img_->saveAs( "step1.png" ); // Paint the next edge onto a temp image Image *tmpImg = new Image( img_->width_, img_->height_ ); paintFromSourceEdge( tmpImg, srcImage, 1 ); GLKVector3 ta = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); GLKVector3 tb = GLKVector3Make( tileB_[0], tileB_[1], 0.0 ); GLKVector3 tc = GLKVector3Make( tileC_[0], tileC_[1], 0.0 ); combineTiles(ta, tb, tc, img_, tmpImg, true, blendMode, marginSize ); // img_->saveAs( "step2.png" ); // Paint the last edge onto a temp image paintFromSourceEdge( tmpImg, srcImage, 2 ); combineTiles(ta, tb, tc, img_, tmpImg, false, blendMode, marginSize ); //img_->saveAs( "step3.png" ); delete tmpImg; // exit(1); } void Tile::paintFromSourceEdge(Image *destImage, Image *srcImage, int edgeIndex ) { // Get requested edge EdgeInfo *edge; GLKVector3 a, b; if (edgeIndex==0) { //edge 0 is AB edge = edge_[0]; if (!flipped_[0]) { a = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); b = GLKVector3Make( tileB_[0], tileB_[1], 0.0 ); } else { b = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); a = GLKVector3Make( tileB_[0], tileB_[1], 0.0 ); } } else if (edgeIndex==1) { //edge 1 is BC edge = edge_[1]; if (!flipped_[1]) { a = GLKVector3Make( tileB_[0], tileB_[1], 0.0 ); b = GLKVector3Make( tileC_[0], tileC_[1], 0.0 ); } else { b = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); a = GLKVector3Make( tileB_[0], tileB_[1], 0.0 ); } } else { // edgeIndex==2 //edge 2 is CA edge = edge_[2]; if (!flipped_[2]) { a = GLKVector3Make( tileC_[0], tileC_[1], 0.0 ); b = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); } else { b = GLKVector3Make( tileC_[0], tileC_[1], 0.0 ); a = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); } } GLKVector3 destA = edge->srcPointB_; GLKVector3 destB = edge->srcPointA_; GLKVector3 srcEdgeDir = GLKVector3Subtract( b, a ); GLKVector3 destEdgeDir = GLKVector3Subtract( destB, destA ); float angSrc =atan2f( srcEdgeDir.y, srcEdgeDir.x ); float angDest = atan2f( destEdgeDir.y, destEdgeDir.x ); GLKVector3 translate = GLKVector3Subtract( destA, a ); float lengthAB = GLKVector3Length( GLKVector3Subtract( a, b ) ); float lengthDestAB = GLKVector3Length( GLKVector3Subtract( destA, destB ) ); float scale = lengthAB / lengthDestAB; float angle = angDest - angSrc; // scale should be ~= 1.0 since we generated the target line the same size // printf("lengthA %f lengthDest %f Scale is %f\n", lengthAB, lengthDestAB, scale ); GLKMatrix4 m3 = GLKMatrix4MakeTranslation( a.x, a.y, a.z ); GLKMatrix4 m2 = GLKMatrix4MakeRotation( angle, 0.0, 0.0, 1.0 ); GLKMatrix4 m1 = GLKMatrix4MakeTranslation( -a.x, -a.y, -a.z ); GLKMatrix4 xform1 = GLKMatrix4Multiply(m3, GLKMatrix4Multiply(m2, m1)); GLKMatrix4 xform2 = GLKMatrix4MakeTranslation( translate.x, translate.y, translate.z ); // xform_ = xform2; xform_ = GLKMatrix4Multiply( xform2, xform1 ); // DBG: draw transformed triangle into source image GLKVector3 ta = GLKVector3Make( tileA_[0], tileA_[1], 0.0 ); GLKVector3 tb = GLKVector3Make( tileB_[0], tileB_[1], 0.0 ); GLKVector3 tc = GLKVector3Make( tileC_[0], tileC_[1], 0.0 ); // GLKVector3 aa = GLKMatrix4MultiplyVector3WithTranslation( xform_, GLKVector3Make( tileA_[0], tileA_[1], 0.0 )); // GLKVector3 bb = GLKMatrix4MultiplyVector3WithTranslation( xform_, GLKVector3Make( tileB_[0], tileB_[1], 0.0 )); // GLKVector3 cc = GLKMatrix4MultiplyVector3WithTranslation( xform_, GLKVector3Make( tileC_[0], tileC_[1], 0.0 )); // srcImage->drawLine( aa.x, aa.y, bb.x, bb.y ); // srcImage->drawLine( bb.x, bb.y, cc.x, cc.y ); // srcImage->drawLine( cc.x, cc.y, aa.x, aa.y ); // Copy the pixels from source into tile for (int j=0; j < img_->height_; j++) { for (int i=0; i < img_->width_; i++) { GLKVector3 p = GLKVector3Make( (float)i, (float)j, 0.0 ); GLKVector3 b = barycentric(ta, tb, tc, p ); float ov = 0.1; if ((b.x >=-ov) && (b.x <=1.0+ov) && (b.y >=-ov) && (b.y <=1.0+ov) && (b.z >=-ov) && (b.z <=1.0+ov) ) { GLKVector4 samplePos = GLKVector4Make( (float)i, (float)j, 0.0, 1.0 ); samplePos = GLKMatrix4MultiplyVector4( xform_, samplePos); // TODO: (maybe) fractional lookup and interpolate uint32_t sampleVal = srcImage->getPixel( (int32_t)samplePos.x, (int32_t)samplePos.y ); #if 1 destImage->drawPixel(i, j, sampleVal ); #else destImage->drawPixelTinted(i, j, sampleVal, edge->debugColor_, 0.5 ); #endif } } } } // ================================================== # pragma mark - TextureTiler // ================================================== TextureTiler::~TextureTiler() { delete sourceImage_; } void dbgDrawEdge( Image *sourceImg, EdgeInfo *edge ) { // Center Edge sourceImg->drawFatLine( edge->srcPointA_.x, edge->srcPointA_.y, edge->srcPointB_.x, edge->srcPointB_.y, edge->debugColor_ ); // Top Triangle sourceImg->drawLine( edge->srcPointA_.x, edge->srcPointA_.y, edge->srcPointOppUp_.x, edge->srcPointOppUp_.y, edge->debugColor_ ); sourceImg->drawLine( edge->srcPointB_.x, edge->srcPointB_.y, edge->srcPointOppUp_.x, edge->srcPointOppUp_.y, edge->debugColor_ ); // Bottom Triangle sourceImg->drawLine( edge->srcPointA_.x, edge->srcPointA_.y, edge->srcPointOppDown_.x, edge->srcPointOppDown_.y, edge->debugColor_ ); sourceImg->drawLine( edge->srcPointB_.x, edge->srcPointB_.y, edge->srcPointOppDown_.x, edge->srcPointOppDown_.y, edge->debugColor_ ); } void TextureTiler::placeEdge( EdgeInfo *edge ) { float edgeSz = (float)edgeSize_; float halfEdgeSz = edgeSz / 2.0; float randAngle = randUniform( 0.0, 360.0 ) * TK_DEG2RAD; // FIXME: if source image is smaller than edgeSz, scale it down or something... GLKVector3 center = GLKVector3Make( randUniform( edgeSz, sourceImage_->width_ - edgeSz) , randUniform( edgeSz, sourceImage_->height_ - edgeSz) , 0.0 ); GLKVector3 v = GLKVector3MultiplyScalar( GLKVector3Make( cosf(randAngle), sinf(randAngle), 0.0 ), halfEdgeSz ); edge->srcPointA_ = GLKVector3Add( center, v ); edge->srcPointB_ = GLKVector3Subtract( center, v ); GLKVector3 ab = GLKVector3Normalize( GLKVector3Subtract( edge->srcPointB_, edge->srcPointA_) ); GLKVector3 vcross = GLKVector3Normalize( GLKVector3CrossProduct( ab, GLKVector3Make(0.0, 0.0, 1.0) ) ); GLKVector3 vperp = GLKVector3MultiplyScalar(vcross, edgeSz * TK_SQRT3_OVER_2 ); edge->srcPointOppUp_ = GLKVector3Add( center, vperp ); edge->srcPointOppDown_ = GLKVector3Subtract( center, vperp ); printf("Edge %d -- A %3.2f %3.2f %3.2f B %3.2f %3.2f %3.2f\n", edge->edgeCode_, edge->srcPointA_.x, edge->srcPointA_.y, edge->srcPointA_.z, edge->srcPointB_.x, edge->srcPointB_.y, edge->srcPointB_.z ); } // Does stuff. void TextureTiler::doStuff( const char *outTexFilename ) { g_vectorFont = createVectorFont(); // g_vectorFont->pen( 0xffff00ff ); // g_vectorFont->move( 100, 100 ); // g_vectorFont->vprintf( sourceImage_, "Hello world" ); // Make edge colors EdgeInfo *edges[TK_MAX_EDGE_COLORS]; edges[0] = new EdgeInfo( 0, 0xffff0000 ); edges[1] = new EdgeInfo( 1, 0xff00ff00 ); edges[2] = new EdgeInfo( 2, 0xff0000ff ); edges[3] = new EdgeInfo( 3, 0xff008efc ); edges[4] = new EdgeInfo( 4, 0xff7f007f ); // build mesh mesh_->buildAdjacency(); mesh_->assignEdges( edges, numEdgeColors_ ); // // Save result // FILE *fp = fopen("assign.txt", "wt"); // for (int i=0; i < numTiles_; i++) { // // fprintf(fp, "%d: %d %d %d %s%s%s\n", // i, // } // make tiles gatherTiles(); // calc edgeSize int bestSize = -1; int bestCols = 0; float bestDiff = 0; for (int rowCount=1; rowCount <= numTiles_; rowCount++) { // See what the edge size would be for this rowCount // TODO: flip alternate triangles for tighter pack float szX = 0; float rowX = 0; float szY = 0; int r = 0; int numCols = 1; for (int i=0; i < numTiles_; i++) { rowX += 1; r++; if (r==rowCount) { r = 0; numCols++; rowX = 0; szY += TK_SQRT3_OVER_2; } if (rowX > szX) szX = rowX; } float diff = fabs(szX - szY); if ((bestSize<0)||(diff<bestDiff)) { printf("At rowcount %d sz is %f x %f\n", rowCount, szX, szY ); printf("rowCount %d Diff %f bestDiff %f\n", rowCount, diff, bestDiff ); bestDiff = diff; bestSize = rowCount; bestCols = numCols; } } int edgeSize1 = (int)((outputSize_ - 8.0) / (float)bestSize) - 4.0; // required size from width int edgeSize2 = (int)( floorf( (outputSize_-8.0) / (float)bestCols) * (1.0/TK_SQRT3_OVER_2)) - 8.0; // required size from height float res1 = edgeSize1 * bestSize; float res2 = (edgeSize2*TK_SQRT3_OVER_2) * bestCols; printf("res1: %f\n", res1); printf("res2: %f\n", res2); edgeSize_ = min_u32( edgeSize1, edgeSize2 ); printf("edgeSize1 %d edgeSize2 %d\n", edgeSize1, edgeSize2 ); printf("Best Row Size: %d bestColSize: %d, edgeSize %d\n", bestSize, bestCols, edgeSize_); // Generate images for (size_t tileNdx = 0; tileNdx < numTiles_; tileNdx++) { Tile *tile = tiles_[tileNdx]; tile->makeImage( edgeSize_, 4 ); char buff[100]; sprintf( buff, "dbgtiles/tile_%c%c%c%c%c%c.png", tile->flipped_[0]?'n':'f', tile->edge_[0]->edgeCode_ + 'A', tile->flipped_[1]?'n':'f', tile->edge_[1]->edgeCode_ + 'A', tile->flipped_[2]?'n':'f', tile->edge_[2]->edgeCode_ + 'A' ); tile->img_->filename_ = strdup(buff); } // DBG // assembleTiles(bestSize, 4 ); // exit(1); // FIXME: delete images #if 1 // initial placement of edges in source for (int i=0; i < numEdgeColors_; i++) { placeEdge( edges[i] ); dbgDrawEdge( sourceImage_, edges[i] ); // sourceImage_->drawFatLine( edges[i]->srcPointA_.x, edges[i]->srcPointA_.y, // edges[i]->srcPointB_.x, edges[i]->srcPointB_.y, // edges[i]->debugColor_ ); } #else // Place edge 0 randomly placeEdge( edges[0] ); edges[0]->placementFinalized_ = true; dbgDrawEdge( sourceImage_, edges[0] ); for (int i=1; i < numEdgeColors_; i++) { // for the next edge, check it against any tiles it shares an edge with // and find the error with some sample points for (size_t tileNdx = 0; tileNdx < numTiles_; tileNdx++) { } } // save the annotated source image sourceImage_->filename_ = strdup( "dbg_source.png" ); sourceImage_->save(); exit(1); #endif // paint tiles paintTiles(); assembleTiles( bestSize, 4 ); // TODO: make filename and stuff settable // NOTE: this assumes outTex is square mesh_->save("outmesh.obj", outTexture_->width_ ); finish(); } Tile *TextureTiler::findOrCreateTile( Triangle *tri ) { Tile *result = nullptr; for (int tileRot = 0; tileRot < 3; tileRot++ ) { // DBG // if (tileRot!=0) continue; for (size_t tileNdx = 0; tileNdx < numTiles_; tileNdx++) { Tile *tile = tiles_[tileNdx]; if ( (tri->ab_ == tile->edge_[(tileRot+0)%3]) && (tri->flipped_[0] == tile->flipped_[(tileRot+0)%3]) && (tri->bc_ == tile->edge_[(tileRot+1)%3]) && (tri->flipped_[1] == tile->flipped_[(tileRot+1)%3]) && (tri->ca_ == tile->edge_[(tileRot+2)%3]) && (tri->flipped_[2] == tile->flipped_[(tileRot+2)%3])) { result = tile; tri->packFlip_ = false; tri->packRot_ = tileRot; break; } // flip make "rorschach butterflies" which are distracting #if 0 // Confusing: because packFlip reverses triangle direction, we want to match the same flip flags // to get the opposite if ( (tri->ca_ == tile->edge_[(tileRot+0)%3]) && (tri->flipped_[2] == !tile->flipped_[(tileRot+0)%3]) && (tri->bc_ == tile->edge_[(tileRot+1)%3]) && (tri->flipped_[1] == !tile->flipped_[(tileRot+1)%3]) && (tri->ab_ == tile->edge_[(tileRot+2)%3]) && (tri->flipped_[0] == !tile->flipped_[(tileRot+2)%3])) { result = tile; tri->packFlip_ = true; tri->packRot_ = tileRot; break; } #endif } } // Didn't find one, create a new tile if (!result) { tri->packFlip_ =false; // Do we need space for more tiles? if (numTiles_ == tilesCapacity_) { size_t growSize = (tilesCapacity_ * 3) / 2; if (growSize < 10) growSize = 10; tilesCapacity_ += growSize; if (!tiles_) { tiles_ = (Tile**)malloc(tilesCapacity_ * sizeof(Tile*)); } else { tiles_ = (Tile**)realloc( tiles_, tilesCapacity_ * sizeof(Tile*)); } printf("Grow tiles, size %zu capacity %zu\n", numTiles_, tilesCapacity_ ); } result = new Tile(); result->edge_[0] = tri->ab_; result->edge_[1] = tri->bc_; result->edge_[2] = tri->ca_; sprintf( result->dbgIndexStr, "T%zu: %d", numTiles_, tri->dbgIndex_); result->dbgIndex_ = (int)numTiles_; for (int i=0; i < 3; i++) { result->flipped_[i] = tri->flipped_[i]; } tiles_[numTiles_++] = result; } return result; } void TextureTiler::gatherTiles() { for (Triangle *tri = mesh_->meshTris_; (tri - mesh_->meshTris_) < mesh_->numMeshTris_; tri++) { tri->tile_ = findOrCreateTile( tri ); } } void TextureTiler::assembleTiles( int rowCount, int margin ) { int marg = 4; uint32_t packX=marg; uint32_t packY=marg; uint32_t rowY = 0; int r = 0; for (size_t tileNdx = 0; tileNdx < numTiles_; tileNdx++) { Tile *tile = tiles_[tileNdx]; r++; if ( r > rowCount ) { // advance to next row packX = marg; packY += rowY; rowY = 0; r=1; } tile->packX_ = packX; tile->packY_ = packY; packX += tile->img_->width_; if (tile->img_->height_ > rowY) { rowY = tile->img_->height_; } } // now make the output image and do the pack // Make an output texture printf("Output size: %d %d\n", outputSize_, outputSize_); outTexture_ = new tapnik::Image( outputSize_, outputSize_ ); outTexture_->clear( 0xff7f7f7f ); outTexture_->filename_ = strdup(outTexFilename_); for (size_t tileNdx = 0; tileNdx < numTiles_; tileNdx++) { Tile *tile = tiles_[tileNdx]; outTexture_->drawImage( tile->packX_, tile->packY_, tile->img_ ); } } void TextureTiler::paintTiles() { for (size_t tileNdx = 0; tileNdx < numTiles_; tileNdx++) { Tile *tile = tiles_[tileNdx]; tile->paintFromSource( sourceImage_, blendMode_, marginSize_ ); tile->debugDrawAnnotations(); printf("Saving tile %lu/%zu\n", tileNdx+1, numTiles_ ); tile->img_->save(); } // save the annotated source image sourceImage_->filename_ = strdup( "dbg_source.png" ); sourceImage_->save(); } void TextureTiler::finish() { assert(outTexture_); outTexture_->save(); }
33.230224
132
0.523748
[ "mesh" ]
4a3628fc038e6c51ff4264db7d4a40eb53fe1a02
1,296
cc
C++
apps/run.cc
CS126SP20/final-project-ashleyeah
3df8b0515d0648f3b76bb0a4d196ccc511ebad94
[ "MIT" ]
null
null
null
apps/run.cc
CS126SP20/final-project-ashleyeah
3df8b0515d0648f3b76bb0a4d196ccc511ebad94
[ "MIT" ]
null
null
null
apps/run.cc
CS126SP20/final-project-ashleyeah
3df8b0515d0648f3b76bb0a4d196ccc511ebad94
[ "MIT" ]
null
null
null
// Copyright (c) 2020 Ashley Yeah. All rights reserved. #include <cinder/app/App.h> #include <cinder/app/RendererGl.h> #include <gflags/gflags.h> #include "pool_app.h" using cinder::app::App; using cinder::app::RendererGl; using std::string; namespace poolapp { const int kSamples = 8; const int kWidth = 1800; const int kHeight = 1100; // gflags so player's names can be changed DEFINE_string(player1, "Player 1", "the name of blue player"); DEFINE_string(player2, "Player 2", "the name of red player"); void ParseArgs(vector<string>* args) { gflags::SetUsageMessage( "Play a game of 8-ball Pool. Pass --helpshort for options."); int argc = static_cast<int>(args->size()); vector<char*> argvs; for (string& str : *args) { argvs.push_back(&str[0]); } char** argv = argvs.data(); gflags::ParseCommandLineFlags(&argc, &argv, true); } void SetUp(App::Settings* settings) { vector<string> args = settings->getCommandLineArgs(); ParseArgs(&args); settings->setWindowSize(kWidth, kHeight); settings->setResizable(false); settings->setTitle("8-ball Pool"); } } // namespace poolapp // This is a macro that runs the application. CINDER_APP(poolapp::PoolApp, RendererGl(RendererGl::Options().msaa(poolapp::kSamples)), poolapp::SetUp)
24.45283
69
0.692901
[ "vector" ]
4a3a19fc8ce35fdec8aca05b4f08dd628b91b6e9
2,401
cpp
C++
QPropertyTree-example/ExampleCustomRows.cpp
koalefant/yasli
2096ed8a59ae9c7da467d8de8f1eb811a989dc39
[ "MIT" ]
8
2021-07-08T18:06:33.000Z
2022-01-17T18:29:57.000Z
QPropertyTree-example/ExampleCustomRows.cpp
koalefant/yasli
2096ed8a59ae9c7da467d8de8f1eb811a989dc39
[ "MIT" ]
null
null
null
QPropertyTree-example/ExampleCustomRows.cpp
koalefant/yasli
2096ed8a59ae9c7da467d8de8f1eb811a989dc39
[ "MIT" ]
1
2021-12-31T15:52:56.000Z
2021-12-31T15:52:56.000Z
#include <string> #include <vector> using std::vector; #include "QPropertyTree/QPropertyTree.h" #include "PropertyTree/Color.h" #include "yasli/decorators/IconXPM.h" #include "yasli/decorators/HorizontalLine.h" #include "yasli/decorators/BitFlags.h" #include "yasli/decorators/Button.h" #include "yasli/decorators/Range.h" #include "yasli/decorators/FileOpen.h" #include "yasli/decorators/FileSave.h" using yasli::Archive; using yasli::SharedPtr; enum Flags { FLAG_FIRST = 1 << 0, FLAG_SECOND = 1 << 1, FLAG_THIRD = 1 << 2, FLAG_ALL = FLAG_FIRST | FLAG_SECOND | FLAG_THIRD }; YASLI_ENUM_BEGIN(Flags, "Flags") YASLI_ENUM(FLAG_FIRST, "first", "First") YASLI_ENUM(FLAG_SECOND, "second", "Second") YASLI_ENUM(FLAG_THIRD, "third", "Third") YASLI_ENUM(FLAG_ALL, "all", "All") YASLI_ENUM_END() struct CustomRows { int bitFlags; yasli::string fileSelector; bool buttonState; property_tree::Color propertyTreeColor; float rangeF; int rangeI; std::string fileOpen; std::string fileSave; CustomRows() : bitFlags(FLAG_FIRST | FLAG_THIRD) , fileSelector("test_file.txt") , buttonState(false) , propertyTreeColor(255, 0, 0, 128) , rangeF(0.5f) , rangeI(50) , fileOpen("file_to_open.txt") , fileSave("file_to_save.txt") { } void serialize(Archive& ar) { #include "Icons/favourites.xpm" ar(yasli::IconXPM(favourites_xpm), "icon", "yasli::IconXPM"); // new way to serialize bit flags, less intrusive ar(yasli::BitFlags<Flags>(bitFlags), "bitFlags", "yasli::BitFlags"); ar(propertyTreeColor, "propertyTreeColor", "property_tree::Color"); ar(yasli::Range(rangeF, 0.0f, 1.0f), "rangeF", "yasli::Range (float)"); ar(yasli::Range(rangeI, 0, 100), "rangeI", "yasli::Range (int)"); ar(yasli::FileOpen(fileOpen, "Text Files (*.txt);;All Files (*.*)", "."), "fileOpen", "yasli::File Open"); ar(yasli::FileSave(fileSave, "Text Files (*.txt);;All Files (*.*)", "."), "fileSave", "yasli::File Save"); ar(yasli::HorizontalLine(), "yasliHline", "<yasli::HorizontalLine"); ar(yasli::Button("yasli::Button"), "yasliButton", "<"); } } customRows; QWidget* createExampleCustomRows() { QPropertyTree* propertyTree = new QPropertyTree(); propertyTree->setExpandLevels(1); propertyTree->attach(yasli::Serializer(customRows)); propertyTree->expandAll(); return propertyTree; }
26.677778
109
0.681383
[ "vector" ]
6652634da171c77e77e51c81c192d20325c06c6a
54,619
cpp
C++
arangod/V8Server/v8-user-structures.cpp
morsdatum/ArangoDB
9cfc6d5cd50b8f451ebdedd77e2c5257fa72a573
[ "Apache-2.0" ]
null
null
null
arangod/V8Server/v8-user-structures.cpp
morsdatum/ArangoDB
9cfc6d5cd50b8f451ebdedd77e2c5257fa72a573
[ "Apache-2.0" ]
null
null
null
arangod/V8Server/v8-user-structures.cpp
morsdatum/ArangoDB
9cfc6d5cd50b8f451ebdedd77e2c5257fa72a573
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// /// @brief V8 user data structures /// /// @file /// /// DISCLAIMER /// /// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Jan Steemann /// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// #include "v8-user-structures.h" #include "Basics/ReadWriteLock.h" #include "Basics/ReadLocker.h" #include "Basics/WriteLocker.h" #include "Basics/hashes.h" #include "Basics/json.h" #include "Basics/json-utilities.h" #include "Basics/tri-strings.h" #include "Utils/Exception.h" #include "VocBase/vocbase.h" #include "V8/v8-conv.h" #include "V8/v8-utils.h" // ----------------------------------------------------------------------------- // --SECTION-- struct KeySpaceElement // ----------------------------------------------------------------------------- struct KeySpaceElement { KeySpaceElement () = delete; KeySpaceElement (char const* k, size_t length, TRI_json_t* json) : key(nullptr), json(json) { key = TRI_DuplicateString2Z(TRI_UNKNOWN_MEM_ZONE, k, length); if (key == nullptr) { THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY); } } ~KeySpaceElement () { if (key != nullptr) { TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, key); } if (json != nullptr) { TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); } } void setValue (TRI_json_t* value) { if (json != nullptr) { TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); json = nullptr; } json = value; } char* key; TRI_json_t* json; }; // ----------------------------------------------------------------------------- // --SECTION-- class KeySpace // ----------------------------------------------------------------------------- class KeySpace { public: KeySpace (uint32_t initialSize) : _lock() { TRI_InitAssociativePointer(&_hash, TRI_UNKNOWN_MEM_ZONE, TRI_HashStringKeyAssociativePointer, HashHash, EqualHash, nullptr); if (initialSize > 0) { TRI_ReserveAssociativePointer(&_hash, initialSize); } } ~KeySpace () { uint32_t const n = _hash._nrAlloc; for (uint32_t i = 0; i < n; ++i) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { delete element; } } TRI_DestroyAssociativePointer(&_hash); } static uint64_t HashHash (TRI_associative_pointer_t*, void const* element) { return TRI_FnvHashString(static_cast<KeySpaceElement const*>(element)->key); } static bool EqualHash (TRI_associative_pointer_t*, void const* key, void const* element) { return TRI_EqualString(static_cast<char const*>(key), static_cast<KeySpaceElement const*>(element)->key); } uint32_t keyspaceCount () { READ_LOCKER(_lock); return _hash._nrUsed; } uint32_t keyspaceCount (std::string const& prefix) { uint32_t count = 0; READ_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; for (uint32_t i = 0; i < n; ++i) { auto data = static_cast<KeySpaceElement*>(_hash._table[i]); if (data != nullptr) { if (TRI_IsPrefixString(data->key, prefix.c_str())) { ++count; } } } return count; } v8::Handle<v8::Value> keyspaceRemove () { v8::HandleScope scope; WRITE_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; uint32_t deleted = 0; for (uint32_t i = 0; i < n; ++i) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { delete element; _hash._table[i] = nullptr; ++deleted; } } _hash._nrUsed = 0; return scope.Close(v8::Number::New(static_cast<int>(deleted))); } v8::Handle<v8::Value> keyspaceRemove (std::string const& prefix) { v8::HandleScope scope; WRITE_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; uint32_t i = 0; uint32_t deleted = 0; while (i < n) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { if (TRI_IsPrefixString(element->key, prefix.c_str())) { if (TRI_RemoveKeyAssociativePointer(&_hash, element->key) != nullptr) { delete element; ++deleted; continue; } } } ++i; } return scope.Close(v8::Number::New(static_cast<int>(deleted))); } v8::Handle<v8::Value> keyspaceKeys () { v8::HandleScope scope; v8::Handle<v8::Array> result; { READ_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; uint32_t count = 0; result = v8::Array::New(static_cast<int>(_hash._nrUsed)); for (uint32_t i = 0; i < n; ++i) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { result->Set(count++, v8::String::New(element->key)); } } } return scope.Close(result); } v8::Handle<v8::Value> keyspaceKeys (std::string const& prefix) { v8::HandleScope scope; v8::Handle<v8::Array> result; { READ_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; uint32_t count = 0; result = v8::Array::New(); for (uint32_t i = 0; i < n; ++i) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { if (TRI_IsPrefixString(element->key, prefix.c_str())) { result->Set(count++, v8::String::New(element->key)); } } } } return scope.Close(result); } v8::Handle<v8::Value> keyspaceGet () { v8::HandleScope scope; v8::Handle<v8::Object> result = v8::Object::New(); { READ_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; for (uint32_t i = 0; i < n; ++i) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { result->Set(v8::String::New(element->key), TRI_ObjectJson(element->json)); } } } return scope.Close(result); } v8::Handle<v8::Value> keyspaceGet (std::string const& prefix) { v8::HandleScope scope; v8::Handle<v8::Object> result = v8::Object::New(); { READ_LOCKER(_lock); uint32_t const n = _hash._nrAlloc; for (uint32_t i = 0; i < n; ++i) { auto element = static_cast<KeySpaceElement*>(_hash._table[i]); if (element != nullptr) { if (TRI_IsPrefixString(element->key, prefix.c_str())) { result->Set(v8::String::New(element->key), TRI_ObjectJson(element->json)); } } } } return scope.Close(result); } bool keyCount (std::string const& key, uint32_t& result) { READ_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found != nullptr) { TRI_json_t const* value = found->json; if (TRI_IsListJson(value)) { result = static_cast<uint32_t>(TRI_LengthVector(&value->_value._objects)); return true; } if (TRI_IsArrayJson(value)) { result = static_cast<uint32_t>(TRI_LengthVector(&value->_value._objects) / 2); return true; } } result = 0; return false; } v8::Handle<v8::Value> keyGet (std::string const& key) { v8::HandleScope scope; v8::Handle<v8::Value> result; { READ_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { result = v8::Undefined(); } else { result = TRI_ObjectJson(found->json); } } return scope.Close(result); } bool keySet (std::string const& key, v8::Handle<v8::Value> const& value, bool replace) { auto element = new KeySpaceElement(key.c_str(), key.size(), TRI_ObjectToJson(value)); KeySpaceElement* found = nullptr; { WRITE_LOCKER(_lock); found = static_cast<KeySpaceElement*>(TRI_InsertKeyAssociativePointer(&_hash, element->key, element, replace)); } if (found == nullptr) { return true; } if (replace) { delete found; return true; } delete element; return false; } int keyCas (std::string const& key, v8::Handle<v8::Value> const& value, v8::Handle<v8::Value> const& compare, bool& match) { auto element = new KeySpaceElement(key.c_str(), key.size(), TRI_ObjectToJson(value)); WRITE_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_InsertKeyAssociativePointer(&_hash, element->key, element, false)); if (compare->IsUndefined()) { if (found == nullptr) { // no object saved yet TRI_InsertKeyAssociativePointer(&_hash, element->key, element, false); match = true; } else { match = false; } return TRI_ERROR_NO_ERROR; } TRI_json_t* other = TRI_ObjectToJson(compare); if (other == nullptr) { delete element; // TODO: fix error message return TRI_ERROR_OUT_OF_MEMORY; } int res = TRI_CompareValuesJson(found->json, other); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, other); if (res != 0) { delete element; match = false; } else { TRI_InsertKeyAssociativePointer(&_hash, element->key, element, true); delete found; match = true; } return TRI_ERROR_NO_ERROR; } bool keyRemove (std::string const& key) { KeySpaceElement* found = nullptr; { WRITE_LOCKER(_lock); found = static_cast<KeySpaceElement*>(TRI_RemoveKeyAssociativePointer(&_hash, key.c_str())); } if (found != nullptr) { delete found; return true; } return false; } bool keyExists (std::string const& key) { READ_LOCKER(_lock); return (TRI_LookupByKeyAssociativePointer(&_hash, key.c_str()) != nullptr); } int keyIncr (std::string const& key, double value, double& result) { WRITE_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { auto element = new KeySpaceElement(key.c_str(), key.size(), TRI_CreateNumberJson(TRI_UNKNOWN_MEM_ZONE, value)); if (TRI_InsertKeyAssociativePointer(&_hash, element->key, static_cast<void*>(element), false) != TRI_ERROR_NO_ERROR) { delete element; return TRI_ERROR_OUT_OF_MEMORY; } result = value; } else { TRI_json_t* current = found->json; if (! TRI_IsNumberJson(current)) { // TODO: change error code return TRI_ERROR_ILLEGAL_NUMBER; } result = current->_value._number += value; } return TRI_ERROR_NO_ERROR; } int keyPush (std::string const& key, v8::Handle<v8::Value> const& value) { WRITE_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { TRI_json_t* list = TRI_CreateList2Json(TRI_UNKNOWN_MEM_ZONE, 1); if (list == nullptr) { return TRI_ERROR_OUT_OF_MEMORY; } if (TRI_PushBack3ListJson(TRI_UNKNOWN_MEM_ZONE, list, TRI_ObjectToJson(value)) != TRI_ERROR_NO_ERROR) { TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, list); return TRI_ERROR_OUT_OF_MEMORY; } auto element = new KeySpaceElement(key.c_str(), key.size(), list); if (TRI_InsertKeyAssociativePointer(&_hash, element->key, static_cast<void*>(element), false) != TRI_ERROR_NO_ERROR) { delete element; return TRI_ERROR_OUT_OF_MEMORY; } } else { TRI_json_t* current = found->json; if (! TRI_IsListJson(current)) { // TODO: change error code return TRI_ERROR_INTERNAL; } if (TRI_PushBack3ListJson(TRI_UNKNOWN_MEM_ZONE, current, TRI_ObjectToJson(value)) != TRI_ERROR_NO_ERROR) { return TRI_ERROR_OUT_OF_MEMORY; } } return TRI_ERROR_NO_ERROR; } v8::Handle<v8::Value> keyPop (std::string const& key) { v8::HandleScope scope; WRITE_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } TRI_json_t* current = found->json; if (! TRI_IsListJson(current)) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } size_t const n = TRI_LengthVector(&current->_value._objects); if (n == 0) { return scope.Close(v8::Undefined()); } TRI_json_t* item = static_cast<TRI_json_t*>(TRI_AtVector(&current->_value._objects, n - 1)); // hack: decrease the vector size --current->_value._objects._length; v8::Handle<v8::Value> result = TRI_ObjectJson(item); TRI_DestroyJson(TRI_UNKNOWN_MEM_ZONE, item); return scope.Close(result); } v8::Handle<v8::Value> keyTransfer (std::string const& keyFrom, std::string const& keyTo) { v8::HandleScope scope; WRITE_LOCKER(_lock); auto source = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, keyFrom.c_str())); if (source == nullptr) { return scope.Close(v8::Undefined()); } TRI_json_t* current = source->json; if (! TRI_IsListJson(current)) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } size_t const n = TRI_LengthVector(&source->json->_value._objects); if (n == 0) { return scope.Close(v8::Undefined()); } TRI_json_t* sourceItem = static_cast<TRI_json_t*>(TRI_AtVector(&source->json->_value._objects, n - 1)); auto dest = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, keyTo.c_str())); if (dest == nullptr) { TRI_json_t* list = TRI_CreateList2Json(TRI_UNKNOWN_MEM_ZONE, 1); if (list == nullptr) { TRI_V8_EXCEPTION_MEMORY(scope); } TRI_PushBack2ListJson(list, sourceItem); try { auto element = new KeySpaceElement(keyTo.c_str(), keyTo.size(), list); TRI_InsertKeyAssociativePointer(&_hash, element->key, element, false); // hack: decrease the vector size --current->_value._objects._length; return TRI_ObjectJson(sourceItem); } catch (...) { TRI_V8_EXCEPTION_MEMORY(scope); } } if (! TRI_IsListJson(dest->json)) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } TRI_PushBack2ListJson(dest->json, sourceItem); // hack: decrease the vector size --current->_value._objects._length; return TRI_ObjectJson(sourceItem); } v8::Handle<v8::Value> keyKeys (std::string const& key) { v8::HandleScope scope; v8::Handle<v8::Value> result; { READ_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { result = v8::Undefined(); } else { result = TRI_KeysJson(found->json); } } return scope.Close(result); } v8::Handle<v8::Value> keyValues (std::string const& key) { v8::HandleScope scope; v8::Handle<v8::Value> result; { READ_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { result = v8::Undefined(); } else { result = TRI_ValuesJson(found->json); } } return scope.Close(result); } v8::Handle<v8::Value> keyGetAt (std::string const& key, int64_t index) { v8::HandleScope scope; v8::Handle<v8::Value> result; { READ_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { result = v8::Undefined(); } else { if (! TRI_IsListJson(found->json)) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } size_t const n = found->json->_value._objects._length; if (index < 0) { index = static_cast<int64_t>(n) + index; } if (index >= static_cast<int64_t>(n)) { result = v8::Undefined(); } else { auto item = static_cast<TRI_json_t const*>(TRI_AtVector(&found->json->_value._objects, static_cast<size_t>(index))); result = TRI_ObjectJson(item); } } } return scope.Close(result); } bool keySetAt (std::string const& key, int64_t index, v8::Handle<v8::Value> const& value) { WRITE_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { // TODO: change error code return false; } else { if (! TRI_IsListJson(found->json)) { // TODO: change error code return false; } size_t const n = found->json->_value._objects._length; if (index < 0) { // TODO: change error code return false; } auto json = TRI_ObjectToJson(value); if (json == nullptr) { // TODO: change error code return false; } if (index >= static_cast<int64_t>(n)) { // insert new element TRI_InsertVector(&found->json->_value._objects, json, static_cast<size_t>(index)); } else { // overwrite existing element auto item = static_cast<TRI_json_t*>(TRI_AtVector(&found->json->_value._objects, static_cast<size_t>(index))); if (item != nullptr) { TRI_DestroyJson(TRI_UNKNOWN_MEM_ZONE, item); } TRI_SetVector(&found->json->_value._objects, static_cast<size_t>(index), json); } // only free pointer to json, but not its internal structures TRI_Free(TRI_UNKNOWN_MEM_ZONE, json); } return true; } char const* keyType (std::string const& key) { READ_LOCKER(_lock); void* found = TRI_LookupByKeyAssociativePointer(&_hash, key.c_str()); if (found != nullptr) { TRI_json_t const* value = static_cast<KeySpaceElement*>(found)->json; switch (value->_type) { case TRI_JSON_NULL: return "null"; case TRI_JSON_BOOLEAN: return "boolean"; case TRI_JSON_NUMBER: return "number"; case TRI_JSON_STRING: case TRI_JSON_STRING_REFERENCE: return "string"; case TRI_JSON_LIST: return "list"; case TRI_JSON_ARRAY: return "object"; case TRI_JSON_UNUSED: break; } } return "undefined"; } v8::Handle<v8::Value> keyMerge (std::string const& key, v8::Handle<v8::Value> const& value, bool nullMeansRemove) { v8::HandleScope scope; if (! value->IsObject() || value->IsArray()) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } WRITE_LOCKER(_lock); auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str())); if (found == nullptr) { auto element = new KeySpaceElement(key.c_str(), key.size(), TRI_ObjectToJson(value)); TRI_InsertKeyAssociativePointer(&_hash, element->key, element, false); return scope.Close(value); } if (! TRI_IsArrayJson(found->json)) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } TRI_json_t* other = TRI_ObjectToJson(value); if (other == nullptr) { TRI_V8_EXCEPTION(scope, TRI_ERROR_OUT_OF_MEMORY); } TRI_json_t* merged = TRI_MergeJson(TRI_UNKNOWN_MEM_ZONE, found->json, other, nullMeansRemove, false); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, other); if (merged == nullptr) { TRI_V8_EXCEPTION(scope, TRI_ERROR_OUT_OF_MEMORY); } found->setValue(merged); return scope.Close(TRI_ObjectJson(merged)); } private: triagens::basics::ReadWriteLock _lock; TRI_associative_pointer_t _hash; }; // ----------------------------------------------------------------------------- // --SECTION-- struct UserStructures // ----------------------------------------------------------------------------- struct UserStructures { struct { triagens::basics::ReadWriteLock lock; std::unordered_map<std::string, KeySpace*> data; } hashes; }; // ----------------------------------------------------------------------------- // --SECTION-- private functions // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @brief get the vocbase pointer from the current V8 context //////////////////////////////////////////////////////////////////////////////// static inline TRI_vocbase_t* GetContextVocBase () { TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData()); TRI_ASSERT_EXPENSIVE(v8g->_vocbase != nullptr); return static_cast<TRI_vocbase_t*>(v8g->_vocbase); } //////////////////////////////////////////////////////////////////////////////// /// @brief finds a hash array by name /// note that at least the read-lock must be held to use this function //////////////////////////////////////////////////////////////////////////////// static KeySpace* GetKeySpace (TRI_vocbase_t* vocbase, std::string const& name) { auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); auto it = h->data.find(name); if (it != h->data.end()) { return (*it).second; } return nullptr; } //////////////////////////////////////////////////////////////////////////////// /// @brief creates a keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceCreate (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_CREATE(<name>, <size>, <ignoreExisting>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); int64_t size = 0; if (argv.Length() > 1) { size = TRI_ObjectToInt64(argv[1]); if (size < 0 || size > static_cast<decltype(size)>(UINT32_MAX)) { TRI_V8_EXCEPTION_PARAMETER(scope, "invalid value for <size>"); } } bool ignoreExisting = false; if (argv.Length() > 2) { ignoreExisting = TRI_ObjectToBoolean(argv[2]); } std::unique_ptr<KeySpace> ptr(new KeySpace(static_cast<uint32_t>(size))); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); { WRITE_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash != nullptr) { if (! ignoreExisting) { // TODO: change error code TRI_V8_EXCEPTION_MESSAGE(scope, TRI_ERROR_INTERNAL, "hash already exists"); } } try { h->data.emplace(std::make_pair(name, ptr.release())); } catch (...) { TRI_V8_EXCEPTION_MEMORY(scope); } } return scope.Close(v8::True()); } //////////////////////////////////////////////////////////////////////////////// /// @brief drops a keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceDrop (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() != 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_DROP(<name>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); { WRITE_LOCKER(h->lock); auto it = h->data.find(name); if (it == h->data.end()) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } delete (*it).second; h->data.erase(it); } return scope.Close(v8::True()); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns the number of items in the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceCount (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_COUNT(<name>, <prefix>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); uint32_t count; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } if (argv.Length() > 1) { std::string const&& prefix = TRI_ObjectToString(argv[1]); count = hash->keyspaceCount(prefix); } else { count = hash->keyspaceCount(); } } return scope.Close(v8::Number::New(static_cast<int>(count))); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns whether a keyspace exists //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceExists (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() != 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_EXISTS(<name>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); return scope.Close(v8::Boolean::New(hash != nullptr)); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns all keys of the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceKeys (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_KEYS(<name>, <prefix>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } if (argv.Length() > 1) { std::string const&& prefix = TRI_ObjectToString(argv[1]); return scope.Close(hash->keyspaceKeys(prefix)); } return scope.Close(hash->keyspaceKeys()); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns all data of the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceGet (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_GET(<name>, <prefix>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } if (argv.Length() > 1) { std::string const&& prefix = TRI_ObjectToString(argv[1]); return scope.Close(hash->keyspaceGet(prefix)); } return scope.Close(hash->keyspaceGet()); } //////////////////////////////////////////////////////////////////////////////// /// @brief removes all keys from the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyspaceRemove (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 1 || ! argv[0]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEYSPACE_REMOVE(<name>, <prefix>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } if (argv.Length() > 1) { std::string const&& prefix = TRI_ObjectToString(argv[1]); return scope.Close(hash->keyspaceRemove(prefix)); } return scope.Close(hash->keyspaceRemove()); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns the value for a key in the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyGet (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_GET(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); v8::Handle<v8::Value> result; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } result = hash->keyGet(key); } return scope.Close(result); } //////////////////////////////////////////////////////////////////////////////// /// @brief set the value for a key in the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeySet (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_SET(<name>, <key>, <value>, <replace>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); bool replace = true; if (argv.Length() > 3) { replace = TRI_ObjectToBoolean(argv[3]); } auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); bool result; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } result = hash->keySet(key, argv[2], replace); } return scope.Close(result ? v8::True() : v8::False()); } //////////////////////////////////////////////////////////////////////////////// /// @brief conditionally set the value for a key in the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeySetCas (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 4 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_SET_CAS(<name>, <key>, <value>, <compare>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); if (argv[2]->IsUndefined()) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); int res; bool match = false; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } res = hash->keyCas(key, argv[2], argv[3], match); } if (res != TRI_ERROR_NO_ERROR) { TRI_V8_EXCEPTION(scope, res); } return scope.Close(v8::Boolean::New(match)); } //////////////////////////////////////////////////////////////////////////////// /// @brief remove the value for a key in the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyRemove (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_REMOVE(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); bool result; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } result = hash->keyRemove(key); } return v8::Boolean::New(result); } //////////////////////////////////////////////////////////////////////////////// /// @brief checks if a key exists in the keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyExists (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_EXISTS(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); bool result; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } result = hash->keyExists(key); } return v8::Boolean::New(result); } //////////////////////////////////////////////////////////////////////////////// /// @brief increase or decrease the value for a key in a keyspace //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyIncr (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_INCR(<name>, <key>, <value>)"); } if (argv.Length() >= 3 && ! argv[2]->IsNumber()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_INCR(<name>, <key>, <value>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); double incr = 1.0; if (argv.Length() >= 3) { incr = TRI_ObjectToDouble(argv[2]); } double result; auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } int res = hash->keyIncr(key, incr, result); if (res != TRI_ERROR_NO_ERROR) { TRI_V8_EXCEPTION(scope, res); } } return scope.Close(v8::Number::New(result)); } //////////////////////////////////////////////////////////////////////////////// /// @brief merges an object into the object with the specified key //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyUpdate (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_UPDATE(<name>, <key>, <object>, <nullMeansRemove>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); bool nullMeansRemove = false; if (argv.Length() > 3) { nullMeansRemove = TRI_ObjectToBoolean(argv[3]); } auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } return scope.Close(hash->keyMerge(key, argv[2], nullMeansRemove)); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns all keys of the key //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyKeys (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_KEYS(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } return scope.Close(hash->keyKeys(key)); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns all value of the hash array //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyValues (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_VALUES(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } return scope.Close(hash->keyValues(key)); } //////////////////////////////////////////////////////////////////////////////// /// @brief right-pushes an element into a list value //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyPush (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_PUSH(<name>, <key>, <value>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } int res = hash->keyPush(key, argv[2]); if (res != TRI_ERROR_NO_ERROR) { TRI_V8_EXCEPTION(scope, res); } return scope.Close(v8::True()); } //////////////////////////////////////////////////////////////////////////////// /// @brief pops an element from a list value //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyPop (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_POP(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } return scope.Close(hash->keyPop(key)); } //////////////////////////////////////////////////////////////////////////////// /// @brief transfer an element from a list value into another //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyTransfer (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_TRANSFER(<name>, <key-from>, <key-to>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& keyFrom = TRI_ObjectToString(argv[1]); std::string const&& keyTo = TRI_ObjectToString(argv[2]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } return scope.Close(hash->keyTransfer(keyFrom, keyTo)); } //////////////////////////////////////////////////////////////////////////////// /// @brief get an element at a specific list position //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyGetAt (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_GET_AT(<name>, <key>, <index>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); int64_t offset = TRI_ObjectToInt64(argv[2]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } return scope.Close(hash->keyGetAt(key, offset)); } //////////////////////////////////////////////////////////////////////////////// /// @brief set an element at a specific list position //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeySetAt (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 4 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_SET_AT(<name>, <key>, <index>, <value>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); int64_t offset = TRI_ObjectToInt64(argv[2]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } int res = hash->keySetAt(key, offset, argv[3]); if (res != TRI_ERROR_NO_ERROR) { TRI_V8_EXCEPTION(scope, res); } return scope.Close(v8::True()); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns the type of the value for a key //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyType (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_TYPE(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); char const* result; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } result = hash->keyType(key); } return scope.Close(v8::String::New(result)); } //////////////////////////////////////////////////////////////////////////////// /// @brief returns the number of items in a compound value //////////////////////////////////////////////////////////////////////////////// static v8::Handle<v8::Value> JS_KeyCount (v8::Arguments const& argv) { v8::HandleScope scope; if (argv.Length() < 2 || ! argv[0]->IsString() || ! argv[1]->IsString()) { TRI_V8_EXCEPTION_USAGE(scope, "KEY_COUNT(<name>, <key>)"); } TRI_vocbase_t* vocbase = GetContextVocBase(); if (vocbase == nullptr) { TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase"); } std::string const&& name = TRI_ObjectToString(argv[0]); std::string const&& key = TRI_ObjectToString(argv[1]); auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes); uint32_t result; bool valid; { READ_LOCKER(h->lock); auto hash = GetKeySpace(vocbase, name); if (hash == nullptr) { // TODO: change error code TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); } valid = hash->keyCount(key, result); } if (valid) { return scope.Close(v8::Number::New(result)); } return scope.Close(v8::Undefined()); } // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @brief creates the user structures for a database //////////////////////////////////////////////////////////////////////////////// void TRI_CreateUserStructuresVocBase (TRI_vocbase_t* vocbase) { TRI_ASSERT(vocbase != nullptr); TRI_ASSERT(vocbase->_userStructures == nullptr); vocbase->_userStructures = new UserStructures; } //////////////////////////////////////////////////////////////////////////////// /// @brief drops the user structures for a database //////////////////////////////////////////////////////////////////////////////// void TRI_FreeUserStructuresVocBase (TRI_vocbase_t* vocbase) { if (vocbase->_userStructures != nullptr) { auto us = static_cast<UserStructures*>(vocbase->_userStructures); for (auto& hash : us->hashes.data) { if (hash.second != nullptr) { delete hash.second; } } delete us; } } //////////////////////////////////////////////////////////////////////////////// /// @brief creates the user structures functions //////////////////////////////////////////////////////////////////////////////// void TRI_InitV8UserStructures (v8::Handle<v8::Context> context) { v8::HandleScope scope; // NOTE: the following functions are all experimental and might // change without further notice TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_CREATE", JS_KeyspaceCreate, true); TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_DROP", JS_KeyspaceDrop, true); TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_COUNT", JS_KeyspaceCount, true); TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_EXISTS", JS_KeyspaceExists, true); TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_KEYS", JS_KeyspaceKeys, true); TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_REMOVE", JS_KeyspaceRemove, true); TRI_AddGlobalFunctionVocbase(context, "KEYSPACE_GET", JS_KeyspaceGet, true); TRI_AddGlobalFunctionVocbase(context, "KEY_SET", JS_KeySet, true); TRI_AddGlobalFunctionVocbase(context, "KEY_SET_CAS", JS_KeySetCas, true); TRI_AddGlobalFunctionVocbase(context, "KEY_GET", JS_KeyGet, true); TRI_AddGlobalFunctionVocbase(context, "KEY_REMOVE", JS_KeyRemove, true); TRI_AddGlobalFunctionVocbase(context, "KEY_EXISTS", JS_KeyExists, true); TRI_AddGlobalFunctionVocbase(context, "KEY_TYPE", JS_KeyType, true); // numeric functions TRI_AddGlobalFunctionVocbase(context, "KEY_INCR", JS_KeyIncr, true); // list / array functions TRI_AddGlobalFunctionVocbase(context, "KEY_UPDATE", JS_KeyUpdate, true); TRI_AddGlobalFunctionVocbase(context, "KEY_KEYS", JS_KeyKeys, true); TRI_AddGlobalFunctionVocbase(context, "KEY_VALUES", JS_KeyValues, true); TRI_AddGlobalFunctionVocbase(context, "KEY_COUNT", JS_KeyCount, true); TRI_AddGlobalFunctionVocbase(context, "KEY_PUSH", JS_KeyPush, true); TRI_AddGlobalFunctionVocbase(context, "KEY_POP", JS_KeyPop, true); TRI_AddGlobalFunctionVocbase(context, "KEY_TRANSFER", JS_KeyTransfer, true); TRI_AddGlobalFunctionVocbase(context, "KEY_GET_AT", JS_KeyGetAt, true); TRI_AddGlobalFunctionVocbase(context, "KEY_SET_AT", JS_KeySetAt, true); } // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- // Local Variables: // mode: outline-minor // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // End:
29.879103
128
0.560263
[ "object", "vector" ]
6655448f492655f643b508c5c17bc0cbbb986b8c
4,418
hpp
C++
include/GlobalNamespace/OVRNetwork_OVRNetworkTcpServer.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/GlobalNamespace/OVRNetwork_OVRNetworkTcpServer.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/GlobalNamespace/OVRNetwork_OVRNetworkTcpServer.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: OVRNetwork #include "GlobalNamespace/OVRNetwork.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: System::Net::Sockets namespace System::Net::Sockets { // Forward declaring type: TcpListener class TcpListener; // Forward declaring type: TcpClient class TcpClient; } // Forward declaring namespace: System::Collections::Generic namespace System::Collections::Generic { // Forward declaring type: List`1<T> template<typename T> class List_1; } // Forward declaring namespace: System namespace System { // Forward declaring type: IAsyncResult class IAsyncResult; } // Completed forward declares // Type namespace: namespace GlobalNamespace { // Size: 0x28 #pragma pack(push, 1) // Autogenerated type: OVRNetwork/OVRNetworkTcpServer class OVRNetwork::OVRNetworkTcpServer : public ::Il2CppObject { public: // public System.Net.Sockets.TcpListener tcpListener // Size: 0x8 // Offset: 0x10 System::Net::Sockets::TcpListener* tcpListener; // Field size check static_assert(sizeof(System::Net::Sockets::TcpListener*) == 0x8); // private readonly System.Object clientsLock // Size: 0x8 // Offset: 0x18 ::Il2CppObject* clientsLock; // Field size check static_assert(sizeof(::Il2CppObject*) == 0x8); // public readonly System.Collections.Generic.List`1<System.Net.Sockets.TcpClient> clients // Size: 0x8 // Offset: 0x20 System::Collections::Generic::List_1<System::Net::Sockets::TcpClient*>* clients; // Field size check static_assert(sizeof(System::Collections::Generic::List_1<System::Net::Sockets::TcpClient*>*) == 0x8); // Creating value type constructor for type: OVRNetworkTcpServer OVRNetworkTcpServer(System::Net::Sockets::TcpListener* tcpListener_ = {}, ::Il2CppObject* clientsLock_ = {}, System::Collections::Generic::List_1<System::Net::Sockets::TcpClient*>* clients_ = {}) noexcept : tcpListener{tcpListener_}, clientsLock{clientsLock_}, clients{clients_} {} // public System.Void StartListening(System.Int32 listeningPort) // Offset: 0x12D64B0 void StartListening(int listeningPort); // public System.Void StopListening() // Offset: 0x12D6998 void StopListening(); // private System.Void DoAcceptTcpClientCallback(System.IAsyncResult ar) // Offset: 0x12D6AEC void DoAcceptTcpClientCallback(System::IAsyncResult* ar); // public System.Boolean HasConnectedClient() // Offset: 0x12D6FA0 bool HasConnectedClient(); // public System.Void Broadcast(System.Int32 payloadType, System.Byte[] payload) // Offset: 0x12D718C void Broadcast(int payloadType, ::Array<uint8_t>* payload); // private System.Void DoWriteDataCallback(System.IAsyncResult ar) // Offset: 0x12D7690 void DoWriteDataCallback(System::IAsyncResult* ar); // public System.Void .ctor() // Offset: 0x12D7788 // Implemented from: System.Object // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static OVRNetwork::OVRNetworkTcpServer* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::OVRNetwork::OVRNetworkTcpServer::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<OVRNetwork::OVRNetworkTcpServer*, creationType>())); } }; // OVRNetwork/OVRNetworkTcpServer #pragma pack(pop) static check_size<sizeof(OVRNetwork::OVRNetworkTcpServer), 32 + sizeof(System::Collections::Generic::List_1<System::Net::Sockets::TcpClient*>*)> __GlobalNamespace_OVRNetwork_OVRNetworkTcpServerSizeCheck; static_assert(sizeof(OVRNetwork::OVRNetworkTcpServer) == 0x28); } DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::OVRNetwork::OVRNetworkTcpServer*, "", "OVRNetwork/OVRNetworkTcpServer");
47
286
0.713445
[ "object" ]
6657389c795b916e3cf1433b4b5d963ed3e6c8db
50
hpp
C++
src/boost_hana_ext_boost_fusion_vector.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
10
2018-03-17T00:58:42.000Z
2021-07-06T02:48:49.000Z
src/boost_hana_ext_boost_fusion_vector.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
2
2021-03-26T15:17:35.000Z
2021-05-20T23:55:08.000Z
src/boost_hana_ext_boost_fusion_vector.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
4
2019-05-28T21:06:37.000Z
2021-07-06T03:06:52.000Z
#include <boost/hana/ext/boost/fusion/vector.hpp>
25
49
0.78
[ "vector" ]
66667fd39f8932ea7c410741acb78f229ca6870f
6,072
cpp
C++
materialsystem/stdshaders/unlitworld_screensample.cpp
DannyParker0001/Kisak-Strike
99ed85927336fe3aff2efd9b9382b2b32eb1d05d
[ "Unlicense" ]
252
2020-12-16T15:34:43.000Z
2022-03-31T23:21:37.000Z
cstrike15_src/materialsystem/stdshaders/unlitworld_screensample.cpp
bahadiraraz/Counter-Strike-Global-Offensive
9a0534100cb98ffa1cf0c32e138f0e7971e910d3
[ "MIT" ]
23
2020-12-20T18:02:54.000Z
2022-03-28T16:58:32.000Z
cstrike15_src/materialsystem/stdshaders/unlitworld_screensample.cpp
bahadiraraz/Counter-Strike-Global-Offensive
9a0534100cb98ffa1cf0c32e138f0e7971e910d3
[ "MIT" ]
42
2020-12-19T04:32:33.000Z
2022-03-30T06:00:28.000Z
//========= Copyright (c) Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #include "BaseVSShader.h" #include "mathlib/vmatrix.h" #include "common_hlsl_cpp_consts.h" // hack hack hack! #include "convar.h" #include "unlitworld_screensample_vs20.inc" #include "unlitworld_screensample_ps20.inc" #include "unlitworld_screensample_ps20b.inc" #include "shaderlib/commandbuilder.h" // NOTE: This has to be the last file included! #include "tier0/memdbgon.h" BEGIN_VS_SHADER( UnLitWorld_ScreenSample, "Help for UnLitWorld_ScreenSample" ) BEGIN_SHADER_PARAMS //always required SHADER_PARAM( BASETEXTURE, SHADER_PARAM_TYPE_TEXTURE, "", "" ) END_SHADER_PARAMS SHADER_INIT_PARAMS() { SET_PARAM_STRING_IF_NOT_DEFINED( BASETEXTURE, "Dev/flat_normal" ); SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING ); } SHADER_FALLBACK { return 0; } SHADER_INIT { if ( params[BASETEXTURE]->IsDefined() ) { LoadTexture( BASETEXTURE ); } } inline void DrawUnLitWorld_ScreenSample( IMaterialVar **params, IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, int vertexCompression ) { SHADOW_STATE { SetInitialShadowState( ); if ( params[BASETEXTURE]->IsDefined() ) { pShaderShadow->EnableTexture( SHADER_SAMPLER0, true ); } if ( IS_FLAG_SET(MATERIAL_VAR_ADDITIVE) ) { EnableAlphaBlending( SHADER_BLEND_ONE, SHADER_BLEND_ONE ); } else { EnableAlphaBlending( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA ); } //pShaderShadow->EnableBlending( true ); //pShaderShadow->BlendFunc( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA ); //pShaderShadow->AlphaFunc( SHADER_ALPHAFUNC_ALWAYS, 0.0f ); /* BlendFunc( SHADER_BLEND_ZERO, SHADER_BLEND_ZERO ); BlendOp( SHADER_BLEND_OP_ADD ); EnableBlendingSeparateAlpha( false ); BlendFuncSeparateAlpha( SHADER_BLEND_ZERO, SHADER_BLEND_ZERO ); BlendOpSeparateAlpha( SHADER_BLEND_OP_ADD ); AlphaFunc( SHADER_ALPHAFUNC_GEQUAL, 0.7f ); */ unsigned int flags = VERTEX_POSITION| VERTEX_FORMAT_COMPRESSED; flags |= VERTEX_NORMAL; int nTexCoordCount = 1; int userDataSize = 0; if (IS_FLAG_SET( MATERIAL_VAR_VERTEXCOLOR )) { flags |= VERTEX_COLOR; } pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize ); DECLARE_STATIC_VERTEX_SHADER( unlitworld_screensample_vs20 ); SET_STATIC_VERTEX_SHADER( unlitworld_screensample_vs20 ); if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) { DECLARE_STATIC_PIXEL_SHADER( unlitworld_screensample_ps20b ); SET_STATIC_PIXEL_SHADER( unlitworld_screensample_ps20b ); } else { DECLARE_STATIC_PIXEL_SHADER( unlitworld_screensample_ps20 ); SET_STATIC_PIXEL_SHADER( unlitworld_screensample_ps20 ); } //pShaderShadow->EnableAlphaWrites( true ); //pShaderShadow->EnableDepthWrites( true ); pShaderShadow->EnableSRGBWrite( true ); pShaderShadow->EnableBlending( true ); //pShaderShadow->EnableAlphaTest( true ); PI_BeginCommandBuffer(); PI_SetModulationPixelShaderDynamicState_LinearColorSpace( 1 ); PI_EndCommandBuffer(); } DYNAMIC_STATE { pShaderAPI->SetDefaultState(); SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, BASETEXTURETRANSFORM ); if ( params[BASETEXTURE]->IsDefined() ) { BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_SRGBREAD, BASETEXTURE, -1 ); } // Get viewport and render target dimensions and set shader constant to do a 2D mad int nViewportX, nViewportY, nViewportWidth, nViewportHeight; pShaderAPI->GetCurrentViewport( nViewportX, nViewportY, nViewportWidth, nViewportHeight ); int nRtWidth, nRtHeight; pShaderAPI->GetCurrentRenderTargetDimensions( nRtWidth, nRtHeight ); // Compute viewport mad that takes projection space coords (post divide by W) into normalized screenspace, taking into account the currently set viewport. float vViewportMad[4]; vViewportMad[0] = .5f * ( ( float )nViewportWidth / ( float )nRtWidth ); vViewportMad[1] = -.5f * ( ( float )nViewportHeight / ( float )nRtHeight ); vViewportMad[2] = vViewportMad[0] + ( ( float )nViewportX / ( float )nRtWidth ); vViewportMad[3] = -vViewportMad[1] + ( ( float )nViewportY / ( float )nRtHeight ); pShaderAPI->SetPixelShaderConstant( 17, vViewportMad, 1 ); float c18[4]; pShaderAPI->GetWorldSpaceCameraPosition( c18 ); c18[3] = 0; pShaderAPI->SetPixelShaderConstant( 18, c18, 1 ); float c0[4] = { 1.0f / (float)MAX(nViewportWidth, 1.0f) , // one X pixel in normalized 0..1 screenspace 1.0f / (float)MAX(nViewportHeight, 1.0f) , // one Y pixel in normalized 0..1 screenspace 0, 0 }; pShaderAPI->SetPixelShaderConstant( 0, c0, 1 ); DECLARE_DYNAMIC_VERTEX_SHADER( unlitworld_screensample_vs20 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER( unlitworld_screensample_vs20 ); if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) { DECLARE_DYNAMIC_PIXEL_SHADER( unlitworld_screensample_ps20b ); SET_DYNAMIC_PIXEL_SHADER( unlitworld_screensample_ps20b ); } else { DECLARE_DYNAMIC_PIXEL_SHADER( unlitworld_screensample_ps20 ); SET_DYNAMIC_PIXEL_SHADER( unlitworld_screensample_ps20 ); } } Draw(); } SHADER_DRAW { DrawUnLitWorld_ScreenSample( params, pShaderShadow, pShaderAPI, vertexCompression ); } //void ExecuteFastPath( int *dynVSIdx, int *dynPSIdx, IMaterialVar** params, IShaderDynamicAPI * pShaderAPI, // VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr, BOOL bCSMEnabled ) //{ // DrawUnLitWorld_ScreenSample( params, pShaderShadow, pShaderAPI, vertexCompression ); //} bool IsTranslucent( IMaterialVar **params ) const { return false; } END_SHADER
31.46114
157
0.730567
[ "render" ]
666b2c463d577a95c8c08e2bd5947412331bc5aa
9,077
cpp
C++
tests/src/printf/hipPrintfManyWaves.cpp
krishoza/HIP
f83315ac3b62801c61098e7f2604ce07e79b633c
[ "MIT" ]
1
2021-06-19T18:15:44.000Z
2021-06-19T18:15:44.000Z
tests/src/printf/hipPrintfManyWaves.cpp
krishoza/HIP
f83315ac3b62801c61098e7f2604ce07e79b633c
[ "MIT" ]
null
null
null
tests/src/printf/hipPrintfManyWaves.cpp
krishoza/HIP
f83315ac3b62801c61098e7f2604ce07e79b633c
[ "MIT" ]
null
null
null
/* Copyright (c) 2020 - present Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* HIT_START * BUILD: %t %s EXCLUDE_HIP_PLATFORM nvidia EXCLUDE_HIP_RUNTIME hcc EXCLUDE_HIP_COMPILER hcc * TEST: %t EXCLUDE_HIP_PLATFORM nvidia EXCLUDE_HIP_RUNTIME hcc EXCLUDE_HIP_COMPILER hcc * HIT_END */ #include "test_common.h" #include "printf_common.h" #include <vector> // Global string constants don't work inside device functions, so we // use a macro to repeat the declaration in host and device contexts. DECLARE_DATA(); __global__ void kernel_mixed0(int *retval) { DECLARE_DATA(); uint tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x; ulong result = 0; // Three strings passed as divergent values to the same hostcall. const char *msg; switch (tid % 3) { case 0: msg = msg_short; break; case 1: msg = msg_long1; break; case 2: msg = msg_long2; break; } retval[tid] = printf("%s\n", msg); } static void test_mixed0(int *retval, uint num_blocks, uint threads_per_block) { CaptureStream captured(stdout); uint num_threads = num_blocks * threads_per_block; for (uint i = 0; i != num_threads; ++i) { retval[i] = 0x23232323; } hipLaunchKernelGGL(kernel_mixed0, dim3(num_blocks), dim3(threads_per_block), 0, 0, retval); hipStreamSynchronize(0); auto CapturedData = captured.getCapturedData(); for (uint ii = 0; ii != num_threads; ++ii) { switch (ii % 3) { case 0: HIPASSERT(retval[ii] == strlen(msg_short) + 1); break; case 1: HIPASSERT(retval[ii] == strlen(msg_long1) + 1); break; case 2: HIPASSERT(retval[ii] == strlen(msg_long2) + 1); break; } } std::map<std::string, int> linecount; for (std::string line; std::getline(CapturedData, line);) { linecount[line]++; } HIPASSERT(linecount.size() == 3); HIPASSERT(linecount[msg_short] == (num_threads + 2) / 3); HIPASSERT(linecount[msg_long1] == (num_threads + 1) / 3); HIPASSERT(linecount[msg_long2] == (num_threads + 0) / 3); } __global__ void kernel_mixed1(int *retval) { DECLARE_DATA(); const uint tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x; // Three strings passed to divergent hostcalls. switch (tid % 3) { case 0: retval[tid] = printf("%s\n", msg_short); break; case 1: retval[tid] = printf("%s\n", msg_long1); break; case 2: retval[tid] = printf("%s\n", msg_long2); break; } } static void test_mixed1(int *retval, uint num_blocks, uint threads_per_block) { CaptureStream captured(stdout); uint num_threads = num_blocks * threads_per_block; for (uint i = 0; i != num_threads; ++i) { retval[i] = 0x23232323; } hipLaunchKernelGGL(kernel_mixed1, dim3(num_blocks), dim3(threads_per_block), 0, 0, retval); hipStreamSynchronize(0); auto CapturedData = captured.getCapturedData(); for (uint ii = 0; ii != num_threads; ++ii) { switch (ii % 3) { case 0: HIPASSERT(retval[ii] == strlen(msg_short) + 1); break; case 1: HIPASSERT(retval[ii] == strlen(msg_long1) + 1); break; case 2: HIPASSERT(retval[ii] == strlen(msg_long2) + 1); break; } } std::map<std::string, int> linecount; for (std::string line; std::getline(CapturedData, line);) { linecount[line]++; } HIPASSERT(linecount.size() == 3); HIPASSERT(linecount[msg_short] == (num_threads + 2) / 3); HIPASSERT(linecount[msg_long1] == (num_threads + 1) / 3); HIPASSERT(linecount[msg_long2] == (num_threads + 0) / 3); } __global__ void kernel_mixed2(int *retval) { DECLARE_DATA(); const uint tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x; // Three different strings. All workitems print all three, but // in different orders. const char *msg[] = {msg_short, msg_long1, msg_long2}; retval[tid] = printf("%s%s%s\n", msg[tid % 3], msg[(tid + 1) % 3], msg[(tid + 2) % 3]); } static void test_mixed2(int *retval, uint num_blocks, uint threads_per_block) { CaptureStream captured(stdout); uint num_threads = num_blocks * threads_per_block; for (uint i = 0; i != num_threads; ++i) { retval[i] = 0x23232323; } hipLaunchKernelGGL(kernel_mixed2, dim3(num_blocks), dim3(threads_per_block), 0, 0, retval); hipStreamSynchronize(0); auto CapturedData = captured.getCapturedData(); for (uint ii = 0; ii != num_threads; ++ii) { HIPASSERT(retval[ii] == strlen(msg_short) + strlen(msg_long1) + strlen(msg_long2) + 1); } std::map<std::string, int> linecount; for (std::string line; std::getline(CapturedData, line);) { linecount[line]++; } std::string str1 = std::string(msg_short) + std::string(msg_long1) + std::string(msg_long2); std::string str2 = std::string(msg_long1) + std::string(msg_long2) + std::string(msg_short); std::string str3 = std::string(msg_long2) + std::string(msg_short) + std::string(msg_long1); HIPASSERT(linecount.size() == 3); HIPASSERT(linecount[str1] == (num_threads + 2) / 3); HIPASSERT(linecount[str2] == (num_threads + 1) / 3); HIPASSERT(linecount[str3] == (num_threads + 0) / 3); } __global__ void kernel_mixed3(int *retval) { DECLARE_DATA(); const uint tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x; int result = 0; result += printf("%s\n", msg_long1); if (tid % 3 == 0) { result += printf("%s\n", msg_short); } result += printf("%s\n", msg_long2); retval[tid] = result; } static void test_mixed3(int *retval, uint num_blocks, uint threads_per_block) { CaptureStream captured(stdout); uint num_threads = num_blocks * threads_per_block; for (uint i = 0; i != num_threads; ++i) { retval[i] = 0x23232323; } hipLaunchKernelGGL(kernel_mixed3, dim3(num_blocks), dim3(threads_per_block), 0, 0, retval); hipStreamSynchronize(0); auto CapturedData = captured.getCapturedData(); for (uint ii = 0; ii != num_threads; ++ii) { if (ii % 3 == 0) { HIPASSERT(retval[ii] == strlen(msg_long1) + strlen(msg_short) + strlen(msg_long2) + 3); } else { HIPASSERT(retval[ii] == strlen(msg_long1) + strlen(msg_long2) + 2); } } std::map<std::string, int> linecount; for (std::string line; std::getline(CapturedData, line);) { linecount[line]++; } HIPASSERT(linecount.size() == 3); HIPASSERT(linecount[msg_long1] == num_threads); HIPASSERT(linecount[msg_long2] == num_threads); HIPASSERT(linecount[msg_short] == (num_threads + 2) / 3); } __global__ void kernel_numbers() { uint tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x; for (uint i = 0; i != 7; ++i) { uint base = tid * 21 + i * 3; printf("%d %d %d\n", base, base + 1, base + 2); } } static void test_numbers(uint num_blocks, uint threads_per_block) { CaptureStream captured(stdout); uint num_threads = num_blocks * threads_per_block; hipLaunchKernelGGL(kernel_numbers, dim3(num_blocks), dim3(threads_per_block), 0, 0); hipStreamSynchronize(0); auto CapturedData = captured.getCapturedData(); std::vector<uint> points; while (true) { uint i; CapturedData >> i; if (CapturedData.fail()) break; points.push_back(i); } std::sort(points.begin(), points.end()); points.erase(std::unique(points.begin(), points.end()), points.end()); HIPASSERT(points.size() == 21 * num_threads); HIPASSERT(points.back() == 21 * num_threads - 1); passed(); } int main(int argc, char **argv) { uint num_blocks = 150; uint threads_per_block = 250; uint num_threads = num_blocks * threads_per_block; void *retval_void; HIPCHECK(hipHostMalloc(&retval_void, 4 * num_threads)); auto retval = reinterpret_cast<int *>(retval_void); test_mixed0(retval, num_blocks, threads_per_block); test_mixed1(retval, num_blocks, threads_per_block); test_mixed2(retval, num_blocks, threads_per_block); test_mixed3(retval, num_blocks, threads_per_block); test_numbers(num_blocks, threads_per_block); passed(); }
30.056291
92
0.67302
[ "vector" ]
666c7707abd13674c977e0dd821369eae63e9e69
10,136
cc
C++
src/moorapi.cc
CHEN-Lin/OpenMoor
f463f586487b9023e7f3678c9d851000558b14d7
[ "Apache-2.0" ]
7
2019-02-10T07:03:45.000Z
2022-03-04T16:09:38.000Z
src/moorapi.cc
CHEN-Lin/OpenMoor
f463f586487b9023e7f3678c9d851000558b14d7
[ "Apache-2.0" ]
null
null
null
src/moorapi.cc
CHEN-Lin/OpenMoor
f463f586487b9023e7f3678c9d851000558b14d7
[ "Apache-2.0" ]
4
2018-03-01T14:34:52.000Z
2018-06-14T12:13:55.000Z
// This file is part of OpenMOOR, an Open-source simulation program for MOORing // systems in offshore renewable energy applications. // // Copyright 2018 Lin Chen <l.chen.tj@gmail.com> & Biswajit Basu <basub@tcd.ie> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //////////////////////////////////////////////////////////////////////////////// #include "moorapi.h" #include "numeric.h" #include "input.h" #include "reader.h" #include "writer.h" #include "solver.h" #include "utility.h" #include "platform.h" #include "mooring.h" #include "moorerror.h" #include "cable.h" #include "node.h" #include <string> #include <fstream> #include <iostream> #include <vector> using namespace std; using namespace moor; //////////////////////////////////////////////////////////////////////////////// /// Create all global objects to be used. //////////////////////////////////////////////////////////////////////////////// ErrorCode err_code = ErrorCode::SUCCESS; ErrorCategory error_domain; Reader reader; Writer writer; Platform platform; Constant constant; vector<StructProperty> struct_properties; vector<HydroProperty> hydro_properties; vector<SeabedProperty> seabed_properties; vector<CableMap> cable_maps; vector<Solver> solvers; vector<Cable> cables; string work_folder; //////////////////////////////////////////////////////////////////////////////// /// Initialization. //////////////////////////////////////////////////////////////////////////////// int DECLDIR initialize(char file_name[]) { string input_file_name(file_name); size_t work_folder_index = input_file_name.find_last_of("/\\"); work_folder = input_file_name.substr(0, work_folder_index + 1); if (struct_properties.size() > 0) struct_properties.clear(); if (hydro_properties.size() > 0) hydro_properties.clear(); if (seabed_properties.size() > 0) seabed_properties.clear(); if (cable_maps.size() > 0) cable_maps.clear(); if (solvers.size() > 0) solvers.clear(); if (cables.size() > 0) cables.clear(); /// The following variables are used only for initialization. RigidBody reference_point; vector<Connection> connections; vector<Current> currents; InputData input_data(&constant, &reference_point, &cable_maps, &connections, &struct_properties, &hydro_properties, &seabed_properties, &currents, &solvers); err_code = reader.read_to(input_data, input_file_name); if (err_code != ErrorCode::SUCCESS) { writer.write_error_message(work_folder+"openmoor.log", err_code, error_domain); return 1; } err_code = input_data.validate(); if (err_code != ErrorCode::SUCCESS) { writer.write_error_message(work_folder+"openmoor.log", err_code, error_domain); return 1; } for (int i=0; i < cable_maps.size(); i++) { Cable cable(cable_maps[i].segment_length.sum(), connections[cable_maps[i].i_connection(0)].position, connections[cable_maps[i].i_connection(1)].position); cables.push_back(cable); } int n_fairlead = cables.size(); // Current requirement. Matrix3Xd fairlead_position; fairlead_position.resize(3, n_fairlead); for (int i=0; i<n_fairlead; i++) { fairlead_position.col(i) = connections[cable_maps[i].i_connection(1)].position; } for (int i=0; i<cables.size(); i++) { cables[i].initialize(cable_maps[i], currents[cable_maps[i].i_current], solvers[cable_maps[i].i_solver], struct_properties, hydro_properties, seabed_properties, constant); } /// Initialize platform position and fairlead number and positions. platform.initialize(reference_point.position, n_fairlead, fairlead_position, cables); string cable_file_name; // Output cable states if desired. for (int i=0; i<cables.size(); i++) { if (cables[i].is_saving) { cable_file_name = (work_folder + "cable_" + to_string(i) + "_time_" + to_string(0.0) + ".dat"); writer.write(cable_file_name, cables[i]); } } // Initialize solvers before assign the solver pointer to cables. for (int i=0; i<solvers.size(); i++) solvers[i].initialize(10, 5); // For using Euler Angle formulation. err_code = ErrorCode::SUCCESS; return 0; } //////////////////////////////////////////////////////////////////////////////// /// Time stepping. //////////////////////////////////////////////////////////////////////////////// int DECLDIR update(double* mooring_load, const double displacement[], const double velocity[], const double time, const double dt, const double save_dt) { Vector6d forced_displacement, forced_velocity; for (int i=0; i<6; i++) { forced_displacement(i) = displacement[i]; forced_velocity(i) = velocity[i]; } if (dt < 1E-6) { err_code = ErrorCode::TIME_STEP_TOO_SMALL; } else { err_code = platform.solve_mooring_load(forced_displacement, forced_velocity, time, dt, cables); } for (int i=0; i<6; i++) mooring_load[i] = platform.get_mooring_load(i); if (err_code != ErrorCode::SUCCESS && err_code != ErrorCode::TIME_STEP_TOO_SMALL) { writer.write_error_message(work_folder+"openmoor.log", err_code, error_domain); return 1; } // Output cable states if desired. double s_dt = save_dt > dt ? save_dt : dt; string cable_file_name; for (int i=0; i < cables.size(); i++) { if (cables[i].is_saving && fabs(remainder(time, s_dt)) < 1E-4) { cable_file_name = (work_folder + "cable_" + to_string(i) + "_time_" + to_string(time) + ".dat"); writer.write(cable_file_name, cables[i]); } } return 0; } //////////////////////////////////////////////////////////////////////////////// /// Finish and clear all objects. //////////////////////////////////////////////////////////////////////////////// int DECLDIR finish(void) { if (struct_properties.size() > 0) struct_properties.clear(); if (hydro_properties.size() > 0) hydro_properties.clear(); if (seabed_properties.size() > 0) seabed_properties.clear(); if (cable_maps.size() > 0) cable_maps.clear(); if (solvers.size() > 0) solvers.clear(); if (cables.size() > 0) cables.clear(); return 0; } //////////////////////////////////////////////////////////////////////////////// /// Get mooring load component. //////////////////////////////////////////////////////////////////////////////// double DECLDIR get_mooring_load(const int i_component) { if (i_component >=0 && i_component <6) return platform.get_mooring_load(i_component); else return NAN; } //////////////////////////////////////////////////////////////////////////////// /// Check reference point velocity. //////////////////////////////////////////////////////////////////////////////// double DECLDIR get_reference_point_displacement(const int i_component) { if (i_component >=0 && i_component <6) return platform.get_displacement(i_component); else return NAN; } //////////////////////////////////////////////////////////////////////////////// /// Check reference point velocity. //////////////////////////////////////////////////////////////////////////////// double DECLDIR get_reference_point_velocity(const int i_component) { if (i_component >=0 && i_component <6) return platform.get_velocity(i_component); else return NAN; } //////////////////////////////////////////////////////////////////////////////// /// Get cable total force at fairlead. //////////////////////////////////////////////////////////////////////////////// double DECLDIR get_cable_fairlead_force(const int i_cable) { if (i_cable >= 0 && i_cable < cables.size()) return cables[i_cable].get_total_fairlead_force(); else return NAN; } //////////////////////////////////////////////////////////////////////////////// /// Get cable total force at anchor. //////////////////////////////////////////////////////////////////////////////// double DECLDIR get_cable_anchor_force(const int i_cable) { if (i_cable >= 0 && i_cable < cables.size()) return cables[i_cable].get_total_anchor_force(); else return NAN; } //////////////////////////////////////////////////////////////////////////////// /// Get total nodal force at a node of a cable. //////////////////////////////////////////////////////////////////////////////// double DECLDIR get_cable_nodal_force(const int i_cable, const int i_node) { if (i_cable >= 0 && i_cable < cables.size()) return cables[i_cable].get_total_nodal_force(i_node); else return NAN; }
33.232787
80
0.505229
[ "vector" ]
667098ee5c8a6fa79a6cc13acb95459789f60a2e
11,196
hpp
C++
include/amtrs/.inc/node-scheduler_component.hpp
isaponsoft/libamtrs
5adf821ee15592fc3280985658ca8a4b175ffcaa
[ "BSD-2-Clause-FreeBSD" ]
1
2019-12-10T02:12:49.000Z
2019-12-10T02:12:49.000Z
include/amtrs/.inc/node-scheduler_component.hpp
isaponsoft/libamtrs
5adf821ee15592fc3280985658ca8a4b175ffcaa
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
include/amtrs/.inc/node-scheduler_component.hpp
isaponsoft/libamtrs
5adf821ee15592fc3280985658ca8a4b175ffcaa
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
/* Copyright (c) 2019, isaponsoft (Isao Shibuya) All rights reserved. * * Use of this source code is governed by a BSD-style license that * * can be found in the LICENSE file. */ #ifndef __libamtrs__node__component__scheduler_component__hpp #define __libamtrs__node__component__scheduler_component__hpp AMTRS_NAMESPACE_BEGIN namespace component { AMTRS_IMPLEMENTS_BEGIN(schedule_component) template<class...> struct schedule_data; // Prototype. Not use. AMTRS_IMPLEMENTS_END(schedule_component) template<class...> class scheduler_component; // Prototype. Not use. template<class...> class schede_dispatcher; // Prototype. Not use. // **************************************************************************** //! スケジューラを管理します。 // ---------------------------------------------------------------------------- template<class NodeT, class R, class... Args> class scheduler_component<NodeT, R(Args...)> { using _this_type = scheduler_component<NodeT, R(Args...)>; public: using schedule_type = AMTRS_IMPLEMENTS(schedule_component)::schedule_data<NodeT, R(Args...)>; using schede_dispatcher_type = schede_dispatcher<NodeT, R(Args...)>; static constexpr std::size_t nolimit = static_cast<std::size_t>(-1); schede_dispatcher_type* get_scheduler() const noexcept { return mRootScheduler; } static void update(NodeT* _root, Args... _args) { if (!_root) { return; } if (!_root->get_scheduler()) { _root->set_scheduler(new schede_dispatcher_type()); } _root->get_scheduler()->execute(std::forward<Args>(_args)...); } scheduler_component() { } ~scheduler_component() { unschedule_all(); } // ======================================================================== //! スケジュールを登録します。 // ------------------------------------------------------------------------ template<class Callback> void schedule(Callback&& _callback) { schedule(this, nolimit, std::forward<Callback>(_callback)); } // ======================================================================== //! 1度だけ実行されるスケジュールを登録します。 // ------------------------------------------------------------------------ template<class Callback> void schedule_once(Callback&& _callback) { schedule(this, 1, std::forward<Callback>(_callback)); } // ======================================================================== //! 削除用のキーを指定してスケジュールを登録します。 // ------------------------------------------------------------------------ template<class KeyT, class Callback> void schedule(const KeyT& _unscheduleKey, Callback&& _callback) { schedule(_unscheduleKey, nolimit, std::forward<Callback>(_callback)); } // ======================================================================== //! 削除用のキーとリピート回数を指定してスケジュールを登録します。 // ------------------------------------------------------------------------ template<class KeyT, class Callback> void schedule(const KeyT& _unscheduleKey, std::size_t _repeatCount, Callback&& _callback) { using type = AMTRS_IMPLEMENTS(schedule_component)::schedule_data<NodeT, KeyT, Callback, R(Args...)>; ref<type> s = new type(this, _unscheduleKey, _repeatCount, std::forward<Callback>(_callback)); mSchedules.push_back(s); if (mRootScheduler) { mRootScheduler->schedule(s); } } // ======================================================================== //! 削除用のキーを指定し、キーが一致するスケジュールを削除します。 // ------------------------------------------------------------------------ template<class KeyT> std::size_t unschedule(const KeyT& _key) { std::size_t usCount = 0; for (auto it = mSchedules.begin(); it != mSchedules.end(); ) { if ((*it)->is_enable() && (*it)->template is_equals<KeyT>(_key)) { (*it)->disable(); if (mRootScheduler) { mRootScheduler->unschedule((*it)); } it = mSchedules.erase(it); ++usCount; } else { ++it; } } return usCount; } // ======================================================================== //! 削除用のキーの型を指定し、キーの型が一致するスケジュールを全て削除します。 // ------------------------------------------------------------------------ template<class KeyT> std::size_t unschedule_for_type() { std::size_t usCount = 0; for (auto it = mSchedules.begin(); it != mSchedules.end(); ) { if ((*it)->is_enable() && (*it)->template is_type<KeyT>()) { (*it)->disable(); if (mRootScheduler) { mRootScheduler->unschedule((*it)); } it = mSchedules.erase(it); ++usCount; } else { ++it; } } return usCount; } // ======================================================================== //! スケジュールを全て削除します。 // ------------------------------------------------------------------------ void unschedule_all() { for (auto& e : mSchedules) { e->disable(); if (mRootScheduler) { mRootScheduler->unschedule(e); } } mSchedules.clear(); } // ======================================================================== //! スケジュールを全て削除します。 // ------------------------------------------------------------------------ void unschedule(schedule_type* _schedule) { if (mRootScheduler) { mRootScheduler->unschedule(_schedule); } mSchedules.remove_if([_schedule](schedule_type* _s) { return _s == _schedule; }); } void set_scheduler(schede_dispatcher_type* _scheduler) { if (_scheduler) { if (mRootScheduler != _scheduler) { mRootScheduler = _scheduler; on_enter(); } } else { if (mRootScheduler) { on_exit(); mRootScheduler = nullptr; } } } protected: virtual void on_enter() { for (schedule_type* s : mSchedules) { if (s && s->is_enable()) { mRootScheduler->schedule(s); } } static_cast<NodeT*>(this)->visit_children([this](auto c) { c->set_scheduler(mRootScheduler); return false; }, false); } virtual void on_exit() { static_cast<NodeT*>(this)->visit_children([](auto c) { c->set_scheduler(nullptr); return false; }, false); for (schedule_type* s : mSchedules) { mRootScheduler->unschedule(s); } } private: schede_dispatcher_type* mRootScheduler = nullptr; std::list<ref<schedule_type>> mSchedules; }; template<class NodeT, class R, class... Args> class schede_dispatcher<NodeT, R(Args...)> : public ref_object { using schedule_type = AMTRS_IMPLEMENTS(schedule_component)::schedule_data<NodeT, R(Args...)>; public: void execute(Args... _args) { auto it = mSchedulerList.begin(); for (;;) { while (it != mSchedulerList.end()) { if (!(*it).empty() && (*it)->is_enable()) { // 有効なスケジュールを発見したので実行する (*it)->execute(std::forward<Args>(_args)...); if (!(*it).empty() && (*it)->is_enable()) { // リピートカウントが設定されているならリピートカウントを低下 if ((*it)->mRepeat > 0) { --((*it)->mRepeat); } if ((*it)->mRepeat != 0) { ++it; continue; } } } // スケジュールが無効になっているのでリストから削除 if (!(*it).empty()) { (*it)->mOwner->unschedule((*it).get()); } it = mSchedulerList.erase(it); } // 新しいスケジュールた追加されていればスケジュールの最後尾に追加 std::lock_guard<safe_spinlock> g(get_sync_object()); if (mNewSchedules.empty()) { break; } auto position = std::distance(mSchedulerList.begin(), it); mSchedulerList.reserve(mSchedulerList.size() + mNewSchedules.size()); for (auto& ns : mNewSchedules) { mSchedulerList.push_back(std::move(ns)); } mNewSchedules.clear(); it = mSchedulerList.begin() + position; } } private: void schedule(schedule_type* _scheduler) { std::lock_guard<safe_spinlock> g(get_sync_object()); mNewSchedules.push_back({_scheduler}); } void unschedule(schedule_type* _scheduler) { std::lock_guard<safe_spinlock> g(get_sync_object()); for (auto& e : mSchedulerList) { if (e == _scheduler) { e = nullptr; } } mNewSchedules.remove(_scheduler); } static safe_spinlock& get_sync_object() { static safe_spinlock s; return s; } std::vector<ref<schedule_type>> mSchedulerList; std::list<ref<schedule_type>> mNewSchedules; template<class...> friend class scheduler_component; }; AMTRS_IMPLEMENTS_BEGIN(schedule_component) // **************************************************************************** // スケジュール本体 // **************************************************************************** template<class NodeT, class R, class... Args> struct schedule_data<NodeT, R(Args...)> : public ref_object { using type_index_type = std::type_index; using result_type = R; using schedule_type = schedule_data<NodeT, R(Args...)>; using scheduler_type = scheduler_component<NodeT, R(Args...)>; static constexpr std::size_t nolimit = static_cast<std::size_t>(-1); schedule_data(scheduler_type* _owner, type_index_type _ti, std::size_t _limit = nolimit) : mOwner(_owner) , mTypeIndex(_ti) , mRepeat(_limit) {} template<class KeyT> bool is_type() const noexcept { return (mTypeIndex == typeid(KeyT)) ? true : false; } template<class KeyT> bool is_equals(const KeyT& _key) const noexcept; bool is_enable() const noexcept { return mEnable && ((mRepeat == nolimit) || mRepeat > 0); } void disable() noexcept { mEnable = false; } virtual R execute(Args...) const noexcept = 0; scheduler_type* mOwner = nullptr; schedule_type* mNextEntry = nullptr; type_index_type mTypeIndex; std::size_t mRepeat = nolimit; bool mEnable = true; template<class...> friend class schede_dispatcher; }; template<class NodeT, class KeyT, class R, class... Args> struct schedule_data<NodeT, KeyT, R(Args...)> : public schedule_data<NodeT, R(Args...)> { using _base_type = schedule_data<NodeT, R(Args...)>; using scheduler_type = typename _base_type::scheduler_type; schedule_data(scheduler_type* _owner, const KeyT& _key, std::size_t _repeat) : _base_type(_owner, typeid(KeyT), _repeat) , mKey(_key) {} KeyT mKey; template<class...> friend class schede_dispatcher; }; template<class NodeT, class KeyT, class Callback, class R, class... Args> struct schedule_data<NodeT, KeyT, Callback, R(Args...)> : public schedule_data<NodeT, KeyT, R(Args...)> { using _base_type = schedule_data<NodeT, KeyT, R(Args...)>; using scheduler_type = typename _base_type::scheduler_type; schedule_data(scheduler_type* _owner, const KeyT& _key, std::size_t _repeat, Callback&& _callback) : _base_type(_owner, _key, _repeat) , mCallback(std::forward<Callback>(_callback)) {} virtual R execute(Args... _args) const noexcept { if constexpr (can_invoke<Callback, Args...>::value) { return mCallback(std::forward<Args>(_args)...); } else { mCallback(); return R(); } } Callback mCallback; template<class...> friend class schede_dispatcher; }; template<class NodeT, class R, class... Args> template<class KeyT> bool schedule_data<NodeT, R(Args...)>::is_equals(const KeyT& _key) const noexcept { using key_type = schedule_data<NodeT, KeyT, R(Args...)>; auto* thiz = static_cast<const key_type*>(this); return ((mTypeIndex == typeid(KeyT)) && (thiz->mKey == _key)) ? true : false; } AMTRS_IMPLEMENTS_END(schedule_component) } AMTRS_NAMESPACE_END #endif
23.872068
103
0.577438
[ "vector" ]
6675b3661e58da74dbfdccc13fa8f01c75480ebc
12,645
cpp
C++
DemoGame/Models/CaveModelPart1.cpp
WizardIke/SpectralEngine
8a5e9fb1542220de063ec59fcf34f40a38308fbc
[ "MIT" ]
3
2018-10-03T21:49:21.000Z
2019-08-16T03:22:32.000Z
DemoGame/Models/CaveModelPart1.cpp
WizardIke/SpectralEngine
8a5e9fb1542220de063ec59fcf34f40a38308fbc
[ "MIT" ]
38
2018-08-28T23:08:09.000Z
2019-10-11T10:12:59.000Z
DemoGame/Models/CaveModelPart1.cpp
WizardIke/SpectralEngine
8a5e9fb1542220de063ec59fcf34f40a38308fbc
[ "MIT" ]
1
2020-08-16T01:22:43.000Z
2020-08-16T01:22:43.000Z
#include "CaveModelPart1.h" #include <Mesh.h> #include <EulerRotation.h> #include <Quaternion.h> #include <Frustum.h> void CaveModelPart1::setConstantBuffers(D3D12_GPU_VIRTUAL_ADDRESS& constantBufferGpuAddress, unsigned char*& constantBufferCpuAddress) { gpuBuffer = constantBufferGpuAddress; constantBufferGpuAddress += vSPerObjectConstantBufferAlignedSize * numSquares + pSPerObjectConstantBufferAlignedSize; VSPerObjectConstantBuffer* vsPerObjectCBVCpuAddress = reinterpret_cast<VSPerObjectConstantBuffer*>(constantBufferCpuAddress); constantBufferCpuAddress += vSPerObjectConstantBufferAlignedSize * numSquares; DirectionalLightMaterialPS* psPerObjectCBVCpuAddress = reinterpret_cast<DirectionalLightMaterialPS*>(constantBufferCpuAddress); constantBufferCpuAddress += pSPerObjectConstantBufferAlignedSize; auto vsWorldMatrix = vsPerObjectCBVCpuAddress; Quaternion rotaion(EulerRotation(0.0f, 0.75f * pi, 0.0f)); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX, positionY, positionZ, 0.0f)); rotaion = Quaternion(EulerRotation(0.0f, -0.75f * pi, pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX, positionY + 13.0f, positionZ + 10.0f, 0.0f)); rotaion = Quaternion(EulerRotation(0.75f * pi, 0.0f, 0.5f * pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX + 10.0f, positionY + 5.0f, positionZ + 5.0f, 0.0f)); rotaion = Quaternion(EulerRotation(0.75f * pi, 0.0f, -0.5f * pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX - 10.0f, positionY + 5.0f, positionZ + 5.0f, 0.0f)); rotaion = Quaternion(EulerRotation(0.0f, 0.75f * pi, 0.0f)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX, positionY - 14.14213562f, positionZ + 14.14213562f, 0.0f)); rotaion = Quaternion(EulerRotation(0.0f, -0.75f * pi, pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX, positionY - 1.14213562f, positionZ + 24.14213562f, 0.0f)); rotaion = Quaternion(EulerRotation(0.75f * pi, 0.0f, 0.5f * pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX + 10.0f, positionY - 9.14213562f, positionZ + 19.14213562f, 0.0f)); rotaion = Quaternion(EulerRotation(0.75f * pi, 0.0f, -0.5f * pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX - 10.0f, positionY - 9.14213562f, positionZ + 19.14213562f, 0.0f)); rotaion = Quaternion(EulerRotation(0.0f, 0.5f * pi, 0.0f)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX, positionY - 21.21320344f, positionZ + 30.0f, 0.0f)); rotaion = Quaternion(EulerRotation(0.0f, -0.5f * pi, pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX, positionY - 8.21320344f, positionZ + 41.2f, 0.0f)); rotaion = Quaternion(EulerRotation(0.5f * pi, 0.0f, 0.5f * pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX + 10.0f, positionY - 16.21320344f, positionZ + 30.0f, 0.0f)); rotaion = Quaternion(EulerRotation(0.5f * pi, 0.0f, -0.5f * pi)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); vsWorldMatrix->worldMatrix = DirectX::XMMatrixAffineTransformation(DirectX::XMVectorSet(10.0f, 10.0f, 10.0f, 1.0f), DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f), DirectX::XMVectorSet(rotaion.x, rotaion.y, rotaion.z, rotaion.w), DirectX::XMVectorSet(positionX - 10.0f, positionY - 16.21320344f, positionZ + 30.0f, 0.0f)); vsWorldMatrix = reinterpret_cast<VSPerObjectConstantBuffer*>(reinterpret_cast<unsigned char*>(vsWorldMatrix) + vSPerObjectConstantBufferAlignedSize); psPerObjectCBVCpuAddress->specularColor = { 0.5f , 0.5f , 0.5f }; psPerObjectCBVCpuAddress->specularPower = 4.0f; } void CaveModelPart1::render(ID3D12GraphicsCommandList* const directCommandList) { directCommandList->IASetVertexBuffers(0u, 1u, &mesh->vertexBufferView); directCommandList->IASetIndexBuffer(&mesh->indexBufferView); directCommandList->SetGraphicsRootConstantBufferView(3u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * numSquares); //needs to draw instances const auto indexCount = mesh->indexCount(); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 2u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 3u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 4u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 5u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 6u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 7u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 8u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 9u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 10u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 11u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); } void CaveModelPart1::renderVirtualFeedback(ID3D12GraphicsCommandList* const directCommandList) { directCommandList->IASetVertexBuffers(0u, 1u, &mesh->vertexBufferView); directCommandList->IASetIndexBuffer(&mesh->indexBufferView); //needs to draw instances const auto indexCount = mesh->indexCount(); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 2u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 3u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 4u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 5u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 6u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 7u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 8u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 9u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 10u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); directCommandList->SetGraphicsRootConstantBufferView(2u, gpuBuffer + vSPerObjectConstantBufferAlignedSize * 11u); directCommandList->DrawIndexedInstanced(indexCount, 1u, 0u, 0, 0u); } bool CaveModelPart1::isInView(const Frustum& Frustum) { return Frustum.checkCuboid2(positionX + 5.0f, positionY + 20.0f, positionZ + 84.0f, positionX - 5.0f, positionY - 15.0f, positionZ - 44.0f); }
69.098361
228
0.796995
[ "mesh", "render" ]
6676745e23cb8ac77b79e1529408b296cb76371f
8,870
cpp
C++
windows/pw6e.official/CPlusPlus/Chapter17/FingerPaint/FingerPaint/MainPage.Share.cpp
nnaabbcc/exercise
255fd32b39473b3d0e7702d4b1a8a97bed2a68f8
[ "MIT" ]
1
2016-11-23T08:18:08.000Z
2016-11-23T08:18:08.000Z
windows/pw6e.official/CPlusPlus/Chapter17/FingerPaint/FingerPaint/MainPage.Share.cpp
nnaabbcc/exercise
255fd32b39473b3d0e7702d4b1a8a97bed2a68f8
[ "MIT" ]
null
null
null
windows/pw6e.official/CPlusPlus/Chapter17/FingerPaint/FingerPaint/MainPage.Share.cpp
nnaabbcc/exercise
255fd32b39473b3d0e7702d4b1a8a97bed2a68f8
[ "MIT" ]
1
2016-11-23T08:17:34.000Z
2016-11-23T08:17:34.000Z
#include "pch.h" #include "MainPage.xaml.h" using namespace FingerPaint; using namespace Concurrency; using namespace Platform; using namespace Windows::ApplicationModel::DataTransfer; using namespace Windows::Foundation; using namespace Windows::Graphics::Imaging; using namespace Windows::Storage::Streams; using namespace Windows::System; using namespace Windows::UI::Core; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Media::Imaging; void MainPage::InitializeSharing() { // Initialize the Past button and provide for updates CheckForPasteEnable(); Clipboard::ContentChanged += ref new EventHandler<Object^>(this, &MainPage::OnClipboardContentChanged); // Watch for accelerator keys for Copy and Paste Window::Current->CoreWindow->Dispatcher->AcceleratorKeyActivated += ref new TypedEventHandler<CoreDispatcher^, AcceleratorKeyEventArgs^>(this, &MainPage::OnAcceleratorKeyActivated); // Hook into the Share pane for providing data DataTransferManager::GetForCurrentView()->DataRequested += ref new TypedEventHandler<DataTransferManager^, DataRequestedEventArgs^>(this, &MainPage::OnDataTransferDataRequested); } void MainPage::OnDataTransferDataRequested(DataTransferManager^ sender, DataRequestedEventArgs^ args) { DataRequestDeferral^ deferral = args->Request->GetDeferral(); // Get a stream reference and hand it over task<RandomAccessStreamReference^> getBitmapTask = create_task(GetBitmapStream(bitmap)); getBitmapTask.then([args, deferral] (RandomAccessStreamReference^ streamRef) { args->Request->Data->SetBitmap(streamRef); args->Request->Data->Properties->Title = "Finger Paint"; args->Request->Data->Properties->Description = "Share this painting with another app"; deferral->Complete(); }); } void MainPage::OnClipboardContentChanged(Object^ sender, Object^ args) { CheckForPasteEnable(); } void MainPage::CheckForPasteEnable() { pasteAppBarButton->IsEnabled = CheckClipboardForBitmap(); } bool MainPage::CheckClipboardForBitmap() { DataPackageView^ dataView = Clipboard::GetContent(); return dataView->Contains(StandardDataFormats::Bitmap); } void MainPage::OnCopyAppBarButtonClick(Object^ sender, RoutedEventArgs^ args) { task<RandomAccessStreamReference^> getBitmapTask = create_task(GetBitmapStream(bitmap)); getBitmapTask.then([this] (RandomAccessStreamReference^ streamRef) { DataPackage^ dataPackage = ref new DataPackage(); dataPackage->RequestedOperation = DataPackageOperation::Move; dataPackage->SetBitmap(streamRef); Clipboard::SetContent(dataPackage); this->BottomAppBar->IsOpen = false; }); } task<RandomAccessStreamReference^> MainPage::GetBitmapStream(WriteableBitmap^ bitmap) { // Create a BitmapEncoder associated with a memory stream InMemoryRandomAccessStream^ memoryStream = ref new InMemoryRandomAccessStream(); task<BitmapEncoder^> createEncoderTask = create_task(BitmapEncoder::CreateAsync(BitmapEncoder::PngEncoderId, memoryStream)); return createEncoderTask.then([this, bitmap, memoryStream] (BitmapEncoder^ encoder) { // Create a pixels array for this bitmap int length = 4 * bitmap->PixelWidth * bitmap->PixelHeight; Array<byte>^ arrPixels = ref new Array<byte>(pixels, length); // Set the pixels into that encoder encoder->SetPixelData(BitmapPixelFormat::Bgra8, BitmapAlphaMode::Premultiplied, (unsigned int)bitmap->PixelWidth, (unsigned int)bitmap->PixelHeight, 96, 96, arrPixels); task<void> flushEncoderTask = create_task(encoder->FlushAsync()); return flushEncoderTask.then([memoryStream] () { return RandomAccessStreamReference::CreateFromStream(memoryStream); }); }); } void MainPage::OnPasteAppBarButtonClick(Platform::Object^ sender, RoutedEventArgs^ args) { // Temporarily disable the Paste button pasteAppBarButton->IsEnabled = false; // Get the Clipboard contents and check for a bitmap DataPackageView^ dataView = Clipboard::GetContent(); if (dataView->Contains(StandardDataFormats::Bitmap)) { // Get the stream reference and a stream task<RandomAccessStreamReference^> getBitmapTask = create_task(dataView->GetBitmapAsync()); getBitmapTask.then([this] (RandomAccessStreamReference^ streamRef) { task<IRandomAccessStreamWithContentType^> openReadTask = create_task(streamRef->OpenReadAsync()); openReadTask.then([this] (IRandomAccessStreamWithContentType^ stream) { task<BitmapDecoder^> createDecoderTask = create_task(BitmapDecoder::CreateAsync(stream)); createDecoderTask.then([this] (BitmapDecoder^ decoder) { task<BitmapFrame^> getFrameTask = create_task(decoder->GetFrameAsync(0)); getFrameTask.then([this] (BitmapFrame^ bitmapFrame) { // Save information for creating WriteableBitmap pastedPixelWidth = (int)bitmapFrame->PixelWidth; pastedPixelHeight = (int)bitmapFrame->PixelHeight; task<PixelDataProvider^> getDataTask = create_task(bitmapFrame->GetPixelDataAsync(BitmapPixelFormat::Bgra8, BitmapAlphaMode::Premultiplied, ref new BitmapTransform(), ExifOrientationMode::RespectExifOrientation, ColorManagementMode::ColorManageToSRgb)); getDataTask.then([this] (PixelDataProvider^ pixelProvider) { // Save information sufficient for creating WriteableBitmap pastedPixels = pixelProvider->DetachPixelData(); // Check if it's OK to replace the current painting task<void> checkOkToTrashTask = create_task(CheckIfOkToTrashFile(&MainPage::FinishPasteBitmapAndPixelArray)); checkOkToTrashTask.then([this] () { // Re-enable the button and close th app bar pasteAppBarButton->IsEnabled = true; this->BottomAppBar->IsOpen = false; }, task_continuation_context::use_current()); }); }); }); }); }); } } Concurrency::task<void> MainPage::FinishPasteBitmapAndPixelArray() { bitmap = ref new WriteableBitmap(pastedPixelWidth, pastedPixelHeight); InitializeBitmap(); // Transfer pixels to bitmap int length = 4 * pastedPixelWidth * pastedPixelHeight; for (int i = 0; i < length; i++) pixels[i] = pastedPixels[i]; pastedPixels = nullptr; // Set AppSettings properties for new image appSettings->LoadedFilePath = nullptr; appSettings->LoadedFilename = nullptr; appSettings->IsImageModified = false; return task<void>([] () {}); } void MainPage::OnAcceleratorKeyActivated(CoreDispatcher^ sender, AcceleratorKeyEventArgs^ args) { if ((args->EventType == CoreAcceleratorKeyEventType::SystemKeyDown || args->EventType == CoreAcceleratorKeyEventType::KeyDown) && (args->VirtualKey == VirtualKey::C || args->VirtualKey == VirtualKey::V)) { CoreWindow^ window = Window::Current->CoreWindow; CoreVirtualKeyStates down = CoreVirtualKeyStates::Down; // Only want case where Ctrl is down if ((window->GetKeyState(VirtualKey::Shift) & down) == down || (window->GetKeyState(VirtualKey::Control) & down) != down || (window->GetKeyState(VirtualKey::Menu) & down) == down) { return; } if (args->VirtualKey == VirtualKey::C) { OnCopyAppBarButtonClick(nullptr, nullptr); } else if (args->VirtualKey == VirtualKey::V) { OnPasteAppBarButtonClick(pasteAppBarButton, nullptr); } } }
42.440191
138
0.616911
[ "object" ]
667bfb99c9a0786308a53ece88485beb757eea01
14,367
cpp
C++
src/cl.cpp
alexd2580/hBalls
1b29c630968d9a9bcfecbb1fc90ee30cb016a411
[ "MIT" ]
1
2015-12-31T13:48:18.000Z
2015-12-31T13:48:18.000Z
src/cl.cpp
alexd2580/hBalls
1b29c630968d9a9bcfecbb1fc90ee30cb016a411
[ "MIT" ]
null
null
null
src/cl.cpp
alexd2580/hBalls
1b29c630968d9a9bcfecbb1fc90ee30cb016a411
[ "MIT" ]
null
null
null
#include "cl.hpp" #include <iostream> #include <cstdlib> #include <fstream> using namespace std; bool load_file(string const& name, string& content) { // We create the file object, saying I want to read it fstream file(name.c_str(), fstream::in); // We verify if the file was successfully opened if(file.is_open()) { // We use the standard getline function to read the file into // a std::string, stoping only at "\0" getline(file, content, '\0'); // We return the success of the operation return !file.bad(); } // The file was not successfully opened, so returning false return false; } namespace OpenCL { cl_int error; __attribute__((const)) char const* translate_cl_error(cl_int err) { #define ERRORCASE(e) \ case e: \ return #e; switch(err) { ERRORCASE(CL_SUCCESS) ERRORCASE(CL_DEVICE_NOT_FOUND) ERRORCASE(CL_DEVICE_NOT_AVAILABLE) ERRORCASE(CL_COMPILER_NOT_AVAILABLE) ERRORCASE(CL_MEM_OBJECT_ALLOCATION_FAILURE) ERRORCASE(CL_OUT_OF_RESOURCES) ERRORCASE(CL_OUT_OF_HOST_MEMORY) ERRORCASE(CL_PROFILING_INFO_NOT_AVAILABLE) ERRORCASE(CL_MEM_COPY_OVERLAP) ERRORCASE(CL_IMAGE_FORMAT_MISMATCH) ERRORCASE(CL_IMAGE_FORMAT_NOT_SUPPORTED) ERRORCASE(CL_BUILD_PROGRAM_FAILURE) ERRORCASE(CL_MAP_FAILURE) ERRORCASE(CL_MISALIGNED_SUB_BUFFER_OFFSET) ERRORCASE(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST) ERRORCASE(CL_COMPILE_PROGRAM_FAILURE) ERRORCASE(CL_LINKER_NOT_AVAILABLE) ERRORCASE(CL_LINK_PROGRAM_FAILURE) ERRORCASE(CL_DEVICE_PARTITION_FAILED) ERRORCASE(CL_KERNEL_ARG_INFO_NOT_AVAILABLE) ERRORCASE(CL_INVALID_VALUE) ERRORCASE(CL_INVALID_DEVICE_TYPE) ERRORCASE(CL_INVALID_PLATFORM) ERRORCASE(CL_INVALID_DEVICE) ERRORCASE(CL_INVALID_CONTEXT) ERRORCASE(CL_INVALID_QUEUE_PROPERTIES) ERRORCASE(CL_INVALID_COMMAND_QUEUE) ERRORCASE(CL_INVALID_HOST_PTR) ERRORCASE(CL_INVALID_MEM_OBJECT) ERRORCASE(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR) ERRORCASE(CL_INVALID_IMAGE_SIZE) ERRORCASE(CL_INVALID_SAMPLER) ERRORCASE(CL_INVALID_BINARY) ERRORCASE(CL_INVALID_BUILD_OPTIONS) ERRORCASE(CL_INVALID_PROGRAM) ERRORCASE(CL_INVALID_PROGRAM_EXECUTABLE) ERRORCASE(CL_INVALID_KERNEL_NAME) ERRORCASE(CL_INVALID_KERNEL_DEFINITION) ERRORCASE(CL_INVALID_KERNEL) ERRORCASE(CL_INVALID_ARG_INDEX) ERRORCASE(CL_INVALID_ARG_VALUE) ERRORCASE(CL_INVALID_ARG_SIZE) ERRORCASE(CL_INVALID_KERNEL_ARGS) ERRORCASE(CL_INVALID_WORK_DIMENSION) ERRORCASE(CL_INVALID_WORK_GROUP_SIZE) ERRORCASE(CL_INVALID_WORK_ITEM_SIZE) ERRORCASE(CL_INVALID_GLOBAL_OFFSET) ERRORCASE(CL_INVALID_EVENT_WAIT_LIST) ERRORCASE(CL_INVALID_EVENT) ERRORCASE(CL_INVALID_OPERATION) ERRORCASE(CL_INVALID_GL_OBJECT) ERRORCASE(CL_INVALID_BUFFER_SIZE) ERRORCASE(CL_INVALID_MIP_LEVEL) ERRORCASE(CL_INVALID_GLOBAL_WORK_SIZE) ERRORCASE(CL_INVALID_PROPERTY) ERRORCASE(CL_INVALID_IMAGE_DESCRIPTOR) ERRORCASE(CL_INVALID_COMPILER_OPTIONS) ERRORCASE(CL_INVALID_LINKER_OPTIONS) ERRORCASE(CL_INVALID_DEVICE_PARTITION_COUNT) default: return "undefined"; } } OpenCLException::OpenCLException(cl_int err, string& msg) : error(err), message(msg) { } void OpenCLException::print(void) { cerr << "[OpenCL] Error " << translate_cl_error(error) << " := " << error << endl << "\t" << message << endl; } /******************************************************************************/ /******************************************************************************/ Environment::Environment(unsigned int platform_num, cl_device_type dev_type) { cout << "[OpenCL] Initializing." << endl; vector<cl::Platform> platforms; error = cl::Platform::get(&platforms); if(error != CL_SUCCESS) { string msg("Could not get platforms."); throw OpenCLException(error, msg); } int int_i = 0; for(auto i = platforms.begin(); i != platforms.end(); i++) { cout << "[OpenCL] Platform " << int_i << ":" << endl; print_platform_info_(*i, CL_PLATFORM_VERSION); print_platform_info_(*i, CL_PLATFORM_NAME); print_platform_info_(*i, CL_PLATFORM_VENDOR); print_platform_info_(*i, CL_PLATFORM_EXTENSIONS); int_i++; } // SELECT CPU VS GPU HERE!!!! if(platform_num >= platforms.size()) { string msg("Invalid platform number: " + std::to_string(platform_num)); throw OpenCLException(0, msg); } m_platform = platforms[platform_num]; list_devices(m_devices, m_platform, dev_type); m_context = cl::Context(m_devices, nullptr, nullptr, nullptr, &error); if(error != CL_SUCCESS) { string msg("Could not create context."); throw OpenCLException(error, msg); } cout << "[OpenCL] Done." << endl; } RemoteBuffer Environment::allocate(size_t byte_size) const { cl::Buffer remote_buffer( m_context, CL_MEM_READ_WRITE | 0, byte_size, nullptr, &error); if(error != CL_SUCCESS) { string msg("Could not create remote buffer of size " + std::to_string(byte_size) + "."); throw OpenCLException(error, msg); } RemoteBuffer rb; rb.size = byte_size; rb.buffer = remote_buffer; return rb; } RemoteBuffer Environment::allocate(size_t byte_size, void* bytes) const { cl::Buffer remote_buffer(m_context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, byte_size, bytes, &error); if(error != CL_SUCCESS) { string msg("Could not create remote buffer of size " + std::to_string(byte_size) + "."); throw OpenCLException(error, msg); } RemoteBuffer rb; rb.size = byte_size; rb.buffer = remote_buffer; return rb; } cl::CommandQueue Environment::create_queue(void) const { cl::CommandQueue queue(m_context, m_devices[0], 0, &error); if(error != CL_SUCCESS) { string msg("Could not create command queue."); throw OpenCLException(error, msg); } return queue; } void writeBufferBlocking(cl::CommandQueue const& queue, RemoteBuffer const& remote, void const* data) { queue.finish(); error = queue.enqueueWriteBuffer( remote.buffer, CL_TRUE, 0, remote.size, data, nullptr, nullptr); if(error != CL_SUCCESS) { string msg("Could not write to buffer."); throw OpenCLException(error, msg); } } void readBufferBlocking(cl::CommandQueue const& queue, RemoteBuffer const& remote, void* data) { queue.finish(); error = queue.enqueueReadBuffer( remote.buffer, CL_TRUE, 0, remote.size, data, nullptr, nullptr); if(error != CL_SUCCESS) { string msg("Could not read from buffer."); throw OpenCLException(error, msg); } } /******************************************************************************/ /******************************************************************************/ Kernel::Kernel(string const& fpath, string const& mname) : file_path(fpath), main_function(mname) { m_kernel = nullptr; m_program = nullptr; } void Kernel::load(Environment const& context) { string kernel_string; if(!load_file(file_path, kernel_string)) { string msg("Could not read file " + file_path + "."); throw OpenCLException(0, msg); } char const* kernel_string_ptr = kernel_string.c_str(); vector<pair<const char*, size_t>> sources; sources.push_back( pair<const char*, size_t>(kernel_string_ptr, kernel_string.size())); m_program = cl::Program(context.m_context, sources, &error); if(error != CL_SUCCESS) { string msg("Could not create program."); throw OpenCLException(error, msg); } } void Kernel::build(Environment const& context) { error = m_program.build(context.m_devices); switch(error) { case CL_SUCCESS: break; case CL_BUILD_PROGRAM_FAILURE: { string log; m_program.getBuildInfo(context.m_devices[0], CL_PROGRAM_BUILD_LOG, &log); string msg("Could not build program " + file_path + ":\n" + log); throw OpenCLException(error, msg); } default: { string msg("Could not build program " + file_path + "."); throw OpenCLException(error, msg); } } } void Kernel::create_kernel(void) { m_kernel = cl::Kernel(m_program, main_function.c_str(), &error); if(error != CL_SUCCESS) { string msg("Could not create kernel."); throw OpenCLException(error, msg); } /*cl_ulong local_mem; error = m_kernel.getWorkGroupInfo(CL_KERNEL_LOCAL_MEM_SIZE, &local_mem); if(error != CL_SUCCESS) { string msg("Could not get kernel local mem size."); throw OpenCLException(error, msg); } cout << "[" << file_path << "] Local mem size: " << (long)local_mem << endl;*/ // pocl ** * ******* ***** ** **** (private mem unimplemented, would fail) /*cl_ulong private_mem; error = clGetKernelWorkGroupInfo(m_kernel, context.device_ids[0], CL_KERNEL_PRIVATE_MEM_SIZE, sizeof(cl_ulong), &private_mem, nullptr); if (error != CL_SUCCESS) { string msg("Could not create kernel private mem size."); throw OpenCLException(error, msg); } cout << "[" << file_path << "] Private memory size: " << private_mem << endl;*/ } void Kernel::make(Environment const& c) { load(c); build(c); create_kernel(); } void Kernel::set_argument(unsigned int nr, RemoteBuffer const& buf) { error = m_kernel.setArg(nr, buf.buffer); if(error != CL_SUCCESS) { string msg("Could not set kernel argument " + std::to_string(nr) + "."); throw OpenCLException(error, msg); } } cl::Event Kernel::enqueue(size_t const width, cl::CommandQueue const& queue) const { cl::Event event; error = queue.enqueueNDRangeKernel(m_kernel, cl::NullRange, cl::NDRange(width, 0, 0), cl::NullRange, // cl::NDRange(width, 0, 0), nullptr, &event); if(error != CL_SUCCESS) { string msg("Could not enqueue kernel."); throw OpenCLException(error, msg); } return event; } cl::Event Kernel::enqueue(size_t const width, size_t const height, cl::CommandQueue const& queue) const { cl::Event event; error = queue.enqueueNDRangeKernel(m_kernel, cl::NDRange(0, 0), cl::NDRange(width, height), cl::NullRange, // cl::NDRange(width, 1), nullptr, &event); if(error != CL_SUCCESS) { string msg("Could not enqueue kernel."); throw OpenCLException(error, msg); } return event; } /******************************************************************************/ /******************************************************************************/ void print_platform_info(cl::Platform const& platform, cl_platform_info const param, string const param_name) { string val; error = platform.getInfo(param, &val); if(error != CL_SUCCESS) { string msg("Could not get parameter " + param_name + "."); throw OpenCLException(error, msg); } cout << "[OpenCL] " << param_name << "=\t" << val << endl; } void list_devices(vector<cl::Device>& devices, cl::Platform const& platform, cl_device_type const type) { cout << "[OpenCL] Listing devices of type " << type << "." << endl; // TODO reverse lookup error = platform.getDevices(type, &devices); if(error != CL_SUCCESS) { string msg("Could not get devices of type (" + std::string("TODO") + ")."); throw OpenCLException(error, msg); } for(auto i = devices.begin(); i != devices.end(); i++) { cout << "[OpenCL] Device:" << endl; print_device_info_(*i, CL_DEVICE_NAME, string); print_device_info_(*i, CL_DEVICE_VENDOR, string); print_device_info_(*i, CL_DEVICE_VERSION, string); print_device_info_(*i, CL_DRIVER_VERSION, string); print_device_info_(*i, CL_DEVICE_OPENCL_C_VERSION, string); print_device_info_(*i, CL_DEVICE_AVAILABLE, cl_bool); print_device_info_(*i, CL_DEVICE_COMPILER_AVAILABLE, cl_bool); print_device_info_(*i, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool); print_device_info_(*i, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong); print_device_info_(*i, CL_DEVICE_ADDRESS_BITS, cl_uint); print_device_info_(*i, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint); print_device_info_(*i, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint); print_device_info_(*i, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint); print_device_info_(*i, CL_DEVICE_MAX_WORK_GROUP_SIZE, size_t); print_device_info_(*i, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint); } cout << endl; } template <typename T> void print_device_info(cl::Device const& device, cl_device_info const param, string const param_name) { T res = get_device_info<T>(device, param, param_name); cout << "[OpenCL] " << param_name << " =\t" << res << endl; } template <typename T> T get_device_info(cl::Device const& device, cl_device_info const param, string const param_name) { T res; error = device.getInfo<T>(param, &res); if(error != CL_SUCCESS) { string msg("Could not get parameter " + param_name + "."); throw OpenCLException(error, msg); } return res; } void waitForEvent(cl_event& e) { error = clWaitForEvents(1, &e); if(error != CL_SUCCESS) { string msg("Waiting for event failed."); throw OpenCLException(error, msg); } } cl_int getEventStatus(cl_event& e) { cl_int stat; error = clGetEventInfo( e, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(cl_int), &stat, NULL); if(error != CL_SUCCESS) { string msg("Could not get event status."); throw OpenCLException(error, msg); } return stat; } }
29.561728
80
0.626784
[ "object", "vector" ]
6681d0e0ec8b1b55117827f1952f17cf7bfc7780
5,995
cpp
C++
src-cpp/server42/src/PacketGenerator.cpp
mfyuce/open-kilda
44f0580c028b8b56aa59536e62003bc416f07180
[ "Apache-2.0" ]
70
2017-10-10T12:59:21.000Z
2022-03-16T13:19:34.000Z
src-cpp/server42/src/PacketGenerator.cpp
NandanBharadwaj/open-kilda
912239cb958a78cc6927103f0aced3ff02ba9624
[ "Apache-2.0" ]
2,433
2017-10-09T08:22:14.000Z
2022-03-31T07:57:24.000Z
src-cpp/server42/src/PacketGenerator.cpp
NandanBharadwaj/open-kilda
912239cb958a78cc6927103f0aced3ff02ba9624
[ "Apache-2.0" ]
65
2017-10-09T07:53:37.000Z
2022-03-16T12:35:18.000Z
#include "PacketGenerator.h" #include <boost/log/trivial.hpp> #include <pcapplusplus/EthLayer.h> #include <pcapplusplus/VlanLayer.h> #include <pcapplusplus/UdpLayer.h> #include <pcapplusplus/IPv4Layer.h> #include <pcapplusplus/PayloadLayer.h> #include "Payload.h" #include "Config.h" namespace org::openkilda { void generate_and_add_packet_for_flow(const FlowCreateArgument &arg) { flow_endpoint_t flow_id_key = get_flow_id(arg); auto db = arg.flow_pool.get_metadata_db(); auto flow_meta = db->get(flow_id_key); if (flow_meta && flow_meta->get_hash() == arg.hash) { BOOST_LOG_TRIVIAL(debug) << "skip add_flow command for " << arg.flow_id << " and direction " << arg.direction_str() << " with hash " << arg.hash << " already exists"; return; } pcpp::Packet newPacket(64); pcpp::MacAddress dst(arg.dst_mac); pcpp::MacAddress src(arg.device->getMacAddress()); pcpp::EthLayer newEthernetLayer(src, dst); newPacket.addLayer(&newEthernetLayer); uint16_t nextType = arg.tunnel_id ? PCPP_ETHERTYPE_VLAN : PCPP_ETHERTYPE_IP; pcpp::VlanLayer newVlanLayer(arg.transit_tunnel_id, false, 1, nextType); if (arg.transit_tunnel_id) { newPacket.addLayer(&newVlanLayer); } uint16_t nextType2 = arg.inner_tunnel_id ? PCPP_ETHERTYPE_VLAN : PCPP_ETHERTYPE_IP; pcpp::VlanLayer newVlanLayer2(arg.tunnel_id, false, 1, nextType2); if (arg.tunnel_id) { newPacket.addLayer(&newVlanLayer2); } pcpp::VlanLayer newVlanLayer3(arg.inner_tunnel_id, false, 1, PCPP_ETHERTYPE_IP); if (arg.inner_tunnel_id) { newPacket.addLayer(&newVlanLayer3); } pcpp::IPv4Layer newIPLayer(pcpp::IPv4Address(std::string("192.168.0.1")), pcpp::IPv4Address(std::string("192.168.1.1"))); newIPLayer.getIPv4Header()->timeToLive = 128; newPacket.addLayer(&newIPLayer); pcpp::UdpLayer newUdpLayer(arg.udp_src_port, Config::flow_rtt_generated_packet_udp_dst_port); newPacket.addLayer(&newUdpLayer); FlowPayload payload{}; payload.direction = arg.direction; payload.flow_id_length = arg.flow_id.size(); payload.flow_id_offset = sizeof payload; std::vector<uint8_t> buffer(sizeof payload + arg.flow_id.size()); std::memcpy(buffer.data(), &payload, sizeof payload); std::memcpy(buffer.data() + payload.flow_id_offset, arg.flow_id.c_str(), arg.flow_id.length()); pcpp::PayloadLayer payloadLayer(buffer.data(), buffer.size(), false); newPacket.addLayer(&payloadLayer); newPacket.computeCalculateFields(); auto packet = flow_pool_t::allocator_t::allocate(newPacket.getRawPacket(), arg.device); if (flow_meta) { BOOST_LOG_TRIVIAL(debug) << "update flow " << arg.flow_id << " and direction " << arg.direction_str() << " with hash " << flow_meta->get_hash() << " to new flow with hash " << arg.hash; arg.flow_pool.remove_packet(flow_id_key); } auto meta = std::shared_ptr<FlowMetadata>( new FlowMetadata(arg.flow_id, arg.direction, arg.dst_mac, arg.hash)); bool success = arg.flow_pool.add_packet(flow_id_key, packet, meta); if (!success) { flow_pool_t::allocator_t::dealocate(packet); } } void generate_and_add_packet_for_isl(const IslCreateArgument &arg) { isl_endpoint_t isl_id_key = get_isl_id(arg); auto db = arg.isl_pool.get_metadata_db(); auto isl_meta = db->get(isl_id_key); if (isl_meta && isl_meta->get_hash() == arg.hash) { BOOST_LOG_TRIVIAL(debug) << "skip add_isl command for " << arg.switch_id << " and port " << arg.port << " with hash " << arg.hash << " already exists"; return; } pcpp::Packet newPacket(64); pcpp::MacAddress dst(arg.dst_mac); pcpp::MacAddress src(arg.device->getMacAddress()); pcpp::EthLayer newEthernetLayer(src, dst); newPacket.addLayer(&newEthernetLayer); pcpp::VlanLayer newVlanLayer(arg.transit_tunnel_id, false, 1, PCPP_ETHERTYPE_IP); if (arg.transit_tunnel_id) { newPacket.addLayer(&newVlanLayer); } pcpp::IPv4Layer newIPLayer(pcpp::IPv4Address(std::string("192.168.0.1")), pcpp::IPv4Address(std::string("192.168.1.1"))); newIPLayer.getIPv4Header()->timeToLive = 128; newPacket.addLayer(&newIPLayer); pcpp::UdpLayer newUdpLayer(arg.udp_src_port, Config::isl_rtt_generated_packet_udp_dst_port); newPacket.addLayer(&newUdpLayer); IslPayload payload{}; size_t length = arg.switch_id.copy(payload.switch_id, sizeof(payload.switch_id) - 1); payload.switch_id[length] = '\0'; payload.port = arg.port; pcpp::PayloadLayer payloadLayer(reinterpret_cast<uint8_t *>(&payload), sizeof(payload), false); newPacket.addLayer(&payloadLayer); newPacket.computeCalculateFields(); auto packet = isl_pool_t::allocator_t::allocate(newPacket.getRawPacket(), arg.device); if (isl_meta) { BOOST_LOG_TRIVIAL(debug) << "update isl " << arg.switch_id << " and port " << arg.port << " with hash " << isl_meta->get_hash() << " to new isl with hash " << arg.hash; arg.isl_pool.remove_packet(isl_id_key); } auto meta = std::shared_ptr<IslMetadata>( new IslMetadata(arg.switch_id, arg.port, arg.dst_mac, arg.hash)); bool success = arg.isl_pool.add_packet(isl_id_key, packet, meta); if (!success) { isl_pool_t::allocator_t::dealocate(packet); } } }
37.704403
110
0.621018
[ "vector" ]
668595f49223a17fdc76845b413d138d0fe89d44
88,848
cpp
C++
testing_source/testing_harness_new_write.cpp
mlawsonca/empress
aa3eb8544f2e01fcbd77749f7dce1b95fbfa11e9
[ "MIT" ]
5
2018-11-28T19:38:23.000Z
2021-03-15T20:44:07.000Z
testing_source/testing_harness_new_write.cpp
mlawsonca/empress
aa3eb8544f2e01fcbd77749f7dce1b95fbfa11e9
[ "MIT" ]
null
null
null
testing_source/testing_harness_new_write.cpp
mlawsonca/empress
aa3eb8544f2e01fcbd77749f7dce1b95fbfa11e9
[ "MIT" ]
1
2018-07-18T15:22:36.000Z
2018-07-18T15:22:36.000Z
/* * Copyright 2018 National Technology & Engineering Solutions of * Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, * the U.S. Government retains certain rights in this software. * * The MIT License (MIT) * * Copyright (c) 2018 Sandia Corporation * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include <stdio.h> //needed for printf #include <stdlib.h> //needed for atoi/atol/malloc/free/rand #include <assert.h> //needed for assert #include <string.h> //needed for strcmp // #include <ctime> #include <stdint.h> //needed for uint // #include <ratio> #include <chrono> //needed for high_resolution_clock #include <math.h> //needed for pow() #include <sys/time.h> //needed for timeval #include <sys/stat.h> //needed for stat #include <fstream> //needed for ifstream #include <vector> #include <float.h> //needed for DBL_MAX #include <numeric> #include <mpi.h> #include <my_metadata_client.h> #include <my_metadata_client_lua_functs.h> #include <Globals.hh> #include <opbox/services/dirman/DirectoryManager.hh> #include <gutties/Gutties.hh> #include <sstream> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <hdf5_helper_functions_write.hh> #include <testing_harness_debug_helper_functions.hh> // #include <client_timing_constants.hh> #include <client_timing_constants_write.hh> //dw settings std::string default_config_string = R"EOF( # Tell the nnti transport to use infiniband nnti.logger.severity error nnti.transport.name ibverbs webhook.interfaces ib0,lo #config.additional_files.env_name.if_defined CONFIG lunasa.lazy_memory_manager malloc lunasa.eager_memory_manager tcmalloc # Select the type of dirman to use. Currently we only have centralized, which # just sticks all the directory info on one node (called root). dirman.type centralized # Turn these on if you want to see more debug messages #bootstrap.debug true #webhook.debug true #opbox.debug true #dirman.debug true #dirman.cache.others.debug true #dirman.cache.mine.debug true )EOF"; using namespace std; static bool extreme_debug_logging = false; static bool debug_logging = false; static bool error_logging = true; static bool testing_logging = false; static bool zero_rank_logging = false; debugLog error_log = debugLog(error_logging, zero_rank_logging); debugLog debug_log = debugLog(debug_logging, zero_rank_logging); debugLog extreme_debug_log = debugLog(extreme_debug_logging, zero_rank_logging); debugLog testing_log = debugLog(testing_logging, zero_rank_logging); static bool do_debug_testing = false; static bool output_timing = true; static bool insert_by_batch = true; static bool do_write_data = true; static bool hdf5_write_data = true; static bool write_obj_data = false; static bool write_obj_data_to_map = false; static bool output_objector_params = false; static bool output_obj_names = false; std::vector<int> catg_of_time_pts; std::vector<long double> time_pts; int zero_time_sec; void add_timing_point(int catg) { if (output_timing) { struct timeval now; gettimeofday(&now, NULL); time_pts.push_back( (now.tv_sec - zero_time_sec) + now.tv_usec / 1000000.0); catg_of_time_pts.push_back(catg); } } std::vector<int> all_num_objects_to_fetch; void add_objector_point(int catg, int num_objects_to_fetch) { if (output_timing) { add_timing_point(catg); extreme_debug_log << "am pushing back " << num_objects_to_fetch << endl; } all_num_objects_to_fetch.push_back(num_objects_to_fetch); } vector<objector_params> all_objector_params; vector<vector<string>> all_object_names; std::map <string, vector<double>> data_outputs; static int setup_dirman(const string &dirman_file_path, const string &dir_path, md_server &dirman, vector<gutties::name_and_node_t> &server_procs, int rank, uint32_t num_servers, uint32_t num_clients); // static void setup_server(md_server &server, int &server_indx, int rank, uint32_t num_servers, const vector<gutties::name_and_node_t> &server_procs); static void setup_server(int rank, uint32_t num_servers, const vector<gutties::name_and_node_t> &server_nodes, md_server &server); // void write_testing(int rank, DirectoryInfo dir, md_server server, uint64_t num_timesteps, uint32_t chunk_id); int create_and_activate_run(md_server server, md_catalog_run_entry &run, const string &rank_to_dims_funct_name, const string &rank_to_dims_funct_path, const string &objector_funct_name, const string &objector_funct_path); int create_and_activate_types(md_server server, uint64_t run_id, uint32_t num_types, uint32_t num_run_timestep_types); int create_vars(md_server server, int rank, uint32_t num_servers, uint32_t num_client_procs, md_catalog_var_entry &temp_var, uint32_t var_indx, uint64_t total_x_length, uint64_t total_y_length, uint64_t total_z_length, vector<md_catalog_var_entry> &all_vars_to_insert ); int write_data(int rank, const vector<double> &data_vctr, const md_catalog_run_entry &run, const string &objector_funct_name, uint32_t timestep_num, int64_t timestep_file_id, const md_catalog_var_entry &var, int var_indx, const vector<md_dim_bounds> &proc_dims_vctr, uint32_t num_run_timestep_types, double &timestep_temp_min, double &timestep_temp_max); int create_var_attrs(md_server server, int rank, const vector<md_dim_bounds> proc_dims_vctr, uint32_t timestep_num, uint32_t var_indx, uint32_t num_types, vector<md_catalog_var_attribute_entry> &all_attrs_to_insert, double &timestep_temp_min, double &timestep_temp_max ); int insert_vars_and_attrs_batch(md_server server, int rank, const vector<md_catalog_var_entry> &all_vars_to_insert, const vector<md_catalog_var_attribute_entry> &all_attrs_to_insert, uint32_t num_servers ); int create_timestep_attrs(md_server server, int rank, double timestep_temp_min, double timestep_temp_max, uint32_t timestep_num, uint32_t num_types, uint32_t num_run_timestep_types, uint32_t num_client_procs, double *all_timestep_temp_mins_for_all_procs, double *all_timestep_temp_maxes_for_all_procs); int activate_timestep_components(md_server server, uint32_t timestep_num); int create_run_attrs(md_server server, int rank, double *all_timestep_temp_mins_for_all_procs, double *all_timestep_temp_maxes_for_all_procs, uint64_t run_id, uint32_t num_timesteps, uint32_t num_types ); void output_obj_names_and_timing(int rank, uint32_t num_client_procs, const md_catalog_run_entry &temp_run, const md_catalog_var_entry &temp_var, uint32_t num_timesteps, uint32_t num_vars ); template <class T> static void make_single_val_data (T val, string &serial_str); template <class T1, class T2> static void make_double_val_data (T1 val_0, T2 val_1, string &serial_str); //note - just for debugging int debug_testing(md_server server, int rank, int num_servers, vector<md_dim_bounds> dims); void gather_and_print_output_params(const vector<objector_params> &object_names, int rank, uint32_t num_client_procs); objector_params get_objector_params ( const md_catalog_run_entry &run, const md_catalog_var_entry &var, const vector<md_dim_bounds> &bounding_box); void gather_and_print_object_names(const vector<vector<string>> &all_object_names, int rank, uint32_t num_client_procs, uint32_t num_timesteps, uint32_t num_vars); void gatherv_int(vector<int> values, uint32_t num_client_procs, int rank, int *each_proc_num_values, int *displacement_for_each_proc, int **all_values); static void get_obj_lengths(const md_catalog_var_entry &var, uint64_t &x_width, uint64_t &last_x_width, uint64_t ndx, uint64_t chunk_size) ; /* argv[1] = dirman hexid argv[2] = number of subdivision of the x dimension (number of processes) argv[3] = number of subdivisions of the y dimension (number of processes) argv[4] = number of subdivisions of the z dimension (number of processes) argv[5] = total length in the x dimension argv[6] = total length in the y dimension argv[7] = total length in the z dimension argv[8] = number of datasets to be stored in the database argv[9] = number of types stored in each dataset argv[10] = estimate of the number of testing time points we will have argv[11] = the number of EMPRESS (metadata) servers argv[12] = the job id (from the scheduler) */ int main(int argc, char **argv) { int rc; // char name[100]; // gethostname(name, sizeof(name)); // extreme_debug_log << name << endl; if (argc != 12) { error_log << "Error. Program should be given 11 arguments. Dirman hexid, npx, npy, npz, nx, ny, nz, number of timesteps, estm num time_pts, num_servers, job_id" << endl; cout << (int)ERR_ARGC << " " << 0 << endl; return RC_ERR; } string dirman_hexid = argv[1]; uint32_t num_x_procs = stoul(argv[2],nullptr,0); uint32_t num_y_procs = stoul(argv[3],nullptr,0); uint32_t num_z_procs = stoul(argv[4],nullptr,0); uint64_t total_x_length = stoull(argv[5],nullptr,0); uint64_t total_y_length = stoull(argv[6],nullptr,0); uint64_t total_z_length = stoull(argv[7],nullptr,0); uint32_t num_timesteps = stoul(argv[8],nullptr,0); // uint32_t num_types = stoul(argv[9],nullptr,0); uint32_t estm_num_time_pts = stoul(argv[9],nullptr,0); uint32_t num_servers = stoul(argv[10],nullptr,0); uint64_t job_id = stoull(argv[11],nullptr,0); extreme_debug_log << "job_id: " << job_id << endl; //all 10 char plus null character uint32_t num_vars = 10; catg_of_time_pts.reserve(estm_num_time_pts); time_pts.reserve(estm_num_time_pts); all_object_names.reserve(100 * num_timesteps * num_vars); all_num_objects_to_fetch.reserve(num_timesteps * num_vars); struct timeval now; gettimeofday(&now, NULL); zero_time_sec = 86400 * (now.tv_sec / 86400); add_timing_point(PROGRAM_START); MPI_Init(&argc, &argv); int rank; int num_client_procs; MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size( MPI_COMM_WORLD, &num_client_procs); add_timing_point(MPI_INIT_DONE); extreme_debug_log.set_rank(rank); debug_log.set_rank(rank); error_log.set_rank(rank); rc = metadata_init_write(); if (rc != RC_OK) { error_log << "Error initing the md_client. Exiting \n"; return RC_ERR; } if (do_debug_testing) { rc = metadata_init_read(); if (rc != RC_OK) { error_log << "Error initing the md_client. Exiting \n"; return RC_ERR; } } add_timing_point(METADATA_CLIENT_INIT_DONE); if(rank == 0) { extreme_debug_log << "starting" << endl; } string dir_path="/metadata/testing"; md_server dirman; md_server server; // int server_indx; // int my_num_clients_per_server; // int remainder; vector<md_dim_bounds> proc_dims_vctr(3); int num_run_timestep_types = 2; uint32_t num_types = 10; extreme_debug_log << "num_type: " << num_types << " num_run_timestep_types: " << num_run_timestep_types << endl; uint32_t x_length_per_proc = total_x_length / num_x_procs; //todo - deal with edge case? uint32_t y_length_per_proc = total_y_length / num_y_procs; uint32_t z_length_per_proc = total_z_length / num_z_procs; uint64_t chunk_vol = x_length_per_proc * y_length_per_proc * z_length_per_proc; struct md_catalog_var_entry temp_var; uint32_t num_dims; uint32_t var_num; uint32_t var_version; struct md_catalog_run_entry temp_run; struct md_catalog_timestep_entry temp_timestep; uint32_t x_pos, y_pos, z_pos; uint32_t x_offset, y_offset, z_offset; double all_timestep_temp_maxes_for_all_procs[num_timesteps]; double all_timestep_temp_mins_for_all_procs[num_timesteps]; vector<double> data_vctr; // double timestep_temp_maxes[num_timesteps][num_vars] = {0}; // double timestep_temp_mins[num_timesteps][num_vars] = {0}; // double timestep_temp_maxes[num_timesteps]= {0}; // double timestep_temp_mins[num_timesteps] = {0}; vector<gutties::name_and_node_t> server_procs; server_procs.resize(num_servers); srand(rank+1); extreme_debug_log << "rank: " << rank << " first rgn: " << rand() << endl; //just for testing------------------------------------------- // long double *all_clock_times; // double *total_times; all_objector_params.reserve(num_vars * num_timesteps); //-------------------------------------------------------------- // my_num_clients_per_server = num_client_procs / num_servers; //each has this many at a min // remainder = num_client_procs - (num_servers * my_num_clients_per_server); // if(server_indx < remainder) { // my_num_clients_per_server +=1; // } x_pos = rank % num_x_procs; y_pos = (rank / num_x_procs) % num_y_procs; z_pos = ((rank / (num_x_procs * num_y_procs)) % num_z_procs); x_offset = x_pos * x_length_per_proc; y_offset = y_pos * y_length_per_proc; z_offset = z_pos * z_length_per_proc; extreme_debug_log << "zoffset: " << to_string(z_offset) << endl; extreme_debug_log << "x pos is " << to_string(x_pos) << " and x_offset is " << to_string(x_offset) << endl; extreme_debug_log << "y pos is " << to_string(y_pos) << " and y_offset is " << to_string(y_offset) << endl; extreme_debug_log << "z pos is " << to_string(z_pos) << " and z_offset is " << to_string(z_offset) << endl; extreme_debug_log << "num x procs " << to_string(num_x_procs) << " num y procs " << to_string(num_y_procs) << " num z procs " << to_string(num_z_procs) << endl; num_dims = 3; proc_dims_vctr [0].min = x_offset; proc_dims_vctr [0].max = x_offset + x_length_per_proc-1; proc_dims_vctr [1].min = y_offset; proc_dims_vctr [1].max = y_offset + y_length_per_proc -1; proc_dims_vctr [2].min = z_offset; proc_dims_vctr [2].max = z_offset + z_length_per_proc -1; // vector<md_dim_bounds> proc_dims_vctr = std::vector<md_dim_bounds>(proc_dims_vctr, proc_dims_vctr + num_dims ); //length_of_chunk = (dims [0].max - dims [0].min + 1) * (dims [1].max - dims [1].min + 1) * (dims [2].max - dims [2].min + 1); for (int j=0; j<num_dims; j++) { extreme_debug_log << "dims [" << to_string(j) << "] min is: " << to_string(proc_dims_vctr [j].min) << endl; extreme_debug_log << "dims [" << to_string(j) << "] max is: " << to_string(proc_dims_vctr [j].max) << endl; } add_timing_point(INIT_VARS_DONE); rc = setup_dirman(argv[1], dir_path, dirman, server_procs, rank, num_servers, num_client_procs); if (rc != RC_OK) { add_timing_point(ERR_DIRMAN); error_log << "Error. Was unable to setup the dirman. Exiting" << endl; return RC_ERR; } add_timing_point(DIRMAN_SETUP_DONE); setup_server(rank, num_servers, server_procs, server); add_timing_point(SERVER_SETUP_DONE_INIT_DONE); MPI_Barrier(MPI_COMM_WORLD); //WRITE PROCESS //only want one copy of each var and type in each server's db add_timing_point(WRITING_START); if(write_data) { add_timing_point(CREATE_DATA_START); data_vctr = vector<double>(chunk_vol); /* * Initialize data buffer * Just use the same data for each var and timestep */ generate_data_for_proc(y_length_per_proc, z_length_per_proc, rank, proc_dims_vctr, data_vctr, x_length_per_proc, y_length_per_proc, z_length_per_proc, chunk_vol); add_timing_point(CREATE_DATA_DONE); } // add_timing_point(DIMS_INIT_DONE); temp_run.job_id = job_id; temp_run.name = "XGC"; temp_run.txn_id = 0; temp_run.npx = num_x_procs; temp_run.npy = num_y_procs; temp_run.npz = num_z_procs; // rc = stringify_function("/ascldap/users/mlawso/sirius/lib_source/lua/lua_function.lua", "rank_to_bounding_box", temp_run.rank_to_dims_funct); // if (rc != RC_OK) { // error_log << "Error. Was unable to stringify the rank to bounding box function. Exitting \n"; // goto cleanup; // } // rc = stringify_function("/ascldap/users/mlawso/sirius/lib_source/lua/metadata_functs.lua", "boundingBoxToObjectNamesAndCounts", temp_run.objector_funct); // if (rc != RC_OK) { // error_log << "Error. Was unable to stringify the boundingBoxToObjectNamesAndCounts function. Exitting \n"; // goto cleanup; // } string rank_to_dims_funct_name = "rank_to_bounding_box"; string rank_to_dims_funct_path = "/ascldap/users/mlawso/sirius/lib_source/lua/lua_function.lua"; string objector_funct_name = "boundingBoxToObjectNamesAndCounts"; string objector_funct_path = "/ascldap/users/mlawso/sirius/lib_source/lua/metadata_functs.lua"; // add_timing_point(RUN_INIT_DONE); uint64_t run_id = 1; //reminder - needs to be done for each CLIENT, not server if(write_obj_data) { add_timing_point(OBJECTOR_LOAD_START); rc = register_objector_funct_write (objector_funct_name, objector_funct_path, job_id); if (rc != RC_OK) { error_log << "error in registering the objector function in write for " << server.URL << endl; } else { extreme_debug_log << "just registered for server " << server.URL << endl; } add_timing_point(OBJECTOR_LOAD_DONE); } if (rank < num_servers) { rc = create_and_activate_run(server, temp_run, rank_to_dims_funct_name, rank_to_dims_funct_path, objector_funct_name, objector_funct_path); if (rc != RC_OK) { goto cleanup; } // if(rank == 0 && hdf5_write_data) { // hdf5_create_run(temp_run.name, job_id); // } } temp_run.run_id = run_id; //todo - do we want to make them catalog to get this? or change so registering doesn't require a name //reminder - unless you adjust create_type to ask for a type id, if you want the types in the given order (so you know how) //type_id corresponds to name/version, you need to insert them in order if (rank < num_servers) { rc = create_and_activate_types(server, run_id, num_types, num_run_timestep_types); if (rc != RC_OK) { goto cleanup; } } temp_timestep.run_id = run_id; //todo - will have to change if we want more than 1 run // add_timing_point(CREATE_TIMESTEPS_START); add_timing_point(CREATE_TIMESTEPS_START); for(uint32_t timestep_num=0; timestep_num < num_timesteps; timestep_num++) { int64_t timestep_file_id = -1; MPI_Barrier(MPI_COMM_WORLD); //want to measure last-first for writing each timestep add_timing_point(CREATE_NEW_TIMESTEP_START); double timestep_temp_max; double timestep_temp_min; extreme_debug_log << "rank: " << rank << " timestep_num: " << timestep_num << " (rank / num_servers): " << (rank / num_servers) << endl; if( (timestep_num % num_client_procs) == (rank / num_servers) ) { extreme_debug_log << "about to create timestep for timestep_num: " << timestep_num << endl; temp_timestep.timestep_id = timestep_num; temp_timestep.path = temp_run.name + "/" + to_string(temp_timestep.timestep_id); //todo - do timestep need to use sprintf for this? temp_timestep.txn_id = timestep_num; // extreme_debug_log << " timestep: " << temp_timestep.timestep_id << // " rank: " << rank << " num servers: " << num_servers << " num_timesteps: " << num_timesteps << endl; // extreme_debug_log << "server hex id: " << server.URL << endl; rc = metadata_create_timestep (server, temp_timestep.timestep_id, temp_timestep.run_id, temp_timestep.path, temp_timestep.txn_id); if (rc != RC_OK) { error_log << "Error. Was unable to create the " << temp_timestep.timestep_id << "th timestep. Exiting" << endl; add_timing_point(ERR_CREATE_TIMESTEP); goto cleanup; } } if(hdf5_write_data) { if(rank == 0) { //have one proc individually create all of the files so they are not all collectives hdf5_create_timestep_and_vars(temp_run.name, job_id, timestep_num, num_vars, total_x_length, total_y_length, total_z_length, proc_dims_vctr); } hdf5_open_timestep_file_collectively_for_write(temp_run.name, job_id, timestep_num, timestep_file_id); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// temp_var.run_id = run_id; temp_var.timestep_id = timestep_num; temp_var.data_size = 8; //double - 64 bit floating point temp_var.txn_id = timestep_num; vector<md_catalog_var_attribute_entry> all_attrs_to_insert; all_attrs_to_insert.reserve(3 * num_vars); vector<md_catalog_var_entry> all_vars_to_insert; all_vars_to_insert.reserve(num_vars); add_timing_point(CREATE_VARS_AND_ATTRS_FOR_NEW_TIMESTEP_START); for(uint32_t var_indx=0; var_indx < num_vars; var_indx++) { rc = create_vars(server, rank, num_servers, num_client_procs, temp_var, var_indx, total_x_length, total_y_length, total_z_length, all_vars_to_insert); if (rc != RC_OK) { goto cleanup; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (do_write_data) { rc = write_data(rank, data_vctr, temp_run, objector_funct_name, timestep_num, timestep_file_id, temp_var, var_indx, proc_dims_vctr, num_run_timestep_types, timestep_temp_min, timestep_temp_max); if (rc != RC_OK) { goto cleanup; } extreme_debug_log << "finished write_data" << endl; } //end if write data else if (output_objector_params) { all_objector_params.push_back( get_objector_params(temp_run, temp_var, proc_dims_vctr) ); // add_objector_point(BOUNDING_BOX_TO_OBJ_NAMES, 1); add_timing_point(BOUNDING_BOX_TO_OBJ_NAMES); } else if (output_obj_names) { std::vector<string> obj_names; add_timing_point(BOUNDING_BOX_TO_OBJ_NAMES_START); rc = boundingBoxToObjNames(temp_run, temp_var, proc_dims_vctr, obj_names); if (rc != RC_OK) { error_log << "Error doing the bounding box to obj names, returning \n"; return RC_ERR; } add_timing_point(BOUNDING_BOX_TO_OBJ_NAMES_DONE); all_object_names.push_back(obj_names); add_objector_point(BOUNDING_BOX_TO_OBJ_NAMES, obj_names.size()); // extreme_debug_log << "rank " << rank << " is pushing back obj_names.size(): " << obj_names.size() << endl; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// rc = create_var_attrs(server, rank, proc_dims_vctr, timestep_num, var_indx, num_types, all_attrs_to_insert, timestep_temp_min, timestep_temp_max); //if not okay, just proceed } //var loop done if(insert_by_batch) { rc = insert_vars_and_attrs_batch(server, rank, all_vars_to_insert, all_attrs_to_insert, num_servers); //if not okay, just proceed } add_timing_point(CREATE_VARS_AND_ATTRS_FOR_NEW_TIMESTEP_DONE); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// rc = create_timestep_attrs(server, rank, timestep_temp_min, timestep_temp_max, timestep_num, num_types, num_run_timestep_types, num_client_procs, all_timestep_temp_mins_for_all_procs, all_timestep_temp_maxes_for_all_procs); //if not okay, just proceed //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reminder - need to barrier so that all instances have been submitted before activating if(hdf5_write_data) { hdf5_close_timestep_file(timestep_file_id); } add_timing_point(CREATE_TIMESTEP_DONE); MPI_Barrier(MPI_COMM_WORLD); if(rank < num_servers) { rc = activate_timestep_components(server, timestep_num); if (rc != RC_OK) { goto cleanup; } } add_timing_point(CREATE_AND_ACTIVATE_TIMESTEP_DONE); } add_timing_point(CREATE_ALL_TIMESTEPS_DONE); for (int i = 0; i<num_timesteps; i++) { debug_log << "rank: " << rank << " timestep: " << i << " max: " << all_timestep_temp_maxes_for_all_procs[i] << endl; debug_log << "rank: " << rank << " timestep: " << i << " min: " << all_timestep_temp_mins_for_all_procs[i] << endl; } if (rank == 0 && num_run_timestep_types > 0) { rc = create_run_attrs(server, rank, all_timestep_temp_mins_for_all_procs, all_timestep_temp_maxes_for_all_procs, run_id, num_timesteps, num_types); if(rc != RC_OK) { goto cleanup; } } add_timing_point(WRITING_DONE); //------------------------------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------- if(do_debug_testing) { MPI_Barrier(MPI_COMM_WORLD); // rc = debug_testing(server); rc = debug_testing( server, rank, num_servers, proc_dims_vctr); if (rc != RC_OK) { error_log << "Error with debug testing \n"; } } //------------------------------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------- cleanup: MPI_Barrier (MPI_COMM_WORLD); add_timing_point(WRITING_DONE_FOR_ALL_PROCS_START_CLEANUP); metadata_finalize_client(); extreme_debug_log << "num_servers: " << num_servers << endl; if( rank < num_servers) { metadata_finalize_server(server); add_timing_point(SERVER_SHUTDOWN_DONE); debug_log << "just finished finalizing" << endl; // extreme_debug_log << "just finished finalizing server" << endl; if(rank == 0) { metadata_finalize_server(dirman); add_timing_point(DIRMAN_SHUTDOWN_DONE); } } output_obj_names_and_timing(rank, num_client_procs, temp_run, temp_var, num_timesteps, num_vars); // free(total_times) MPI_Barrier (MPI_COMM_WORLD); MPI_Finalize(); gutties::bootstrap::Finish(); debug_log << "got to cleanup7" << endl; return rc; } int retrieveObjNamesAndDataForAttrCatalog(const std::map <string, vector<double>> &data_outputs, const md_catalog_run_entry &run, const vector<md_catalog_var_entry> &var_entries, uint64_t run_id, uint64_t timestep_id, uint64_t txn_id, const vector<md_catalog_var_attribute_entry> &attr_entries ); // int retrieveObjNamesAndDataForAttrCatalog(const std::map <string, vector<double>> &data_outputs, const md_catalog_run_entry &run, // const vector<md_catalog_var_entry> &var_entries, // uint64_t run_id, uint64_t timestep_id, // uint64_t txn_id, // const vector<md_catalog_var_attribute_entry> &attr_entries, // vector<string> &obj_names, vector<uint64_t> &offsets_and_counts // ); int debug_testing(md_server server, int rank, int num_servers, vector<md_dim_bounds> dims) { int rc; uint32_t count; vector<md_catalog_var_attribute_entry> var_attr_entries; vector<md_catalog_run_attribute_entry> run_attr_entries; vector<md_catalog_timestep_attribute_entry> timestep_attr_entries; vector<md_catalog_run_entry> run_entries; vector<md_catalog_timestep_entry> timestep_entries; vector<md_catalog_var_entry> var_entries; vector<md_catalog_type_entry> type_entries; uint64_t txn_id = -1; rc = metadata_catalog_run (server, txn_id, count, run_entries); if (rc != RC_OK) { error_log << "Error cataloging the post deletion set of run entries. Proceeding \n"; } if (rank < num_servers) { testing_log << "run catalog for txn_id " << txn_id << ": \n"; print_run_catalog (count, run_entries); } if (rank < num_servers) { for (md_catalog_run_entry run : run_entries) { rc = metadata_catalog_all_run_attributes ( server, run.run_id, txn_id, count, run_attr_entries ); if (rc == RC_OK) { testing_log << "attributes associated with run_id " << run.run_id; testing_log << "\n"; print_run_attribute_list (count, run_attr_entries); print_run_attr_data(count, run_attr_entries); } else { error_log << "Error getting the matching attribute list. Proceeding \n"; } testing_log << "\n"; } } for (md_catalog_run_entry run : run_entries) { rc = metadata_catalog_type (server, run.run_id, txn_id, count, type_entries); if (rc == RC_OK) { if (rank < num_servers) { testing_log << "new type catalog for run_id " << run.run_id << ": \n"; print_type_catalog (count, type_entries); } } else { error_log << "Error cataloging the new set of type entries. Proceeding \n"; } } for (md_catalog_run_entry run : run_entries) { rc = metadata_catalog_timestep (server, run.run_id, txn_id, count, timestep_entries); if (rc != RC_OK) { error_log << "Error cataloging the post deletion set of timestep entries. Proceeding \n"; } if (rank < num_servers) { testing_log << "timestep catalog for run_id " << run.run_id << ": \n"; print_timestep_catalog (count, timestep_entries); } for (md_catalog_timestep_entry timestep : timestep_entries) { if (rank < num_servers) { rc = metadata_catalog_all_timestep_attributes(server, timestep.run_id, timestep.timestep_id, txn_id, count, timestep_attr_entries); if (rc == RC_OK) { testing_log << "attributes associated with run id: " << timestep.run_id << " and timestep: " << timestep.timestep_id << "\n"; print_timestep_attribute_list (count, timestep_attr_entries); print_timestep_attr_data(count, timestep_attr_entries); } else { error_log << "Error getting the matching timestep attribute list. Proceeding \n"; } } rc = metadata_catalog_var (server, timestep.run_id, timestep.timestep_id, run.txn_id, count, var_entries); if (rc == RC_OK) { if (rank < num_servers) { testing_log << "vars associated with run_id " << timestep.run_id << "and timestep " << timestep.timestep_id << ": \n"; print_var_catalog (count, var_entries); } } else { error_log << "Error cataloging the new set of var entries. Proceeding \n"; } // rc = metadata_catalog_all_var_attributes (server, timestep.run_id, timestep.timestep_id, txn_id, count, var_attr_entries); // if (rc == RC_OK) { // testing_log << "using var attrs funct: attributes associated with run_id " << timestep.run_id << // " and timestep_id " << timestep.timestep_id ; // testing_log << "\n"; // print_var_attribute_list (count, var_attr_entries); // print_var_attr_data(count, var_attr_entries); // } // else { // error_log << "Error getting the matching attribute list. Proceeding \n"; // } rc = metadata_catalog_all_var_attributes_with_dims(server, timestep.run_id, timestep.timestep_id, timestep.txn_id, dims.size(), dims, count, var_attr_entries); if (rc == RC_OK) { testing_log << "using var attrs dims funct: attributes associated with run_id " << timestep.run_id << ", timestep_id " << timestep.timestep_id << " and txn_id: " << timestep.txn_id << " overlapping with vect_dims"; for(int j=0; j< dims.size(); j++) { testing_log << " d" << j << "_min: " << dims [j].min; testing_log << " d" << j << "_max: " << dims [j].max; } testing_log << " \n"; print_var_attribute_list (count, var_attr_entries); print_var_attr_data(count, var_attr_entries); } else { error_log << "Error getting the matching attribute list. Proceeding \n"; } testing_log << "\n"; // vector<string> obj_names; // vector<uint64_t> offsets_and_counts; // rc = retrieveObjNamesAndDataForAttrCatalog(data_outputs, run, var_entries, run.run_id, timestep.timestep_id, txn_id, var_attr_entries, obj_names, offsets_and_counts ); if(do_write_data) { rc = retrieveObjNamesAndDataForAttrCatalog(data_outputs, run, var_entries, run.run_id, timestep.timestep_id, txn_id, var_attr_entries ); if (rc != RC_OK) { error_log << "error. could not perform retrieveObjNamesAndDataForAttrCatalog \n"; } } } //for each timestep } //for each run return rc; } int create_and_activate_run(md_server server, md_catalog_run_entry &run, const string &rank_to_dims_funct_name, const string &rank_to_dims_funct_path, const string &objector_funct_name, const string &objector_funct_path) { int rc = RC_OK; add_timing_point(CREATE_NEW_RUN_START); rc = metadata_create_run ( server, run.run_id, run.job_id, run.name, run.txn_id, run.npx, run.npy, run.npz, rank_to_dims_funct_name, rank_to_dims_funct_path, objector_funct_name, objector_funct_path); if (rc != RC_OK) { error_log << "Error. Was unable to create the first run. Exitting \n"; add_timing_point(ERR_CREATE_RUN); return rc; } rc = metadata_activate_run ( server, run.txn_id); if (rc != RC_OK) { error_log << "Error. Was unable to activate the run. Exitting \n"; add_timing_point(ERR_ACTIVATE_RUN); return rc; } add_timing_point(CREATE_NEW_RUN_DONE); return rc; } int create_and_activate_types(md_server server, uint64_t run_id, uint32_t num_types, uint32_t num_run_timestep_types) { int rc = RC_OK; md_catalog_type_entry temp_type; char type_names[10][13] = {"blob_freq", "blob_ifreq", "blob_rare", "max_val_type", "min_val_type", "note_freq", "note_ifreq", "note_rare", "ranges_type1", "ranges_type2"}; char run_timestep_type_names[2][9] = {"max_temp", "min_temp"}; add_timing_point(CREATE_TYPES_START); vector<md_catalog_type_entry> all_types_to_insert; all_types_to_insert.reserve(num_types + num_run_timestep_types); for(int type_indx=0; type_indx < (num_types + num_run_timestep_types); type_indx++) { // add_timing_point(CREATE_NEW_TYPE_START); uint64_t type_indx_adj = type_indx % num_types; bool is_run_type = (type_indx >= num_types); extreme_debug_log << "type_indx: " << type_indx << endl; temp_type.run_id = run_id; if(is_run_type) { temp_type.name = run_timestep_type_names[type_indx_adj]; } else { temp_type.name = type_names[type_indx_adj]; } temp_type.version = 0; temp_type.txn_id = run_id; // add_timing_point(TYPE_INIT_DONE); uint64_t temp_type_id; if(insert_by_batch) { all_types_to_insert.push_back(temp_type); } else { rc = metadata_create_type (server, temp_type_id, temp_type); if (rc != RC_OK) { add_timing_point(ERR_CREATE_TYPE); error_log << "Error. Was unable to insert the type of index " << type_indx << ". Proceeding \n"; return rc; } } } if(insert_by_batch) { vector<uint64_t> type_ids; rc = metadata_create_type_batch (server, type_ids, all_types_to_insert); if (rc != RC_OK) { add_timing_point(ERR_CREATE_TYPE_BATCH); error_log << "Error. Was unable to insert the types by batch. Proceeding \n"; return rc; } } rc = metadata_activate_type ( server, run_id); if (rc != RC_OK) { error_log << "Error. Was unable to activate the types. Exitting \n"; add_timing_point(ERR_ACTIVATE_TYPE); return rc; } add_timing_point(CREATE_TYPES_DONE); return rc; } int create_vars(md_server server, int rank, uint32_t num_servers, uint32_t num_client_procs, md_catalog_var_entry &temp_var, uint32_t var_indx, uint64_t total_x_length, uint64_t total_y_length, uint64_t total_z_length, vector<md_catalog_var_entry> &all_vars_to_insert ) { int rc = RC_OK; char var_names[10][11] = {"temperat", "temperat", "pressure", "pressure", "velocity_x", "velocity_y", "velocity_z", "magn_field", "energy_var", "density_vr"}; uint32_t version1 = 1; uint32_t version2 = 2; vector<md_dim_bounds> var_dims(3); add_timing_point(CREATE_VAR_AND_ATTRS_FOR_NEW_VAR_START); extreme_debug_log << "var_indx: " << var_indx << " rank: " << rank << endl; extreme_debug_log << " var_indx: " << var_indx << " rank: " << rank << " num servers: " << num_servers << endl; // uint64_t var_id = my_num_clients_per_server * var_indx + (rank / num_servers); temp_var.name = var_names[var_indx]; temp_var.path = "/"+ (string) temp_var.name; if(var_indx == 1 || var_indx == 3) { //these have been designated ver2 temp_var.version = version2; } else { temp_var.version = version1; } temp_var.var_id = var_indx; temp_var.num_dims = 3; var_dims [0].min = 0; var_dims [0].max = total_x_length-1; var_dims [1].min = 0; var_dims [1].max = total_y_length-1; var_dims [2].min = 0; var_dims [2].max = total_z_length-1; // temp_var.dims = std::vector<md_dim_bounds>(var_dims, var_dims + temp_var.num_dims ); temp_var.dims = var_dims; // add_timing_point(VAR_INIT_DONE); uint64_t temp_var_id; // if ( (var_indx % my_num_clients_per_server) == (rank / num_servers) ) { if(insert_by_batch && rank < num_servers) { debug_log << "rank just pushed back var with id: " << temp_var.var_id << endl; all_vars_to_insert.push_back(temp_var); } else if (!insert_by_batch) { if ( (var_indx % num_client_procs) == (rank / num_servers) ) { extreme_debug_log << "var_indx: " << var_indx << endl; rc = metadata_create_var (server, temp_var_id, temp_var); if (rc != RC_OK) { error_log << "Error. Was unable to create the temp var. Exiting" << endl; error_log << "Failed var_id " << to_string(temp_var_id) << endl; add_timing_point(ERR_CREATE_VAR); return rc; } extreme_debug_log << "rank " << rank << " and server hexid: " << server.URL << " Finished creating var. new var_id " << var_indx << endl; } else { extreme_debug_log << "var id is greater than num vars so am skipping create \n"; } } return rc; } int write_data(int rank, const vector<double> &data_vctr, const md_catalog_run_entry &run, const string &objector_funct_name, uint32_t timestep_num, int64_t timestep_file_id, const md_catalog_var_entry &var, int var_indx, const vector<md_dim_bounds> &proc_dims_vctr, uint32_t num_run_timestep_types, double &timestep_temp_min, double &timestep_temp_max) { int rc = RC_OK; if(write_obj_data_to_map) { add_timing_point(CREATE_OBJS_AND_STORE_IN_MAP_START); rc = write_output(data_outputs, rank, run, objector_funct_name, var, proc_dims_vctr, data_vctr); if (rc != RC_OK) { error_log << "Error. Was unable write the output for rank " << rank << " \n"; add_timing_point(ERR_CREATE_OBJ_NAMES_AND_DATA); return rc; } add_timing_point(CREATE_OBJS_AND_STORE_IN_MAP_DONE); } else if (hdf5_write_data) { hdf5_write_chunk_data(timestep_file_id, var, proc_dims_vctr, rank, data_vctr); } if(var_indx == 0 && num_run_timestep_types > 0) { add_timing_point(CHUNK_MAX_MIN_FIND_START); timestep_temp_max = -1 *RAND_MAX; timestep_temp_min = RAND_MAX; for (double val : data_vctr) { if (val < timestep_temp_min) { timestep_temp_min = val; } if (val > timestep_temp_max) { timestep_temp_max = val; } } timestep_temp_min -= 100*timestep_num; timestep_temp_max += 100*timestep_num; add_timing_point(CHUNK_MAX_MIN_FIND_DONE); } //end if(var_indx == 0 && num_run_timestep_types > 0) return rc; } int create_var_attrs(md_server server, int rank, const vector<md_dim_bounds> proc_dims_vctr, uint32_t timestep_num, uint32_t var_indx, uint32_t num_types, vector<md_catalog_var_attribute_entry> &all_attrs_to_insert, double &timestep_temp_min, double &timestep_temp_max ) { int rc = RC_OK; //given in % float type_freqs[] = {25, 5, .1, 100, 100, 20, 2.5, .5, 1, 10}; // char type_types[10][3] = {"b", "b", "b", "d", "d", "2p","2p","2p","2d","2d"}; char type_types[10][3] = {"b", "b", "b", "d", "d", "s","s","s","2d","2d"}; add_timing_point(CREATE_VAR_ATTRS_FOR_NEW_VAR_START); for(uint32_t type_indx=0; type_indx<num_types; type_indx++) { // std::chrono::high_resolution_clock::time_point create_attr_start_time = chrono::high_resolution_clock::now(); float freq = type_freqs[type_indx]; uint32_t odds = 100 / freq; uint32_t val = rand() % odds; extreme_debug_log << "rank: " << to_string(rank) << " and val: " << to_string(val) << " and odds: " << to_string(odds) << endl; if(val == 0) { //makes sure we have the desired frequency for each type add_timing_point(CREATE_NEW_VAR_ATTR_START); uint64_t attr_id; md_catalog_var_attribute_entry temp_attr; temp_attr.timestep_id = timestep_num; temp_attr.type_id = type_indx+1; //note - if we change the id system this will change temp_attr.var_id = var_indx; //todo - are we okay with this? temp_attr.txn_id = timestep_num; temp_attr.num_dims = 3; // temp_attr.dims = std::vector<md_dim_bounds>(proc_dims_vctr, proc_dims_vctr + num_dims ); temp_attr.dims = proc_dims_vctr; //todo - you wont want this to be the entire chunk for all attrs if(strcmp(type_types[type_indx], "b") == 0) { bool flag = rank % 2; make_single_val_data(flag, temp_attr.data); temp_attr.data_type = ATTR_DATA_TYPE_INT; } else if(strcmp(type_types[type_indx], "d") == 0) { // int sign = pow(-1, rand() % 2); int sign = pow(-1,(type_indx+1)%2); //max will be positive, min will be neg double val = (double)rand() / RAND_MAX; // val = sign * (DBL_MIN + val * (DBL_MAX - DBL_MIN) ); //note - can use DBL MAX/MIN but the numbers end up being E305 to E308 // val = sign * (FLT_MIN + val * (FLT_MAX - FLT_MIN) ); //note - can use DBL MAX/MIN but the numbers end up being E35 to E38 val = sign * val * ( pow(10,10) ) ; //produces a number in the range [0,10^10] make_single_val_data(val, temp_attr.data); temp_attr.data_type = ATTR_DATA_TYPE_REAL; //if write data the chunk min and max for var 0 will be based on the actual data values (this is done above) if(!do_write_data && var_indx == 0 ) { if ( type_indx == 3 ) { timestep_temp_max = val; extreme_debug_log << "for rank: " << rank << " timestep: " << timestep_num << " just added " << val << " as the max value \n"; } else if (type_indx == 4 ) { timestep_temp_min = val; extreme_debug_log << "for rank: " << rank << " timestep: " << timestep_num << " just added " << val << " as the min value \n"; } } } else if(strcmp(type_types[type_indx], "s") == 0) { temp_attr.data = "attr data for var" + to_string(var_indx) + "timestep"+to_string(timestep_num); temp_attr.data_type = ATTR_DATA_TYPE_TEXT; } else if(strcmp(type_types[type_indx], "2d") == 0) { vector<int> vals(2); vals[0] = (int) (rand() % RAND_MAX); vals[1] = vals[0] + 10000; make_single_val_data(vals, temp_attr.data); temp_attr.data_type = ATTR_DATA_TYPE_BLOB; } else { error_log << "error. type didn't match list of possibilities" << endl; add_timing_point(ERR_TYPE_COMPARE); } add_timing_point(VAR_ATTR_INIT_DONE); if(insert_by_batch) { all_attrs_to_insert.push_back(temp_attr); // if(all_attrs_to_insert.size() < 5) { // extreme_debug_log << "for rank: " << rank << " the " << all_attrs_to_insert.size() << "th attr has val: " << temp_attr.data << endl; // } } else { // rc = metadata_insert_var_attribute_by_dims (server, attr_id, temp_attr); rc = metadata_insert_var_attribute_by_dims (server, attr_id, temp_attr); if (rc != RC_OK) { error_log << "Error. Was unable to insert the attribute for type indx" << type_indx << "var indx " << var_indx <<". Proceeding" << endl; add_timing_point(ERR_INSERT_VAR_ATTR); } extreme_debug_log << "rank: " << rank << "attr.data: " << temp_attr.data << endl; } add_timing_point(CREATE_NEW_VAR_ATTR_DONE); }//val = 0 done } //type loop done add_timing_point(CREATE_VAR_ATTRS_FOR_NEW_VAR_DONE); return rc; } int insert_vars_and_attrs_batch(md_server server, int rank, const vector<md_catalog_var_entry> &all_vars_to_insert, const vector<md_catalog_var_attribute_entry> &all_attrs_to_insert, uint32_t num_servers ) { int rc = RC_OK; if(rank < num_servers) { debug_log << "about to insert all vars of size: " << all_vars_to_insert.size() << endl; rc = metadata_create_var_batch (server, all_vars_to_insert); if (rc != RC_OK) { error_log << "Error. Was unable to insert the batch vars. Proceeding" << endl; add_timing_point(ERR_CREATE_VAR_BATCH); } } debug_log << "about to insert all attrs of size: " << all_attrs_to_insert.size() << endl; rc = metadata_insert_var_attribute_by_dims_batch (server, all_attrs_to_insert); if (rc != RC_OK) { error_log << "Error. Was unable to insert the batch attributes. Proceeding" << endl; add_timing_point(ERR_INSERT_VAR_ATTR_BATCH); } return rc; } int create_timestep_attrs(md_server server, int rank, double timestep_temp_min, double timestep_temp_max, uint32_t timestep_num, uint32_t num_types, uint32_t num_run_timestep_types, uint32_t num_client_procs, double *all_timestep_temp_mins_for_all_procs, double *all_timestep_temp_maxes_for_all_procs) { int rc = RC_OK; add_timing_point(CREATE_TIMESTEP_ATTRS_START); if(rank == 0 && num_run_timestep_types > 0) { double all_temp_maxes[num_client_procs]; double all_temp_mins[num_client_procs]; MPI_Gather(&timestep_temp_max, 1, MPI_DOUBLE, all_temp_maxes, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Gather(&timestep_temp_min, 1, MPI_DOUBLE, all_temp_mins, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); double timestep_var_max = -1 * RAND_MAX; double timestep_var_min = RAND_MAX; add_timing_point(GATHER_DONE_PROC_MAX_MIN_FIND_START); for (int proc_rank = 0; proc_rank<num_client_procs; proc_rank++) { if( all_temp_maxes[proc_rank] > timestep_var_max) { timestep_var_max = all_temp_maxes[proc_rank]; } if( all_temp_mins[proc_rank] < timestep_var_min) { timestep_var_min = all_temp_mins[proc_rank]; } } add_timing_point(PROC_MAX_MIN_FIND_DONE); all_timestep_temp_maxes_for_all_procs[timestep_num] = timestep_var_max; all_timestep_temp_mins_for_all_procs[timestep_num] = timestep_var_min; testing_log << "timestep " << timestep_num << " temperature max: " << timestep_var_max << endl; testing_log << "timestep " << timestep_num << " temperature min: " << timestep_var_min << endl; uint64_t temp_max_id; md_catalog_timestep_attribute_entry temp_max; temp_max.timestep_id = timestep_num; temp_max.type_id = num_types+1; temp_max.txn_id = timestep_num; make_single_val_data(timestep_var_max, temp_max.data); temp_max.data_type = ATTR_DATA_TYPE_REAL; uint64_t temp_min_id; md_catalog_timestep_attribute_entry temp_min; temp_min.timestep_id = timestep_num; temp_min.type_id = num_types+2; temp_min.txn_id = timestep_num; make_single_val_data(timestep_var_min, temp_min.data); temp_min.data_type = ATTR_DATA_TYPE_REAL; if(insert_by_batch) { vector<md_catalog_timestep_attribute_entry> all_timestep_attrs_to_insert = {temp_max, temp_min}; rc = metadata_insert_timestep_attribute_batch (server, all_timestep_attrs_to_insert); if (rc != RC_OK) { error_log << "Error. Was unable to insert timestep attributes by batch. Proceeding \n"; add_timing_point(ERR_INSERT_TIMESTEP_ATTR_BATCH); } } else { rc = metadata_insert_timestep_attribute (server, temp_max_id, temp_max); if (rc != RC_OK) { error_log << "Error. Was unable to insert the new timestep attribute. Proceeding \n"; add_timing_point(ERR_INSERT_TIMESTEP_ATTR); } debug_log << "New timestep attribute id is " << to_string(temp_max_id) << endl; rc = metadata_insert_timestep_attribute (server, temp_min_id, temp_min); if (rc != RC_OK) { error_log << "Error. Was unable to insert the new timestep attribute. Proceeding \n"; add_timing_point(ERR_INSERT_TIMESTEP_ATTR); } debug_log << "New timestep attribute id is " << to_string(temp_min_id) << endl; } } else if (num_run_timestep_types > 0) { MPI_Gather(&timestep_temp_max, 1, MPI_DOUBLE, NULL, NULL, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Gather(&timestep_temp_min, 1, MPI_DOUBLE, NULL, NULL, MPI_DOUBLE, 0, MPI_COMM_WORLD); } add_timing_point(CREATE_TIMESTEP_ATTRS_DONE); return rc; } int activate_timestep_components(md_server server, uint32_t timestep_num) { int rc; rc = metadata_activate_timestep ( server, timestep_num); if (rc != RC_OK) { error_log << "Error. Was unable to activate the " << timestep_num << "th timestep. Exitting \n"; add_timing_point(ERR_ACTIVATE_TIMESTEP); return rc; } rc = metadata_activate_var ( server, timestep_num); if (rc != RC_OK) { error_log << "Error. Was unable to activate the vars for the " << timestep_num << "th timestep. Exitting \n"; add_timing_point(ERR_ACTIVATE_VAR); return rc; } rc = metadata_activate_var_attribute (server, timestep_num); if (rc != RC_OK) { error_log << "Error. Was unable to activate the types. Exitting \n"; add_timing_point(ERR_ACTIVATE_VAR_ATTR); return rc; } rc = metadata_activate_timestep_attribute ( server, timestep_num); if (rc != RC_OK) { error_log << "Error. Was unable to activate the timestep attrs. Exitting \n"; add_timing_point(ERR_ACTIVATE_TIMESTEP_ATTR); return rc; } return rc; } int create_run_attrs(md_server server, int rank, double *all_timestep_temp_mins_for_all_procs, double *all_timestep_temp_maxes_for_all_procs, uint64_t run_id, uint32_t num_timesteps, uint32_t num_types ) { int rc = RC_OK; add_timing_point(CREATE_RUN_ATTRS_START); double run_temp_max = -1 * RAND_MAX; double run_temp_min = RAND_MAX; add_timing_point(TIMESTEP_MAX_MIN_FIND_START); for(int timestep = 0; timestep < num_timesteps; timestep++) { if( all_timestep_temp_maxes_for_all_procs[timestep] > run_temp_max) { run_temp_max = all_timestep_temp_maxes_for_all_procs[timestep]; } if( all_timestep_temp_mins_for_all_procs[timestep] < run_temp_min) { run_temp_min = all_timestep_temp_mins_for_all_procs[timestep]; } } add_timing_point(TIMESTEP_MAX_MIN_FIND_DONE); uint64_t temp_max_id; md_catalog_run_attribute_entry temp_max; temp_max.type_id = num_types+1; temp_max.txn_id = run_id; make_single_val_data(run_temp_max, temp_max.data); testing_log << "run temperature max: " << run_temp_max << endl; temp_max.data_type = ATTR_DATA_TYPE_REAL; uint64_t temp_min_id; md_catalog_run_attribute_entry temp_min; temp_min.type_id = num_types+2; temp_min.txn_id = run_id; make_single_val_data(run_temp_min, temp_min.data); testing_log << "run temperature min: " << run_temp_min << endl; temp_min.data_type = ATTR_DATA_TYPE_REAL; if(insert_by_batch) { vector<md_catalog_run_attribute_entry> all_run_attributes_to_insert = {temp_max, temp_min}; rc = metadata_insert_run_attribute_batch (server, all_run_attributes_to_insert); if (rc != RC_OK) { error_log << "Error. Was unable to insert the new run attributes by batch. Proceeding \n"; add_timing_point(ERR_INSERT_RUN_ATTR_BATCH); } } else { rc = metadata_insert_run_attribute (server, temp_max_id, temp_max); if (rc != RC_OK) { error_log << "Error. Was unable to insert the new run attribute. Proceeding \n"; add_timing_point(ERR_INSERT_RUN_ATTR); } debug_log << "New run attribute id is " << to_string(temp_max_id) << endl; rc = metadata_insert_run_attribute (server, temp_min_id, temp_min); if (rc != RC_OK) { error_log << "Error. Was unable to insert the new run attribute. Proceeding \n"; add_timing_point(ERR_INSERT_RUN_ATTR); } debug_log << "New run attribute id is " << to_string(temp_min_id) << endl; } rc = metadata_activate_run_attribute ( server, run_id); if (rc != RC_OK) { error_log << "Error. Was unable to activate the run attrs. Exitting \n"; add_timing_point(ERR_ACTIVATE_RUN_ATTR); return rc; } add_timing_point(CREATE_RUN_ATTRS_DONE); return rc; } static int setup_dirman(const string &dirman_file_path, const string &dir_path, md_server &dirman, vector<gutties::name_and_node_t> &server_procs, int rank, uint32_t num_servers, uint32_t num_clients) { bool ok; int rc; char *serialized_c_str; int length_ser_c_str; // gutties::name_and_node_t *server_ary; if(rank == 0) { struct stat buffer; bool dirman_initted = false; std::ifstream file; string dirman_hexid; DirectoryInfo dir; while (!dirman_initted) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); dirman_initted = (stat (dirman_file_path.c_str(), &buffer) == 0); debug_log << "dirman not initted yet \n"; } file.open(dirman_file_path); if(!file) { return RC_ERR; } while( file.peek() == std::ifstream::traits_type::eof() ) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); debug_log << "dirman file empty \n"; } file >> dirman_hexid; debug_log << "just got the hexid: " << dirman_hexid << endl; gutties::Configuration config(default_config_string); config.Append("dirman.root_node", dirman_hexid); config.Append("webhook.port", to_string(3000+rank)); //note if you up number of servers you'll want to up this config.AppendFromReferences(); debug_log << "just configged" << endl; gutties::bootstrap::Start(config, opbox::bootstrap); //Add the directory manager's URL to the config string so the clients know //Where to access the directory //------------------------------------------- //TODO: This connect is temporarily necessary gutties::nodeid_t dirman_nodeid(dirman_hexid); extreme_debug_log << "Dirman node ID " << dirman_nodeid.GetHex() << " " << dirman_nodeid.GetIP() << " port " << dirman_nodeid.GetPort() << endl; dirman.name_and_node.node = dirman_nodeid; extreme_debug_log << "about to connect peer to node" << endl; rc = net::Connect(&dirman.peer_ptr, dirman.name_and_node.node); assert(rc==RC_OK && "could not connect"); extreme_debug_log << "just connected" << endl; //------------------------------------------- extreme_debug_log << "app name is " << dir_path << endl; ok = dirman::GetRemoteDirectoryInfo(gutties::ResourceURL(dir_path), &dir); assert(ok && "Could not get info about the directory?"); extreme_debug_log << "just got directory info" << endl; while( dir.children.size() < num_servers) { debug_log << "dir.children.size() < num_servers. dir.children.size(): " << dir.children.size() << " num_servers: " << num_servers << endl; std::this_thread::sleep_for(std::chrono::milliseconds(10)); ok = dirman::GetRemoteDirectoryInfo(gutties::ResourceURL(dir_path), &dir); extreme_debug_log << "and now dir.children.size() < num_servers. dir.children.size(): " << dir.children.size() << " num_servers: " << num_servers << endl; assert(ok && "Could not get info about the directory?"); extreme_debug_log << "just got directory info" << endl; } debug_log << "dir init is done" << endl; server_procs = dir.children; extreme_debug_log << "about to serialize server_procs \n"; stringstream ss; boost::archive::text_oarchive oa(ss); if(server_procs.size() > 0) { //leaving off here. looks kike sometimes the string isn't getting copied properly? (could have embedded nulls) oa << server_procs; string serialized_str = ss.str(); length_ser_c_str = serialized_str.size() + 1; serialized_c_str = (char *) malloc(length_ser_c_str); serialized_str.copy(serialized_c_str, serialized_str.size()); } else { error_log << "error. thinks the correct number of servers is 0 \n"; return RC_ERR; } } MPI_Bcast(&length_ser_c_str, 1, MPI_INT, 0, MPI_COMM_WORLD); if(rank != 0) { debug_log << "num_bytes is "<< to_string(length_ser_c_str) + " and rank: " << to_string(rank) << endl; serialized_c_str = (char *) malloc(length_ser_c_str); } MPI_Bcast(serialized_c_str, length_ser_c_str, MPI_CHAR, 0, MPI_COMM_WORLD); if (rank != 0) { extreme_debug_log << "serialized_c_str: " << (string)serialized_c_str << endl; stringstream ss1; ss1.write(serialized_c_str, length_ser_c_str); boost::archive::text_iarchive ia(ss1); ia >> server_procs; //todo - should decide if we want to have a dedicated dirman, if //not, just need to adjust so "dirman" is server rank 0 gutties::Configuration config(default_config_string); config.Append("dirman.root_node", server_procs[0].node.GetHex()); config.Append("webhook.port", to_string(3000+rank)); //note if you up number of servers you'll want to up this config.AppendFromReferences(); debug_log << "just configged" << endl; gutties::bootstrap::Start(config, opbox::bootstrap); } free(serialized_c_str); for (int i=0; i<num_servers; i++) { extreme_debug_log << "server " << i << " in ary has hexid " << server_procs[i].node.GetHex() << endl; } // server_procs = temp(server_ary, server_ary +(int)num_servers); extreme_debug_log << "done initing dirman" << endl; return RC_OK; } static void setup_server(int rank, uint32_t num_servers, const vector<gutties::name_and_node_t> &server_nodes, md_server &server) { int server_indx = rank % num_servers; server.name_and_node = server_nodes[server_indx]; net::Connect(&server.peer_ptr, server.name_and_node.node); server.URL = server.name_and_node.node.GetHex(); extreme_debug_log << "server.URL: " << server.URL << endl; extreme_debug_log << "server_indx: " << server_indx << endl; } void output_obj_names_and_timing(int rank, uint32_t num_client_procs, const md_catalog_run_entry &temp_run, const md_catalog_var_entry &temp_var, uint32_t num_timesteps, uint32_t num_vars ) { long double *all_time_pts_buf; if (output_objector_params) { gather_and_print_output_params(all_objector_params, rank, num_client_procs); } else if (output_obj_names) { uint64_t x_width, last_x_width; if(rank == 0) { uint64_t ndx = ( temp_var.dims[0].max - temp_var.dims[0].min + 1 ) / temp_run.npx; uint64_t ndy = ( temp_var.dims[1].max - temp_var.dims[1].min + 1 ) / temp_run.npy; uint64_t ndz = ( temp_var.dims[2].max - temp_var.dims[2].min + 1 ) / temp_run.npz; uint64_t chunk_volume = ndx * ndy * ndz; uint64_t chunk_size = chunk_volume * temp_var.data_size; get_obj_lengths(temp_var, x_width, last_x_width, ndx, chunk_size); uint64_t regular_object_volume = x_width * ndy * ndz; uint64_t last_object_volume = last_x_width * ndy * ndz; printf("chunk size: ndx: %d, ndy: %d, ndz: %d. total chunk volume %d\n", ndx,ndy,ndz,chunk_volume); printf("obj size: ndx: %d, ndy: %d, ndz: %d. for last object in chunk ndx: %d\n", x_width,ndy,ndz,last_x_width); printf("regular object volume: %d, regular object size: %d. last object volume: %d, last object size: %d \n\n", regular_object_volume,regular_object_volume*temp_var.data_size,last_object_volume,last_object_volume*temp_var.data_size); } gather_and_print_object_names(all_object_names, rank, num_client_procs, num_timesteps, num_vars); } if(output_timing) { double accum2 = std::accumulate(all_num_objects_to_fetch.begin(), all_num_objects_to_fetch.end(), 0.0); if( all_object_names.size() != accum2 ) { error_log << "error. all_num_objects_to_fetch.size(): " << all_object_names.size() << " sum(all_object_names): " << accum2 << endl; } else { debug_log << "all_num_objects_to_fetch.size() == accum2 == " << accum2 << endl; } int each_proc_num_objector_outputs[num_client_procs]; int object_name_displacement_for_each_proc[num_client_procs]; int *num_objects_to_fetch_for_all_procs; gatherv_int(all_num_objects_to_fetch, num_client_procs, rank, each_proc_num_objector_outputs, object_name_displacement_for_each_proc, &num_objects_to_fetch_for_all_procs); int each_proc_num_time_pts[num_client_procs]; int displacement_for_each_proc[num_client_procs]; int *all_catg_time_pts_buf; gatherv_int(catg_of_time_pts, num_client_procs, rank, each_proc_num_time_pts, displacement_for_each_proc, &all_catg_time_pts_buf); int sum = 0; if(rank == 0) { // for(int i = 0; i < num_client_procs; i++) { // sum += each_proc_num_time_pts[i]; // } sum = accumulate(each_proc_num_time_pts, each_proc_num_time_pts+num_client_procs, sum); extreme_debug_log << "sum: " << sum << endl; all_time_pts_buf = (long double *) malloc(sum * sizeof(long double)); } int num_time_pts = time_pts.size(); debug_log << "num_time pts: " << to_string(num_time_pts) << "time_pts.size(): " << time_pts.size()<< endl; MPI_Gatherv(&time_pts[0], num_time_pts, MPI_LONG_DOUBLE, all_time_pts_buf, each_proc_num_time_pts, displacement_for_each_proc, MPI_LONG_DOUBLE, 0, MPI_COMM_WORLD); if (rank == 0) { //prevent it from buffering the printf statements setbuf(stdout, NULL); std::cout << "begin timing output" << endl; int obj_count = 0; int objector_output_count = 0; for(int i=0; i<sum; i++) { if (output_obj_names && all_catg_time_pts_buf[i] == BOUNDING_BOX_TO_OBJ_NAMES) { printf("%d %d ", all_catg_time_pts_buf[i], num_objects_to_fetch_for_all_procs[objector_output_count]); objector_output_count += 1; } else if (output_objector_params && all_catg_time_pts_buf[i] == BOUNDING_BOX_TO_OBJ_NAMES) { printf("%d %d ", all_catg_time_pts_buf[i], 1); obj_count += 1; } else { // cout << "all_time_pts_buf[i]: " << all_time_pts_buf[i] << endl; printf("%d %Lf ", all_catg_time_pts_buf[i], all_time_pts_buf[i]); } // std::cout << all_catg_time_pts_buf[i] << " " << all_time_pts_buf[i] << " "; if (i%20 == 0 && i!=0) { std::cout << std::endl; } } std::cout << std::endl; // // free(all_clock_times); free(all_time_pts_buf); free(all_catg_time_pts_buf); free(num_objects_to_fetch_for_all_procs); } } } template <class T> static void make_single_val_data (T val, string &serial_str) { extreme_debug_log << "about to make single val data \n"; stringstream ss; boost::archive::text_oarchive oa(ss); oa << val; serial_str = ss.str(); } template <class T1, class T2> static void make_double_val_data (T1 val_0, T2 val_1, string &serial_str) { extreme_debug_log << "about to make double val data \n"; stringstream ss; boost::archive::text_oarchive oa(ss); oa << val_0; oa << val_1; serial_str = ss.str(); } void gather_and_print_output_params(const vector<objector_params> &all_objector_params, int rank, uint32_t num_client_procs) { extreme_debug_log.set_rank(rank); int length_ser_c_str = 0; char *serialized_c_str; int each_proc_ser_objector_params_size[num_client_procs]; int displacement_for_each_proc[num_client_procs]; char *serialized_c_str_all_objector_params; stringstream ss; boost::archive::text_oarchive oa(ss); // extreme_debug_log << "rank " << rank << " about to try serializing at the beginning" << endl; oa << all_objector_params; // extreme_debug_log << "rank " << rank << " just finished serializing at the beginning" << endl; string serialized_str = ss.str(); length_ser_c_str = serialized_str.size() + 1; serialized_c_str = (char *) malloc(length_ser_c_str); serialized_str.copy(serialized_c_str, serialized_str.size()); serialized_c_str[serialized_str.size()]='\0'; // extreme_debug_log << "rank " << rank << " attrs ser string is of size " << length_ser_c_str << " serialized_str " << // serialized_str << " serialized_c_str: " << serialized_c_str << endl; extreme_debug_log << "rank " << rank << " params ser string is of size " << length_ser_c_str << " serialized_str " << serialized_str << endl; // extreme_debug_log << "rank " << rank << " about to allgather" << endl; MPI_Gather(&length_ser_c_str, 1, MPI_INT, each_proc_ser_objector_params_size, 1, MPI_INT, 0, MPI_COMM_WORLD); // extreme_debug_log << "rank " << rank << " about with allgather" << endl; int num_iterations; int max_value = 0; int sum = 0; if (rank == 0 ) { for(int i=0; i<num_client_procs; i++) { displacement_for_each_proc[i] = sum; sum += each_proc_ser_objector_params_size[i]; if(each_proc_ser_objector_params_size[i] != 0 && rank == 0) { extreme_debug_log << "rank " << i << " has a string of length " << each_proc_ser_objector_params_size[i] << endl; } if (each_proc_ser_objector_params_size[i] > max_value) { max_value = each_proc_ser_objector_params_size[i]; } } extreme_debug_log << "sum: " << sum << endl; serialized_c_str_all_objector_params = (char *) malloc(sum); } // extreme_debug_log << "num_bytes is "<< to_string(length_ser_c_str) + " and rank: " << to_string(rank) << endl; // extreme_debug_log << "rank " << rank << " about to allgatherv" << endl; MPI_Gatherv(serialized_c_str, length_ser_c_str, MPI_CHAR, serialized_c_str_all_objector_params, each_proc_ser_objector_params_size, displacement_for_each_proc, MPI_CHAR, 0, MPI_COMM_WORLD); // extreme_debug_log << "rank " << rank << " done with allgatherv" << endl; // extreme_debug_log << "entire set of attr vectors: " << serialized_c_str_all_objector_params << " and is of length: " << strlen(serialized_c_str_all_objector_params) << endl; if(rank == 0) { cout <<"rank, get_counts, job_id, sim_name, timestep, ndx, ndy, ndz, " << "ceph_obj_size, var_name, var_version, data_size, x1, " << "y1, z1, x2, y2, z2, " << "var_x1, var_x2, var_y1, var_y2, var_z1, var_z2 \n"; for(int i = 0; i < num_client_procs; i++) { int offset = displacement_for_each_proc[i]; int count = each_proc_ser_objector_params_size[i]; if(count > 0) { vector<objector_params> rec_objector_params; if(i != rank) { extreme_debug_log << "rank " << rank << " count: " << count << " offset: " << offset << endl; char serialzed_objector_params_for_one_proc[count]; memcpy ( serialzed_objector_params_for_one_proc, serialized_c_str_all_objector_params + offset, count); objector_params rec_objector_params; extreme_debug_log << "rank " << rank << " serialized_c_str: " << (string)serialzed_objector_params_for_one_proc << endl; extreme_debug_log << " serialized_c_str length: " << strlen(serialzed_objector_params_for_one_proc) << " count: " << count << endl; stringstream ss1; ss1.write(serialzed_objector_params_for_one_proc, count); extreme_debug_log << "about to deserialize ss: " << ss1.str() << endl; boost::archive::text_iarchive ia(ss1); ia >> rec_objector_params; } else { //i == rank rec_objector_params = all_objector_params; } extreme_debug_log << "num entries in rec_objector_params: " << rec_objector_params.size() << endl; // cout <<"rank get_counts false job_id sim_name timestep " << // "ndx ndy ndz " << // "ceph_obj_size var_name var_version data_size x1 " << // "y1 z1 x2 y2 z2 " << // "var_x1 var_x2 var_y1 var_y2 var_z1 var_z2 \n"; int len = to_string(max( rec_objector_params.at(0).var_dims[0].max, max(rec_objector_params.at(0).var_dims[1].max, rec_objector_params.at(0).var_dims[2].max) )).length(); int len2 = to_string(num_client_procs - 1).length(); for( objector_params object_name : rec_objector_params) { // function boundingBoxToObjectNamesAndCounts(get_counts, job_id, sim_name, timestep, ndx, ndy, ndz, ceph_obj_size, var_name, var_version, data_size, x1, y1, z1, x2, y2, z2, var_x1, var_x2, var_y1, var_y2, var_z1, var_z2) //todo change %s to have max num digits if ever start using more than 1 run name //todo change %llu to have max num digits if ever start using multi digit timestep ids //todo change %lu to have max num digits if ever start using multi digit var versions printf("%*d, false, %8llu, %s, %llu, %llu, %llu, %llu, " "8000000, %10s, %lu, 8, %*llu, %*llu, %*llu, %*llu, %*llu, %*llu, " "%*llu, %*llu, %*llu, %*llu, %*llu, %*llu \n", len2, i, object_name.job_id, object_name.run_name.c_str(), object_name.timestep_id, object_name.ndx, object_name.ndy, object_name.ndz, object_name.var_name.c_str(), object_name.var_version, len, object_name.bounding_box[0].min, len, object_name.bounding_box[1].min, len, object_name.bounding_box[2].min, len, object_name.bounding_box[0].max, len, object_name.bounding_box[1].max, len, object_name.bounding_box[2].max, len, object_name.var_dims[0].min, len, object_name.var_dims[0].max, len, object_name.var_dims[1].min, len, object_name.var_dims[1].max, len, object_name.var_dims[2].min, len, object_name.var_dims[2].max); // printf("rank: %6d, get_counts: false, job_id: %8llu, sim_name: %6s, timestep: %2llu, ndx: %10llu, ndy: %10llu, ndz: %10llu," // "ceph_obj_size: 8000000, var_name: %14s, var_version: %2lu, data_size: %1d, x1: %10llu, y1: %10llu, z1: %10llu, x2: %10llu, y2: %10llu, z2: %10llu," // "var_x1: %10llu, var_x2: %10llu, var_y1: %10llu, var_y2: %10llu, var_z1: %10llu, var_z2: %10llu \n", // i, object_name.job_id, object_name.run_name.c_str(), object_name.timestep_id, // object_name.ndx, object_name.ndy, object_name.ndz, object_name.var_name.c_str(), object_name.var_version, 8, // object_name.bounding_box[0].min, object_name.bounding_box[1].min, object_name.bounding_box[2].min, // object_name.bounding_box[0].max, object_name.bounding_box[1].max, object_name.bounding_box[2].max, // object_name.var_dims[0].min, object_name.var_dims[0].max, object_name.var_dims[1].min, // object_name.var_dims[1].max, object_name.var_dims[2].min, object_name.var_dims[2].max); } } cout << endl; } free(serialized_c_str_all_objector_params); } if(length_ser_c_str > 0) { free(serialized_c_str); } } objector_params get_objector_params ( const md_catalog_run_entry &run, const md_catalog_var_entry &var, const vector<md_dim_bounds> &bounding_box) { objector_params object_names; object_names.run_id = run.run_id; object_names.job_id = run.job_id; object_names.run_name = run.name; object_names.timestep_id = var.timestep_id; object_names.ndx = ( var.dims[0].max - var.dims[0].min + 1 ) / run.npx; object_names.ndy = ( var.dims[1].max - var.dims[1].min + 1) / run.npy; object_names.ndz = ( var.dims[2].max - var.dims[2].min + 1 ) / run.npz; object_names.var_id = var.var_id; object_names.var_name = var.name; object_names.var_version = var.version; object_names.var_dims = var.dims; object_names.bounding_box = bounding_box; // object_names.ceph_obj_size = 8000000 return object_names; } void gatherv_int(vector<int> values, uint32_t num_client_procs, int rank, int *each_proc_num_values, int *displacement_for_each_proc, int **all_values) { int num_values = values.size(); // int *values_ary = &values[0]; // if(rank == 0) { // for (int i = 0; i < 31; i++) { // extreme_debug_log << "i: " << i << " values[i]: " << values[i] << endl; // } // } MPI_Gather(&num_values, 1, MPI_INT, each_proc_num_values, 1, MPI_INT, 0, MPI_COMM_WORLD); int sum = 0; if (rank == 0 ) { for(int i=0; i<num_client_procs; i++) { displacement_for_each_proc[i] = sum; sum += each_proc_num_values[i]; if(each_proc_num_values[i] != 0 && rank == 0) { extreme_debug_log << "rank " << i << " has a string of length " << each_proc_num_values[i] << endl; } } *all_values = (int *) malloc(sum * sizeof(int)); extreme_debug_log << "sum: " << sum << endl; } // extreme_debug_log << "num_bytes is "<< to_string(length_ser_c_str) + " and rank: " << to_string(rank) << endl; // extreme_debug_log << "rank " << rank << " about to allgatherv" << endl; MPI_Gatherv(&values[0], num_values, MPI_INT, *all_values, each_proc_num_values, displacement_for_each_proc, MPI_INT, 0, MPI_COMM_WORLD); // if(rank == 0) { // for (int i = 0; i < 62; i++) { // extreme_debug_log << "i: " << i << " all_values[i]: " << *all_values[i] << endl; // } // } } template <class T> void gatherv_ser(T values, uint32_t num_client_procs, int rank, int *each_proc_ser_values_size, int *displacement_for_each_proc, char **serialized_c_str_all_ser_values) { int length_ser_c_str = 0; char *serialized_c_str; stringstream ss; boost::archive::text_oarchive oa(ss); oa << values; string serialized_str = ss.str(); length_ser_c_str = serialized_str.size() + 1; serialized_c_str = (char *) malloc(length_ser_c_str); serialized_str.copy(serialized_c_str, serialized_str.size()); serialized_c_str[serialized_str.size()]='\0'; // extreme_debug_log << "rank " << rank << " object_names ser string is of size " << length_ser_c_str << " serialized_str " << // serialized_str << endl; extreme_debug_log << "rank " << rank << " object_names ser string is of size " << length_ser_c_str << endl; // extreme_debug_log << "rank " << rank << " about to allgather" << endl; MPI_Gather(&length_ser_c_str, 1, MPI_INT, each_proc_ser_values_size, 1, MPI_INT, 0, MPI_COMM_WORLD); // extreme_debug_log << "rank " << rank << " about with allgather" << endl; // if (rank == 1) { // cout << "serialized_str: " << serialized_str << endl; // } int sum = 0; // int max_value = 0; if (rank == 0 ) { for(int i=0; i<num_client_procs; i++) { displacement_for_each_proc[i] = sum; sum += each_proc_ser_values_size[i]; if(each_proc_ser_values_size[i] != 0 && rank == 0) { extreme_debug_log << "rank " << i << " has a string of length " << each_proc_ser_values_size[i] << endl; } // if(displacement_for_each_proc[i] > max_value) { // max_value = displacement_for_each_proc[i]; // } } extreme_debug_log << "sum: " << sum << endl; *serialized_c_str_all_ser_values = (char *) malloc(sum); } extreme_debug_log << "num_bytes is "<< to_string(length_ser_c_str) + " and rank: " << to_string(rank) << endl; extreme_debug_log << "rank " << rank << " about to gatherv" << endl; MPI_Gatherv(serialized_c_str, length_ser_c_str, MPI_CHAR, *serialized_c_str_all_ser_values, each_proc_ser_values_size, displacement_for_each_proc, MPI_CHAR, 0, MPI_COMM_WORLD); extreme_debug_log << "just finished with gather v" << endl; free(serialized_c_str); } void gather_and_print_object_names(const vector<vector<string>> &all_object_names, int rank, uint32_t num_client_procs, uint32_t num_timesteps, uint32_t num_vars) { extreme_debug_log.set_rank(rank); uint16_t num_vars_per_run = num_vars * num_timesteps; vector<vector<vector<string>>> all_rec_obj_names(num_vars_per_run); for (int k = 0; k < all_object_names.size(); k++) { int each_proc_ser_object_names_size[num_client_procs]; int displacement_for_each_proc[num_client_procs]; char *serialized_c_str_all_object_names; vector<string> obj_names = all_object_names.at(k); if (obj_names.size() == 0) { cout << "error. rank: " << rank << "obj_names.size(): " << obj_names.size() << endl; } gatherv_ser(obj_names, num_client_procs, rank, each_proc_ser_object_names_size, displacement_for_each_proc, &serialized_c_str_all_object_names); // extreme_debug_log << "rank " << rank << " done with allgatherv" << endl; // extreme_debug_log << "entire set of attr vectors: " << serialized_c_str_all_object_names << " and is of length: " << strlen(serialized_c_str_all_object_names) << endl; if(rank == 0) { for(int i = 0; i < num_client_procs; i++) { int offset = displacement_for_each_proc[i]; int count = each_proc_ser_object_names_size[i]; if(count > 0) { vector<string> rec_obj_names; if(i != rank) { extreme_debug_log << "rank " << rank << " count: " << count << " offset: " << offset << endl; char serialzed_object_names_for_one_proc[count]; memcpy ( serialzed_object_names_for_one_proc, serialized_c_str_all_object_names + offset, count); extreme_debug_log << "rank " << rank << " serialized_c_str: " << (string)serialzed_object_names_for_one_proc << endl; extreme_debug_log << " serialized_c_str length: " << strlen(serialzed_object_names_for_one_proc) << " count: " << count << endl; stringstream ss1; ss1.write(serialzed_object_names_for_one_proc, count); extreme_debug_log << "about to deserialize ss: " << ss1.str() << endl; boost::archive::text_iarchive ia(ss1); ia >> rec_obj_names; } else { //i == rank rec_obj_names = all_object_names.at(k); } all_rec_obj_names.at(k).push_back(rec_obj_names); } } free(serialized_c_str_all_object_names); } } if (rank == 0) { int len2 = to_string(num_client_procs - 1).length(); cout <<"rank, object_name\n"; for (int i = 0; i < all_rec_obj_names.size(); i++) { int var_id = i % num_vars; int timestep_id = i / num_vars; //rank, timestep, var printf("\nobj names for TIMESTEP %d VAR %d:\n", timestep_id, var_id); vector<vector<string>> obj_names = all_rec_obj_names.at(i); for (int rank = 0; rank < obj_names.size(); rank++) { for (string obj_name : obj_names.at(rank)) { printf("%*d, %s\n", len2, rank, obj_name.c_str()); } // cout << endl; } } if(output_timing) { cout << "begin timing output" << endl; } } } static void get_obj_lengths(const md_catalog_var_entry &var, uint64_t &x_width, uint64_t &last_x_width, uint64_t ndx, uint64_t chunk_size) { uint64_t ceph_obj_size = 8000000; //todo extreme_debug_log << "chunk size: " << chunk_size << endl; uint32_t num_objs_per_chunk = round(chunk_size / ceph_obj_size); if(num_objs_per_chunk <= 0) { num_objs_per_chunk = 1; } extreme_debug_log << "num_objs_per_chunk: " << num_objs_per_chunk << endl; x_width = round(ndx / num_objs_per_chunk); if(x_width <= 0) { x_width = 1; } extreme_debug_log << "x_width: " << x_width << endl; last_x_width = ndx - x_width * (num_objs_per_chunk-1); if(last_x_width <= 0) { num_objs_per_chunk = num_objs_per_chunk + floor( (last_x_width-1) / x_width); last_x_width = ndx - x_width * (num_objs_per_chunk-1); } }
42.715385
241
0.618866
[ "object", "vector" ]
669fa705a84c9f2a2b736bd64ac8edb130f92099
6,767
cc
C++
mindspore/ccsrc/plugin/device/cpu/kernel/nth_element_cpu_kernel.cc
httpsgithu/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
1
2022-02-23T09:13:43.000Z
2022-02-23T09:13:43.000Z
mindspore/ccsrc/plugin/device/cpu/kernel/nth_element_cpu_kernel.cc
949144093/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
null
null
null
mindspore/ccsrc/plugin/device/cpu/kernel/nth_element_cpu_kernel.cc
949144093/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
null
null
null
/** * Copyright 2022 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include "plugin/device/cpu/kernel/nth_element_cpu_kernel.h" #include "plugin/device/cpu/hal/device/cpu_device_address.h" namespace mindspore { namespace kernel { namespace { constexpr size_t kNthElementInputsNum = 2; constexpr size_t kNthElementOutputsNum = 1; constexpr size_t kParallelDataNums = 32 * 1024; } // namespace size_t get_nth_element_num(const std::vector<size_t> &shape) { size_t size = 1; for (size_t i = 0; i < shape.size(); i++) { size *= shape[i]; } return size; } void NthElementCpuKernelMod::InitKernel(const CNodePtr &kernel_node) { MS_EXCEPTION_IF_NULL(kernel_node); kernel_name_ = common::AnfAlgo::GetCNodeName(kernel_node); input_n_shape_ = AnfAlgo::GetInputDeviceShape(kernel_node, 1); if (input_n_shape_.size() != 0) { MS_LOG(EXCEPTION) << "For NthElement, the input n must be a scalar or a 0-D tensor but got a " << input_n_shape_.size() << "-D tensor."; } input_shape_ = AnfAlgo::GetInputDeviceShape(kernel_node, 0); if (input_shape_.size() < 1) { MS_LOG(EXCEPTION) << "For NthElement, input size must be equal or greater than 1, " << "but got " << input_shape_.size() << "."; } output_shape_ = common::AnfAlgo::GetOutputInferShape(kernel_node, 0); input_elements_ = get_nth_element_num(input_shape_); output_elements_ = get_nth_element_num(output_shape_); reverse_ = common::AnfAlgo::GetNodeAttr<bool>(kernel_node, "reverse"); dtype_ = AnfAlgo::GetInputDeviceDataType(kernel_node, 0); } bool NthElementCpuKernelMod::Launch(const std::vector<kernel::AddressPtr> &inputs, const std::vector<kernel::AddressPtr> &, const std::vector<kernel::AddressPtr> &outputs) { CHECK_KERNEL_INPUTS_NUM(inputs.size(), kNthElementInputsNum, kernel_name_); CHECK_KERNEL_OUTPUTS_NUM(outputs.size(), kNthElementOutputsNum, kernel_name_); switch (dtype_) { case kNumberTypeFloat32: LaunchKernel<float>(inputs, outputs); break; case kNumberTypeFloat16: LaunchKernel<float16>(inputs, outputs); break; case kNumberTypeInt8: LaunchKernel<int8_t>(inputs, outputs); break; case kNumberTypeUInt16: LaunchKernel<uint16_t>(inputs, outputs); break; case kNumberTypeInt16: LaunchKernel<int16_t>(inputs, outputs); break; case kNumberTypeUInt8: LaunchKernel<uint8_t>(inputs, outputs); break; case kNumberTypeInt32: LaunchKernel<int32_t>(inputs, outputs); break; case kNumberTypeInt64: LaunchKernel<int64_t>(inputs, outputs); break; case kNumberTypeFloat64: LaunchKernel<double>(inputs, outputs); break; default: MS_EXCEPTION(TypeError) << "For NthElement, input data type must be float32, float16, int8, " << "uint16, int 16, uint8, int32, int64 or float64 but got data type " << TypeIdLabel(dtype_) << "."; } return true; } template <typename T> void NthElementCpuKernelMod::LaunchKernel(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &outputs) { auto *n_data = reinterpret_cast<int32_t *>(inputs[1]->addr); input_n_val_ = *n_data; if (input_n_val_ < 0 || input_n_val_ >= static_cast<int>(input_shape_.back())) { MS_LOG(EXCEPTION) << "For NthElement, the value of input n must be in [0, input.shape[-1]), " << "but got " << input_n_val_ << "."; } auto last_dim = input_shape_.back(); if (reverse_) { input_n_val_ = static_cast<int32_t>(last_dim - input_n_val_ - 1); } size_t index = IntToSize(input_n_val_); T *input_addrs = reinterpret_cast<T *>(inputs[0]->addr); T *output_addrs = reinterpret_cast<T *>(outputs[0]->addr); if (input_elements_ <= kParallelDataNums) { std::vector<T> buf(last_dim); for (size_t i = 0; i < output_elements_; i++) { const T *input_start = input_addrs + i * last_dim; const T *input_end = input_start + last_dim; std::copy(input_start, input_end, buf.begin()); std::nth_element(buf.begin(), buf.begin() + input_n_val_, buf.end()); output_addrs[i] = buf[index]; } } else { auto shard_nth_element = [this, &last_dim, &input_addrs, &output_addrs, &index](size_t start, size_t end) { std::vector<T> buf(last_dim); for (size_t i = start; i < end; ++i) { const T *input_start = input_addrs + i * last_dim; const T *input_end = input_start + last_dim; std::copy(input_start, input_end, buf.begin()); std::nth_element(buf.begin(), buf.begin() + input_n_val_, buf.end()); output_addrs[i] = buf[index]; } }; ParallelLaunchAutoSearch(shard_nth_element, output_elements_, this, &parallel_search_info_); } } std::vector<KernelAttr> NthElementCpuKernelMod::GetOpSupport() { static std::vector<KernelAttr> support_list = { KernelAttr().AddInputAttr(kNumberTypeFloat32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat32), KernelAttr().AddInputAttr(kNumberTypeFloat16).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat16), KernelAttr().AddInputAttr(kNumberTypeInt8).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt8), KernelAttr().AddInputAttr(kNumberTypeUInt16).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeUInt16), KernelAttr().AddInputAttr(kNumberTypeInt16).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt16), KernelAttr().AddInputAttr(kNumberTypeUInt8).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeUInt8), KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt32), KernelAttr().AddInputAttr(kNumberTypeInt64).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeInt64), KernelAttr().AddInputAttr(kNumberTypeFloat64).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeFloat64)}; return support_list; } MS_KERNEL_FACTORY_REG(NativeCpuKernelMod, NthElement, NthElementCpuKernelMod); // } } // namespace kernel } // namespace mindspore
44.228758
116
0.699719
[ "shape", "vector" ]
66a747acbd414b6272749e86a2ab525286afcca6
4,879
cpp
C++
modules/sensors/dynamic_sensor/test/HidRawSensorTest.cpp
lighthouse-os/hardware_libhardware
c6fa046a69d9b1adf474cf5de58318b677801e49
[ "Apache-2.0" ]
null
null
null
modules/sensors/dynamic_sensor/test/HidRawSensorTest.cpp
lighthouse-os/hardware_libhardware
c6fa046a69d9b1adf474cf5de58318b677801e49
[ "Apache-2.0" ]
null
null
null
modules/sensors/dynamic_sensor/test/HidRawSensorTest.cpp
lighthouse-os/hardware_libhardware
c6fa046a69d9b1adf474cf5de58318b677801e49
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "HidRawSensorTest" #include "HidDevice.h" #include "HidLog.h" #include "HidLog.h" #include "HidParser.h" #include "HidRawSensor.h" #include "HidSensorDef.h" #include "StreamIoUtil.h" #include "TestHidDescriptor.h" #include "Utils.h" #include <deque> #include <unordered_map> namespace android { namespace SensorHalExt { class HidRawDummyDevice : public HidDevice { public: struct DataPair { uint8_t id; std::vector<uint8_t> data; }; HidRawDummyDevice() { // dummy values mInfo = { .name = "Test sensor name", .physicalPath = "/physical/path", .busType = "USB", .vendorId = 0x1234, .productId = 0x5678, .descriptor = {0} }; } virtual const HidDeviceInfo& getDeviceInfo() { return mInfo; } // get feature from device virtual bool getFeature(uint8_t id, std::vector<uint8_t> *out) { auto i = mFeature.find(id); if (i == mFeature.end()) { return false; } *out = i->second; return true; } // write feature to device virtual bool setFeature(uint8_t id, const std::vector<uint8_t> &in) { auto i = mFeature.find(id); if (i == mFeature.end() || in.size() != i->second.size()) { return false; } i->second = in; return true; } // send report to default output endpoint virtual bool sendReport(uint8_t id, std::vector<uint8_t> &data) { DataPair pair = { .id = id, .data = data }; mOutput.push_back(pair); return true; } // receive from default input endpoint virtual bool receiveReport(uint8_t * /*id*/, std::vector<uint8_t> * /*data*/) { // not necessary, as input report can be directly feed to HidRawSensor for testing purpose return false; } bool dequeuOutputReport(DataPair *pair) { if (!mOutput.empty()) { return false; } *pair = mOutput.front(); mOutput.pop_front(); return true; } private: HidDeviceInfo mInfo; std::deque<DataPair> mOutput; std::unordered_map<uint8_t, std::vector<uint8_t>> mFeature; }; class HidRawSensorTest { public: static bool test() { bool ret = true; using namespace Hid::Sensor::SensorTypeUsage; std::unordered_set<unsigned int> interestedUsage{ ACCELEROMETER_3D, GYROMETER_3D, COMPASS_3D, CUSTOM}; SP(HidDevice) device(new HidRawDummyDevice()); HidParser hidParser; for (const TestHidDescriptor *p = gDescriptorArray; ; ++p) { if (p->data == nullptr || p->len == 0) { break; } const char *name = p->name != nullptr ? p->name : "unnamed"; if (!hidParser.parse(p->data, p->len)) { LOG_E << name << " parsing error!" << LOG_ENDL; ret = false; continue; } hidParser.filterTree(); LOG_V << name << " digest: " << LOG_ENDL; auto digestVector = hidParser.generateDigest(interestedUsage); LOG_V << digestVector; if (digestVector.empty()) { LOG_V << name << " does not contain interested usage" << LOG_ENDL; continue; } LOG_V << name << " sensor: " << LOG_ENDL; for (const auto &digest : digestVector) { LOG_I << "Sensor usage " << std::hex << digest.fullUsage << std::dec << LOG_ENDL; auto *s = new HidRawSensor(device, digest.fullUsage, digest.packets); if (s->mValid) { LOG_V << "Usage " << std::hex << digest.fullUsage << std::dec << LOG_ENDL; LOG_V << s->dump(); } else { LOG_V << "Sensor of usage " << std::hex << digest.fullUsage << std::dec << " not valid!" << LOG_ENDL; } } LOG_V << LOG_ENDL; } return ret; } }; }// namespace SensorHalExt }// namespace android int main() { return android::SensorHalExt::HidRawSensorTest::test() ? 0 : 1; }
29.932515
98
0.564255
[ "vector" ]
66aff0092ebddee437a0c32f5a89039f66664b0f
5,745
cpp
C++
flare/Pipeline.cpp
freakMeduza/flare
32003c1be20e8876948a4c97d9715059f1d32e5c
[ "MIT" ]
2
2022-01-02T15:45:36.000Z
2022-01-12T15:31:24.000Z
flare/Pipeline.cpp
freakMeduza/flare
32003c1be20e8876948a4c97d9715059f1d32e5c
[ "MIT" ]
null
null
null
flare/Pipeline.cpp
freakMeduza/flare
32003c1be20e8876948a4c97d9715059f1d32e5c
[ "MIT" ]
null
null
null
#include "Pipeline.hpp" #include "Device.hpp" #include "Shader.hpp" #include "Log.hpp" namespace { static constexpr const char* SHADER_ENTRY_POINT = "main"; } namespace fve { Pipeline::Pipeline(Device& device, const std::vector<std::shared_ptr<Shader>>& shaders, const Settings& settings) { std::vector<vk::PipelineShaderStageCreateInfo> shaderStageCreateInfos{}; for (auto shader : shaders) { vk::PipelineShaderStageCreateInfo shaderStageCreateInfo{}; shaderStageCreateInfo.setModule(shader->shaderModule()); shaderStageCreateInfo.setStage(shader->shaderStage()); shaderStageCreateInfo.setPName(SHADER_ENTRY_POINT); shaderStageCreateInfos.emplace_back(shaderStageCreateInfo); } vk::PipelineVertexInputStateCreateInfo vertexInputStateCreateInfo{}; vertexInputStateCreateInfo.setVertexBindingDescriptions(settings.bindingDescriptions); vertexInputStateCreateInfo.setVertexAttributeDescriptions(settings.attributeDescriptions); vk::PipelineColorBlendStateCreateInfo colorBlendStateCreateInfo{}; colorBlendStateCreateInfo.setLogicOpEnable(false); colorBlendStateCreateInfo.setLogicOp(vk::LogicOp::eCopy); colorBlendStateCreateInfo.setAttachmentCount(1); colorBlendStateCreateInfo.setPAttachments(&settings.colorBlendAttachmentState); colorBlendStateCreateInfo.setBlendConstants({ 0.f, 0.f, 0.f, 0.f }); vk::PipelineDynamicStateCreateInfo dynamicStateCreateInfo{}; dynamicStateCreateInfo.setDynamicStates(settings.dynamicStates); dynamicStateCreateInfo.setFlags({}); vk::GraphicsPipelineCreateInfo pipelineCreateInfo{}; pipelineCreateInfo.setStages(shaderStageCreateInfos); pipelineCreateInfo.setPVertexInputState(&vertexInputStateCreateInfo); pipelineCreateInfo.setPInputAssemblyState(&settings.inputAssemblyStateCreateInfo); pipelineCreateInfo.setPViewportState(&settings.viewportStateCreateInfo); pipelineCreateInfo.setPRasterizationState(&settings.rasterizationStateCreateInfo); pipelineCreateInfo.setPMultisampleState(&settings.multisampleStateCreateInfo); pipelineCreateInfo.setPDepthStencilState(&settings.depthStencilStateCreateInfo); pipelineCreateInfo.setPColorBlendState(&colorBlendStateCreateInfo); pipelineCreateInfo.setPDynamicState(&dynamicStateCreateInfo); pipelineCreateInfo.setLayout(settings.pipelineLayout); pipelineCreateInfo.setRenderPass(settings.renderPass); pipelineCreateInfo.setSubpass(settings.subpass); pipeline_ = device.logical().createGraphicsPipelineUnique(nullptr, pipelineCreateInfo); } Pipeline::~Pipeline() noexcept { } void Pipeline::bind(vk::CommandBuffer commandBuffer) { commandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, *pipeline_); } void Pipeline::defaultPipelineSettings(Settings& settings) noexcept { settings.inputAssemblyStateCreateInfo.setTopology(vk::PrimitiveTopology::eTriangleList); settings.inputAssemblyStateCreateInfo.setPrimitiveRestartEnable(false); settings.viewportStateCreateInfo.setViewportCount(1); settings.viewportStateCreateInfo.setPViewports(nullptr); settings.viewportStateCreateInfo.setScissorCount(1); settings.viewportStateCreateInfo.setPScissors(nullptr); settings.rasterizationStateCreateInfo.setDepthClampEnable(false); settings.rasterizationStateCreateInfo.setRasterizerDiscardEnable(false); settings.rasterizationStateCreateInfo.setPolygonMode(vk::PolygonMode::eFill); settings.rasterizationStateCreateInfo.setLineWidth(1.f); settings.rasterizationStateCreateInfo.setCullMode(vk::CullModeFlagBits::eNone); settings.rasterizationStateCreateInfo.setFrontFace(vk::FrontFace::eClockwise); settings.rasterizationStateCreateInfo.setDepthBiasEnable(false); settings.rasterizationStateCreateInfo.setDepthBiasConstantFactor(0.f); settings.rasterizationStateCreateInfo.setDepthBiasClamp(0.f); settings.rasterizationStateCreateInfo.setDepthBiasSlopeFactor(0.f); settings.multisampleStateCreateInfo.setSampleShadingEnable(false); settings.multisampleStateCreateInfo.setRasterizationSamples(vk::SampleCountFlagBits::e1); settings.multisampleStateCreateInfo.setMinSampleShading(1.f); settings.multisampleStateCreateInfo.setPSampleMask(nullptr); settings.multisampleStateCreateInfo.setAlphaToCoverageEnable(false); settings.multisampleStateCreateInfo.setAlphaToOneEnable(false); settings.colorBlendAttachmentState.setColorWriteMask(vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA); settings.colorBlendAttachmentState.setBlendEnable(false); settings.colorBlendAttachmentState.setSrcColorBlendFactor(vk::BlendFactor::eOne); settings.colorBlendAttachmentState.setDstColorBlendFactor(vk::BlendFactor::eZero); settings.colorBlendAttachmentState.setColorBlendOp(vk::BlendOp::eAdd); settings.colorBlendAttachmentState.setSrcAlphaBlendFactor(vk::BlendFactor::eOne); settings.colorBlendAttachmentState.setDstAlphaBlendFactor(vk::BlendFactor::eZero); settings.colorBlendAttachmentState.setAlphaBlendOp(vk::BlendOp::eAdd); settings.depthStencilStateCreateInfo.setDepthTestEnable(true); settings.depthStencilStateCreateInfo.setDepthWriteEnable(true); settings.depthStencilStateCreateInfo.setDepthCompareOp(vk::CompareOp::eLess); settings.depthStencilStateCreateInfo.setDepthBoundsTestEnable(false); settings.depthStencilStateCreateInfo.setMinDepthBounds(0.f); settings.depthStencilStateCreateInfo.setMaxDepthBounds(1.f); settings.depthStencilStateCreateInfo.setStencilTestEnable(false); settings.depthStencilStateCreateInfo.setFront({}); settings.depthStencilStateCreateInfo.setBack({}); settings.dynamicStates = { vk::DynamicState::eViewport, vk::DynamicState::eScissor }; } }
50.840708
116
0.836902
[ "vector" ]
66b77411e741de71307d29dbb44fb415979a3849
35,152
cpp
C++
perception_utils/src/vfh/vfh_pose_estimator.cpp
Tacha-S/perception
aefbb5612c84b46a745c7db4fe860a2456d6e7ef
[ "BSD-3-Clause" ]
17
2020-07-08T06:38:22.000Z
2021-09-20T01:18:12.000Z
perception_utils/src/vfh/vfh_pose_estimator.cpp
Tacha-S/perception
aefbb5612c84b46a745c7db4fe860a2456d6e7ef
[ "BSD-3-Clause" ]
116
2019-03-10T23:02:44.000Z
2021-07-22T15:28:14.000Z
perception_utils/src/vfh/vfh_pose_estimator.cpp
Tacha-S/perception
aefbb5612c84b46a745c7db4fe860a2456d6e7ef
[ "BSD-3-Clause" ]
4
2019-12-08T23:20:36.000Z
2021-06-02T09:32:30.000Z
#include <perception_utils/vfh/vfh_pose_estimator.h> #include <perception_utils/perception_utils.h> #include <perception_utils/pcl_typedefs.h> #include <pcl/io/vtk_lib_io.h> #include <vtkPolyDataMapper.h> #include <pcl/apps/render_views_tesselated_sphere.h> #include <pcl/visualization/pcl_visualizer.h> #include <pcl/surface/mls.h> #include <pcl/filters/filter.h> #include <ros/package.h> #include <chrono> #include <vector> using namespace std; /** \brief loads either a .pcd or .ply file into a pointcloud \param cloud pointcloud to load data into \param path path to pointcloud file */ bool VFHPoseEstimator::loadPointCloud(const boost::filesystem::path &path, PointCloud &cloud) { std::cout << "Loading: " << path.filename() << std::endl; //read pcd file pcl::PCDReader reader; if ( reader.read(path.native(), cloud) == -1) { PCL_ERROR("Could not read .pcd file\n"); return false; } return true; } /** \brief Load the list of angles from FLANN list file * \param list of angles * \param filename the input file name */ bool VFHPoseEstimator::loadFLANNAngleData ( std::vector<VFHPoseEstimator::CloudInfo> &cloudInfoList, const std::string &filename) { ifstream fs; fs.open (filename.c_str ()); if (!fs.is_open () || fs.fail ()) { return (false); } CloudInfo cloudinfo; std::string line; while (!fs.eof ()) { //read roll std::getline (fs, line, ' '); if (line.empty ()) { continue; } cloudinfo.roll = boost::lexical_cast<float>(line.c_str()); //read pitch std::getline (fs, line, ' '); if (line.empty ()) { continue; } cloudinfo.pitch = boost::lexical_cast<float>(line.c_str()); //read yaw std::getline (fs, line, ' '); if (line.empty ()) { continue; } cloudinfo.yaw = boost::lexical_cast<float>(line.c_str()); //read filename std::getline (fs, line); if (line.empty ()) { continue; } cloudinfo.filePath = boost::filesystem::path(line); cloudinfo.filePath.replace_extension(".pcd"); cloudInfoList.push_back (cloudinfo); } fs.close (); return (true); } bool VFHPoseEstimator::loadTransformData ( std::vector<VFHPoseEstimator::CloudInfo> &cloudInfoList, const std::string &filename) { ifstream fs; fs.open (filename.c_str ()); if (!fs.is_open () || fs.fail ()) { return (false); } int num_histograms = cloudInfoList.size(); assert(num_histograms != 0); int idx = 0; while (idx < num_histograms) { Eigen::Matrix4f transform; assert(idx < num_histograms); fs >> transform(0, 0); fs >> transform(0, 1); fs >> transform(0, 2); fs >> transform(0, 3); fs >> transform(1, 0); fs >> transform(1, 1); fs >> transform(1, 2); fs >> transform(1, 3); fs >> transform(2, 0); fs >> transform(2, 1); fs >> transform(2, 2); fs >> transform(2, 3); fs >> transform(3, 0); fs >> transform(3, 1); fs >> transform(3, 2); fs >> transform(3, 3); cloudInfoList.at(idx).transform = transform; idx++; } // TODO: verify there is no more data to read fs.close (); return (true); } /** \brief loads either angle data corresponding \param path path to .txt file containing angle information \param cloudInfo stuct to load theta and phi angles into */ bool VFHPoseEstimator::loadCloudAngleData(const boost::filesystem::path &path, CloudInfo &cloudInfo) { //open file std::cout << "Loading: " << path.filename() << std::endl; ifstream fs; fs.open (path.c_str()); if (!fs.is_open () || fs.fail ()) { return false; } //load angle data std::string angle; std::getline (fs, angle, ' '); cloudInfo.roll = static_cast<float>(atof(angle.c_str())); // std::getline (fs, angle); std::getline (fs, angle, ' '); cloudInfo.pitch = static_cast<float>(atof(angle.c_str())); std::getline (fs, angle); cloudInfo.yaw = static_cast<float>(atof(angle.c_str())); // cloudInfo.yaw = 0; fs.close (); //save filename cloudInfo.filePath = path; cloudInfo.filePath.replace_extension(".pcd"); return true; } /** \brief Search for the closest k neighbors * \param index the tree * \param vfhs pointer to the query vfh feature * \param k the number of neighbors to search for * \param indices the resultant neighbor indices * \param distances the resultant neighbor distances */ void VFHPoseEstimator::nearestKSearch ( flann::Index<flann::ChiSquareDistance<float>> &index, pcl::PointCloud<pcl::VFHSignature308>::Ptr vfhs, int k, flann::Matrix<int> &indices, flann::Matrix<float> &distances) { //store in flann query point flann::Matrix<float> p = flann::Matrix<float>(new float[histLength], 1, histLength); for (size_t i = 0; i < histLength; ++i) { p[0][i] = vfhs->points[0].histogram[i]; } indices = flann::Matrix<int>(new int[k], 1, k); distances = flann::Matrix<float>(new float[k], 1, k); index.knnSearch (p, indices, distances, k, flann::SearchParams (512)); delete[] p.ptr (); } std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> VFHPoseEstimator::getPoseConstrained ( const PointCloud::Ptr &cloud_in, const bool visMatch, const std::vector<std::string> &model_names, std::vector<double> *best_distances, std::vector<Eigen::Affine3f> *model_to_scene_transforms) { std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> matched_clouds; PointCloud::Ptr cloud(new PointCloud); // Upsample using MLS to common resolution pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointXYZ> mls; pcl::search::KdTree<pcl::PointXYZ>::Ptr mlsTree (new pcl::search::KdTree<pcl::PointXYZ>); Eigen::Vector4f centroid_cluster; pcl::compute3DCentroid (*cloud_in, centroid_cluster); float dist_to_sensor = centroid_cluster.norm (); float sigma = dist_to_sensor * 0.02f; mls.setComputeNormals (false); mls.setSearchMethod(mlsTree); mls.setSearchRadius (sigma); mls.setInputCloud(cloud_in); mls.setPolynomialFit (true); mls.setPolynomialOrder (2); mls.setUpsamplingMethod ( pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointXYZ>::SAMPLE_LOCAL_PLANE); mls.setUpsamplingRadius (0.003); //0.002 mls.setUpsamplingStepSize (0.001); //001 // mls.setUpsamplingMethod (pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointXYZ>::VOXEL_GRID_DILATION); // mls.setDilationIterations (2); // mls.setDilationVoxelSize (0.003);//3mm Kinect resolution mls.process(*cloud); cout << "FILTERED " << cloud->size() << endl; pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_rgb (new pcl::PointCloud<pcl::PointXYZRGB>); copyPointCloud(*cloud, *cloud_rgb); // cloud_rgb = perception_utils::DownsamplePointCloud(cloud_rgb, 0.0025); cloud_rgb = perception_utils::DownsamplePointCloud(cloud_rgb, 0.003); copyPointCloud(*cloud_rgb, *cloud); cout << "DOWNSAMPLED " << cloud->size() << endl; //Estimate normals Normals::Ptr normals (new Normals); pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normEst; normEst.setInputCloud(cloud); pcl::search::KdTree<pcl::PointXYZ>::Ptr normTree (new pcl::search::KdTree<pcl::PointXYZ>); normEst.setSearchMethod(normTree); normEst.setRadiusSearch(0.01); //0.005 normEst.compute(*normals); //Create VFH estimation class pcl::OURCVFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::VFHSignature308> vfh; vfh.setInputCloud(cloud); vfh.setInputNormals(normals); pcl::search::KdTree<pcl::PointXYZ>::Ptr vfhsTree (new pcl::search::KdTree<pcl::PointXYZ>); vfh.setSearchMethod(vfhsTree); //calculate VFHS features pcl::PointCloud<pcl::VFHSignature308>::Ptr vfhs (new pcl::PointCloud<pcl::VFHSignature308>); vfh.setViewPoint(0, 0, 0); // OUR-CVFH vfh.setEPSAngleThreshold(0.13f); // 5 / 180 * M_PI vfh.setCurvatureThreshold(0.035f); //1 vfh.setClusterTolerance(3.0f); //1 vfh.setNormalizeBins(true); // Set the minimum axis ratio between the SGURF axes. At the disambiguation phase, // this will decide if additional Reference Frames need to be created, if ambiguous. vfh.setAxisRatio(0.8); vfh.compute(*vfhs); std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>> sgurf_transforms; vfh.getTransforms(sgurf_transforms); //filenames const std::string kTrainPath = ros::package::getPath("perception_utils") + "/config/"; std::string featuresFileName = kTrainPath + "training_features.h5"; std::string anglesFileName = kTrainPath + "training_angles.list"; std::string transformsFileName = kTrainPath + "training_transforms.list"; std::string kdtreeIdxFileName = kTrainPath + "training_kdtree.idx"; // std::string featuresFileName = "training_features.h5"; // std::string anglesFileName = "training_angles.list"; // std::string kdtreeIdxFileName = "training_kdtree.idx"; cout << featuresFileName << endl; //allocate flann matrices static std::vector<CloudInfo> cloudInfoList; static bool training_loaded = false; flann::Matrix<int> k_indices; flann::Matrix<float> k_distances; flann::Matrix<float> data; //load training data angles list if (!training_loaded) { if (!loadFLANNAngleData(cloudInfoList, anglesFileName)) { std::cout << "Could not load FLANN angle data" << std::endl; return matched_clouds; } if (!loadTransformData(cloudInfoList, transformsFileName)) { std::cout << "Could not load transform data" << std::endl; return matched_clouds; } training_loaded = true; } flann::load_from_file (data, featuresFileName, "training_data"); // flann::Index<flann::ChiSquareDistance<float>> index (data, // flann::SavedIndexParams ("training_kdtree.idx")); // flann::Index<flann::ChiSquareDistance<float>> index (data, flann::SavedIndexParams (kdtreeIdxFileName.c_str())); //perform knn search index.buildIndex (); // Get distances to all histograms. int k = cloudInfoList.size(); nearestKSearch (index, vfhs, k, k_indices, k_distances); assert(!model_names.empty()); best_distances->clear(); best_distances->resize(model_names.size()); model_to_scene_transforms->clear(); model_to_scene_transforms->resize(model_names.size()); for (size_t jj = 0; jj < model_names.size(); ++jj) { double best_distance = std::numeric_limits<double>::max(); int best_index = -1; for (int ii = 0; ii < k; ++ii) { if (k_distances[0][ii] < best_distance) { std::string cloud_path = cloudInfoList.at(k_indices[0][ii]).filePath.string(); // Trailing underscore for correct name match. if (cloud_path.find(model_names[jj] + '_') == std::string::npos) { continue; } best_distance = k_distances[0][ii]; best_index = ii; } } assert(best_index != -1); best_distances->at(jj) = best_distance; //retrieve matched pointcloud PointCloud::Ptr cloudMatch (new PointCloud); pcl::PCDReader reader; reader.read(cloudInfoList.at(k_indices[0][best_index]).filePath.native(), *cloudMatch); matched_clouds.push_back(cloudMatch); // roll = cloudInfoList.at(k_indices[0][best_index]).roll; // pitch = cloudInfoList.at(k_indices[0][best_index]).pitch; // yaw = cloudInfoList.at(k_indices[0][best_index]).yaw; boost::filesystem::path model_to_view_transform_path = cloudInfoList.at( k_indices[0][best_index]).filePath; model_to_view_transform_path.replace_extension(".eig"); std::ifstream fs; fs.open(model_to_view_transform_path.c_str()); if (!fs.is_open () || fs.fail ()) { std::cout << "Could not load model transform: " << model_to_view_transform_path.c_str() << std::endl; return matched_clouds; } Eigen::Affine3f model_to_view_transform; fs >> model_to_view_transform.matrix()(0, 0); fs >> model_to_view_transform.matrix()(0, 1); fs >> model_to_view_transform.matrix()(0, 2); fs >> model_to_view_transform.matrix()(0, 3); fs >> model_to_view_transform.matrix()(1, 0); fs >> model_to_view_transform.matrix()(1, 1); fs >> model_to_view_transform.matrix()(1, 2); fs >> model_to_view_transform.matrix()(1, 3); fs >> model_to_view_transform.matrix()(2, 0); fs >> model_to_view_transform.matrix()(2, 1); fs >> model_to_view_transform.matrix()(2, 2); fs >> model_to_view_transform.matrix()(2, 3); fs >> model_to_view_transform.matrix()(3, 0); fs >> model_to_view_transform.matrix()(3, 1); fs >> model_to_view_transform.matrix()(3, 2); fs >> model_to_view_transform.matrix()(3, 3); fs.close(); Eigen::Affine3f training_cloud_transform, observed_cloud_transform, final_transform; training_cloud_transform.matrix() = cloudInfoList.at( k_indices[0][best_index]).transform; observed_cloud_transform.matrix() = sgurf_transforms[0]; final_transform = observed_cloud_transform.inverse() * training_cloud_transform * model_to_view_transform; model_to_scene_transforms->at(jj) = final_transform; // Output the results on screen if (visMatch) { pcl::console::print_highlight ("The closest neighbor is:\n"); pcl::console::print_info ("(%s) with a distance of: %f\n", cloudInfoList.at(k_indices[0][best_index]).filePath.c_str(), k_distances[0][best_index]); //retrieve matched pointcloud PointCloud::Ptr cloudMatch (new PointCloud); pcl::PCDReader reader; reader.read(cloudInfoList.at(k_indices[0][best_index]).filePath.native(), *cloudMatch); //Move point cloud so it is is centered at the origin Eigen::Matrix<float, 4, 1> centroid; pcl::compute3DCentroid(*cloudMatch, centroid); pcl::demeanPointCloud(*cloudMatch, centroid, *cloudMatch); //Visualize point cloud and matches //viewpoint calcs int y_s = (int)std::floor (sqrt (2.0)); int x_s = y_s + (int)std::ceil ((2.0 / (double)y_s) - y_s); double x_step = (double)(1 / (double)x_s); double y_step = (double)(1 / (double)y_s); int viewport = 0, l = 0, m = 0; //setup visualizer and add query cloud pcl::visualization::PCLVisualizer visu("KNN search"); visu.createViewPort (l * x_step, m * y_step, (l + 1) * x_step, (m + 1) * y_step, viewport); //Move point cloud so it is is centered at the origin PointCloud::Ptr cloudDemeaned (new PointCloud); pcl::compute3DCentroid(*cloud, centroid); pcl::demeanPointCloud(*cloud, centroid, *cloudDemeaned); visu.addPointCloud<pcl::PointXYZ> (cloudDemeaned, ColorHandler(cloud, 0.0 , 255.0, 0.0), "Query Cloud Cloud", viewport); visu.addText ("Query Cloud", 20, 30, 136.0 / 255.0, 58.0 / 255.0, 1, "Query Cloud", viewport); visu.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_FONT_SIZE, 18, "Query Cloud", viewport); visu.addCoordinateSystem (0.05, 0); //add matches to plot //shift viewpoint ++l; //names and text labels std::string viewName = "match"; std::string textString = viewName; std::string cloudname = viewName; //add cloud visu.createViewPort (l * x_step, m * y_step, (l + 1) * x_step, (m + 1) * y_step, viewport); visu.addPointCloud<pcl::PointXYZ> (cloudMatch, ColorHandler(cloudMatch, 0.0 , 255.0, 0.0), cloudname, viewport); visu.addText (textString, 20, 30, 136.0 / 255.0, 58.0 / 255.0, 1, textString, viewport); visu.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_FONT_SIZE, 18, textString, viewport); visu.spin(); } } return matched_clouds; } bool VFHPoseEstimator::getPose (const PointCloud::Ptr &cloud_in, float &roll, float &pitch, float &yaw, const bool visMatch) { // Downsample cloud to common resolution PointCloud::Ptr cloud(new PointCloud); pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_rgb (new pcl::PointCloud<pcl::PointXYZRGB>); copyPointCloud(*cloud_in, *cloud_rgb); cloud_rgb = perception_utils::DownsamplePointCloud(cloud_rgb, 0.0025); copyPointCloud(*cloud_rgb, *cloud); //Estimate normals Normals::Ptr normals (new Normals); pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normEst; normEst.setInputCloud(cloud); pcl::search::KdTree<pcl::PointXYZ>::Ptr normTree (new pcl::search::KdTree<pcl::PointXYZ>); normEst.setSearchMethod(normTree); normEst.setRadiusSearch(0.01); //0.005 normEst.compute(*normals); //Create VFH estimation class pcl::CVFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::VFHSignature308> vfh; vfh.setInputCloud(cloud); vfh.setInputNormals(normals); pcl::search::KdTree<pcl::PointXYZ>::Ptr vfhsTree (new pcl::search::KdTree<pcl::PointXYZ>); vfh.setSearchMethod(vfhsTree); //calculate VFHS features pcl::PointCloud<pcl::VFHSignature308>::Ptr vfhs (new pcl::PointCloud<pcl::VFHSignature308>); vfh.setViewPoint(0, 0, 0); vfh.compute(*vfhs); //filenames const std::string kTrainPath = ros::package::getPath("perception_utils") + "/config/"; std::string featuresFileName = kTrainPath + "training_features.h5"; std::string anglesFileName = kTrainPath + "training_angles.list"; std::string kdtreeIdxFileName = kTrainPath + "training_kdtree.idx"; // std::string featuresFileName = "training_features.h5"; // std::string anglesFileName = "training_angles.list"; // std::string kdtreeIdxFileName = "training_kdtree.idx"; cout << featuresFileName << endl; //allocate flann matrices std::vector<CloudInfo> cloudInfoList; flann::Matrix<int> k_indices; flann::Matrix<float> k_distances; flann::Matrix<float> data; //load training data angles list if (!loadFLANNAngleData(cloudInfoList, anglesFileName)) { return false; } flann::load_from_file (data, featuresFileName, "training_data"); // flann::Index<flann::ChiSquareDistance<float>> index (data, // flann::SavedIndexParams ("training_kdtree.idx")); // flann::Index<flann::ChiSquareDistance<float>> index (data, flann::SavedIndexParams (kdtreeIdxFileName.c_str())); //perform knn search index.buildIndex (); int k = 10; nearestKSearch (index, vfhs, k, k_indices, k_distances); roll = cloudInfoList.at(k_indices[0][0]).roll; pitch = cloudInfoList.at(k_indices[0][0]).pitch; yaw = cloudInfoList.at(k_indices[0][0]).yaw; // Output the results on screen if (visMatch) { pcl::console::print_highlight ("The closest neighbor is:\n"); pcl::console::print_info ("roll = %f, pitch = %f, yaw = %f, (%s) with a distance of: %f\n", roll * 180.0 / M_PI, pitch * 180.0 / M_PI, yaw * 180.0 / M_PI, cloudInfoList.at(k_indices[0][0]).filePath.c_str(), k_distances[0][0]); for (int ii = 1; ii < k; ++ii) { pcl::console::print_info ("roll = %f, pitch = %f, yaw = %f, (%s) with a distance of: %f\n", roll * 180.0 / M_PI, pitch * 180.0 / M_PI, yaw * 180.0 / M_PI, cloudInfoList.at(k_indices[0][ii]).filePath.c_str(), k_distances[0][ii]); } //retrieve matched pointcloud PointCloud::Ptr cloudMatch (new PointCloud); pcl::PCDReader reader; reader.read(cloudInfoList.at(k_indices[0][0]).filePath.native(), *cloudMatch); //Move point cloud so it is is centered at the origin Eigen::Matrix<float, 4, 1> centroid; pcl::compute3DCentroid(*cloudMatch, centroid); pcl::demeanPointCloud(*cloudMatch, centroid, *cloudMatch); //Visualize point cloud and matches //viewpoint calcs int y_s = (int)std::floor (sqrt (2.0)); int x_s = y_s + (int)std::ceil ((2.0 / (double)y_s) - y_s); double x_step = (double)(1 / (double)x_s); double y_step = (double)(1 / (double)y_s); int viewport = 0, l = 0, m = 0; //setup visualizer and add query cloud pcl::visualization::PCLVisualizer visu("KNN search"); visu.createViewPort (l * x_step, m * y_step, (l + 1) * x_step, (m + 1) * y_step, viewport); //Move point cloud so it is is centered at the origin PointCloud::Ptr cloudDemeaned (new PointCloud); pcl::compute3DCentroid(*cloud, centroid); pcl::demeanPointCloud(*cloud, centroid, *cloudDemeaned); visu.addPointCloud<pcl::PointXYZ> (cloudDemeaned, ColorHandler(cloud, 0.0 , 255.0, 0.0), "Query Cloud Cloud", viewport); visu.addText ("Query Cloud", 20, 30, 136.0 / 255.0, 58.0 / 255.0, 1, "Query Cloud", viewport); visu.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_FONT_SIZE, 18, "Query Cloud", viewport); visu.addCoordinateSystem (0.05, 0); //add matches to plot //shift viewpoint ++l; //names and text labels std::string viewName = "match"; std::string textString = viewName; std::string cloudname = viewName; //add cloud visu.createViewPort (l * x_step, m * y_step, (l + 1) * x_step, (m + 1) * y_step, viewport); visu.addPointCloud<pcl::PointXYZ> (cloudMatch, ColorHandler(cloudMatch, 0.0 , 255.0, 0.0), cloudname, viewport); visu.addText (textString, 20, 30, 136.0 / 255.0, 58.0 / 255.0, 1, textString, viewport); visu.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_FONT_SIZE, 18, textString, viewport); visu.spin(); } return true; } bool VFHPoseEstimator::generateTrainingViewsFromModels(boost::filesystem::path &dataDir) { boost::filesystem::path output_dir = dataDir / "rendered_views"; if (!boost::filesystem::is_directory(output_dir)) { boost::filesystem::create_directory(output_dir); } //loop over all ply files in the data directry and calculate vfh features boost::filesystem::directory_iterator dirItr(dataDir), dirEnd; for (dirItr; dirItr != dirEnd; ++dirItr) { if (dirItr->path().extension().native().compare(".ply") != 0) { continue; } std::cout << "Generating views for: " << dirItr->path().string() << std::endl; // Need to re-initialize this for every model because generated_views is not cleared internally. pcl::apps::RenderViewsTesselatedSphere render_views; // Pixel width of the rendering window, it directly affects the snapshot file size. render_views.setResolution(150); // Horizontal FoV of the virtual camera. render_views.setViewAngle(57.0f); // If true, the resulting clouds of the snapshots will be organized. render_views.setGenOrganized(true); // How much to subdivide the icosahedron. Increasing this will result in a lot more snapshots. render_views.setTesselationLevel(3); //1 // If true, the camera will be placed at the vertices of the triangles. If false, at the centers. // This will affect the number of snapshots produced (if true, less will be made). // True: 42 for level 1, 162 for level 2, 642 for level 3... // False: 80 for level 1, 320 for level 2, 1280 for level 3... render_views.setUseVertices(true); // If true, the entropies (the amount of occlusions) will be computed for each snapshot (optional). render_views.setComputeEntropies(true); pcl::PolygonMesh mesh; pcl::io::loadPolygonFile (dirItr->path().string().c_str(), mesh); pcl::PolygonMesh::Ptr mesh_in (new pcl::PolygonMesh(mesh)); pcl::PolygonMesh::Ptr mesh_out (new pcl::PolygonMesh(mesh)); pcl::PointCloud<PointT>::Ptr cloud_in (new pcl::PointCloud<PointT>); pcl::PointCloud<PointT>::Ptr cloud_out (new pcl::PointCloud<PointT>); pcl::fromPCLPointCloud2(mesh_in->cloud, *cloud_in); PointT min_pt, max_pt; pcl::getMinMax3D(*cloud_in, min_pt, max_pt); // Shift bottom most points to 0-z coordinate Eigen::Matrix4f transform; transform << 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -min_pt.z, 0, 0 , 0, 1; // Convert mm to m (assuming all CAD models/ply files are in mm) transform = 0.001 * transform; transformPointCloud(*cloud_in, *cloud_out, transform); *mesh_out = *mesh_in; pcl::toPCLPointCloud2(*cloud_out, mesh_out->cloud); vtkSmartPointer<vtkPolyData> object = vtkSmartPointer<vtkPolyData>::New (); pcl::io::mesh2vtk(*mesh_out, object); // Render render_views.addModelFromPolyData(object); // Aditya // render_views.generateViews(); // Object for storing the rendered views. std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> views; // Object for storing the poses, as 4x4 transformation matrices. std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>> poses; // Object for storing the entropies (optional). std::vector<float> entropies; render_views.getViews(views); render_views.getPoses(poses); render_views.getEntropies(entropies); size_t num_views = views.size(); cout << "Number of views: " << num_views << endl; std::ofstream fs; pcl::PCDWriter writer; for (size_t ii = 0; ii < num_views; ++ii) { // Write cloud info std::string transform_path, cloud_path, angles_path; boost::filesystem::path base_path = dirItr->path().stem(); boost::filesystem::path full_path = output_dir / base_path; transform_path = full_path.native() + "_" + std::to_string(ii) + ".eig"; cout << "Out path: " << transform_path << endl; fs.open(transform_path.c_str()); fs << poses[ii] << "\n"; fs.close (); // Save cloud cloud_path = full_path.native() + "_" + std::to_string(ii) + ".pcd"; writer.writeBinary (cloud_path.c_str(), *(views[ii])); // Save r,p,y angles_path = full_path.native() + "_" + std::to_string(ii) + ".txt"; // Eigen::Matrix<float,3,1> euler = poses[ii].eulerAngles(2,1,0); float yaw, pitch, roll; Eigen::Affine3f affine_mat(poses[ii]); pcl::getEulerAngles(affine_mat, roll, pitch, yaw); // yaw = euler(0,0); pitch = euler(1,0); roll = euler(2,0); fs.open(angles_path.c_str()); fs << roll << " " << pitch << " " << yaw << "\n"; fs.close (); } } return true; } bool VFHPoseEstimator::trainClassifier(boost::filesystem::path &dataDir) { //loop over all pcd files in the data directry and calculate vfh features // chrono::time_point<chrono::system_clock> start, end; start = chrono::system_clock::now(); PointCloud::Ptr cloud (new PointCloud); Eigen::Matrix<float, 4, 1> centroid; std::list<CloudInfo> training; //training data list boost::filesystem::directory_iterator dirItr(dataDir), dirEnd; boost::filesystem::path angleDataPath; for (dirItr; dirItr != dirEnd; ++dirItr) { //skip txt and other files if (dirItr->path().extension().native().compare(".pcd") != 0) { continue; } // if (dirItr->path().filename().string().find("963.111.00.dec_10") != std::string::npos) { // continue; // } // if (dirItr->path().filename().string().find("963.111.00.dec_11") != std::string::npos) { // continue; // } // if (dirItr->path().filename().string().find("100.919.00-cup_358") != std::string::npos) { // continue; // } //load point cloud if (!loadPointCloud(dirItr->path(), *cloud)) { return false; } std::vector<int> indices; pcl::removeNaNFromPointCloud(*cloud,*cloud, indices); cout << "UNFILTERED " << cloud->size() << endl; //load angle data from txt file angleDataPath = dirItr->path(); angleDataPath.replace_extension(".txt"); CloudInfo cloudInfo; if (!loadCloudAngleData(angleDataPath, cloudInfo)) { return false; } // Upsample using MLS to common resolution pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointXYZ> mls; pcl::search::KdTree<pcl::PointXYZ>::Ptr mlsTree (new pcl::search::KdTree<pcl::PointXYZ>); Eigen::Vector4f centroid_cluster; pcl::compute3DCentroid (*cloud, centroid_cluster); float dist_to_sensor = centroid_cluster.norm (); float sigma = dist_to_sensor * 0.02f; mls.setComputeNormals (false); mls.setSearchMethod(mlsTree); mls.setSearchRadius (sigma); mls.setInputCloud(cloud); mls.setPolynomialFit (true); mls.setPolynomialOrder (2); mls.setUpsamplingMethod ( pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointXYZ>::SAMPLE_LOCAL_PLANE); mls.setUpsamplingRadius (0.003); //0.002 mls.setUpsamplingStepSize (0.001); //001 // mls.setUpsamplingMethod (pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointXYZ>::VOXEL_GRID_DILATION); // mls.setDilationIterations (2); // mls.setDilationVoxelSize (0.003);//3mm Kinect resolution pcl::PointCloud<pcl::PointXYZ>::Ptr filtered(new pcl::PointCloud<pcl::PointXYZ>); mls.process(*filtered); copyPointCloud(*filtered, *cloud); cout << "FILTERED " << cloud->size() << endl; pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_rgb (new pcl::PointCloud<pcl::PointXYZRGB>); copyPointCloud(*cloud, *cloud_rgb); // cloud_rgb = perception_utils::DownsamplePointCloud(cloud_rgb, 0.0025); cloud_rgb = perception_utils::DownsamplePointCloud(cloud_rgb, 0.003); copyPointCloud(*cloud_rgb, *cloud); cout << "DOWNSAMPLED " << cloud->size() << endl; //setup normal estimation class Normals::Ptr normals (new Normals); pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normEst; pcl::search::KdTree<pcl::PointXYZ>::Ptr normTree (new pcl::search::KdTree<pcl::PointXYZ>); normEst.setInputCloud(cloud); normEst.setSearchMethod(normTree); normEst.setRadiusSearch(0.01); //0.005 //estimate normals normEst.compute(*normals); cout << "NORMALS COMPUTED\n"; //Create VFH estimation class pcl::OURCVFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::VFHSignature308> vfh; pcl::search::KdTree<pcl::PointXYZ>::Ptr vfhsTree (new pcl::search::KdTree<pcl::PointXYZ>); vfh.setSearchMethod(vfhsTree); pcl::PointCloud<pcl::VFHSignature308>::Ptr vfhs (new pcl::PointCloud<pcl::VFHSignature308>); vfh.setViewPoint(0, 0, 0); // OUR-CVFH vfh.setEPSAngleThreshold(0.13f); // 5 / 180 * M_PI vfh.setCurvatureThreshold(0.035f); //1 vfh.setClusterTolerance(3.0f); //0.015 vfh.setNormalizeBins(true); // Set the minimum axis ratio between the SGURF axes. At the disambiguation phase, // this will decide if additional Reference Frames need to be created, if ambiguous. vfh.setAxisRatio(0.8); //compute vfhs features vfh.setInputCloud(cloud); vfh.setInputNormals(normals); cout << "COMPUTING VFGHS\n"; vfh.compute(*vfhs); cout << "COMPUTED VFGHS\n"; std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>> sgurf_transforms; vfh.getTransforms(sgurf_transforms); //store vfhs feature in vfh model and push it to the training data list for (size_t j = 0; j < vfhs->size(); ++j) { CloudInfo specific_cloud_info = cloudInfo; specific_cloud_info.transform = sgurf_transforms[j]; for (size_t i = 0; i < histLength; ++i) { specific_cloud_info.hist[i] = vfhs->points[j].histogram[i]; } training.push_front(specific_cloud_info); } } //convert training data to FLANN format flann::Matrix<float> data (new float[training.size() * histLength], training.size(), histLength); size_t i = 0; std::list<CloudInfo>::iterator it; for (it = training.begin(); it != training.end(); ++it) { for (size_t j = 0; j < data.cols; ++j) { data[i][j] = it->hist[j]; } ++i; } //filenames std::string featuresFileName = "training_features.h5"; std::string anglesFileName = "training_angles.list"; std::string transformsFileName = "training_transforms.list"; std::string kdtreeIdxFileName = "training_kdtree.idx"; // Save features to data file flann::save_to_file (data, featuresFileName, "training_data"); // Save angles to data file std::ofstream fs; fs.open (anglesFileName.c_str ()); for (it = training.begin(); it != training.end(); ++it) { fs << it->roll << " " << it->pitch << " " << it->yaw << " " << it->filePath.native() << "\n"; } fs.close (); // Save SGURF transforms to file fs.open (transformsFileName.c_str ()); for (it = training.begin(); it != training.end(); ++it) { fs << it->transform << "\n"; } fs.close (); // Build the tree index and save it to disk pcl::console::print_error ("Building the kdtree index (%s) for %d elements...", kdtreeIdxFileName.c_str (), (int)data.rows); flann::Index<flann::ChiSquareDistance<float>> index (data, flann::LinearIndexParams ()); //flann::Index<flann::ChiSquareDistance<float> > index (data, flann::KDTreeIndexParams (4)); index.buildIndex (); index.save (kdtreeIdxFileName); delete[] data.ptr (); end = chrono::system_clock::now(); chrono::duration<double> elapsed_seconds = end-start; std::cout << "Training VFH classifier took " << elapsed_seconds.count() << " seconds" << std::endl; pcl::console::print_error (stderr, "Done\n"); return true; }
36.963197
113
0.625853
[ "cad", "mesh", "render", "object", "vector", "model", "transform" ]
66b9482fe608b4e3c04827f62fd7e7f6298e8e1e
18,669
cpp
C++
ds/security/gina/snapins/ade/snapin.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
ds/security/gina/snapins/ade/snapin.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
ds/security/gina/snapins/ade/snapin.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//+-------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1994 - 1997. // // File: snapin.cpp // // Contents: DLL support routines, class factory and registration // functions. // // Classes: // // Functions: // // History: 2-12-1998 stevebl comment header added // //--------------------------------------------------------------------------- #include "precomp.hxx" #include "initguid.h" #include "gpedit.h" extern const CLSID CLSID_Snapin = {0xBACF5C8A,0xA3C7,0x11D1,{0xA7,0x60,0x00,0xC0,0x4F,0xB9,0x60,0x3F}}; extern const wchar_t * szCLSID_Snapin = L"{BACF5C8A-A3C7-11D1-A760-00C04FB9603F}"; extern const CLSID CLSID_MachineSnapin = {0x942A8E4F,0xA261,0x11D1,{0xA7,0x60,0x00,0xc0,0x4f,0xb9,0x60,0x3f}}; extern const wchar_t * szCLSID_MachineSnapin = L"{942A8E4F-A261-11D1-A760-00C04FB9603F}"; // Main NodeType GUID on numeric format extern const GUID cNodeType = {0xF8B3A900,0X8EA5,0X11D0,{0X8D,0X3C,0X00,0XA0,0XC9,0X0D,0XCA,0XE7}}; // Main NodeType GUID on string format extern const wchar_t* cszNodeType = L"{F8B3A900-8EA5-11D0-8D3C-00A0C90DCAE7}"; // No public place for this now, real def is in gina\gpext\appmgmt\cs.idl. extern const IID IID_IClassAdmin = {0x00000191,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}}; // RSOP flavors: extern const CLSID CLSID_RSOP_Snapin = { 0x1bc972d6, 0x555c, 0x4ff7, {0xbe, 0x2c, 0xc5, 0x84, 0x02, 0x1a, 0x0a, 0x6a}}; extern const wchar_t * szCLSID_RSOP_Snapin = L"{1BC972D6-555C-4FF7-BE2C-C584021A0A6A}"; extern const CLSID CLSID_RSOP_MachineSnapin = { 0x7e45546f, 0x6d52, 0x4d10, {0xb7, 0x02, 0x9c, 0x2e, 0x67, 0x23, 0x2e, 0x62}}; extern const wchar_t * szCLSID_RSOP_MachineSnapin = L"{7E45546F-6D52-4D10-B702-9C2E67232E62}"; #include "safereg.hxx" #define BREAK_ON_FAIL_HRESULT(hr) if (FAILED(hr)) break #define PSBUFFER_STR L"AppManagementBuffer" #define THREADING_STR L"Apartment" HRESULT RegisterInterface( CSafeReg *pshkInterface, LPWSTR wszInterfaceGUID, LPWSTR wszInterfaceName, LPWSTR wszNumMethods, LPWSTR wszProxyCLSID); CComModule _Module; BEGIN_OBJECT_MAP(ObjectMap) OBJECT_ENTRY(CLSID_Snapin, CUserComponentDataImpl) OBJECT_ENTRY(CLSID_MachineSnapin, CMachineComponentDataImpl) OBJECT_ENTRY(CLSID_RSOP_Snapin, CRSOPUserComponentDataImpl) OBJECT_ENTRY(CLSID_RSOP_MachineSnapin, CRSOPMachineComponentDataImpl) END_OBJECT_MAP() CLSID CLSID_Temp; #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif class CSnapinApp : public CWinApp { public: virtual BOOL InitInstance(); virtual int ExitInstance(); }; CSnapinApp theApp; HINSTANCE ghInstance; BOOL CSnapinApp::InitInstance() { ghInstance = m_hInstance; _Module.Init(ObjectMap, m_hInstance); // CoGetMalloc(1, &g_pIMalloc); CsSetOptions( CsOption_AdminTool ); InitDebugSupport(); // Add theme'ing support BOOL bInitialized = SHFusionInitializeFromModuleID (m_hInstance, 2); if ( bInitialized ) { return bInitialized = CWinApp::InitInstance(); } return bInitialized; } int CSnapinApp::ExitInstance() { _Module.Term(); DEBUG_VERIFY_INSTANCE_COUNT(CResultPane); DEBUG_VERIFY_INSTANCE_COUNT(CScopePane); // Cleanup required by fusion support SHFusionUninitialize(); // g_pIMalloc->Release(); return CWinApp::ExitInstance(); } ///////////////////////////////////////////////////////////////////////////// // Used to determine whether the DLL can be unloaded by OLE STDAPI DllCanUnloadNow(void) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE; } ///////////////////////////////////////////////////////////////////////////// // Returns a class factory to create an object of the requested type STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { return _Module.GetClassObject(rclsid, riid, ppv); } const wchar_t * szUser_Namespace = L"{59849DF9-A256-11D1-A760-00C04FB9603F}"; const wchar_t * szMachine_Namespace = L"{4D53F093-A260-11D1-A760-00C04FB9603F}"; const wchar_t * szMachineAppName = L"Software Installation (Computers)"; const wchar_t * szUserAppName = L"Software Installation (Users)"; const wchar_t * szUser_RSOP_Namespace = L"{9D5EB218-8EA3-4EE9-B120-52FC68C8D128}"; const wchar_t * szMachine_RSOP_Namespace = L"{DFA38559-8B35-42EF-8B00-E8F6CBF99BC0}"; const wchar_t * szUserAppNameIndirect = L"@appmgr.dll,-50"; const wchar_t * szMachineAppNameIndirect = L"@appmgr.dll,-51"; ///////////////////////////////////////////////////////////////////////////// // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { CSafeReg shk; CSafeReg shkCLSID; CSafeReg shkServer; CSafeReg shkTemp; HRESULT hr = S_OK; do { CLSID_Temp = CLSID_Snapin; hr = _Module.RegisterServer(FALSE); BREAK_ON_FAIL_HRESULT(hr); // register extension hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns", KEY_WRITE); BREAK_ON_FAIL_HRESULT(hr); hr = shkCLSID.Create(szCLSID_Snapin, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.SetValue(L"NameString", REG_SZ, (CONST BYTE *) szUserAppName, sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1)); hr = shk.SetValue(L"NameStringIndirect", REG_SZ, (CONST BYTE *) szUserAppNameIndirect, sizeof(WCHAR) * (lstrlen(szUserAppNameIndirect)+ 1)); hr = shk.Create(L"NodeTypes", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.Create(szUser_Namespace, &shkServer); BREAK_ON_FAIL_HRESULT(hr); shkServer.Close(); shkTemp.Close(); shk.Close(); hr = shkCLSID.Create(szCLSID_MachineSnapin, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.SetValue(L"NameString", REG_SZ, (CONST BYTE *) szMachineAppName, sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1)); hr = shk.SetValue(L"NameStringIndirect", REG_SZ, (CONST BYTE *) szMachineAppNameIndirect, sizeof(WCHAR) * (lstrlen(szMachineAppNameIndirect)+ 1)); hr = shk.Create(L"NodeTypes", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.Create(szMachine_Namespace, &shkServer); BREAK_ON_FAIL_HRESULT(hr); shkServer.Close(); shkTemp.Close(); shk.Close(); shkCLSID.Close(); hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes", KEY_WRITE); BREAK_ON_FAIL_HRESULT(hr); hr = shkCLSID.Create(szUser_Namespace, &shk); BREAK_ON_FAIL_HRESULT(hr); shk.Close(); hr = shkCLSID.Create(szMachine_Namespace, &shk); BREAK_ON_FAIL_HRESULT(hr); shk.Close(); WCHAR szGUID[50]; StringFromGUID2 (NODEID_UserSWSettings, szGUID, 50); hr = shkCLSID.Create(szGUID, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.Create(L"Extensions", &shkServer); BREAK_ON_FAIL_HRESULT(hr); hr = shkServer.Create(L"NameSpace", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.SetValue(szCLSID_Snapin, REG_SZ, (CONST BYTE *) szUserAppName, sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1)); shkTemp.Close(); shkServer.Close(); shk.Close(); StringFromGUID2 (NODEID_MachineSWSettings, szGUID, 50); hr = shkCLSID.Create(szGUID, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.Create(L"Extensions", &shkServer); BREAK_ON_FAIL_HRESULT(hr); hr = shkServer.Create(L"NameSpace", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.SetValue(szCLSID_MachineSnapin, REG_SZ, (CONST BYTE *) szMachineAppName, sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1)); shkTemp.Close(); shkServer.Close(); shk.Close(); shkCLSID.Close(); // // RSOP versions // CLSID_Temp = CLSID_RSOP_Snapin; hr = _Module.RegisterServer(FALSE); BREAK_ON_FAIL_HRESULT(hr); // register extension hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns", KEY_WRITE); BREAK_ON_FAIL_HRESULT(hr); hr = shkCLSID.Create(szCLSID_RSOP_Snapin, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.SetValue(L"NameString", REG_SZ, (CONST BYTE *) szUserAppName, sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1)); hr = shk.SetValue(L"NameStringIndirect", REG_SZ, (CONST BYTE *) szUserAppNameIndirect, sizeof(WCHAR) * (lstrlen(szUserAppNameIndirect)+ 1)); hr = shk.Create(L"NodeTypes", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.Create(szUser_RSOP_Namespace, &shkServer); BREAK_ON_FAIL_HRESULT(hr); shkServer.Close(); shkTemp.Close(); shk.Close(); hr = shkCLSID.Create(szCLSID_RSOP_MachineSnapin, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.SetValue(L"NameString", REG_SZ, (CONST BYTE *) szMachineAppName, sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1)); hr = shk.SetValue(L"NameStringIndirect", REG_SZ, (CONST BYTE *) szMachineAppNameIndirect, sizeof(WCHAR) * (lstrlen(szMachineAppNameIndirect)+ 1)); hr = shk.Create(L"NodeTypes", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.Create(szMachine_RSOP_Namespace, &shkServer); BREAK_ON_FAIL_HRESULT(hr); shkServer.Close(); shkTemp.Close(); shk.Close(); shkCLSID.Close(); hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes", KEY_WRITE); BREAK_ON_FAIL_HRESULT(hr); hr = shkCLSID.Create(szUser_RSOP_Namespace, &shk); BREAK_ON_FAIL_HRESULT(hr); shk.Close(); hr = shkCLSID.Create(szMachine_RSOP_Namespace, &shk); BREAK_ON_FAIL_HRESULT(hr); shk.Close(); StringFromGUID2 (NODEID_RSOPUserSWSettings, szGUID, 50); hr = shkCLSID.Create(szGUID, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.Create(L"Extensions", &shkServer); BREAK_ON_FAIL_HRESULT(hr); hr = shkServer.Create(L"NameSpace", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.SetValue(szCLSID_RSOP_Snapin, REG_SZ, (CONST BYTE *) szUserAppName, sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1)); shkTemp.Close(); shkServer.Close(); shk.Close(); StringFromGUID2 (NODEID_RSOPMachineSWSettings, szGUID, 50); hr = shkCLSID.Create(szGUID, &shk); BREAK_ON_FAIL_HRESULT(hr); hr = shk.Create(L"Extensions", &shkServer); BREAK_ON_FAIL_HRESULT(hr); hr = shkServer.Create(L"NameSpace", &shkTemp); BREAK_ON_FAIL_HRESULT(hr); hr = shkTemp.SetValue(szCLSID_RSOP_MachineSnapin, REG_SZ, (CONST BYTE *) szMachineAppName, sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1)); shkTemp.Close(); shkServer.Close(); shk.Close(); shkCLSID.Close(); hr = shkCLSID.Open(HKEY_CLASSES_ROOT, L"CLSID", KEY_WRITE); BREAK_ON_FAIL_HRESULT(hr); } while (0); return hr; } ///////////////////////////////////////////////////////////////////////////// // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { CLSID_Temp = CLSID_Snapin; _Module.UnregisterServer(); HKEY hkey; CString sz; RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_Snapin)); RegCloseKey(hkey); } RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szUser_Namespace)); RegCloseKey(hkey); } WCHAR szGUID[50]; sz = L"Software\\Microsoft\\MMC\\NodeTypes\\"; StringFromGUID2 (NODEID_UserSWSettings, szGUID, 50); sz += szGUID; sz += L"\\Extensions\\NameSpace"; RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteValue(hkey, szCLSID_Snapin); RegCloseKey(hkey); } RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_MachineSnapin)); RegCloseKey(hkey); } RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szMachine_Namespace)); RegCloseKey(hkey); } sz = L"Software\\Microsoft\\MMC\\NodeTypes\\"; StringFromGUID2 (NODEID_MachineSWSettings, szGUID, 50); sz += szGUID; sz += L"\\Extensions\\NameSpace"; RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteValue(hkey, szCLSID_MachineSnapin); RegCloseKey(hkey); } // // RSOP versions // CLSID_Temp = CLSID_RSOP_Snapin; _Module.UnregisterServer(); RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_RSOP_Snapin)); RegCloseKey(hkey); } RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szUser_RSOP_Namespace)); RegCloseKey(hkey); } sz = L"Software\\Microsoft\\MMC\\NodeTypes\\"; StringFromGUID2 (NODEID_RSOPUserSWSettings, szGUID, 50); sz += szGUID; sz += L"\\Extensions\\NameSpace"; RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteValue(hkey, szCLSID_Snapin); RegCloseKey(hkey); } RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_RSOP_MachineSnapin)); RegCloseKey(hkey); } RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szMachine_Namespace)); RegCloseKey(hkey); } sz = L"Software\\Microsoft\\MMC\\NodeTypes\\"; StringFromGUID2 (NODEID_RSOPMachineSWSettings, szGUID, 50); sz += szGUID; sz += L"\\Extensions\\NameSpace"; RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey); if (hkey) { RegDeleteValue(hkey, szCLSID_RSOP_MachineSnapin); RegCloseKey(hkey); } return S_OK; } //+-------------------------------------------------------------------------- // // Function: RegisterInterface // // Synopsis: Add the registry entries required for an interface. // // Arguments: [pshkInterface] - handle to CLSID\Interface key // [wszInterfaceGUID] - GUID of interface to add // [wszInterfaceName] - human-readable name of interface // [wszNumMethods] - number of methods (including inherited) // [wszProxyCLSID] - GUID of dll containing proxy/stubs // // Returns: HRESULT // // History: 3-31-1997 DavidMun Created // 5-09-1997 SteveBl Modified for use with AppMgr // //--------------------------------------------------------------------------- HRESULT RegisterInterface( CSafeReg *pshkInterface, LPWSTR wszInterfaceGUID, LPWSTR wszInterfaceName, LPWSTR wszNumMethods, LPWSTR wszProxyCLSID) { HRESULT hr = S_OK; CSafeReg shkIID; CSafeReg shkNumMethods; CSafeReg shkProxy; do { hr = pshkInterface->Create(wszInterfaceGUID, &shkIID); BREAK_ON_FAIL_HRESULT(hr); hr = shkIID.SetValue(NULL, REG_SZ, (CONST BYTE *) wszInterfaceName, sizeof(WCHAR) * (lstrlen(wszInterfaceName) + 1)); BREAK_ON_FAIL_HRESULT(hr); hr = shkIID.Create(L"NumMethods", &shkNumMethods); BREAK_ON_FAIL_HRESULT(hr); hr = shkNumMethods.SetValue(NULL, REG_SZ, (CONST BYTE *)wszNumMethods, sizeof(WCHAR) * (lstrlen(wszNumMethods) + 1)); BREAK_ON_FAIL_HRESULT(hr); hr = shkIID.Create(L"ProxyStubClsid32", &shkProxy); BREAK_ON_FAIL_HRESULT(hr); hr = shkProxy.SetValue(NULL, REG_SZ, (CONST BYTE *)wszProxyCLSID, sizeof(WCHAR) * (lstrlen(wszProxyCLSID) + 1)); BREAK_ON_FAIL_HRESULT(hr); } while (0); return hr; }
32.355286
111
0.578178
[ "object" ]
66baaf5fb8427e932d4e879e9eb5c5978f85e750
843
hpp
C++
Paramedic.hpp
LeeFB/HW4_B
cb3559439b3ee4e227223ce5735c0b83a19b30c6
[ "MIT" ]
null
null
null
Paramedic.hpp
LeeFB/HW4_B
cb3559439b3ee4e227223ce5735c0b83a19b30c6
[ "MIT" ]
null
null
null
Paramedic.hpp
LeeFB/HW4_B
cb3559439b3ee4e227223ce5735c0b83a19b30c6
[ "MIT" ]
null
null
null
// // Paramedic.hpp // wargame-a // // Created by Lee Fingerhut on 22/05/2020. // Copyright © 2020 Lee Fingerhut. All rights reserved. // #pragma once #include <stdio.h> #include <iostream> #include <vector> #include "Soldier.hpp" using namespace std; //Can go one slot in each direction. //Does not shoot at all, but only heals all the soldiers of the same player who are in the box next to him //(returns the number of their health points to the starting number) // I assumed that the Paramedic doesn't heals himself // but heals other paramdics next to him; class Paramedic : public Soldier { public: Paramedic(int player) : Soldier(100,100,player){ initial_health_points = 100; type = SoldierID::Paramedic; } void activity(std::vector<std::vector<Soldier*>> &board, std::pair<int,int> loc); };
29.068966
107
0.696323
[ "vector" ]
66bb500cd71e2c7e67297dfec311585ff3800105
617
cpp
C++
maxpairwiseproduct.cpp
fromSAM/coursera.files
22ae08d8bcff148c27dc1fcfe443ae6de8bb589c
[ "MIT" ]
null
null
null
maxpairwiseproduct.cpp
fromSAM/coursera.files
22ae08d8bcff148c27dc1fcfe443ae6de8bb589c
[ "MIT" ]
null
null
null
maxpairwiseproduct.cpp
fromSAM/coursera.files
22ae08d8bcff148c27dc1fcfe443ae6de8bb589c
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> using std::vector; using std::cin; using std::cout; using std::max; long long int MaxPairwiseProduct(const vector<int>& numbers) { int product = 0; long long int n = numbers.size(); for (long long int i = 0; i < n; ++i) { for (long long int j = i + 1; j < n; ++j) { product = max(product, numbers[i] * numbers[j]); } } return product; } int main() { long long int n; cin >> n; vector<long long int> numbers(n); for (long long int i = 0; i < n; ++i) { cin >> numbers[i]; } int product = MaxPairwiseProduct(numbers); cout << product << "\n"; return 0; }
22.035714
63
0.611021
[ "vector" ]
66bcd91de34fad35ecd3aea98a5167a2d6f7b337
6,166
cpp
C++
src/libs/base/bufferview.cpp
jpnurmi/communi-desktop
adec82ee04dee6eafdd2f0f2366ee1362ec8f1a3
[ "BSD-3-Clause" ]
null
null
null
src/libs/base/bufferview.cpp
jpnurmi/communi-desktop
adec82ee04dee6eafdd2f0f2366ee1362ec8f1a3
[ "BSD-3-Clause" ]
null
null
null
src/libs/base/bufferview.cpp
jpnurmi/communi-desktop
adec82ee04dee6eafdd2f0f2366ee1362ec8f1a3
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (C) 2008-2016 The Communi Project You may use this file under the terms of BSD license as follows: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bufferview.h" #include "textdocument.h" #include "textbrowser.h" #include "textinput.h" #include "listview.h" #include "titlebar.h" #include <IrcBufferModel> #include <QApplication> #include <QVBoxLayout> #include <IrcChannel> #include <IrcBuffer> #include <QShortcut> BufferView::BufferView(QWidget* parent) : QWidget(parent) { d.buffer = 0; d.titleBar = new TitleBar(this); d.listView = new ListView(this); d.textInput = new TextInput(this); d.textBrowser = new TextBrowser(this); d.textBrowser->setBuddy(d.textInput); d.textBrowser->setFocusPolicy(Qt::ClickFocus); d.textBrowser->viewport()->setAttribute(Qt::WA_AcceptTouchEvents, false); d.splitter = new QSplitter(this); d.splitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); QShortcut* zoomIn = new QShortcut(QKeySequence::ZoomIn, this); zoomIn->setContext(Qt::WidgetWithChildrenShortcut); connect(zoomIn, SIGNAL(activated()), d.textBrowser, SLOT(zoomIn())); QShortcut* zoomOut = new QShortcut(QKeySequence::ZoomOut, this); zoomOut->setContext(Qt::WidgetWithChildrenShortcut); connect(zoomOut, SIGNAL(activated()), d.textBrowser, SLOT(zoomOut())); QShortcut* resetZoom = new QShortcut(QKeySequence("Ctrl+0"), this); resetZoom->setContext(Qt::WidgetWithChildrenShortcut); connect(resetZoom, SIGNAL(activated()), d.textBrowser, SLOT(resetZoom())); QShortcut* pageDown = new QShortcut(QKeySequence::MoveToNextPage, this); pageDown->setContext(Qt::WidgetWithChildrenShortcut); connect(pageDown, SIGNAL(activated()), d.textBrowser, SLOT(scrollToNextPage())); QShortcut* pageUp = new QShortcut(QKeySequence::MoveToPreviousPage, this); pageUp->setContext(Qt::WidgetWithChildrenShortcut); connect(pageUp, SIGNAL(activated()), d.textBrowser, SLOT(scrollToPreviousPage())); QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setMargin(0); layout->addWidget(d.splitter); layout->addWidget(d.textInput); layout->setStretchFactor(d.splitter, 1); connect(d.titleBar, SIGNAL(offsetChanged(int)), d.textBrowser, SLOT(moveShadow(int))); d.titleBar->raise(); d.splitter->addWidget(d.textBrowser); d.splitter->addWidget(d.listView); d.splitter->setStretchFactor(0, 1); connect(d.listView, SIGNAL(queried(QString)), this, SLOT(query(QString))); connect(d.textBrowser, SIGNAL(queried(QString)), this, SLOT(query(QString))); } BufferView::~BufferView() { emit destroyed(this); } IrcBuffer* BufferView::buffer() const { return d.buffer; } ListView* BufferView::listView() const { return d.listView; } TextInput* BufferView::textInput() const { return d.textInput; } TitleBar* BufferView::titleBar() const { return d.titleBar; } TextBrowser* BufferView::textBrowser() const { return d.textBrowser; } TextDocument* BufferView::textDocument() const { return d.textBrowser->document(); } void BufferView::setBuffer(IrcBuffer* buffer) { if (d.buffer != buffer) { d.buffer = buffer; IrcChannel* channel = qobject_cast<IrcChannel*>(buffer); d.listView->setChannel(channel); d.listView->setVisible(channel); d.titleBar->setBuffer(buffer); d.textInput->setBuffer(buffer); if (buffer) { TextDocument* doc = 0; QList<TextDocument*> documents = d.buffer->findChildren<TextDocument*>(); // there might be multiple clones, but at least one instance // must always remain there to avoid losing history... Q_ASSERT(!documents.isEmpty()); foreach (TextDocument* d, documents) { if (!d->isVisible()) doc = d; } if (!doc) { doc = documents.first()->clone(); emit cloned(doc); } d.textBrowser->setDocument(doc); } else { d.textBrowser->setDocument(0); } emit bufferChanged(buffer); } } void BufferView::closeBuffer() { if (d.buffer) emit bufferClosed(d.buffer); } void BufferView::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); int tbh = d.titleBar->minimumSizeHint().height(); d.titleBar->resize(width(), tbh); layout()->setContentsMargins(0, tbh + d.titleBar->baseOffset(), 0, 0); } void BufferView::query(const QString& user) { IrcBufferModel* model = d.buffer ? d.buffer->model() : 0; if (model) setBuffer(model->add(user)); }
33.32973
90
0.695589
[ "model" ]
66be4859dcea286524f0a967a31ad0a56174d7c8
348
cpp
C++
leetcode/961. N-Repeated Element in Size 2N Array/s1.cpp
zhuohuwu0603/leetcode_cpp_lzl124631x
6a579328810ef4651de00fde0505934d3028d9c7
[ "Fair" ]
787
2017-05-12T05:19:57.000Z
2022-03-30T12:19:52.000Z
leetcode/961. N-Repeated Element in Size 2N Array/s1.cpp
aerlokesh494/LeetCode
0f2cbb28d5a9825b51a8d3b3a0ae0c30d7ff155f
[ "Fair" ]
8
2020-03-16T05:55:38.000Z
2022-03-09T17:19:17.000Z
leetcode/961. N-Repeated Element in Size 2N Array/s1.cpp
aerlokesh494/LeetCode
0f2cbb28d5a9825b51a8d3b3a0ae0c30d7ff155f
[ "Fair" ]
247
2017-04-30T15:07:50.000Z
2022-03-30T09:58:57.000Z
// OJ: https://leetcode.com/problems/n-repeated-element-in-size-2n-array // Author: github.com/lzl124631x // Time: O(N) // Space: O(N) class Solution { public: int repeatedNTimes(vector<int>& A) { unordered_set<int> s; for (int n : A) { if (s.find(n) != s.end()) return n; s.insert(n); } } };
24.857143
72
0.548851
[ "vector" ]
66c095460c290848ec55360f37e86deb906340dc
11,227
cpp
C++
branch/old_angsys/angsys_beta3/source/platform/platform.desktop/source/win_events.cpp
ChuyX3/angsys
89b2eaee866bcfd11e66efda49b38acc7468c780
[ "Apache-2.0" ]
null
null
null
branch/old_angsys/angsys_beta3/source/platform/platform.desktop/source/win_events.cpp
ChuyX3/angsys
89b2eaee866bcfd11e66efda49b38acc7468c780
[ "Apache-2.0" ]
null
null
null
branch/old_angsys/angsys_beta3/source/platform/platform.desktop/source/win_events.cpp
ChuyX3/angsys
89b2eaee866bcfd11e66efda49b38acc7468c780
[ "Apache-2.0" ]
null
null
null
#include "pch.h" #include <ang/core/timer.h> #include "ang/platform/win32/windows.h" #include "event_args.h" using namespace ang; using namespace ang::platform; using namespace ang::platform::events; using namespace ang::platform::windows; safe_enum_rrti2(ang::platform::events, win_msg); msg_event_args::msg_event_args(message msg) : m_msg(msg) { } msg_event_args::~msg_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::msg_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::msg_event_args, object, imsg_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::msg_event_args, object, imsg_event_args); const message& msg_event_args::msg()const { return m_msg; } void msg_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool msg_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// app_status_event_args::app_status_event_args(message msg, windows::appptr app) : m_msg(msg) , m_app(ang::move(app)) { } app_status_event_args::~app_status_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::app_status_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::app_status_event_args, object, iapp_status_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::app_status_event_args, object, iapp_status_event_args, imsg_event_args); const message& app_status_event_args::msg()const { return m_msg; } icore_app_t app_status_event_args::core_app()const { return m_app.get(); } void app_status_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool app_status_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// created_event_args::created_event_args(message msg, wndptr wnd, appptr app, var_args_t args) : m_msg(msg) , m_view(ang::move(wnd)) , m_app(ang::move(app)) , m_args(ang::move(args)) { } created_event_args::~created_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::created_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::created_event_args, object, icreated_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::created_event_args, object, icreated_event_args, imsg_event_args); const message& created_event_args::msg()const { return m_msg; } icore_view_t created_event_args::core_view()const { return m_view.get(); } icore_app_t created_event_args::core_app()const { return m_app.get(); } var_args_t created_event_args::args_list()const { return m_args.get(); } void created_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool created_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// display_info_event_args::display_info_event_args(message msg, wndptr wnd, display_invalidate_reason_t reason, display::display_info_t info) : m_msg(msg) , m_view(ang::move(wnd)) , m_reason(reason) , m_info(info) { } display_info_event_args::~display_info_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::display_info_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::display_info_event_args, object, idisplay_info_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::display_info_event_args, object, idisplay_info_event_args, imsg_event_args); const message& display_info_event_args::msg()const { return m_msg; } icore_view_t display_info_event_args::core_view()const { return m_view.get(); } display_invalidate_reason_t const& display_info_event_args::invalidate_reason()const { return m_reason; } display::display_info_t const& display_info_event_args::display_info()const { return m_info; } void display_info_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool display_info_event_args::handled()const { return m_msg.result() != -1; } ////////////////////////////////////////////////////////////////////// visibility_change_event_args::visibility_change_event_args(message msg, windows::wndptr wnd, bool vis) : m_msg(msg) , m_view(ang::move(wnd)) , m_visible(vis) { } visibility_change_event_args::~visibility_change_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::visibility_change_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::visibility_change_event_args, object, ivisibility_change_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::visibility_change_event_args, object, ivisibility_change_event_args, imsg_event_args); const message& visibility_change_event_args::msg()const { return m_msg; } icore_view_t visibility_change_event_args::core_view()const { return m_view.get(); } bool visibility_change_event_args::is_visible()const { return m_visible; } void visibility_change_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool visibility_change_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// activate_event_args::activate_event_args(message msg, activate_status_t status) : m_msg(msg) , m_status(status) { } activate_event_args::~activate_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::activate_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::activate_event_args, object, iactivate_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::activate_event_args, object, iactivate_event_args, imsg_event_args); const message& activate_event_args::msg()const { return m_msg; } activate_status_t const& activate_event_args::status()const { return m_status; } void activate_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool activate_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// draw_event_args::draw_event_args(message msg, wndptr wnd, graphics::device_context_t dc, graphics::size<float> size) : m_msg(msg) , m_view(ang::move(wnd)) , m_dc(ang::move(dc)) , m_size(size) { } draw_event_args::~draw_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::draw_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::draw_event_args, object, idraw_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::draw_event_args, object, idraw_event_args, imsg_event_args); const message& draw_event_args::msg()const { return m_msg; } icore_view_t draw_event_args::core_view()const { return m_view.get(); } graphics::icore_context_t draw_event_args::core_context()const { return m_dc.get(); } graphics::size<float> const& draw_event_args::canvas_size()const { return m_size; } void draw_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool draw_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //TODO: //TOCHECK: //TOFIX pointer_event_args::pointer_event_args(message msg, input::poiner_info_t info) : m_msg(msg) , m_info(info) { } pointer_event_args::~pointer_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::pointer_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::pointer_event_args, object, ipointer_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::pointer_event_args, object, ipointer_event_args, imsg_event_args); const message& pointer_event_args::msg()const { return m_msg; } graphics::point<float> const& pointer_event_args::position()const { return m_info.point; } input::key_modifiers_t const& pointer_event_args::modifiers()const { return m_info.modifiers; } input::poiner_info_t const& pointer_event_args::info()const { return m_info; } void pointer_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool pointer_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// key_event_args::key_event_args(message msg, input::key_info_t info) : m_msg(msg) , m_info(info) { } key_event_args::~key_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::key_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::key_event_args, object, ikey_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::key_event_args, object, ikey_event_args, imsg_event_args); const message& key_event_args::msg()const { return m_msg; } char32_t key_event_args::key()const { return m_info.char_code; } input::key_info_t const& key_event_args::info()const { return m_info; } void key_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool key_event_args::handled()const { return m_msg.result() != -1; } //////////////////////////////////////////////////////////////////// text_change_event_args::text_change_event_args(message msg, wstring txt, input::ikeyboard_t keyboard) : m_msg(msg) , m_text(ang::move(txt)) , m_keyboard(ang::move(keyboard)) { } text_change_event_args::~text_change_event_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::text_change_event_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::text_change_event_args, object, itext_change_event_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::text_change_event_args, object, itext_change_event_args, imsg_event_args); const message& text_change_event_args::msg()const { return m_msg; } text::istring_t text_change_event_args::text()const { return m_text.get(); } input::ikeyboard_t text_change_event_args::keyboard()const { return m_keyboard; } void text_change_event_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool text_change_event_args::handled()const { return m_msg.result() != -1; } ////////////////////////////////////////////////////////////////////////// controller_status_args::controller_status_args(message msg, input::controller_t controller, input::controller_status_t status) : m_msg(msg) , m_controller(controller) , m_status(status) { } controller_status_args::~controller_status_args() { } ANG_IMPLEMENT_OBJECT_RUNTIME_INFO(ang::platform::events::controller_status_args) ANG_IMPLEMENT_OBJECT_CLASS_INFO(ang::platform::events::controller_status_args, object, icontroller_status_args); ANG_IMPLEMENT_OBJECT_QUERY_INTERFACE(ang::platform::events::controller_status_args, object, icontroller_status_args, imsg_event_args); const message& controller_status_args::msg()const { return m_msg; } void controller_status_args::handled(bool value) { m_msg.result(value ? 0 : -1); } bool controller_status_args::handled()const { return m_msg.result() != -1; } uint controller_status_args::controller_id()const { return m_controller->device_id; } input::icontroller_t controller_status_args::controller()const { return m_controller.get(); } input::controller_status_t controller_status_args::status()const { return m_status; }
23.006148
146
0.73439
[ "object" ]
66c1b989a6799e0e3b594ea631d93b1850829fed
1,178
cpp
C++
src/cmcandy/C_Language_Answers/_0041.cpp
ch98road/leetcode
a9b4be54a169b30f6711809b892dd1f79f2a17e7
[ "MIT" ]
null
null
null
src/cmcandy/C_Language_Answers/_0041.cpp
ch98road/leetcode
a9b4be54a169b30f6711809b892dd1f79f2a17e7
[ "MIT" ]
null
null
null
src/cmcandy/C_Language_Answers/_0041.cpp
ch98road/leetcode
a9b4be54a169b30f6711809b892dd1f79f2a17e7
[ "MIT" ]
1
2020-11-26T03:01:12.000Z
2020-11-26T03:01:12.000Z
#include <iostream> #include <string> #include <vector> using namespace ::std; class Solution { public: int firstMissingPositive(vector<int> &nums) { int len = nums.size(); if (len == 0 || (len == 1 && nums[0] != 1)) return 1; else if (len == 1 && nums[0] == 1) return 2; int i = 0; while (i < len) { cout << nums[0] << nums[1] << nums[2]<<nums[3] << endl; if (nums[i] != i) { if (nums[i] >= len || nums[i] <= 0) { nums[i] = 0; i++; } else if (nums[nums[i]] != nums[i]) { int tmp = nums[nums[i]]; nums[nums[i]] = nums[i]; nums[i] = tmp; }else i++; } else i++; } for (int j = 1; j < len; j++) { if (nums[j] == 0) return j; } return i; } }; int main() { Solution s; int a[] = { 1, 1}; vector<int> v(a, a + 4); s.firstMissingPositive(v); }
22.653846
67
0.343803
[ "vector" ]
66c527bc0916bc60b49d872d3dc98b3309d1ecb5
2,329
hpp
C++
Settings.hpp
fossabot/Veritas-1
57d8574f170bb65149f1f704d97b9eed13be5d91
[ "MIT" ]
7
2016-09-09T22:23:08.000Z
2019-03-01T07:21:21.000Z
Settings.hpp
fossabot/Veritas-1
57d8574f170bb65149f1f704d97b9eed13be5d91
[ "MIT" ]
2
2018-08-19T21:53:58.000Z
2018-08-23T20:55:52.000Z
Settings.hpp
fossabot/Veritas-1
57d8574f170bb65149f1f704d97b9eed13be5d91
[ "MIT" ]
1
2018-08-23T20:31:26.000Z
2018-08-23T20:31:26.000Z
#ifndef __settings_hpp__ #define __settings_hpp__ struct Input { double minEfficiency = 0.6, dx = 0.5, k = 0.01; double refinementCriteria = 1e-8, cfl = 0.9, sizeWeight = 0.0; double preLength = 2, postLength = 2; unsigned int nx = 76*4, r = 2, Lfinest = 5; double plasma_xl_bound = 3.0e-6, plasma_xr_bound = 7.0e-6; std::vector<double> tempEM = {0.0}; }; struct Particles { std::vector<double> mass = {9.10938291e-31}; std::vector<double> charge = {-1.60217657e-19}; std::vector<std::vector<double>> misc = {{0.0,0.01}}; std::vector<unsigned int> np = {50}; std::vector<double> dp = {0.1}; std::vector<double> pmin = {0.1}; }; struct Output { bool time = true; bool rectangleData = true; bool charge = true; bool energy = true; bool potential = true; bool EFieldLongitudinal = true; bool EFieldTransverse = true; bool BFieldTransverse = true; bool AFieldSquared = true; int precision = 15; }; class Settings { EMFieldSolver *EMSolver; public: Output output; double dx, time, minEfficiency,preLength,postLength,refinementCriteria,cfl,sizeWeight,plasma_xl_bound,plasma_xr_bound; std::vector<double> m, q, m_inv, dp, fMax, tempEM, pmin; std::vector<std::vector<double>> temp; unsigned int x_size_finest, x_size, refinementRatio; int maxDepth,quadratureDepth; std::vector<unsigned int> p_size, p_size_finest; Settings(const Input &grid, const Particles &particles, const Output &out); void title(std::string output, char spacer); double InitialDistribution(double x, double p, int particleType); double GetDp(int level, int particleType); double GetDx(int level); int GetXSize(int level); int GetPSize(int level, int particleType); double GetMass(int i); double GetCharge(int i); double GetVectorPotentialY(double x, double t); double GetVectorPotentialZ(double x, double t); void UpdateTime(int step, double dt); double GetEY(double x, double t); double GetEZ(double x, double t); double GetBY(double x, double t); double GetBZ(double x, double t); void DetermineMaximum(); double GetfMax(int i); void settingsOverride(); bool RefinementOverride(double x,double p,int depth,int particleType); }; #endif /* __settings_hpp__ */
34.25
122
0.682267
[ "vector" ]
66cf1aad7f8201185554070b125a3c39c3a68ae7
2,280
cc
C++
unittests/libtests/faults/data/CohesiveDataTri3h.cc
joegeisz/pylith
f74060b7b19d7e90abf8597bbe9250c96593c0ad
[ "MIT" ]
1
2021-09-09T06:24:11.000Z
2021-09-09T06:24:11.000Z
unittests/libtests/faults/data/CohesiveDataTri3h.cc
joegeisz/pylith
f74060b7b19d7e90abf8597bbe9250c96593c0ad
[ "MIT" ]
null
null
null
unittests/libtests/faults/data/CohesiveDataTri3h.cc
joegeisz/pylith
f74060b7b19d7e90abf8597bbe9250c96593c0ad
[ "MIT" ]
null
null
null
// -*- C++ -*- // // ====================================================================== // // Brad T. Aagaard, U.S. Geological Survey // Charles A. Williams, GNS Science // Matthew G. Knepley, University of Chicago // // This code was developed as part of the Computational Infrastructure // for Geodynamics (http://geodynamics.org). // // Copyright (c) 2010-2017 University of California, Davis // // See COPYING for license information. // // ====================================================================== // /* Original mesh * */ #include "CohesiveDataTri3h.hh" const int pylith::faults::CohesiveDataTri3h::_numVertices = 11; const int pylith::faults::CohesiveDataTri3h::_spaceDim = 2; const int pylith::faults::CohesiveDataTri3h::_numCells = 13; const int pylith::faults::CohesiveDataTri3h::_cellDim = 2; const int pylith::faults::CohesiveDataTri3h::_numCorners[13] = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, }; const int pylith::faults::CohesiveDataTri3h::_materialIds[13] = { 0, 0, 0, 0, 2, 2, 3, 3, 3, 2, 3, 1, 1, }; const int pylith::faults::CohesiveDataTri3h::_numGroups = 3; const int pylith::faults::CohesiveDataTri3h::_groupSizes[3] = { 3+2, 2, 4+4 }; // vertices+edges const char* pylith::faults::CohesiveDataTri3h::_groupNames[3] = { "output", "edge", "fault" }; const char* pylith::faults::CohesiveDataTri3h::_groupTypes[3] = { "vertex", "vertex", "vertex" }; const char* pylith::faults::CohesiveDataTri3h::_filename = "data/tri3h.mesh"; const char* pylith::faults::CohesiveDataTri3h::_fault = "fault"; const char* pylith::faults::CohesiveDataTri3h::_edge = "edge"; pylith::faults::CohesiveDataTri3h::CohesiveDataTri3h(void) { // constructor numVertices = _numVertices; spaceDim = _spaceDim; numCells = _numCells; cellDim = _cellDim; numCorners = const_cast<int*>(_numCorners); materialIds = const_cast<int*>(_materialIds); groupSizes = const_cast<int*>(_groupSizes); groupNames = const_cast<char**>(_groupNames); groupTypes = const_cast<char**>(_groupTypes); numGroups = _numGroups; filename = const_cast<char*>(_filename); fault = const_cast<char*>(_fault); edge = const_cast<char*>(_edge); } // constructor pylith::faults::CohesiveDataTri3h::~CohesiveDataTri3h(void) {} // End of file
27.46988
77
0.654825
[ "mesh" ]
66d25f2573b72bd1f7e27319abad346064f8a099
7,600
cc
C++
Engine/addons/particles/particletechniqueserialization.cc
BikkyS/DreamEngine
47da4e22c65188c72f44591f6a96505d8ba5f5f3
[ "MIT" ]
26
2015-01-15T12:57:40.000Z
2022-02-16T10:07:12.000Z
Engine/addons/particles/particletechniqueserialization.cc
BikkyS/DreamEngine
47da4e22c65188c72f44591f6a96505d8ba5f5f3
[ "MIT" ]
null
null
null
Engine/addons/particles/particletechniqueserialization.cc
BikkyS/DreamEngine
47da4e22c65188c72f44591f6a96505d8ba5f5f3
[ "MIT" ]
17
2015-02-18T07:51:31.000Z
2020-06-01T01:10:12.000Z
/**************************************************************************** Copyright (c) 2011-2013,WebJet Business Division,CYOU http://www.genesis-3d.com.cn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "stdneb.h" #include "particles/particletechnique.h" namespace Particles { using namespace Serialization; const char* s_TechniqueName = "TechniqueName"; const char* s_TechniquePosition = "TechniquePosition"; const char* s_TechniqueUseExternBB = "TechniqueUseExternBB"; const char* s_TechniqueExternBB = "TechniqueExternBB"; const char* s_TechniqueQuota = "TechniqueQuota"; const char* s_EmitterCount = "EmitterCount"; const char* s_AffectorCount = "AffectorCount"; const char* s_TargetCount = "TargetCount"; const char* s_IsMoveWorldCoor = "IsMoveWorldCoor"; class ParticleTechniqueSerialization { public: //------------------------------------------------------------------------ void Load( ParticleTechnique* obj, SVersion ver, SerializeReader* pReader ) { if ( 1 == ver ) { Load_1(obj, pReader); return; } if ( 2 == ver ) { Load_2(obj, pReader); return; } n_error(" %s Load unknown version.\n", obj->GetClassName().AsCharPtr() ); } //------------------------------------------------------------------------ void Load_2(ParticleTechnique* obj, SerializeReader* pReader) { bool moveType; pReader->SerializeBool(s_IsMoveWorldCoor, moveType ); obj->SetMoveWorldCoord( moveType ); Load_1(obj, pReader); } //------------------------------------------------------------------------ void Load_1(ParticleTechnique* obj, SerializeReader* pReader) { Util::String name; pReader->SerializeString( s_TechniqueName, name ); obj->SetName( name ); Math::float3 pos; pReader->SerializeFloat3( s_TechniquePosition, pos ); obj->SetPosition( pos ); bool useExternBB; pReader->SerializeBool( s_TechniqueUseExternBB, useExternBB ); obj->SetUseExternBoundingBox( useExternBB ); Math::bbox bb; pReader->SerializeBBox( s_TechniqueExternBB, bb ); obj->SetExternBoundingBox( bb ); SizeT quota; pReader->SerializeInt( s_TechniqueQuota, quota ); obj->SetParticleQuota( quota ); SizeT emmiterCount; pReader->SerializeInt( s_EmitterCount, emmiterCount); for ( IndexT index = 0; index < emmiterCount; ++index ) { ParticleEmitterPtr emitter = pReader->SerializeObject<ParticleEmitter>(); n_assert( emitter.isvalid() ); obj->AddEmitter( emitter ); if ( emitter->IsA( Particles::ModelEmitter::RTTI ) ) obj->SetLoadEmitterMesh(false); } SizeT affectorCount; pReader->SerializeInt( s_AffectorCount, affectorCount); for( IndexT index = 0; index < affectorCount; ++index ) { ParticleAffectorPtr affector = pReader->SerializeObject<ParticleAffector>(); n_assert( affector.isvalid() ); obj->AddAffector( affector ); } SizeT targetCount; pReader->SerializeInt( s_TargetCount, targetCount ); if ( targetCount == 1 ) { ParticleTargetPtr target = pReader->SerializeObject<ParticleTarget>(); n_assert( target.isvalid() ); obj->SetTarget( target ); } } //------------------------------------------------------------------------ void Save( const ParticleTechnique* obj, SerializeWriter* pWriter ) { pWriter->SerializeBool( s_IsMoveWorldCoor, obj->IsMoveWorldCoord() ); pWriter->SerializeString( s_TechniqueName, obj->GetName() ); pWriter->SerializeFloat3( s_TechniquePosition, obj->GetPosition() ); pWriter->SerializeBool( s_TechniqueUseExternBB, obj->IsUseExternBoundingBox() ); pWriter->SerializeBBox( s_TechniqueExternBB, obj->GetExternBoundingBox() ); pWriter->SerializeInt( s_TechniqueQuota, obj->GetParticleQuota() ); SizeT emmiterCount = obj->GetEmitterCount(); pWriter->SerializeInt( s_EmitterCount, emmiterCount); for ( IndexT index = 0; index < emmiterCount; ++index ) { const ParticleEmitterPtr& emitter = obj->GetEmitter( index ); pWriter->SerializeObject( emitter ); } SizeT affectorCount = obj->GetAffectorCount(); pWriter->SerializeInt( s_AffectorCount, affectorCount); for( IndexT index = 0; index < affectorCount; ++index ) { const ParticleAffectorPtr& affector = obj->GetAffector(index); pWriter->SerializeObject( affector ); } const ParticleTargetPtr& target = obj->GetTarget(); if ( target.isvalid() ) { pWriter->SerializeInt( s_TargetCount, 1 ); pWriter->SerializeObject( target ); } else { pWriter->SerializeInt( s_TargetCount, 0 ); } } }; //------------------------------------------------------------------------ // @ISerialization::GetVersion. when change storage, must add SerializeVersion count SVersion ParticleTechnique::GetVersion() const { return 2; // } //------------------------------------------------------------------------ // @ISerialization::Load void ParticleTechnique::Load( SVersion ver, SerializeReader* pReader, const Serialization::SerializationArgs* args ) { ParticleTechniqueSerialization Serialize; Serialize.Load( this, ver, pReader ); } //------------------------------------------------------------------------ // @ISerialization::Save void ParticleTechnique::Save( SerializeWriter* pWriter ) const { ParticleTechniqueSerialization Serialize; Serialize.Save( this, pWriter ); } //------------------------------------------------------------------------ void ParticleTechnique::CopyFrom( const GPtr<ParticleTechnique>& technique ) { SetName( technique->GetName() ); SetPosition( technique->GetPosition() ); SetUseExternBoundingBox( technique->IsUseExternBoundingBox() ); SetExternBoundingBox( technique->GetExternBoundingBox() ); SetParticleQuota( technique->GetParticleQuota() ); SetMoveWorldCoord(technique->IsMoveWorldCoord()); SizeT emmiterCount = technique->GetEmitterCount(); for ( IndexT index = 0; index < emmiterCount; ++index ) { const ParticleEmitterPtr& emitter = technique->GetEmitter( index ); ParticleEmitterPtr dest = Clone( emitter ); AddEmitter( dest ); } SizeT affectorCount = technique->GetAffectorCount(); for( IndexT index = 0; index < affectorCount; ++index ) { const ParticleAffectorPtr& affector = technique->GetAffector(index); ParticleAffectorPtr dest = Clone( affector ); AddAffector( dest ); } const ParticleTargetPtr& target = technique->GetTarget(); if ( target.isvalid() ) { ParticleTargetPtr dest = Clone( target ); SetTarget( dest ); } } }
34.234234
117
0.653158
[ "3d" ]
2044e5a55f137f9958c9f0db4912794efd1d88a1
3,926
cpp
C++
HelperFunctions/getVkImageDrmFormatModifierListCreateInfoEXT.cpp
dkaip/jvulkan-natives-Linux-x86_64
ea7932f74e828953c712feea11e0b01751f9dc9b
[ "Apache-2.0" ]
null
null
null
HelperFunctions/getVkImageDrmFormatModifierListCreateInfoEXT.cpp
dkaip/jvulkan-natives-Linux-x86_64
ea7932f74e828953c712feea11e0b01751f9dc9b
[ "Apache-2.0" ]
null
null
null
HelperFunctions/getVkImageDrmFormatModifierListCreateInfoEXT.cpp
dkaip/jvulkan-natives-Linux-x86_64
ea7932f74e828953c712feea11e0b01751f9dc9b
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2019-2020 Douglas Kaip * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * getVkImageDrmFormatModifierListCreateInfoEXT.cpp * * Created on: May 27, 2019 * Author: Douglas Kaip */ #include "JVulkanHelperFunctions.hh" #include "slf4j.hh" namespace jvulkan { void getVkImageDrmFormatModifierListCreateInfoEXT( JNIEnv *env, const jobject jVkImageDrmFormatModifierListCreateInfoEXTObject, VkImageDrmFormatModifierListCreateInfoEXT *vkImageDrmFormatModifierListCreateInfoEXT, std::vector<void *> *memoryToFree) { jclass theClass = env->GetObjectClass(jVkImageDrmFormatModifierListCreateInfoEXTObject); if (env->ExceptionOccurred()) { LOGERROR(env, "%s", "Could not find class for jVkImageDrmFormatModifierListCreateInfoEXTObject"); return; } //////////////////////////////////////////////////////////////////////// VkStructureType sTypeValue = getSType(env, jVkImageDrmFormatModifierListCreateInfoEXTObject); if (env->ExceptionOccurred()) { LOGERROR(env, "%s", "Call to getSType failed."); return; } //////////////////////////////////////////////////////////////////////// jobject jpNextObject = getpNextObject(env, jVkImageDrmFormatModifierListCreateInfoEXTObject); if (env->ExceptionOccurred()) { LOGERROR(env, "%s", "Call to getpNext failed."); return; } void *pNext = nullptr; if (jpNextObject != nullptr) { getpNextChain( env, jpNextObject, &pNext, memoryToFree); if (env->ExceptionOccurred()) { LOGERROR(env, "%s", "Call to getpNextChain failed."); return; } } //////////////////////////////////////////////////////////////////////// jmethodID methodId = env->GetMethodID(theClass, "getDrmFormatModifiers", "()[J"); if (env->ExceptionOccurred()) { LOGERROR(env, "%s", "Could not find method id for getDrmFormatModifiers"); return; } jlongArray jDrmFormatModifiersArrayObject = (jlongArray)env->CallObjectMethod(jVkImageDrmFormatModifierListCreateInfoEXTObject, methodId); if (env->ExceptionOccurred()) { LOGERROR(env, "%s", "Error calling CallObjectMethod"); return; } uint64_t *pDrmFormatModifiers = nullptr; jsize arrayLength = 0; if (jDrmFormatModifiersArrayObject != nullptr) { arrayLength = env->GetArrayLength(jDrmFormatModifiersArrayObject); pDrmFormatModifiers = (uint64_t *)calloc(arrayLength, sizeof(uint64_t)); memoryToFree->push_back(pDrmFormatModifiers); env->GetLongArrayRegion(jDrmFormatModifiersArrayObject, 0, arrayLength, (long int *)pDrmFormatModifiers); if (env->ExceptionOccurred()) { return; } } vkImageDrmFormatModifierListCreateInfoEXT->sType = sTypeValue; vkImageDrmFormatModifierListCreateInfoEXT->pNext = pNext; vkImageDrmFormatModifierListCreateInfoEXT->drmFormatModifierCount = (uint32_t)arrayLength; vkImageDrmFormatModifierListCreateInfoEXT->pDrmFormatModifiers = pDrmFormatModifiers; } }
35.690909
146
0.611819
[ "vector" ]
2045dee28822ef5ee2420f08cb2ed2258fd347b1
2,073
hpp
C++
Phoenix3D/PX2Edit/PX2EditRenderView_TimeLine.hpp
PheonixFoundation/Phoenix3D
bfb2e3757bf61ac461aeeda9216bf8c8fdf76d99
[ "BSL-1.0" ]
36
2016-04-24T01:40:38.000Z
2022-01-18T07:32:26.000Z
Phoenix3D/PX2Edit/PX2EditRenderView_TimeLine.hpp
PheonixFoundation/Phoenix3D
bfb2e3757bf61ac461aeeda9216bf8c8fdf76d99
[ "BSL-1.0" ]
null
null
null
Phoenix3D/PX2Edit/PX2EditRenderView_TimeLine.hpp
PheonixFoundation/Phoenix3D
bfb2e3757bf61ac461aeeda9216bf8c8fdf76d99
[ "BSL-1.0" ]
16
2016-06-13T08:43:51.000Z
2020-09-15T13:25:58.000Z
// PX2EditRenderView_TimeLine.hpp #ifndef PX2EDITUIRENDERVIEW_TIMELINE_HPP #define PX2EDITUIRENDERVIEW_TIMELINE_HPP #include "PX2EditPre.hpp" #include "PX2EditRenderView.hpp" #include "PX2Polysegment.hpp" #include "PX2UIFrame.hpp" #include "PX2UIView.hpp" namespace PX2 { class EffectModule; class PX2_EDIT_ITEM EditRenderView_TimeLine : public EditRenderView { public: EditRenderView_TimeLine(); virtual ~EditRenderView_TimeLine(); virtual bool InitlizeRendererStep(const std::string &name); virtual void Tick(double elapsedTime); void FitViewHorizontally(); void FitViewVertically(); void FitViewToAll(); void FitViewToSelected(); void ZoomCamera(float xDetal, float zDetal); void ZoomCameraTo(float xMax, float zMax); protected: void _RefreshGrid(bool doScale); void _TrySelectCurveCtrlPoint(const APoint &pos); enum MoveMode { MM_PAN, MM_ZOOM, MM_MAX_MODE }; MoveMode mMoveMode; UIViewPtr mUIViewUIGroup; UIViewPtr mUIViewGrid; float mLeftWidth; float mPixelOverCamIn; float mPixelOverCamOut; // Grid float mUPerGrid; float mVPerGrid; float mXStart; float mXEnd; float mZStart; float mZEnd; struct FontStr { FontStr() { x = 0; y = 0; } int x; int y; std::string str; }; std::vector<FontStr> mFontStrs; public: virtual void OnSize(const Sizef& size); virtual void OnLeftDown(const APoint &pos); virtual void OnLeftUp(const APoint &pos); virtual void OnLeftDClick(const APoint &pos); virtual void OnMiddleDown(const APoint &pos); virtual void OnMiddleUp(const APoint &pos); virtual void OnMouseWheel(float delta); virtual void OnRightDown(const APoint &pos); virtual void OnRightUp(const APoint &pos); virtual void OnMotion(const APoint &pos); // Event public: virtual void DoExecute(Event *event); protected: void RemoveCurveGroup(EffectModule *module); void RemoveCurveGroup(InterpCurveController *ctrl); void RemoveCurveGroup(Movable *mov); }; typedef Pointer0<EditRenderView_TimeLine> EditRenderView_TimeLinePtr; } #endif
21.371134
70
0.749156
[ "vector" ]
2065128097d2d835370bcdfc6258c772ec6a77ce
885
cpp
C++
codeforces/cdf308_2d.cpp
knuu/competitive-programming
16bc68fdaedd6f96ae24310d697585ca8836ab6e
[ "MIT" ]
1
2018-11-12T15:18:55.000Z
2018-11-12T15:18:55.000Z
codeforces/cdf308_2d.cpp
knuu/competitive-programming
16bc68fdaedd6f96ae24310d697585ca8836ab6e
[ "MIT" ]
null
null
null
codeforces/cdf308_2d.cpp
knuu/competitive-programming
16bc68fdaedd6f96ae24310d697585ca8836ab6e
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; #define REP(i,x) for(int i=0;i<(int)(x);i++) #define FOR(i,s,x) for(int i=s;i<(int)(x);i++) #define PB push_back #define MP make_pair #define DUMP( x ) cerr << #x << " = " << ( x ) << endl #define fst first #define snd second int N; vector<P> point; bool isLine(P p1, P p2, P p3) { int x1 = p1.fst, y1 = p1.snd; int x2 = p2.fst, y2 = p2.snd; int x3 = p3.fst, y3 = p3.snd; double S = abs((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) / 2.0; return S == 0 ? true : false; } int main() { cin >> N; REP(i, N) { int x, y; cin >> x >> y; point.PB(MP(x, y)); } int ans = 0; REP(i, N) FOR(j, i+1, N) FOR(k, j+1, N) if (!isLine(point[i], point[j], point[k])) ans++; cout << ans << endl; return 0; }
21.585366
91
0.545763
[ "vector" ]
20693463dd8f838f8e1f1a2a2f3b90fa151e3edb
16,171
cpp
C++
third_party/virtualbox/src/libs/xpcom18a4/xpcom/proxy/tests/proxytests.cpp
Fimbure/icebox-1
0b81992a53e1b410955ca89bdb6f8169d6f2da86
[ "MIT" ]
521
2019-03-29T15:44:08.000Z
2022-03-22T09:46:19.000Z
third_party/virtualbox/src/libs/xpcom18a4/xpcom/proxy/tests/proxytests.cpp
Fimbure/icebox-1
0b81992a53e1b410955ca89bdb6f8169d6f2da86
[ "MIT" ]
30
2019-06-04T17:00:49.000Z
2021-09-08T20:44:19.000Z
third_party/virtualbox/src/libs/xpcom18a4/xpcom/proxy/tests/proxytests.cpp
Fimbure/icebox-1
0b81992a53e1b410955ca89bdb6f8169d6f2da86
[ "MIT" ]
99
2019-03-29T16:04:13.000Z
2022-03-28T16:59:34.000Z
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Pierre Phaneuf <pp@ludusdesign.com> * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include <stdio.h> #include "nsXPCOM.h" #include "nsIComponentManager.h" #include "nsIComponentRegistrar.h" #include "nsIServiceManager.h" #include "nsCOMPtr.h" #include "nscore.h" #include "nspr.h" #include "prmon.h" #include "nsITestProxy.h" #include "nsIProxyObjectManager.h" #include "nsIEventQueueService.h" static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); /***************************************************************************/ /* nsTestXPCFoo */ /***************************************************************************/ class nsTestXPCFoo : public nsITestProxy { NS_DECL_ISUPPORTS NS_IMETHOD Test(PRInt32 p1, PRInt32 p2, PRInt32* retval); NS_IMETHOD Test2(); NS_IMETHOD Test3(nsISupports *p1, nsISupports **p2); nsTestXPCFoo(); }; nsTestXPCFoo::nsTestXPCFoo() { NS_ADDREF_THIS(); } NS_IMPL_ISUPPORTS1(nsTestXPCFoo, nsITestProxy) NS_IMETHODIMP nsTestXPCFoo::Test(PRInt32 p1, PRInt32 p2, PRInt32* retval) { printf("Thread (%d) Test Called successfully! Party on...\n", p1); *retval = p1+p2; return NS_OK; } NS_IMETHODIMP nsTestXPCFoo::Test2() { printf("The quick brown netscape jumped over the old lazy ie..\n"); return NS_OK; } NS_IMETHODIMP nsTestXPCFoo::Test3(nsISupports *p1, nsISupports **p2) { if (p1 != nsnull) { nsITestProxy *test; p1->QueryInterface(NS_GET_IID(nsITestProxy), (void**)&test); test->Test2(); PRInt32 a; test->Test( 1, 2, &a); printf("\n1+2=%d\n",a); } *p2 = new nsTestXPCFoo(); return NS_OK; } /***************************************************************************/ /* nsTestXPCFoo2 */ /***************************************************************************/ class nsTestXPCFoo2 : public nsITestProxy { NS_DECL_ISUPPORTS NS_IMETHOD Test(PRInt32 p1, PRInt32 p2, PRInt32* retval); NS_IMETHOD Test2(); NS_IMETHOD Test3(nsISupports *p1, nsISupports **p2); nsTestXPCFoo2(); }; nsTestXPCFoo2::nsTestXPCFoo2() { NS_ADDREF_THIS(); } NS_IMPL_THREADSAFE_ISUPPORTS1(nsTestXPCFoo2, nsITestProxy) NS_IMETHODIMP nsTestXPCFoo2::Test(PRInt32 p1, PRInt32 p2, PRInt32* retval) { printf("calling back to caller!\n\n"); nsIProxyObjectManager* manager; nsITestProxy * proxyObject; nsServiceManager::GetService( NS_XPCOMPROXY_CONTRACTID, NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); printf("ProxyObjectManager: %p \n", manager); PR_ASSERT(manager); manager->GetProxyForObject((nsIEventQueue*)p1, NS_GET_IID(nsITestProxy), this, PROXY_SYNC, (void**)&proxyObject); proxyObject->Test3(nsnull, nsnull); printf("Deleting Proxy Object\n"); NS_RELEASE(proxyObject); return NS_OK; } NS_IMETHODIMP nsTestXPCFoo2::Test2() { printf("nsTestXPCFoo2::Test2() called\n"); return NS_OK; } NS_IMETHODIMP nsTestXPCFoo2::Test3(nsISupports *p1, nsISupports **p2) { printf("Got called"); return NS_OK; } typedef struct _ArgsStruct { nsIEventQueue* queue; PRInt32 threadNumber; }ArgsStruct; // This will create two objects both descendants of a single IID. void TestCase_TwoClassesOneInterface(void *arg) { ArgsStruct *argsStruct = (ArgsStruct*) arg; nsIProxyObjectManager* manager; nsServiceManager::GetService( NS_XPCOMPROXY_CONTRACTID, NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); printf("ProxyObjectManager: %p \n", manager); PR_ASSERT(manager); nsITestProxy *proxyObject; nsITestProxy *proxyObject2; nsTestXPCFoo* foo = new nsTestXPCFoo(); nsTestXPCFoo2* foo2 = new nsTestXPCFoo2(); PR_ASSERT(foo); PR_ASSERT(foo2); manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject); manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo2, PROXY_SYNC, (void**)&proxyObject2); if (proxyObject && proxyObject2) { // release ownership of the real object. PRInt32 a; nsresult rv; PRInt32 threadNumber = argsStruct->threadNumber; printf("Deleting real Object (%d)\n", threadNumber); NS_RELEASE(foo); printf("Deleting real Object 2 (%d)\n", threadNumber); NS_RELEASE(foo2); printf("Thread (%d) Prior to calling proxyObject->Test.\n", threadNumber); rv = proxyObject->Test(threadNumber, 0, &a); printf("Thread (%d) error: %d.\n", threadNumber, rv); printf("Thread (%d) Prior to calling proxyObject->Test2.\n", threadNumber); rv = proxyObject->Test2(); printf("Thread (%d) error: %d.\n", threadNumber, rv); printf("Thread (%d) Prior to calling proxyObject2->Test2.\n", threadNumber); rv = proxyObject2->Test2(); printf("Thread (%d) proxyObject2 error: %d.\n", threadNumber, rv); printf("Deleting Proxy Object (%d)\n", threadNumber ); NS_RELEASE(proxyObject); printf("Deleting Proxy Object 2 (%d)\n", threadNumber ); NS_RELEASE(proxyObject2); } PR_Sleep( PR_MillisecondsToInterval(1000) ); // If your thread goes away, your stack goes away. Only use ASYNC on calls that do not have out parameters } void TestCase_NestedLoop(void *arg) { ArgsStruct *argsStruct = (ArgsStruct*) arg; nsIProxyObjectManager* manager; nsServiceManager::GetService( NS_XPCOMPROXY_CONTRACTID, NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); printf("ProxyObjectManager: %p \n", manager); PR_ASSERT(manager); nsITestProxy *proxyObject; nsTestXPCFoo2* foo = new nsTestXPCFoo2(); PR_ASSERT(foo); manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject); if (proxyObject) { // release ownership of the real object. nsresult rv; PRInt32 threadNumber = argsStruct->threadNumber; printf("Deleting real Object (%d)\n", threadNumber); NS_RELEASE(foo); PRInt32 retval; printf("Getting EventQueue...\n"); nsIEventQueue* eventQ; nsCOMPtr<nsIEventQueueService> eventQService = do_GetService(kEventQueueServiceCID, &rv); if (NS_SUCCEEDED(rv)) { rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ); if (NS_FAILED(rv)) rv = eventQService->CreateThreadEventQueue(); if (NS_FAILED(rv)) return; else rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ); printf("Thread (%d) Prior to calling proxyObject->Test.\n", threadNumber); rv = proxyObject->Test(NS_PTR_TO_INT32(eventQ), 0, &retval); printf("Thread (%d) proxyObject error: %d.\n", threadNumber, rv); printf("Deleting Proxy Object (%d)\n", threadNumber ); NS_RELEASE(proxyObject); } PR_Sleep( PR_MillisecondsToInterval(1000) ); // If your thread goes away, your stack goes away. Only use ASYNC on calls that do not have out parameters } } void TestCase_2(void *arg) { ArgsStruct *argsStruct = (ArgsStruct*) arg; nsIProxyObjectManager* manager; nsServiceManager::GetService( NS_XPCOMPROXY_CONTRACTID, NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); PR_ASSERT(manager); nsITestProxy *proxyObject; manager->GetProxy(argsStruct->queue, NS_GET_IID(nsITestProxy), // should be CID! nsnull, NS_GET_IID(nsITestProxy), PROXY_SYNC, (void**)&proxyObject); if (proxyObject != nsnull) { NS_RELEASE(proxyObject); } } void TestCase_nsISupports(void *arg) { ArgsStruct *argsStruct = (ArgsStruct*) arg; nsIProxyObjectManager* manager; nsServiceManager::GetService( NS_XPCOMPROXY_CONTRACTID, NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); PR_ASSERT(manager); nsITestProxy *proxyObject; nsTestXPCFoo* foo = new nsTestXPCFoo(); PR_ASSERT(foo); manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject); if (proxyObject != nsnull) { nsISupports *bISupports = nsnull, *cISupports = nsnull; proxyObject->Test3(foo, &bISupports); proxyObject->Test3(bISupports, &cISupports); nsITestProxy *test; bISupports->QueryInterface(NS_GET_IID(nsITestProxy), (void**)&test); test->Test2(); NS_RELEASE(foo); NS_RELEASE(proxyObject); } } /***************************************************************************/ /* ProxyTest */ /***************************************************************************/ static void PR_CALLBACK ProxyTest( void *arg ) { //TestCase_TwoClassesOneInterface(arg); // TestCase_2(arg); //TestCase_nsISupports(arg); TestCase_NestedLoop(arg); NS_RELEASE( ((ArgsStruct*) arg)->queue); free((void*) arg); } nsIEventQueue *gEventQueue = nsnull; static void PR_CALLBACK EventLoop( void *arg ) { nsresult rv; printf("Creating EventQueue...\n"); nsIEventQueue* eventQ; nsCOMPtr<nsIEventQueueService> eventQService = do_GetService(kEventQueueServiceCID, &rv); if (NS_SUCCEEDED(rv)) { rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ); if (NS_FAILED(rv)) rv = eventQService->CreateThreadEventQueue(); if (NS_FAILED(rv)) return; else rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ); } if (NS_FAILED(rv)) return; rv = eventQ->QueryInterface(NS_GET_IID(nsIEventQueue), (void**)&gEventQueue); if (NS_FAILED(rv)) return; printf("Verifing calling Proxy on eventQ thread.\n"); nsIProxyObjectManager* manager; nsServiceManager::GetService( NS_XPCOMPROXY_CONTRACTID, NS_GET_IID(nsIProxyObjectManager), (nsISupports **)&manager); PR_ASSERT(manager); nsITestProxy *proxyObject; nsTestXPCFoo* foo = new nsTestXPCFoo(); PR_ASSERT(foo); manager->GetProxyForObject(gEventQueue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject); PRInt32 a; proxyObject->Test(1, 2, &a); proxyObject->Test2(); NS_RELEASE(proxyObject); delete foo; printf("End of Verification calling Proxy on eventQ thread.\n"); printf("Looping for events.\n"); PLEvent* event = nsnull; while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(1)) ) { rv = gEventQueue->GetEvent(&event); if (NS_FAILED(rv)) return; gEventQueue->HandleEvent(event); } gEventQueue->ProcessPendingEvents(); printf("Closing down Event Queue.\n"); delete gEventQueue; gEventQueue = nsnull; printf("End looping for events.\n\n"); } int main(int argc, char **argv) { int numberOfThreads = 1; if (argc > 1) numberOfThreads = atoi(argv[1]); nsCOMPtr<nsIServiceManager> servMan; NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull); nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); NS_ASSERTION(registrar, "Null nsIComponentRegistrar"); registrar->AutoRegister(nsnull); static PRThread** threads = (PRThread**) calloc(sizeof(PRThread*), numberOfThreads); static PRThread* aEventThread; aEventThread = PR_CreateThread(PR_USER_THREAD, EventLoop, NULL, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0 ); PR_Sleep(PR_MillisecondsToInterval(1000)); NS_ASSERTION(gEventQueue, "no main event queue"); // BAD BAD BAD. EVENT THREAD DID NOT CREATE QUEUE. This may be a timing issue, set the // sleep about longer, and try again. printf("Spawn Threads:\n"); for (PRInt32 spawn = 0; spawn < numberOfThreads; spawn++) { ArgsStruct *args = (ArgsStruct *) malloc (sizeof(ArgsStruct)); args->queue = gEventQueue; NS_ADDREF(args->queue); args->threadNumber = spawn; threads[spawn] = PR_CreateThread(PR_USER_THREAD, ProxyTest, args, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0 ); printf("\tThread (%d) spawned\n", spawn); PR_Sleep( PR_MillisecondsToInterval(250) ); } printf("All Threads Spawned.\n\n"); printf("Wait for threads.\n"); for (PRInt32 i = 0; i < numberOfThreads; i++) { PRStatus rv; printf("Thread (%d) Join...\n", i); rv = PR_JoinThread(threads[i]); printf("Thread (%d) Joined. (error: %d).\n", i, rv); } PR_Interrupt(aEventThread); PR_JoinThread(aEventThread); printf("Calling Cleanup.\n"); PR_Cleanup(); printf("Return zero.\n"); return 0; }
29.189531
161
0.588708
[ "object" ]
2069cdc2fa32b5adfe5c26f970a70d5fae30a3b3
309,872
cpp
C++
mtce/src/common/nodeClass.cpp
oponcea/ceph-uprev-stx-metal
03c70b1bb2fc3e97193f2a4a15ef8acffe171870
[ "Apache-2.0" ]
null
null
null
mtce/src/common/nodeClass.cpp
oponcea/ceph-uprev-stx-metal
03c70b1bb2fc3e97193f2a4a15ef8acffe171870
[ "Apache-2.0" ]
null
null
null
mtce/src/common/nodeClass.cpp
oponcea/ceph-uprev-stx-metal
03c70b1bb2fc3e97193f2a4a15ef8acffe171870
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2013-2016 Wind River Systems, Inc. * * SPDX-License-Identifier: Apache-2.0 * */ /** * @file * Wind River CGTS Platform Nodal Health Check Service Node Implementation */ #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string> #include <errno.h> /* for ENODEV, EFAULT and ENXIO */ #include <unistd.h> /* for close and usleep */ using namespace std; #ifdef __AREA__ #undef __AREA__ #define __AREA__ "---" #endif #include "nodeBase.h" #include "threadUtil.h" #include "nodeClass.h" #include "nodeUtil.h" #include "mtcNodeMsg.h" /* for ... send_mtc_cmd */ #include "nlEvent.h" /* for ... get_netlink_events */ #include "daemon_common.h" #include "alarmUtil.h" #include "mtcAlarm.h" #include "alarm.h" #include "hbsAlarm.h" #include "hbsBase.h" /** Initialize the supplied command buffer */ void mtcCmd_init ( mtcCmd & cmd ) { cmd.cmd = 0 ; cmd.rsp = 0 ; cmd.ack = 0 ; cmd.retry = 0 ; cmd.parm1 = 0 ; cmd.parm2 = 0 ; cmd.task = false ; cmd.status = RETRY ; cmd.status_string.clear(); cmd.name.clear(); } extern void mtcTimer_handler ( int sig, siginfo_t *si, void *uc); const char mtc_nodeAdminAction_str[MTC_ADMIN_ACTIONS][20] = { "none", "lock", "unlock", "reset", "reboot", "reinstall", "power-off", "power-on", "recovery", "delete", "powercycle", "add", "swact", "force-lock", "force-swact", "enable", "enable-subf", }; const char * get_adminAction_str ( mtc_nodeAdminAction_enum action ) { if ( action >= MTC_ADMIN_ACTIONS ) { slog ("Invalid admin action (%d)\n", action); action = MTC_ADMIN_ACTION__NONE ; } return ( &mtc_nodeAdminAction_str[action][0] ); } const char mtc_nodeAdminState_str[MTC_ADMIN_STATES][15] = { "locked", "unlocked", }; string get_adminState_str ( mtc_nodeAdminState_enum adminState ) { if ( adminState >= MTC_ADMIN_STATES ) { slog ("Invalid admin state (%d)\n", adminState ); adminState = MTC_ADMIN_STATE__LOCKED ; } return ( mtc_nodeAdminState_str[adminState] ); } bool adminStateOk ( string admin ) { if (( admin.compare(mtc_nodeAdminState_str[0])) && ( admin.compare(mtc_nodeAdminState_str[1]))) { wlog ("Invalid 'admin' state (%s)\n", admin.c_str()); return ( false ); } return (true); } const char mtc_nodeOperState_str[MTC_OPER_STATES][15] = { "disabled", "enabled" }; string get_operState_str ( mtc_nodeOperState_enum operState ) { if ( operState >= MTC_OPER_STATES ) { slog ("Invalid oper state (%d)\n", operState ); operState = MTC_OPER_STATE__DISABLED ; } return ( mtc_nodeOperState_str[operState] ); } bool operStateOk ( string oper ) { if (( oper.compare(mtc_nodeOperState_str[0])) && ( oper.compare(mtc_nodeOperState_str[1]))) { wlog ("Invalid 'oper' state (%s)\n", oper.c_str()); return ( false ); } return (true); } const char mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS][15] = { "not-installed", "available", "degraded", "failed", "intest", "power-off", "offline", "online", "offduty" }; bool availStatusOk ( string avail ) { if (( avail.compare(mtc_nodeAvailStatus_str[0])) && ( avail.compare(mtc_nodeAvailStatus_str[1])) && ( avail.compare(mtc_nodeAvailStatus_str[2])) && ( avail.compare(mtc_nodeAvailStatus_str[3])) && ( avail.compare(mtc_nodeAvailStatus_str[4])) && ( avail.compare(mtc_nodeAvailStatus_str[5])) && ( avail.compare(mtc_nodeAvailStatus_str[6])) && ( avail.compare(mtc_nodeAvailStatus_str[7])) && ( avail.compare(mtc_nodeAvailStatus_str[8]))) { wlog ("Invalid 'avail' status (%s)\n", avail.c_str()); return ( false ); } return (true); } string get_availStatus_str ( mtc_nodeAvailStatus_enum availStatus ) { if ( availStatus > MTC_AVAIL_STATUS ) { slog ("Invalid avail status (%d)\n", availStatus ); availStatus = MTC_AVAIL_STATUS__FAILED ; } return ( mtc_nodeAvailStatus_str[availStatus] ); } #ifdef WANT_nodeClass_latency_log /* Needs to be tied to a node */ #define NODECLASS_LATENCY_MON_START ((const char *)"start") #define MAX_DELAY_B4_LATENCY_LOG (1700) void nodeClass_latency_log ( const char * label_ptr, int msecs ) { static unsigned long long prev__time = 0 ; static unsigned long long this__time = 0 ; this__time = gettime_monotonic_nsec () ; /* If label_ptr is != NULL and != start then take the measurement */ if ( label_ptr && strncmp ( label_ptr, NODECLASS_LATENCY_MON_START, strlen(NODECLASS_LATENCY_MON_START))) { if ( this__time > (prev__time + (NSEC_TO_MSEC*(msecs)))) { llog ("%4llu.%-4llu msec - %s\n", ((this__time-prev__time) > NSEC_TO_MSEC) ? ((this__time-prev__time)/NSEC_TO_MSEC) : 0, ((this__time-prev__time) > NSEC_TO_MSEC) ? ((this__time-prev__time)%NSEC_TO_MSEC) : 0, label_ptr); } } /* reset to be equal for next round */ prev__time = this__time ; } #endif /* nodeLinkClass constructor */ nodeLinkClass::nodeLinkClass() { this->is_poweron_handler = NULL; for(unsigned int i=0; i<MAX_NODES; ++i) { this->node_ptrs[i] = NULL; } this->offline_threshold = 0; this->offline_period = 0; /* this->mtcTimer = mtc_timer(); * this->mtcTimer_mnfa = mtc_timer(); * this->mtcTimer_token = mtc_timer(); * this->mtcTimer_uptime = mtc_timer(); */ this->api_retries = 0; for(unsigned int i =0; i<MAX_IFACES; ++i) { this->pulse_requests[i] = 0; this->hbs_expected_pulses[i] = 0; this->hbs_detected_pulses[i] = 0; } this->compute_mtcalive_timeout = 0; this->controller_mtcalive_timeout = 0; this->goenabled_timeout = 0; this->loc_recovery_timeout = 0; this->node_reinstall_timeout = 0; this->token_refresh_rate = 0; head = tail = NULL; memory_allocs = 0 ; memory_used = 0 ; hosts = 0 ; host_deleted = false ; /* Init the base level pulse info and pointers for all interfaces */ pulse_ptr = NULL ; for ( int i = 0 ; i < MAX_IFACES ; i++ ) { pulse_list[i].head_ptr = NULL ; pulse_list[i].tail_ptr = NULL ; pulse_list[i].last_ptr = NULL ; pulses[i] = 0 ; } /* init the resource reference index to null */ rrri = 0 ; /* Entry of RRA is reserved (not used) and set to NULL */ hbs_rra[0] = static_cast<struct node *>(NULL) ; /* Make no assumption on the service */ maintenance = false ; heartbeat = false ; active = false ; /* run active */ active_controller = false ; /* true if this controller is active */ /* Set some defaults for the hearbeat service */ hbs_ready = false ; hbs_state_change = false ; hbs_disabled = true ; hbs_pulse_period = hbs_pulse_period_save = 0 ; hbs_minor_threshold = HBS_MINOR_THRESHOLD ; hbs_degrade_threshold = HBS_DEGRADE_THRESHOLD ; hbs_failure_threshold = HBS_FAILURE_THRESHOLD ; hbs_failure_action = HBS_FAILURE_ACTION__FAIL ; hbs_silent_fault_detector = 0 ; hbs_silent_fault_logged = false ; /* Start with null identity */ my_hostname.clear() ; my_local_ip.clear() ; my_float_ip.clear() ; active_controller_hostname.clear() ; inactive_controller_hostname.clear() ; /* MNFA Activity Controls */ mnfa_threshold = 2 ; /* 2 hosts */ mnfa_timeout = 0 ; /* no timeout */ /* Start with no failures */ mnfa_awol_list.clear(); mnfa_host_count[MGMNT_IFACE] = 0 ; mnfa_host_count[INFRA_IFACE] = 0 ; mnfa_occurances = 0 ; mnfa_active = false ; mgmnt_link_up_and_running = false ; infra_link_up_and_running = false ; infra_network_provisioned = false ; infra_degrade_only = false ; dor_mode_active = false ; dor_start_time = 0 ; dor_mode_active_log_throttle = 0 ; swact_timeout = MTC_MINS_2 ; uptime_period = MTC_UPTIME_REFRESH_TIMER ; online_period = MTC_OFFLINE_TIMER ; sysinv_timeout = HTTP_SYSINV_CRIT_TIMEOUT ; sysinv_noncrit_timeout = HTTP_SYSINV_NONC_TIMEOUT ; work_queue_timeout = MTC_WORKQUEUE_TIMEOUT ; /* Init the auto recovery threshold and intervals to zero until * modified by daemon config */ memset (&ar_threshold, 0, sizeof(ar_threshold)); memset (&ar_interval, 0, sizeof(ar_interval)); /* Inservice test periods in seconds - 0 = disabled */ insv_test_period = 0 ; oos_test_period = 0 ; /* Init the inotify shadow password file descriptors to zero */ inotify_shadow_file_fd = 0 ; inotify_shadow_file_wd = 0 ; /* Ensure that HA Swact gate is open on init. * This true gates maintenance commands */ smgrEvent.mutex = false ; /* Init the event bases to null as they have not been allocated yet */ sysinvEvent.base = NULL ; smgrEvent.base = NULL ; tokenEvent.base = NULL ; sysinvEvent.conn = NULL ; smgrEvent.conn = NULL ; tokenEvent.conn = NULL ; sysinvEvent.req = NULL ; smgrEvent.req = NULL ; tokenEvent.req = NULL ; sysinvEvent.buf = NULL ; smgrEvent.buf = NULL ; tokenEvent.buf = NULL ; unknown_host_throttle = 0 ; testmode = 0 ; module_init( ); } /* nodeLinkClass destructor */ nodeLinkClass::~nodeLinkClass() { /* Free any allocated host memory */ for ( int i = 0 ; i < MAX_HOSTS ; i++ ) { if ( node_ptrs[i] ) { delete node_ptrs[i] ; } } } /* Clear start host service controls */ void nodeLinkClass::clear_hostservices_ctls ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr ) { node_ptr->start_services_needed = false ; node_ptr->start_services_needed_subf = false ; node_ptr->start_services_running_main = false ; node_ptr->start_services_running_subf = false ; node_ptr->start_services_retries = 0 ; } } /* Clear all the main function enable failure bools */ void nodeLinkClass::clear_main_failed_bools ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr ) { node_ptr->config_failed = false ; node_ptr->goEnabled_failed = false ; node_ptr->inservice_failed = false ; node_ptr->hostservices_failed = false ; return; } slog ("null pointer\n"); } /* Clear all the sub function enable failure bools */ void nodeLinkClass::clear_subf_failed_bools ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr ) { node_ptr->config_failed_subf = false ; node_ptr->goEnabled_failed_subf = false ; node_ptr->inservice_failed_subf = false ; node_ptr->hostservices_failed_subf = false ; return; } slog ("null pointer\n"); } /* * Allocates memory for a new node and stores its the address in node_ptrs * @param void * @return node pointer to the newly allocted node */ struct nodeLinkClass::node * nodeLinkClass::newNode ( void ) { struct nodeLinkClass::node * temp_node_ptr = NULL ; if ( memory_allocs == 0 ) { memset ( node_ptrs, 0 , sizeof(struct node *)*MAX_NODES); } // find an empty spot for ( int i = 0 ; i < MAX_NODES ; i++ ) { if ( node_ptrs[i] == NULL ) { node_ptrs[i] = temp_node_ptr = new node ; memory_allocs++ ; memory_used += sizeof (struct nodeLinkClass::node); return temp_node_ptr ; } } elog ( "Failed to save new node pointer address\n" ); return temp_node_ptr ; } /* Frees the memory of a pre-allocated node and removes * it from the node_ptrs list * @param node * pointer to the node memory address to be freed * @return int return code { PASS or -EINVAL } */ int nodeLinkClass::delNode ( struct nodeLinkClass::node * node_ptr ) { if ( memory_allocs > 0 ) { for ( int i = 0 ; i < MAX_NODES ; i++ ) { if ( node_ptrs[i] == node_ptr ) { delete node_ptr ; node_ptrs[i] = NULL ; memory_allocs-- ; memory_used -= sizeof (struct nodeLinkClass::node); return PASS ; } } elog ( "Error: Unable to validate memory address being freed\n" ); } else elog ( "Error: Free memory called when there is no memory to free\n" ); return -EINVAL ; } /* * Allocate new node and tack it on the end of the node_list */ struct nodeLinkClass::node* nodeLinkClass::addNode( string hostname ) { /* verify node is not already provisioned */ struct node * ptr = getNode ( hostname ); if ( ptr ) { /* if it is then clean it up and fall through */ if ( !testmode ) { wlog ("Warning: Node already provisioned\n"); } if ( remNode ( hostname ) ) { /* Should never get here but if we do then */ /* something is seriously wrong */ elog ("Error: Unable to remove node during reprovision\n"); return static_cast<struct node *>(NULL); } } /* allocate memory for new node */ ptr = newNode (); if( ptr == NULL ) { elog ( "Error: Failed to allocate memory for new node\n" ); return static_cast<struct node *>(NULL); } /* init the new node */ ptr->hostname = hostname ; ptr->ip = "" ; ptr->mac = "" ; ptr->infra_ip = "" ; ptr->infra_mac = "" ; ptr->patching = false ; ptr->patched = false ; /* the goenabled state bool */ ptr->goEnabled = false ; ptr->goEnabled_subf = false ; clear_hostservices_ctls ( ptr ); /* clear all the enable failure bools */ clear_main_failed_bools ( ptr ); clear_subf_failed_bools ( ptr ); /* Set the subfunction to disabled */ ptr->operState_subf = MTC_OPER_STATE__DISABLED ; ptr->availStatus_subf = MTC_AVAIL_STATUS__NOT_INSTALLED ; ptr->operState_dport = MTC_OPER_STATE__DISABLED ; ptr->availStatus_dport= MTC_AVAIL_STATUS__OFFDUTY ; ptr->enabled_count = 0 ; ptr->cmdName = ""; ptr->cmdReq = 0 ; ptr->cmdRsp = 0 ; ptr->cmdRsp_status= 0 ; ptr->cmdRsp_status_string = "" ; ptr->add_completed = false ; /* init the hwmon reset and powercycle recovery control structures */ recovery_ctrl_init ( ptr->hwmon_reset ); recovery_ctrl_init ( ptr->hwmon_powercycle ); /* Default timeout values */ ptr->mtcalive_timeout = HOST_MTCALIVE_TIMEOUT ; /* no ned to send a reboot response back to any client */ ptr->activeClient = CLIENT_NONE ; ptr->task = "none" ; ptr->action = "none" ; ptr->clear_task = false ; ptr->mtcAlive_gate = true ; ptr->mtcAlive_online = false ; ptr->mtcAlive_offline = true ; ptr->mtcAlive_misses = 0 ; ptr->mtcAlive_hits = 0 ; ptr->mtcAlive_count = 0 ; ptr->mtcAlive_purge = 0 ; ptr->offline_search_count = 0 ; ptr->mtcAlive_mgmnt = false ; ptr->mtcAlive_infra = false ; ptr->reboot_cmd_ack_mgmnt = false ; ptr->reboot_cmd_ack_infra = false ; ptr->offline_log_throttle = 0 ; ptr->offline_log_reported = true ; ptr->online_log_reported = false ; ptr->dor_recovery_mode = false ; ptr->was_dor_recovery_mode= false ; ptr->dor_recovery_time = 0 ; ptr->ar_disabled = false ; ptr->ar_cause = MTC_AR_DISABLE_CAUSE__NONE ; memset (&ptr->ar_count, 0, sizeof(ptr->ar_count)); ptr->ar_log_throttle = 0 ; mtcTimer_init ( ptr->mtcTimer, hostname, "mtc timer"); /* Init node's general mtc timer */ mtcTimer_init ( ptr->insvTestTimer, hostname, "insv test timer"); mtcTimer_init ( ptr->oosTestTimer, hostname, "oos test timer"); /* Init node's oos test timer */ mtcTimer_init ( ptr->mtcSwact_timer, hostname, "mtcSwact timer"); /* Init node's mtcSwact timer */ mtcTimer_init ( ptr->mtcCmd_timer, hostname, "mtcCmd timer"); /* Init node's mtcCmd timer */ mtcTimer_init ( ptr->mtcConfig_timer, hostname, "mtcConfig timer"); /* Init node's mtcConfig timer */ mtcTimer_init ( ptr->mtcAlive_timer , hostname, "mtcAlive timer"); /* Init node's mtcAlive timer */ mtcTimer_init ( ptr->offline_timer, hostname, "offline timer"); /* Init node's FH offline timer */ mtcTimer_init ( ptr->http_timer, hostname, "http timer" ); /* Init node's http timer */ mtcTimer_init ( ptr->bm_timer, hostname, "bm timer" ); /* Init node's bm timer */ mtcTimer_init ( ptr->bm_ping_info.timer,hostname,"ping timer" ); /* Init node's ping timer */ mtcTimer_init ( ptr->bmc_access_timer, hostname, "bmc acc timer" ); /* Init node's bm access timer */ mtcTimer_init ( ptr->host_services_timer, hostname, "host services timer" ); /* host services timer */ mtcTimer_init ( ptr->hwmon_powercycle.control_timer, hostname, "powercycle control timer"); mtcTimer_init ( ptr->hwmon_powercycle.recovery_timer, hostname, "powercycle recovery timer"); mtcTimer_init ( ptr->hwmon_reset.control_timer, hostname, "reset control timer"); mtcTimer_init ( ptr->hwmon_reset.recovery_timer, hostname, "reset recovery timer"); mtcCmd_init ( ptr->host_services_req ); mtcCmd_init ( ptr->mtcAlive_req ); mtcCmd_init ( ptr->reboot_req ); mtcCmd_init ( ptr->general_req ); ptr->configStage = MTC_CONFIG__START ; ptr->swactStage = MTC_SWACT__START ; ptr->offlineStage = MTC_OFFLINE__IDLE ; ptr->onlineStage = MTC_ONLINE__START ; ptr->addStage = MTC_ADD__START ; ptr->delStage = MTC_DEL__START ; ptr->recoveryStage = MTC_RECOVERY__START ; ptr->insvTestStage = MTC_INSV_TEST__RUN ; /* Start wo initial delay */ ptr->oosTestStage = MTC_OOS_TEST__LOAD_NEXT_TEST ; ptr->resetProgStage = MTC_RESETPROG__START; ptr->powerStage = MTC_POWER__DONE ; ptr->powercycleStage = MTC_POWERCYCLE__DONE; ptr->subStage = MTC_SUBSTAGE__DONE ; ptr->reinstallStage = MTC_REINSTALL__DONE ; ptr->resetStage = MTC_RESET__START ; ptr->enableStage = MTC_ENABLE__START ; ptr->disableStage = MTC_DISABLE__START ; ptr->oos_test_count = 0 ; ptr->insv_test_count = 0 ; ptr->insv_recovery_counter = 0 ; ptr->uptime = 0 ; ptr->uptime_refresh_counter = 0 ; ptr->node_unlocked_counter = 0 ; /* Good health needs to be learned */ ptr->mtce_flags = 0 ; ptr->graceful_recovery_counter = 0 ; ptr->health_threshold_counter = 0 ; ptr->unknown_health_reported = false ; ptr->mnfa_graceful_recovery = false ; /* initialize all board management variables for this host */ ptr->bm_ip = NONE ; ptr->bm_type = NONE ; ptr->bm_un = NONE ; ptr->bm_pw = NONE ; ptr->bm_provisioned = false ; /* assume not provisioned until learned */ ptr->power_on = false ; /* learned on first BMC connection */ bmc_access_data_init ( ptr ); /* init all the BMC access vars all modes */ /* init the alarm array only to have it updated later * with current alarm severities */ for ( int id = 0 ; id < MAX_ALARMS ; id++ ) { ptr->alarms[id] = FM_ALARM_SEVERITY_CLEAR ; } ptr->alarms_loaded = false ; ptr->cfgEvent.base = NULL ; ptr->sysinvEvent.base= NULL ; ptr->vimEvent.base = NULL ; ptr->httpReq.base = NULL ; ptr->libEvent_done_fifo.clear(); ptr->libEvent_work_fifo.clear(); ptr->oper_sequence = 0 ; ptr->oper_failures = 0 ; ptr->mtcCmd_work_fifo.clear(); ptr->mtcCmd_done_fifo.clear(); ptr->cfgEvent.conn = NULL ; ptr->sysinvEvent.conn= NULL ; ptr->vimEvent.conn = NULL ; ptr->httpReq.conn = NULL ; ptr->cfgEvent.req = NULL ; ptr->sysinvEvent.req = NULL ; ptr->vimEvent.req = NULL ; ptr->httpReq.req = NULL ; ptr->cfgEvent.buf = NULL ; ptr->sysinvEvent.buf = NULL ; ptr->vimEvent.buf = NULL ; ptr->httpReq.buf = NULL ; /* log throttles */ ptr->stall_recovery_log_throttle = 0 ; ptr->stall_monitor_log_throttle = 0 ; ptr->unexpected_pulse_log_throttle = 0 ; ptr->lookup_mismatch_log_throttle = 0 ; ptr->log_throttle = 0 ; ptr->no_work_log_throttle = 0 ; ptr->no_rri_log_throttle = 0 ; ptr->degrade_mask = ptr->degrade_mask_save = DEGRADE_MASK_NONE ; ptr->degraded_resources_list.clear () ; ptr->pmond_ready = false ; ptr->rmond_ready = false ; ptr->hwmond_ready = false ; ptr->hbsClient_ready = false ; ptr->toggle = false ; ptr->retries = 0 ; ptr->http_retries_cur = 0 ; ptr->cmd_retries = 0 ; ptr->power_action_retries = 0 ; ptr->subf_enabled = false ; for ( int i = 0 ; i < MAX_IFACES ; i++ ) { ptr->pulse_link[i].next_ptr = NULL ; ptr->pulse_link[i].prev_ptr = NULL ; ptr->monitor[i] = false ; ptr->hbs_minor[i] = false ; ptr->hbs_degrade[i] = false ; ptr->hbs_failure[i] = false ; ptr->max_count[i] = 0 ; ptr->hbs_count[i] = 0 ; ptr->hbs_minor_count[i] = 0 ; ptr->hbs_misses_count[i] = 0 ; ptr->b2b_misses_count[i] = 0 ; ptr->b2b_pulses_count[i] = 0 ; ptr->hbs_degrade_count[i] = 0 ; ptr->hbs_failure_count[i] = 0 ; ptr->heartbeat_failed[i] = false; } ptr->health = NODE_HEALTH_UNKNOWN ; ptr->pmon_missing_count = 0; ptr->pmon_degraded = false ; /* now add it to the node list ; dealing with all conditions */ /* if the node list is empty add it to the head */ if( head == NULL ) { head = ptr ; tail = ptr ; ptr->prev = NULL ; ptr->next = NULL ; } else { /* link in the new_node to the tail of the node_list * then mark the next field as the end of the node_list * adjust tail to point to the last node */ tail->next = ptr ; ptr->prev = tail ; ptr->next = NULL ; tail = ptr ; } /* start with no action and an empty todo list */ ptr->adminAction = MTC_ADMIN_ACTION__NONE ; ptr->adminAction_todo_list.clear(); hosts++ ; /* (re)build the Resource Reference Array */ if ( heartbeat ) build_rra (); return ptr ; } struct nodeLinkClass::node* nodeLinkClass::getNode ( string hostname ) { /* check for empty list condition */ if ( head == NULL ) return NULL ; if ( hostname.empty() ) return static_cast<struct node *>(NULL); for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( !hostname.compare ( ptr->hostname )) { return ptr ; } /* Node can be looked up by ip addr too */ if ( !hostname.compare ( ptr->ip )) { return ptr ; } /* Node can be looked up by infra_ip addr too */ if ( !hostname.compare ( ptr->infra_ip )) { return ptr ; } /* Node can be looked up by uuid too */ if ( !hostname.compare ( ptr->uuid )) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node* nodeLinkClass::getEventBaseNode ( libEvent_enum request, struct event_base * base_ptr) { struct node * ptr = static_cast<struct node *>(NULL) ; /* check for empty list condition */ if ( head == NULL ) return NULL ; if ( base_ptr == NULL ) return NULL ; for ( ptr = head ; ; ptr = ptr->next ) { switch ( request ) { case SYSINV_HOST_QUERY: { if ( ptr->sysinvEvent.base == base_ptr ) { hlog1 ("%s Found Sysinv Event Base Pointer (%p)\n", ptr->hostname.c_str(), ptr->sysinvEvent.base); return ptr ; } } case VIM_HOST_DISABLED: case VIM_HOST_ENABLED: case VIM_HOST_OFFLINE: case VIM_HOST_FAILED: { if ( ptr->vimEvent.base == base_ptr ) { hlog1 ("%s Found vimEvent Base Pointer (%p) \n", ptr->hostname.c_str(), ptr->vimEvent.base); return ptr ; } } default: ; } /* End Switch */ if (( ptr->next == NULL ) || ( ptr == tail )) break ; } wlog ("%s Event Base Pointer (%p) - Not Found\n", ptr->hostname.c_str(), base_ptr); return static_cast<struct node *>(NULL); } /* Find the node in the list of nodes being heartbeated and splice it out */ int nodeLinkClass::remNode( string hostname ) { int rc = -ENODEV ; if ( hostname.c_str() == NULL ) return -EFAULT ; if ( head == NULL ) return -ENXIO ; struct node * ptr = getNode ( hostname ); if ( ptr == NULL ) return -EFAULT ; mtcTimer_fini ( ptr->mtcTimer ); mtcTimer_fini ( ptr->mtcSwact_timer ); mtcTimer_fini ( ptr->mtcAlive_timer ); mtcTimer_fini ( ptr->offline_timer ); mtcTimer_fini ( ptr->mtcCmd_timer ); mtcTimer_fini ( ptr->http_timer ); mtcTimer_fini ( ptr->insvTestTimer ); mtcTimer_fini ( ptr->oosTestTimer ); mtcTimer_fini ( ptr->mtcConfig_timer ); mtcTimer_fini ( ptr->host_services_timer ); mtcTimer_fini ( ptr->hwmon_powercycle.control_timer ); mtcTimer_fini ( ptr->hwmon_powercycle.recovery_timer ); mtcTimer_fini ( ptr->hwmon_reset.control_timer ); mtcTimer_fini ( ptr->hwmon_reset.recovery_timer ); mtcTimer_fini ( ptr->bm_timer ); mtcTimer_fini ( ptr->bmc_access_timer ); mtcTimer_fini ( ptr->bm_ping_info.timer ); #ifdef WANT_PULSE_LIST_SEARCH_ON_DELETE /* Splice the node out of the pulse monitor list */ for ( int i = 0 ; i < MAX_IFACES ; i++ ) { /* Does the pulse monitor list exist ? */ if ( pulse_list[i].head_ptr != NULL ) { pulse_ptr = ptr ; if ( pulse_list[i].head_ptr == pulse_ptr ) { if ( pulse_list[i].head_ptr == pulse_list[i].tail_ptr ) { pulse_list[i].head_ptr = NULL ; pulse_list[i].tail_ptr = NULL ; dlog ("Pulse: Single Node -> Head Case\n"); } else { dlog ("Pulse: Multiple Nodes -> Head Case\n"); pulse_list[i].head_ptr = pulse_list[i].head_ptr->pulse_link[i].next_ptr ; pulse_list[i].head_ptr->pulse_link[i].prev_ptr = NULL ; } } else if ( pulse_list[i].tail_ptr == pulse_ptr ) { dlog ("Pulse: Multiple Node -> Tail Case\n"); pulse_list[i].tail_ptr = pulse_list[i].tail_ptr->pulse_link[i].prev_ptr ; pulse_list[i].tail_ptr->pulse_link[i].next_ptr = NULL ; } else { dlog ("Pulse: Multiple Node -> Full Splice Out\n"); pulse_ptr->pulse_link[i].prev_ptr->pulse_link[i].next_ptr = pulse_ptr->pulse_link[i].next_ptr ; pulse_ptr->pulse_link[i].next_ptr->pulse_link[i].prev_ptr = pulse_ptr->pulse_link[i].prev_ptr ; } } } #endif /* If the node is the head node */ if ( ptr == head ) { /* only one node in the list case */ if ( head == tail ) { dlog ("Single Node -> Head Case\n"); head = NULL ; tail = NULL ; delNode ( ptr ); rc = PASS ; } else { dlog ("Multiple Nodes -> Head Case\n"); head = head->next ; head->prev = NULL ; delNode ( ptr ); rc = PASS ; } } /* if not head but tail then there must be more than one * node in the list so go ahead and chop the tail. */ else if ( ptr == tail ) { dlog ("Multiple Node -> Tail Case\n"); tail = tail->prev ; tail->next = NULL ; delNode ( ptr ); rc = PASS ; } else { dlog ("Multiple Node -> Full Splice Out\n"); ptr->prev->next = ptr->next ; ptr->next->prev = ptr->prev ; delNode( ptr ); rc = PASS ; } hosts-- ; /* (re)build the Resource Reference Array */ if ( heartbeat ) build_rra (); return rc ; } /** * Node state set'ers and get'ers */ mtc_nodeAdminAction_enum nodeLinkClass::get_adminAction ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) return ( node_ptr->adminAction ); elog ("Failed getting 'admin action' for '%s'\n", hostname.c_str()); return (MTC_ADMIN_ACTION__NONE); } int nodeLinkClass::set_adminAction ( string & hostname, mtc_nodeAdminAction_enum adminAction ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) { adminActionChange ( node_ptr, adminAction ) ; return (PASS) ; } elog ("Failed setting 'admin action' for '%s'\n", hostname.c_str()); return (FAIL) ; } mtc_nodeAdminState_enum nodeLinkClass::get_adminState ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) return ( node_ptr->adminState ); elog ("Failed getting 'admin state' state for '%s'\n", hostname.c_str()); return (MTC_ADMIN_STATE__LOCKED); } int nodeLinkClass::set_adminState ( string & hostname, mtc_nodeAdminState_enum adminState ) { int rc = FAIL ; nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) { rc = nodeLinkClass::adminStateChange ( node_ptr , adminState ); } if ( rc ) { elog ("Failed setting 'admin state' for '%s'\n", hostname.c_str()); } return (rc) ; } mtc_nodeOperState_enum nodeLinkClass::get_operState ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) return ( node_ptr->operState ); elog ("Failed getting 'operational state' for '%s'\n", hostname.c_str()); return (MTC_OPER_STATE__DISABLED); } int nodeLinkClass::set_operState ( string & hostname, mtc_nodeOperState_enum operState ) { int rc = FAIL ; nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) { rc = nodeLinkClass::operStateChange ( node_ptr , operState ); } if ( rc ) { elog ("Failed setting 'operational state' for '%s'\n", hostname.c_str()); } return (rc) ; } mtc_nodeAvailStatus_enum nodeLinkClass::get_availStatus ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) return ( node_ptr->availStatus ); elog ("Failed getting 'availability status' for '%s'\n", hostname.c_str()); return (MTC_AVAIL_STATUS__OFFDUTY); } int nodeLinkClass::set_availStatus ( string & hostname, mtc_nodeAvailStatus_enum availStatus ) { int rc = FAIL ; nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { rc = nodeLinkClass::availStatusChange ( node_ptr , availStatus ); } if ( rc ) { elog ("Failed setting 'availability status' for '%s'\n", hostname.c_str()); } return (FAIL) ; } /** Return a string representing the data port operational state * according to the X.731 standard */ string nodeLinkClass::get_operState_dport ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) { return ( operState_enum_to_str(node_ptr->operState_dport)); } elog ("%s failed getting 'operState_dport'\n", hostname.c_str()); return (""); } /** Return a string representing the data port availability status * according to the X.731 standard */ string nodeLinkClass::get_availStatus_dport ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr ) { return ( availStatus_enum_to_str(node_ptr->availStatus_dport)); } elog ("%s failed getting 'availStatus_dport'\n", hostname.c_str()); return (""); } void nodeLinkClass::print_node_info ( nodeLinkClass::node * ptr ) { ilog ("%17s (%15s) %8s %8s-%-9s | %s-%s-%s | %s | %0X", ptr->hostname.c_str(), ptr->ip.c_str(), mtc_nodeAdminState_str[ptr->adminState], mtc_nodeOperState_str[ptr->operState], mtc_nodeAvailStatus_str[ptr->availStatus], ptr->subfunction_str.c_str(), mtc_nodeOperState_str[ptr->operState_subf], mtc_nodeAvailStatus_str[ptr->availStatus_subf], mtc_nodeAdminAction_str [ptr->adminAction], ptr->degrade_mask); } void nodeLinkClass::print_node_info ( void ) { if ( maintenance ) { syslog ( LOG_INFO,"+--------------------------------------+-------------------+-----------------+\n"); for ( struct node * ptr = head ; ptr != NULL ; ptr = ptr->next ) { if ( LARGE_SYSTEM ) { syslog ( LOG_INFO, "| %36s | %17s | %15s | %8s %8s-%s", ptr->uuid.length() ? ptr->uuid.c_str() : "", ptr->hostname.c_str(), ptr->ip.c_str(), mtc_nodeAdminState_str[ptr->adminState], mtc_nodeOperState_str[ptr->operState], mtc_nodeAvailStatus_str[ptr->availStatus]); } else { syslog ( LOG_INFO, "| %36s | %17s | %15s | %8s %8s-%-9s | %s-%s-%s", ptr->uuid.length() ? ptr->uuid.c_str() : "", ptr->hostname.c_str(), ptr->ip.c_str(), mtc_nodeAdminState_str[ptr->adminState], mtc_nodeOperState_str[ptr->operState], mtc_nodeAvailStatus_str[ptr->availStatus], ptr->subfunction_str.c_str(), mtc_nodeOperState_str[ptr->operState_subf], mtc_nodeAvailStatus_str[ptr->availStatus_subf]); } // syslog ( LOG_INFO, "\n"); } syslog ( LOG_INFO, "+--------------------------------------+-------------------+-----------------+\n\n"); } if ( heartbeat ) { for ( int i = 0 ; i < MAX_IFACES ; i++ ) { if (( i == INFRA_IFACE ) && ( infra_network_provisioned == false )) continue ; syslog ( LOG_INFO, "+--------------+-----+-------+-------+-------+-------+------------+----------+-----------------+\n"); syslog ( LOG_INFO, "| %s: %3d | Mon | Mis | Max | Deg | Fail | Pulses Tot | Pulses | %s (%4d) |\n" , get_iface_name_str ((iface_enum)i), hosts, hbs_disabled ? "DISABLED" : "Enabled ", hbs_pulse_period ); syslog ( LOG_INFO, "+--------------+-----+-------+-------+-------+-------+------------+----------+-----------------+\n"); for ( struct node * ptr = head ; ptr != NULL ; ptr = ptr->next ) { syslog ( LOG_INFO, "| %-12s | %c | %5i | %5i | %5i | %5i | %10x | %8x | %d msec\n", ptr->hostname.c_str(), ptr->monitor[i] ? 'Y' : 'n', ptr->hbs_misses_count[i], ptr->max_count[i], ptr->hbs_degrade_count[i], ptr->hbs_failure_count[i], ptr->hbs_count[i], ptr->b2b_pulses_count[i], hbs_pulse_period ); } } syslog ( LOG_INFO, "+--------------+-----+-------+-------+-------+-------+------------+----------+-----------------+\n"); } } /** Convert the supplied string to a valid maintenance Admin State enum */ mtc_nodeAdminState_enum nodeLinkClass::adminState_str_to_enum ( const char * admin_ptr ) { /* Default state */ mtc_nodeAdminState_enum temp = MTC_ADMIN_STATE__LOCKED; if ( admin_ptr == NULL ) { wlog ("Administrative state is Null\n"); } else if ( !strcmp ( &mtc_nodeAdminState_str[MTC_ADMIN_STATE__UNLOCKED][0], admin_ptr )) temp = MTC_ADMIN_STATE__UNLOCKED ; return (temp) ; } /** Convert the supplied string to a valid maintenance Oper State enum */ mtc_nodeOperState_enum nodeLinkClass::operState_str_to_enum ( const char * oper_ptr ) { /* Default state */ mtc_nodeOperState_enum temp = MTC_OPER_STATE__DISABLED; if ( oper_ptr == NULL ) { wlog ("Operation state is Null\n"); } else if ( !strcmp ( &mtc_nodeOperState_str[MTC_ADMIN_STATE__UNLOCKED][0], oper_ptr )) temp = MTC_OPER_STATE__ENABLED ; return (temp) ; } /** Convert the supplied string to a valid maintenance Avail Status enum */ mtc_nodeAvailStatus_enum nodeLinkClass::availStatus_str_to_enum ( const char * avail_ptr ) { /* Default state */ mtc_nodeAvailStatus_enum temp = MTC_AVAIL_STATUS__OFFDUTY; /* Could do this as a loop but this is more resiliant to enum changes */ /* TODO: consider using a paired list */ if ( avail_ptr == NULL ) { wlog ("Availability status is Null\n"); } else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__AVAILABLE][0], avail_ptr )) temp = MTC_AVAIL_STATUS__AVAILABLE ; else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__FAILED][0], avail_ptr )) temp = MTC_AVAIL_STATUS__FAILED ; else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__INTEST][0], avail_ptr )) temp = MTC_AVAIL_STATUS__INTEST ; else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__DEGRADED][0], avail_ptr )) temp = MTC_AVAIL_STATUS__DEGRADED ; else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__OFFLINE][0], avail_ptr )) temp = MTC_AVAIL_STATUS__OFFLINE ; else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__ONLINE][0], avail_ptr )) temp = MTC_AVAIL_STATUS__ONLINE ; else if ( !strcmp ( &mtc_nodeAvailStatus_str[MTC_AVAIL_STATUS__POWERED_OFF][0], avail_ptr )) temp = MTC_AVAIL_STATUS__POWERED_OFF ; return (temp) ; } /** Convert the supplied enum to the corresponding Admin State string */ string nodeLinkClass::adminAction_enum_to_str ( mtc_nodeAdminAction_enum val ) { if ( val < MTC_ADMIN_ACTIONS ) { string adminAction_string = &mtc_nodeAdminAction_str[val][0] ; return ( adminAction_string ); } return ( NULL ); } /** Convert the supplied enum to the corresponding Admin State string */ string nodeLinkClass::adminState_enum_to_str ( mtc_nodeAdminState_enum val ) { if ( val < MTC_ADMIN_STATES ) { string adminState_string = &mtc_nodeAdminState_str[val][0] ; return ( adminState_string ); } return ( NULL ); } /** Convert the supplied enum to the corresponding Oper State string */ string nodeLinkClass::operState_enum_to_str ( mtc_nodeOperState_enum val ) { if ( val < MTC_OPER_STATES ) { string operState_string = &mtc_nodeOperState_str[val][0] ; return ( operState_string ); } return ( NULL ); } /** Convert the supplied enum to the corresponding Avail Status string */ string nodeLinkClass::availStatus_enum_to_str ( mtc_nodeAvailStatus_enum val ) { if ( val < MTC_AVAIL_STATUS ) { string availStatus_string = &mtc_nodeAvailStatus_str[val][0] ; return ( availStatus_string ); } return ( NULL ); } void nodeLinkClass::host_print ( struct nodeLinkClass::node * node_ptr ) { string uuid ; if ( daemon_get_cfg_ptr()->debug_level == 1 ) { const char bar [] = { "+-------------+--------------------------------------+" }; const char uar [] = { "+- Add Host -+--------------------------------------+" }; syslog ( LOG_INFO, "%s\n", &uar[0]); syslog ( LOG_INFO, "| uuid : %s\n", node_ptr->uuid.c_str()); syslog ( LOG_INFO, "| main : %s\n", node_ptr->function_str.c_str()); syslog ( LOG_INFO, "| subf : %s\n", node_ptr->subfunction_str.c_str()); syslog ( LOG_INFO, "| name : %s\n", node_ptr->hostname.c_str()); syslog ( LOG_INFO, "| ip : %s\n", node_ptr->ip.c_str()); syslog ( LOG_INFO, "| admin : %s\n", adminState_enum_to_str (node_ptr->adminState).c_str()); syslog ( LOG_INFO, "| oper : %s\n", operState_enum_to_str (node_ptr->operState).c_str()); syslog ( LOG_INFO, "| avail_subf: %s\n", availStatus_enum_to_str (node_ptr->availStatus_subf).c_str()); syslog ( LOG_INFO, "| oper_subf: %s\n", operState_enum_to_str (node_ptr->operState_subf).c_str()); syslog ( LOG_INFO, "%s\n", &bar[0]); } /* ec3624cb-d80f-4e8b-a6d7-0c11f6937f6a */ /* Just print the last 4 chars of the uuid */ if ( node_ptr->uuid.empty() ) uuid = "---" ; else uuid = node_ptr->uuid.substr(32) ; if ( node_ptr->availStatus == MTC_AVAIL_STATUS__AVAILABLE ) { ilog ("%s '%s' %s %s-%s (%s)\n", node_ptr->hostname.c_str(), functions.c_str(), node_ptr->ip.c_str(), adminState_enum_to_str (node_ptr->adminState).c_str(), operState_enum_to_str (node_ptr->operState).c_str(), uuid.c_str()); } else { ilog ("%s '%s' %s %s-%s-%s (%s)\n",node_ptr->hostname.c_str(), functions.c_str(), node_ptr->ip.c_str(), adminState_enum_to_str (node_ptr->adminState).c_str(), operState_enum_to_str (node_ptr->operState).c_str(), availStatus_enum_to_str(node_ptr->availStatus).c_str(), uuid.c_str()); } } /** Host Administrative State Change public member function */ int nodeLinkClass::admin_state_change ( string hostname, string newAdminState ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( hostname ); if ( node_ptr ) { if ( newAdminState.empty() ) { rc = FAIL_STRING_EMPTY ; } else if ( adminState_str_to_enum ( newAdminState.data() ) == node_ptr->adminState ) { rc = PASS ; } else if ( adminStateOk ( newAdminState ) ) { clog ("%s %s (from %s)\n", hostname.c_str(), newAdminState.c_str(), adminState_enum_to_str (node_ptr->adminState).c_str()); node_ptr->adminState = adminState_str_to_enum ( newAdminState.data() ); rc = PASS ; } else { elog ("%s Invalid 'admin' state (%s)\n", hostname.c_str(), newAdminState.c_str() ); } } else { wlog ("Cannot change 'admin' state for unknown hostname (%s)\n", hostname.c_str()); } return (rc); } /** Host Operational State Change public member function */ int nodeLinkClass::oper_state_change ( string hostname, string newOperState ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( hostname ); if ( node_ptr ) { if ( newOperState.empty() ) { rc = FAIL_STRING_EMPTY ; } else if ( operState_str_to_enum ( newOperState.data() ) == node_ptr->operState ) { rc = PASS ; } else if ( operStateOk ( newOperState ) ) { mtc_nodeOperState_enum oper = operState_str_to_enum ( newOperState.data() ); if (( node_ptr->operState == MTC_OPER_STATE__DISABLED ) && ( oper == MTC_OPER_STATE__ENABLED )) { mtcAlarm_log ( hostname, MTC_LOG_ID__STATUSCHANGE_ENABLED ); } if (( node_ptr->operState == MTC_OPER_STATE__ENABLED ) && ( oper == MTC_OPER_STATE__DISABLED )) { mtcAlarm_log ( hostname, MTC_LOG_ID__STATUSCHANGE_DISABLED ); } clog ("%s %s (from %s)\n", hostname.c_str(), newOperState.c_str(), operState_enum_to_str (node_ptr->operState).c_str()); node_ptr->operState = oper ; rc = PASS ; } else { elog ("%s Invalid 'oper' state (%s)\n", hostname.c_str(), newOperState.c_str() ); } } else { wlog ("Cannot change 'oper' state for unknown hostname (%s)\n", hostname.c_str() ); } return (rc); } /** Host Availability Status Change public member function */ int nodeLinkClass::avail_status_change ( string hostname, string newAvailStatus ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( hostname ); if ( node_ptr ) { if ( newAvailStatus.empty() ) { rc = FAIL_STRING_EMPTY ; } else if ( availStatus_str_to_enum ( newAvailStatus.data() ) == node_ptr->availStatus ) { rc = PASS ; } else if ( availStatusOk ( newAvailStatus )) { mtc_nodeAvailStatus_enum avail = availStatus_str_to_enum ( newAvailStatus.data() ); /* if we go to the failed state then clear all mtcAlive counts * so that the last ones don't look like we are online when we * might not be - we should relearn the on/off line state */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__FAILED ) && ( avail == MTC_AVAIL_STATUS__FAILED )) { node_ptr->mtcAlive_misses = 0 ; node_ptr->mtcAlive_hits = 0 ; node_ptr->mtcAlive_gate = false ; } /* check for need to generate power on log */ if (( node_ptr->availStatus == MTC_AVAIL_STATUS__POWERED_OFF ) && ( avail != MTC_AVAIL_STATUS__POWERED_OFF )) { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__POWERON ) { mtcAlarm_log ( hostname, MTC_LOG_ID__COMMAND_MANUAL_POWER_ON ); } else { mtcAlarm_log ( hostname, MTC_LOG_ID__COMMAND_AUTO_POWER_ON ); } } /* check for need to generate power off log */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__POWERED_OFF ) && ( avail == MTC_AVAIL_STATUS__POWERED_OFF )) { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__POWEROFF ) { mtcAlarm_log ( hostname, MTC_LOG_ID__COMMAND_MANUAL_POWER_OFF ); } else { mtcAlarm_log ( hostname, MTC_LOG_ID__COMMAND_AUTO_POWER_OFF ); } } /* check for need to generate online log */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__ONLINE ) && ( avail == MTC_AVAIL_STATUS__ONLINE )) { if ( node_ptr->offline_log_reported == true ) { mtcAlarm_log ( hostname, MTC_LOG_ID__STATUSCHANGE_ONLINE ); node_ptr->offline_log_reported = false ; node_ptr->online_log_reported = true ; } } /* check for need to generate offline log */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__OFFLINE ) && ( avail == MTC_AVAIL_STATUS__OFFLINE )) { if ( node_ptr->online_log_reported == true ) { mtcAlarm_log ( hostname, MTC_LOG_ID__STATUSCHANGE_OFFLINE ); node_ptr->offline_log_reported = true ; node_ptr->online_log_reported = false ; } } /* If the availability status is moving away from off or online then * be sure we cancel the mtcAlive timer */ if ((( node_ptr->availStatus == MTC_AVAIL_STATUS__OFFLINE ) || ( node_ptr->availStatus == MTC_AVAIL_STATUS__ONLINE )) && (( avail != MTC_AVAIL_STATUS__OFFLINE ) && ( avail != MTC_AVAIL_STATUS__ONLINE ))) { /* Free the mtc timer if in use */ if ( node_ptr->mtcAlive_timer.tid ) { tlog ("%s Stopping mtcAlive timer\n", node_ptr->hostname.c_str()); mtcTimer_stop ( node_ptr->mtcAlive_timer ); node_ptr->mtcAlive_timer.ring = false ; node_ptr->mtcAlive_timer.tid = NULL ; } node_ptr->onlineStage = MTC_ONLINE__START ; } clog ("%s %s (from %s)\n", hostname.c_str(), newAvailStatus.c_str(), availStatus_enum_to_str (node_ptr->availStatus).c_str()); node_ptr->availStatus = avail ; rc = PASS ; } else { elog ("%s Invalid 'avail' status (%s)\n", hostname.c_str(), newAvailStatus.c_str() ); } } else { wlog ("Cannot change 'avail' status for unknown hostname (%s)\n", hostname.c_str()); } return (rc); } /** Set host to the disabled failed state and generate the disabled-failed customer log * This interface allows the disabled-failed state change to be combined so as to avoid * setting a 'disabled' AND 'disabled-failed' customer log for the failure case */ int nodeLinkClass::failed_state_change ( struct nodeLinkClass::node * node_ptr ) { int rc = FAIL_NULL_POINTER ; if ( node_ptr ) { node_ptr->availStatus = MTC_AVAIL_STATUS__FAILED ; node_ptr->operState = MTC_OPER_STATE__DISABLED ; mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__STATUSCHANGE_FAILED ); rc = PASS ; } else { slog ("Cannot change to disabled-failed state for null node pointer\n"); } return (rc); } /***************************************************************************** * * Name : lazy_graceful_fs_reboot * * Description: Issue a lazy reboot and signal SM to shutdown services * * Assumptions: No return * *****************************************************************************/ int nodeLinkClass::lazy_graceful_fs_reboot ( struct nodeLinkClass::node * node_ptr ) { /* issue a lazy reboot to the mtcClient and as a backup launch a sysreq reset thresd */ send_mtc_cmd ( node_ptr->hostname, MTC_CMD_LAZY_REBOOT, MGMNT_INTERFACE ) ; fork_sysreq_reboot ( daemon_get_cfg_ptr()->failsafe_shutdown_delay ); /* loop until reboot */ for ( ; ; ) { for ( int i = 0 ; i < LAZY_REBOOT_RETRY_DELAY_SECS ; i++ ) { daemon_signal_hdlr (); sleep (MTC_SECS_1); /* give sysinv time to handle the response and get its state in order */ if ( i == SM_NOTIFY_UNHEALTHY_DELAY_SECS ) { daemon_log ( SMGMT_UNHEALTHY_FILE, "AIO shutdown request" ); } } /* Should never get there but if we do resend the reboot request * but this time not Lazy */ send_mtc_cmd ( node_ptr->hostname, MTC_CMD_REBOOT, MGMNT_INTERFACE ) ; } return (FAIL); } /* Generate a log and a critical alarm if the node config failed */ int nodeLinkClass::alarm_config_failure ( struct nodeLinkClass::node * node_ptr ) { if ( (node_ptr->degrade_mask & DEGRADE_MASK_CONFIG) == 0 ) { node_ptr->degrade_mask |= DEGRADE_MASK_CONFIG ; } if ( node_ptr->alarms[MTC_ALARM_ID__CONFIG] != FM_ALARM_SEVERITY_CRITICAL ) { elog ("%s critical config failure\n", node_ptr->hostname.c_str()); mtcAlarm_critical ( node_ptr->hostname, MTC_ALARM_ID__CONFIG ); node_ptr->alarms[MTC_ALARM_ID__CONFIG] = FM_ALARM_SEVERITY_CRITICAL ; } return (PASS); } /* Clear the config alarm and degrade flag */ int nodeLinkClass::alarm_config_clear ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr->degrade_mask & DEGRADE_MASK_CONFIG ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_CONFIG ; } if ( node_ptr->alarms[MTC_ALARM_ID__CONFIG] != FM_ALARM_SEVERITY_CLEAR ) { ilog ("%s config alarm clear\n", node_ptr->hostname.c_str()); mtcAlarm_clear ( node_ptr->hostname, MTC_ALARM_ID__CONFIG ); node_ptr->alarms[MTC_ALARM_ID__CONFIG] = FM_ALARM_SEVERITY_CLEAR ; } return (PASS); } /* Generate a log and a critical alarm if the node enable failed */ int nodeLinkClass::alarm_enabled_failure ( struct nodeLinkClass::node * node_ptr, bool want_degrade ) { if ( want_degrade ) { if ( (node_ptr->degrade_mask & DEGRADE_MASK_ENABLE) == 0 ) { node_ptr->degrade_mask |= DEGRADE_MASK_ENABLE ; } } if ( node_ptr->alarms[MTC_ALARM_ID__ENABLE] != FM_ALARM_SEVERITY_CRITICAL ) { elog ("%s critical enable failure\n", node_ptr->hostname.c_str()); mtcAlarm_critical ( node_ptr->hostname, MTC_ALARM_ID__ENABLE ); node_ptr->alarms[MTC_ALARM_ID__ENABLE] = FM_ALARM_SEVERITY_CRITICAL ; } return (PASS); } /* * Generate a major (in-service) enable alarm * - don't downgrade the alarm from critical * - do nothing if the alarm is already at major level * **/ int nodeLinkClass::alarm_insv_failure ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr ) { if ( node_ptr->alarms[MTC_ALARM_ID__ENABLE] != FM_ALARM_SEVERITY_MAJOR ) { if ( node_ptr->alarms[MTC_ALARM_ID__ENABLE] != FM_ALARM_SEVERITY_CRITICAL ) { elog ("%s major inservice enable failure\n", node_ptr->hostname.c_str()); node_ptr->degrade_mask |= DEGRADE_MASK_INSV_TEST ; mtcAlarm_major ( node_ptr->hostname, MTC_ALARM_ID__ENABLE ); node_ptr->alarms[MTC_ALARM_ID__ENABLE] = FM_ALARM_SEVERITY_MAJOR ; } } } return (PASS); } /* Clear the enable alarm and degrade flag */ int nodeLinkClass::alarm_enabled_clear ( struct nodeLinkClass::node * node_ptr, bool force ) { if ( node_ptr->degrade_mask & DEGRADE_MASK_ENABLE ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_ENABLE ; } /* The inservice test degrade flag needs to be cleared too. */ if ( node_ptr->degrade_mask & DEGRADE_MASK_INSV_TEST ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_INSV_TEST ; } if (( node_ptr->alarms[MTC_ALARM_ID__ENABLE] != FM_ALARM_SEVERITY_CLEAR ) || ( force == true )) { ilog ("%s enable alarm clear\n", node_ptr->hostname.c_str()); mtcAlarm_clear ( node_ptr->hostname, MTC_ALARM_ID__ENABLE ); node_ptr->alarms[MTC_ALARM_ID__ENABLE] = FM_ALARM_SEVERITY_CLEAR ; } return (PASS); } /* Generate worker subfunction failure alarm */ int nodeLinkClass::alarm_compute_failure ( struct nodeLinkClass::node * node_ptr, EFmAlarmSeverityT sev ) { if ( (node_ptr->degrade_mask & DEGRADE_MASK_SUBF) == 0 ) { node_ptr->degrade_mask |= DEGRADE_MASK_SUBF ; } if ( node_ptr->alarms[MTC_ALARM_ID__CH_COMP] != sev ) { if ( sev == FM_ALARM_SEVERITY_CRITICAL ) { elog ("%s critical worker subf failure\n", node_ptr->hostname.c_str()); mtcAlarm_critical ( node_ptr->hostname, MTC_ALARM_ID__CH_COMP ); } else { elog ("%s major worker subf failure\n", node_ptr->hostname.c_str()); mtcAlarm_major ( node_ptr->hostname, MTC_ALARM_ID__CH_COMP ); } node_ptr->alarms[MTC_ALARM_ID__CH_COMP] = sev ; } return (PASS); } /* Clear the enable alarm if is at the Major severity level */ int nodeLinkClass::alarm_insv_clear ( struct nodeLinkClass::node * node_ptr, bool force ) { if ( node_ptr->degrade_mask & DEGRADE_MASK_INSV_TEST ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_INSV_TEST ; } if (( node_ptr->alarms[MTC_ALARM_ID__ENABLE] == FM_ALARM_SEVERITY_MAJOR ) || ( force == true )) { ilog ("%s %s enable alarm clear\n", node_ptr->hostname.c_str(), force ? "force" : "major" ); mtcAlarm_clear ( node_ptr->hostname, MTC_ALARM_ID__ENABLE ); node_ptr->alarms[MTC_ALARM_ID__ENABLE] = FM_ALARM_SEVERITY_CLEAR ; } if ( node_ptr->alarms[MTC_ALARM_ID__ENABLE] == FM_ALARM_SEVERITY_CLEAR ) { if ( node_ptr->degrade_mask & DEGRADE_MASK_ENABLE ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_ENABLE ; } } return (PASS); } /* Clear the worker subfunction alarm and degrade flag */ int nodeLinkClass::alarm_compute_clear ( struct nodeLinkClass::node * node_ptr, bool force ) { if ( node_ptr->degrade_mask & DEGRADE_MASK_SUBF ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_SUBF ; } if (( node_ptr->alarms[MTC_ALARM_ID__CH_COMP] != FM_ALARM_SEVERITY_CLEAR ) || ( force == true )) { ilog ("%s major enable alarm clear\n", node_ptr->hostname.c_str()); mtcAlarm_clear ( node_ptr->hostname, MTC_ALARM_ID__CH_COMP ); node_ptr->alarms[MTC_ALARM_ID__CH_COMP] = FM_ALARM_SEVERITY_CLEAR ; } return (PASS); } /** Host Operational State Change public member function */ int nodeLinkClass::oper_subf_state_change ( string hostname, string newOperState ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( hostname ); if ( node_ptr ) { if ( newOperState.empty() ) { rc = FAIL_STRING_EMPTY ; } else if ( operStateOk ( newOperState ) ) { node_ptr->operState_subf = operState_str_to_enum ( newOperState.data() ); rc = PASS ; } else { elog ("%s Invalid subfunction 'oper' state (%s)\n", hostname.c_str(), newOperState.c_str() ); } } else { wlog ("Cannot change subfuction 'oper' state for unknown hostname (%s)\n", hostname.c_str() ); } return (rc); } /** Host Subfunction Availability Status Change public member function */ int nodeLinkClass::avail_subf_status_change ( string hostname, string newAvailStatus ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( hostname ); if ( node_ptr ) { if ( newAvailStatus.empty() ) { rc = FAIL_STRING_EMPTY ; } else if ( availStatusOk ( newAvailStatus ) ) { node_ptr->availStatus_subf = availStatus_str_to_enum ( newAvailStatus.data() ); rc = PASS ; } else { elog ("%s Invalid subfunction 'avail' status (%s)\n", hostname.c_str(), newAvailStatus.c_str() ); } } else { wlog ("Cannot change subfunction 'avail' status for unknown hostname (%s)\n", hostname.c_str()); } return (rc); } /** Update the mtce key with value */ int nodeLinkClass::update_key_value ( string hostname, string key , string value ) { int rc = PASS ; struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( hostname ); if ( node_ptr ) { /* TODO: Add all database members to this utility */ if ( !key.compare(MTC_JSON_INV_BMIP) ) node_ptr->bm_ip = value ; else if ( !key.compare(MTC_JSON_INV_TASK) ) node_ptr->task = value ; else { wlog ("%s Unsupported key '%s' update with value '%s'\n", hostname.c_str(), key.c_str(), value.c_str()); rc = FAIL_BAD_PARM ; } } else { wlog ("Cannot change 'admin' state for unknown hostname (%s)\n", hostname.c_str()); } return (rc); } int nodeLinkClass::del_host ( const string uuid ) { string hostname = "unknown" ; int rc = FAIL_DEL_UNKNOWN ; nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( uuid ); if ( node_ptr ) { hostname = node_ptr->hostname ; if ( node_ptr->mtcTimer.tid ) mtcTimer_stop ( node_ptr->mtcTimer ); if ( nodeLinkClass::maintenance == true ) { if ( node_ptr->bm_provisioned == true ) { set_bm_prov ( node_ptr, false); } doneQueue_purge ( node_ptr ); workQueue_purge ( node_ptr ); mtcCmd_doneQ_purge ( node_ptr ); mtcCmd_workQ_purge ( node_ptr ); /* Cleanup if this is the inactive controller */ if ( !node_ptr->hostname.compare(inactive_controller_hostname)) { inactive_controller_hostname = "" ; } } rc = rem_host ( hostname ); if ( rc == PASS ) { plog ("%s Deleted\n", hostname.c_str()); print_node_info(); } else { elog ("%s Delete Failed (rc:%d)\n", hostname.c_str(), rc ); } this->host_deleted = true ; } else { wlog ("Unknown uuid: %s\n", uuid.c_str()); } return (rc); } int nodeLinkClass::set_host_failed ( node_inv_type & inv ) { struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( inv.name ); if(NULL == node_ptr) { return FAIL_UNKNOWN_HOSTNAME; } if( (node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED) && (node_ptr->operState == MTC_OPER_STATE__ENABLED) ) { elog( "%s is being force failed by SM", inv.name.c_str() ); this->force_full_enable (node_ptr); } return PASS; } int nodeLinkClass::mod_host ( node_inv_type & inv ) { int rc = PASS ; bool modify = false ; bool modify_bm = false ; print_inv (inv); struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode( inv.uuid ); if ( node_ptr ) { dlog ("%s Modify\n", node_ptr->hostname.c_str()); #ifdef WANT_FIT_TESTING if ( daemon_want_fit ( FIT_CODE__TRANSLATE_LOCK_TO_FORCELOCK , node_ptr->hostname ) ) { if ( inv.action.compare("lock") == 0 ) { slog ("%s FIT action from 'lock' to 'force-lock'\n", node_ptr->hostname.c_str()); inv.action = "force-lock"; } } #endif /* Handle Administrative state mismatch between SYSINV and Maintenance */ if ( strcmp ( mtc_nodeAdminState_str[node_ptr->adminState], inv.admin.data())) { plog ("%s Modify 'Administrative' state %s -> %sed\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str[node_ptr->adminState], inv.action.c_str()); modify = true ; /* we have a delta */ /* Local admin state takes precedence */ if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { /* handle a lock request while unlocked */ if ( !inv.action.compare ( "lock" ) ) { if ( node_ptr->dor_recovery_mode == true ) node_ptr->dor_recovery_mode = false ; /* Set action to LOCK and let the FSM run the disable handler */ adminActionChange ( node_ptr , MTC_ADMIN_ACTION__LOCK ); } else { ilog ("%s Already Unlocked ; no action required\n", node_ptr->hostname.c_str() ); } } else { if ( node_ptr->patching == true ) { wlog ("%s cannot unlock host while patching is in progress\n", node_ptr->hostname.c_str()); rc = FAIL_PATCH_INPROGRESS ; } else { /* generate command=unlock log */ mtcAlarm_log ( inv.name, MTC_LOG_ID__COMMAND_UNLOCK ); /* Set action to UNLOCK and let the FSM run the enable handler */ adminActionChange ( node_ptr , MTC_ADMIN_ACTION__UNLOCK ); } } } else if ( (!inv.action.empty()) && (inv.action.compare ( "none" ))) { dlog ("%s Modify Action is '%s'\n", node_ptr->hostname.c_str(), inv.action.c_str() ); node_ptr->action = inv.action ; modify = true ; /* we have a delta */ /* Do not permit administrative actions while Swact is in progress */ /* Note: There is a self corrective clause in the mtcTimer_handler * that will auto clear this flag if it gets stuck for 5 minutes */ if ( smgrEvent.mutex ) { elog ("%s Rejecting '%s' - Swact Operation in-progress\n", node_ptr->hostname.c_str(), inv.action.c_str()); rc = FAIL_SWACT_INPROGRESS ; } else if (!inv.action.compare ( "force-lock" )) { /* TODO: Create customer log of this action */ ilog ("%s Force Lock Action\n", node_ptr->hostname.c_str()); if ( node_ptr->dor_recovery_mode == true ) node_ptr->dor_recovery_mode = false ; if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__FORCE_LOCK ) { ilog ("%s Force Lock Action - already in progress ...\n", node_ptr->hostname.c_str()); } else { /* generate command=forcelock log */ mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_FORCE_LOCK ); /* Set action to LOCK and let the FSM run the disable handler */ adminActionChange ( node_ptr , MTC_ADMIN_ACTION__FORCE_LOCK ); } } else { wlog ("%s Already Locked\n", node_ptr->hostname.c_str() ); } } else if (!inv.action.compare ( "lock" )) { if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { if ( node_ptr->dor_recovery_mode == true ) node_ptr->dor_recovery_mode = false ; /* Set action to LOCK and let the FSM run the disable handler */ adminActionChange ( node_ptr , MTC_ADMIN_ACTION__LOCK ); } else { wlog ("%s Already Locked\n", node_ptr->hostname.c_str() ); } } else if (!inv.action.compare ( "unlock" )) { if ( node_ptr->adminState == MTC_ADMIN_STATE__LOCKED ) { if ( node_ptr->patching == true ) { wlog ("%s cannot unlock host while patching is in progress\n", node_ptr->hostname.c_str()); rc = FAIL_PATCH_INPROGRESS ; } else { recovery_ctrl_init ( node_ptr->hwmon_reset ); recovery_ctrl_init ( node_ptr->hwmon_powercycle ); /* Set action to UNLOCK and let the FSM run the enable handler */ adminActionChange ( node_ptr , MTC_ADMIN_ACTION__UNLOCK ); mtcAlarm_clear ( node_ptr->hostname, MTC_ALARM_ID__LOCK ); node_ptr->alarms[MTC_ALARM_ID__LOCK] = FM_ALARM_SEVERITY_CLEAR ; /* generate command=unlock log */ mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_UNLOCK ); } } else { wlog ("%s Already UnLocked\n", node_ptr->hostname.c_str() ); } } else if ( !inv.action.compare ( "swact" ) || !inv.action.compare ( "force-swact" ) ) { if ( !((get_host_function_mask ( inv.type ) & CONTROLLER_TYPE) == CONTROLLER_TYPE) ) { elog ("%s Rejecting '%s' - Swact only supported for Controllers\n", node_ptr->hostname.c_str(), inv.action.c_str()); rc = FAIL_NODETYPE ; } else if ( nodeLinkClass::is_inactive_controller_main_insv() != true ) { elog ("%s Rejecting '%s' - No In-Service Mate\n", node_ptr->hostname.c_str(), inv.action.c_str()); rc = FAIL_SWACT_NOINSVMATE ; } else if ( node_ptr->adminAction != MTC_ADMIN_ACTION__NONE ) { elog ("%s Rejecting '%s' - '%s' In-Progress\n", node_ptr->hostname.c_str(), inv.action.c_str(), get_adminAction_str( node_ptr->adminAction )); rc = FAIL_OPER_INPROGRESS ; } else if ( smgrEvent.mutex ) { elog ("%s Rejecting '%s' - Operation in-progress\n", node_ptr->hostname.c_str(), inv.action.c_str()); rc = FAIL_SWACT_INPROGRESS ; } // don't run the patching tests during a force-swact action else if ( node_ptr->patching == true ) { wlog ("%s cannot swact active controller while patching is in progress\n", node_ptr->hostname.c_str()); rc = FAIL_PATCH_INPROGRESS ; } else if ( inactive_controller_is_patching() == true ) { wlog ("%s cannot swact to inactive controller while patching is in progress\n", node_ptr->hostname.c_str()); rc = FAIL_PATCH_INPROGRESS ; } // if this is a force-swact action then allow swact to a // patched node that has not been rebooted yet, since // this is a recoverable operation. The other two patching tests // (above) need to be done on all swact actions since it may // render the system non-recoverable. else if ( !inv.action.compare ( "swact" ) && inactive_controller_is_patched() == true ) { wlog ("%s cannot swact to a 'patched' but not 'rebooted' host\n", node_ptr->hostname.c_str()); rc = FAIL_PATCHED_NOREBOOT ; } else { plog ("%s Action=%s\n", node_ptr->hostname.c_str(), inv.action.c_str()); if ( !inv.action.compare ( "force-swact" ) ) adminActionChange ( node_ptr, MTC_ADMIN_ACTION__FORCE_SWACT ); else adminActionChange ( node_ptr, MTC_ADMIN_ACTION__SWACT ); /* generate command=swact log */ mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_SWACT ); smgrEvent.mutex = true ; } } else if ( !inv.action.compare ( "reboot" ) ) { plog ("%s Reboot Action\n", node_ptr->hostname.c_str()); node_ptr->resetProgStage = MTC_RESETPROG__START ; node_ptr->retries = 0 ; mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_MANUAL_REBOOT ); adminActionChange ( node_ptr , MTC_ADMIN_ACTION__REBOOT ); } else if ( !inv.action.compare ( "reinstall" ) ) { plog ("%s Reinstall Action\n", node_ptr->hostname.c_str()); adminActionChange ( node_ptr , MTC_ADMIN_ACTION__REINSTALL ); /* generate command=reinstall log */ mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_REINSTALL ); } else if ( !inv.action.compare ( "reset" ) ) { string bm_ip = NONE ; rc = FAIL_RESET_CONTROL ; node_ptr->retries = 0 ; plog ("%s Reset Action\n", node_ptr->hostname.c_str()); if ( hostUtil_is_valid_bm_type ( node_ptr->bm_type ) == false ) { wlog ("%s reset rejected due to unprovisioned bmc\n", node_ptr->hostname.c_str()); rc = FAIL_BM_PROVISION_ERR ; } else if ( node_ptr->availStatus == MTC_AVAIL_STATUS__POWERED_OFF ) { wlog ("%s reset rejected for powered off host\n", node_ptr->hostname.c_str()); rc = FAIL_RESET_POWEROFF; } else if ( node_ptr->bm_un.empty() ) { wlog ("%s reset rejected due to unconfigured 'bm_username'\n", node_ptr->bm_un.c_str()); rc = FAIL_BM_PROVISION_ERR ; } else { rc = PASS ; node_ptr->resetStage = MTC_RESET__START ; adminActionChange ( node_ptr , MTC_ADMIN_ACTION__RESET ); mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_MANUAL_RESET ); } } else if ( !inv.action.compare ( "power-on" ) ) { string bm_ip = NONE ; rc = FAIL_POWER_CONTROL ; plog ("%s Power-On Action\n", node_ptr->hostname.c_str()); if ( hostUtil_is_valid_bm_type ( node_ptr->bm_type ) == false ) { wlog ("%s power-on rejected due to unprovisioned bmc\n", node_ptr->hostname.c_str()); rc = FAIL_BM_PROVISION_ERR ; } else if ( node_ptr->bm_un.empty() ) { wlog ("%s power-on rejected due to unconfigured 'bm_username'\n", node_ptr->hostname.c_str()); rc = FAIL_BM_PROVISION_ERR ; } else { rc = PASS ; node_ptr->powerStage = MTC_POWERON__START ; adminActionChange ( node_ptr , MTC_ADMIN_ACTION__POWERON ); } mtcInvApi_update_task ( node_ptr, "" ); } else if ( !inv.action.compare ( "power-off" ) ) { string bm_ip = NONE ; rc = FAIL_POWER_CONTROL ; plog ("%s Power-Off Action\n", node_ptr->hostname.c_str()); if ( hostUtil_is_valid_bm_type ( node_ptr->bm_type ) == false ) { wlog ("%s power-off rejected due to unprovisioned bmc\n", node_ptr->hostname.c_str()); rc = FAIL_BM_PROVISION_ERR ; } else if ( node_ptr->bm_un.empty() ) { wlog ("%s power-off rejected due to unconfigured 'bm_username'\n", node_ptr->hostname.c_str()); rc = FAIL_BM_PROVISION_ERR ; } else { if (( !hostUtil_is_valid_ip_addr ( node_ptr->bm_ip )) && ( !hostUtil_is_valid_ip_addr ( bm_ip ))) { wlog ("%s power-off may fail ; 'bm_ip' is undiscovered\n", node_ptr->hostname.c_str()); } rc = PASS ; node_ptr->powerStage = MTC_POWEROFF__START ; adminActionChange ( node_ptr , MTC_ADMIN_ACTION__POWEROFF ); } mtcInvApi_update_task ( node_ptr, "" ); } else { wlog ("%s Unsupported action '%s'\n", node_ptr->hostname.c_str(), inv.action.c_str()); rc = FAIL_ADMIN_ACTION ; mtcInvApi_update_task ( node_ptr, "" ); } } if ( node_ptr->uuid.compare ( inv.uuid ) ) { send_hwmon_command ( node_ptr->hostname, MTC_CMD_DEL_HOST ); plog ("%s Modify 'uuid' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->uuid.c_str(), inv.uuid.c_str() ); node_ptr->uuid = inv.uuid ; send_hwmon_command ( node_ptr->hostname, MTC_CMD_ADD_HOST ); modify = true ; /* we have a delta */ } if ( node_ptr->type.compare ( inv.type ) ) { plog ("%s Modify 'personality' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->type.c_str(), inv.type.c_str() ); node_ptr->type = inv.type ; node_ptr->nodetype = get_host_function_mask ( inv.type ); modify = true ; /* we have a delta */ } if ( node_ptr->ip.compare ( inv.ip ) ) { plog ("%s Modify 'mgmt_ip' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->ip.c_str(), inv.ip.c_str()); node_ptr->ip = inv.ip ; /* Tell the guestAgent the new IP */ rc = send_guest_command(node_ptr->hostname,MTC_CMD_MOD_HOST); modify = true ; /* we have a delta */ } if ( node_ptr->mac.compare ( inv.mac ) ) { plog ("%s Modify 'mgmt_mac' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->mac.c_str(), inv.mac.c_str() ); node_ptr->mac = inv.mac ; modify = true ; /* we have a delta */ } if ( node_ptr->infra_ip.compare ( inv.infra_ip ) ) { if (( hostUtil_is_valid_ip_addr ( inv.infra_ip )) || ( hostUtil_is_valid_ip_addr ( node_ptr->infra_ip ))) { plog ("%s Modify 'infra_ip' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->infra_ip.c_str(), inv.infra_ip.c_str() ); modify = true ; /* we have a delta */ } node_ptr->infra_ip = inv.infra_ip ; } if ( (!inv.name.empty()) && (node_ptr->hostname.compare ( inv.name)) ) { mtcCmd cmd ; mtcCmd_init ( cmd ); cmd.stage = MTC_CMD_STAGE__START ; cmd.cmd = MTC_OPER__MODIFY_HOSTNAME ; cmd.name = inv.name ; node_ptr->mtcCmd_work_fifo.push_back(cmd); plog ("%s Modify 'hostname' to %s (mtcCmd_queue:%ld)\n", node_ptr->hostname.c_str(), cmd.name.c_str() , node_ptr->mtcCmd_work_fifo.size()); modify_bm = true ; /* board mgmnt change */ modify = true ; /* we have some delta */ } if ( node_ptr->bm_un.compare ( inv.bm_un ) ) { if ( inv.bm_un.empty () ) inv.bm_un = "none" ; plog ("%s Modify 'bm_username' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->bm_un.c_str(), inv.bm_un.c_str()); node_ptr->bm_un = inv.bm_un ; modify_bm = true ; /* board mgmnt change */ modify = true ; /* we have some delta */ } /* PATCHBACK - issue found during BMC refactoring user story * where there was a race condition found where the bmc dnsmasq file * was updated with a new bm_ip close to when there was an * administrative operation (unlock in this case). The newly learned * bm_ip was overwritten by the now stale bm_ip that came in from * inventory. The bm_ip should never come from sysinv while in * internal mode. */ if (( node_ptr->bm_ip.compare ( inv.bm_ip ))) { if ( inv.bm_ip.empty () ) inv.bm_ip = NONE ; /* if not empty and not none and already used then reject */ if ( is_bm_ip_already_used ( inv.bm_ip ) == true ) { wlog ("%s cannot use already provisioned bm ip %s\n", node_ptr->hostname.c_str(), inv.bm_ip.c_str()); return (FAIL_DUP_IPADDR); } plog ("%s Modify 'bm_ip' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->bm_ip.c_str(), inv.bm_ip.c_str()); node_ptr->bm_ip = inv.bm_ip ; modify_bm = true ; /* board mgmnt change */ modify = true ; /* we have some delta */ } if ( node_ptr->bm_type.compare ( inv.bm_type ) ) { if ( inv.bm_type.empty() ) inv.bm_type = "none" ; else inv.bm_type = tolowercase(inv.bm_type) ; plog ("%s Modify 'bm_type' from %s -> %s\n", node_ptr->hostname.c_str(), node_ptr->bm_type.c_str(), inv.bm_type.c_str()); modify_bm = true ; /* board mgmnt change */ modify = true ; /* we have some delta */ } /* print a log if we find that there was nothing to modify */ if ( modify == false ) { wlog ("%s Modify request without anything to modify\n", node_ptr->hostname.c_str()); } if ( modify_bm == true ) { wlog ("%s Board Management provisioning has changed\n", node_ptr->hostname.c_str()); bool bm_type_was_valid = hostUtil_is_valid_bm_type (node_ptr->bm_type) ; bool bm_type_now_valid = hostUtil_is_valid_bm_type (inv.bm_type) ; /* update bm_type now */ node_ptr->bm_type = inv.bm_type ; /* BM is provisioned */ if ( bm_type_now_valid == true ) { /* force (re)provision */ manage_bmc_provisioning ( node_ptr ); } /* BM is already provisioned but is now deprovisioned */ else if (( bm_type_was_valid == true ) && ( bm_type_now_valid == false )) { node_ptr->bm_type = NONE ; node_ptr->bm_ip = NONE ; node_ptr->bm_un = NONE ; mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_BM_DEPROVISIONED ); set_bm_prov ( node_ptr, false ); } /* BM was not provisioned and is still not provisioned */ else { /* Handle all other provisioning changes ; username, ip address */ manage_bmc_provisioning ( node_ptr ); } } } else { elog ("getNode failed to find uuid: %s\n", inv.uuid.c_str()); } return ( rc ); } void nodeLinkClass::start_offline_handler ( struct nodeLinkClass::node * node_ptr ) { bool already_active = false ; mtc_offlineStages_enum offlineStage_saved = node_ptr->offlineStage ; if ( node_ptr->offlineStage == MTC_OFFLINE__IDLE ) { node_ptr->offlineStage = MTC_OFFLINE__START ; } else { already_active = true ; } plog ("%s%soffline handler (%s-%s-%s) (stage:%d)\n", node_ptr->hostname.c_str(), already_active ? " " : " starting ", adminState_enum_to_str(node_ptr->adminState).c_str(), operState_enum_to_str(node_ptr->operState).c_str(), availStatus_enum_to_str(node_ptr->availStatus).c_str(), offlineStage_saved); node_ptr->offline_log_throttle = 0; } void nodeLinkClass::stop_offline_handler ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr->offlineStage != MTC_OFFLINE__IDLE ) { plog ("%s stopping offline handler (%s-%s-%s) (stage:%d)\n", node_ptr->hostname.c_str(), adminState_enum_to_str(node_ptr->adminState).c_str(), operState_enum_to_str(node_ptr->operState).c_str(), availStatus_enum_to_str(node_ptr->availStatus).c_str(), node_ptr->offlineStage); node_ptr->offlineStage = MTC_OFFLINE__IDLE ; } node_ptr->offline_log_throttle = 0; } string nodeLinkClass::get_host ( string uuid ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( uuid ); if ( node_ptr != NULL ) { return (node_ptr->hostname) ; } return ( "" ); } /** Check to see if the node list already contains any of the following * information and reject the add or modify if it does * * uuid * hostname * ip address * mac address * **/ int nodeLinkClass::add_host_precheck ( node_inv_type & inv ) { struct node * ptr = static_cast<struct node *>(NULL) ; struct node * node_ptr = static_cast<struct node *>(NULL) ; int rc = PASS ; if ( head == NULL ) return (PASS); for ( node_ptr = head ; ; node_ptr = node_ptr->next ) { /* look or the UUID */ if ( !node_ptr->uuid.compare(inv.uuid)) { rc = RETRY ; dlog ("%s found in mtce\n", node_ptr->uuid.c_str()); break ; } else if (( node_ptr->next == NULL ) || ( node_ptr == tail )) break ; } /** If that uuid is not found then make sure there * are no other entries in the list that already * has the same info that we want to create a * new host with. * If so then reject by returning a failure. */ for ( ptr = head ; ; ptr = ptr->next ) { /* if this uuid is found then see if we are being * asked to modify and make sure that we are not being * asked to modify other members to values that are * used by other hosts * If so then reject by returning a failure. * otherwise then allow the modification by returning a retry. */ if (( rc == RETRY ) && ( ptr == node_ptr )) { dlog ("%s skip\n", ptr->hostname.c_str()); /* skip the node we found the UUID on * but make sure that none of the other nodes * have the same data */ } else { dlog ("%s check\n", ptr->hostname.c_str()); if ( !ptr->hostname.compare(inv.name)) { wlog ("hostname (%s) already used ; rejecting add / modify\n", inv.name.c_str()); return(FAIL_DUP_HOSTNAME); } if ( ptr->ip.compare("none") != 0 && !ptr->ip.compare(inv.ip)) { wlog ("ip address (%s) already used ; rejecting add / modify\n", inv.ip.c_str()); return(FAIL_DUP_IPADDR); } if ( !ptr->mac.compare(inv.mac)) { wlog ("mac address (%s) already used ; rejecting add / modify\n", inv.mac.c_str()); return(FAIL_DUP_MACADDR); } } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (rc); } int nodeLinkClass::add_host ( node_inv_type & inv ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = static_cast<struct node *>(NULL); if ((!inv.name.compare("controller-0")) || (!inv.name.compare("controller-1"))) { dlog ("Adding %s\n", inv.name.c_str()); node_ptr = nodeLinkClass::getNode(inv.name); } else if (( inv.name.empty()) || ( !inv.name.compare ("none") ) || ( !inv.name.compare ("None") )) { wlog ("Refusing to add host with 'null' or 'invalid' hostname (%s)\n", inv.uuid.c_str()); return (FAIL_INVALID_HOSTNAME) ; } else if (( inv.uuid.empty()) || ( !inv.uuid.compare ("none") ) || ( !inv.uuid.compare ("None") )) { wlog ("Refusing to add host with 'null' or 'invalid' uuid (%s)\n", inv.uuid.c_str()); return (FAIL_INVALID_UUID) ; } /* Ensure we don't add a host with critical info that is * already used by other members of inventory like ; * hostname, uuid, ip, mac, bm_ip */ else if ( ( rc = add_host_precheck ( inv )) > RETRY ) { return (rc); } else { if ( rc == RETRY ) { dlog ("%s modify operation\n", inv.uuid.c_str()); } else { dlog ("%s add operation\n", inv.uuid.c_str()); } node_ptr = nodeLinkClass::getNode(inv.uuid); } if ( node_ptr ) { dlog ("%s Already provisioned\n", node_ptr->hostname.c_str()); /* update some of the info */ node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } /* Send back a retry so that this add is converted to a modify */ return (RETRY); } /* Otherwise add it as a new node */ else { if ( daemon_get_cfg_ptr()->debug_level != 0 ) print_inv ( inv ); unsigned int nodetype_temp = get_host_function_mask ( inv.type ); if ( (nodetype_temp & CONTROLLER_TYPE) == CONTROLLER_TYPE ) { if ( inactive_controller_hostname.empty () == false ) { wlog ("Cannot provision more than 2 controllers\n"); wlog ("%s is already provisioned as inactive\n", inactive_controller_hostname.c_str()); return (FAIL); } } /* Prevent allowing add of a reserved hostname * with and incorrect node type. Reserved names are * * controller-0 and controller-1 must be a controller type * storage-0 must be a storage type * * */ if ((( !inv.name.compare ("controller-0")) && (( nodetype_temp & CONTROLLER_TYPE) != CONTROLLER_TYPE )) || (( !inv.name.compare ("controller-1")) && (( nodetype_temp & CONTROLLER_TYPE ) != CONTROLLER_TYPE)) || (( !inv.name.compare ("storage-0" )) && (( nodetype_temp & STORAGE_TYPE) != STORAGE_TYPE))) { wlog ("Cannot provision '%s' as a '%s' host\n", inv.name.c_str(), inv.type.c_str()); return (FAIL_RESERVED_NAME); } node_ptr = nodeLinkClass::addNode(inv.name); if ( node_ptr ) { bool validStates = false ; node_ptr->hostname = inv.name ; /* set the node type ; string and define code */ node_ptr->type = inv.type ; node_ptr->nodetype = get_host_function_mask ( inv.type ) ; update_host_functions ( inv.name, inv.func ); node_ptr->ip = inv.ip ; node_ptr->mac = inv.mac ; node_ptr->uuid = inv.uuid ; node_ptr->infra_ip = inv.infra_ip ; if ( inv.uptime.length() ) { sscanf ( inv.uptime.data(), "%u", &node_ptr->uptime ); dlog2 ("%s Uptime (%s:%u)\n", inv.name.c_str(), inv.uptime.c_str(), node_ptr->uptime ); } else { node_ptr->uptime = 0 ; } node_ptr->thread_extra_info.bm_ip = node_ptr->bm_ip = inv.bm_ip ; node_ptr->thread_extra_info.bm_un = node_ptr->bm_un = inv.bm_un ; node_ptr->thread_extra_info.bm_type= node_ptr->bm_type = inv.bm_type ; node_ptr->bm_ping_info.sock = 0 ; /* initialize the host power and reset control thread */ thread_init ( node_ptr->ipmitool_thread_ctrl, node_ptr->ipmitool_thread_info, &node_ptr->thread_extra_info, mtcThread_ipmitool, DEFAULT_THREAD_TIMEOUT_SECS, node_ptr->hostname, THREAD_NAME__IPMITOOL); if ( adminStateOk (inv.admin) && operStateOk (inv.oper ) && availStatusOk (inv.avail)) { validStates = true ; } clog ("%s subf state %s-%s\n", node_ptr->hostname.c_str(), inv.oper_subf.c_str(), inv.avail_subf.c_str() ); node_ptr->task = inv.task ; /* Add based on 'action' */ if ((!inv.action.empty()) && (inv.action.compare ("none"))) { /* Save current action */ node_ptr->action = inv.action ; if ( !inv.action.compare ("unlock") && validStates ) { ilog ("%s Added in 'unlocked' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } adminActionChange ( node_ptr, MTC_ADMIN_ACTION__UNLOCK ); } else if ( !inv.action.compare ("lock") && validStates ) { ilog ("%s Added in 'locked' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } adminActionChange ( node_ptr, MTC_ADMIN_ACTION__LOCK ); } else if ( !inv.action.compare ("force-lock") && validStates ) { ilog ("%s Added in 'force-locked' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } adminActionChange ( node_ptr, MTC_ADMIN_ACTION__FORCE_LOCK ); } else if ( !inv.action.compare ("reboot") && validStates ) { ilog ("%s Added with 'reboot' in 'locked' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } adminActionChange ( node_ptr, MTC_ADMIN_ACTION__REBOOT ); } else if ( !inv.action.compare ("reset") && validStates ) { ilog ("%s Added with 'reset' in 'locked' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } adminActionChange ( node_ptr, MTC_ADMIN_ACTION__RESET ); } else if ( !inv.action.compare ("power-off") && validStates ) { ilog ("%s Added in a 'locked' and 'power-off' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = MTC_ADMIN_STATE__LOCKED ; node_ptr->operState = MTC_OPER_STATE__DISABLED; node_ptr->availStatus = MTC_AVAIL_STATUS__POWERED_OFF ; node_ptr->operState_subf = MTC_OPER_STATE__DISABLED ; node_ptr->availStatus_subf = MTC_AVAIL_STATUS__POWERED_OFF ; adminActionChange ( node_ptr, MTC_ADMIN_ACTION__POWEROFF ); } else if ( !inv.action.compare ("power-on") && validStates ) { ilog ("%s Added with 'power-on' in 'locked' state\n", node_ptr->hostname.c_str()); print_inv ( inv ); node_ptr->adminState = MTC_ADMIN_STATE__LOCKED ; node_ptr->operState = MTC_OPER_STATE__DISABLED; node_ptr->availStatus = MTC_AVAIL_STATUS__OFFLINE ; node_ptr->operState_subf = MTC_OPER_STATE__DISABLED ; node_ptr->availStatus_subf = MTC_AVAIL_STATUS__OFFLINE ; node_ptr->onlineStage = MTC_ONLINE__START ; adminActionChange ( node_ptr, MTC_ADMIN_ACTION__POWERON ); } else { wlog ("%s Need add Action support for '%s' action\n", node_ptr->hostname.c_str(), inv.action.c_str()); print_inv ( inv ); /* Load in maintenance states */ node_ptr->adminState = MTC_ADMIN_STATE__LOCKED ; node_ptr->operState = MTC_OPER_STATE__DISABLED ; node_ptr->availStatus = MTC_AVAIL_STATUS__OFFLINE ; if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = MTC_OPER_STATE__DISABLED ; node_ptr->availStatus_subf = MTC_AVAIL_STATUS__OFFLINE ; } node_ptr->onlineStage = MTC_ONLINE__START ; wlog ("%s Need '%s' action enabled here\n", node_ptr->hostname.c_str(), inv.action.c_str()); } } else { node_ptr->adminState = adminState_str_to_enum (inv.admin.data()); node_ptr->operState = operState_str_to_enum (inv.oper.data ()); node_ptr->availStatus = availStatus_str_to_enum (inv.avail.data()); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { node_ptr->operState_subf = operState_str_to_enum (inv.oper_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum (inv.avail_subf.data()); } } /* Clear the heartbeat failure conts for this host */ for ( int iface = 0 ; iface < MAX_IFACES ; iface++ ) { node_ptr->hbs_degrade_count[iface] = 0; node_ptr->hbs_failure_count[iface] = 0; } /* Add to the end of inventory */ hostname_inventory.push_back ( node_ptr->hostname ); rc = PASS ; } } if (( rc == PASS ) && ( node_ptr )) { node_ptr->addStage = MTC_ADD__START ; adminActionChange ( node_ptr , MTC_ADMIN_ACTION__ADD ); } return (rc); } void nodeLinkClass::clear_service_readies ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr ) { if ( node_ptr->hbsClient_ready || node_ptr->pmond_ready ) { ilog ("%s clearing service ready events\n", node_ptr->hostname.c_str()); node_ptr->hbsClient_ready = false ; node_ptr->pmond_ready = false ; } } } /* Used by the heartbeat service to add a host to its list */ int nodeLinkClass::add_heartbeat_host ( const node_inv_type & inv ) { int rc = FAIL ; struct nodeLinkClass::node * node_ptr = static_cast<struct node *>(NULL); dlog ("%s with nodetype %u\n", inv.name.c_str(), inv.nodetype ); /* no hostname - no add ! */ if ( inv.name.length() ) { /* Handle the case where we are adding a node that is already */ /* present if so just update the inventory data not the mtc state */ node_ptr = nodeLinkClass::getNode(inv.name); if ( node_ptr ) { dlog ("%s already provisioned\n", node_ptr->hostname.c_str()); rc = RETRY ; } /* Otherwise add it as a new node */ else { node_ptr = nodeLinkClass::addNode(inv.name); if ( node_ptr != NULL ) { node_ptr->hostname = inv.name ; node_ptr->nodetype = inv.nodetype ; dlog ("%s added to linked list\n", inv.name.c_str()); rc = PASS ; } else { elog ("Failed to addNode %s to heartbeat service\n", inv.name.c_str()); } } } return (rc); } string nodeLinkClass::get_uuid ( string hostname ) { struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode(hostname); if ( node_ptr ) { return (node_ptr->uuid); } else { return (""); } } void nodeLinkClass::set_uuid ( string hostname, string uuid ) { struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode(hostname); if ( node_ptr ) { node_ptr->uuid = uuid ; } } /* Set the task field in the maintenance class object for the specified host */ void nodeLinkClass::set_task ( string hostname, string task ) { struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode(hostname); if ( node_ptr ) { node_ptr->task = task ; } } /* Lock Rules * * 1. Cannot lock this controller * 2. Cannot lock inactive controller if storage-0 is locked * 3. Cannot lock storage node with monitor if inactive conroller is locked or not present * 4. Cannot lock last storage host. */ bool nodeLinkClass::can_uuid_be_locked ( string uuid , int & reason ) { struct nodeLinkClass::node * node_ptr = nodeLinkClass::getNode(uuid); if ( node_ptr ) { dlog1 ("%s Lock permission query\n", node_ptr->hostname.c_str()); /* Allow lock of already locked 'any' host */ if ( node_ptr->adminState == MTC_ADMIN_STATE__LOCKED ) { ilog ("%s is already 'locked'\n", node_ptr->hostname.c_str()); return (true); } else if ( node_ptr->operState == MTC_OPER_STATE__DISABLED ) { ilog ("%s allowing lock of 'disabled' host\n", node_ptr->hostname.c_str() ); return (true); } else if (is_controller(node_ptr)) { /* Rule 1 - Cannot lock active controller */ if ( THIS_HOST ) { elog ("%s Cannot be 'locked' - controller is 'active'\n", node_ptr->hostname.c_str()); reason = FAIL_UNIT_ACTIVE ; return (false); } /* Rule 2 - Cannot lock inactive controller if the floating storage * ceph monitor is locked */ if (( get_storage_backend() == CGCS_STORAGE_CEPH ) && ( is_storage_mon_enabled () == false )) { wlog ("%s cannot be 'locked' - failed storage redundancy check\n", node_ptr->hostname.c_str()); reason = FAIL_NEED_STORAGE_MON ; return (false); } ilog ("%s can be locked\n", node_ptr->hostname.c_str()); return (true); } else if ( is_worker(node_ptr) ) { if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { dlog ("%s is 'unlocked' and can be 'locked'\n", node_ptr->hostname.c_str()); } return (true); } /* Deal with lock of storage cases - Rules 3 and 4 */ else if ( is_storage(node_ptr) ) { /* Only need to semantic check if this host is unlocked-enabled */ if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) { /* Both active controllers path ... */ if ( num_controllers_enabled () >= 2 ) { /* If we are locking storage-0 make sure that there * is another enabled storage node */ if ( !node_ptr->hostname.compare("storage-0") ) { /* We already know that this storage node is enabled so * we need to see a count greated than 1 */ if ( enabled_storage_nodes () > 1 ) { /* We have 2 enabled controllers and 2 enabled * storage nodes so we can allow lock of storage-0 */ ilog ("%s can be locked - there is storage redundancy\n", node_ptr->hostname.c_str()); return (true); } /* Rule 4 - Cannot lock last storage node */ else { wlog ("%s cannot be locked - no storage redundancy\n", node_ptr->hostname.c_str()); reason = FAIL_LOW_STORAGE ; return (false); } } /* O.K. we are trying to lock a storage host tha is not * the floating storage monitor */ else if (( is_storage_mon_enabled () == true ) && ( enabled_storage_nodes() > 1 )) { /* We have - 2 enabled controllers * - the storage mon is enabled and * - is not this one. */ ilog ("%s can be locked - there is storage redundancy\n", node_ptr->hostname.c_str()); return (true); } /* Rule 4 - Cannot lock last storage node */ else if (enabled_storage_nodes() <= 1) { wlog ("%s cannot be locked - no storage redundancy\n", node_ptr->hostname.c_str()); reason = FAIL_LOW_STORAGE ; return (false); } else { /* Other redundancy checks here and in SysInv have passed. */ ilog ("%s can be locked - storage redundancy filters passed.\n", node_ptr->hostname.c_str()); return (true); } } /* Rule 3 - Cannot lock storage node with monitor if inactive * controller is locked or not present and there is * not another storage node enabled */ else { /* Cannot lock storage-0 if there is only a single enabled controller */ if ( !node_ptr->hostname.compare("storage-0") ) { wlog ("%s cannot be locked - simplex system\n", node_ptr->hostname.c_str()); reason = FAIL_NEED_STORAGE_MON ; return (false); } /* Only allow locking of a storage node if there is another in service */ else if (( is_storage_mon_enabled () == true ) && ( enabled_storage_nodes() > 1 )) { ilog ("%s can be locked - there is storage redundancy\n", node_ptr->hostname.c_str()); return (true); } /* Rule 4 - Cannot lock last storage node */ else { wlog ("%s cannot be locked - no redundancy\n", node_ptr->hostname.c_str()); reason = FAIL_LOW_STORAGE ; return (false); } } } else { ilog ("%s allowing lock of disabled storage host\n", node_ptr->hostname.c_str()); return (true); } } else { elog ("%s unsupported nodetype (%u)\n", node_ptr->hostname.c_str(), node_ptr->nodetype); return (false); } } else { dlog ("Unknown uuid: %s\n", uuid.c_str()); /* allowing lock as a means to clear up error */ return (true); } } int nodeLinkClass::rem_host ( string & hostname ) { int rc = FAIL ; if ( ! hostname.empty() ) { hostname_inventory.remove ( hostname ); rc = nodeLinkClass::remNode ( hostname ); } return ( rc ); } void nodeLinkClass::set_my_hostname ( string hostname ) { struct nodeLinkClass::node * node_ptr ; nodeLinkClass::my_hostname = hostname ; /* set it in the local inventory as well */ node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->hostname = hostname ; } } string nodeLinkClass::get_my_hostname ( void ) { return( nodeLinkClass::my_hostname ); } void nodeLinkClass::set_my_local_ip ( string & ip ) { nodeLinkClass::node* node_ptr ; nodeLinkClass::my_local_ip = ip ; /* set it in the local inventory as well */ node_ptr = nodeLinkClass::getNode ( my_hostname ); if ( node_ptr != NULL ) { node_ptr->ip = ip ; } } string nodeLinkClass::get_my_local_ip ( void ) { return( nodeLinkClass::my_local_ip ); } void nodeLinkClass::set_my_float_ip ( string & ip ) { nodeLinkClass::my_float_ip = ip ; } string nodeLinkClass::get_my_float_ip ( void ) { return( nodeLinkClass::my_float_ip ); } static string null_str = "" ; string nodeLinkClass::get_hostaddr ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->ip ); } return ( null_str ); } string nodeLinkClass::get_infra_hostaddr ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->infra_ip ); } return ( null_str ); } string nodeLinkClass::get_hostIfaceMac ( string & hostname, int iface ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { if ( iface == MGMNT_IFACE ) return ( node_ptr->mac ); if ( iface == INFRA_IFACE ) return ( node_ptr->infra_mac ); } ilog ("%s has unknown mac address for %s interface\n", hostname.c_str(), get_iface_name_str(iface)); return ( null_str ); } int nodeLinkClass::set_hostaddr ( string & hostname, string & ip ) { int rc = FAIL ; nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->ip = ip ; rc = PASS ; } return ( rc ); } int nodeLinkClass::set_infra_hostaddr ( string & hostname, string & ip ) { int rc = FAIL ; nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->infra_ip = ip ; rc = PASS ; } return ( rc ); } string nodeLinkClass::get_hostname ( string & hostaddr ) { if (( hostaddr == LOOPBACK_IPV6 ) || ( hostaddr == LOOPBACK_IP ) || ( hostaddr == LOCALHOST )) { return(my_hostname); } else { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostaddr ); if ( node_ptr != NULL ) { return ( node_ptr->hostname ); } return ( null_str ); } } string nodeLinkClass::get_hostname_from_bm_ip ( string bm_ip ) { if ( head ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ! ptr->bm_ip.compare(bm_ip) ) { return ( ptr->hostname ); } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return ("") ; } int nodeLinkClass::num_hosts ( void ) { return ( nodeLinkClass::hosts ) ; } void nodeLinkClass::set_cmd_resp ( string & hostname, mtc_message_type & msg ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { if ( is_host_services_cmd ( msg.cmd ) ) { /***************************************************** * Host Services Request's Response Handling *****************************************************/ node_ptr->host_services_req.status = msg.parm[0] ; if ( msg.cmd == node_ptr->host_services_req.cmd ) { // print_mtc_message ( &msg, true ); /* if num > 1 then expect a host services result message */ if ( msg.cmd == MTC_CMD_HOST_SVCS_RESULT ) { if ( !node_ptr->host_services_req.ack ) { slog ("%s %s without initial command ACK\n", hostname.c_str(), node_ptr->host_services_req.name.c_str()); } node_ptr->host_services_req.rsp = msg.cmd ; if ( msg.buf[0] != '\0' ) { node_ptr->host_services_req.status_string = msg.buf ; } } /* Check to see if the start/stop host services command * response demonstrates support for the enhanced host * services extension. */ else if (( msg.num > 1 ) && ( msg.parm[1] == MTC_ENHANCED_HOST_SERVICES )) { dlog ("%s %s request ack\n", hostname.c_str(), node_ptr->host_services_req.name.c_str()); node_ptr->host_services_req.ack = true ; } else { ilog ("%s %s request ack (legacy mode)\n", hostname.c_str(), node_ptr->host_services_req.name.c_str()); /* support legacy client by copying the cmd to cmdRsp */ node_ptr->host_services_req.status = PASS ; node_ptr->host_services_req.rsp = msg.cmd ; node_ptr->host_services_req.ack = MTC_CMD_NONE ; } } if ( msg.num && ( node_ptr->host_services_req.status != PASS )) { dlog ("%s %s command failed (rc:%d) [%s]\n", hostname.c_str(), get_mtcNodeCommand_str(msg.cmd), node_ptr->host_services_req.status, node_ptr->host_services_req.status_string.empty() ? "no error string" : node_ptr->host_services_req.status_string.c_str()); } } else { node_ptr->cmdRsp = msg.cmd ; if ( msg.num > 0 ) node_ptr->cmdRsp_status = msg.parm[0] ; else node_ptr->cmdRsp_status = -1 ; dlog ("%s '%s' command response status [%u:%s]\n", hostname.c_str(), node_ptr->cmdName.c_str(), msg.num ? node_ptr->cmdRsp_status : PASS, node_ptr->cmdRsp_status_string.empty() ? "empty" : node_ptr->cmdRsp_status_string.c_str()); } } } unsigned int nodeLinkClass::get_cmd_resp ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->cmdRsp ) ; } return (-1); } mtc_client_enum nodeLinkClass::get_activeClient ( string hostname ) { nodeLinkClass::node* node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->activeClient ) ; } else { slog ("Host lookup failed for '%s'\n", hostname.c_str()); } return (CLIENT_NONE); } int nodeLinkClass::set_activeClient ( string hostname, mtc_client_enum client ) { nodeLinkClass::node* node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->activeClient = client ; return (PASS); } else { slog ("Host lookup failed for '%s'\n", hostname.c_str()); } return (FAIL_HOSTNAME_LOOKUP); } /***************************************************************************** * * Name : set_mtcAlive * * Description: * * If mtcAlive is ungated then * * 1. manage the online/offline state bools * 2. increment the mtcAlive count and * 3. set the mtcAlive received bool for the specified interface * *****************************************************************************/ void nodeLinkClass::set_mtcAlive ( string & hostname, int interface ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { if ( node_ptr->mtcAlive_gate == false ) { node_ptr->mtcAlive_online = true ; node_ptr->mtcAlive_offline = false ; node_ptr->mtcAlive_count++ ; if ( interface == INFRA_INTERFACE ) { node_ptr->mtcAlive_infra = true ; } else { node_ptr->mtcAlive_mgmnt = true ; } } } } bool nodeLinkClass::get_mtcAlive_gate ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->mtcAlive_gate ) ; } /* If we can't find the node then gate off the alive messages */ return (true); } void nodeLinkClass::ctl_mtcAlive_gate ( string & hostname, bool gated ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->mtcAlive_gate = gated ; if ( gated == true ) { alog ("%s mtcAlive gated\n", node_ptr->hostname.c_str()); } else { alog ("%s mtcAlive ungated\n", node_ptr->hostname.c_str()); } } } /* Main-Function Go Enabled member Functions */ void nodeLinkClass::set_goEnabled ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->goEnabled = true ; } } bool nodeLinkClass::get_goEnabled ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->goEnabled ) ; } return (false); } void nodeLinkClass::set_goEnabled_failed ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->goEnabled_failed = true ; } } /* Sub-Function Go Enabled Member Functions */ void nodeLinkClass::set_goEnabled_subf ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->goEnabled_subf = true ; } } bool nodeLinkClass::get_goEnabled_subf ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->goEnabled_subf ) ; } return (false); } void nodeLinkClass::set_goEnabled_failed_subf ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->goEnabled_failed_subf = true ; } } /* Set and Get Uptime Member Function */ void nodeLinkClass::set_uptime ( struct nodeLinkClass::node * node_ptr, unsigned int uptime, bool force ) { if ( node_ptr != NULL ) { /* Force the uptime into the database if * - passed in value is 0 and current value is !0 * - passed in value is !0 and current value is 0 * - if ther force option is used * Otherwise allow the audit to push time to the database */ if ((force == true ) || (( uptime != 0 ) && ( node_ptr->uptime == 0 )) || (( node_ptr->uptime != 0 ) && ( uptime == 0 ))) { mtcInvApi_update_uptime ( node_ptr, uptime ); } node_ptr->uptime = uptime ; } } void nodeLinkClass::set_uptime ( string & hostname, unsigned int uptime, bool force ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); set_uptime ( node_ptr, uptime, force ); } unsigned int nodeLinkClass::get_uptime ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->uptime ) ; } return (0); } void nodeLinkClass::set_uptime_refresh_ctr ( string & hostname, int value ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->uptime_refresh_counter = value ; } } int nodeLinkClass::get_uptime_refresh_ctr ( string & hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->uptime_refresh_counter ) ; } return (0); } void nodeLinkClass::set_mtce_flags ( string hostname, int flags ) { nodeLinkClass::node* node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { /* Deal with host level */ node_ptr->mtce_flags = flags ; if ( flags & MTC_FLAG__MAIN_GOENABLED ) node_ptr->goEnabled = true ; else node_ptr->goEnabled = false ; /* Track host patching state by Out-Of-Band flag */ if ( flags & MTC_FLAG__PATCHING ) { if ( node_ptr->patching == false ) { plog ("%s software patching has begun\n", node_ptr->hostname.c_str()); } node_ptr->patching = true ; } else { if ( node_ptr->patching == true ) { plog ("%s software patching done\n", node_ptr->hostname.c_str()); } node_ptr->patching = false ; } /* Track host patched state by Out-Of-Band flag. * This flag is set when the host is patched but not reset */ if ( flags & MTC_FLAG__PATCHED ) { if ( node_ptr->patched == false ) { plog ("%s software patched\n", node_ptr->hostname.c_str()); } node_ptr->patched = true ; } else { if ( node_ptr->patched == true ) { plog ("%s software patch is applied\n", node_ptr->hostname.c_str()); } node_ptr->patched = false ; } /* Deal with sub-function if AIO controller host */ if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { if ( flags & MTC_FLAG__SUBF_GOENABLED ) { if ( node_ptr->operState_subf == MTC_OPER_STATE__ENABLED ) { node_ptr->goEnabled_subf = true ; } } else { node_ptr->goEnabled_subf = false ; } } } } void nodeLinkClass::set_health ( string & hostname, int health ) { switch ( health ) { case NODE_HEALTH_UNKNOWN: case NODE_HEALTHY: case NODE_UNHEALTHY: { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { if ( health == NODE_UNHEALTHY ) { if ( node_ptr->health != NODE_UNHEALTHY ) { if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { wlog ("%s Health State Change -> UNHEALTHY\n", hostname.c_str()); } } } node_ptr->health = health ; } break ; } default: { wlog ("%s Unexpected health code (%d), defaulting to (unknown)\n", hostname.c_str(), health ); break ; } } } /************************************************************************************* * * Name : manage_bmc_provisioning * * Description: This utility manages a change in bmc provisioning for * bm region EXTERNAL mode. Creates provisioning logs and * sends START and STOP monitoring commands to the hardware monitor. * * Warning : Should only be called when there is a change to BM provisioning. * as it will first always first disable provisioning and then * decides whether it needs to be re-enabled or not. * *************************************************************************************/ int nodeLinkClass::manage_bmc_provisioning ( struct node * node_ptr ) { int rc = PASS ; bool was_provisioned = node_ptr->bm_provisioned ; set_bm_prov ( node_ptr, false); if ((hostUtil_is_valid_ip_addr ( node_ptr->bm_ip )) && (!node_ptr->bm_un.empty())) { if ( was_provisioned == true ) { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_BM_REPROVISIONED ); } else { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_BM_PROVISIONED ); } set_bm_prov ( node_ptr, true ); } else if ( was_provisioned == true ) { send_hwmon_command(node_ptr->hostname,MTC_CMD_STOP_HOST); mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_BM_DEPROVISIONED ); } /* Send hmond updated bm info */ ilog ("%s sending board management info update to hwmond\n", node_ptr->hostname.c_str() ); if ( ( rc = send_hwmon_command(node_ptr->hostname,MTC_CMD_MOD_HOST) ) == PASS ) { if ( node_ptr->bm_provisioned == true ) { rc = send_hwmon_command(node_ptr->hostname,MTC_CMD_START_HOST); } else { rc = send_hwmon_command(node_ptr->hostname,MTC_CMD_STOP_HOST); } if ( rc ) { wlog ("%s failed to send START or STOP command to hwmond\n", node_ptr->hostname.c_str()); } } else { wlog ("%s failed to send MODIFY command to hwmond\n", node_ptr->hostname.c_str()); } return (rc); } bool nodeLinkClass::is_bm_ip_already_used ( string bm_ip ) { if ( hostUtil_is_valid_ip_addr ( bm_ip ) == true ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( !bm_ip.compare(ptr->bm_ip) ) { return (true); } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return (false); } int nodeLinkClass::set_bm_type ( string hostname , string bm_type ) { int rc = FAIL_HOSTNAME_LOOKUP ; nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->bm_type = bm_type ; dlog ("%s '%s' updated to '%s'\n", hostname.c_str(), MTC_JSON_INV_BMTYPE, node_ptr->bm_type.c_str()); rc = PASS ; } return (rc); } int nodeLinkClass::set_bm_un ( string hostname , string bm_un ) { int rc = FAIL_HOSTNAME_LOOKUP ; nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { if ( bm_un.length() ) { node_ptr->bm_un = bm_un ; } else { node_ptr->bm_un = NONE ; } dlog ("%s '%s' updated to '%s'\n", hostname.c_str(), MTC_JSON_INV_BMUN, node_ptr->bm_un.c_str()); rc = PASS ; } return (rc); } int nodeLinkClass::set_bm_ip ( string hostname , string bm_ip ) { int rc = FAIL_HOSTNAME_LOOKUP ; nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->bm_ip = bm_ip ; dlog ("%s '%s' updated to '%s'\n", hostname.c_str(), MTC_JSON_INV_BMIP, node_ptr->bm_ip.c_str()); rc = PASS ; } return (rc); } void nodeLinkClass::bmc_access_data_init ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr ) { node_ptr->bm_accessible = false; node_ptr->mc_info_query_active = false ; node_ptr->mc_info_query_done = false ; node_ptr->reset_cause_query_active = false ; node_ptr->reset_cause_query_done = false ; node_ptr->power_status_query_active = false; node_ptr->power_status_query_done = false ; } } /***************************************************************************** * * Name : set_bm_prov * * Description: Manage the local provisioning state of the * board management connection. * * Assumptions: Does not set HTTP requests to sysinv so it is * safe to call from thje modify handler * * Does not clear alarms. * ******************************************************************************/ int nodeLinkClass::set_bm_prov ( struct nodeLinkClass::node * node_ptr, bool state ) { int rc = FAIL_HOSTNAME_LOOKUP ; if ( node_ptr != NULL ) { ilog ("%s bmc %sprovision request (provisioned:%s)\n", // ERIC blog node_ptr->hostname.c_str(), state ? "" : "de", node_ptr->bm_provisioned ? "Yes" : "No" ); /* Clear the alarm if we are starting fresh from an unprovisioned state */ if (( node_ptr->bm_provisioned == false ) && ( state == true )) { /* BMC is managed by IPMI/IPMITOOL */ ilog ("%s starting BM ping monitor to address '%s'\n", node_ptr->hostname.c_str(), node_ptr->bm_ip.c_str()); // mtcTimer_reset ( node_ptr->bm_ping_info.timer ); node_ptr->bm_ping_info.ip = node_ptr->bm_ip ; node_ptr->bm_ping_info.stage = PINGUTIL_MONITOR_STAGE__OPEN ; bmc_access_data_init ( node_ptr ); node_ptr->bm_ping_info.timer_handler = &mtcTimer_handler ; node_ptr->thread_extra_info.bm_pw = node_ptr->bm_pw = get_bm_password (node_ptr->uuid.data()); node_ptr->thread_extra_info.bm_ip = node_ptr->bm_ip ; node_ptr->thread_extra_info.bm_un = node_ptr->bm_un ; send_hwmon_command(node_ptr->hostname, MTC_CMD_ADD_HOST); send_hwmon_command(node_ptr->hostname, MTC_CMD_START_HOST); } /* handle the case going from provisioned to not provisioned */ else if (( node_ptr->bm_provisioned == true ) && ( state == false )) { /* BMC is managed by IPMI/IPMITOOL */ ilog ("%s deprovisioning bmc ; accessible:%s\n", node_ptr->hostname.c_str(), node_ptr->bm_accessible ? "Yes" : "No" ); pingUtil_fini ( node_ptr->bm_ping_info ); bmc_access_data_init ( node_ptr ); node_ptr->bm_accessible = false; if ( !thread_idle( node_ptr->ipmitool_thread_ctrl ) ) { thread_kill ( node_ptr->ipmitool_thread_ctrl , node_ptr->ipmitool_thread_info); } node_ptr->mc_info_query_active = false ; node_ptr->mc_info_query_done = false ; node_ptr->reset_cause_query_active = false ; node_ptr->reset_cause_query_done = false ; node_ptr->power_status_query_active = false; node_ptr->power_status_query_done = false ; /* send a delete to hwmon if the provisioning data is NONE */ if ( hostUtil_is_valid_bm_type ( node_ptr->bm_type ) == false ) { send_hwmon_command(node_ptr->hostname, MTC_CMD_DEL_HOST); } } if (( node_ptr->bm_provisioned == false ) && ( state == true )) { /* start the connection timer - if it expires before we * are 'accessible' then the BM Alarm is raised. * Timer is further managed in mtcNodeHdlrs.cpp */ plog ("%s bmc access timer started (%d secs)\n", node_ptr->hostname.c_str(), MTC_MINS_2); mtcTimer_reset ( node_ptr->bmc_access_timer ); mtcTimer_start ( node_ptr->bmc_access_timer, mtcTimer_handler, MTC_MINS_2 ); } node_ptr->bm_provisioned = state ; } return (rc); } string nodeLinkClass::get_bm_ip ( string hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return (node_ptr->bm_ip); } elog ("%s bm ip lookup failed\n", hostname.c_str() ); return (""); } string nodeLinkClass::get_bm_un ( string hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return (node_ptr->bm_un); } elog ("%s bm username lookup failed\n", hostname.c_str() ); return (""); } string nodeLinkClass::get_bm_type ( string hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return (node_ptr->bm_type); } elog ("%s bm type lookup failed\n", hostname.c_str() ); return (""); } string nodeLinkClass::get_hwmon_info ( string hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { string hwmon_info = "" ; hwmon_info.append( "{ \"personality\":\"" ) ; hwmon_info.append( node_ptr->type ); hwmon_info.append( "\""); hwmon_info.append( ",\"hostname\":\"" ) ; hwmon_info.append( node_ptr->hostname ); hwmon_info.append( "\""); hwmon_info.append( ",\"bm_ip\":\"" ) ; hwmon_info.append( node_ptr->bm_ip ); hwmon_info.append( "\""); hwmon_info.append( ",\"bm_type\":\""); hwmon_info.append( node_ptr->bm_type ); hwmon_info.append( "\""); hwmon_info.append( ",\"bm_username\":\""); hwmon_info.append( node_ptr->bm_un ); hwmon_info.append( "\""); hwmon_info.append( ",\"uuid\":\"" ) ; hwmon_info.append( node_ptr->uuid ); hwmon_info.append( "\" }"); return (hwmon_info); } elog ("%s hwmon info lookup failed\n", hostname.c_str() ); return (""); } int nodeLinkClass::manage_shadow_change ( string hostname ) { int rc = FAIL ; if ( ! hostname.empty() ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { rc = PASS ; if ( node_ptr->configAction == MTC_CONFIG_ACTION__NONE ) { node_ptr->configStage = MTC_CONFIG__START ; node_ptr->configAction = MTC_CONFIG_ACTION__CHANGE_PASSWD ; } else { node_ptr->configAction = MTC_CONFIG_ACTION__CHANGE_PASSWD_AGAIN ; } } } return (rc); } /** Returns the number of worker hosts that are operationally 'enabled' */ int nodeLinkClass::enabled_compute_nodes ( void ) { int temp_count = 0 ; for ( struct node * ptr = head ; ; ptr = ptr->next ) { if (( is_worker( ptr )) && ( ptr->operState == MTC_OPER_STATE__ENABLED )) { temp_count++ ; } else if (( is_worker_subfunction ( ptr )) && ( ptr->operState_subf == MTC_OPER_STATE__ENABLED )) { temp_count++ ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (temp_count); } /** Returns the number of storage hosts that are operationally 'enabled' */ int nodeLinkClass::enabled_storage_nodes ( void ) { int temp_count = 0 ; for ( struct node * ptr = head ; ; ptr = ptr->next ) { if (( is_storage( ptr ) ) && ( ptr->operState == MTC_OPER_STATE__ENABLED )) { temp_count++ ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (temp_count); } int nodeLinkClass::enabled_nodes ( void ) { int temp_count = 0 ; for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->operState == MTC_OPER_STATE__ENABLED ) { temp_count++ ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } /* Remove the active controller from the count */ if (temp_count) temp_count-- ; return (temp_count); } /** Returns the system's storage back end type ceph or nfs */ int nodeLinkClass::get_storage_backend ( void ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( is_storage(ptr) ) return ( CGCS_STORAGE_CEPH ) ; if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (CGCS_STORAGE_NFS); } /** Returns true if the storage pool has a monitor running on * an unlocked-enabled storage host */ bool nodeLinkClass::is_storage_mon_enabled ( void ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if (( is_storage(ptr) ) && ( ptr->operState == MTC_OPER_STATE__ENABLED ) && ( !ptr->hostname.compare("storage-0"))) { return ( true ) ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (false); } /** Returns number of enabled controllers */ int nodeLinkClass::num_controllers_enabled ( void ) { int cnt = 0 ; for ( struct node * ptr = head ; ; ptr = ptr->next ) { if (( is_controller(ptr) ) && ( ptr->operState == MTC_OPER_STATE__ENABLED )) { ++cnt ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (cnt); } /** Returns true if the specified hostname is provisioned */ bool nodeLinkClass::hostname_provisioned ( string hostname ) { bool provisioned = false ; for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->hostname.compare(hostname) == 0 ) { provisioned = true ; break ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } return (provisioned); } int nodeLinkClass::service_netlink_events ( int nl_socket , int ioctl_socket ) { std::list<string> links_gone_down ; std::list<string> links_gone_up ; std::list<string>::iterator iter_curr_ptr ; if ( get_netlink_events ( nl_socket, links_gone_down, links_gone_up )) { const char * mgmnt_iface_ptr = daemon_get_cfg_ptr()->mgmnt_iface ; const char * infra_iface_ptr = daemon_get_cfg_ptr()->infra_iface ; bool running = false ; if ( !links_gone_down.empty() ) { //wlog ("one or more links have dropped\n"); /* Look at the down list */ for ( iter_curr_ptr = links_gone_down.begin(); iter_curr_ptr != links_gone_down.end() ; iter_curr_ptr++ ) { bool care = false ; if ( iter_curr_ptr->size() == 0 ) continue ; if ( !strcmp (mgmnt_iface_ptr, iter_curr_ptr->data())) { care = true ; mgmnt_link_up_and_running = false ; wlog ("Management link %s is down\n", mgmnt_iface_ptr ); } if ( !strcmp (infra_iface_ptr, iter_curr_ptr->data())) { care = true ; infra_link_up_and_running = false ; wlog ("Infrastructure link %s is down\n", infra_iface_ptr ); } if ( care == true ) { if ( get_link_state ( ioctl_socket, iter_curr_ptr->data(), &running ) == PASS ) { wlog ("%s is down (oper:%s)\n", iter_curr_ptr->c_str(), running ? "up" : "down" ); } else { wlog ("%s is down (driver query failed)\n", iter_curr_ptr->c_str() ); } } } } if ( !links_gone_up.empty() ) { // wlog ("one or more links have recovered\n"); /* Look at the up list */ for ( iter_curr_ptr = links_gone_up.begin(); iter_curr_ptr != links_gone_up.end() ; iter_curr_ptr++ ) { bool care = false ; if ( iter_curr_ptr->size() == 0 ) continue ; if ( !strcmp (mgmnt_iface_ptr, iter_curr_ptr->data())) { mgmnt_link_up_and_running = true ; wlog ("Management link %s is up\n", mgmnt_iface_ptr ); } if ( !strcmp (infra_iface_ptr, iter_curr_ptr->data())) { infra_link_up_and_running = true ; wlog ("Infrastructure link %s is up\n", infra_iface_ptr ); } if ( care == true ) { if ( get_link_state ( ioctl_socket, iter_curr_ptr->data(), &running ) == PASS ) { wlog ("%s is up (oper:%s)\n", iter_curr_ptr->c_str(), running ? "up" : "down" ); } else { wlog ("%s is up (driver query failed)\n", iter_curr_ptr->c_str() ); } } } } } return (PASS); } /* *************************************************************************** * * Name : hbs_minor_clear * * Description: Clear the heartbeat minor state from the specified host. * * Manage overall mnfa counts and call mnfa_exit when the number crosses * the recovery threwshold. * ******************************************************************************/ void nodeLinkClass::hbs_minor_clear ( struct nodeLinkClass::node * node_ptr, iface_enum iface ) { if ( mnfa_host_count[iface] == 0 ) return ; /* Nothing to do if this host is not in the hbs_minor state */ if ( node_ptr->hbs_minor[iface] == true ) { /* clear it - possibly temporarily */ node_ptr->hbs_minor[iface] = false ; /* manage counts over heartbeat failure */ if ( mnfa_host_count[iface] ) { /* If we are mnfa_active AND now below the threshold * then trigger mnfa_exit */ if (( --mnfa_host_count[iface] < mnfa_threshold) && ( mnfa_active == true )) { wlog ("%s MNFA exit with graceful recovery (%s:%d)\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), mnfa_host_count[iface] ); /* re-activate this to true so that it is part * of the recovery group in mnfa_exit */ node_ptr->hbs_minor[iface] = true ; mnfa_exit ( false ); } /* Otherwise this is a single host that has recovered * possibly as part of a mnfa group or simply a lone wolf */ else { if ( node_ptr->mnfa_graceful_recovery == true ) { ilog ("%s MNFA removed from pool\n", node_ptr->hostname.c_str() ); mnfa_awol_list.remove(node_ptr->hostname); } mnfa_recover_host ( node_ptr ); if ( mnfa_active == true ) { /* Restart the heartbeat for this recovered host */ send_hbs_command ( node_ptr->hostname, MTC_RESTART_HBS ); /* don't restart graceful recovery for this host if its already in that FSM */ if ( node_ptr->adminAction != MTC_ADMIN_ACTION__RECOVER ) { recoveryStageChange ( node_ptr, MTC_RECOVERY__START ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__RECOVER ); } } } } } /* lets clean-up - walk the inventory and make sure the * avoidance count meets the number of hosts in the minor * degrade state */ int temp_count = 0 ; for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->hbs_minor[iface] == true ) { if ( ptr->operState != MTC_OPER_STATE__ENABLED ) { slog ("%s found hbs_minor set for disabled host\n" , ptr->hostname.c_str() ); } temp_count++ ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } if ( temp_count != mnfa_host_count[iface] ) { slog ("%s MNFA host tally (%s:%d incorrect - expected %d) ; correcting\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), mnfa_host_count[iface], temp_count ); mnfa_host_count[iface] = temp_count ; mnfa_host_count[iface] = temp_count ; } else { wlog ("%s MNFA host tally (%s:%d)\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), mnfa_host_count[iface] ); } } /**************************************************************************** * * Name : manage_dor_recovery * * Description: Enable DOR recovery mode for this host. * Generate log * * The severity parm is used to enhance the logs to indicate what * severity level this utility was called from ; * minor, major, or critical * ***************************************************************************/ void nodeLinkClass::manage_dor_recovery ( struct nodeLinkClass::node * node_ptr, EFmAlarmSeverityT severity ) { if (( severity == FM_ALARM_SEVERITY_CLEAR ) && ( node_ptr->dor_recovery_mode == true )) { node_ptr->dor_recovery_mode = false ; node_ptr->was_dor_recovery_mode = true ; } else if (( severity == FM_ALARM_SEVERITY_CRITICAL ) && ( node_ptr->dor_recovery_mode == false )) { struct timespec ts ; clock_gettime (CLOCK_MONOTONIC, &ts ); wlog ("%-12s is waiting ; DOR recovery %2ld:%02ld mins (%4ld secs)\n", node_ptr->hostname.c_str(), ts.tv_sec/60, ts.tv_sec%60, ts.tv_sec); node_ptr->dor_recovery_time = 0 ; node_ptr->dor_recovery_mode = true ; node_ptr->hbsClient_ready = false ; mtcInvApi_update_task ( node_ptr, MTC_TASK_RECOVERY_WAIT ); /* don't restart graceful recovery for this host if its already in that FSM */ if (( node_ptr->adminAction != MTC_ADMIN_ACTION__RECOVER ) && ( node_ptr->adminAction != MTC_ADMIN_ACTION__LOCK )) { recoveryStageChange ( node_ptr, MTC_RECOVERY__START ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__RECOVER ); } } } /** Manage heartbeat failure events */ void nodeLinkClass::manage_heartbeat_failure ( string hostname, iface_enum iface, bool clear_event ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown host\n", hostname.c_str()); return ; } /* Handle clear */ if ( clear_event == true ) { hbs_minor_clear ( node_ptr, iface ); plog ("%s %s Heartbeat failure clear\n", hostname.c_str(), get_iface_name_str(iface)); // if (( mnfa_host_count == 0 ) || ( iface == INFRA_IFACE )) if ( mnfa_host_count[iface] == 0 ) // || ( iface == INFRA_IFACE )) { slog ("%s %s Heartbeat failure clear\n", hostname.c_str(), get_iface_name_str(iface)); node_ptr->hbs_failure[iface] = false ; } } else if ( this->mtcTimer_dor.tid ) { manage_dor_recovery ( node_ptr, FM_ALARM_SEVERITY_CRITICAL ); } else { /* handle auto recovery for heartbeat failure during enable */ if ( node_ptr->ar_cause == MTC_AR_DISABLE_CAUSE__HEARTBEAT ) return ; else if ( node_ptr->enableStage == MTC_ENABLE__HEARTBEAT_SOAK ) { elog ("%s %s *** Heartbeat Loss *** (during enable soak)\n", hostname.c_str(), get_iface_name_str(iface)); if ( ar_manage ( node_ptr, MTC_AR_DISABLE_CAUSE__HEARTBEAT, MTC_TASK_AR_DISABLED_HEARTBEAT ) == PASS ) { mtcInvApi_update_task ( node_ptr, MTC_TASK_ENABLE_FAIL_HB ); enableStageChange ( node_ptr, MTC_ENABLE__FAILURE ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__NONE ); } return ; } mnfa_add_host ( node_ptr , iface ); if ( mnfa_active == false ) { elog ("%s %s *** Heartbeat Loss ***\n", hostname.c_str(), get_iface_name_str(iface)); if ( iface == INFRA_IFACE ) { node_ptr->heartbeat_failed[INFRA_IFACE] = true ; } else if ( iface == MGMNT_IFACE ) { node_ptr->heartbeat_failed[MGMNT_IFACE] = true ; } if (mnfa_host_count[iface] < this->mnfa_threshold) { elog ("%s %s network heartbeat failure\n", hostname.c_str(), get_iface_name_str(iface)); nodeLinkClass::set_availStatus ( hostname, MTC_AVAIL_STATUS__FAILED ); if (( node_ptr->adminAction != MTC_ADMIN_ACTION__ENABLE ) && ( node_ptr->adminAction != MTC_ADMIN_ACTION__UNLOCK )) { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__RECOVER ) { wlog ("%s restarting graceful recovery\n", hostname.c_str() ); } else { wlog ("%s starting graceful recovery\n", hostname.c_str() ); } recoveryStageChange ( node_ptr, MTC_RECOVERY__START ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__RECOVER ); } else { mtcInvApi_update_task ( node_ptr, MTC_TASK_ENABLE_FAIL_HB ); enableStageChange ( node_ptr, MTC_ENABLE__FAILURE ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__NONE ); } } } } } void nodeLinkClass::manage_heartbeat_clear ( string hostname, iface_enum iface ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown host\n", hostname.c_str()); return ; } if ( iface == MAX_IFACES ) { for ( int i = 0 ; i < MAX_IFACES ; i++ ) { node_ptr->heartbeat_failed[i] = false ; if ( i == MGMNT_IFACE ) { node_ptr->alarms[HBS_ALARM_ID__HB_MGMNT] = FM_ALARM_SEVERITY_CLEAR ; node_ptr->degrade_mask &= ~DEGRADE_MASK_HEARTBEAT_MGMNT ; } if ( i == INFRA_IFACE ) { node_ptr->alarms[HBS_ALARM_ID__HB_INFRA] = FM_ALARM_SEVERITY_CLEAR ; node_ptr->degrade_mask &= ~DEGRADE_MASK_HEARTBEAT_INFRA ; } } } else { node_ptr->heartbeat_failed[iface] = false ; if ( iface == MGMNT_IFACE ) { node_ptr->alarms[HBS_ALARM_ID__HB_MGMNT] = FM_ALARM_SEVERITY_CLEAR ; node_ptr->degrade_mask &= ~DEGRADE_MASK_HEARTBEAT_MGMNT ; } else if ( iface == INFRA_IFACE ) { node_ptr->alarms[HBS_ALARM_ID__HB_INFRA] = FM_ALARM_SEVERITY_CLEAR ; node_ptr->degrade_mask &= ~DEGRADE_MASK_HEARTBEAT_INFRA ; } } } /** Manage worker host maintenance based on this heartbeat * degrade event and others that may be present at this moment */ void nodeLinkClass::manage_heartbeat_degrade ( string hostname, iface_enum iface, bool clear_event ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown host\n", hostname.c_str()); return ; } if ( clear_event == true ) { alog ("%s %s Heartbeat Degrade (clear)\n", hostname.c_str(), get_iface_name_str(iface)); manage_heartbeat_clear ( hostname, iface ); if ( iface == MGMNT_IFACE ) { node_ptr->no_work_log_throttle = 0 ; node_ptr->degrade_mask &= ~DEGRADE_MASK_HEARTBEAT_MGMNT ; } else if ( iface == INFRA_IFACE ) { node_ptr->no_work_log_throttle = 0 ; node_ptr->degrade_mask &= ~DEGRADE_MASK_HEARTBEAT_INFRA ; } hbs_minor_clear ( node_ptr, iface ); } else if ( this->mtcTimer_dor.tid ) { manage_dor_recovery ( node_ptr, FM_ALARM_SEVERITY_MAJOR ); } else { if ( mnfa_active == false ) { wlog ("%s %s *** Heartbeat Miss ***\n", hostname.c_str(), get_iface_name_str(iface) ); } mnfa_add_host ( node_ptr, iface ); if ( nodeLinkClass::get_operState ( hostname ) == MTC_OPER_STATE__ENABLED ) { if ( iface == MGMNT_IFACE ) { /* Don't raise the alarm again if this host is already degraded */ if ( !(node_ptr->degrade_mask & DEGRADE_MASK_HEARTBEAT_MGMNT) ) { node_ptr->degrade_mask |= DEGRADE_MASK_HEARTBEAT_MGMNT ; } } if ( iface == INFRA_IFACE ) { if ( !(node_ptr->degrade_mask & DEGRADE_MASK_HEARTBEAT_INFRA) ) { node_ptr->degrade_mask |= DEGRADE_MASK_HEARTBEAT_INFRA ; } } } } } /** Manage heartbeat minor events */ void nodeLinkClass::manage_heartbeat_minor ( string hostname, iface_enum iface, bool clear_event ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown host\n", hostname.c_str()); return ; } /* is this a clear event ? */ if ( clear_event == true ) { alog ("%s %s Heartbeat Minor (clear)\n", hostname.c_str(), get_iface_name_str(iface)); hbs_minor_clear ( node_ptr, iface ); } /* if not a clear then only set if the host is enabled * - we don't care about disabled hosts */ else if ( nodeLinkClass::get_operState ( hostname ) == MTC_OPER_STATE__ENABLED ) { if ( this->mtcTimer_dor.tid ) { manage_dor_recovery ( node_ptr, FM_ALARM_SEVERITY_MINOR ); } else if ( node_ptr->hbs_minor[iface] != true ) { mnfa_add_host ( node_ptr, iface ); } } } /** Interface to declare that a key service on the * specified host is up, running and ready */ int nodeLinkClass::declare_service_ready ( string & hostname, unsigned int service ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host\n", hostname.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( service == MTC_SERVICE_PMOND ) { node_ptr->pmond_ready = true ; plog ("%s got pmond ready event\n", hostname.c_str()); /* A ready event means that pmond pocess has started. * Any previous history is gone. Cleanup mtce. * If there are still process issues on this host then * they will be reported again.*/ node_ptr->degrade_mask &= ~DEGRADE_MASK_PMON ; return (PASS); } else if ( service == MTC_SERVICE_HWMOND ) { node_ptr->hwmond_ready = true ; plog ("%s got hwmond ready event\n", hostname.c_str()); if ( node_ptr->bm_provisioned == true ) { send_hwmon_command ( node_ptr->hostname, MTC_CMD_ADD_HOST ); send_hwmon_command ( node_ptr->hostname, MTC_CMD_START_HOST ); } return (PASS); } else if ( service == MTC_SERVICE_RMOND ) { node_ptr->rmond_ready = true ; plog ("%s got rmond ready event\n", hostname.c_str()); return (PASS); } else if ( service == MTC_SERVICE_HEARTBEAT ) { if ( node_ptr->hbsClient_ready == false ) { node_ptr->hbsClient_ready = true ; plog ("%s got hbsClient ready event\n", hostname.c_str()); } return (PASS); } else { return (FAIL_BAD_CASE); } } /** Clear pmond degrade flag */ int nodeLinkClass::degrade_pmond_clear ( string & hostname ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host\n", hostname.c_str()); return (FAIL_UNKNOWN_HOSTNAME) ; } if ( node_ptr->degrade_mask ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_PMON ; } /* The only detectable inservice failures are process failures */ node_ptr->inservice_failed_subf = false ; node_ptr->inservice_failed = false ; return (PASS); } /* This private API handles event messages from collectd */ int nodeLinkClass::collectd_notify_handler ( string & hostname, string & resource, string & state ) { int rc = PASS ; nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host\n", hostname.c_str()); return (FAIL_UNKNOWN_HOSTNAME) ; } if ( state == "clear" ) { if ( node_ptr->degrade_mask & DEGRADE_MASK_COLLECTD ) { ilog("%s collectd degrade state change ; assert -> clear (%s)", hostname.c_str(), resource.c_str()); node_ptr->degrade_mask &= ~DEGRADE_MASK_COLLECTD ; } else { mlog3("%s collectd degrade 'clear' request (%s)", hostname.c_str(), resource.c_str()); } } else if ( state == "assert" ) { if ( (node_ptr->degrade_mask & DEGRADE_MASK_COLLECTD) == 0 ) { ilog("%s collectd degrade state change ; clear -> assert (due to %s)", hostname.c_str(), resource.c_str()); node_ptr->degrade_mask |= DEGRADE_MASK_COLLECTD ; } else { mlog3("%s collectd degrade 'assert' request (%s)", hostname.c_str(), resource.c_str()); } } else { wlog ("%s collectd degrade state unknown (%s)\n", hostname.c_str(), state.c_str()); rc = FAIL_OPERATION ; } return (rc); } /** Resource Monitor 'Clear' Event handler. * * The resource specified will be removed from the * 'degraded_resources_list' for specified host. * if there are no other degraded resources or other * degraded services/reasons against that host then * this handler will clear the degrade state for the * specified host all together. */ int nodeLinkClass::degrade_resource_clear ( string & hostname, string & resource ) { /* lr - Log Prefix Rmon */ string lr = hostname ; lr.append (" rmond:"); nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host\n", lr.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { /* Clear all resource degrade conditions if there is no resource specified */ /* this is used as a cleanup audit just in case things get stuck */ if ( resource.empty() ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_RESMON ; node_ptr->degraded_resources_list.clear () ; } else if (( node_ptr->degraded_resources_list.empty()) || ( node_ptr->degrade_mask == DEGRADE_MASK_NONE )) { dlog ("%s '%s' Non-Degraded Clear\n", lr.c_str(), resource.c_str()); } else { if (is_string_in_string_list (node_ptr->degraded_resources_list, resource)) { node_ptr->degraded_resources_list.remove(resource); ilog ("%s '%s' Degrade Clear\n", lr.c_str(), resource.c_str()); } else { wlog ("%s '%s' Unexpected Degrade Clear\n", lr.c_str(), resource.c_str()); } if ( node_ptr->degraded_resources_list.empty() ) { node_ptr->degrade_mask &= ~DEGRADE_MASK_RESMON ; ; } else { string degraded_resources = get_strings_in_string_list ( node_ptr->degraded_resources_list ); wlog ("%s Degraded Resource List: %s\n", lr.c_str(), degraded_resources.c_str()); } } } return (PASS); } /********************************************************************************* * * Name : node_degrade_control * * Purpose : Accept and handle degrade raise and clear requests from * external services. * * Description: Maintenance maintains a degrade mask with a bit representing * various services. The assertion of any one bit causes the host * to be degraded. All bits need to be cleared in orde to exit * the degrade state. * * Supported 'services' include * * "hwmon" - The Hardware Monitor process * * * Future services might be rmon and pmon * **********************************************************************************/ int nodeLinkClass::node_degrade_control ( string & hostname, int state, string service ) { int rc = FAIL_UNKNOWN_HOSTNAME ; nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr ) { unsigned int service_flag = 0 ; /* convert service string to degrade mask flag * - handle empty string and unsupported service */ if ( service.empty() ) { slog ("%s service not specified", hostname.c_str()); return (FAIL_STRING_EMPTY); } else if ( !service.compare("hwmon") ) { service_flag = DEGRADE_MASK_HWMON ; } else { slog ("%s service '%s' not supported\n", hostname.c_str(), service.c_str()); return (FAIL_INVALID_DATA); } switch ( state ) { /* Handle clear case */ case MTC_DEGRADE_CLEAR: { if ( node_ptr->degrade_mask & service_flag ) { ilog ("%s degrade 'clear' from '%s'\n", hostname.c_str(), service.c_str() ); } /* clear the mask regardless of host state */ node_ptr->degrade_mask &= ~service_flag ; rc = PASS ; break ; } /* Handle assertion case */ case MTC_DEGRADE_RAISE: { if (( node_ptr->degrade_mask & service_flag ) == 0 ) { wlog ("%s degrade 'assert' from '%s'\n", hostname.c_str(), service.c_str() ); node_ptr->degrade_mask |= service_flag ; } rc = PASS ; break ; } default: { wlog ("%s invalid degrade control request '%d'\n", hostname.c_str(), state); rc = FAIL_BAD_CASE ; break ; } } /* end switch */ } else { dlog ("%s Unknown Host\n", hostname.c_str()); } return (rc); } int nodeLinkClass::hwmon_recovery_monitor ( struct nodeLinkClass::node * node_ptr, int hwmon_event ) { int delay = MTC_MINS_15 ; if ( hwmon_event == MTC_EVENT_HWMON_POWERCYCLE ) { node_ptr->hwmon_powercycle.retries = 0 ; node_ptr->hwmon_powercycle.queries = 0 ; node_ptr->hwmon_powercycle.state = RECOVERY_STATE__MONITOR ; mtcTimer_reset ( node_ptr->hwmon_powercycle.recovery_timer ); mtcTimer_start ( node_ptr->hwmon_powercycle.recovery_timer, mtcTimer_handler, delay ); ilog ("%s starting hwmon 'powercycle' recovery monitor", node_ptr->hostname.c_str()); ilog ("%s ... uninterrupted completion time: %s", node_ptr->hostname.c_str(), future_time(delay)); } else if ( hwmon_event == MTC_EVENT_HWMON_RESET ) { node_ptr->hwmon_reset.retries = 0 ; node_ptr->hwmon_reset.queries = 0 ; node_ptr->hwmon_reset.state = RECOVERY_STATE__MONITOR ; mtcTimer_reset ( node_ptr->hwmon_reset.recovery_timer ); mtcTimer_start ( node_ptr->hwmon_reset.recovery_timer, mtcTimer_handler, delay ); ilog ("%s starting hwmon 'reset' recovery monitor", node_ptr->hostname.c_str()); ilog ("%s ... uninterrupted completion time: %s", node_ptr->hostname.c_str(), future_time(delay)); } return (PASS); } /* Hardware Monitor 'Action' Event method * * The hardware monitor daemon is calling out a sensor that * is operating out of spec. The command is the accompanying * action that hwmond requested as a recovery action to this failure. * The sensor is the sensor name that triggersed the event. */ int nodeLinkClass::invoke_hwmon_action ( string & hostname, int action, string & sensor ) { int rc = PASS ; nodeLinkClass::node * node_ptr = getNode ( hostname ) ; dlog ("%s request to '%s' due to critical sensor '%s' reading\n", hostname.c_str(), get_event_str(action).c_str(), sensor.c_str()); if ( node_ptr ) { if ( node_ptr->bm_accessible == false ) { wlog ("%s rejecting %s hwmon action request for '%s' sensor ; BMC not accessible\n", hostname.c_str(), get_event_str(action).c_str(), sensor.c_str()); return (PASS); } if ( action == MTC_EVENT_HWMON_RESET ) { if ( is_active_controller (hostname) == true ) { wlog ("%s refusing to 'reset' self due to critical '%s' sensor event\n", hostname.c_str(), sensor.c_str()); recovery_ctrl_init ( node_ptr->hwmon_reset ); return(rc); } /* Avoid interrupting higher priority powercycle action */ else if (( node_ptr->adminAction == MTC_ADMIN_ACTION__POWERCYCLE ) || ( node_ptr->hwmon_powercycle.state != RECOVERY_STATE__INIT )) { wlog ("%s bypassing 'reset' request while 'powercycle' already in progress (%s)\n", hostname.c_str(), sensor.c_str()); } else if ( node_ptr->adminAction != MTC_ADMIN_ACTION__NONE ) { wlog ("%s bypassing 'reset' request while '%s' action in progress (%s)\n", hostname.c_str(), get_adminAction_str(node_ptr->adminAction), sensor.c_str()); } else if ( node_ptr->hwmon_reset.state ) { wlog ("%s rejecting 'reset' request while already in progress (%s)\n", hostname.c_str(), sensor.c_str()); } else { if (( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) && ( node_ptr->operState == MTC_OPER_STATE__ENABLED )) { mtcTimer_reset ( node_ptr->hwmon_reset.recovery_timer ); mtcTimer_start ( node_ptr->hwmon_reset.recovery_timer, mtcTimer_handler, MTC_MINS_15 ); force_full_enable ( node_ptr ); } else { if ( node_ptr->adminAction != MTC_ADMIN_ACTION__RESET ) { elog ("%s starting 'reset' FSM\n", hostname.c_str()); mtcTimer_reset ( node_ptr->hwmon_reset.recovery_timer ); mtcTimer_start ( node_ptr->hwmon_reset.recovery_timer, mtcTimer_handler, MTC_MINS_15 ); adminActionChange ( node_ptr , MTC_ADMIN_ACTION__RESET ); } else { wlog ("%s mtce 'reset' action already in progress\n", hostname.c_str()); } } node_ptr->hwmon_reset.state = RECOVERY_STATE__HOLDOFF ; } } else if ( action == MTC_EVENT_HWMON_POWERCYCLE ) { if ( node_ptr->hwmon_powercycle.attempts > MAX_POWERCYCLE_ATTEMPT_RETRIES ) { wlog ("%s ignoring 'powercycle' request ; too many failed attempts (%d)\n", node_ptr->hostname.c_str(), node_ptr->hwmon_powercycle.attempts ); } else if ( is_active_controller (hostname) == true ) { wlog ("%s refusing to 'powercycle' self due to critical '%s' sensor event\n", hostname.c_str(), sensor.c_str()); recovery_ctrl_init ( node_ptr->hwmon_powercycle ) ; } else { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__POWERCYCLE ) { wlog ("%s bypassing 'powercycle' request while already in progress (%s)\n", hostname.c_str(), sensor.c_str()); } else if ( node_ptr->adminAction != MTC_ADMIN_ACTION__NONE ) { wlog ("%s bypassing 'powercycle' request while '%s' action in progress (%s)\n", hostname.c_str(), get_adminAction_str(node_ptr->adminAction), sensor.c_str()); } else if ( node_ptr->hwmon_powercycle.state == RECOVERY_STATE__COOLOFF ) { wlog ("%s avoiding 'powercycle' request while in powercycle recovery cooloff (%s)\n", hostname.c_str(), sensor.c_str()); } else if ( node_ptr->hwmon_powercycle.state == RECOVERY_STATE__HOLDOFF ) { wlog ("%s avoiding 'powercycle' request while in powercycle recovery holdoff (%s)\n", hostname.c_str(), sensor.c_str()); } else if ( node_ptr->hwmon_powercycle.state == RECOVERY_STATE__ACTION ) { wlog ("%s avoiding 'powercycle' request while already handling powercycle (%s)\n", hostname.c_str(), sensor.c_str()); } else if ( node_ptr->hwmon_powercycle.state == RECOVERY_STATE__BLOCKED ) { wlog ("%s avoiding 'powercycle' request ; host is powered off due to protect hardware from damage due to critical '%s' sensor\n", hostname.c_str(), sensor.c_str()); } else { if ( node_ptr->hwmon_powercycle.state == RECOVERY_STATE__MONITOR ) { wlog ("%s 'powercycle' request while in monitor phase (%s)\n", hostname.c_str(), sensor.c_str()); } /* Cancel the recovery timer only to have it started once the * next power cycle phase is complete */ mtcTimer_reset ( node_ptr->hwmon_powercycle.recovery_timer ); wlog ("%s invoking 'powercycle' due to critical '%s' sensor assertion\n", hostname.c_str(), sensor.c_str()); powercycleStageChange ( node_ptr, MTC_POWERCYCLE__START ); subStageChange ( node_ptr, MTC_SUBSTAGE__START ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__POWERCYCLE ); } } } else { slog ("%s '%s' action not supported as request from hwmond\n", hostname.c_str(), get_event_str(action).c_str()); rc = FAIL_BAD_PARM ; } } else { slog ("%s cannot '%s' due to unknown host\n", hostname.c_str(), get_event_str(action).c_str()); rc = FAIL_UNKNOWN_HOSTNAME ; } return (rc); } /* Generate a log for the reported failed process if that host is * unlocked */ int nodeLinkClass::log_process_failure ( string & hostname, string & process ) { /* lp - Log Prefix */ string lp = hostname ; lp.append (" pmon:"); nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host ; '%s' failed (minor)\n", lp.c_str(), process.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) { if ( process.compare("ntpd") ) { wlog ("%s '%s' process failed and is being auto recovered\n", lp.c_str(), process.c_str()); } else { wlog ("%s '%s' process has failed ; manual recovery action required\n", lp.c_str(), process.c_str()); } } return (PASS); } /* if unlocked-enabled generate an alarm for the reported failed process */ int nodeLinkClass::alarm_process_failure ( string & hostname, string & process ) { /* lp - Log Prefix */ string lp = hostname ; lp.append (" pmon:"); nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host ; '%s' failed (minor)\n", lp.c_str(), process.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) { /* TODO: Generate Alarm here */ wlog ("%s '%s' failed (minor)\n", lp.c_str(), process.c_str()); } return (PASS); } /* Generate a log for the reported failed resource if that host is * unlocked */ int nodeLinkClass::log_resource_failure ( string & hostname, string & resource ) { /* lr - Log Prefix Rmond */ string lr = hostname ; lr.append (" rmond:"); nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host ; '%s' failed (minor)\n", lr.c_str(), resource.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) { ilog ("%s '%s' failed (minor)\n", lr.c_str(), resource.c_str()); } return (PASS); } /** Process Monitor Degrade Event handler. * * The host will enter degrade state due to the specified process * not running properly. The process name is recorded in the * 'degraded_processes_list' for specified host. * Clearing degrade against this process requires that host to * send a clear event against that process or for that host to * fully re-enable */ int nodeLinkClass::degrade_process_raise ( string & hostname, string & process ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host\n", hostname.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { if ( (node_ptr->degrade_mask & DEGRADE_MASK_PMON) == 0 ) { node_ptr->degrade_mask |= DEGRADE_MASK_PMON ; wlog ("%s is degraded due to '%s' process failure\n", hostname.c_str(), process.c_str()); } } return (PASS); } /* * Name : update_dport_states * * Purpose: Update data port states based on the event severity * * CLEAR = enabled-available * MAJOR = enabled-degraded * CRITICAL = disabled-failed * */ int update_dport_states_throttle = 0 ; int nodeLinkClass::update_dport_states ( struct nodeLinkClass::node * node_ptr, int event ) { int rc = PASS ; /* if the host is locked then report the data ports as offline */ if ( node_ptr->adminState == MTC_ADMIN_STATE__LOCKED ) { event = MTC_EVENT_AVS_OFFLINE ; } switch (event) { case MTC_EVENT_AVS_OFFLINE: { if ( node_ptr->operState_dport != MTC_OPER_STATE__DISABLED ) { ilog ("%s data port 'operState' change from '%s' -> 'disabled'", node_ptr->hostname.c_str(), operState_enum_to_str(node_ptr->operState_dport).c_str()); node_ptr->operState_dport = MTC_OPER_STATE__DISABLED ; } if ( node_ptr->availStatus_dport != MTC_AVAIL_STATUS__OFFLINE ) { ilog ("%s data port 'availStat' change from '%s' -> 'offline'", node_ptr->hostname.c_str(), availStatus_enum_to_str(node_ptr->availStatus_dport).c_str()); node_ptr->availStatus_dport = MTC_AVAIL_STATUS__OFFLINE ; } break ; } case MTC_EVENT_AVS_CLEAR: { bool state_change = false ; if ( node_ptr->operState_dport != MTC_OPER_STATE__ENABLED ) { ilog ("%s data port 'operState' change from '%s' -> 'enabled'", node_ptr->hostname.c_str(), operState_enum_to_str(node_ptr->operState_dport).c_str()); node_ptr->operState_dport = MTC_OPER_STATE__ENABLED ; state_change = true ; } if ( node_ptr->availStatus_dport != MTC_AVAIL_STATUS__AVAILABLE ) { ilog ("%s data port 'availStat' change from '%s' -> 'available'", node_ptr->hostname.c_str(), availStatus_enum_to_str(node_ptr->availStatus_dport).c_str()); node_ptr->availStatus_dport = MTC_AVAIL_STATUS__AVAILABLE ; state_change = true ; } /** If there has been s state change as a result of a * clear then send that to the VIM immediately **/ if ( state_change == true ) { /* Inform the VIM of the data port state change */ mtcVimApi_state_change ( node_ptr, VIM_DPORT_CLEARED, 3 ); } break ; } case MTC_EVENT_AVS_MAJOR: { if ( node_ptr->operState_dport != MTC_OPER_STATE__ENABLED ) { ilog ("%s data port 'operState' change from '%s' -> 'enabled'", node_ptr->hostname.c_str(), operState_enum_to_str(node_ptr->operState_dport).c_str()); node_ptr->operState_dport = MTC_OPER_STATE__ENABLED ; } if ( node_ptr->availStatus_dport != MTC_AVAIL_STATUS__DEGRADED ) { wlog ("%s data port 'availStat' change from '%s' -> 'degraded'", node_ptr->hostname.c_str(), availStatus_enum_to_str(node_ptr->availStatus_dport).c_str()); node_ptr->availStatus_dport = MTC_AVAIL_STATUS__DEGRADED ; } break ; } case MTC_EVENT_AVS_CRITICAL: { if ( node_ptr->operState_dport != MTC_OPER_STATE__DISABLED ) { elog ("%s data port 'operState' change from '%s' -> 'disabled'", node_ptr->hostname.c_str(), operState_enum_to_str(node_ptr->operState_dport).c_str()); node_ptr->operState_dport = MTC_OPER_STATE__DISABLED ; } if ( node_ptr->availStatus_dport != MTC_AVAIL_STATUS__FAILED ) { elog ("%s data port 'availStat' change from '%s' -> 'failed'", node_ptr->hostname.c_str(), availStatus_enum_to_str(node_ptr->availStatus_dport).c_str()); node_ptr->availStatus_dport = MTC_AVAIL_STATUS__FAILED ; } break ; } default: { wlog_throttled (update_dport_states_throttle, 10, "Invalid port state (%x)\n", event ); rc = FAIL_BAD_CASE ; } } return (rc); } /** Resource Monitor 'Raise' Event handler. * * The host will enter degrade state due to the specified resource * threshold being surpased. The resource name is recorded in the * 'degraded_resources_list' for specified host. * Clearing degrade against this resource requires that host to * send a clear event against that resource or for that host to * fully re-enable */ int nodeLinkClass::degrade_resource_raise ( string & hostname, string & resource ) { /* lr - Log Prefix Rmond */ string lr = hostname ; lr.append (" rmond:"); nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s Unknown Host\n", lr.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } else if ( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) { if ( is_string_in_string_list ( node_ptr->degraded_resources_list, resource ) == false ) { string degraded_resources = ""; ilog ("%s '%s' Degraded\n", lr.c_str(), resource.c_str()); node_ptr->degraded_resources_list.push_back (resource); node_ptr->degrade_mask |= DEGRADE_MASK_RESMON ; /* Cleanup the list */ node_ptr->degraded_resources_list.sort (); node_ptr->degraded_resources_list.unique (); degraded_resources = get_strings_in_string_list ( node_ptr->degraded_resources_list ); wlog ("%s Failing Resources: %s\n", lr.c_str(), degraded_resources.c_str()); } else { dlog ("%s '%s' Degraded (again)\n", lr.c_str(), resource.c_str()); } } return (PASS); } /** Process Monitor 'Critical Process Failed' Event handler. * * This utility handles critical process failure event notifications. * Typically this interface will force a host re-enable through reset. * * For AIO Simplex this failure sets the auto recovery bool * so that the main enable FSM can handle it through a thresholded * self reboot. * * That as well as all other failure handling cases are deferred to * the enable handler's from failure case. * **/ int nodeLinkClass::critical_process_failed( string & hostname, string & process, unsigned int nodetype ) { UNUSED(nodetype); nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s pmon: Unknown host\n", hostname.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } if (( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) && ( node_ptr->operState == MTC_OPER_STATE__ENABLED )) { elog ("%s has critical '%s' process failure\n", hostname.c_str(), process.c_str()); node_ptr->degrade_mask |= DEGRADE_MASK_PMON ; /* Special critical process failure handling for AIO system */ if ( THIS_HOST && ( is_inactive_controller_main_insv() == false )) { if ( node_ptr->ar_disabled == true ) { dlog ("%s bypassing persistent critical process failure\n", node_ptr->hostname.c_str()); return (PASS); } dlog ("%s critical process failure (aio)\n", node_ptr->hostname.c_str()); /* dlog */ } /* Start fresh the next time we enter graceful recovery handler */ node_ptr->graceful_recovery_counter = 0 ; /* Set node as unlocked-disabled-failed */ allStateChange ( node_ptr, MTC_ADMIN_STATE__UNLOCKED, MTC_OPER_STATE__DISABLED, MTC_AVAIL_STATUS__FAILED ); enableStageChange ( node_ptr, MTC_ENABLE__FAILURE ); adminActionChange ( node_ptr, MTC_ADMIN_ACTION__NONE ); dlog ("%s adminState:%s EnableStage:%s\n", node_ptr->hostname.c_str(), adminAction_enum_to_str(node_ptr->adminAction).c_str(), get_enableStages_str(node_ptr->enableStage).c_str()); } return (PASS); } /** Resource Monitor 'Failed' Event handler. * * The host will go out of service, be reset and * automatically re-enabled. */ int nodeLinkClass::critical_resource_failed( string & hostname, string & resource ) { nodeLinkClass::node * node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { wlog ("%s rmond: Unknown host\n", hostname.c_str()); return FAIL_UNKNOWN_HOSTNAME ; } if (( node_ptr->adminState == MTC_ADMIN_STATE__UNLOCKED ) && ( node_ptr->operState == MTC_OPER_STATE__ENABLED )) { /* Start fresh the next time we enter graceful recovery handler */ node_ptr->graceful_recovery_counter = 0 ; elog ("%s rmond: Critical Resource '%s' Failure\n", hostname.c_str(), resource.c_str()); /* Set node as unlocked-enabled */ allStateChange ( node_ptr, MTC_ADMIN_STATE__UNLOCKED, MTC_OPER_STATE__DISABLED, MTC_AVAIL_STATUS__FAILED ); } return (PASS); } bool nodeLinkClass::is_active_controller ( string hostname ) { if ( nodeLinkClass::my_hostname.compare(hostname) ) { return (false) ; } return (true); } string nodeLinkClass::get_inactive_controller_hostname ( void ) { return (inactive_controller_hostname); } void nodeLinkClass::set_inactive_controller_hostname ( string hostname ) { inactive_controller_hostname = hostname ; } string nodeLinkClass::get_active_controller_hostname ( void ) { return (active_controller_hostname); } void nodeLinkClass::set_active_controller_hostname ( string hostname ) { active_controller_hostname = hostname ; } bool nodeLinkClass::inactive_controller_is_patched ( void ) { nodeLinkClass::node * node_ptr = getNode ( inactive_controller_hostname ) ; if ( node_ptr != NULL ) { return ( node_ptr->patched ); } return (false) ; } bool nodeLinkClass::inactive_controller_is_patching ( void ) { nodeLinkClass::node * node_ptr = getNode ( inactive_controller_hostname ) ; if ( node_ptr != NULL ) { return ( node_ptr->patching ); } return (false) ; } bool nodeLinkClass::is_inactive_controller_main_insv ( void ) { nodeLinkClass::node * node_ptr = getNode ( inactive_controller_hostname ) ; if ( node_ptr != NULL ) { if ( node_ptr->operState == MTC_OPER_STATE__ENABLED ) { return (true) ; } } return (false) ; } bool nodeLinkClass::is_inactive_controller_subf_insv ( void ) { nodeLinkClass::node * node_ptr = getNode ( inactive_controller_hostname ) ; if ( node_ptr != NULL ) { if ( node_ptr->operState_subf == MTC_OPER_STATE__ENABLED ) { return (true) ; } } return (false) ; } int nodeLinkClass::set_subf_info ( string hostname, string functions, string operState_subf, string availState_subf ) { int rc = FAIL_HOSTNAME_LOOKUP ; if ( functions.empty() ) { elog ("%s called with empty 'functions' string\n", hostname.c_str()); return (FAIL_STRING_EMPTY); } nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { node_ptr->functions = functions ; node_ptr->operState_subf = operState_str_to_enum(operState_subf.data()); node_ptr->availStatus_subf = availStatus_str_to_enum(availState_subf.data()); rc = update_host_functions ( hostname, functions ); } return (rc); } /********************************************************************************** * * Name : update_host_functions * * Purpose: Loads a nodeLinkClass with function information based on a comma * delimited function string like. * * controller * worker * storage * controller,worker * controller,storage * **********************************************************************************/ int nodeLinkClass::update_host_functions ( string hostname , string functions ) { int rc = FAIL ; if ( functions.empty() ) { elog ("%s called with empty 'functions' string\n", hostname.c_str()); return (rc); } nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { node_ptr->functions = functions ; if ( set_host_functions ( functions, &node_ptr->nodetype, &node_ptr->function, &node_ptr->subfunction ) != PASS ) { elog ("%s failed to extract nodetype\n", hostname.c_str()); rc = FAIL_NODETYPE; } else { if ( node_ptr->function == CONTROLLER_TYPE ) node_ptr->function_str = "controller" ; else if ( node_ptr->function == WORKER_TYPE ) node_ptr->function_str = "worker" ; else if ( node_ptr->function == STORAGE_TYPE ) node_ptr->function_str = "storage" ; else node_ptr->function_str = "" ; if ( node_ptr->subfunction == WORKER_TYPE ) { node_ptr->subfunction_str = "worker" ; } else if ( node_ptr->subfunction == STORAGE_TYPE ) { node_ptr->subfunction_str = "storage" ; } else node_ptr->subfunction_str = "" ; } rc = PASS ; } return (rc); } /** Fetch the node type (worker or controller) by hostname */ int nodeLinkClass::get_nodetype ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { return ( node_ptr->nodetype ); } return (false); } /** Check if a node is a controller */ bool nodeLinkClass::is_controller ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr != NULL ) { if ( (node_ptr->function & CONTROLLER_TYPE ) == CONTROLLER_TYPE ) { return (true); } } return (false); } /** Check if a node is a worker */ bool nodeLinkClass::is_worker_subfunction ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr != NULL ) { if ( (node_ptr->subfunction & WORKER_TYPE ) == WORKER_TYPE ) { return (true); } } return (false); } /** Check if a node is a worker */ bool nodeLinkClass::is_worker ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr != NULL ) { if ( (node_ptr->function & WORKER_TYPE ) == WORKER_TYPE ) { return (true); } } return (false); } /** Check if a node is a storage */ bool nodeLinkClass::is_storage ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr != NULL ) { if ( (node_ptr->function & STORAGE_TYPE ) == STORAGE_TYPE ) { return (true); } } return (false); } string nodeLinkClass::get_node_function_str ( string hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ); if ( node_ptr != NULL ) { return node_ptr->function_str ; } return "unknown" ; } string nodeLinkClass::get_node_subfunction_str ( string hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ); if ( node_ptr != NULL ) { return node_ptr->subfunction_str ; } return "unknown" ; } /** Check if a node is a controller */ bool nodeLinkClass::is_controller ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ); if ( node_ptr ) { return is_controller(node_ptr); } return false ; } /** Check if a node is a worker */ bool nodeLinkClass::is_worker ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ); if ( node_ptr ) { return is_worker(node_ptr); } return false ; } /** Check if a node is a worker */ bool nodeLinkClass::is_worker_subfunction ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ); if ( node_ptr ) { return is_worker_subfunction(node_ptr); } return false ; } /** Check if a node is a storage */ bool nodeLinkClass::is_storage ( string & hostname ) { nodeLinkClass::node * node_ptr = getNode ( hostname ); if ( node_ptr ) { return is_storage(node_ptr); } return false ; } /** Maintenance FSM Test Case Setup procedure */ int nodeLinkClass::set_enableStage ( string & hostname, mtc_enableStages_enum stage ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { node_ptr->enableStage = stage ; return (PASS); } return (FAIL); } /* Set the reboot stage */ int nodeLinkClass::set_rebootStage ( string & hostname, mtc_resetProgStages_enum stage ) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { node_ptr->resetProgStage = stage ; return (PASS); } return (FAIL); } /** Maintenance FSM Test Case Setup procedure */ mtc_enableStages_enum nodeLinkClass::get_enableStage ( string & hostname) { nodeLinkClass::node * node_ptr = getNode ( hostname ) ; if ( node_ptr != NULL ) { return ( node_ptr->enableStage ) ; } return (MTC_ENABLE__STAGES); } int nodeLinkClass::allStateChange ( struct nodeLinkClass::node * node_ptr, mtc_nodeAdminState_enum adminState, mtc_nodeOperState_enum operState, mtc_nodeAvailStatus_enum availStatus ) { int rc = FAIL ; if (( adminState < MTC_ADMIN_STATES ) && ( operState < MTC_OPER_STATES ) && ( availStatus < MTC_AVAIL_STATUS )) { bool change = false ; if (( node_ptr->adminState != adminState ) || ( node_ptr->operState != operState ) || ( node_ptr->availStatus != availStatus )) { change = true ; } string admin = mtc_nodeAdminState_str [adminState ] ; string oper = mtc_nodeOperState_str [operState ] ; string avail = mtc_nodeAvailStatus_str[availStatus] ; rc = mtcInvApi_force_states ( node_ptr, admin, oper, avail ); admin_state_change ( node_ptr->hostname, admin ); if ((( operState == MTC_OPER_STATE__DISABLED ) && ( node_ptr->operState != MTC_OPER_STATE__DISABLED )) && (( availStatus == MTC_AVAIL_STATUS__FAILED ) && ( node_ptr->availStatus != MTC_AVAIL_STATUS__FAILED ))) { failed_state_change ( node_ptr ); } else { oper_state_change ( node_ptr->hostname, oper ); avail_status_change ( node_ptr->hostname, avail ); } if ( change == true ) { /* after */ ilog ("%s %s-%s-%s (seq:%d)\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str [node_ptr->adminState ], mtc_nodeOperState_str [node_ptr->operState ], mtc_nodeAvailStatus_str[node_ptr->availStatus], node_ptr->oper_sequence-1); } } else { slog ("Invalid State (%d:%d:%d)\n", adminState, operState, availStatus ); } return (rc); } int nodeLinkClass::subfStateChange ( struct nodeLinkClass::node * node_ptr, mtc_nodeOperState_enum operState_subf, mtc_nodeAvailStatus_enum availStatus_subf ) { int rc = FAIL ; if (( operState_subf < MTC_OPER_STATES ) && ( availStatus_subf < MTC_AVAIL_STATUS )) { bool change = false ; if (( node_ptr->operState_subf != operState_subf ) || ( node_ptr->availStatus_subf != availStatus_subf )) { change = true ; } string oper = mtc_nodeOperState_str [operState_subf ] ; string avail = mtc_nodeAvailStatus_str[availStatus_subf] ; rc = mtcInvApi_subf_states ( node_ptr, oper, avail ); node_ptr->operState_subf = operState_subf ; node_ptr->availStatus_subf = availStatus_subf; if ( change == true ) { /* after */ ilog ("%s-%s %s-%s-%s (seq:%d)\n", node_ptr->hostname.c_str(), node_ptr->subfunction_str.c_str(), mtc_nodeAdminState_str [node_ptr->adminState ], mtc_nodeOperState_str [node_ptr->operState_subf ], mtc_nodeAvailStatus_str[node_ptr->availStatus_subf], node_ptr->oper_sequence-1); } } else { slog ("Invalid State (%d:%d:%d)\n", node_ptr->adminState, availStatus_subf, availStatus_subf ); } return (rc); } /** * Set the required action and then let the FSP and handlers deal with it * If we are in an action already then just add the action to the * action todo list. When we chnage the action to none then query the * todo list and pop it off and apply it **/ int nodeLinkClass::adminActionChange ( struct nodeLinkClass::node * node_ptr, mtc_nodeAdminAction_enum newActionState ) { int rc = FAIL ; if (( newActionState < MTC_ADMIN_ACTIONS ) && ( node_ptr->adminAction < MTC_ADMIN_ACTIONS )) { rc = PASS ; if ( node_ptr->adminAction == newActionState ) { /* no action change */ return (rc); } /** * Any of these actions need to complete before any * other action can take effect. * If its not one of these action then just proceed with it **/ if (( node_ptr->adminAction != MTC_ADMIN_ACTION__ADD ) && ( node_ptr->adminAction != MTC_ADMIN_ACTION__FORCE_LOCK )) { clog ("%s Administrative Action '%s' -> '%s'\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [node_ptr->adminAction], mtc_nodeAdminAction_str [newActionState]); } /* handle queue'd requests if here are any and * we are done with the curent action */ else if (( newActionState == MTC_ADMIN_ACTION__NONE ) && ( !node_ptr->adminAction_todo_list.empty())) { newActionState = *(node_ptr->adminAction_todo_list.begin()); node_ptr->adminAction_todo_list.pop_front(); clog ("%s Administrative Action '%s' -> '%s' from queue\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [node_ptr->adminAction], mtc_nodeAdminAction_str [newActionState]); } /* queue the request if we are already acting on a current action * ... handle unsupported action queueing conditions */ else if (( node_ptr->adminAction != MTC_ADMIN_ACTION__NONE ) && ( newActionState != MTC_ADMIN_ACTION__NONE )) { /* refuse to add duplicate action */ if ( newActionState == node_ptr->adminAction ) { wlog ("%s refusing to queue duplicate of current action (%s)\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [node_ptr->adminAction] ); return (FAIL); } else if ( node_ptr->adminAction_todo_list.size() >= MTC_MAX_QUEUED_ACTIONS ) { wlog ("%s rejecting action '%s' request ; max queued actions reached (%ld of %d)\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [newActionState], node_ptr->adminAction_todo_list.size(), MTC_MAX_QUEUED_ACTIONS ); return (FAIL); } /* refuse to queue action that already exists in the queue */ else { list<mtc_nodeAdminAction_enum>::iterator adminAction_todo_list_ptr ; for ( adminAction_todo_list_ptr = node_ptr->adminAction_todo_list.begin(); adminAction_todo_list_ptr != node_ptr->adminAction_todo_list.end(); adminAction_todo_list_ptr++ ) { if ( *adminAction_todo_list_ptr == newActionState ) { wlog ("%s refusing to queue duplicate already queued action (%s)\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [*adminAction_todo_list_ptr]); return (FAIL); } } } /* Add the action to the action todo list */ node_ptr->adminAction_todo_list.push_back( newActionState ); ilog ("%s Administrative Action '%s' queued ; already handling '%s' action\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [newActionState], mtc_nodeAdminAction_str [node_ptr->adminAction]); return (PASS); } /* otherwise just take the action change */ else { clog ("%s Administrative Action '%s' -> '%s'\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [node_ptr->adminAction], mtc_nodeAdminAction_str [newActionState]); } mtc_nodeAdminAction_enum oldActionState = node_ptr->adminAction ; log_adminAction ( node_ptr->hostname, oldActionState, newActionState ); node_ptr->adminAction = newActionState ; node_ptr->action = mtc_nodeAdminAction_str [node_ptr->adminAction] ; /* If we are starting a new ( not 'none' ) action ... * be sure we start at the beginning */ if ( newActionState != MTC_ADMIN_ACTION__NONE ) { if (( oldActionState == MTC_ADMIN_ACTION__POWERCYCLE ) && (( newActionState != MTC_ADMIN_ACTION__POWERCYCLE ) && ( newActionState != MTC_ADMIN_ACTION__POWEROFF ))) { blog ("%s (mon:%d:prov:%d)\n", node_ptr->hostname.c_str(), node_ptr->hwmond_monitor, node_ptr->bm_provisioned ); if (( node_ptr->hwmond_monitor == false ) && ( node_ptr->bm_provisioned == true )) { send_hwmon_command ( node_ptr->hostname, MTC_CMD_ADD_HOST ); send_hwmon_command ( node_ptr->hostname, MTC_CMD_START_HOST ); } } /* Lets ensure that the handlers start in the right stage * The enable_handler -> MTC_ENABLE__START * The disable_handler -> MTC_DISABLE__START * The reset_handler -> MTC_RESET__START * The reboot_handler -> MTC_RESET__START * * This is a little detailed but exists for maintainability * All START stages are 0. */ switch ( newActionState ) { case MTC_ADMIN_ACTION__UNLOCK: { if ( oldActionState != MTC_ADMIN_ACTION__UNLOCK ) { node_ptr->node_unlocked_counter++ ; } ar_enable (node_ptr); node_ptr->enableStage = MTC_ENABLE__START ; break ; } case MTC_ADMIN_ACTION__LOCK: case MTC_ADMIN_ACTION__FORCE_LOCK: { node_ptr->disableStage = MTC_DISABLE__START ; break ; } case MTC_ADMIN_ACTION__RESET: { node_ptr->resetStage = MTC_RESET__START ; break ; } case MTC_ADMIN_ACTION__REBOOT: { break ; } case MTC_ADMIN_ACTION__REINSTALL: { node_ptr->reinstallStage = MTC_REINSTALL__START ; break ; } case MTC_ADMIN_ACTION__POWERON: { node_ptr->powerStage = MTC_POWERON__START ; break ; } case MTC_ADMIN_ACTION__RECOVER: { if ( node_ptr->mtcTimer.tid ) { mtcTimer_stop ( node_ptr->mtcTimer ) ; } if ( node_ptr->mtcSwact_timer.tid ) { mtcTimer_stop ( node_ptr->mtcSwact_timer ) ; } node_ptr->recoveryStage = MTC_RECOVERY__START ; break ; } case MTC_ADMIN_ACTION__POWEROFF: { node_ptr->powerStage = MTC_POWEROFF__START ; break ; } case MTC_ADMIN_ACTION__DELETE: { node_ptr->delStage = MTC_DEL__START ; break ; } case MTC_ADMIN_ACTION__ENABLE: default: { break ; } } } } return (rc); } int nodeLinkClass::adminStateChange ( struct nodeLinkClass::node * node_ptr, mtc_nodeAdminState_enum newAdminState ) { int rc = FAIL ; if (( newAdminState < MTC_ADMIN_STATES ) && ( node_ptr->adminState < MTC_ADMIN_STATES )) { rc = PASS ; /* See if we are actually changing the state */ if ( node_ptr->adminState != newAdminState ) { ilog ("%s %s-%s-%s' -> %s-%s-%s\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str [node_ptr->adminState], mtc_nodeOperState_str [node_ptr->operState], mtc_nodeAvailStatus_str[node_ptr->availStatus], mtc_nodeAdminState_str [newAdminState], mtc_nodeOperState_str [node_ptr->operState], mtc_nodeAvailStatus_str[node_ptr->availStatus]); node_ptr->adminState = newAdminState ; } } else { slog ("Invalid Host Operational State (now:%d new:%d)\n", node_ptr->adminState, newAdminState ); } return (rc); } int nodeLinkClass::operStateChange ( struct nodeLinkClass::node * node_ptr, mtc_nodeOperState_enum newOperState ) { int rc = FAIL ; if (( newOperState < MTC_OPER_STATES ) && ( node_ptr->operState < MTC_OPER_STATES )) { rc = PASS ; /* See if we are actually changing the state */ if ( node_ptr->operState != newOperState ) { clog ("%s %s-%s-%s\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str [node_ptr->adminState], mtc_nodeOperState_str [node_ptr->operState], mtc_nodeAvailStatus_str[node_ptr->availStatus]); /* Push it to the database */ if ( node_ptr->uuid.length() == UUID_LEN ) { string key = MTC_JSON_INV_OPER ; string value = operState_enum_to_str(newOperState) ; rc = mtcInvApi_update_state ( node_ptr, key, value ); } else { wlog ("%s has invalid uuid:%s so %s state not written to database\n", node_ptr->hostname.c_str(), node_ptr->uuid.c_str(), operState_enum_to_str(newOperState).c_str()); } node_ptr->operState = newOperState ; clog ("%s %s-%s-%s\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str [node_ptr->adminState], mtc_nodeOperState_str [node_ptr->operState], mtc_nodeAvailStatus_str[node_ptr->availStatus]); } } else { slog ("Invalid Host Operational State (now:%d new:%d)\n", node_ptr->operState, newOperState ); } return (rc); } int nodeLinkClass::availStatusChange ( struct nodeLinkClass::node * node_ptr, mtc_nodeAvailStatus_enum newAvailStatus ) { int rc = FAIL ; if (( newAvailStatus < MTC_AVAIL_STATUS ) && ( node_ptr->availStatus < MTC_AVAIL_STATUS )) { rc = PASS ; /* See if we are actually changing the state */ if ( node_ptr->availStatus != newAvailStatus ) { clog ("%s %s-%s-%s\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str [node_ptr->adminState], mtc_nodeOperState_str [node_ptr->operState], mtc_nodeAvailStatus_str[node_ptr->availStatus]); /* Push it to the database */ if ( node_ptr->uuid.length() == UUID_LEN ) { string key = MTC_JSON_INV_AVAIL ; string value = availStatus_enum_to_str(newAvailStatus) ; rc = mtcInvApi_update_state ( node_ptr, key, value ); if ( rc != PASS ) { wlog ("%s Failed to update availability '%s' to '%s'\n", node_ptr->hostname.c_str(), mtc_nodeAvailStatus_str[node_ptr->availStatus], mtc_nodeAvailStatus_str[newAvailStatus]); } } else { wlog ("%s has invalid uuid:%s so %s state not written to database\n", node_ptr->hostname.c_str(), node_ptr->uuid.c_str(), availStatus_enum_to_str(newAvailStatus).c_str()); } if (( node_ptr->operState == MTC_OPER_STATE__ENABLED ) && (( node_ptr->availStatus == MTC_AVAIL_STATUS__AVAILABLE ) || ( node_ptr->availStatus == MTC_AVAIL_STATUS__DEGRADED )) && ( newAvailStatus == MTC_AVAIL_STATUS__FAILED )) { enableStageChange ( node_ptr, MTC_ENABLE__START ); } /* if we go to the failed state then clear all mtcAlive counts * so that the last ones don't look like we are online when we * might not be - we should relearn the on/off line state */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__FAILED ) && ( newAvailStatus == MTC_AVAIL_STATUS__FAILED )) { node_ptr->mtcAlive_misses = 0 ; node_ptr->mtcAlive_hits = 0 ; node_ptr->mtcAlive_gate = false ; } /* check for need to generate power on log */ if (( node_ptr->availStatus == MTC_AVAIL_STATUS__POWERED_OFF ) && ( newAvailStatus != MTC_AVAIL_STATUS__POWERED_OFF )) { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__POWERON ) { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_MANUAL_POWER_ON ); } else { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_AUTO_POWER_ON ); } } /* check for need to generate power off log */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__POWERED_OFF ) && ( newAvailStatus == MTC_AVAIL_STATUS__POWERED_OFF )) { if ( node_ptr->adminAction == MTC_ADMIN_ACTION__POWEROFF ) { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_MANUAL_POWER_OFF ); } else { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__COMMAND_AUTO_POWER_OFF ); } } /* check for need to generate online log */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__ONLINE ) && ( newAvailStatus == MTC_AVAIL_STATUS__ONLINE )) { if ( node_ptr->offline_log_reported == true ) { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__STATUSCHANGE_ONLINE ); node_ptr->offline_log_reported = false ; node_ptr->online_log_reported = true ; } } /* check for need to generate offline log */ if (( node_ptr->availStatus != MTC_AVAIL_STATUS__OFFLINE ) && ( newAvailStatus == MTC_AVAIL_STATUS__OFFLINE )) { if ( node_ptr->online_log_reported == true ) { mtcAlarm_log ( node_ptr->hostname, MTC_LOG_ID__STATUSCHANGE_OFFLINE ); node_ptr->offline_log_reported = true ; node_ptr->online_log_reported = false ; } } /* If the availability status is moving away from off or online then * be sure we cancel the mtcAlive timer */ if ((( node_ptr->availStatus == MTC_AVAIL_STATUS__OFFLINE ) || ( node_ptr->availStatus == MTC_AVAIL_STATUS__ONLINE )) && (( newAvailStatus != MTC_AVAIL_STATUS__OFFLINE ) && ( newAvailStatus != MTC_AVAIL_STATUS__ONLINE ))) { /* Free the mtc timer if in use */ if ( node_ptr->mtcAlive_timer.tid ) { tlog ("%s Stopping mtcAlive timer\n", node_ptr->hostname.c_str()); mtcTimer_stop ( node_ptr->mtcAlive_timer ); node_ptr->mtcAlive_timer.ring = false ; node_ptr->mtcAlive_timer.tid = NULL ; } node_ptr->onlineStage = MTC_ONLINE__START ; } clog ("%s %s-%s-%s\n", node_ptr->hostname.c_str(), mtc_nodeAdminState_str [node_ptr->adminState], mtc_nodeOperState_str [node_ptr->operState], mtc_nodeAvailStatus_str[node_ptr->availStatus]); node_ptr->availStatus = newAvailStatus ; } } else { slog ("Invalid Host Availability Status (now:%d new:%d)\n", node_ptr->availStatus, newAvailStatus ); } return (rc); } /** Host Enable Handler Stage Change member function */ int nodeLinkClass::enableStageChange ( struct nodeLinkClass::node * node_ptr, mtc_enableStages_enum newHdlrStage ) { /* TODO: Consider converting stage to strings ... */ if (( newHdlrStage >= MTC_ENABLE__STAGES ) || ( node_ptr->enableStage >= MTC_ENABLE__STAGES )) { slog ("%s has invalid Enable stage (%d:%d)\n", node_ptr->hostname.c_str(), node_ptr->enableStage, newHdlrStage ); node_ptr->enableStage = MTC_ENABLE__FAILURE ; /* TODO: cause failed or degraded state ? */ return (FAIL); } else if ( node_ptr->enableStage != newHdlrStage ) { clog ("%s %s -> %s\n", node_ptr->hostname.c_str(), get_enableStages_str(node_ptr->enableStage).c_str(), get_enableStages_str(newHdlrStage).c_str()); node_ptr->enableStage = newHdlrStage ; return (PASS); } else { /* No state change */ dlog1 ("%s %s -> %s\n", node_ptr->hostname.c_str(), get_enableStages_str(node_ptr->enableStage).c_str(), get_enableStages_str(newHdlrStage).c_str()); return (PASS); } } /** Host Disable Handler Stage Change member function */ int nodeLinkClass::disableStageChange ( struct nodeLinkClass::node * node_ptr, mtc_disableStages_enum newHdlrStage ) { /* TODO: Consider converting stage to strings ... */ if (( newHdlrStage >= MTC_DISABLE__STAGES ) || ( node_ptr->disableStage >= MTC_DISABLE__STAGES )) { slog ("%s has invalid disable stage (%d:%d)\n", node_ptr->hostname.c_str(), node_ptr->disableStage, newHdlrStage ); node_ptr->disableStage = MTC_DISABLE__DISABLED ; /* TODO: cause failed or degraded state ? */ return (FAIL); } else { clog ("%s %s -> %s\n", node_ptr->hostname.c_str(), get_disableStages_str(node_ptr->disableStage).c_str(), get_disableStages_str(newHdlrStage).c_str()); node_ptr->disableStage = newHdlrStage ; return (PASS); } } /** Validate and log Recovery stage changes */ int nodeLinkClass::recoveryStageChange ( struct nodeLinkClass::node * node_ptr, mtc_recoveryStages_enum newHdlrStage ) { int rc = PASS ; if (( newHdlrStage >= MTC_RECOVERY__STAGES ) || ( node_ptr->recoveryStage >= MTC_RECOVERY__STAGES )) { slog ("%s Invalid recovery stage (%d:%d)\n", node_ptr->hostname.c_str(), node_ptr->recoveryStage, newHdlrStage ); if ( newHdlrStage < MTC_RECOVERY__STAGES ) { clog ("%s ? -> %s\n", node_ptr->hostname.c_str(), get_recoveryStages_str(newHdlrStage).c_str()); node_ptr->recoveryStage = newHdlrStage ; } else { node_ptr->recoveryStage = MTC_RECOVERY__FAILURE ; rc = FAIL ; } } else { clog ("%s %s -> %s\n", node_ptr->hostname.c_str(), get_recoveryStages_str(node_ptr->recoveryStage).c_str(), get_recoveryStages_str(newHdlrStage).c_str()); node_ptr->recoveryStage = newHdlrStage ; } return (rc) ; } /** Validate and log Recovery stage changes */ int nodeLinkClass::configStageChange ( struct nodeLinkClass::node * node_ptr, mtc_configStages_enum newHdlrStage ) { int rc = PASS ; if (( newHdlrStage >= MTC_CONFIG__STAGES ) || ( node_ptr->configStage >= MTC_CONFIG__STAGES )) { slog ("%s Invalid config stage (%d:%d)\n", node_ptr->hostname.c_str(), node_ptr->configStage, newHdlrStage ); if ( newHdlrStage < MTC_CONFIG__STAGES ) { clog ("%s ? -> %s\n", node_ptr->hostname.c_str(), get_configStages_str(newHdlrStage).c_str()); node_ptr->configStage = newHdlrStage ; } else { node_ptr->configStage = MTC_CONFIG__FAILURE ; rc = FAIL ; } } else { clog ("%s %s -> %s\n", node_ptr->hostname.c_str(), get_configStages_str(node_ptr->configStage).c_str(), get_configStages_str(newHdlrStage).c_str()); node_ptr->configStage = newHdlrStage ; } return (rc) ; } /** Host Reset Handler Stage Change member function */ int nodeLinkClass::resetStageChange ( struct nodeLinkClass::node * node_ptr, mtc_resetStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_RESET__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_resetStages_str(node_ptr->resetStage).c_str(), get_resetStages_str(newHdlrStage).c_str()); node_ptr->resetStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid reset stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->resetStage = MTC_RESET__DONE ; return (FAIL) ; } } /* Host Reset Handler Stage Change member function */ int nodeLinkClass::reinstallStageChange ( struct nodeLinkClass::node * node_ptr, mtc_reinstallStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_REINSTALL__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_reinstallStages_str(node_ptr->reinstallStage).c_str(), get_reinstallStages_str(newHdlrStage).c_str()); node_ptr->reinstallStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid reinstall stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->reinstallStage = MTC_REINSTALL__DONE ; return (FAIL) ; } } /** Host Power control Handler Stage Change member function */ int nodeLinkClass::powerStageChange ( struct nodeLinkClass::node * node_ptr, mtc_powerStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_POWER__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_powerStages_str(node_ptr->powerStage).c_str(), get_powerStages_str(newHdlrStage).c_str()); node_ptr->powerStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid power control stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->powerStage = MTC_POWER__DONE ; return (FAIL) ; } } /** Host Power Cycle control Handler Stage Change member function */ int nodeLinkClass::powercycleStageChange ( struct nodeLinkClass::node * node_ptr, mtc_powercycleStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_POWERCYCLE__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_powercycleStages_str(node_ptr->powercycleStage).c_str(), get_powercycleStages_str(newHdlrStage).c_str()); node_ptr->powercycleStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid powercycle stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->powercycleStage = MTC_POWERCYCLE__DONE ; return (FAIL) ; } } /** Host Out-Of-Service Stage Change member function */ int nodeLinkClass::oosTestStageChange ( struct nodeLinkClass::node * node_ptr, mtc_oosTestStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_OOS_TEST__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_oosTestStages_str(node_ptr->oosTestStage).c_str(), get_oosTestStages_str(newHdlrStage).c_str()); node_ptr->oosTestStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid oos test stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->oosTestStage = MTC_OOS_TEST__DONE ; return (FAIL) ; } } /** Host in-Service Stage Change member function */ int nodeLinkClass::insvTestStageChange ( struct nodeLinkClass::node * node_ptr, mtc_insvTestStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_INSV_TEST__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_insvTestStages_str(node_ptr->insvTestStage).c_str(), get_insvTestStages_str(newHdlrStage).c_str()); node_ptr->insvTestStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid insv test stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->insvTestStage = MTC_INSV_TEST__START ; return (FAIL) ; } } /** SubStage Change member function */ int nodeLinkClass::subStageChange ( struct nodeLinkClass::node * node_ptr, mtc_subStages_enum newHdlrStage ) { if ( newHdlrStage < MTC_SUBSTAGE__STAGES ) { clog ("%s stage %s -> %s\n", node_ptr->hostname.c_str(), get_subStages_str(node_ptr->subStage).c_str(), get_subStages_str(newHdlrStage).c_str()); node_ptr->subStage = newHdlrStage ; return (PASS) ; } else { slog ("%s Invalid 'subStage' stage (%d)\n", node_ptr->hostname.c_str(), newHdlrStage ); node_ptr->subStage = MTC_SUBSTAGE__DONE ; return (FAIL) ; } } struct nodeLinkClass::node * nodeLinkClass::get_mtcTimer_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->mtcTimer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_mtcCmd_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->mtcCmd_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_host_services_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->host_services_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_http_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->http_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_thread_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->ipmitool_thread_ctrl.timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_ping_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->bm_ping_info.timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_bm_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->bm_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_bmc_access_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->bmc_access_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_mtcConfig_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->mtcConfig_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_powercycle_control_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->hwmon_powercycle.control_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_reset_control_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->hwmon_reset.control_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_powercycle_recovery_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->hwmon_powercycle.recovery_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_reset_recovery_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->hwmon_reset.recovery_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_mtcAlive_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->mtcAlive_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_offline_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->offline_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_mtcSwact_timer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->mtcSwact_timer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_oosTestTimer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->oosTestTimer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } struct nodeLinkClass::node * nodeLinkClass::get_insvTestTimer ( timer_t tid ) { /* check for empty list condition */ if ( tid != NULL ) { for ( struct node * ptr = head ; ; ptr = ptr->next ) { if ( ptr->insvTestTimer.tid == tid ) { return ptr ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } return static_cast<struct node *>(NULL); } /***************************************************************************** * * Name : ar_enable * * Description: Clears all auto recovery state for the specified host and * removes the auto recovery count file if it exists. * * Auto recovery count is tracked/preserved in a host named auto recovery * counter file /etc/mtc/tmp/hostname_ar_count. * *****************************************************************************/ void nodeLinkClass::ar_enable ( struct nodeLinkClass::node * node_ptr ) { string ar_file = TMP_DIR_PATH + node_ptr->hostname + AUTO_RECOVERY_FILE_SUFFIX ; if ( daemon_is_file_present (ar_file.data())) { wlog ("%s clearing autorecovery file counter\n", node_ptr->hostname.c_str()); daemon_remove_file (ar_file.data()); } if (( node_ptr->ar_disabled ) || ( node_ptr->ar_cause != MTC_AR_DISABLE_CAUSE__NONE )) { wlog ("%s re-enabling autorecovery\n", node_ptr->hostname.c_str()); } node_ptr->ar_disabled = false ; node_ptr->ar_cause = MTC_AR_DISABLE_CAUSE__NONE ; memset (&node_ptr->ar_count, 0, sizeof(node_ptr->ar_count)); node_ptr->ar_log_throttle = 0 ; } /***************************************************************************** * * Name : ar_manage * * Purpose : Manage Auto Recovery state. * * Description: the following checks and operations are performed ... * * Pre Checks: * * Validate auto recovery cause code * Return if already in ar_disabled state. Unlikely but safe guard. * * Manage Auto Recovery: * * Case 1: Failed active controller with no enabled inactive controller. * * Requires persistent count file and self reboot until threshold * is reached. * * Issues an immediate lazy reboot if the autorecovery threshold * is not reached. Otherwise it disables autorecovery and returns * so we don't get a rolling boot loop. * * Auto recovery count is tracked/preserved in a host named auto * recovery counter file /etc/mtc/tmp/hostname_ar_count. * * Case 2: All other cases * * Case 2a: No auto recovery thresholding of active controller in non AIO SX * where the user can't lock and unlock the active controller. * * Maintain auto recovery count and set ar_disabled for the host when * the threshold is reached. * * Parameters: * * node_ptr nodeLinkClass ptr of failing host. * * cause autorecovery_disable_cause_enum failure cause code. * * string host status string to display when auto recovery * threshold is reached and autorecovery is disabled. * * Returns: * * FAIL tells the caller to break from its FSM at earliest opportunity * because auto recovery threshold is reached and auto recovery * is disabled. * * PASS tells the caller that the threshold is not reached and to * continue handling the failure. * ******************************************************************************/ int nodeLinkClass::ar_manage ( struct nodeLinkClass::node * node_ptr, autorecovery_disable_cause_enum cause, string ar_disable_banner ) { int rc = FAIL ; /* Auto recovery only applies for hosts that are unlocked * and not already in ar_disabled state */ if (( node_ptr->adminState != MTC_ADMIN_STATE__UNLOCKED ) || ( node_ptr->ar_disabled )) { return (rc); } /* check for invalid call case */ if ( cause >= MTC_AR_DISABLE_CAUSE__LAST ) { slog ("%s called with invalid auto recovery cause (%d)", node_ptr->hostname.c_str(), cause ); return (rc); } /* update cause code */ if ( node_ptr->ar_cause != cause ) node_ptr->ar_cause = cause ; /* Case 1 check */ if ( ( THIS_HOST ) && ( is_inactive_controller_main_insv() == false )) { /* manage the auto recovery threshold count file */ unsigned int value = 0 ; string ar_file = TMP_DIR_PATH + node_ptr->hostname + AUTO_RECOVERY_FILE_SUFFIX ; if ( daemon_is_file_present (ar_file.data())) { /* if the file is there then read the count and increment it */ value = daemon_get_file_int ( ar_file.data() ); } value++ ; /* Save the new value in the file */ daemon_log_value ( ar_file.data(), value ); value = daemon_get_file_int ( ar_file.data() ); /* set rc to reflect what the caller should do */ if ( value > this->ar_threshold[node_ptr->ar_cause] ) { elog ("%s auto recovery threshold exceeded (%d)\n", node_ptr->hostname.c_str(), this->ar_threshold[node_ptr->ar_cause] ); node_ptr->ar_disabled = true ; adminActionChange ( node_ptr, MTC_ADMIN_ACTION__NONE ); allStateChange ( node_ptr, node_ptr->adminState, MTC_OPER_STATE__ENABLED, MTC_AVAIL_STATUS__DEGRADED ); mtcInvApi_update_task ( node_ptr, ar_disable_banner ); return (rc); } wlog ("%s auto recovery (try %d of %d) (%d)", node_ptr->hostname.c_str(), value, this->ar_threshold[node_ptr->ar_cause], node_ptr->ar_cause); mtcInvApi_update_states_now ( node_ptr, "unlocked", "disabled", "failed", "disabled", "failed" ); lazy_graceful_fs_reboot ( node_ptr ); } else /* Case 2 */ { send_hbs_command ( node_ptr->hostname, MTC_CMD_STOP_HOST ); mtcInvApi_update_states ( node_ptr, "unlocked", "disabled", "failed" ); if (( NOT_THIS_HOST ) && ( this->system_type != SYSTEM_TYPE__CPE_MODE__SIMPLEX )) { if ( ++node_ptr->ar_count[node_ptr->ar_cause] >= this->ar_threshold [node_ptr->ar_cause] ) { elog ("%s auto recovery threshold exceeded (%d)\n", node_ptr->hostname.c_str(), this->ar_threshold[node_ptr->ar_cause] ); node_ptr->ar_disabled = true ; adminActionChange ( node_ptr, MTC_ADMIN_ACTION__NONE ); mtcInvApi_update_task ( node_ptr, ar_disable_banner ); rc = FAIL ; } else { wlog ("%s auto recovery (try %d of %d) (%d)", node_ptr->hostname.c_str(), node_ptr->ar_count[node_ptr->ar_cause], this->ar_threshold[node_ptr->ar_cause], node_ptr->ar_cause); rc = PASS ; } } else { wlog ("%s auto recovery\n", node_ptr->hostname.c_str()); rc = PASS ; } } return (rc); } /**************************************************************************** * * Name : report_dor_recovery * * Description: Create a specifically formatted log for the the specified * hosts DOR recovery state and timing. * * Parameters : The node and a caller prefix string that states if the node * is ENABELD * is FAILED * is ENMABLED-degraded * etc. * ***************************************************************************/ void nodeLinkClass::report_dor_recovery ( struct nodeLinkClass::node * node_ptr, string node_state_log_prefix ) { struct timespec ts ; clock_gettime (CLOCK_MONOTONIC, &ts ); node_ptr->dor_recovery_time = ts.tv_sec ; plog ("%-12s %s ; DOR Recovery %2d:%02d mins (%4d secs) (uptime:%2d:%02d mins)\n", node_ptr->hostname.c_str(), node_state_log_prefix.c_str(), node_ptr->dor_recovery_time/60, node_ptr->dor_recovery_time%60, node_ptr->dor_recovery_time, node_ptr->uptime/60, node_ptr->uptime%60 ); node_ptr->dor_recovery_mode = false ; node_ptr->was_dor_recovery_mode = false ; } void nodeLinkClass::force_full_enable ( struct nodeLinkClass::node * node_ptr ) { if ( node_ptr->ar_disabled == true ) return ; if ( node_ptr->was_dor_recovery_mode ) { report_dor_recovery ( node_ptr , "is FAILED " ); } plog ("%s Forcing Full Enable Sequence\n", node_ptr->hostname.c_str()); /* Raise Critical Enable Alarm */ alarm_enabled_failure ( node_ptr, true ); allStateChange ( node_ptr, node_ptr->adminState, MTC_OPER_STATE__DISABLED, MTC_AVAIL_STATUS__FAILED ); enableStageChange ( node_ptr, MTC_ENABLE__FAILURE ); recoveryStageChange ( node_ptr, MTC_RECOVERY__START ); /* reset the fsm */ // don't override the add action or lock actions / if (( node_ptr->adminAction != MTC_ADMIN_ACTION__ADD ) && ( node_ptr->adminAction != MTC_ADMIN_ACTION__LOCK ) && ( node_ptr->adminAction != MTC_ADMIN_ACTION__FORCE_LOCK )) { adminActionChange ( node_ptr, MTC_ADMIN_ACTION__NONE ); // no action } else { wlog ("%s refusing to override '%s' action with 'none' action\n", node_ptr->hostname.c_str(), mtc_nodeAdminAction_str [node_ptr->adminAction]); } } /***************************************************************************** * * Name : launch_host_services_cmd * * Description: This is a multi timeslice service that is executed * by the command handler. * * This interface just determines the host type and loads the * command handler with the host type corresponding host * services command based on the start bool. If 'subf' is * specified then the start or stop command defaults to COMPUTE. * * Supported Commands are defined in nodeBase.h * * start = False (means stop) * * MTC_CMD_STOP_CONTROL_SVCS * MTC_CMD_STOP_WORKER_SVCS * MTC_CMD_STOP_STORAGE_SVCS * * start = True * * MTC_CMD_START_CONTROL_SVCS * MTC_CMD_START_WORKER_SVCS * MTC_CMD_START_STORAGE_SVCS * * Returns : PASS = launch success * !PASS = launch failure * ****************************************************************************/ int nodeLinkClass::launch_host_services_cmd ( struct nodeLinkClass::node * node_ptr, bool start, bool subf ) { if ( !node_ptr ) return (FAIL_NULL_POINTER); /* Initialize the host's command request control structure */ mtcCmd_init ( node_ptr->host_services_req ); /* Service subfunction override first, efficiency. */ if ( subf == true ) { /* only supported subfunction (right now) is COMPUTE */ if ( start == true ) node_ptr->host_services_req.cmd = MTC_CMD_START_WORKER_SVCS ; else node_ptr->host_services_req.cmd = MTC_CMD_STOP_WORKER_SVCS ; } else if ( start == true ) { if ( is_controller (node_ptr) ) node_ptr->host_services_req.cmd = MTC_CMD_START_CONTROL_SVCS ; else if ( is_worker (node_ptr) ) node_ptr->host_services_req.cmd = MTC_CMD_START_WORKER_SVCS ; else if ( is_storage (node_ptr) ) node_ptr->host_services_req.cmd = MTC_CMD_START_STORAGE_SVCS ; else { slog ("%s start host services is not supported for this host type\n", node_ptr->hostname.c_str()); return (FAIL_BAD_CASE) ; } } else { if ( is_controller (node_ptr) ) node_ptr->host_services_req.cmd = MTC_CMD_STOP_CONTROL_SVCS ; else if ( is_worker (node_ptr) ) node_ptr->host_services_req.cmd = MTC_CMD_STOP_WORKER_SVCS ; else if ( is_storage (node_ptr) ) node_ptr->host_services_req.cmd = MTC_CMD_STOP_STORAGE_SVCS ; else { slog ("%s stop host services is not supported for this host type\n", node_ptr->hostname.c_str()); return (FAIL_BAD_CASE); } } /* Translate that command to its named string */ node_ptr->host_services_req.name = get_mtcNodeCommand_str(node_ptr->host_services_req.cmd); /* Get the host services timeout and add MTC_AGENT_TIMEOUT_EXTENSION * seconds so that it is a bit longer than the mtcClient timeout */ int timeout = daemon_get_cfg_ptr()->host_services_timeout ; timeout+= MTC_AGENT_TIMEOUT_EXTENSION ; ilog ("%s %s launch\n", node_ptr->hostname.c_str(), node_ptr->host_services_req.name.c_str()); /* The launch part. * init the */ mtcCmd_init ( node_ptr->cmd ); node_ptr->cmd.stage = MTC_CMD_STAGE__START ; node_ptr->cmd.cmd = MTC_OPER__HOST_SERVICES_CMD ; node_ptr->mtcCmd_work_fifo.clear() ; node_ptr->mtcCmd_work_fifo.push_front(node_ptr->cmd); /* start an unbrella timer and start waiting for the result, * a little longer than the mtcClient version */ mtcTimer_reset ( node_ptr->host_services_timer ); mtcTimer_start ( node_ptr->host_services_timer, mtcTimer_handler, timeout ) ; return (PASS); } int send_event ( string & hostname, unsigned int cmd, iface_enum iface ); int nodeLinkClass::mon_host ( const string & hostname, bool true_false, bool send_clear ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { bool want_log = true ; for ( int iface = 0 ; iface < MAX_IFACES ; iface++ ) { if ( iface == INFRA_IFACE ) { if ( this->infra_network_provisioned == false ) continue ; if ( node_ptr->monitor[MGMNT_IFACE] == true_false ) want_log = false ; } if ( send_clear == true ) { send_event ( node_ptr->hostname, MTC_EVENT_HEARTBEAT_MINOR_CLR, (iface_enum)iface ) ; send_event ( node_ptr->hostname, MTC_EVENT_HEARTBEAT_DEGRADE_CLR, (iface_enum)iface ) ; } if ( true_false == true ) { if ( want_log ) { ilog ("%s starting heartbeat service \n", hostname.c_str()); } node_ptr->no_work_log_throttle = 0 ; node_ptr->b2b_misses_count[iface] = 0 ; node_ptr->hbs_misses_count[iface] = 0 ; node_ptr->b2b_pulses_count[iface] = 0 ; node_ptr->max_count[iface] = 0 ; node_ptr->hbs_failure[iface] = false ; node_ptr->hbs_minor[iface] = false ; node_ptr->hbs_degrade[iface] = false ; } else { if ( want_log ) { ilog ("%s stopping heartbeat service\n", hostname.c_str()); } } node_ptr->monitor[iface] = true_false ; } return PASS ; } return ( FAIL ); } /* store the current hardware monitor monitoring state */ void nodeLinkClass::set_hwmond_monitor_state ( string & hostname, bool state ) { if ( hostname.length() ) { struct nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { node_ptr->hwmond_monitor = state ; } } } /* get the current hardware monitor monitoring state */ bool nodeLinkClass::get_hwmond_monitor_state ( string & hostname ) { bool state = false ; if ( hostname.length() ) { struct nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { state = node_ptr->hwmond_monitor ; } } return (state); } /* get the current heartbeat monitoring state */ bool nodeLinkClass::get_hbs_monitor_state ( string & hostname, int iface ) { bool state = false ; if ( hostname.length() ) { struct nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { int rri_max = this->hosts ; state = node_ptr->monitor[iface] ; if ( state == true ) { wlog_throttled (node_ptr->no_rri_log_throttle, rri_max, "%s Not Offering RRI (%d)\n", hostname.c_str(), this->hosts ); } else { node_ptr->no_rri_log_throttle = 0 ; } } } return (state); } /* Manage the heartbeat pulse flags by hostname */ void nodeLinkClass::manage_pulse_flags ( string & hostname, unsigned int flags ) { if ( hostname.length() ) { struct nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { manage_pulse_flags ( node_ptr, flags ); } } } /* Manage the heartbeat pulse flags by pulse_ptr */ void nodeLinkClass::manage_pulse_flags ( struct nodeLinkClass::node * node_ptr, unsigned int flags ) { /* Do nothing with the flags for missing pulse * responses (identified with flags=NULL_PULSE_FLAGS) */ if ( flags == NULL_PULSE_FLAGS ) { return ; } /* Code that manages enabling of Infrastructrure network moonitoring * * Algorithm: Only monitor a hosts infrastructure network while the * management network of that same host is being monitored * and while that host indicates support for the infrastructure * network by setting the INFRA_FLAG in its management network * pulse responses. */ if ( node_ptr->monitor[MGMNT_IFACE] == false ) { node_ptr->monitor[INFRA_IFACE] = false ; } else if ( flags & INFRA_FLAG ) { /* TODO: Does this need to be debounced ??? */ node_ptr->monitor[INFRA_IFACE] = true ; } /* A host indicates that its process monitor is running by setting the * PMOND_FLAG occasionally in its pulse response. * The following if/else if clauses manage raising an alarm and degrading * a host has stopped sending the PMOND_FLAG. */ if ( flags & PMOND_FLAG ) { if ( node_ptr->pmon_degraded == true ) { if ( node_ptr->alarms[HBS_ALARM_ID__PMOND] != FM_ALARM_SEVERITY_CLEAR ) { alarm_clear ( node_ptr->hostname, PMOND_ALARM_ID, "pmond" ); } if ( send_event ( node_ptr->hostname, MTC_EVENT_PMOND_CLEAR, MGMNT_IFACE ) == PASS ) { node_ptr->alarms[HBS_ALARM_ID__PMOND] = FM_ALARM_SEVERITY_CLEAR ; node_ptr->pmon_degraded = false ; } } node_ptr->pmon_missing_count = 0 ; node_ptr->stall_monitor_log_throttle = 0 ; node_ptr->stall_recovery_log_throttle = 0 ; } else if ( ++node_ptr->pmon_missing_count > PMOND_MISSING_THRESHOLD ) { if ( node_ptr->pmon_degraded == false ) { wlog ("%s sending pmon degrade event to maintenance\n", node_ptr->hostname.c_str()); if ( send_event ( node_ptr->hostname, MTC_EVENT_PMOND_RAISE, MGMNT_IFACE ) == PASS ) { node_ptr->pmon_degraded = true ; node_ptr->alarms[HBS_ALARM_ID__PMOND] = FM_ALARM_SEVERITY_MAJOR ; alarm_major ( node_ptr->hostname, PMOND_ALARM_ID, "pmond" ); } } } /* A host indicates that a process stall condition exists by setting the * STALL_REC_FLAG it its heartbeat pulse response messages */ if ( flags & STALL_REC_FLAG ) { wlog ("%s hbsClient stall recovery action (flags:%08x)\n", node_ptr->hostname.c_str(), flags); if ( node_ptr->stall_recovery_log_throttle++ == 0 ) { send_event ( node_ptr->hostname, MTC_EVENT_HOST_STALLED , MGMNT_IFACE ); } } else if ( flags & STALL_MON_FLAG ) { if ( node_ptr->stall_monitor_log_throttle++ == 0 ) { wlog ("%s hbsClient running stall monitor (flags:%08x)\n", node_ptr->hostname.c_str(), flags ); } else if ( flags & STALL_ERROR_FLAGS ) { wlog ("%s hbsClient running stall monitor (flags:%08x)\n", node_ptr->hostname.c_str(), flags ); } } if ( node_ptr->stall_recovery_log_throttle > STALL_MSG_THLD ) { node_ptr->stall_recovery_log_throttle = 0 ; } if ( node_ptr->stall_monitor_log_throttle > STALL_MSG_THLD ) { node_ptr->stall_monitor_log_throttle = 0 ; } } /* Create the monitored pulse list for the specified interface */ int nodeLinkClass::create_pulse_list ( iface_enum iface ) { struct node * ptr = head ; if ( iface >= MAX_IFACES ) { dlog ("Invalid interface (%d)\n", iface ); return 0; } pulses[iface] = 0; pulse_list[iface].last_ptr = NULL ; pulse_list[iface].head_ptr = NULL ; pulse_list[iface].tail_ptr = NULL ; /* No check-in list if there is no inventory */ if (( head == NULL ) || ( hosts == 0 )) { return 0; } /* walk the node list looking for nodes that should be monitored */ for ( ; ptr != NULL ; ptr = ptr->next ) { if ( ptr->monitor[iface] == true ) { /* current monitored node pointer */ pulse_ptr = ptr ; /* if first pulse node */ if ( pulse_list[iface].head_ptr == NULL ) { /* need to keep track of the last node so we can deal with * skipped nodes when they are not in monitor mode */ pulse_list[iface].last_ptr = pulse_ptr ; pulse_list[iface].head_ptr = pulse_ptr ; pulse_list[iface].tail_ptr = pulse_ptr ; pulse_ptr->pulse_link[iface].prev_ptr = NULL ; } else { pulse_list[iface].last_ptr->pulse_link[iface].next_ptr = pulse_ptr ; pulse_ptr->pulse_link[iface].prev_ptr = pulse_list[iface].last_ptr ; pulse_list[iface].last_ptr = pulse_ptr ; /* save current to handle a skip */ pulse_list[iface].tail_ptr = pulse_ptr ; /* migrate tail as list is built */ } pulse_ptr->pulse_link[iface].next_ptr = NULL ; pulse_ptr->linknum[iface] = ++pulses[iface] ; mlog2 ("%s %s Pulse Info: %d:%d - %d:%p\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->linknum[iface], pulses[iface], pulse_ptr->rri, pulse_ptr); } } print_pulse_list(iface); return (pulses[iface]); } /** Clear heartbeat stats in support of failed heartbeat restart */ void nodeLinkClass::hbs_clear_all_stats ( void ) { ilog ("clearing all hearbeat stats\n"); for ( struct node * ptr = head ; ptr != NULL ; ptr = ptr->next ) { for ( int iface = 0 ; iface < MAX_IFACES ; iface++ ) { ptr->max_count[iface] = 0 ; ptr->hbs_count[iface] = 0 ; ptr->hbs_misses_count[iface] = 0 ; ptr->b2b_pulses_count[iface] = 0 ; ptr->b2b_misses_count[iface] = 0 ; ptr->hbs_minor_count[iface] = 0 ; ptr->hbs_degrade_count[iface] = 0 ; ptr->hbs_failure_count[iface] = 0 ; ptr->hbs_minor[iface] = false ; ptr->hbs_degrade[iface] = false ; ptr->hbs_failure[iface] = false ; ptr->heartbeat_failed[iface] = false ; } if (( ptr->next == NULL ) || ( ptr == tail )) break ; } } /** Build the Reasource Reference Array */ void nodeLinkClass::build_rra ( void ) { struct node * ptr = NULL ; int x = 1 ; for ( ptr = head ; ptr != NULL ; ptr = ptr->next ) { hbs_rra [x] = ptr ; ptr->rri=x ; x++ ; if (( ptr->next == NULL ) || ( ptr == tail )) break ; } if ( ptr != NULL ) { dlog ("%s forced RRA build (%d)\n", ptr->hostname.c_str(), x-1); } /* fill the rest with NULL */ for ( ; x < MAX_NODES ; x++ ) hbs_rra[x] = NULL ; /* Reset the "Running RRI" */ rrri = 0 ; } /** Gets the next hostname and resource reference identifier * (the rra index) and updates the callers variables with them. * * This is a helper function in support of the fast resource lookup feature. * During steady state operation the heartbeat agent cycles through * all the resources , one per heartbeat request, sending new * reference identifiers (name and index) to the monitored resources. * Each time this is called it get the next set. * */ void nodeLinkClass::get_rris ( string & hostname, int & rri ) { if ( hosts ) { hostname = "none" ; rrri++ ; if ( rrri > hosts ) { rrri = 1 ; } hostname = hbs_rra[rrri]->hostname ; rri = rrri ; } } struct nodeLinkClass::node* nodeLinkClass::getPulseNode ( string & hostname , iface_enum iface ) { /* check for empty list condition */ if ( pulse_list[iface].head_ptr == NULL ) return NULL ; for ( pulse_ptr = pulse_list[iface].head_ptr ; ; pulse_ptr = pulse_ptr->pulse_link[iface].next_ptr ) { if ( !hostname.compare ( pulse_ptr->hostname )) { return pulse_ptr ; } if (( pulse_ptr->pulse_link[iface].next_ptr == NULL ) || ( pulse_ptr==pulse_list[iface].tail_ptr )) { break ; } } return static_cast<struct node *>(NULL); } /* Find the node in the list of nodes being heartbeated and splice it out */ int nodeLinkClass::remPulse_by_index ( string hostname, int index, iface_enum iface, bool clear_b2b_misses_count, unsigned int flags ) { int rc = FAIL ; if (( index > 0 ) && ( !(index > hosts))) { if ( hbs_rra[index] != NULL ) { struct nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { if (( hbs_rra[index] == node_ptr ) && ( ! node_ptr->hostname.compare(hostname))) { node_ptr->lookup_mismatch_log_throttle = 0 ; if ( node_ptr->monitor[iface] == true ) { node_ptr->unexpected_pulse_log_throttle = 0 ; return ( remPulse ( hbs_rra[index], iface, clear_b2b_misses_count, flags )); } else { wlog_throttled ( node_ptr->unexpected_pulse_log_throttle, 200, "%s is not being monitored\n", hostname.c_str()); rc = PASS; } } else { rc = remPulse_by_name ( hostname, iface, clear_b2b_misses_count, flags ); wlog_throttled ( node_ptr->lookup_mismatch_log_throttle, 200, "%s rri lookup mismatch (%s:%d) ; %s\n", hostname.c_str(), node_ptr->hostname.c_str(), index, rc ? "" : "removed by hostname" ); return (rc); } } else { dlog ("%s could not lookup by index or hostname (%d)\n", hostname.c_str(), index ); rc = FAIL_HOSTNAME_LOOKUP ; } } } return (rc); } /* Find the node in the list of nodes being heartbeated and splice it out */ int nodeLinkClass::remPulse_by_name ( string & hostname, iface_enum iface, bool clear_b2b_misses_count, unsigned int flags ) { return ( remPulse ( getPulseNode ( hostname, iface ), iface, clear_b2b_misses_count, flags )); } /** WANT_LINKLIST_FIT is not defined by default. * Needs to be explicitely defined and the undef commented out for testing **/ #ifdef WANT_LINKLIST_FIT #undef WANT_LINKLIST_FIT #endif #ifdef WANT_LINKLIST_FIT static bool already_fit = false ; #endif /* Find the node in the list of nodes being heartbeated and splice it out */ int nodeLinkClass::remPulse ( struct node * node_ptr, iface_enum iface, bool clear_b2b_misses_count, unsigned int flags ) { /* This default RC allows the caller to filter out unexpected pulse responses */ int rc = ENXIO ; if ( head == NULL ) { return -ENODEV ; } else if ( node_ptr == NULL ) { return (rc) ; } struct node * ptr = node_ptr ; // dlog ("%s\n", node_ptr->hostname.c_str()); /* Splice the node out of the pulse monitor list */ /* Does the pulse monitor list exist and is the node in the list */ /* Need to gracefully handle being called when there is no pulse */ /* list and/or the specified host is not in the pulse list */ if (( pulse_list[iface].head_ptr != NULL ) && ( ptr != NULL ) && ( ptr->linknum[iface] != 0)) { pulse_ptr = ptr ; manage_pulse_flags ( pulse_ptr , flags ); /* clear_b2b_misses_count override check ; thresold recovery */ if ( clear_b2b_misses_count == true ) { ptr->hbs_count[iface]++ ; ptr->b2b_pulses_count[iface]++ ; if ( ptr->b2b_pulses_count[iface] == hbs_failure_threshold ) { hbs_cluster_change( ptr->hostname + " " + get_iface_name_str(iface) + " heartbeat pass" ); } else if ( ptr->b2b_pulses_count[iface] == 1 ) { hbs_cluster_change( ptr->hostname + " " + get_iface_name_str(iface) + " heartbeat start" ); } if ( ptr->hbs_failure[iface] == true ) { /* threshold failure recovery */ if ( ptr->b2b_pulses_count[iface] < HBS_PULSES_REQUIRED_FOR_RECOVERY ) { /* don't clear the alarm or send clear notifications to mtc * if this interfaces failed and has not yet received the * required number of back to back pulses needed for recovery */ clear_b2b_misses_count = false ; dlog ("%s %s heartbeat failure recovery (%d of %d)\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), ptr->b2b_pulses_count[iface], HBS_PULSES_REQUIRED_FOR_RECOVERY); } else { ptr->hbs_failure[iface] = false ; ilog ("%s %s heartbeat failure recovery (%d)\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), ptr->b2b_pulses_count[iface]); } } else { ptr->b2b_misses_count[iface] = 0 ; } } else { if (( ptr->b2b_pulses_count[iface] != 0 ) && ( ptr->hbs_failure[iface] == true )) { ilog ("%s %s failed but %d\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), ptr->b2b_pulses_count[iface]); } } if ( clear_b2b_misses_count == true ) { manage_heartbeat_alarm ( pulse_ptr, FM_ALARM_SEVERITY_CLEAR, iface ); if ( ptr->b2b_misses_count[iface] > hbs_degrade_threshold ) { ilog ("%s %s Pulse Rxed (after %d misses)\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), node_ptr->b2b_misses_count[iface]); } ptr->b2b_misses_count[iface] = 0 ; if ( pulse_ptr->hbs_degrade[iface] == true ) { /* Send a degrade clear event to maintenance */ if ( send_event ( pulse_ptr->hostname, MTC_EVENT_HEARTBEAT_DEGRADE_CLR, iface ) == PASS ) { pulse_ptr->hbs_degrade[iface] = false ; } } if ( pulse_ptr->hbs_minor[iface] == true ) { if ( send_event ( pulse_ptr->hostname, MTC_EVENT_HEARTBEAT_MINOR_CLR, iface ) == PASS ) { pulse_ptr->hbs_minor[iface] = false ; } } } rc = PASS ; #ifdef WANT_LINKLIST_FIT if ( already_fit == false ) { if ( daemon_is_file_present ( MTC_CMD_FIT__LINKLIST ) == true ) { if ( pulse_list[iface].head_ptr->pulse_link[iface].next_ptr != NULL ) { slog ("FIT of next pointer\n"); pulse_list[iface].head_ptr->pulse_link[iface].next_ptr = NULL ; already_fit = true ; } } } #endif if ( pulse_list[iface].head_ptr == pulse_ptr ) { if ( pulse_list[iface].head_ptr == pulse_list[iface].tail_ptr ) { qlog2 ("%s Pulse: Single Node -> Head Case : %d of %d\n", node_ptr->hostname.c_str(), pulse_ptr->linknum[iface], pulses[iface] ); pulse_list[iface].head_ptr = NULL ; pulse_list[iface].tail_ptr = NULL ; } else { qlog2 ("%s Pulse: Multiple Node -> Head Case : %d of %d\n", node_ptr->hostname.c_str(), pulse_ptr->linknum[iface], pulses[iface] ); if ( pulse_list[iface].head_ptr->pulse_link[iface].next_ptr == NULL ) { slog ("%s unexpected NULL next_ptr ; aborting this pulse window\n", node_ptr->hostname.c_str()); pulse_list[iface].head_ptr = NULL ; pulse_list[iface].tail_ptr = NULL ; pulse_ptr->linknum[iface] = 0 ; pulses[iface] = 0 ; return (FAIL_NULL_POINTER); } else { pulse_list[iface].head_ptr = pulse_list[iface].head_ptr->pulse_link[iface].next_ptr ; pulse_list[iface].head_ptr->pulse_link[iface].prev_ptr = NULL ; } } } else if ( pulse_list[iface].tail_ptr == pulse_ptr ) { qlog2 ("%s Pulse: Multiple Node -> Tail Case : %d of %d\n", node_ptr->hostname.c_str(), pulse_ptr->linknum[iface], pulses[iface] ); if ( pulse_list[iface].tail_ptr->pulse_link[iface].prev_ptr == NULL ) { slog ("%s unexpected NULL prev_ptr ; aborting this pulse window\n", node_ptr->hostname.c_str()); pulse_list[iface].head_ptr = NULL ; pulse_list[iface].tail_ptr = NULL ; pulse_ptr->linknum[iface] = 0 ; pulses[iface] = 0 ; return (FAIL_NULL_POINTER); } else { pulse_list[iface].tail_ptr = pulse_list[iface].tail_ptr->pulse_link[iface].prev_ptr ; pulse_list[iface].tail_ptr->pulse_link[iface].next_ptr = NULL ; } } else { /* July 1 emacdona: Make failure path case more robust */ if ( pulse_ptr == NULL ) { slog ("Internal Err 1\n"); rc = FAIL; } else if ( pulse_ptr->pulse_link[iface].prev_ptr == NULL ) { slog ("Internal Err 2\n"); rc = FAIL; } else if ( pulse_ptr->pulse_link[iface].next_ptr == NULL ) { slog ("Internal Err 3\n"); rc = FAIL; } if ( rc == FAIL ) { slog ("%s Null pointer error splicing %s out of pulse list with %d pulses remaining (Monitoring:%s)\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), pulses[iface], node_ptr->monitor[iface] ? "Yes" : "No" ); } else { pulse_ptr->pulse_link[iface].prev_ptr->pulse_link[iface].next_ptr = pulse_ptr->pulse_link[iface].next_ptr ; pulse_ptr->pulse_link[iface].next_ptr->pulse_link[iface].prev_ptr = pulse_ptr->pulse_link[iface].prev_ptr ; } } if ( rc == PASS ) { pulse_ptr->linknum[iface]-- ; } pulses[iface]-- ; } else if ( node_ptr ) { dlog ("%s unexpected pulse response ; %s", node_ptr->hostname.c_str(), get_iface_name_str(iface)); } else { slog ("null pointer"); } return rc ; } /** This utility will try and remove a pluse from the pulse * linked list first by index and then by hostname. * * By index does not require a lookup whereas hostname does */ int nodeLinkClass::remove_pulse ( string & hostname, iface_enum iface, int index, unsigned int flags ) { /* TODO: consider removing this check */ if ( hostname == "localhost" ) { /* localhost is not a supported hostname and indicates * an unconfigured host response ; return the ignore response */ return(ENXIO); } if ( index ) { int rc = remPulse_by_index ( hostname, index , iface, true , flags ); switch (rc) { case PASS: return (rc) ; case ENXIO: return (rc); default: mlog ("%s RRI Miss (rri:%d) (rc:%d)\n", hostname.c_str(), index, rc ); } } else { } return ( remPulse_by_name ( hostname , iface, true, flags )); } void nodeLinkClass::clear_pulse_list ( iface_enum iface ) { struct node * ptr = head ; for ( ; ptr != NULL ; ptr = ptr->next ) { ptr->pulse_link[iface].prev_ptr = NULL ; ptr->pulse_link[iface].next_ptr = NULL ; } pulse_list[iface].head_ptr = NULL ; pulse_list[iface].tail_ptr = NULL ; if ( ptr != NULL ) { ptr->linknum[iface] = 0 ; pulses[iface] = 0 ; } } /** Runs in the hbsAgent to set or clear heartbat alarms for all supported interfaces */ void nodeLinkClass::manage_heartbeat_alarm ( struct nodeLinkClass::node * node_ptr, EFmAlarmSeverityT sev, int iface ) { if ( this->heartbeat != true ) return ; if ( this->hbs_failure_action == HBS_FAILURE_ACTION__NONE ) { dlog ("%s dropping heartbeat alarm request (%s:%s) ; action none\n", node_ptr->hostname.c_str(), alarmUtil_getSev_str(sev).c_str(), get_iface_name_str(iface) ); return ; } bool make_alarm_call = false ; alarm_id_enum id ; EFmAlarmStateT state = FM_ALARM_STATE_SET ; const char * alarm_id_ptr = NULL ; const char * entity_ptr = NULL ; if ( iface == MGMNT_IFACE ) { entity_ptr = MGMNT_NAME ; id = HBS_ALARM_ID__HB_MGMNT ; alarm_id_ptr = MGMNT_HB_ALARM_ID; } else { entity_ptr = INFRA_NAME ; id = HBS_ALARM_ID__HB_INFRA ; alarm_id_ptr = INFRA_HB_ALARM_ID; } if ( sev == FM_ALARM_SEVERITY_CLEAR ) { state = FM_ALARM_STATE_CLEAR ; if ( node_ptr->alarms[id] != FM_ALARM_SEVERITY_CLEAR ) { make_alarm_call = true ; node_ptr->alarms[id] = sev ; } } else if ( sev == FM_ALARM_SEVERITY_MAJOR ) { if ( node_ptr->alarms[id] == FM_ALARM_SEVERITY_CRITICAL ) { ; /* we don't go from critical to degrade need a clear first */ } else if ( node_ptr->alarms[id] != FM_ALARM_SEVERITY_MAJOR ) { make_alarm_call = true ; node_ptr->alarms[id] = FM_ALARM_SEVERITY_MAJOR ; } } else if ( sev == FM_ALARM_SEVERITY_CRITICAL ) { if ( node_ptr->alarms[id] != sev ) { make_alarm_call = true ; node_ptr->alarms[id] = sev ; } } else if ( sev == FM_ALARM_SEVERITY_MINOR ) { if ( node_ptr->alarms[id] != sev ) { make_alarm_call = true ; node_ptr->alarms[id] = sev ; } } else { if ( node_ptr->alarms[id] != FM_ALARM_SEVERITY_WARNING ) { make_alarm_call = true ; node_ptr->alarms[id] = FM_ALARM_SEVERITY_WARNING ; } } if ( make_alarm_call == true ) { alarm_ ( node_ptr->hostname, alarm_id_ptr, state, sev, entity_ptr , ""); } } #define HBS_LOSS_REPORT_THROTTLE (100) int nodeLinkClass::lost_pulses ( iface_enum iface, bool & storage_0_responding ) { int lost = 0 ; /* * Assume storage-0 is responding until otherwise proven its not. * keep in mind that this interface counts nodes that have not responded ; * not those that have. */ storage_0_responding = true ; /* * Loop over the pulse_list which now onoly contains a list of hosts * that have not responded in this heartbeat period. */ for ( ; pulse_list[iface].head_ptr != NULL ; ) { daemon_signal_hdlr (); pulse_ptr = pulse_list[iface].head_ptr ; lost++ ; if ( active ) { string flat = "Flat Line:" ; pulse_ptr->b2b_misses_count[iface]++ ; pulse_ptr->hbs_misses_count[iface]++ ; pulse_ptr->b2b_pulses_count[iface] = 0 ; // pulse_ptr->max_count[iface]++ ; /* * Update storage_0_responding reference to false if storgate-0 * is found in the pulse lots list. */ if ( pulse_ptr->hostname == STORAGE_0 ) { storage_0_responding = false ; } if ( pulse_ptr->b2b_misses_count[iface] > 1 ) { if ( pulse_ptr->b2b_misses_count[iface] >= hbs_failure_threshold ) { if ( pulse_ptr->b2b_misses_count[iface] == hbs_failure_threshold ) { ilog ("%s %s Pulse Miss (%d) (log throttled to every %d)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->b2b_misses_count[iface], 0xfff); } /* Once the misses exceed 4095 then throttle the logging to avoid flooding */ if ( (pulse_ptr->b2b_misses_count[iface] & 0xfff) == 0 ) { ilog ("%s %s Pulse Miss (%d)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->b2b_misses_count[iface] ); } } else { if ( pulse_ptr->b2b_misses_count[iface] > hbs_degrade_threshold ) { ilog ("%s %s Pulse Miss (%3d) (max:%3d) (in degrade)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->b2b_misses_count[iface], pulse_ptr->max_count[iface]); } else if ( pulse_ptr->b2b_misses_count[iface] > hbs_minor_threshold ) { ilog ("%s %s Pulse Miss (%3d) (max:%3d) (in minor)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->b2b_misses_count[iface] , pulse_ptr->max_count[iface]); } else { ilog ("%s %s Pulse Miss (%3d) (max:%3d)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->b2b_misses_count[iface], pulse_ptr->max_count[iface]); } } } else { dlog ("%s %s Pulse Miss (%d)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface), pulse_ptr->b2b_misses_count[iface] ); } #ifdef WANT_HBS_MEM_LOGS mem_log ( flat, pulse_ptr->b2b_misses_count[iface], pulse_ptr->hostname.c_str()); #endif if ( iface == MGMNT_IFACE ) { if ( pulse_ptr->b2b_misses_count[iface] == hbs_minor_threshold ) { if ( this->active_controller ) { send_event ( pulse_ptr->hostname, MTC_EVENT_HEARTBEAT_MINOR_SET, iface ); } pulse_ptr->hbs_minor[iface] = true ; pulse_ptr->hbs_minor_count[iface]++ ; wlog ("%s %s -> MINOR\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface)); } } if ( pulse_ptr->b2b_misses_count[iface] == hbs_degrade_threshold ) { if ( this->active_controller ) { manage_heartbeat_alarm ( pulse_ptr, FM_ALARM_SEVERITY_MAJOR, iface ); /* report this host as failed */ if ( send_event ( pulse_ptr->hostname, MTC_EVENT_HEARTBEAT_DEGRADE_SET, iface ) == PASS ) { pulse_ptr->hbs_degrade[iface] = true ; } } else { pulse_ptr->hbs_degrade[iface] = true ; } wlog ("%s %s -> DEGRADED\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface)); pulse_ptr->hbs_degrade_count[iface]++ ; } /* Handle lost degrade event case */ if (( pulse_ptr->b2b_misses_count[iface] > hbs_degrade_threshold ) && ( pulse_ptr->hbs_degrade[iface] == false )) { wlog ("%s -> DEGRADED - Auto-Correction\n", pulse_ptr->hostname.c_str()); if ( this->active_controller ) { manage_heartbeat_alarm ( pulse_ptr, FM_ALARM_SEVERITY_MAJOR, iface ); /* report this host as failed */ if ( send_event ( pulse_ptr->hostname, MTC_EVENT_HEARTBEAT_DEGRADE_SET, iface ) == PASS ) { pulse_ptr->hbs_degrade[iface] = true ; } } else { pulse_ptr->hbs_degrade[iface] = true ; } } /* Turn the infra heartbeat loss into a degrade only * condition if the infra_degrade_only flag is set */ if (( iface == INFRA_IFACE ) && ( pulse_ptr->b2b_misses_count[iface] >= hbs_failure_threshold ) && ( infra_degrade_only == true )) { /* Only print the log at the threshold boundary */ if (( pulse_ptr->b2b_misses_count[iface]%HBS_LOSS_REPORT_THROTTLE) == hbs_failure_threshold ) { if ( this->active_controller ) { manage_heartbeat_alarm ( pulse_ptr, FM_ALARM_SEVERITY_CRITICAL, iface ); } wlog ( "%s %s *** Heartbeat Loss *** (degrade only)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface) ); hbs_cluster_change ( pulse_ptr->hostname + " heartbeat loss" ); } } /* Turn the infra heartbeat loss into a degrade only * condition for inactive controller on normal system. */ else if (( iface == INFRA_IFACE ) && ( pulse_ptr->b2b_misses_count[iface] >= hbs_failure_threshold ) && ( this->system_type == SYSTEM_TYPE__NORMAL ) && (( pulse_ptr->nodetype & CONTROLLER_TYPE) == CONTROLLER_TYPE )) { /* Only print the log at the threshold boundary */ if ( (pulse_ptr->b2b_misses_count[iface]%HBS_LOSS_REPORT_THROTTLE) == hbs_failure_threshold ) { if ( this->active_controller ) { manage_heartbeat_alarm ( pulse_ptr, FM_ALARM_SEVERITY_CRITICAL, iface ); } wlog ( "%s %s *** Heartbeat Loss *** (degrade only)\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface)); hbs_cluster_change ( pulse_ptr->hostname + " heartbeat loss" ); } } else if ((pulse_ptr->b2b_misses_count[iface]%HBS_LOSS_REPORT_THROTTLE) == hbs_failure_threshold ) { elog ("%s %s *** Heartbeat Loss ***\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface) ); if ( this->active_controller ) { manage_heartbeat_alarm ( pulse_ptr, FM_ALARM_SEVERITY_CRITICAL, iface ); /* report this host as failed */ if ( send_event ( pulse_ptr->hostname, MTC_EVENT_HEARTBEAT_LOSS , iface ) == PASS ) { pulse_ptr->hbs_failure[iface] = true ; } } else { pulse_ptr->hbs_failure[iface] = true ; hbs_cluster_change ( pulse_ptr->hostname + " heartbeat loss" ); } pulse_ptr->hbs_failure_count[iface]++ ; } if ( pulse_ptr->b2b_misses_count[iface] > pulse_ptr->max_count[iface] ) pulse_ptr->max_count[iface] = pulse_ptr->b2b_misses_count[iface] ; } if ( remPulse_by_name ( pulse_ptr->hostname, iface, false, NULL_PULSE_FLAGS )) { elog ("%s %s not in pulse list\n", pulse_ptr->hostname.c_str(), get_iface_name_str(iface)); clear_pulse_list ( iface ); break ; } if ( pulse_list[iface].head_ptr == NULL ) { // dlog ("Pulse list is Empty\n"); break ; } } return (lost); } /* Return true if the specified interface is being monitored for this host */ bool nodeLinkClass::monitored_pulse ( string hostname , iface_enum iface ) { if ( hostname.length() ) { struct nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr != NULL ) { return ( node_ptr->monitor[iface] ) ; } } return(false); } /* Reports pulse list empty status. * true if empty * false if not empty */ bool nodeLinkClass::pulse_list_empty ( iface_enum iface ) { if ( pulse_list[iface].head_ptr == NULL ) return true ; return false ; } void nodeLinkClass::print_pulse_list ( iface_enum iface ) { string pulse_host_list = "- " ; if ( pulse_list[iface].head_ptr != NULL ) { for ( pulse_ptr = pulse_list[iface].head_ptr ; pulse_ptr != NULL ; pulse_ptr = pulse_ptr->pulse_link[iface].next_ptr ) { pulse_host_list.append(pulse_ptr->hostname.c_str()); pulse_host_list.append(" "); } dlog ("Patients: %s\n", pulse_host_list.c_str()); } #ifdef WANT_HBS_MEM_LOGS if ( pulses[iface] && !pulse_host_list.empty() ) { string temp = get_iface_name_str(iface) ; temp.append(" Patients :") ; mem_log ( temp, pulses[iface], pulse_host_list ); } #endif } /* Clear all degrade flags except for the HWMON one */ void clear_host_degrade_causes ( unsigned int & degrade_mask ) { if ( degrade_mask & DEGRADE_MASK_HWMON ) { degrade_mask = DEGRADE_MASK_HWMON ; } else { degrade_mask = 0 ; } } /***************************************************************************/ /******************* State Dump Utilities ***********************/ /***************************************************************************/ void nodeLinkClass::mem_log_general ( void ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s %s %s %s:%s %s:%s \n", my_hostname.c_str(), my_local_ip.c_str(), my_float_ip.c_str(), daemon_get_cfg_ptr()->mgmnt_iface, mgmnt_link_up_and_running ? "Up" : "Down", daemon_get_cfg_ptr()->infra_iface, infra_link_up_and_running ? "Up" : "Down"); mem_log (str); } void nodeLinkClass::mem_log_dor ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s DOR - Active: %c Was: %c Time: %5d (00:%02d:%02d)\n", node_ptr->hostname.c_str(), node_ptr->dor_recovery_mode ? 'Y' : 'N', node_ptr->was_dor_recovery_mode ? 'Y' : 'N', node_ptr->dor_recovery_time, node_ptr->dor_recovery_time ? node_ptr->dor_recovery_time/60 : 0, node_ptr->dor_recovery_time ? node_ptr->dor_recovery_time%60 : 0); mem_log (str); } /* Multi-Node Failure Avoidance Data */ void nodeLinkClass::mem_log_mnfa ( void ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s MNFA: State:%s Hosts:%d:%d Threshold:%d Occurances:%d\n", my_hostname.c_str(), mnfa_active ? "ACTIVE" : "inactive", mnfa_host_count[MGMNT_IFACE], mnfa_host_count[INFRA_IFACE], mnfa_threshold, mnfa_occurances); mem_log (str); } void nodeLinkClass::mem_log_general_mtce_hosts ( void ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s EnableHosts -> Cont:%d Comp:%d Stor:%d StorType:%d\n", my_hostname.c_str(), num_controllers_enabled(), enabled_compute_nodes(), enabled_storage_nodes(), get_storage_backend()); mem_log (str); } void nodeLinkClass::mem_log_bm ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tbm_ip:%s bm_un:%s bm_type:%s provisioned: %s\n", node_ptr->hostname.c_str(), node_ptr->bm_ip.c_str(), node_ptr->bm_un.c_str(), node_ptr->bm_type.c_str(), node_ptr->bm_provisioned ? "Yes" : "No" ); mem_log (str); } void nodeLinkClass::mem_log_identity ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\t%s %s (%u)\n", node_ptr->hostname.c_str(), node_ptr->uuid.c_str(), node_ptr->type.c_str(), node_ptr->nodetype); mem_log (str); } void nodeLinkClass::mem_log_state1 ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; string ad = adminState_enum_to_str(node_ptr->adminState) ; string op = operState_enum_to_str(node_ptr->operState) ; string av = availStatus_enum_to_str(node_ptr->availStatus); snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\t%s-%s-%s degrade_mask:%08x\n", node_ptr->hostname.c_str(), ad.c_str(), op.c_str(), av.c_str(), node_ptr->degrade_mask); mem_log (str); op = operState_enum_to_str(node_ptr->operState_subf) ; av = availStatus_enum_to_str(node_ptr->availStatus_subf); if ( ! node_ptr->subfunction_str.empty() ) { snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tSub-Functions: %s-%s %s-%s-%s\n", node_ptr->hostname.c_str(), node_ptr->function_str.c_str(), node_ptr->subfunction_str.c_str(), ad.c_str(), op.c_str(), av.c_str()); } mem_log (str); } void nodeLinkClass::mem_log_state2 ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; string aa = adminAction_enum_to_str(node_ptr->adminAction) ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tmtcAction:%s invAction:%s Task:%s\n", node_ptr->hostname.c_str(), aa.c_str(), node_ptr->action.c_str(), node_ptr->task.c_str()); mem_log (str); } void nodeLinkClass::mem_log_mtcalive ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tmtcAlive: on:%c off:%c Cnt:%d State:%s Misses:%d\n", node_ptr->hostname.c_str(), node_ptr->mtcAlive_online ? 'Y' : 'N', node_ptr->mtcAlive_offline ? 'Y' : 'N', node_ptr->mtcAlive_count, node_ptr->mtcAlive_gate ? "gated" : "rxing", node_ptr->mtcAlive_misses); mem_log (str); } void nodeLinkClass::mem_log_alarm1 ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tAlarm List:%s%s%s%s%s%s\n", node_ptr->hostname.c_str(), node_ptr->alarms[MTC_ALARM_ID__LOCK ] ? " Locked" : " .", node_ptr->alarms[MTC_ALARM_ID__CONFIG ] ? " Config" : " .", node_ptr->alarms[MTC_ALARM_ID__ENABLE ] ? " Enable" : " .", node_ptr->alarms[MTC_ALARM_ID__CH_CONT ] ? " Control" : " .", node_ptr->alarms[MTC_ALARM_ID__CH_COMP ] ? " Compute" : " .", node_ptr->alarms[MTC_ALARM_ID__BM ] ? " Brd Mgmt" : " ."); mem_log (str); } void nodeLinkClass::mem_log_stage ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tAdd:%d Offline:%d: Swact:%d Recovery:%d Enable:%d Disable:%d\n", node_ptr->hostname.c_str(), node_ptr->addStage, node_ptr->offlineStage, node_ptr->swactStage, node_ptr->recoveryStage, node_ptr->enableStage, node_ptr->disableStage); mem_log (str); } void nodeLinkClass::mem_log_power_info ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tStage:%s Attempts:%d: Holdoff:%d Retry:%d State:%x ctid:%p rtid:%p\n", node_ptr->hostname.c_str(), get_powercycleStages_str(node_ptr->powercycleStage).c_str(), node_ptr->hwmon_powercycle.attempts, node_ptr->hwmon_powercycle.holdoff, node_ptr->hwmon_powercycle.retries, node_ptr->hwmon_powercycle.state, node_ptr->hwmon_powercycle.control_timer.tid, node_ptr->hwmon_powercycle.recovery_timer.tid); mem_log (str); } void nodeLinkClass::mem_log_reset_info ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tStage:%s Attempts:%d: Holdoff:%d Retry:%d State:%x ctid:%p rtid:%p\n", node_ptr->hostname.c_str(), get_resetStages_str(node_ptr->resetStage).c_str(), node_ptr->hwmon_reset.attempts, node_ptr->hwmon_reset.holdoff, node_ptr->hwmon_reset.retries, node_ptr->hwmon_reset.state, node_ptr->hwmon_reset.control_timer.tid, node_ptr->hwmon_reset.recovery_timer.tid); mem_log (str); } void nodeLinkClass::mem_log_network ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\t%s %s infra_ip: %s Uptime: %u\n", node_ptr->hostname.c_str(), node_ptr->mac.c_str(), node_ptr->ip.c_str(), node_ptr->infra_ip.c_str(), node_ptr->uptime ); mem_log (str); } void nodeLinkClass::mem_log_heartbeat ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; for ( int iface = 0 ; iface < MAX_IFACES ; iface++ ) { snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\t%s Minor:%s Degrade:%s Failed:%s Monitor:%s\n", node_ptr->hostname.c_str(), get_iface_name_str (iface), node_ptr->hbs_minor[iface] ? "true " : "false", node_ptr->hbs_degrade[iface] ? "true " : "false", node_ptr->hbs_failure[iface] ? "true " : "false", node_ptr->monitor[iface] ? "YES" : "no" ); mem_log (str); } } void nodeLinkClass::mem_log_hbs_cnts ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; for ( int iface = 0 ; iface < MAX_IFACES ; iface++ ) { snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\t%s Counts Minor:%d Degrade:%d Failed:%d Misses:%d MaxB2BMisses:%d Cur:%d Tot:%d\n", node_ptr->hostname.c_str(), get_iface_name_str(iface), node_ptr->hbs_minor_count[iface], node_ptr->hbs_degrade_count[iface], node_ptr->hbs_failure_count[iface], node_ptr->hbs_misses_count[iface], node_ptr->max_count[iface], node_ptr->b2b_pulses_count[iface], node_ptr->hbs_count[iface]); mem_log (str); } } void nodeLinkClass::mem_log_test_info ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tOOS Stage:%s Runs:%d - INSV Stage:%s Runs:%d\n", node_ptr->hostname.c_str(), get_oosTestStages_str(node_ptr->oosTestStage).c_str(), node_ptr->oos_test_count, get_insvTestStages_str(node_ptr->insvTestStage).c_str(), node_ptr->insv_test_count); mem_log (str); } void nodeLinkClass::mem_log_thread_info ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tThread Stage:%d Runs:%d Progress:%d Ctrl Status:%d Thread Status:%d\n", node_ptr->hostname.c_str(), node_ptr->ipmitool_thread_ctrl.stage, node_ptr->ipmitool_thread_ctrl.runcount, node_ptr->ipmitool_thread_info.progress, node_ptr->ipmitool_thread_ctrl.status, node_ptr->ipmitool_thread_info.status); mem_log (str); } void nodeLinkClass::mem_log_type_info ( struct nodeLinkClass::node * node_ptr ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tSystem:%d NodeMask: %x Function: %s (%u)\n", node_ptr->hostname.c_str(), this->system_type, node_ptr->nodetype, node_ptr->function_str.c_str(), node_ptr->function); mem_log (str); if (( CPE_SYSTEM ) && ( is_controller(node_ptr) == true )) { snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\tSub-Function: %s (%u) (SubFunc Enabled:%c)\n", node_ptr->hostname.c_str(), node_ptr->subfunction_str.c_str(), node_ptr->subfunction, node_ptr->subf_enabled ? 'Y' : 'n' ); mem_log (str); } } void mem_log_delimit_host ( void ) { char str[MAX_MEM_LOG_DATA] ; snprintf (&str[0], MAX_MEM_LOG_DATA, "-------------------------------------------------------------\n"); mem_log (str); } void nodeLinkClass::memDumpNodeState ( string hostname ) { nodeLinkClass::node* node_ptr ; node_ptr = nodeLinkClass::getNode ( hostname ); if ( node_ptr == NULL ) { mem_log ( hostname, ": ", "Not Found\n" ); return ; } else { if ( maintenance == true ) { mem_log_dor ( node_ptr ); mem_log_identity ( node_ptr ); mem_log_type_info ( node_ptr ); mem_log_network ( node_ptr ); mem_log_state1 ( node_ptr ); mem_log_state2 ( node_ptr ); // mem_log_reset_info ( node_ptr ); mem_log_power_info ( node_ptr ); mem_log_alarm1 ( node_ptr ); mem_log_mtcalive ( node_ptr ); mem_log_stage ( node_ptr ); mem_log_bm ( node_ptr ); mem_log_test_info ( node_ptr ); mem_log_thread_info( node_ptr ); workQueue_dump ( node_ptr ); } if ( heartbeat == true ) { mem_log_heartbeat( node_ptr ); mem_log_hbs_cnts ( node_ptr ); } mem_log_delimit_host (); } } void nodeLinkClass::memDumpAllState ( void ) { mem_log_delimit_host (); mem_log_general (); if ( nodeLinkClass::maintenance == true ) { mem_log_general_mtce_hosts(); mem_log_mnfa (); } mem_log_delimit_host (); /* walk the node list looking for nodes that should be monitored */ for ( struct node * ptr = head ; ptr != NULL ; ptr = ptr->next ) { memDumpNodeState ( ptr->hostname ); } } /*************************************************************************** * * * Module Test Head * * * ***************************************************************************/ int nodeLinkClass::testhead ( int test ) { UNUSED(test); return (PASS) ; }
34.746804
210
0.53363
[ "render", "object", "3d" ]
206a3b15b01afc5aa3c58ff8625547ea5cffdaea
3,648
cpp
C++
src/qubits/default/default.cpp
lanamineh/qsl
7e339d2345297709ef817d78ae3a52a33b1c8614
[ "Apache-2.0" ]
null
null
null
src/qubits/default/default.cpp
lanamineh/qsl
7e339d2345297709ef817d78ae3a52a33b1c8614
[ "Apache-2.0" ]
null
null
null
src/qubits/default/default.cpp
lanamineh/qsl
7e339d2345297709ef817d78ae3a52a33b1c8614
[ "Apache-2.0" ]
null
null
null
/* * Authors: Lana Mineh and John Scott * Copyright 2021 Phasecraft Ltd. and John Scott * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * \file default.cpp * \brief Contains the implementation of constructors and * set/get methods of the Default qubits class. */ #include "qsl/qubits.hpp" #include "qsl/utils/misc.hpp" #include "qsl/utils/quantum.hpp" #include <iostream> template<> const std::string qsl::Qubits<qsl::Type::Default, double>::name = std::string("Qub<def,double>"); template<> const std::string qsl::Qubits<qsl::Type::Default, float>::name = std::string("Qub<def,float>"); template<std::floating_point Fp> qsl::Qubits<qsl::Type::Default, Fp>::Qubits(unsigned nqubits_in) : nqubits{ nqubits_in }, dim{ std::size_t(1) << nqubits }, state(dim), random(0,1) { // Make the all-zero state reset(); } template<std::floating_point Fp> qsl::Qubits<qsl::Type::Default, Fp>::Qubits(const std::vector<qsl::complex<Fp>> & state) : nqubits{ qsl::checkStateSize(state) }, dim{ state.size() }, state{state}, random(0,1) { //std::cout << "nqubits = " << nqubits << std::endl; //std::cout << "dim = " << dim << std::endl; } template<std::floating_point Fp> void qsl::Qubits<qsl::Type::Default, Fp>::reset() { for (std::size_t n=0; n<dim; n++) { state[n].real = 0; state[n].imag = 0; } state[0].real = 1; } template<std::floating_point Fp> void qsl::Qubits<qsl::Type::Default, Fp>::setState(const std::vector<qsl::complex<Fp>> & state_in) { if (state_in.size() != dim) { std::string msg = "Cannot assign state vector from different "; msg += "number of qubits"; throw std::logic_error(msg); } // Set the new state vector state = state_in; } template<std::floating_point Fp> void qsl::Qubits<qsl::Type::Default, Fp>::setBasisState(std::size_t index) { // Clear the state - set all amplitudes to zero for (std::size_t n = 0; n < dim; n++) { state[n].real = 0; state[n].imag = 0; } // Set the amplitude for index to 1 state[index].real = 1; } template<std::floating_point Fp> void qsl::Qubits<qsl::Type::Default, Fp>::operator = (const Qubits & old) { // Check if nqubits (and therefore dim) are the same if (nqubits != old.nqubits) { std::string msg = "Cannot assign Qubits object vector from different "; msg += "number of qubits"; throw std::logic_error(msg); } // Set the new state vector state = old.state; } /// Get the state vector associated to the qubits template<std::floating_point Fp> std::vector<qsl::complex<Fp>> qsl::Qubits<qsl::Type::Default, Fp>::getState() const { return state; } template<std::floating_point Fp> unsigned qsl::Qubits<qsl::Type::Default, Fp>::getNumQubits() const { return nqubits; } template<std::floating_point Fp> void qsl::Qubits<qsl::Type::Default, Fp>::print(std::ostream & os) const { os << "Number of qubits = " << nqubits << std::endl; os << state << std::endl; } // Explicit instantiations template class qsl::Qubits<qsl::Type::Default, float>; template class qsl::Qubits<qsl::Type::Default, double>;
27.636364
98
0.663925
[ "object", "vector" ]
206db54ae31ec17ba594ec2525c8a6246f64b2ba
2,283
cpp
C++
STRING ALGORITHM/WEEK 3/SUFFIX ARRAY LONG/suffix_array_long.cpp
Mohit-007/DSA-UCDS-COURSERA
f5826a6f393e3b69ed8cf1c47df4d7a319b2d1fd
[ "MIT" ]
null
null
null
STRING ALGORITHM/WEEK 3/SUFFIX ARRAY LONG/suffix_array_long.cpp
Mohit-007/DSA-UCDS-COURSERA
f5826a6f393e3b69ed8cf1c47df4d7a319b2d1fd
[ "MIT" ]
null
null
null
STRING ALGORITHM/WEEK 3/SUFFIX ARRAY LONG/suffix_array_long.cpp
Mohit-007/DSA-UCDS-COURSERA
f5826a6f393e3b69ed8cf1c47df4d7a319b2d1fd
[ "MIT" ]
null
null
null
#include <algorithm> #include <iostream> #include <string> #include <vector> #include <utility> using std::cin; using std::cout; using std::endl; using std::make_pair; using std::pair; using std::string; using std::vector; struct suff { int ind; int r[2]; }; int cmp(suff p, suff q) { return (p.r[0] == q.r[0]) ? (p.r[1] < q.r[1]) : (p.r[0] < q.r[0]); } // Build suffix array of the string text and // return a vector result of the same length as the text // such that the value result[i] is the index (0-based) // in text where the i-th lexicographically smallest // suffix of text starts. vector<int> BuildSuffixArray(const string& text) { vector<int> result; // Implement this function yourself suff s[text.length()]; int i,k; for(i=0;i<text.length();i++) { s[i].ind = i; s[i].r[0] = text[i] - 'a'; if(i + 1 < text.length()) s[i].r[1] = text[i + 1] - 'a' ; else s[i].r[1] = -1; } std::sort(s, s + text.length(), cmp); int ind[text.length()]; for (k = 4; k < 2 * text.length(); k *= 2) { int r = 0; int prev_rank = s[0].r[0]; s[0].r[0] = r; ind[s[0].ind] = 0; for(i=1;i<text.length();i++) { if(s[i].r[0] == prev_rank && s[i].r[1] == s[i - 1].r[1]) { prev_rank = s[i].r[0]; s[i].r[0] = r; } else { prev_rank = s[i].r[0]; s[i].r[0] = ++r; } ind[s[i].ind] = i; } for (i=0;i<text.length();i++) { int next_ind = s[i].ind + k / 2; if(next_ind < text.length()) s[i].r[1] = s[ind[next_ind]].r[0] ; else s[i].r[1] = -1; } std::sort(s, s + text.length(), cmp); } for(i=0;i<text.length();i++) result.push_back(s[i].ind); return result; } int main() { string text; cin >> text; vector<int> suffix_array = BuildSuffixArray(text); for (int i = 0; i < suffix_array.size(); ++i) { cout << suffix_array[i] << ' '; } cout << endl; return 0; }
20.567568
71
0.450723
[ "vector" ]
20732349b02dd8cb7f418d2facb26fb824d13cca
1,584
cpp
C++
p166m/fraction_to_decimal.cpp
l33tdaima/l33tdaima
0a7a9573dc6b79e22dcb54357493ebaaf5e0aa90
[ "MIT" ]
1
2020-02-20T12:04:46.000Z
2020-02-20T12:04:46.000Z
p166m/fraction_to_decimal.cpp
l33tdaima/l33tdaima
0a7a9573dc6b79e22dcb54357493ebaaf5e0aa90
[ "MIT" ]
null
null
null
p166m/fraction_to_decimal.cpp
l33tdaima/l33tdaima
0a7a9573dc6b79e22dcb54357493ebaaf5e0aa90
[ "MIT" ]
null
null
null
// g++ -std=c++11 *.cpp -o test && ./test && rm test #include <string> #include <unordered_map> #include <vector> #include <iostream> using namespace std; class Solution { public: string fractionToDecimal(int numerator, int denominator) { return fractionToDecimal((int64_t)numerator, (int64_t)denominator); } string fractionToDecimal(int64_t n, int64_t d) { if (n == 0) { return "0"; } string ans; if (n < 0 ^ d < 0) { ans += "-"; } n = abs(n); d = abs(d); // integral part ans += to_string(n / d); if (n % d == 0) { return ans; } ans += "."; unordered_map<int, int> seen; for (int64_t r = n % d; r != 0; r = r % d) { if (seen.count(r)) { ans.insert(seen[r], "("); ans += ")"; break; } seen[r] = ans.size(); r *= 10; ans += to_string(r / d); } return ans; } }; struct Test { int n; int d; string expected; void run() { Solution sol; string act = sol.fractionToDecimal(n, d); cout << n << " / " << d << " = " << act << endl; assert(act == expected); } }; int main(int argc, char const *argv[]) { vector<Test> tests = { {0, 1, "0"}, {4, 2, "2"}, {1, 3, "0.(3)"}, {1, 6, "0.1(6)"}, {1, 7, "0.(142857)"}, {1, 11, "0.(09)"}, {1, 12, "0.08(3)"}, {3, 11, "0.(27)"}, }; for (auto& t: tests) { t.run(); } return 0; }
23.641791
75
0.430556
[ "vector" ]
2077981a0fc5555c9e5cdb5aa7adbe9cdcf103ce
26,813
cpp
C++
src/lib/statement/class_statement.cpp
paramah/hiphop-php-osx
5ed8c24abe8ad9fd7bc6dd4c28b4ffff23e54362
[ "PHP-3.01", "Zend-2.0" ]
1
2015-11-05T21:45:07.000Z
2015-11-05T21:45:07.000Z
src/lib/statement/class_statement.cpp
brion/hiphop-php
df70a236e6418d533ac474be0c01f0ba87034d7f
[ "PHP-3.01", "Zend-2.0" ]
null
null
null
src/lib/statement/class_statement.cpp
brion/hiphop-php
df70a236e6418d533ac474be0c01f0ba87034d7f
[ "PHP-3.01", "Zend-2.0" ]
null
null
null
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ */ #include <lib/statement/class_statement.h> #include <lib/parser/hphp.tab.hpp> #include <lib/expression/expression_list.h> #include <lib/statement/statement_list.h> #include <lib/expression/scalar_expression.h> #include <lib/analysis/class_scope.h> #include <lib/analysis/file_scope.h> #include <lib/analysis/function_scope.h> #include <lib/analysis/analysis_result.h> #include <lib/analysis/dependency_graph.h> #include <lib/statement/method_statement.h> #include <lib/analysis/variable_table.h> #include <lib/analysis/constant_table.h> #include <util/util.h> #include <lib/statement/interface_statement.h> #include <lib/option.h> #include <sstream> using namespace HPHP; using namespace std; using namespace boost; /////////////////////////////////////////////////////////////////////////////// // constructors/destructors ClassStatement::ClassStatement (STATEMENT_CONSTRUCTOR_PARAMETERS, int type, const std::string &name, const std::string &parent, ExpressionListPtr base, StatementListPtr stmt) : InterfaceStatement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES, name, base, stmt), m_type(type) { m_parent = Util::toLower(parent); } StatementPtr ClassStatement::clone() { ClassStatementPtr stmt(new ClassStatement(*this)); stmt->m_stmt = Clone(m_stmt); stmt->m_base = Clone(m_base); return stmt; } /////////////////////////////////////////////////////////////////////////////// // parser functions void ClassStatement::onParse(AnalysisResultPtr ar) { ClassScope::KindOf kindOf = ClassScope::KindOfObjectClass; switch (m_type) { case T_CLASS: kindOf = ClassScope::KindOfObjectClass; break; case T_ABSTRACT: kindOf = ClassScope::KindOfAbstractClass; break; case T_FINAL: kindOf = ClassScope::KindOfFinalClass; break; default: ASSERT(false); } vector<string> bases; if (!m_parent.empty()) bases.push_back(m_parent); if (m_base) m_base->getStrings(bases); StatementPtr stmt = dynamic_pointer_cast<Statement>(shared_from_this()); ClassScopePtr classScope(new ClassScope(kindOf, m_originalName, m_parent, bases, stmt, ar->getFileScope())); m_classScope = classScope; ar->getFileScope()->addClass(ar, classScope); ar->recordClassSource(m_name, ar->getFileScope()->getName()); if (m_stmt) { ar->pushScope(classScope); bool seenConstruct = false; for (int i = 0; i < m_stmt->getCount(); i++) { MethodStatementPtr meth = dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]); if (meth && meth->getName() == "__construct") { seenConstruct = true; break; } } for (int i = 0; i < m_stmt->getCount(); i++) { if (!seenConstruct) { MethodStatementPtr meth = dynamic_pointer_cast<MethodStatement>((*m_stmt)[i]); if (meth && classScope && meth->getName() == classScope->getName() && !meth->getModifiers()->isStatic()) { // class-name constructor classScope->setAttribute(ClassScope::classNameConstructor); } } IParseHandlerPtr ph = dynamic_pointer_cast<IParseHandler>((*m_stmt)[i]); ph->onParse(ar); } ar->popScope(); } } /////////////////////////////////////////////////////////////////////////////// // static analysis functions std::string ClassStatement::getName() const { return string("Class ") + m_classScope.lock()->getName(); } void ClassStatement::analyzeProgram(AnalysisResultPtr ar) { vector<string> bases; if (!m_parent.empty()) bases.push_back(m_parent); if (m_base) m_base->getStrings(bases); for (unsigned int i = 0; i < bases.size(); i++) { string className = bases[i]; addUserClass(ar, bases[i]); } ClassScopePtr classScope = m_classScope.lock(); if (hasHphpNote("Volatile")) classScope->setVolatile(); FunctionScopePtr func = ar->getFunctionScope(); // redeclared classes are automatically volatile if (classScope->isVolatile()) { func->getVariables()->setAttribute(VariableTable::NeedGlobalPointer); } if (m_stmt) { ar->pushScope(classScope); m_stmt->analyzeProgram(ar); ar->popScope(); } DependencyGraphPtr dependencies = ar->getDependencyGraph(); for (unsigned int i = 0; i < bases.size(); i++) { ClassScopePtr cls = ar->findClass(bases[i]); if (cls) { if (dependencies->checkCircle(DependencyGraph::KindOfClassDerivation, m_originalName, cls->getOriginalName())) { ClassScopePtr classScope = m_classScope.lock(); ar->getCodeError()->record(CodeError::InvalidDerivation, shared_from_this(), ConstructPtr(), cls->getOriginalName()); m_parent = ""; m_base = ExpressionListPtr(); classScope->clearBases(); } else if (cls->isUserClass()) { dependencies->add(DependencyGraph::KindOfClassDerivation, ar->getName(), m_originalName, shared_from_this(), cls->getOriginalName(), cls->getStmt()); } } } } StatementPtr ClassStatement::preOptimize(AnalysisResultPtr ar) { return InterfaceStatement::preOptimize(ar); } StatementPtr ClassStatement::postOptimize(AnalysisResultPtr ar) { return InterfaceStatement::postOptimize(ar); } void ClassStatement::inferTypes(AnalysisResultPtr ar) { if (m_stmt) { ClassScopePtr classScope = m_classScope.lock(); ar->pushScope(classScope); m_stmt->inferTypes(ar); ar->popScope(); } } /////////////////////////////////////////////////////////////////////////////// // code generation functions void ClassStatement::getAllParents(AnalysisResultPtr ar, std::vector<std::string> &names) { if (!m_parent.empty()) { ClassScopePtr cls = ar->findClass(m_parent); if (cls) { cls->getAllParents(ar, names); names.push_back(m_parent); } } if (m_base) { vector<string> bases; m_base->getStrings(bases); for (unsigned int i = 0; i < bases.size(); i++) { ClassScopePtr cls = ar->findClass(bases[i]); if (cls) { cls->getAllParents(ar, names); names.push_back(bases[i]); } } } } void ClassStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { ClassScopePtr classScope = m_classScope.lock(); if (!classScope->isUserClass()) return; if (ar) ar->pushScope(classScope); switch (m_type) { case T_CLASS: break; case T_ABSTRACT: cg.printf("abstract "); break; case T_FINAL: cg.printf("final "); break; default: ASSERT(false); } cg.printf("class %s", m_name.c_str()); if (!m_parent.empty()) { cg.printf(" extends %s", m_parent.c_str()); } if (m_base) { cg.printf(" implements "); m_base->outputPHP(cg, ar); } cg.indentBegin(" {\n"); m_classScope.lock()->outputPHP(cg, ar); if (m_stmt) m_stmt->outputPHP(cg, ar); cg.indentEnd("}\n"); if (ar) ar->popScope(); } bool ClassStatement::hasImpl() const { ClassScopePtr cls = m_classScope.lock(); return cls->isVolatile() || cls->getVariables()->getAttribute(VariableTable::ContainsDynamicStatic); } void ClassStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { ClassScopePtr classScope = m_classScope.lock(); if (cg.getContext() == CodeGenerator::NoContext) { if (classScope->isRedeclaring()) { cg.printf("g->%s%s = ClassStaticsPtr(NEW(%s%s)());\n", Option::ClassStaticsObjectPrefix, m_name.c_str(), Option::ClassStaticsPrefix, classScope->getId().c_str()); } if (classScope->isVolatile()) { cg.printf("g->declareClass(\"%s\");\n", m_name.c_str()); } return; } if (cg.getContext() != CodeGenerator::CppForwardDeclaration) { printSource(cg); } ar->pushScope(classScope); string clsNameStr = classScope->getId(); const char *clsName = clsNameStr.c_str(); bool redeclared = classScope->isRedeclaring(); switch (cg.getContext()) { case CodeGenerator::CppForwardDeclaration: if (Option::GenerateCPPMacros) { cg.printf("FORWARD_DECLARE_CLASS(%s)\n", clsName); if (redeclared) { cg.printf("FORWARD_DECLARE_REDECLARED_CLASS(%s)\n", clsName); } } if (m_stmt) { cg.setContext(CodeGenerator::CppClassConstantsDecl); m_stmt->outputCPP(cg, ar); cg.setContext(CodeGenerator::CppForwardDeclaration); } break; case CodeGenerator::CppDeclaration: { ClassScopePtr parCls; if (!m_parent.empty()) parCls = ar->findClass(m_parent); cg.printf("class %s%s", Option::ClassPrefix, clsName); bool derived = false; if (!m_parent.empty() && classScope->derivesFrom(ar, m_parent)) { if (parCls->isRedeclaring()) { cg.printf(" : public DynamicObjectData"); } else { cg.printf(" : virtual public %s%s", Option::ClassPrefix, parCls->getId().c_str()); } derived = true; } if (m_base) { for (int i = 0; i < m_base->getCount(); i++) { ScalarExpressionPtr exp = dynamic_pointer_cast<ScalarExpression>((*m_base)[i]); const char *intf = exp->getString().c_str(); ClassScopePtr intfClassScope = ar->findClass(intf); if (intfClassScope && classScope->derivesFrom(ar, intf)) { // temporary fix for inheriting from a re-declaring class string id = intfClassScope->getId(); if (!derived) { derived = true; cg.printf(" :"); } else { cg.printf(","); } cg.printf(" virtual public %s%s", Option::ClassPrefix, id.c_str()); } } } if (!derived) { const char *op = derived ? "," : " :"; if (classScope->derivesFromRedeclaring()) { cg.printf("%s public DynamicObjectData", op); } else { cg.printf("%s virtual public ObjectData", op); } } cg.indentBegin(" {\n"); if (Option::GenerateCPPMacros) { vector<string> bases; getAllParents(ar, bases); cg.indentBegin("BEGIN_CLASS_MAP(%s)\n", clsName); for (unsigned int i = 0; i < bases.size(); i++) { cg.printf("PARENT_CLASS(%s)\n", bases[i].c_str()); } cg.indentEnd("END_CLASS_MAP(%s)\n", clsName); } if (Option::GenerateCPPMacros) { bool dyn = classScope->derivesFromRedeclaring() == ClassScope::DirectFromRedeclared; bool idyn = classScope->derivesFromRedeclaring() == ClassScope::IndirectFromRedeclared; bool redec = classScope->isRedeclaring(); if (!classScope->derivesFromRedeclaring()) { cg.printf("DECLARE_CLASS(%s, %s, %s)\n", clsName, m_originalName.c_str(), m_parent.empty() ? "ObjectData" : m_parent.c_str()); } else { cg.printf("DECLARE_DYNAMIC_CLASS(%s, %s)\n", clsName, m_originalName.c_str()); } if (cg.getOutput() == CodeGenerator::SystemCPP || Option::EnableEval >= Option::LimitedEval) { cg.printf("DECLARE_INVOKES_FROM_EVAL\n"); } if (dyn || idyn || redec) { if (redec) { cg.indentBegin("Variant %sroot_invoke(const char* s, CArrRef ps, " "int64 h, bool f = true) {\n", Option::ObjectPrefix); cg.printf("return root->%sinvoke(s, ps, h, f);\n", Option::ObjectPrefix); cg.indentEnd("}\n"); cg.indentBegin("Variant %sroot_invoke_few_args(const char* s, " "int64 h, int count", Option::ObjectPrefix); for (int i = 0; i < Option::InvokeFewArgsCount; i++) { cg.printf(", CVarRef a%d = null_variant", i); } cg.printf(") {\n"); cg.printf("return root->%sinvoke_few_args(s, h, count", Option::ObjectPrefix); for (int i = 0; i < Option::InvokeFewArgsCount; i++) { cg.printf(", a%d", i); } cg.printf(");\n"); cg.indentEnd("}\n"); if (!dyn && !idyn) cg.printf("private: ObjectData* root;\n"); cg.printf("public:\n"); } string conInit = ":"; if (dyn) { conInit += "DynamicObjectData(\"" + m_parent + "\", r)"; } else if (idyn) { conInit += string(Option::ClassPrefix) + parCls->getId() + "(r?r:this)"; } else { conInit += "root(r?r:this)"; } cg.printf("%s%s(ObjectData* r = NULL)%s {}\n", Option::ClassPrefix, clsName, conInit.c_str()); } } cg.printf("void init();\n", Option::ClassPrefix, clsName); if (classScope->needLazyStaticInitializer()) { cg.printf("static GlobalVariables *lazy_initializer" "(GlobalVariables *g);\n"); } if (!classScope->derivesFromRedeclaring()){ classScope->getVariables()->outputCPPPropertyDecl(cg, ar); } if (!classScope->getAttribute(ClassScope::HasConstructor)) { FunctionScopePtr func = classScope->findFunction(ar, "__construct", false); if (func && !func->isAbstract() && !classScope->isInterface()) { ar->pushScope(func); func->outputCPPCreateDecl(cg, ar); ar->popScope(); } } if (classScope->getAttribute(ClassScope::HasDestructor)) { cg.printf("public: virtual void destruct();\n"); } // doCall if (classScope->getAttribute(ClassScope::HasUnknownMethodHandler)) { cg.printf("Variant doCall(Variant v_name, Variant v_arguments, " "bool fatal);\n"); } if (m_stmt) m_stmt->outputCPP(cg, ar); { set<string> done; classScope->outputCPPStaticMethodWrappers(cg, ar, done, clsName); } if (cg.getOutput() == CodeGenerator::SystemCPP && ar->isBaseSysRsrcClass(clsName) && !classScope->hasProperty("rsrc")) { cg.printf("public: Variant %srsrc;\n", Option::PropertyPrefix); } cg.indentEnd("};\n"); if (redeclared) { cg.indentBegin("class %s%s : public ClassStatics {\n", Option::ClassStaticsPrefix, clsName); cg.printf("public:\n"); cg.printf("DECLARE_OBJECT_ALLOCATION(%s%s);\n", Option::ClassStaticsPrefix, clsName); cg.printf("%s%s() : ClassStatics(%d) {}\n", Option::ClassStaticsPrefix, clsName, classScope->getRedeclaringId()); cg.indentBegin("Variant %sget(const char *s, int64 hash = -1) {\n", Option::ObjectStaticPrefix); cg.printf("return %s%s::%sget(s, hash);\n", Option::ClassPrefix, clsName, Option::ObjectStaticPrefix); cg.indentEnd("}\n"); cg.indentBegin("Variant &%slval(const char* s, int64 hash = -1) {\n", Option::ObjectStaticPrefix); cg.printf("return %s%s::%slval(s, hash);\n", Option::ClassPrefix, clsName, Option::ObjectStaticPrefix); cg.indentEnd("}\n"); cg.indentBegin("Variant %sinvoke(const char *c, const char *s, " "CArrRef params, int64 hash = -1, bool fatal = true) " "{\n", Option::ObjectStaticPrefix); cg.printf("return %s%s::%sinvoke(c, s, params, hash, fatal);\n", Option::ClassPrefix, clsName, Option::ObjectStaticPrefix); cg.indentEnd("}\n"); cg.indentBegin("Object create(CArrRef params, bool init = true, " "ObjectData* root = NULL) {\n"); cg.printf("return Object(%s%s(NEW(%s%s)(root))->" "dynCreate(params, init));\n", Option::SmartPtrPrefix, clsName, Option::ClassPrefix, clsName); cg.indentEnd("}\n"); cg.indentBegin("Variant %sconstant(const char* s) {\n", Option::ObjectStaticPrefix); cg.printf("return %s%s::%sconstant(s);\n", Option::ClassPrefix, clsName, Option::ObjectStaticPrefix); cg.indentEnd("}\n"); cg.indentBegin("Variant %sinvoke_from_eval(const char *c, " "const char *s, Eval::VariableEnvironment &env, " "const Eval::FunctionCallExpression *call, " "int64 hash = -1, bool fatal = true) " "{\n", Option::ObjectStaticPrefix); cg.printf("return %s%s::%sinvoke_from_eval(c, s, env, call, hash, " "fatal);\n", Option::ClassPrefix, clsName, Option::ObjectStaticPrefix); cg.indentEnd("}\n"); cg.indentEnd("};\n"); } } break; case CodeGenerator::CppImplementation: if (m_stmt) { cg.setContext(CodeGenerator::CppClassConstantsImpl); m_stmt->outputCPP(cg, ar); cg.setContext(CodeGenerator::CppImplementation); } classScope->outputCPPSupportMethodsImpl(cg, ar); if (redeclared) { cg.printf("IMPLEMENT_OBJECT_ALLOCATION(%s%s);\n", Option::ClassStaticsPrefix, clsName); } cg.indentBegin("void %s%s::init() {\n", Option::ClassPrefix, clsName); if (!m_parent.empty()) { if (classScope->derivesFromRedeclaring() == ClassScope::DirectFromRedeclared) { cg.printf("parent->init();\n"); } else { cg.printf("%s%s::init();\n", Option::ClassPrefix, m_parent.c_str()); } } cg.setContext(CodeGenerator::CppConstructor); if (m_stmt) m_stmt->outputCPP(cg, ar); cg.indentEnd("}\n"); if (classScope->needStaticInitializer()) { cg.indentBegin("void %s%s::os_static_initializer() {\n", Option::ClassPrefix, clsName); cg.printDeclareGlobals(); cg.setContext(CodeGenerator::CppStaticInitializer); if (m_stmt) m_stmt->outputCPP(cg, ar); cg.indentEnd("}\n"); cg.indentBegin("void %s%s() {\n", Option::ClassStaticInitializerPrefix, clsName); cg.printf("%s%s::os_static_initializer();\n", Option::ClassPrefix, clsName); cg.indentEnd("}\n"); } if (classScope->needLazyStaticInitializer()) { cg.indentBegin("GlobalVariables *%s%s::lazy_initializer(" "GlobalVariables *g) {\n", Option::ClassPrefix, clsName); cg.indentBegin("if (!g->%s%s) {\n", Option::ClassStaticInitializerFlagPrefix, clsName); cg.printf("g->%s%s = true;\n", Option::ClassStaticInitializerFlagPrefix, clsName); cg.setContext(CodeGenerator::CppLazyStaticInitializer); if (m_stmt) m_stmt->outputCPP(cg, ar); cg.indentEnd("}\n"); cg.printf("return g;\n"); cg.indentEnd("}\n"); } cg.setContext(CodeGenerator::CppImplementation); if (m_stmt) m_stmt->outputCPP(cg, ar); break; case CodeGenerator::CppFFIDecl: case CodeGenerator::CppFFIImpl: if (m_stmt) m_stmt->outputCPP(cg, ar); break; case CodeGenerator::JavaFFI: { if (classScope->isRedeclaring()) break; // TODO support PHP namespaces, once HPHP supports it string packageName = Option::JavaFFIRootPackage; string packageDir = packageName; Util::replaceAll(packageDir, ".", "/"); string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix + packageDir + "/"; Util::mkdir(outputDir); // uses a different cg to generate a separate file for each PHP class // also, uses the original capitalized class name string clsFile = outputDir + getOriginalName() + ".java"; ofstream fcls(clsFile.c_str()); CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP); cgCls.setContext(CodeGenerator::JavaFFI); cgCls.printf("package %s;\n\n", packageName.c_str()); cgCls.printf("import hphp.*;\n\n"); printSource(cgCls); string clsModifier; switch (m_type) { case T_CLASS: break; case T_ABSTRACT: clsModifier = "abstract "; break; case T_FINAL: clsModifier = "final "; break; } cgCls.printf("public %sclass %s ", clsModifier.c_str(), getOriginalName().c_str()); ClassScopePtr parCls; if (!m_parent.empty()) parCls = ar->findClass(m_parent); if (!m_parent.empty() && classScope->derivesFrom(ar, m_parent) && parCls->isUserClass() && !parCls->isRedeclaring()) { // system classes are not supported in static FFI translation // they shouldn't appear as superclasses as well cgCls.printf("extends %s", parCls->getOriginalName()); } else { cgCls.printf("extends HphpObject"); } if (m_base) { bool first = true; for (int i = 0; i < m_base->getCount(); i++) { ScalarExpressionPtr exp = dynamic_pointer_cast<ScalarExpression>((*m_base)[i]); const char *intf = exp->getString().c_str(); ClassScopePtr intfClassScope = ar->findClass(intf); if (intfClassScope && classScope->derivesFrom(ar, intf) && intfClassScope->isUserClass()) { if (first) { cgCls.printf(" implements "); first = false; } else { cgCls.printf(", "); } cgCls.printf(intfClassScope->getOriginalName()); } } } cgCls.indentBegin(" {\n"); // constructor for initializing the variant pointer cgCls.printf("protected %s(long ptr) { super(ptr); }\n\n", getOriginalName().c_str()); FunctionScopePtr cons = classScope->findConstructor(ar, true); if (cons && !cons->isAbstract() || m_type != T_ABSTRACT) { // if not an abstract class and not having an explicit constructor, // adds a default constructor outputJavaFFIConstructor(cgCls, ar, cons); } if (m_stmt) m_stmt->outputCPP(cgCls, ar); cgCls.indentEnd("}\n"); fcls.close(); } break; case CodeGenerator::JavaFFICppDecl: case CodeGenerator::JavaFFICppImpl: { if (classScope->isRedeclaring()) break; if (m_stmt) m_stmt->outputCPP(cg, ar); FunctionScopePtr cons = classScope->findConstructor(ar, true); if (cons && !cons->isAbstract() || m_type != T_ABSTRACT) { outputJavaFFICPPCreator(cg, ar, cons); } } break; default: ASSERT(false); break; } ar->popScope(); } void ClassStatement::outputJavaFFIConstructor(CodeGenerator &cg, AnalysisResultPtr ar, FunctionScopePtr cons) { int ac = cons ? cons->getMaxParamCount() : 0; bool varArgs = cons && cons->isVariableArgument(); // generates the constructor cg.printf("public %s(", getOriginalName().c_str()); ostringstream args; ostringstream params; bool first = true; for (int i = 0; i < ac; i++) { if (first) { first = false; } else { cg.printf(", "); args << ", "; params << ", "; } cg.printf("HphpVariant a%d", i); args << "a" << i << ".getVariantPtr()"; params << "long a" << i; } if (varArgs) { if (!first) { cg.printf(", "); args << ", "; params << ", "; } cg.printf("HphpVariant va"); args << "va.getVariantPtr()"; params << "long va"; } cg.indentBegin(") {\n"); cg.printf("this(create(%s));\n", args.str().c_str()); cg.indentEnd("}\n\n"); // generates the native method stub for creating the object cg.printf("private static native long create(%s);\n\n", params.str().c_str()); } void ClassStatement::outputJavaFFICPPCreator(CodeGenerator &cg, AnalysisResultPtr ar, FunctionScopePtr cons) { ClassScopePtr cls = m_classScope.lock(); string packageName = Option::JavaFFIRootPackage; int ac = cons ? cons->getMaxParamCount() : 0; bool varArgs = cons && cons->isVariableArgument(); const char *clsName = getOriginalName().c_str(); string mangledName = "Java_" + packageName + "_" + clsName + "_create"; Util::replaceAll(mangledName, ".", "_"); cg.printf("JNIEXPORT jlong JNICALL\n"); cg.printf("%s(JNIEnv *env, jclass cls", mangledName.c_str()); ostringstream args; bool first = true; if (varArgs) { args << ac << " + (((Variant *)va)->isNull() ? 0" << " : ((Variant *)va)->getArrayData()->size())"; first = false; } for (int i = 0; i < ac; i++) { if (first) first = false; else { args << ", "; } cg.printf(", jlong a%d", i); args << "*(Variant *)a" << i; } if (varArgs) { if (!first) { args << ", "; } cg.printf(", jlong va"); args << "((Variant *)va)->toArray()"; } if (cg.getContext() == CodeGenerator::JavaFFICppDecl) { // java_stubs.h cg.printf(");\n\n"); return; } cg.indentBegin(") {\n"); cg.printf("ObjectData *obj = "); cg.printf("(NEW(%s%s)())->create(%s);\n", Option::ClassPrefix, cls->getId().c_str(), args.str().c_str()); cg.printf("obj->incRefCount();\n"); cg.printf("return (jlong)(NEW(Variant)(obj));\n"); cg.indentEnd("}\n\n"); }
35.326746
80
0.564129
[ "object", "vector" ]
208363c6d0cd70e4ed74632c77186caf29abdad0
2,305
cxx
C++
vtkm/cont/AssignerMultiBlock.cxx
cjy7117/VTK-m-FP16
3afaaaececf53f32db1afb8f069a5446271dfdf4
[ "BSD-3-Clause" ]
null
null
null
vtkm/cont/AssignerMultiBlock.cxx
cjy7117/VTK-m-FP16
3afaaaececf53f32db1afb8f069a5446271dfdf4
[ "BSD-3-Clause" ]
null
null
null
vtkm/cont/AssignerMultiBlock.cxx
cjy7117/VTK-m-FP16
3afaaaececf53f32db1afb8f069a5446271dfdf4
[ "BSD-3-Clause" ]
2
2020-07-06T06:32:00.000Z
2020-08-24T14:08:15.000Z
//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //============================================================================ #include <vtkm/cont/AssignerMultiBlock.h> #include <vtkm/cont/EnvironmentTracker.h> #include <vtkm/cont/MultiBlock.h> #include <vtkm/thirdparty/diy/diy.h> #include <algorithm> // std::lower_bound #include <numeric> // std::iota namespace vtkm { namespace cont { VTKM_CONT AssignerMultiBlock::AssignerMultiBlock(const vtkm::cont::MultiBlock& mb) : AssignerMultiBlock(mb.GetNumberOfBlocks()) { } VTKM_CONT AssignerMultiBlock::AssignerMultiBlock(vtkm::Id num_blocks) : vtkmdiy::StaticAssigner(vtkm::cont::EnvironmentTracker::GetCommunicator().size(), 1) , IScanBlockCounts() { auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator(); if (comm.size() > 1) { vtkm::Id iscan; vtkmdiy::mpi::scan(comm, num_blocks, iscan, std::plus<vtkm::Id>()); vtkmdiy::mpi::all_gather(comm, iscan, this->IScanBlockCounts); } else { this->IScanBlockCounts.push_back(num_blocks); } this->set_nblocks(static_cast<int>(this->IScanBlockCounts.back())); } VTKM_CONT void AssignerMultiBlock::local_gids(int my_rank, std::vector<int>& gids) const { const size_t s_rank = static_cast<size_t>(my_rank); if (my_rank == 0) { assert(this->IScanBlockCounts.size() > 0); gids.resize(static_cast<size_t>(this->IScanBlockCounts[s_rank])); std::iota(gids.begin(), gids.end(), 0); } else if (my_rank > 0 && s_rank < this->IScanBlockCounts.size()) { gids.resize( static_cast<size_t>(this->IScanBlockCounts[s_rank] - this->IScanBlockCounts[s_rank - 1])); std::iota(gids.begin(), gids.end(), static_cast<int>(this->IScanBlockCounts[s_rank - 1])); } } VTKM_CONT int AssignerMultiBlock::rank(int gid) const { return static_cast<int>( std::lower_bound(this->IScanBlockCounts.begin(), this->IScanBlockCounts.end(), gid + 1) - this->IScanBlockCounts.begin()); } } // vtkm::cont } // vtkm
28.45679
96
0.660304
[ "vector" ]
2084ea5e874a4966b7e126bf4a8fc183d57d997e
1,470
cpp
C++
codejam/Problem3/main.cpp
qiaotian/CodeInterview
294c1ba86d8ace41a121c5ada4ba4c3765ccc17d
[ "WTFPL" ]
5
2016-10-29T09:28:11.000Z
2019-10-19T23:02:48.000Z
codejam/Problem3/main.cpp
qiaotian/CodeInterview
294c1ba86d8ace41a121c5ada4ba4c3765ccc17d
[ "WTFPL" ]
null
null
null
codejam/Problem3/main.cpp
qiaotian/CodeInterview
294c1ba86d8ace41a121c5ada4ba4c3765ccc17d
[ "WTFPL" ]
null
null
null
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <set> #include <map> #include <unordered_map> #include <unordered_set> using namespace std; int main(int argc, const char* argv[]) { //string inpath = argv[1]; //string outpath = argv[2]; string inpath = "/Users/qiaotian/Downloads/test2.txt"; string outpath = "/Users/qiaotian/Desktop/Problem3/test2.out.txt"; ifstream infile(inpath); ofstream outfile(outpath); if(!infile || !outfile) { cout << "open files failed" << endl; return EXIT_FAILURE; } int num_cases = 0; // test case number string currline; //vector<vector<int> > tests; getline(infile, currline); num_cases = stoi(currline); for(int i=0; i<num_cases; i++){ int M, N; //vector<string> names; //vector<pair<string, int>> count; // name to count getline(infile, currline); istringstream iss(currline); iss>> M >> N; // rows and cols vector<vector<int>> height(M, vector<int>(N, 0)); for(int i=0; i<M; i++) { getline(infile, currline); istringstream iss(currline); for(int j=0; j<N; j++) { iss >> height[i][j]; } } // output the result outfile << "Case #" << i+1 <<": " << count[0].first << endl; } infile.close(); outfile.close(); return 0; }
21
70
0.560544
[ "vector" ]
2086ffad453c6fa999e7ee5d5bbfbec6f3bf8553
782,457
cpp
C++
src/main_2200.cpp
sc2ad/BeatSaber-Quest-Codegen
ba8acaae541cfe1161e05fbc3bf87f4bc46bc4ab
[ "Unlicense" ]
23
2020-08-07T04:09:00.000Z
2022-03-31T22:10:29.000Z
src/main_2200.cpp
sc2ad/BeatSaber-Quest-Codegen
ba8acaae541cfe1161e05fbc3bf87f4bc46bc4ab
[ "Unlicense" ]
6
2021-09-29T23:47:31.000Z
2022-03-30T20:49:23.000Z
src/main_2200.cpp
sc2ad/BeatSaber-Quest-Codegen
ba8acaae541cfe1161e05fbc3bf87f4bc46bc4ab
[ "Unlicense" ]
17
2020-08-20T19:36:52.000Z
2022-03-30T18:28:24.000Z
// Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus #include "HoudiniEngineUnity/HEU_Task.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus NONE HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_NONE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_NONE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "NONE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus NONE void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_NONE(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_NONE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "NONE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus PENDING_START HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_PENDING_START() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_PENDING_START"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "PENDING_START")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus PENDING_START void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_PENDING_START(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_PENDING_START"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "PENDING_START", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus STARTED HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_STARTED() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_STARTED"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "STARTED")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus STARTED void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_STARTED(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_STARTED"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "STARTED", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus REQUIRE_UPDATE HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_REQUIRE_UPDATE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_REQUIRE_UPDATE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "REQUIRE_UPDATE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus REQUIRE_UPDATE void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_REQUIRE_UPDATE(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_REQUIRE_UPDATE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "REQUIRE_UPDATE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus PENDING_COMPLETE HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_PENDING_COMPLETE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_PENDING_COMPLETE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "PENDING_COMPLETE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus PENDING_COMPLETE void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_PENDING_COMPLETE(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_PENDING_COMPLETE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "PENDING_COMPLETE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus COMPLETED HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_COMPLETED() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_COMPLETED"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "COMPLETED")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus COMPLETED void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_COMPLETED(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_COMPLETED"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "COMPLETED", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus UNUSED HoudiniEngineUnity::HEU_Task::TaskStatus HoudiniEngineUnity::HEU_Task::TaskStatus::_get_UNUSED() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_get_UNUSED"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskStatus>("HoudiniEngineUnity", "HEU_Task/TaskStatus", "UNUSED")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskStatus UNUSED void HoudiniEngineUnity::HEU_Task::TaskStatus::_set_UNUSED(HoudiniEngineUnity::HEU_Task::TaskStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::_set_UNUSED"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskStatus", "UNUSED", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_Task::TaskStatus::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskStatus::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult #include "HoudiniEngineUnity/HEU_Task.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult NONE HoudiniEngineUnity::HEU_Task::TaskResult HoudiniEngineUnity::HEU_Task::TaskResult::_get_NONE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_get_NONE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskResult>("HoudiniEngineUnity", "HEU_Task/TaskResult", "NONE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult NONE void HoudiniEngineUnity::HEU_Task::TaskResult::_set_NONE(HoudiniEngineUnity::HEU_Task::TaskResult value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_set_NONE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskResult", "NONE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult SUCCESS HoudiniEngineUnity::HEU_Task::TaskResult HoudiniEngineUnity::HEU_Task::TaskResult::_get_SUCCESS() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_get_SUCCESS"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskResult>("HoudiniEngineUnity", "HEU_Task/TaskResult", "SUCCESS")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult SUCCESS void HoudiniEngineUnity::HEU_Task::TaskResult::_set_SUCCESS(HoudiniEngineUnity::HEU_Task::TaskResult value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_set_SUCCESS"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskResult", "SUCCESS", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult FAILED HoudiniEngineUnity::HEU_Task::TaskResult HoudiniEngineUnity::HEU_Task::TaskResult::_get_FAILED() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_get_FAILED"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskResult>("HoudiniEngineUnity", "HEU_Task/TaskResult", "FAILED")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult FAILED void HoudiniEngineUnity::HEU_Task::TaskResult::_set_FAILED(HoudiniEngineUnity::HEU_Task::TaskResult value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_set_FAILED"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskResult", "FAILED", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult KILLED HoudiniEngineUnity::HEU_Task::TaskResult HoudiniEngineUnity::HEU_Task::TaskResult::_get_KILLED() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_get_KILLED"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_Task::TaskResult>("HoudiniEngineUnity", "HEU_Task/TaskResult", "KILLED")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskResult KILLED void HoudiniEngineUnity::HEU_Task::TaskResult::_set_KILLED(HoudiniEngineUnity::HEU_Task::TaskResult value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::_set_KILLED"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_Task/TaskResult", "KILLED", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_Task::TaskResult::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskResult::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskCallback #include "HoudiniEngineUnity/HEU_Task_TaskCallback.hpp" // Including type: System.IAsyncResult #include "System/IAsyncResult.hpp" // Including type: System.AsyncCallback #include "System/AsyncCallback.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskCallback.Invoke void HoudiniEngineUnity::HEU_Task::TaskCallback::Invoke(HoudiniEngineUnity::HEU_Task* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskCallback::Invoke"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Invoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, task); } // Autogenerated method: HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskCallback.BeginInvoke System::IAsyncResult* HoudiniEngineUnity::HEU_Task::TaskCallback::BeginInvoke(HoudiniEngineUnity::HEU_Task* task, System::AsyncCallback* callback, ::Il2CppObject* object) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskCallback::BeginInvoke"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BeginInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task), ::il2cpp_utils::ExtractType(callback), ::il2cpp_utils::ExtractType(object)}))); return ::il2cpp_utils::RunMethodThrow<System::IAsyncResult*, false>(this, ___internal__method, task, callback, object); } // Autogenerated method: HoudiniEngineUnity.HEU_Task/HoudiniEngineUnity.TaskCallback.EndInvoke void HoudiniEngineUnity::HEU_Task::TaskCallback::EndInvoke(System::IAsyncResult* result) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Task::TaskCallback::EndInvoke"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "EndInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(result)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, result); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_AssetTask #include "HoudiniEngineUnity/HEU_AssetTask.hpp" // Including type: HoudiniEngineUnity.HEU_HoudiniAsset #include "HoudiniEngineUnity/HEU_HoudiniAsset.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: HoudiniEngineUnity.HEU_CookedEventData #include "HoudiniEngineUnity/HEU_CookedEventData.hpp" // Including type: HoudiniEngineUnity.HEU_ReloadEventData #include "HoudiniEngineUnity/HEU_ReloadEventData.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType _buildType HoudiniEngineUnity::HEU_AssetTask::BuildType& HoudiniEngineUnity::HEU_AssetTask::dyn__buildType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::dyn__buildType"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_buildType"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_AssetTask::BuildType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_HoudiniAsset _asset HoudiniEngineUnity::HEU_HoudiniAsset*& HoudiniEngineUnity::HEU_AssetTask::dyn__asset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::dyn__asset"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_asset"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_HoudiniAsset**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _assetPath ::Il2CppString*& HoudiniEngineUnity::HEU_AssetTask::dyn__assetPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::dyn__assetPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_assetPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _position UnityEngine::Vector3& HoudiniEngineUnity::HEU_AssetTask::dyn__position() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::dyn__position"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_position"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _buildResult bool& HoudiniEngineUnity::HEU_AssetTask::dyn__buildResult() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::dyn__buildResult"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_buildResult"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int64 _forceSessionID int64_t& HoudiniEngineUnity::HEU_AssetTask::dyn__forceSessionID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::dyn__forceSessionID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_forceSessionID"))->offset; return *reinterpret_cast<int64_t*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.GetTaskSession HoudiniEngineUnity::HEU_SessionBase* HoudiniEngineUnity::HEU_AssetTask::GetTaskSession() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::GetTaskSession"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetTaskSession", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_SessionBase*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.CookCompletedCallback void HoudiniEngineUnity::HEU_AssetTask::CookCompletedCallback(HoudiniEngineUnity::HEU_HoudiniAsset* asset, bool bSuccess, System::Collections::Generic::List_1<UnityEngine::GameObject*>* outputs) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::CookCompletedCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CookCompletedCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(asset), ::il2cpp_utils::ExtractType(bSuccess), ::il2cpp_utils::ExtractType(outputs)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, asset, bSuccess, outputs); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.CookCompletedCallback void HoudiniEngineUnity::HEU_AssetTask::CookCompletedCallback(HoudiniEngineUnity::HEU_CookedEventData* cookedEventData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::CookCompletedCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CookCompletedCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(cookedEventData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, cookedEventData); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.CookCompletedCallback void HoudiniEngineUnity::HEU_AssetTask::CookCompletedCallback(HoudiniEngineUnity::HEU_ReloadEventData* reloadEventData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::CookCompletedCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CookCompletedCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(reloadEventData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, reloadEventData); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.DoTask void HoudiniEngineUnity::HEU_AssetTask::DoTask() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::DoTask"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DoTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.KillTask void HoudiniEngineUnity::HEU_AssetTask::KillTask() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::KillTask"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "KillTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_AssetTask.CompleteTask void HoudiniEngineUnity::HEU_AssetTask::CompleteTask(HoudiniEngineUnity::HEU_Task::TaskResult result) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::CompleteTask"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CompleteTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(result)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, result); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType #include "HoudiniEngineUnity/HEU_AssetTask.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType NONE HoudiniEngineUnity::HEU_AssetTask::BuildType HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_NONE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_NONE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_AssetTask::BuildType>("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "NONE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType NONE void HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_NONE(HoudiniEngineUnity::HEU_AssetTask::BuildType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_NONE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "NONE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType LOAD HoudiniEngineUnity::HEU_AssetTask::BuildType HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_LOAD() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_LOAD"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_AssetTask::BuildType>("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "LOAD")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType LOAD void HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_LOAD(HoudiniEngineUnity::HEU_AssetTask::BuildType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_LOAD"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "LOAD", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType COOK HoudiniEngineUnity::HEU_AssetTask::BuildType HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_COOK() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_COOK"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_AssetTask::BuildType>("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "COOK")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType COOK void HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_COOK(HoudiniEngineUnity::HEU_AssetTask::BuildType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_COOK"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "COOK", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType RELOAD HoudiniEngineUnity::HEU_AssetTask::BuildType HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_RELOAD() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_get_RELOAD"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_AssetTask::BuildType>("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "RELOAD")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_AssetTask/HoudiniEngineUnity.BuildType RELOAD void HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_RELOAD(HoudiniEngineUnity::HEU_AssetTask::BuildType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::_set_RELOAD"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_AssetTask/BuildType", "RELOAD", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_AssetTask::BuildType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_AssetTask::BuildType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_TaskManager #include "HoudiniEngineUnity/HEU_TaskManager.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Task> _tasks System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>* HoudiniEngineUnity::HEU_TaskManager::_get__tasks() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::_get__tasks"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>*>("HoudiniEngineUnity", "HEU_TaskManager", "_tasks")); } // Autogenerated static field setter // Set static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Task> _tasks void HoudiniEngineUnity::HEU_TaskManager::_set__tasks(System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::_set__tasks"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_TaskManager", "_tasks", value)); } // Autogenerated static field getter // Get static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Task> _pendingAdd System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>* HoudiniEngineUnity::HEU_TaskManager::_get__pendingAdd() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::_get__pendingAdd"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>*>("HoudiniEngineUnity", "HEU_TaskManager", "_pendingAdd")); } // Autogenerated static field setter // Set static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Task> _pendingAdd void HoudiniEngineUnity::HEU_TaskManager::_set__pendingAdd(System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::_set__pendingAdd"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_TaskManager", "_pendingAdd", value)); } // Autogenerated static field getter // Get static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Task> _pendingRemove System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>* HoudiniEngineUnity::HEU_TaskManager::_get__pendingRemove() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::_get__pendingRemove"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>*>("HoudiniEngineUnity", "HEU_TaskManager", "_pendingRemove")); } // Autogenerated static field setter // Set static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Task> _pendingRemove void HoudiniEngineUnity::HEU_TaskManager::_set__pendingRemove(System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Task*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::_set__pendingRemove"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_TaskManager", "_pendingRemove", value)); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager..cctor void HoudiniEngineUnity::HEU_TaskManager::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.Update void HoudiniEngineUnity::HEU_TaskManager::Update() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::Update"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.GetTask HoudiniEngineUnity::HEU_Task* HoudiniEngineUnity::HEU_TaskManager::GetTask(System::Guid taskGuid) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::GetTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "GetTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(taskGuid)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_Task*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, taskGuid); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.AddTask void HoudiniEngineUnity::HEU_TaskManager::AddTask(HoudiniEngineUnity::HEU_Task* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::AddTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "AddTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, task); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.KillTask void HoudiniEngineUnity::HEU_TaskManager::KillTask(HoudiniEngineUnity::HEU_Task* task, bool bRemove) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::KillTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "KillTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task), ::il2cpp_utils::ExtractType(bRemove)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, task, bRemove); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.KillTask void HoudiniEngineUnity::HEU_TaskManager::KillTask(System::Guid taskGuid, bool bRemove) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::KillTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "KillTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(taskGuid), ::il2cpp_utils::ExtractType(bRemove)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, taskGuid, bRemove); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.RemoveTask void HoudiniEngineUnity::HEU_TaskManager::RemoveTask(HoudiniEngineUnity::HEU_Task* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::RemoveTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "RemoveTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, task); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.ExecuteTask void HoudiniEngineUnity::HEU_TaskManager::ExecuteTask(HoudiniEngineUnity::HEU_Task* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::ExecuteTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "ExecuteTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, task); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.CompleteTask void HoudiniEngineUnity::HEU_TaskManager::CompleteTask(HoudiniEngineUnity::HEU_Task* task, HoudiniEngineUnity::HEU_Task::TaskResult result) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::CompleteTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "CompleteTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task), ::il2cpp_utils::ExtractType(result)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, task, result); } // Autogenerated method: HoudiniEngineUnity.HEU_TaskManager.InternalCompleteTask void HoudiniEngineUnity::HEU_TaskManager::InternalCompleteTask(HoudiniEngineUnity::HEU_Task* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TaskManager::InternalCompleteTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TaskManager", "InternalCompleteTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, task); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ThreadManager #include "HoudiniEngineUnity/HEU_ThreadManager.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTask #include "HoudiniEngineUnity/HEU_ThreadedTask.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private HoudiniEngineUnity.HEU_ThreadManager _instance HoudiniEngineUnity::HEU_ThreadManager* HoudiniEngineUnity::HEU_ThreadManager::_get__instance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::_get__instance"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadManager*>("HoudiniEngineUnity", "HEU_ThreadManager", "_instance")); } // Autogenerated static field setter // Set static field: static private HoudiniEngineUnity.HEU_ThreadManager _instance void HoudiniEngineUnity::HEU_ThreadManager::_set__instance(HoudiniEngineUnity::HEU_ThreadManager* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::_set__instance"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadManager", "_instance", value)); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_ThreadedTask> _tasks System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTask*>*& HoudiniEngineUnity::HEU_ThreadManager::dyn__tasks() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::dyn__tasks"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tasks"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTask*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_ThreadedTask> _pendingAdd System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTask*>*& HoudiniEngineUnity::HEU_ThreadManager::dyn__pendingAdd() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::dyn__pendingAdd"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_pendingAdd"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTask*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_ThreadedTask> _pendingRemove System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTask*>*& HoudiniEngineUnity::HEU_ThreadManager::dyn__pendingRemove() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::dyn__pendingRemove"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_pendingRemove"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTask*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.get_Instance HoudiniEngineUnity::HEU_ThreadManager* HoudiniEngineUnity::HEU_ThreadManager::get_Instance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::get_Instance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ThreadManager", "get_Instance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_ThreadManager*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.CreateInstance void HoudiniEngineUnity::HEU_ThreadManager::CreateInstance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::CreateInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ThreadManager", "CreateInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.Register void HoudiniEngineUnity::HEU_ThreadManager::Register() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::Register"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Register", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.Unregister void HoudiniEngineUnity::HEU_ThreadManager::Unregister() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::Unregister"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Unregister", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.Update void HoudiniEngineUnity::HEU_ThreadManager::Update() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::Update"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.AddTask void HoudiniEngineUnity::HEU_ThreadManager::AddTask(HoudiniEngineUnity::HEU_ThreadedTask* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::AddTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, task); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.RemoveTask void HoudiniEngineUnity::HEU_ThreadManager::RemoveTask(HoudiniEngineUnity::HEU_ThreadedTask* task) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::RemoveTask"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RemoveTask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(task)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, task); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadManager.Finalize void HoudiniEngineUnity::HEU_ThreadManager::Finalize() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadManager::Finalize"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Finalize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_LoadBufferBase #include "HoudiniEngineUnity/HEU_LoadBufferBase.hpp" // Including type: HoudiniEngineUnity.HEU_GeneratedOutput #include "HoudiniEngineUnity/HEU_GeneratedOutput.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 _id int& HoudiniEngineUnity::HEU_LoadBufferBase::dyn__id() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferBase::dyn__id"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_id"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _name ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferBase::dyn__name() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferBase::dyn__name"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_name"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _bInstanced bool& HoudiniEngineUnity::HEU_LoadBufferBase::dyn__bInstanced() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferBase::dyn__bInstanced"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bInstanced"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _bInstancer bool& HoudiniEngineUnity::HEU_LoadBufferBase::dyn__bInstancer() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferBase::dyn__bInstancer"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bInstancer"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_GeneratedOutput _generatedOutput HoudiniEngineUnity::HEU_GeneratedOutput*& HoudiniEngineUnity::HEU_LoadBufferBase::dyn__generatedOutput() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferBase::dyn__generatedOutput"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_generatedOutput"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_GeneratedOutput**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_LoadBufferBase.InitializeBuffer void HoudiniEngineUnity::HEU_LoadBufferBase::InitializeBuffer(int id, ::Il2CppString* name, bool bInstanced, bool bInstancer) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferBase::InitializeBuffer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitializeBuffer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(id), ::il2cpp_utils::ExtractType(name), ::il2cpp_utils::ExtractType(bInstanced), ::il2cpp_utils::ExtractType(bInstancer)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, id, name, bInstanced, bInstancer); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_LoadBufferMesh #include "HoudiniEngineUnity/HEU_LoadBufferMesh.hpp" // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache #include "HoudiniEngineUnity/HEU_GenerateGeoCache.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_GeoGroup #include "HoudiniEngineUnity/HEU_GeoGroup.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_GenerateGeoCache _geoCache HoudiniEngineUnity::HEU_GenerateGeoCache*& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__geoCache() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__geoCache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_geoCache"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_GenerateGeoCache**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_GeoGroup> _LODGroupMeshes System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>*& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__LODGroupMeshes() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__LODGroupMeshes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_LODGroupMeshes"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _defaultMaterialKey int& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__defaultMaterialKey() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__defaultMaterialKey"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_defaultMaterialKey"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _bGenerateUVs bool& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bGenerateUVs() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bGenerateUVs"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bGenerateUVs"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _bGenerateTangents bool& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bGenerateTangents() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bGenerateTangents"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bGenerateTangents"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _bGenerateNormals bool& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bGenerateNormals() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bGenerateNormals"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bGenerateNormals"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _bPartInstanced bool& HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bPartInstanced() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferMesh::dyn__bPartInstanced"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bPartInstanced"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_LoadBufferVolume #include "HoudiniEngineUnity/HEU_LoadBufferVolume.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferVolumeLayer #include "HoudiniEngineUnity/HEU_LoadBufferVolumeLayer.hpp" // Including type: HoudiniEngineUnity.HEU_VolumeScatterTrees #include "HoudiniEngineUnity/HEU_VolumeScatterTrees.hpp" // Including type: HoudiniEngineUnity.HEU_DetailPrototype #include "HoudiniEngineUnity/HEU_DetailPrototype.hpp" // Including type: HoudiniEngineUnity.HEU_DetailProperties #include "HoudiniEngineUnity/HEU_DetailProperties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 _tileIndex int& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__tileIndex() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__tileIndex"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tileIndex"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_LoadBufferVolumeLayer> _splatLayers System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolumeLayer*>*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__splatLayers() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__splatLayers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_splatLayers"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolumeLayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _heightMapWidth int& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightMapWidth() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightMapWidth"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightMapWidth"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _heightMapHeight int& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightMapHeight() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightMapHeight"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightMapHeight"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[,] _heightMap ::ArrayW<float>& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightMap"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[,,] _splatMaps ::ArrayW<float>& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__splatMaps() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__splatMaps"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_splatMaps"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _terrainSizeX float& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainSizeX() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainSizeX"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainSizeX"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _terrainSizeY float& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainSizeY() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainSizeY"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainSizeY"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _heightRange float& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightRange() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__heightRange"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightRange"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _position UnityEngine::Vector3& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__position() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__position"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_position"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _terrainDataPath ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainDataPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainDataPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainDataPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _terrainDataExportPath ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainDataExportPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__terrainDataExportPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainDataExportPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_VolumeScatterTrees _scatterTrees HoudiniEngineUnity::HEU_VolumeScatterTrees*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__scatterTrees() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__scatterTrees"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scatterTrees"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_VolumeScatterTrees**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_DetailPrototype> _detailPrototypes System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_DetailPrototype*>*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__detailPrototypes() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__detailPrototypes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_detailPrototypes"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_DetailPrototype*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<System.Int32[,]> _detailMaps System::Collections::Generic::List_1<::ArrayW<int>>*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__detailMaps() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__detailMaps"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_detailMaps"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<::ArrayW<int>>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_DetailProperties _detailProperties HoudiniEngineUnity::HEU_DetailProperties*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__detailProperties() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__detailProperties"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_detailProperties"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_DetailProperties**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _specifiedTerrainMaterialName ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__specifiedTerrainMaterialName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolume::dyn__specifiedTerrainMaterialName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_specifiedTerrainMaterialName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_LoadBufferVolumeLayer #include "HoudiniEngineUnity/HEU_LoadBufferVolumeLayer.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.String _layerName ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__layerName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__layerName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layerName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _partID int& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__partID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__partID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_partID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _heightMapWidth int& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__heightMapWidth() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__heightMapWidth"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightMapWidth"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _heightMapHeight int& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__heightMapHeight() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__heightMapHeight"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightMapHeight"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _strength float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__strength() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__strength"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_strength"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _diffuseTexturePath ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__diffuseTexturePath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__diffuseTexturePath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_diffuseTexturePath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _maskTexturePath ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__maskTexturePath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__maskTexturePath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maskTexturePath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _metallic float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__metallic() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__metallic"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_metallic"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _normalTexturePath ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__normalTexturePath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__normalTexturePath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalTexturePath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _normalScale float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__normalScale() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__normalScale"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalScale"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _smoothness float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__smoothness() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__smoothness"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_smoothness"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Color _specularColor UnityEngine::Color& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__specularColor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__specularColor"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_specularColor"))->offset; return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector2 _tileSize UnityEngine::Vector2& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__tileSize() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__tileSize"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tileSize"))->offset; return *reinterpret_cast<UnityEngine::Vector2*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector2 _tileOffset UnityEngine::Vector2& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__tileOffset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__tileOffset"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tileOffset"))->offset; return *reinterpret_cast<UnityEngine::Vector2*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _uiExpanded bool& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__uiExpanded() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__uiExpanded"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_uiExpanded"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _tile int& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__tile() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__tile"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tile"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _normalizedHeights ::ArrayW<float>& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__normalizedHeights() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__normalizedHeights"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalizedHeights"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _minHeight float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__minHeight() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__minHeight"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_minHeight"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _maxHeight float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__maxHeight() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__maxHeight"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maxHeight"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _heightRange float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__heightRange() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__heightRange"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightRange"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _terrainSizeX float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__terrainSizeX() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__terrainSizeX"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainSizeX"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _terrainSizeY float& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__terrainSizeY() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__terrainSizeY"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainSizeY"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _position UnityEngine::Vector3& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__position() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__position"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_position"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _minBounds UnityEngine::Vector3& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__minBounds() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__minBounds"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_minBounds"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _maxBounds UnityEngine::Vector3& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__maxBounds() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__maxBounds"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maxBounds"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _center UnityEngine::Vector3& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__center() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__center"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_center"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _layerPath ::Il2CppString*& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__layerPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__layerPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layerPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _hasLayerAttributes bool& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__hasLayerAttributes() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__hasLayerAttributes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_hasLayerAttributes"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HFLayerType _layerType HoudiniEngineUnity::HFLayerType& HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__layerType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferVolumeLayer::dyn__layerType"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layerType"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HFLayerType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_LoadBufferInstancer #include "HoudiniEngineUnity/HEU_LoadBufferInstancer.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_Transform[] _instanceTransforms ::ArrayW<HoudiniEngineUnity::HAPI_Transform>& HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__instanceTransforms() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__instanceTransforms"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_instanceTransforms"))->offset; return *reinterpret_cast<::ArrayW<HoudiniEngineUnity::HAPI_Transform>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String[] _instancePrefixes ::ArrayW<::Il2CppString*>& HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__instancePrefixes() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__instancePrefixes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_instancePrefixes"))->offset; return *reinterpret_cast<::ArrayW<::Il2CppString*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _instanceNodeIDs ::ArrayW<int>& HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__instanceNodeIDs() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__instanceNodeIDs"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_instanceNodeIDs"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String[] _assetPaths ::ArrayW<::Il2CppString*>& HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__assetPaths() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__assetPaths"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_assetPaths"))->offset; return *reinterpret_cast<::ArrayW<::Il2CppString*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String[] _collisionAssetPaths ::ArrayW<::Il2CppString*>& HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__collisionAssetPaths() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_LoadBufferInstancer::dyn__collisionAssetPaths"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_collisionAssetPaths"))->offset; return *reinterpret_cast<::ArrayW<::Il2CppString*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_ThreadedTask #include "HoudiniEngineUnity/HEU_ThreadedTask.hpp" // Including type: System.Threading.Thread #include "System/Threading/Thread.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Boolean _isComplete bool& HoudiniEngineUnity::HEU_ThreadedTask::dyn__isComplete() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__isComplete"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isComplete"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean _isActive bool& HoudiniEngineUnity::HEU_ThreadedTask::dyn__isActive() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__isActive"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isActive"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean _stopRequested bool& HoudiniEngineUnity::HEU_ThreadedTask::dyn__stopRequested() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__stopRequested"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_stopRequested"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Object _lockHandle ::Il2CppObject*& HoudiniEngineUnity::HEU_ThreadedTask::dyn__lockHandle() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__lockHandle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lockHandle"))->offset; return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Threading.Thread _thread System::Threading::Thread*& HoudiniEngineUnity::HEU_ThreadedTask::dyn__thread() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__thread"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_thread"))->offset; return *reinterpret_cast<System::Threading::Thread**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Threading.ThreadPriority _priority System::Threading::ThreadPriority& HoudiniEngineUnity::HEU_ThreadedTask::dyn__priority() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__priority"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_priority"))->offset; return *reinterpret_cast<System::Threading::ThreadPriority*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean _isBackground bool& HoudiniEngineUnity::HEU_ThreadedTask::dyn__isBackground() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__isBackground"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isBackground"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: protected System.String _name ::Il2CppString*& HoudiniEngineUnity::HEU_ThreadedTask::dyn__name() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::dyn__name"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_name"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.get_TaskName ::Il2CppString* HoudiniEngineUnity::HEU_ThreadedTask::get_TaskName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::get_TaskName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_TaskName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.get_IsComplete bool HoudiniEngineUnity::HEU_ThreadedTask::get_IsComplete() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::get_IsComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.set_IsComplete void HoudiniEngineUnity::HEU_ThreadedTask::set_IsComplete(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::set_IsComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_IsComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.get_IsActive bool HoudiniEngineUnity::HEU_ThreadedTask::get_IsActive() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::get_IsActive"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsActive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.set_IsActive void HoudiniEngineUnity::HEU_ThreadedTask::set_IsActive(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::set_IsActive"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_IsActive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.get_StopRequested bool HoudiniEngineUnity::HEU_ThreadedTask::get_StopRequested() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::get_StopRequested"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_StopRequested", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.set_StopRequested void HoudiniEngineUnity::HEU_ThreadedTask::set_StopRequested(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::set_StopRequested"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_StopRequested", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.get_Priority System::Threading::ThreadPriority HoudiniEngineUnity::HEU_ThreadedTask::get_Priority() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::get_Priority"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Priority", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Threading::ThreadPriority, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.set_Priority void HoudiniEngineUnity::HEU_ThreadedTask::set_Priority(System::Threading::ThreadPriority value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::set_Priority"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Priority", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.get_IsBackground bool HoudiniEngineUnity::HEU_ThreadedTask::get_IsBackground() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::get_IsBackground"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsBackground", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.set_IsBackground void HoudiniEngineUnity::HEU_ThreadedTask::set_IsBackground(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::set_IsBackground"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_IsBackground", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.Start void HoudiniEngineUnity::HEU_ThreadedTask::Start() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::Start"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.Stop void HoudiniEngineUnity::HEU_ThreadedTask::Stop() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::Stop"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Stop", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.Abort void HoudiniEngineUnity::HEU_ThreadedTask::Abort() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::Abort"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Abort", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.Reset void HoudiniEngineUnity::HEU_ThreadedTask::Reset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.Update void HoudiniEngineUnity::HEU_ThreadedTask::Update() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::Update"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.DoWork void HoudiniEngineUnity::HEU_ThreadedTask::DoWork() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::DoWork"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DoWork", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.OnComplete void HoudiniEngineUnity::HEU_ThreadedTask::OnComplete() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::OnComplete"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.OnStopped void HoudiniEngineUnity::HEU_ThreadedTask::OnStopped() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::OnStopped"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnStopped", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.CleanUp void HoudiniEngineUnity::HEU_ThreadedTask::CleanUp() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::CleanUp"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CleanUp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTask.Run void HoudiniEngineUnity::HEU_ThreadedTask::Run() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTask::Run"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Run", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferVolume #include "HoudiniEngineUnity/HEU_LoadBufferVolume.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadObject #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadObject.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadCallbackType.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallback #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadCallback.hpp" // Including type: HoudiniEngineUnity.HEU_BaseSync #include "HoudiniEngineUnity/HEU_BaseSync.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HAPI_ObjectInfo #include "HoudiniEngineUnity/HAPI_ObjectInfo.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: UnityEngine.Color #include "UnityEngine/Color.hpp" // Including type: UnityEngine.Vector2 #include "UnityEngine/Vector2.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferMesh #include "HoudiniEngineUnity/HEU_LoadBufferMesh.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferInstancer #include "HoudiniEngineUnity/HEU_LoadBufferInstancer.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferBase #include "HoudiniEngineUnity/HEU_LoadBufferBase.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus // Already included the same include: HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo.hpp #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_BaseSync _ownerSync HoudiniEngineUnity::HEU_BaseSync*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__ownerSync() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__ownerSync"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ownerSync"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_BaseSync**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_SessionBase _session HoudiniEngineUnity::HEU_SessionBase*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__session() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__session"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_session"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_SessionBase**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_GenerateOptions _generateOptions HoudiniEngineUnity::HEU_GenerateOptions& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__generateOptions() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__generateOptions"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_generateOptions"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_GenerateOptions*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType _loadType HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__loadType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__loadType"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_loadType"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String _filePath ::Il2CppString*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__filePath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__filePath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_filePath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData _loadData HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__loadData() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__loadData"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_loadData"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallback _loadCallback HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__loadCallback() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::dyn__loadCallback"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_loadCallback"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetupLoad void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoad(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_BaseSync* ownerSync, HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType loadType, int cookNodeID, ::Il2CppString* name, ::Il2CppString* filePath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoad"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupLoad", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(ownerSync), ::il2cpp_utils::ExtractType(loadType), ::il2cpp_utils::ExtractType(cookNodeID), ::il2cpp_utils::ExtractType(name), ::il2cpp_utils::ExtractType(filePath)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, ownerSync, loadType, cookNodeID, name, filePath); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetupLoadNode void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoadNode(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_BaseSync* ownerSync, int cookNodeID, ::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoadNode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupLoadNode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(ownerSync), ::il2cpp_utils::ExtractType(cookNodeID), ::il2cpp_utils::ExtractType(name)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, ownerSync, cookNodeID, name); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetupLoadFile void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoadFile(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_BaseSync* ownerSync, int cookNodeID, ::Il2CppString* filePath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoadFile"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupLoadFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(ownerSync), ::il2cpp_utils::ExtractType(cookNodeID), ::il2cpp_utils::ExtractType(filePath)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, ownerSync, cookNodeID, filePath); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetupLoadAsset void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoadAsset(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_BaseSync* ownerSync, ::Il2CppString* assetPath, ::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetupLoadAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupLoadAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(ownerSync), ::il2cpp_utils::ExtractType(assetPath), ::il2cpp_utils::ExtractType(name)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, ownerSync, assetPath, name); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetLoadCallback void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetLoadCallback(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback* loadCallback) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetLoadCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetLoadCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(loadCallback)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, loadCallback); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.CookNode bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CookNode(HoudiniEngineUnity::HEU_SessionBase* session, int cookNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CookNode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CookNode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(cookNodeID)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, cookNodeID); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.LoadObjectBuffers bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadObjectBuffers(HoudiniEngineUnity::HEU_SessionBase* session, ByRef<HoudiniEngineUnity::HAPI_ObjectInfo> objectInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadObjectBuffers"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadObjectBuffers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(objectInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, byref(objectInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.LoadNodeBuffer bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadNodeBuffer(HoudiniEngineUnity::HEU_SessionBase* session, int nodeID, HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject* loadObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadNodeBuffer"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadNodeBuffer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(nodeID), ::il2cpp_utils::ExtractType(loadObject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, nodeID, loadObject); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.BuildBufferIDsMap void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::BuildBufferIDsMap(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData* loadData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::BuildBufferIDsMap"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BuildBufferIDsMap", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(loadData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, loadData); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.DoFileLoad bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::DoFileLoad() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::DoFileLoad"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DoFileLoad", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.DoAssetLoad bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::DoAssetLoad() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::DoAssetLoad"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DoAssetLoad", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.QueryParts bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::QueryParts(int nodeID, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>*> meshParts, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>*> volumeParts, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>*> instancerParts, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>*> curveParts, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>*> scatterInstancerParts) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::QueryParts"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "QueryParts", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(nodeID), ::il2cpp_utils::ExtractType(meshParts), ::il2cpp_utils::ExtractType(volumeParts), ::il2cpp_utils::ExtractType(instancerParts), ::il2cpp_utils::ExtractType(curveParts), ::il2cpp_utils::ExtractType(scatterInstancerParts)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, nodeID, byref(meshParts), byref(volumeParts), byref(instancerParts), byref(curveParts), byref(scatterInstancerParts)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.CreateLogString ::Il2CppString* HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CreateLogString(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus status, ::Il2CppString* logStr) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CreateLogString"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateLogString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(status), ::il2cpp_utils::ExtractType(logStr)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method, status, logStr); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.AppendLog void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::AppendLog(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus status, ::Il2CppString* logStr) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::AppendLog"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AppendLog", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(status), ::il2cpp_utils::ExtractType(logStr)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, status, logStr); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetLog void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetLog(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus status, ::Il2CppString* logStr) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetLog"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetLog", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(status), ::il2cpp_utils::ExtractType(logStr)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, status, logStr); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.CreateFileNode bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CreateFileNode(ByRef<int> fileNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CreateFileNode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateFileNode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, byref(fileNodeID)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GetCookNodeID int HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GetCookNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GetCookNodeID"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCookNodeID", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GetDisplayNodeID int HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GetDisplayNodeID(int objNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GetDisplayNodeID"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDisplayNodeID", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(objNodeID)}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method, objNodeID); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.SetFileParm bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetFileParm(int fileNodeID, ::Il2CppString* filePath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::SetFileParm"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetFileParm", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fileNodeID), ::il2cpp_utils::ExtractType(filePath)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, fileNodeID, filePath); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.Sleep void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::Sleep() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::Sleep"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Sleep", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GenerateTerrainBuffers bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GenerateTerrainBuffers(HoudiniEngineUnity::HEU_SessionBase* session, int nodeID, System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>* volumeParts, System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>* scatterInstancerParts, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolume*>*> volumeBuffers) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GenerateTerrainBuffers"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GenerateTerrainBuffers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(nodeID), ::il2cpp_utils::ExtractType(volumeParts), ::il2cpp_utils::ExtractType(scatterInstancerParts), ::il2cpp_utils::ExtractIndependentType<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolume*>*&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, nodeID, volumeParts, scatterInstancerParts, byref(volumeBuffers)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.LoadStringFromAttribute void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadStringFromAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<::Il2CppString*> strValue) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadStringFromAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadStringFromAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(strValue)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, geoID, partID, attrName, byref(strValue)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.LoadFloatFromAttribute void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadFloatFromAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<float> floatValue) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadFloatFromAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadFloatFromAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(floatValue)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, geoID, partID, attrName, byref(floatValue)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.LoadLayerColorFromAttribute void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadLayerColorFromAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<UnityEngine::Color> colorValue) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadLayerColorFromAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadLayerColorFromAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(colorValue)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, geoID, partID, attrName, byref(colorValue)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.LoadLayerVector2FromAttribute void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadLayerVector2FromAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<UnityEngine::Vector2> vectorValue) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadLayerVector2FromAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadLayerVector2FromAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(vectorValue)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, geoID, partID, attrName, byref(vectorValue)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GenerateMeshBuffers bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GenerateMeshBuffers(HoudiniEngineUnity::HEU_SessionBase* session, int nodeID, System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>* meshParts, bool bSplitPoints, bool bUseLODGroups, bool bGenerateUVs, bool bGenerateTangents, bool bGenerateNormals, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferMesh*>*> meshBuffers) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GenerateMeshBuffers"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GenerateMeshBuffers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(nodeID), ::il2cpp_utils::ExtractType(meshParts), ::il2cpp_utils::ExtractType(bSplitPoints), ::il2cpp_utils::ExtractType(bUseLODGroups), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateTangents), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractIndependentType<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferMesh*>*&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, nodeID, meshParts, bSplitPoints, bUseLODGroups, bGenerateUVs, bGenerateTangents, bGenerateNormals, byref(meshBuffers)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GenerateInstancerBuffers bool HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GenerateInstancerBuffers(HoudiniEngineUnity::HEU_SessionBase* session, int nodeID, System::Collections::Generic::List_1<HoudiniEngineUnity::HAPI_PartInfo>* instancerParts, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferInstancer*>*> instancerBuffers) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GenerateInstancerBuffers"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GenerateInstancerBuffers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(nodeID), ::il2cpp_utils::ExtractType(instancerParts), ::il2cpp_utils::ExtractIndependentType<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferInstancer*>*&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, nodeID, instancerParts, byref(instancerBuffers)); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GeneratePartsInstancerBuffer HoudiniEngineUnity::HEU_LoadBufferInstancer* HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GeneratePartsInstancerBuffer(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* partName, HoudiniEngineUnity::HAPI_PartInfo partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GeneratePartsInstancerBuffer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GeneratePartsInstancerBuffer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(partName), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_LoadBufferInstancer*, false>(this, ___internal__method, session, geoID, partID, partName, partInfo); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GeneratePointAttributeInstancerBuffer HoudiniEngineUnity::HEU_LoadBufferInstancer* HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GeneratePointAttributeInstancerBuffer(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* partName, HoudiniEngineUnity::HAPI_PartInfo partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GeneratePointAttributeInstancerBuffer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GeneratePointAttributeInstancerBuffer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(partName), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_LoadBufferInstancer*, false>(this, ___internal__method, session, geoID, partID, partName, partInfo); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.GetLoadBufferVolumeFromTileIndex HoudiniEngineUnity::HEU_LoadBufferVolume* HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GetLoadBufferVolumeFromTileIndex(int tileIndex, System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolume*>* buffers) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::GetLoadBufferVolumeFromTileIndex"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo", "GetLoadBufferVolumeFromTileIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(tileIndex), ::il2cpp_utils::ExtractType(buffers)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_LoadBufferVolume*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, tileIndex, buffers); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.DoWork void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::DoWork() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::DoWork"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DoWork", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.OnComplete void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::OnComplete() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::OnComplete"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.OnStopped void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::OnStopped() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::OnStopped"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnStopped", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo.CleanUp void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CleanUp() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::CleanUp"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CleanUp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType FILE HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_get_FILE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_get_FILE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/LoadType", "FILE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType FILE void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_set_FILE(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_set_FILE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/LoadType", "FILE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType NODE HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_get_NODE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_get_NODE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/LoadType", "NODE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType NODE void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_set_NODE(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_set_NODE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/LoadType", "NODE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType ASSET HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_get_ASSET() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_get_ASSET"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/LoadType", "ASSET")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.LoadType ASSET void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_set_ASSET(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::_set_ASSET"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/LoadType", "ASSET", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::LoadType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferBase #include "HoudiniEngineUnity/HEU_LoadBufferBase.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadObject #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadObject.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 _cookNodeID int& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__cookNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__cookNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_cookNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus _loadStatus HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__loadStatus() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__loadStatus"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_loadStatus"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Text.StringBuilder _logStr System::Text::StringBuilder*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__logStr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__logStr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_logStr"))->offset; return *reinterpret_cast<System::Text::StringBuilder**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_SessionBase _session HoudiniEngineUnity::HEU_SessionBase*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__session() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__session"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_session"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_SessionBase**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadObject> _loadedObjects System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject*>*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__loadedObjects() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__loadedObjects"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_loadedObjects"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,HoudiniEngineUnity.HEU_LoadBufferBase> _idBuffersMap System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_LoadBufferBase*>*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__idBuffersMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::dyn__idBuffersMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_idBuffersMap"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_LoadBufferBase*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus NONE HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_NONE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_NONE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "NONE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus NONE void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_NONE(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_NONE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "NONE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus STARTED HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_STARTED() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_STARTED"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "STARTED")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus STARTED void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_STARTED(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_STARTED"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "STARTED", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus SUCCESS HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_SUCCESS() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_SUCCESS"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "SUCCESS")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus SUCCESS void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_SUCCESS(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_SUCCESS"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "SUCCESS", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus ERROR HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_ERROR() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_get_ERROR"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "ERROR")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadData/HoudiniEngineUnity.LoadStatus ERROR void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_ERROR(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::_set_ERROR"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadData/LoadStatus", "ERROR", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData::LoadStatus::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadObject #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadObject.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferVolume #include "HoudiniEngineUnity/HEU_LoadBufferVolume.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferMesh #include "HoudiniEngineUnity/HEU_LoadBufferMesh.hpp" // Including type: HoudiniEngineUnity.HEU_LoadBufferInstancer #include "HoudiniEngineUnity/HEU_LoadBufferInstancer.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 _objectNodeID int& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__objectNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__objectNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_objectNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _displayNodeID int& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__displayNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__displayNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_displayNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_LoadBufferVolume> _terrainBuffers System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolume*>*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__terrainBuffers() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__terrainBuffers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainBuffers"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferVolume*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_LoadBufferMesh> _meshBuffers System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferMesh*>*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__meshBuffers() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__meshBuffers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshBuffers"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferMesh*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_LoadBufferInstancer> _instancerBuffers System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferInstancer*>*& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__instancerBuffers() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadObject::dyn__instancerBuffers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_instancerBuffers"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_LoadBufferInstancer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadCallbackType.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType PRECOOK HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_get_PRECOOK() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_get_PRECOOK"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadCallbackType", "PRECOOK")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType PRECOOK void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_set_PRECOOK(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_set_PRECOOK"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadCallbackType", "PRECOOK", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType POSTCOOK HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_get_POSTCOOK() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_get_POSTCOOK"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType>("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadCallbackType", "POSTCOOK")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType POSTCOOK void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_set_POSTCOOK(HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::_set_POSTCOOK"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ThreadedTaskLoadGeo/HEU_LoadCallbackType", "POSTCOOK", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallback #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadCallback.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: System.IAsyncResult #include "System/IAsyncResult.hpp" // Including type: System.AsyncCallback #include "System/AsyncCallback.hpp" // Including type: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallbackType #include "HoudiniEngineUnity/HEU_ThreadedTaskLoadGeo_HEU_LoadCallbackType.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallback.Invoke void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback::Invoke(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData* loadData, HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType callbackType) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback::Invoke"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Invoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(loadData), ::il2cpp_utils::ExtractType(callbackType)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, loadData, callbackType); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallback.BeginInvoke System::IAsyncResult* HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback::BeginInvoke(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadData* loadData, HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallbackType callbackType, System::AsyncCallback* callback, ::Il2CppObject* object) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback::BeginInvoke"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BeginInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(loadData), ::il2cpp_utils::ExtractType(callbackType), ::il2cpp_utils::ExtractType(callback), ::il2cpp_utils::ExtractType(object)}))); return ::il2cpp_utils::RunMethodThrow<System::IAsyncResult*, false>(this, ___internal__method, session, loadData, callbackType, callback, object); } // Autogenerated method: HoudiniEngineUnity.HEU_ThreadedTaskLoadGeo/HoudiniEngineUnity.HEU_LoadCallback.EndInvoke void HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback::EndInvoke(System::IAsyncResult* result) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ThreadedTaskLoadGeo::HEU_LoadCallback::EndInvoke"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "EndInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(result)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, result); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_CookLogs #include "HoudiniEngineUnity/HEU_CookLogs.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private HoudiniEngineUnity.HEU_CookLogs _instance HoudiniEngineUnity::HEU_CookLogs* HoudiniEngineUnity::HEU_CookLogs::_get__instance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::_get__instance"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_CookLogs*>("HoudiniEngineUnity", "HEU_CookLogs", "_instance")); } // Autogenerated static field setter // Set static field: static private HoudiniEngineUnity.HEU_CookLogs _instance void HoudiniEngineUnity::HEU_CookLogs::_set__instance(HoudiniEngineUnity::HEU_CookLogs* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::_set__instance"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_CookLogs", "_instance", value)); } // Autogenerated static field getter // Get static field: static private System.Int32 MAX_COOK_LOG_COUNT int HoudiniEngineUnity::HEU_CookLogs::_get_MAX_COOK_LOG_COUNT() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::_get_MAX_COOK_LOG_COUNT"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("HoudiniEngineUnity", "HEU_CookLogs", "MAX_COOK_LOG_COUNT")); } // Autogenerated static field setter // Set static field: static private System.Int32 MAX_COOK_LOG_COUNT void HoudiniEngineUnity::HEU_CookLogs::_set_MAX_COOK_LOG_COUNT(int value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::_set_MAX_COOK_LOG_COUNT"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_CookLogs", "MAX_COOK_LOG_COUNT", value)); } // Autogenerated static field getter // Get static field: static public System.Int64 MaxLogSize int64_t HoudiniEngineUnity::HEU_CookLogs::_get_MaxLogSize() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::_get_MaxLogSize"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int64_t>("HoudiniEngineUnity", "HEU_CookLogs", "MaxLogSize")); } // Autogenerated static field setter // Set static field: static public System.Int64 MaxLogSize void HoudiniEngineUnity::HEU_CookLogs::_set_MaxLogSize(int64_t value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::_set_MaxLogSize"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_CookLogs", "MaxLogSize", value)); } // Autogenerated instance field getter // Get instance field: private System.Text.StringBuilder _cookLogs System::Text::StringBuilder*& HoudiniEngineUnity::HEU_CookLogs::dyn__cookLogs() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::dyn__cookLogs"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_cookLogs"))->offset; return *reinterpret_cast<System::Text::StringBuilder**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 _currentCookLogCount int& HoudiniEngineUnity::HEU_CookLogs::dyn__currentCookLogCount() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::dyn__currentCookLogCount"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentCookLogCount"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String _lastLogStr ::Il2CppString*& HoudiniEngineUnity::HEU_CookLogs::dyn__lastLogStr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::dyn__lastLogStr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastLogStr"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean _uniqueStrOnly bool& HoudiniEngineUnity::HEU_CookLogs::dyn__uniqueStrOnly() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::dyn__uniqueStrOnly"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_uniqueStrOnly"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.get_Instance HoudiniEngineUnity::HEU_CookLogs* HoudiniEngineUnity::HEU_CookLogs::get_Instance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::get_Instance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_CookLogs", "get_Instance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_CookLogs*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.GetCookLogString ::Il2CppString* HoudiniEngineUnity::HEU_CookLogs::GetCookLogString() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::GetCookLogString"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCookLogString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.AppendCookLog void HoudiniEngineUnity::HEU_CookLogs::AppendCookLog(::Il2CppString* logStr) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::AppendCookLog"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AppendCookLog", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(logStr)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, logStr); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.ClearCookLog void HoudiniEngineUnity::HEU_CookLogs::ClearCookLog() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::ClearCookLog"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ClearCookLog", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.GetCookLogFilePath ::Il2CppString* HoudiniEngineUnity::HEU_CookLogs::GetCookLogFilePath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::GetCookLogFilePath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCookLogFilePath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.DeleteCookingFile void HoudiniEngineUnity::HEU_CookLogs::DeleteCookingFile() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::DeleteCookingFile"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DeleteCookingFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.WriteToLogFile void HoudiniEngineUnity::HEU_CookLogs::WriteToLogFile(::Il2CppString* logStr, bool checkLastLogStr) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::WriteToLogFile"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToLogFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(logStr), ::il2cpp_utils::ExtractType(checkLastLogStr)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, logStr, checkLastLogStr); } // Autogenerated method: HoudiniEngineUnity.HEU_CookLogs.GetFileSizeOfLogFile int64_t HoudiniEngineUnity::HEU_CookLogs::GetFileSizeOfLogFile() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_CookLogs::GetFileSizeOfLogFile"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetFileSizeOfLogFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int64_t, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_EditorUtility #include "HoudiniEngineUnity/HEU_EditorUtility.hpp" // Including type: HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions #include "HoudiniEngineUnity/HEU_EditorUtility_HEU_ReplacePrefabOptions.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.Vector3 #include "UnityEngine/Vector3.hpp" // Including type: UnityEngine.Matrix4x4 #include "UnityEngine/Matrix4x4.hpp" // Including type: UnityEngine.Component #include "UnityEngine/Component.hpp" // Including type: UnityEngine.Object #include "UnityEngine/Object.hpp" // Including type: UnityEngine.Transform #include "UnityEngine/Transform.hpp" // Including type: HoudiniEngineUnity.HEU_HoudiniAssetRoot #include "HoudiniEngineUnity/HEU_HoudiniAssetRoot.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.MarkSceneDirty void HoudiniEngineUnity::HEU_EditorUtility::MarkSceneDirty() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::MarkSceneDirty"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "MarkSceneDirty", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SelectObject void HoudiniEngineUnity::HEU_EditorUtility::SelectObject(UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SelectObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SelectObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SelectObjects void HoudiniEngineUnity::HEU_EditorUtility::SelectObjects(::ArrayW<UnityEngine::GameObject*> gameObjects) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SelectObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SelectObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObjects)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObjects); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetSelectedObjectsMeanPosition UnityEngine::Vector3 HoudiniEngineUnity::HEU_EditorUtility::GetSelectedObjectsMeanPosition() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetSelectedObjectsMeanPosition"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetSelectedObjectsMeanPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetSelectedObjectsMeanTransform UnityEngine::Matrix4x4 HoudiniEngineUnity::HEU_EditorUtility::GetSelectedObjectsMeanTransform() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetSelectedObjectsMeanTransform"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetSelectedObjectsMeanTransform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Matrix4x4, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SaveAsPrefabAsset UnityEngine::GameObject* HoudiniEngineUnity::HEU_EditorUtility::SaveAsPrefabAsset(::Il2CppString* path, UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SaveAsPrefabAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SaveAsPrefabAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(path), ::il2cpp_utils::ExtractType(go)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, path, go); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.PrefabIsAddedComponentOverride bool HoudiniEngineUnity::HEU_EditorUtility::PrefabIsAddedComponentOverride(UnityEngine::Component* comp) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::PrefabIsAddedComponentOverride"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "PrefabIsAddedComponentOverride", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(comp)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, comp); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsEditorPlaying bool HoudiniEngineUnity::HEU_EditorUtility::IsEditorPlaying() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsEditorPlaying"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsEditorPlaying", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.ReplacePrefab UnityEngine::GameObject* HoudiniEngineUnity::HEU_EditorUtility::ReplacePrefab(UnityEngine::GameObject* go, UnityEngine::Object* targetPrefab, HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions heuOptions) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::ReplacePrefab"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "ReplacePrefab", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go), ::il2cpp_utils::ExtractType(targetPrefab), ::il2cpp_utils::ExtractType(heuOptions)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go, targetPrefab, heuOptions); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsPrefabInstance bool HoudiniEngineUnity::HEU_EditorUtility::IsPrefabInstance(UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsPrefabInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsPrefabInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsPrefabAsset bool HoudiniEngineUnity::HEU_EditorUtility::IsPrefabAsset(UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsPrefabAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsPrefabAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsEditingInPrefabMode bool HoudiniEngineUnity::HEU_EditorUtility::IsEditingInPrefabMode(UnityEngine::GameObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsEditingInPrefabMode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsEditingInPrefabMode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsDisconnectedPrefabInstance bool HoudiniEngineUnity::HEU_EditorUtility::IsDisconnectedPrefabInstance(UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsDisconnectedPrefabInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsDisconnectedPrefabInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetPrefabAsset UnityEngine::Object* HoudiniEngineUnity::HEU_EditorUtility::GetPrefabAsset(UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetPrefabAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetPrefabAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Object*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetPrefabAssetPath ::Il2CppString* HoudiniEngineUnity::HEU_EditorUtility::GetPrefabAssetPath(UnityEngine::Object* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetPrefabAssetPath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetPrefabAssetPath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.DisconnectPrefabInstance void HoudiniEngineUnity::HEU_EditorUtility::DisconnectPrefabInstance(UnityEngine::GameObject* instance) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::DisconnectPrefabInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "DisconnectPrefabInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(instance)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, instance); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.InstantiatePrefab UnityEngine::Object* HoudiniEngineUnity::HEU_EditorUtility::InstantiatePrefab(UnityEngine::GameObject* prefabOriginal) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::InstantiatePrefab"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "InstantiatePrefab", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(prefabOriginal)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Object*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, prefabOriginal); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.InstantiateGameObject UnityEngine::GameObject* HoudiniEngineUnity::HEU_EditorUtility::InstantiateGameObject(UnityEngine::GameObject* sourceGameObject, UnityEngine::Transform* parentTransform, bool instantiateInWorldSpace, bool bRegisterUndo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::InstantiateGameObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "InstantiateGameObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sourceGameObject), ::il2cpp_utils::ExtractType(parentTransform), ::il2cpp_utils::ExtractType(instantiateInWorldSpace), ::il2cpp_utils::ExtractType(bRegisterUndo)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, sourceGameObject, parentTransform, instantiateInWorldSpace, bRegisterUndo); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.UndoRecordObject void HoudiniEngineUnity::HEU_EditorUtility::UndoRecordObject(UnityEngine::Object* objectToUndo, ::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::UndoRecordObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "UndoRecordObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(objectToUndo), ::il2cpp_utils::ExtractType(name)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, objectToUndo, name); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.UndoCollapseCurrentGroup void HoudiniEngineUnity::HEU_EditorUtility::UndoCollapseCurrentGroup() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::UndoCollapseCurrentGroup"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "UndoCollapseCurrentGroup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.CollectDependencies ::ArrayW<UnityEngine::Object*> HoudiniEngineUnity::HEU_EditorUtility::CollectDependencies(UnityEngine::Object* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::CollectDependencies"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "CollectDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<UnityEngine::Object*>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsPersistant bool HoudiniEngineUnity::HEU_EditorUtility::IsPersistant(UnityEngine::Object* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsPersistant"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsPersistant", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetUniqueNameForSibling ::Il2CppString* HoudiniEngineUnity::HEU_EditorUtility::GetUniqueNameForSibling(UnityEngine::Transform* parentTransform, ::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetUniqueNameForSibling"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetUniqueNameForSibling", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentTransform), ::il2cpp_utils::ExtractType(name)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentTransform, name); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.DisplayProgressBar void HoudiniEngineUnity::HEU_EditorUtility::DisplayProgressBar(::Il2CppString* title, ::Il2CppString* info, float progress) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::DisplayProgressBar"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "DisplayProgressBar", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(title), ::il2cpp_utils::ExtractType(info), ::il2cpp_utils::ExtractType(progress)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, title, info, progress); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.ClearProgressBar void HoudiniEngineUnity::HEU_EditorUtility::ClearProgressBar() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::ClearProgressBar"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "ClearProgressBar", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.IsEditorNotInPlayModeAndNotGoingToPlayMode bool HoudiniEngineUnity::HEU_EditorUtility::IsEditorNotInPlayModeAndNotGoingToPlayMode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::IsEditorNotInPlayModeAndNotGoingToPlayMode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "IsEditorNotInPlayModeAndNotGoingToPlayMode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.DisplayDialog bool HoudiniEngineUnity::HEU_EditorUtility::DisplayDialog(::Il2CppString* title, ::Il2CppString* message, ::Il2CppString* ok, ::Il2CppString* cancel) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::DisplayDialog"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "DisplayDialog", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(title), ::il2cpp_utils::ExtractType(message), ::il2cpp_utils::ExtractType(ok), ::il2cpp_utils::ExtractType(cancel)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, title, message, ok, cancel); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.DisplayErrorDialog bool HoudiniEngineUnity::HEU_EditorUtility::DisplayErrorDialog(::Il2CppString* title, ::Il2CppString* message, ::Il2CppString* ok, ::Il2CppString* cancel) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::DisplayErrorDialog"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "DisplayErrorDialog", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(title), ::il2cpp_utils::ExtractType(message), ::il2cpp_utils::ExtractType(ok), ::il2cpp_utils::ExtractType(cancel)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, title, message, ok, cancel); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.RevealInFinder void HoudiniEngineUnity::HEU_EditorUtility::RevealInFinder(::Il2CppString* path) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::RevealInFinder"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "RevealInFinder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(path)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, path); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SetObjectDirtyForEditorUpdate void HoudiniEngineUnity::HEU_EditorUtility::SetObjectDirtyForEditorUpdate(UnityEngine::Object* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SetObjectDirtyForEditorUpdate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SetObjectDirtyForEditorUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SetStatic void HoudiniEngineUnity::HEU_EditorUtility::SetStatic(UnityEngine::GameObject* go, bool bStatic, bool bIncludeChildren) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SetStatic"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SetStatic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go), ::il2cpp_utils::ExtractType(bStatic), ::il2cpp_utils::ExtractType(bIncludeChildren)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go, bStatic, bIncludeChildren); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SetIsHidden void HoudiniEngineUnity::HEU_EditorUtility::SetIsHidden(UnityEngine::GameObject* go, bool isHidden, bool bIncludeChildren) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SetIsHidden"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SetIsHidden", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go), ::il2cpp_utils::ExtractType(isHidden), ::il2cpp_utils::ExtractType(bIncludeChildren)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go, isHidden, bIncludeChildren); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetSelectedObjects ::ArrayW<UnityEngine::GameObject*> HoudiniEngineUnity::HEU_EditorUtility::GetSelectedObjects() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetSelectedObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetSelectedObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<UnityEngine::GameObject*>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetSelectedAssetRoots ::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*> HoudiniEngineUnity::HEU_EditorUtility::GetSelectedAssetRoots() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetSelectedAssetRoots"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetSelectedAssetRoots", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetAllAssetRoots ::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*> HoudiniEngineUnity::HEU_EditorUtility::GetAllAssetRoots() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetAllAssetRoots"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetAllAssetRoots", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.CookSelected void HoudiniEngineUnity::HEU_EditorUtility::CookSelected() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::CookSelected"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "CookSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.CookAll void HoudiniEngineUnity::HEU_EditorUtility::CookAll() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::CookAll"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "CookAll", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.CookAssets void HoudiniEngineUnity::HEU_EditorUtility::CookAssets(::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*> rootAssets) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::CookAssets"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "CookAssets", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rootAssets)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, rootAssets); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.RebuildSelected void HoudiniEngineUnity::HEU_EditorUtility::RebuildSelected() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::RebuildSelected"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "RebuildSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.RebuildAll void HoudiniEngineUnity::HEU_EditorUtility::RebuildAll() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::RebuildAll"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "RebuildAll", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.RebuildAssets void HoudiniEngineUnity::HEU_EditorUtility::RebuildAssets(::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*> rootAssets) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::RebuildAssets"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "RebuildAssets", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rootAssets)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, rootAssets); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.BakeAndReplaceSelectedInScene void HoudiniEngineUnity::HEU_EditorUtility::BakeAndReplaceSelectedInScene() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::BakeAndReplaceSelectedInScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "BakeAndReplaceSelectedInScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.BakeAndReplaceAllInScene void HoudiniEngineUnity::HEU_EditorUtility::BakeAndReplaceAllInScene() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::BakeAndReplaceAllInScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "BakeAndReplaceAllInScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.BakeAndReplaceAssets void HoudiniEngineUnity::HEU_EditorUtility::BakeAndReplaceAssets(::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*> rootAssets) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::BakeAndReplaceAssets"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "BakeAndReplaceAssets", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rootAssets)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, rootAssets); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.ExportSelectedAssetsToGeoFiles void HoudiniEngineUnity::HEU_EditorUtility::ExportSelectedAssetsToGeoFiles() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::ExportSelectedAssetsToGeoFiles"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "ExportSelectedAssetsToGeoFiles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.ExportAllAssetsToGeoFiles void HoudiniEngineUnity::HEU_EditorUtility::ExportAllAssetsToGeoFiles() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::ExportAllAssetsToGeoFiles"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "ExportAllAssetsToGeoFiles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.ExportAssetsToGeoFiles void HoudiniEngineUnity::HEU_EditorUtility::ExportAssetsToGeoFiles(::ArrayW<HoudiniEngineUnity::HEU_HoudiniAssetRoot*> rootAssets) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::ExportAssetsToGeoFiles"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "ExportAssetsToGeoFiles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rootAssets)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, rootAssets); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.EditorSaveFolderPanel ::Il2CppString* HoudiniEngineUnity::HEU_EditorUtility::EditorSaveFolderPanel(::Il2CppString* title, ::Il2CppString* folder, ::Il2CppString* defaultName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::EditorSaveFolderPanel"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "EditorSaveFolderPanel", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(title), ::il2cpp_utils::ExtractType(folder), ::il2cpp_utils::ExtractType(defaultName)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, title, folder, defaultName); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.QuerySelectedMeshTopology void HoudiniEngineUnity::HEU_EditorUtility::QuerySelectedMeshTopology() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::QuerySelectedMeshTopology"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "QuerySelectedMeshTopology", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetObjectParentFolder ::Il2CppString* HoudiniEngineUnity::HEU_EditorUtility::GetObjectParentFolder(UnityEngine::GameObject* parentObject, System::Collections::Generic::HashSet_1<UnityEngine::Material*>* generatedMaterials) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetObjectParentFolder"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetObjectParentFolder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentObject), ::il2cpp_utils::ExtractType(generatedMaterials)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentObject, generatedMaterials); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.GetObjectParentFolderHelper ::Il2CppString* HoudiniEngineUnity::HEU_EditorUtility::GetObjectParentFolderHelper(int instanceID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::GetObjectParentFolderHelper"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "GetObjectParentFolderHelper", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(instanceID)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, instanceID); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.RepaintScene void HoudiniEngineUnity::HEU_EditorUtility::RepaintScene() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::RepaintScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "RepaintScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.SetTextureToNormalMap void HoudiniEngineUnity::HEU_EditorUtility::SetTextureToNormalMap(::Il2CppString* filename) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::SetTextureToNormalMap"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "SetTextureToNormalMap", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(filename)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, filename); } // Autogenerated method: HoudiniEngineUnity.HEU_EditorUtility.ReleasedMouse bool HoudiniEngineUnity::HEU_EditorUtility::ReleasedMouse() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::ReleasedMouse"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_EditorUtility", "ReleasedMouse", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions #include "HoudiniEngineUnity/HEU_EditorUtility_HEU_ReplacePrefabOptions.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions Default HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_get_Default() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_get_Default"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions>("HoudiniEngineUnity", "HEU_EditorUtility/HEU_ReplacePrefabOptions", "Default")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions Default void HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_set_Default(HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_set_Default"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_EditorUtility/HEU_ReplacePrefabOptions", "Default", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions ConnectToPrefab HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_get_ConnectToPrefab() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_get_ConnectToPrefab"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions>("HoudiniEngineUnity", "HEU_EditorUtility/HEU_ReplacePrefabOptions", "ConnectToPrefab")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions ConnectToPrefab void HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_set_ConnectToPrefab(HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_set_ConnectToPrefab"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_EditorUtility/HEU_ReplacePrefabOptions", "ConnectToPrefab", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions ReplaceNameBased HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_get_ReplaceNameBased() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_get_ReplaceNameBased"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions>("HoudiniEngineUnity", "HEU_EditorUtility/HEU_ReplacePrefabOptions", "ReplaceNameBased")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_EditorUtility/HoudiniEngineUnity.HEU_ReplacePrefabOptions ReplaceNameBased void HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_set_ReplaceNameBased(HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::_set_ReplaceNameBased"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_EditorUtility/HEU_ReplacePrefabOptions", "ReplaceNameBased", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_EditorUtility::HEU_ReplacePrefabOptions::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_Extensions #include "HoudiniEngineUnity/HEU_Extensions.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.IEnumerable`1 #include "System/Collections/Generic/IEnumerable_1.hpp" // Including type: System.Func`2 #include "System/Func_2.hpp" // Including type: System.Func`3 #include "System/Func_3.hpp" // Including type: UnityEngine.Quaternion #include "UnityEngine/Quaternion.hpp" // Including type: HoudiniEngineUnity.IEquivable`1 #include "HoudiniEngineUnity/IEquivable_1.hpp" // Including type: UnityEngine.Vector3 #include "UnityEngine/Vector3.hpp" // Including type: UnityEngine.Matrix4x4 #include "UnityEngine/Matrix4x4.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.ApproximatelyEquals bool HoudiniEngineUnity::HEU_Extensions::ApproximatelyEquals(UnityEngine::Quaternion quatA, UnityEngine::Quaternion value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::ApproximatelyEquals"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "ApproximatelyEquals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(quatA), ::il2cpp_utils::ExtractType(value)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, quatA, value); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.ApproximatelyEquals bool HoudiniEngineUnity::HEU_Extensions::ApproximatelyEquals(float self, float other, float epsilon) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::ApproximatelyEquals"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "ApproximatelyEquals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self), ::il2cpp_utils::ExtractType(other), ::il2cpp_utils::ExtractType(epsilon)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self, other, epsilon); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.AsByteArray ::ArrayW<uint8_t> HoudiniEngineUnity::HEU_Extensions::AsByteArray(::Il2CppString* self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::AsByteArray"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "AsByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<uint8_t>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.AsString ::Il2CppString* HoudiniEngineUnity::HEU_Extensions::AsString(::ArrayW<uint8_t> buffer) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::AsString"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "AsString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(buffer)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, buffer); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.SwapXAndY UnityEngine::Vector3 HoudiniEngineUnity::HEU_Extensions::SwapXAndY(UnityEngine::Vector3 self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::SwapXAndY"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "SwapXAndY", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.SwapXAndZ UnityEngine::Vector3 HoudiniEngineUnity::HEU_Extensions::SwapXAndZ(UnityEngine::Vector3 self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::SwapXAndZ"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "SwapXAndZ", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.SwapYAndZ UnityEngine::Vector3 HoudiniEngineUnity::HEU_Extensions::SwapYAndZ(UnityEngine::Vector3 self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::SwapYAndZ"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "SwapYAndZ", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.DecomposeToPosition UnityEngine::Vector3 HoudiniEngineUnity::HEU_Extensions::DecomposeToPosition(UnityEngine::Matrix4x4 self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::DecomposeToPosition"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "DecomposeToPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.DecomposeToRotation UnityEngine::Quaternion HoudiniEngineUnity::HEU_Extensions::DecomposeToRotation(UnityEngine::Matrix4x4 self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::DecomposeToRotation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "DecomposeToRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated method: HoudiniEngineUnity.HEU_Extensions.DecomposeToScale UnityEngine::Vector3 HoudiniEngineUnity::HEU_Extensions::DecomposeToScale(UnityEngine::Matrix4x4 self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Extensions::DecomposeToScale"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Extensions", "DecomposeToScale", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.ArrayExtensions #include "HoudiniEngineUnity/ArrayExtensions.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.TransformData #include "HoudiniEngineUnity/TransformData.hpp" // Including type: UnityEngine.Transform #include "UnityEngine/Transform.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 position UnityEngine::Vector3& HoudiniEngineUnity::TransformData::dyn_position() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::dyn_position"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "position"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Quaternion rotation UnityEngine::Quaternion& HoudiniEngineUnity::TransformData::dyn_rotation() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::dyn_rotation"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotation"))->offset; return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 localPosition UnityEngine::Vector3& HoudiniEngineUnity::TransformData::dyn_localPosition() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::dyn_localPosition"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "localPosition"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 localScale UnityEngine::Vector3& HoudiniEngineUnity::TransformData::dyn_localScale() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::dyn_localScale"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "localScale"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Quaternion localRotation UnityEngine::Quaternion& HoudiniEngineUnity::TransformData::dyn_localRotation() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::dyn_localRotation"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "localRotation"))->offset; return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Transform parent UnityEngine::Transform*& HoudiniEngineUnity::TransformData::dyn_parent() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::dyn_parent"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "parent"))->offset; return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.TransformData..ctor HoudiniEngineUnity::TransformData::TransformData(UnityEngine::Transform* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, other); } // Autogenerated method: HoudiniEngineUnity.TransformData.CopyTo void HoudiniEngineUnity::TransformData::CopyTo(UnityEngine::Transform* other, bool copyParent) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::CopyTo"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "CopyTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other), ::il2cpp_utils::ExtractType(copyParent)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, other, copyParent); } // Autogenerated method: HoudiniEngineUnity.TransformData.CopyToLocal void HoudiniEngineUnity::TransformData::CopyToLocal(UnityEngine::Transform* other, bool copyParent) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::TransformData::CopyToLocal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "CopyToLocal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other), ::il2cpp_utils::ExtractType(copyParent)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, other, copyParent); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_GeneralUtility #include "HoudiniEngineUnity/HEU_GeneralUtility.hpp" // Including type: HoudiniEngineUnity.HEU_GeneralUtility/HoudiniEngineUnity.GetArray1ArgDel`1 #include "HoudiniEngineUnity/HEU_GeneralUtility_GetArray1ArgDel_1.hpp" // Including type: HoudiniEngineUnity.HEU_GeneralUtility/HoudiniEngineUnity.GetArray2ArgDel`2 #include "HoudiniEngineUnity/HEU_GeneralUtility_GetArray2ArgDel_2.hpp" // Including type: HoudiniEngineUnity.HEU_GeneralUtility/HoudiniEngineUnity.GetArray3ArgDel`3 #include "HoudiniEngineUnity/HEU_GeneralUtility_GetArray3ArgDel_3.hpp" // Including type: HoudiniEngineUnity.HEU_GeneralUtility/HoudiniEngineUnity.GetAttributeArrayInputFunc`1 #include "HoudiniEngineUnity/HEU_GeneralUtility_GetAttributeArrayInputFunc_1.hpp" // Including type: HoudiniEngineUnity.HEU_GeneralUtility/HoudiniEngineUnity.SetAttributeArrayFunc`1 #include "HoudiniEngineUnity/HEU_GeneralUtility_SetAttributeArrayFunc_1.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: HoudiniEngineUnity.HEU_OutputAttribute #include "HoudiniEngineUnity/HEU_OutputAttribute.hpp" // Including type: UnityEngine.Transform #include "UnityEngine/Transform.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_HoudiniAssetRoot #include "HoudiniEngineUnity/HEU_HoudiniAssetRoot.hpp" // Including type: UnityEngine.Component #include "UnityEngine/Component.hpp" // Including type: UnityEngine.Object #include "UnityEngine/Object.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" // Including type: UnityEngine.MeshCollider #include "UnityEngine/MeshCollider.hpp" // Including type: UnityEngine.Color #include "UnityEngine/Color.hpp" // Including type: UnityEngine.Camera #include "UnityEngine/Camera.hpp" // Including type: UnityEngine.Vector2 #include "UnityEngine/Vector2.hpp" // Including type: UnityEngine.Rect #include "UnityEngine/Rect.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: HoudiniEngineUnity.HEU_Handle #include "HoudiniEngineUnity/HEU_Handle.hpp" // Including type: HoudiniEngineUnity.HAPI_AssetInfo #include "HoudiniEngineUnity/HAPI_AssetInfo.hpp" // Including type: HoudiniEngineUnity.HEU_Parameters #include "HoudiniEngineUnity/HEU_Parameters.hpp" // Including type: UnityEngine.Texture #include "UnityEngine/Texture.hpp" // Including type: UnityEngine.Texture2D #include "UnityEngine/Texture2D.hpp" // Including type: HoudiniEngineUnity.HAPI_Transform #include "HoudiniEngineUnity/HAPI_Transform.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeStringDataHelper void HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringDataHelper(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* name, ByRef<HoudiniEngineUnity::HAPI_AttributeInfo> info, ByRef<::ArrayW<int>> data) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringDataHelper"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeStringDataHelper", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(name), ::il2cpp_utils::ExtractType(info), ::il2cpp_utils::ExtractType(data)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, name, byref(info), byref(data)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeStringData ::ArrayW<::Il2CppString*> HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringData(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* name, ByRef<HoudiniEngineUnity::HAPI_AttributeInfo> attrInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeStringData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(name), ::il2cpp_utils::ExtractType(attrInfo)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<::Il2CppString*>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, name, byref(attrInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CheckAttributeExists bool HoudiniEngineUnity::HEU_GeneralUtility::CheckAttributeExists(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attribName, HoudiniEngineUnity::HAPI_AttributeOwner attribOwner) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CheckAttributeExists"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CheckAttributeExists", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attribName), ::il2cpp_utils::ExtractType(attribOwner)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attribName, attribOwner); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeInfo bool HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeInfo(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attribName, ByRef<HoudiniEngineUnity::HAPI_AttributeInfo> attribInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeInfo"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeInfo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attribName), ::il2cpp_utils::ExtractType(attribInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attribName, byref(attribInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.HasValidInstanceAttribute bool HoudiniEngineUnity::HEU_GeneralUtility::HasValidInstanceAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attribName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::HasValidInstanceAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "HasValidInstanceAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attribName)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attribName); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.UpdateGeneratedAttributeStore void HoudiniEngineUnity::HEU_GeneralUtility::UpdateGeneratedAttributeStore(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::UpdateGeneratedAttributeStore"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "UpdateGeneratedAttributeStore", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(go)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, go); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CreateOutputAttributeHelper HoudiniEngineUnity::HEU_OutputAttribute* HoudiniEngineUnity::HEU_GeneralUtility::CreateOutputAttributeHelper(::Il2CppString* attrName, ByRef<HoudiniEngineUnity::HAPI_AttributeInfo> attrInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CreateOutputAttributeHelper"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CreateOutputAttributeHelper", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(attrInfo)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_OutputAttribute*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, attrName, byref(attrInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CreateOutputAttribute HoudiniEngineUnity::HEU_OutputAttribute* HoudiniEngineUnity::HEU_GeneralUtility::CreateOutputAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<HoudiniEngineUnity::HAPI_AttributeInfo> attrInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CreateOutputAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CreateOutputAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(attrInfo)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_OutputAttribute*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, byref(attrInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CopyWorldTransformValues void HoudiniEngineUnity::HEU_GeneralUtility::CopyWorldTransformValues(UnityEngine::Transform* src, UnityEngine::Transform* dest) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CopyWorldTransformValues"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CopyWorldTransformValues", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(src), ::il2cpp_utils::ExtractType(dest)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, src, dest); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.ApplyTransformTo void HoudiniEngineUnity::HEU_GeneralUtility::ApplyTransformTo(UnityEngine::Transform* src, UnityEngine::Transform* target) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::ApplyTransformTo"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "ApplyTransformTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(src), ::il2cpp_utils::ExtractType(target)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, src, target); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CopyLocalTransformValues void HoudiniEngineUnity::HEU_GeneralUtility::CopyLocalTransformValues(UnityEngine::Transform* src, UnityEngine::Transform* dest) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CopyLocalTransformValues"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CopyLocalTransformValues", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(src), ::il2cpp_utils::ExtractType(dest)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, src, dest); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetChildGameObjects System::Collections::Generic::List_1<UnityEngine::GameObject*>* HoudiniEngineUnity::HEU_GeneralUtility::GetChildGameObjects(UnityEngine::GameObject* parentGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetChildGameObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetChildGameObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentGO)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<UnityEngine::GameObject*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetChildGameObjectsWithNamePattern System::Collections::Generic::List_1<UnityEngine::GameObject*>* HoudiniEngineUnity::HEU_GeneralUtility::GetChildGameObjectsWithNamePattern(UnityEngine::GameObject* parentGO, ::Il2CppString* pattern, bool bExclude) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetChildGameObjectsWithNamePattern"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetChildGameObjectsWithNamePattern", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentGO), ::il2cpp_utils::ExtractType(pattern), ::il2cpp_utils::ExtractType(bExclude)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<UnityEngine::GameObject*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentGO, pattern, bExclude); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetInstanceChildObjects System::Collections::Generic::List_1<UnityEngine::GameObject*>* HoudiniEngineUnity::HEU_GeneralUtility::GetInstanceChildObjects(UnityEngine::GameObject* parentGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetInstanceChildObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetInstanceChildObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentGO)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<UnityEngine::GameObject*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetNonInstanceChildObjects System::Collections::Generic::List_1<UnityEngine::GameObject*>* HoudiniEngineUnity::HEU_GeneralUtility::GetNonInstanceChildObjects(UnityEngine::GameObject* parentGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetNonInstanceChildObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetNonInstanceChildObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentGO)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<UnityEngine::GameObject*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetGameObjectByName UnityEngine::GameObject* HoudiniEngineUnity::HEU_GeneralUtility::GetGameObjectByName(System::Collections::Generic::List_1<UnityEngine::GameObject*>* goList, ::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetGameObjectByName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetGameObjectByName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goList), ::il2cpp_utils::ExtractType(name)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, goList, name); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetGameObjectByNameInProjectOnly UnityEngine::GameObject* HoudiniEngineUnity::HEU_GeneralUtility::GetGameObjectByNameInProjectOnly(::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetGameObjectByNameInProjectOnly"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetGameObjectByNameInProjectOnly", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(name)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, name); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.IsGameObjectInProject bool HoudiniEngineUnity::HEU_GeneralUtility::IsGameObjectInProject(UnityEngine::GameObject* go) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::IsGameObjectInProject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "IsGameObjectInProject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(go)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, go); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetGameObjectByNameInScene UnityEngine::GameObject* HoudiniEngineUnity::HEU_GeneralUtility::GetGameObjectByNameInScene(::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetGameObjectByNameInScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetGameObjectByNameInScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(name)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, name); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetHDAByGameObjectNameInScene HoudiniEngineUnity::HEU_HoudiniAssetRoot* HoudiniEngineUnity::HEU_GeneralUtility::GetHDAByGameObjectNameInScene(::Il2CppString* name) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetHDAByGameObjectNameInScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetHDAByGameObjectNameInScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(name)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_HoudiniAssetRoot*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, name); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyGeneratedComponents void HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedComponents(UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedComponents"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyGeneratedComponents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyGeneratedMeshComponents void HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedMeshComponents(UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedMeshComponents"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyGeneratedMeshComponents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyTerrainComponents void HoudiniEngineUnity::HEU_GeneralUtility::DestroyTerrainComponents(UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyTerrainComponents"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyTerrainComponents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyImmediate void HoudiniEngineUnity::HEU_GeneralUtility::DestroyImmediate(UnityEngine::Object* obj, bool bAllowDestroyingAssets, bool bRegisterUndo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyImmediate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyImmediate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj), ::il2cpp_utils::ExtractType(bAllowDestroyingAssets), ::il2cpp_utils::ExtractType(bRegisterUndo)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, obj, bAllowDestroyingAssets, bRegisterUndo); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyBakedGameObjects void HoudiniEngineUnity::HEU_GeneralUtility::DestroyBakedGameObjects(System::Collections::Generic::List_1<UnityEngine::GameObject*>* gameObjectsToDestroy) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyBakedGameObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyBakedGameObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObjectsToDestroy)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObjectsToDestroy); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyBakedGameObjectsWithEndName void HoudiniEngineUnity::HEU_GeneralUtility::DestroyBakedGameObjectsWithEndName(System::Collections::Generic::List_1<UnityEngine::GameObject*>* gameObjectsToDestroy, ::Il2CppString* endName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyBakedGameObjectsWithEndName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyBakedGameObjectsWithEndName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObjectsToDestroy), ::il2cpp_utils::ExtractType(endName)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObjectsToDestroy, endName); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyLODGroup void HoudiniEngineUnity::HEU_GeneralUtility::DestroyLODGroup(UnityEngine::GameObject* targetGO, bool bDontDeletePersistantResources) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyLODGroup"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyLODGroup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetGO), ::il2cpp_utils::ExtractType(bDontDeletePersistantResources)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, targetGO, bDontDeletePersistantResources); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetLODTransforms System::Collections::Generic::List_1<UnityEngine::Transform*>* HoudiniEngineUnity::HEU_GeneralUtility::GetLODTransforms(UnityEngine::GameObject* targetGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetLODTransforms"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetLODTransforms", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetGO)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<UnityEngine::Transform*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, targetGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetLODTransformValues void HoudiniEngineUnity::HEU_GeneralUtility::SetLODTransformValues(UnityEngine::GameObject* targetGO, System::Collections::Generic::List_1<HoudiniEngineUnity::TransformData>* transformData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetLODTransformValues"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetLODTransformValues", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetGO), ::il2cpp_utils::ExtractType(transformData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, targetGO, transformData); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyGeneratedMeshMaterialsLODGroups void HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedMeshMaterialsLODGroups(UnityEngine::GameObject* targetGO, bool bDontDeletePersistantResources) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedMeshMaterialsLODGroups"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyGeneratedMeshMaterialsLODGroups", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetGO), ::il2cpp_utils::ExtractType(bDontDeletePersistantResources)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, targetGO, bDontDeletePersistantResources); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyGeneratedMaterial void HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedMaterial(UnityEngine::Material* material) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyGeneratedMaterial"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyGeneratedMaterial", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(material)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, material); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DestroyMeshCollider void HoudiniEngineUnity::HEU_GeneralUtility::DestroyMeshCollider(UnityEngine::MeshCollider* meshCollider, bool bDontDeletePersistantResources) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DestroyMeshCollider"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DestroyMeshCollider", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(meshCollider), ::il2cpp_utils::ExtractType(bDontDeletePersistantResources)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, meshCollider, bDontDeletePersistantResources); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetGameObjectRenderVisiblity void HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectRenderVisiblity(UnityEngine::GameObject* gameObject, bool bVisible) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectRenderVisiblity"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetGameObjectRenderVisiblity", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject), ::il2cpp_utils::ExtractType(bVisible)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject, bVisible); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetGameObjectChildrenRenderVisibility void HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectChildrenRenderVisibility(UnityEngine::GameObject* gameObject, bool bVisible) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectChildrenRenderVisibility"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetGameObjectChildrenRenderVisibility", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject), ::il2cpp_utils::ExtractType(bVisible)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject, bVisible); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetGameObjectColliderState void HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectColliderState(UnityEngine::GameObject* gameObject, bool bEnabled) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectColliderState"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetGameObjectColliderState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject), ::il2cpp_utils::ExtractType(bEnabled)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject, bEnabled); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetGameObjectChildrenColliderState void HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectChildrenColliderState(UnityEngine::GameObject* gameObject, bool bVisible) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetGameObjectChildrenColliderState"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetGameObjectChildrenColliderState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject), ::il2cpp_utils::ExtractType(bVisible)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject, bVisible); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.ColorToString ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::ColorToString(UnityEngine::Color c) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::ColorToString"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "ColorToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(c)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, c); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.StringToColor UnityEngine::Color HoudiniEngineUnity::HEU_GeneralUtility::StringToColor(::Il2CppString* colorString) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::StringToColor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "StringToColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(colorString)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, colorString); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.DoesUnityTagExist bool HoudiniEngineUnity::HEU_GeneralUtility::DoesUnityTagExist(::Il2CppString* tagName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::DoesUnityTagExist"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "DoesUnityTagExist", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(tagName)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, tagName); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetLayer void HoudiniEngineUnity::HEU_GeneralUtility::SetLayer(UnityEngine::GameObject* rootGO, int layer, bool bIncludeChildren) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetLayer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetLayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rootGO), ::il2cpp_utils::ExtractType(layer), ::il2cpp_utils::ExtractType(bIncludeChildren)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, rootGO, layer, bIncludeChildren); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetTag void HoudiniEngineUnity::HEU_GeneralUtility::SetTag(UnityEngine::GameObject* rootGO, ::Il2CppString* tag, bool bIncludeChildren) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetTag"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetTag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rootGO), ::il2cpp_utils::ExtractType(tag), ::il2cpp_utils::ExtractType(bIncludeChildren)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, rootGO, tag, bIncludeChildren); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CopyFlags void HoudiniEngineUnity::HEU_GeneralUtility::CopyFlags(UnityEngine::GameObject* srcGO, UnityEngine::GameObject* dstGO, bool bIncludeChildren) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CopyFlags"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CopyFlags", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(srcGO), ::il2cpp_utils::ExtractType(dstGO), ::il2cpp_utils::ExtractType(bIncludeChildren)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, srcGO, dstGO, bIncludeChildren); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.IsMouseWithinSceneView bool HoudiniEngineUnity::HEU_GeneralUtility::IsMouseWithinSceneView(UnityEngine::Camera* camera, UnityEngine::Vector2 mousePosition) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::IsMouseWithinSceneView"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "IsMouseWithinSceneView", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(camera), ::il2cpp_utils::ExtractType(mousePosition)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, camera, mousePosition); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.IsMouseOverRect bool HoudiniEngineUnity::HEU_GeneralUtility::IsMouseOverRect(UnityEngine::Camera* camera, UnityEngine::Vector2 mousePosition, ByRef<UnityEngine::Rect> rect) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::IsMouseOverRect"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "IsMouseOverRect", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(camera), ::il2cpp_utils::ExtractType(mousePosition), ::il2cpp_utils::ExtractType(rect)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, camera, mousePosition, byref(rect)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetSystemTypeByName System::Type* HoudiniEngineUnity::HEU_GeneralUtility::GetSystemTypeByName(::Il2CppString* typeName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetSystemTypeByName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetSystemTypeByName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(typeName)}))); return ::il2cpp_utils::RunMethodThrow<System::Type*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, typeName); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.AssignUnityTag void HoudiniEngineUnity::HEU_GeneralUtility::AssignUnityTag(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::AssignUnityTag"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "AssignUnityTag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.AssignUnityLayer void HoudiniEngineUnity::HEU_GeneralUtility::AssignUnityLayer(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::AssignUnityLayer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "AssignUnityLayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.MakeStaticIfHasAttribute void HoudiniEngineUnity::HEU_GeneralUtility::MakeStaticIfHasAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::MakeStaticIfHasAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "MakeStaticIfHasAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetUnityScriptAttributeValue ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::GetUnityScriptAttributeValue(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetUnityScriptAttributeValue"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetUnityScriptAttributeValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeStringValueSingle ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringValueSingle(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, HoudiniEngineUnity::HAPI_AttributeOwner attrOwner) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringValueSingle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeStringValueSingle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(attrOwner)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, attrOwner); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeStringValueSingleStrict ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringValueSingleStrict(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, HoudiniEngineUnity::HAPI_AttributeOwner attrOwner) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeStringValueSingleStrict"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeStringValueSingleStrict", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(attrOwner)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, attrOwner); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeFloatSingle bool HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeFloatSingle(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<float> value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeFloatSingle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeFloatSingle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractIndependentType<float&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, byref(value)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeIntSingle bool HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeIntSingle(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<int> value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeIntSingle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeIntSingle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, byref(value)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetAttributeColorSingle bool HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeColorSingle(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ByRef<UnityEngine::Color> value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetAttributeColorSingle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetAttributeColorSingle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(value)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, byref(value)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.HasAttribute bool HoudiniEngineUnity::HEU_GeneralUtility::HasAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, HoudiniEngineUnity::HAPI_AttributeOwner attrOwner) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::HasAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "HasAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(attrOwner)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, attrOwner); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.AttachScriptWithInvokeFunction void HoudiniEngineUnity::HEU_GeneralUtility::AttachScriptWithInvokeFunction(::Il2CppString* scriptSet, UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::AttachScriptWithInvokeFunction"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "AttachScriptWithInvokeFunction", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(scriptSet), ::il2cpp_utils::ExtractType(gameObject)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, scriptSet, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.IsInCameraView bool HoudiniEngineUnity::HEU_GeneralUtility::IsInCameraView(UnityEngine::Camera* camera, UnityEngine::Vector3 point) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::IsInCameraView"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "IsInCameraView", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(camera), ::il2cpp_utils::ExtractType(point)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, camera, point); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.FindOrGenerateHandles System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Handle*>* HoudiniEngineUnity::HEU_GeneralUtility::FindOrGenerateHandles(HoudiniEngineUnity::HEU_SessionBase* session, ByRef<HoudiniEngineUnity::HAPI_AssetInfo> assetInfo, int assetID, ::Il2CppString* assetName, HoudiniEngineUnity::HEU_Parameters* parameters, System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Handle*>* currentHandles) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::FindOrGenerateHandles"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "FindOrGenerateHandles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(assetInfo), ::il2cpp_utils::ExtractType(assetID), ::il2cpp_utils::ExtractType(assetName), ::il2cpp_utils::ExtractType(parameters), ::il2cpp_utils::ExtractType(currentHandles)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Handle*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, byref(assetInfo), assetID, assetName, parameters, currentHandles); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CopyComponents void HoudiniEngineUnity::HEU_GeneralUtility::CopyComponents(UnityEngine::GameObject* srcGO, UnityEngine::GameObject* destGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CopyComponents"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CopyComponents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(srcGO), ::il2cpp_utils::ExtractType(destGO)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, srcGO, destGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.LoadTextureFromFile UnityEngine::Texture* HoudiniEngineUnity::HEU_GeneralUtility::LoadTextureFromFile(::Il2CppString* filePath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::LoadTextureFromFile"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "LoadTextureFromFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(filePath)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Texture*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, filePath); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.MakeTexture UnityEngine::Texture2D* HoudiniEngineUnity::HEU_GeneralUtility::MakeTexture(int width, int height, UnityEngine::Color color) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::MakeTexture"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "MakeTexture", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(width), ::il2cpp_utils::ExtractType(height), ::il2cpp_utils::ExtractType(color)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Texture2D*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, width, height, color); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.ReplaceFirstOccurrence ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::ReplaceFirstOccurrence(::Il2CppString* srcStr, ::Il2CppString* searchStr, ::Il2CppString* replaceStr) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::ReplaceFirstOccurrence"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "ReplaceFirstOccurrence", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(srcStr), ::il2cpp_utils::ExtractType(searchStr), ::il2cpp_utils::ExtractType(replaceStr)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, srcStr, searchStr, replaceStr); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.SetParentWithCleanTransform void HoudiniEngineUnity::HEU_GeneralUtility::SetParentWithCleanTransform(UnityEngine::Transform* parentTransform, UnityEngine::Transform* childTransform) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::SetParentWithCleanTransform"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "SetParentWithCleanTransform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parentTransform), ::il2cpp_utils::ExtractType(childTransform)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, parentTransform, childTransform); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.CopyHAPITransform void HoudiniEngineUnity::HEU_GeneralUtility::CopyHAPITransform(ByRef<HoudiniEngineUnity::HAPI_Transform> src, ByRef<HoudiniEngineUnity::HAPI_Transform> dest) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::CopyHAPITransform"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "CopyHAPITransform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(src), ::il2cpp_utils::ExtractType(dest)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, byref(src), byref(dest)); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetMaterialAttributeValueFromPart ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::GetMaterialAttributeValueFromPart(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetMaterialAttributeValueFromPart"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetMaterialAttributeValueFromPart", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.ReplaceColliderMeshFromMeshFilter void HoudiniEngineUnity::HEU_GeneralUtility::ReplaceColliderMeshFromMeshFilter(UnityEngine::GameObject* targetGO, UnityEngine::GameObject* sourceColliderGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::ReplaceColliderMeshFromMeshFilter"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "ReplaceColliderMeshFromMeshFilter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetGO), ::il2cpp_utils::ExtractType(sourceColliderGO)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, targetGO, sourceColliderGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.ReplaceColliderMeshFromMeshCollider void HoudiniEngineUnity::HEU_GeneralUtility::ReplaceColliderMeshFromMeshCollider(UnityEngine::GameObject* targetGO, UnityEngine::GameObject* sourceColliderGO) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::ReplaceColliderMeshFromMeshCollider"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "ReplaceColliderMeshFromMeshCollider", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetGO), ::il2cpp_utils::ExtractType(sourceColliderGO)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, targetGO, sourceColliderGO); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.BiLerpf float HoudiniEngineUnity::HEU_GeneralUtility::BiLerpf(float p00, float p10, float p01, float p11, float fracX, float fracY) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::BiLerpf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "BiLerpf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p00), ::il2cpp_utils::ExtractType(p10), ::il2cpp_utils::ExtractType(p01), ::il2cpp_utils::ExtractType(p11), ::il2cpp_utils::ExtractType(fracX), ::il2cpp_utils::ExtractType(fracY)}))); return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, p00, p10, p01, p11, fracX, fracY); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.Fractionalf float HoudiniEngineUnity::HEU_GeneralUtility::Fractionalf(float value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::Fractionalf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "Fractionalf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.LongestCommonPrefix ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::LongestCommonPrefix(System::Collections::Generic::List_1<::Il2CppString*>* list) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::LongestCommonPrefix"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "LongestCommonPrefix", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(list)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, list); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetRawOperatorName ::Il2CppString* HoudiniEngineUnity::HEU_GeneralUtility::GetRawOperatorName(::Il2CppString* assetOpName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetRawOperatorName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetRawOperatorName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(assetOpName)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, assetOpName); } // Autogenerated method: HoudiniEngineUnity.HEU_GeneralUtility.GetPrefabFromPath UnityEngine::GameObject* HoudiniEngineUnity::HEU_GeneralUtility::GetPrefabFromPath(::Il2CppString* path) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeneralUtility::GetPrefabFromPath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeneralUtility", "GetPrefabFromPath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(path)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::GameObject*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, path); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.ReverseCompare #include "HoudiniEngineUnity/ReverseCompare.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.ReverseCompare.Compare int HoudiniEngineUnity::ReverseCompare::Compare(::Il2CppObject* x, ::Il2CppObject* y) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::ReverseCompare::Compare"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Compare", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(x), ::il2cpp_utils::ExtractType(y)}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method, x, y); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache #include "HoudiniEngineUnity/HEU_GenerateGeoCache.hpp" // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo #include "HoudiniEngineUnity/HEU_GenerateGeoCache_HEU_ColliderInfo.hpp" // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c #include "HoudiniEngineUnity/HEU_GenerateGeoCache_--c.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: HoudiniEngineUnity.HEU_UnityMaterialInfo #include "HoudiniEngineUnity/HEU_UnityMaterialInfo.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_MaterialData #include "HoudiniEngineUnity/HEU_MaterialData.hpp" // Including type: HoudiniEngineUnity.HEU_MeshIndexFormat #include "HoudiniEngineUnity/HEU_MeshIndexFormat.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HEU_GeneratedOutputData #include "HoudiniEngineUnity/HEU_GeneratedOutputData.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" // Including type: HoudiniEngineUnity.HEU_GeoGroup #include "HoudiniEngineUnity/HEU_GeoGroup.hpp" // Including type: HoudiniEngineUnity.HEU_GeneratedOutput #include "HoudiniEngineUnity/HEU_GeneratedOutput.hpp" // Including type: UnityEngine.Mesh #include "UnityEngine/Mesh.hpp" // Including type: HoudiniEngineUnity.HEU_MeshData #include "HoudiniEngineUnity/HEU_MeshData.hpp" // Including type: UnityEngine.MeshTopology #include "UnityEngine/MeshTopology.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 <AssetID>k__BackingField int& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn_$AssetID$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn_$AssetID$k__BackingField"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<AssetID>k__BackingField"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_GeoInfo _geoInfo HoudiniEngineUnity::HAPI_GeoInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__geoInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__geoInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_geoInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_GeoInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_PartInfo _partInfo HoudiniEngineUnity::HAPI_PartInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__partInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__partInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_partInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_PartInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _partName ::Il2CppString*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__partName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__partName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_partName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _vertexList ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__vertexList() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__vertexList"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_vertexList"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _faceCounts ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__faceCounts() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__faceCounts"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_faceCounts"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _houdiniMaterialIDs ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__houdiniMaterialIDs() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__houdiniMaterialIDs"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_houdiniMaterialIDs"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _singleFaceUnityMaterial bool& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__singleFaceUnityMaterial() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__singleFaceUnityMaterial"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_singleFaceUnityMaterial"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _singleFaceHoudiniMaterial bool& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__singleFaceHoudiniMaterial() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__singleFaceHoudiniMaterial"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_singleFaceHoudiniMaterial"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,HoudiniEngineUnity.HEU_UnityMaterialInfo> _unityMaterialInfos System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_UnityMaterialInfo*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialInfos() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialInfos"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_unityMaterialInfos"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_UnityMaterialInfo*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _unityMaterialAttrInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_unityMaterialAttrInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _unityMaterialAttrName ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialAttrName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialAttrName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_unityMaterialAttrName"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,System.String> _unityMaterialAttrStringsMap System::Collections::Generic::Dictionary_2<int, ::Il2CppString*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialAttrStringsMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__unityMaterialAttrStringsMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_unityMaterialAttrStringsMap"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, ::Il2CppString*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _substanceMaterialAttrNameInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrNameInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrNameInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_substanceMaterialAttrNameInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _substanceMaterialAttrName ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_substanceMaterialAttrName"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,System.String> _substanceMaterialAttrStringsMap System::Collections::Generic::Dictionary_2<int, ::Il2CppString*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrStringsMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrStringsMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_substanceMaterialAttrStringsMap"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, ::Il2CppString*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _substanceMaterialAttrIndexInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrIndexInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrIndexInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_substanceMaterialAttrIndexInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _substanceMaterialAttrIndex ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrIndex() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__substanceMaterialAttrIndex"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_substanceMaterialAttrIndex"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_MaterialData> _inUseMaterials System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_MaterialData*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__inUseMaterials() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__inUseMaterials"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inUseMaterials"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_MaterialData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _posAttrInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__posAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__posAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_posAttrInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo[] _uvsAttrInfo ::ArrayW<HoudiniEngineUnity::HAPI_AttributeInfo>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__uvsAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__uvsAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_uvsAttrInfo"))->offset; return *reinterpret_cast<::ArrayW<HoudiniEngineUnity::HAPI_AttributeInfo>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _normalAttrInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__normalAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__normalAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalAttrInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _colorAttrInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__colorAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__colorAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorAttrInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _alphaAttrInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__alphaAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__alphaAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_alphaAttrInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AttributeInfo _tangentAttrInfo HoudiniEngineUnity::HAPI_AttributeInfo& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__tangentAttrInfo() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__tangentAttrInfo"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tangentAttrInfo"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AttributeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _posAttr ::ArrayW<float>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__posAttr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__posAttr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_posAttr"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[][] _uvsAttr ::ArrayW<::ArrayW<float>>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__uvsAttr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__uvsAttr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_uvsAttr"))->offset; return *reinterpret_cast<::ArrayW<::ArrayW<float>>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _normalAttr ::ArrayW<float>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__normalAttr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__normalAttr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalAttr"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _colorAttr ::ArrayW<float>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__colorAttr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__colorAttr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorAttr"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _alphaAttr ::ArrayW<float>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__alphaAttr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__alphaAttr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_alphaAttr"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _tangentAttr ::ArrayW<float>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__tangentAttr() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__tangentAttr"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tangentAttr"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String[] _groups ::ArrayW<::Il2CppString*>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groups() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groups"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_groups"))->offset; return *reinterpret_cast<::ArrayW<::Il2CppString*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _hasGroupGeometry bool& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__hasGroupGeometry() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__hasGroupGeometry"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_hasGroupGeometry"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.String,System.Int32[]> _groupSplitVertexIndices System::Collections::Generic::Dictionary_2<::Il2CppString*, ::ArrayW<int>>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groupSplitVertexIndices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groupSplitVertexIndices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_groupSplitVertexIndices"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<::Il2CppString*, ::ArrayW<int>>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.String,System.Collections.Generic.List`1<System.Int32>> _groupSplitFaceIndices System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Collections::Generic::List_1<int>*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groupSplitFaceIndices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groupSplitFaceIndices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_groupSplitFaceIndices"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Collections::Generic::List_1<int>*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.String,System.Collections.Generic.List`1<System.Int32>> _groupVertexOffsets System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Collections::Generic::List_1<int>*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groupVertexOffsets() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__groupVertexOffsets"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_groupVertexOffsets"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Collections::Generic::List_1<int>*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _allCollisionVertexList ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__allCollisionVertexList() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__allCollisionVertexList"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_allCollisionVertexList"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _allCollisionFaceIndices ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__allCollisionFaceIndices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__allCollisionFaceIndices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_allCollisionFaceIndices"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _normalCosineThreshold float& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__normalCosineThreshold() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__normalCosineThreshold"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalCosineThreshold"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _hasLODGroups bool& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__hasLODGroups() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__hasLODGroups"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_hasLODGroups"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single[] _LODTransitionValues ::ArrayW<float>& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__LODTransitionValues() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__LODTransitionValues"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_LODTransitionValues"))->offset; return *reinterpret_cast<::ArrayW<float>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _isMeshReadWrite bool& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__isMeshReadWrite() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__isMeshReadWrite"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isMeshReadWrite"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo> _colliderInfos System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__colliderInfos() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__colliderInfos"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colliderInfos"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_MaterialData> _materialCache System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_MaterialData*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__materialCache() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__materialCache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_materialCache"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_MaterialData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,HoudiniEngineUnity.HEU_MaterialData> _materialIDToDataMap System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_MaterialData*>*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__materialIDToDataMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__materialIDToDataMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_materialIDToDataMap"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_MaterialData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _assetCacheFolderPath ::Il2CppString*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__assetCacheFolderPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__assetCacheFolderPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_assetCacheFolderPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_MeshIndexFormat _meshIndexFormat HoudiniEngineUnity::HEU_MeshIndexFormat*& HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__meshIndexFormat() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::dyn__meshIndexFormat"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshIndexFormat"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_MeshIndexFormat**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.get_GeoID int HoudiniEngineUnity::HEU_GenerateGeoCache::get_GeoID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::get_GeoID"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_GeoID", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.get_PartID int HoudiniEngineUnity::HEU_GenerateGeoCache::get_PartID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::get_PartID"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_PartID", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.get_AssetID int HoudiniEngineUnity::HEU_GenerateGeoCache::get_AssetID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::get_AssetID"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AssetID", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.set_AssetID void HoudiniEngineUnity::HEU_GenerateGeoCache::set_AssetID(int value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::set_AssetID"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AssetID", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GetPopulatedGeoCache HoudiniEngineUnity::HEU_GenerateGeoCache* HoudiniEngineUnity::HEU_GenerateGeoCache::GetPopulatedGeoCache(HoudiniEngineUnity::HEU_SessionBase* session, int assetID, int geoID, int partID, bool bUseLODGroups, System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_MaterialData*>* materialCache, ::Il2CppString* assetCacheFolderPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GetPopulatedGeoCache"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GetPopulatedGeoCache", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(assetID), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(bUseLODGroups), ::il2cpp_utils::ExtractType(materialCache), ::il2cpp_utils::ExtractType(assetCacheFolderPath)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_GenerateGeoCache*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, assetID, geoID, partID, bUseLODGroups, materialCache, assetCacheFolderPath); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.PopulateUnityMaterialData void HoudiniEngineUnity::HEU_GenerateGeoCache::PopulateUnityMaterialData(HoudiniEngineUnity::HEU_SessionBase* session) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::PopulateUnityMaterialData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PopulateUnityMaterialData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GetMaterialKeyFromAttributeIndex int HoudiniEngineUnity::HEU_GenerateGeoCache::GetMaterialKeyFromAttributeIndex(HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, int attributeIndex, ByRef<::Il2CppString*> unityMaterialName, ByRef<::Il2CppString*> substanceName, ByRef<int> substanceIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GetMaterialKeyFromAttributeIndex"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GetMaterialKeyFromAttributeIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(attributeIndex), ::il2cpp_utils::ExtractIndependentType<::Il2CppString*&>(), ::il2cpp_utils::ExtractIndependentType<::Il2CppString*&>(), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, geoCache, attributeIndex, byref(unityMaterialName), byref(substanceName), byref(substanceIndex)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.CreateMaterialInfoEntryFromAttributeIndex void HoudiniEngineUnity::HEU_GenerateGeoCache::CreateMaterialInfoEntryFromAttributeIndex(HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, int materialAttributeIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::CreateMaterialInfoEntryFromAttributeIndex"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "CreateMaterialInfoEntryFromAttributeIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(materialAttributeIndex)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, geoCache, materialAttributeIndex); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.PopulateGeometryData bool HoudiniEngineUnity::HEU_GenerateGeoCache::PopulateGeometryData(HoudiniEngineUnity::HEU_SessionBase* session, bool bUseLODGroups) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::PopulateGeometryData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PopulateGeometryData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(bUseLODGroups)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, bUseLODGroups); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.ParseLODTransitionAttribute void HoudiniEngineUnity::HEU_GenerateGeoCache::ParseLODTransitionAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ByRef<::ArrayW<float>> LODTransitionValues) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::ParseLODTransitionAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "ParseLODTransitionAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(LODTransitionValues)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, byref(LODTransitionValues)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.UpdateColliders void HoudiniEngineUnity::HEU_GenerateGeoCache::UpdateColliders(HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, HoudiniEngineUnity::HEU_GeneratedOutputData* outputData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::UpdateColliders"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "UpdateColliders", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(outputData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, geoCache, outputData); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.UpdateCollider void HoudiniEngineUnity::HEU_GenerateGeoCache::UpdateCollider(HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, HoudiniEngineUnity::HEU_GeneratedOutputData* outputData, HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo* colliderInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::UpdateCollider"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "UpdateCollider", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(outputData), ::il2cpp_utils::ExtractType(colliderInfo)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, geoCache, outputData, colliderInfo); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GetFinalMaterialsFromComparingNewWithPrevious void HoudiniEngineUnity::HEU_GenerateGeoCache::GetFinalMaterialsFromComparingNewWithPrevious(UnityEngine::GameObject* gameObject, ::ArrayW<UnityEngine::Material*> previousMaterials, ::ArrayW<UnityEngine::Material*> newMaterials, ByRef<::ArrayW<UnityEngine::Material*>> finalMaterials) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GetFinalMaterialsFromComparingNewWithPrevious"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GetFinalMaterialsFromComparingNewWithPrevious", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject), ::il2cpp_utils::ExtractType(previousMaterials), ::il2cpp_utils::ExtractType(newMaterials), ::il2cpp_utils::ExtractType(finalMaterials)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject, previousMaterials, newMaterials, byref(finalMaterials)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GenerateMeshFromSingleGroup bool HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateMeshFromSingleGroup(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_GeoGroup* GeoGroup, HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, HoudiniEngineUnity::HEU_GeneratedOutput* generatedOutput, int defaultMaterialKey, bool bGenerateUVs, bool bGenerateTangents, bool bGenerateNormals, bool bPartInstanced) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateMeshFromSingleGroup"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GenerateMeshFromSingleGroup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(GeoGroup), ::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(generatedOutput), ::il2cpp_utils::ExtractType(defaultMaterialKey), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateTangents), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(bPartInstanced)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, GeoGroup, geoCache, generatedOutput, defaultMaterialKey, bGenerateUVs, bGenerateTangents, bGenerateNormals, bPartInstanced); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GenerateLODMeshesFromGeoGroups bool HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateLODMeshesFromGeoGroups(HoudiniEngineUnity::HEU_SessionBase* session, System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>* GeoGroupMeshes, HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, HoudiniEngineUnity::HEU_GeneratedOutput* generatedOutput, int defaultMaterialKey, bool bGenerateUVs, bool bGenerateTangents, bool bGenerateNormals, bool bPartInstanced) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateLODMeshesFromGeoGroups"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GenerateLODMeshesFromGeoGroups", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(GeoGroupMeshes), ::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(generatedOutput), ::il2cpp_utils::ExtractType(defaultMaterialKey), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateTangents), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(bPartInstanced)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, GeoGroupMeshes, geoCache, generatedOutput, defaultMaterialKey, bGenerateUVs, bGenerateTangents, bGenerateNormals, bPartInstanced); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GenerateMeshFromGeoGroup bool HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateMeshFromGeoGroup(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_GeoGroup* GeoGroup, HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, int defaultMaterialKey, bool bGenerateUVs, bool bGenerateTangents, bool bGenerateNormals, bool bPartInstanced, ByRef<UnityEngine::Mesh*> newMesh, ByRef<::ArrayW<UnityEngine::Material*>> newMaterials) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateMeshFromGeoGroup"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GenerateMeshFromGeoGroup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(GeoGroup), ::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(defaultMaterialKey), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateTangents), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(bPartInstanced), ::il2cpp_utils::ExtractIndependentType<UnityEngine::Mesh*&>(), ::il2cpp_utils::ExtractIndependentType<::ArrayW<UnityEngine::Material*>&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, GeoGroup, geoCache, defaultMaterialKey, bGenerateUVs, bGenerateTangents, bGenerateNormals, bPartInstanced, byref(newMesh), byref(newMaterials)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.CombineQuadMeshes UnityEngine::Mesh* HoudiniEngineUnity::HEU_GenerateGeoCache::CombineQuadMeshes(System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_MeshData*>* subMeshesMap, System::Collections::Generic::List_1<int>* subMeshIndices, bool bGenerateNormals) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::CombineQuadMeshes"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "CombineQuadMeshes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(subMeshesMap), ::il2cpp_utils::ExtractType(subMeshIndices), ::il2cpp_utils::ExtractType(bGenerateNormals)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Mesh*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, subMeshesMap, subMeshIndices, bGenerateNormals); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.CombineMeshes UnityEngine::Mesh* HoudiniEngineUnity::HEU_GenerateGeoCache::CombineMeshes(System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_MeshData*>* subMeshesMap, System::Collections::Generic::List_1<int>* submeshIndices, bool bGenerateUVs, bool bGenerateNormals, HoudiniEngineUnity::HEU_MeshIndexFormat* meshIndexFormat) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::CombineMeshes"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "CombineMeshes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(subMeshesMap), ::il2cpp_utils::ExtractType(submeshIndices), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(meshIndexFormat)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Mesh*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, subMeshesMap, submeshIndices, bGenerateUVs, bGenerateNormals, meshIndexFormat); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.CreateMeshFromMeshData UnityEngine::Mesh* HoudiniEngineUnity::HEU_GenerateGeoCache::CreateMeshFromMeshData(HoudiniEngineUnity::HEU_MeshData* submesh, bool bGenerateUVs, bool bGenerateNormals, HoudiniEngineUnity::HEU_MeshIndexFormat* meshIndexFormat) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::CreateMeshFromMeshData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "CreateMeshFromMeshData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(submesh), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(meshIndexFormat)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Mesh*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, submesh, bGenerateUVs, bGenerateNormals, meshIndexFormat); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.TransferRegularAttributesToVertices void HoudiniEngineUnity::HEU_GenerateGeoCache::TransferRegularAttributesToVertices(::ArrayW<int> groupVertexList, ::ArrayW<int> allFaceCounts, System::Collections::Generic::List_1<int>* groupFaces, System::Collections::Generic::List_1<int>* groupVertexOffset, ByRef<HoudiniEngineUnity::HAPI_AttributeInfo> attribInfo, ::ArrayW<float> inData, ByRef<::ArrayW<float>> outData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::TransferRegularAttributesToVertices"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "TransferRegularAttributesToVertices", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(groupVertexList), ::il2cpp_utils::ExtractType(allFaceCounts), ::il2cpp_utils::ExtractType(groupFaces), ::il2cpp_utils::ExtractType(groupVertexOffset), ::il2cpp_utils::ExtractType(attribInfo), ::il2cpp_utils::ExtractType(inData), ::il2cpp_utils::ExtractType(outData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, groupVertexList, allFaceCounts, groupFaces, groupVertexOffset, byref(attribInfo), inData, byref(outData)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GenerateGeoGroupUsingGeoCacheVertices bool HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateGeoGroupUsingGeoCacheVertices(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, bool bGenerateUVs, bool bGenerateTangents, bool bGenerateNormals, bool bUseLODGroups, bool bPartInstanced, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>*> LODGroupMeshes, ByRef<int> defaultMaterialKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateGeoGroupUsingGeoCacheVertices"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GenerateGeoGroupUsingGeoCacheVertices", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateTangents), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(bUseLODGroups), ::il2cpp_utils::ExtractType(bPartInstanced), ::il2cpp_utils::ExtractIndependentType<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>*&>(), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoCache, bGenerateUVs, bGenerateTangents, bGenerateNormals, bUseLODGroups, bPartInstanced, byref(LODGroupMeshes), byref(defaultMaterialKey)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.GenerateGeoGroupUsingGeoCachePoints bool HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateGeoGroupUsingGeoCachePoints(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_GenerateGeoCache* geoCache, bool bGenerateUVs, bool bGenerateTangents, bool bGenerateNormals, bool bUseLODGroups, bool bPartInstanced, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>*> LODGroupMeshes, ByRef<int> defaultMaterialKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::GenerateGeoGroupUsingGeoCachePoints"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "GenerateGeoGroupUsingGeoCachePoints", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoCache), ::il2cpp_utils::ExtractType(bGenerateUVs), ::il2cpp_utils::ExtractType(bGenerateTangents), ::il2cpp_utils::ExtractType(bGenerateNormals), ::il2cpp_utils::ExtractType(bUseLODGroups), ::il2cpp_utils::ExtractType(bPartInstanced), ::il2cpp_utils::ExtractIndependentType<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_GeoGroup*>*&>(), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoCache, bGenerateUVs, bGenerateTangents, bGenerateNormals, bUseLODGroups, bPartInstanced, byref(LODGroupMeshes), byref(defaultMaterialKey)); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache.CalculateGroupMeshTopology UnityEngine::MeshTopology HoudiniEngineUnity::HEU_GenerateGeoCache::CalculateGroupMeshTopology(System::Collections::Generic::List_1<int>* groupFaces, ::ArrayW<int> allFaceCounts) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::CalculateGroupMeshTopology"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache", "CalculateGroupMeshTopology", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(groupFaces), ::il2cpp_utils::ExtractType(allFaceCounts)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::MeshTopology, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, groupFaces, allFaceCounts); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo #include "HoudiniEngineUnity/HEU_GenerateGeoCache_HEU_ColliderInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType _colliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderType"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colliderType"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _colliderCenter UnityEngine::Vector3& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderCenter() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderCenter"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colliderCenter"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3 _colliderSize UnityEngine::Vector3& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderSize() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderSize"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colliderSize"))->offset; return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _colliderRadius float& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderRadius() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__colliderRadius"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colliderRadius"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _convexCollider bool& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__convexCollider() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__convexCollider"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_convexCollider"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _collisionGroupName ::Il2CppString*& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__collisionGroupName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__collisionGroupName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_collisionGroupName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Vector3[] _collisionVertices ::ArrayW<UnityEngine::Vector3>& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__collisionVertices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__collisionVertices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_collisionVertices"))->offset; return *reinterpret_cast<::ArrayW<UnityEngine::Vector3>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32[] _collisionIndices ::ArrayW<int>& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__collisionIndices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__collisionIndices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_collisionIndices"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.MeshTopology _meshTopology UnityEngine::MeshTopology& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__meshTopology() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__meshTopology"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshTopology"))->offset; return *reinterpret_cast<UnityEngine::MeshTopology*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _isTrigger bool& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__isTrigger() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::dyn__isTrigger"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isTrigger"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType #include "HoudiniEngineUnity/HEU_GenerateGeoCache_HEU_ColliderInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType NONE HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_NONE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_NONE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "NONE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType NONE void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_NONE(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_NONE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "NONE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType BOX HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_BOX() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_BOX"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "BOX")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType BOX void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_BOX(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_BOX"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "BOX", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SPHERE HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SPHERE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SPHERE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SPHERE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SPHERE void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SPHERE(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SPHERE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SPHERE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType MESH HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_MESH() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_MESH"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "MESH")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType MESH void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_MESH(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_MESH"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "MESH", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SIMPLE_BOX HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SIMPLE_BOX() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SIMPLE_BOX"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SIMPLE_BOX")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SIMPLE_BOX void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SIMPLE_BOX(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SIMPLE_BOX"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SIMPLE_BOX", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SIMPLE_SPHERE HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SIMPLE_SPHERE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SIMPLE_SPHERE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SIMPLE_SPHERE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SIMPLE_SPHERE void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SIMPLE_SPHERE(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SIMPLE_SPHERE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SIMPLE_SPHERE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SIMPLE_CAPSULE HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SIMPLE_CAPSULE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_get_SIMPLE_CAPSULE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType>("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SIMPLE_CAPSULE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.HEU_ColliderInfo/HoudiniEngineUnity.ColliderType SIMPLE_CAPSULE void HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SIMPLE_CAPSULE(HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::_set_SIMPLE_CAPSULE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/HEU_ColliderInfo/ColliderType", "SIMPLE_CAPSULE", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::HEU_ColliderInfo::ColliderType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c #include "HoudiniEngineUnity/HEU_GenerateGeoCache_--c.hpp" // Including type: System.Predicate`1 #include "System/Predicate_1.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" // Including type: System.Comparison`1 #include "System/Comparison_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public readonly HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c <>9 HoudiniEngineUnity::HEU_GenerateGeoCache::$$c* HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_get_$$9() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_get_$$9"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_GenerateGeoCache::$$c*>("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", "<>9"))); } // Autogenerated static field setter // Set static field: static public readonly HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c <>9 void HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_set_$$9(HoudiniEngineUnity::HEU_GenerateGeoCache::$$c* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_set_$$9"); THROW_UNLESS((il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", "<>9", value))); } // Autogenerated static field getter // Get static field: static public System.Predicate`1<UnityEngine.Material> <>9__63_0 System::Predicate_1<UnityEngine::Material*>* HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_get_$$9__63_0() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_get_$$9__63_0"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<System::Predicate_1<UnityEngine::Material*>*>("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", "<>9__63_0"))); } // Autogenerated static field setter // Set static field: static public System.Predicate`1<UnityEngine.Material> <>9__63_0 void HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_set_$$9__63_0(System::Predicate_1<UnityEngine::Material*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_set_$$9__63_0"); THROW_UNLESS((il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", "<>9__63_0", value))); } // Autogenerated static field getter // Get static field: static public System.Comparison`1<System.Single> <>9__65_0 System::Comparison_1<float>* HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_get_$$9__65_0() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_get_$$9__65_0"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<System::Comparison_1<float>*>("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", "<>9__65_0"))); } // Autogenerated static field setter // Set static field: static public System.Comparison`1<System.Single> <>9__65_0 void HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_set_$$9__65_0(System::Comparison_1<float>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_set_$$9__65_0"); THROW_UNLESS((il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", "<>9__65_0", value))); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c..cctor void HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GenerateGeoCache/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c.<GetFinalMaterialsFromComparingNewWithPrevious>b__63_0 bool HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::$GetFinalMaterialsFromComparingNewWithPrevious$b__63_0(UnityEngine::Material* material) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::<GetFinalMaterialsFromComparingNewWithPrevious>b__63_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<GetFinalMaterialsFromComparingNewWithPrevious>b__63_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(material)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, material); } // Autogenerated method: HoudiniEngineUnity.HEU_GenerateGeoCache/HoudiniEngineUnity.<>c.<GenerateLODMeshesFromGeoGroups>b__65_0 int HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::$GenerateLODMeshesFromGeoGroups$b__65_0(float a, float b) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GenerateGeoCache::$$c::<GenerateLODMeshesFromGeoGroups>b__65_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<GenerateLODMeshesFromGeoGroups>b__65_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method, a, b); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_GeoGroup #include "HoudiniEngineUnity/HEU_GeoGroup.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: HoudiniEngineUnity.HEU_MeshData #include "HoudiniEngineUnity/HEU_MeshData.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_VertexEntry #include "HoudiniEngineUnity/HEU_VertexEntry.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.String _groupName ::Il2CppString*& HoudiniEngineUnity::HEU_GeoGroup::dyn__groupName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeoGroup::dyn__groupName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_groupName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,HoudiniEngineUnity.HEU_MeshData> _subMeshesMap System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_MeshData*>*& HoudiniEngineUnity::HEU_GeoGroup::dyn__subMeshesMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeoGroup::dyn__subMeshesMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_subMeshesMap"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, HoudiniEngineUnity::HEU_MeshData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_VertexEntry>[] _sharedNormalIndices ::ArrayW<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_VertexEntry*>*>& HoudiniEngineUnity::HEU_GeoGroup::dyn__sharedNormalIndices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeoGroup::dyn__sharedNormalIndices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sharedNormalIndices"))->offset; return *reinterpret_cast<::ArrayW<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_VertexEntry*>*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_GeoGroup.CompareTo int HoudiniEngineUnity::HEU_GeoGroup::CompareTo(HoudiniEngineUnity::HEU_GeoGroup* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeoGroup::CompareTo"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CompareTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method, other); } // Autogenerated method: HoudiniEngineUnity.HEU_GeoGroup.SetupNormalIndices void HoudiniEngineUnity::HEU_GeoGroup::SetupNormalIndices(int indicesCount) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeoGroup::SetupNormalIndices"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupNormalIndices", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(indicesCount)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, indicesCount); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_VertexEntry #include "HoudiniEngineUnity/HEU_VertexEntry.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 _meshKey int& HoudiniEngineUnity::HEU_VertexEntry::dyn__meshKey() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_VertexEntry::dyn__meshKey"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshKey"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _vertexIndex int& HoudiniEngineUnity::HEU_VertexEntry::dyn__vertexIndex() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_VertexEntry::dyn__vertexIndex"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_vertexIndex"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _normalIndex int& HoudiniEngineUnity::HEU_VertexEntry::dyn__normalIndex() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_VertexEntry::dyn__normalIndex"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalIndex"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_GeometryUtility #include "HoudiniEngineUnity/HEU_GeometryUtility.hpp" // Including type: UnityEngine.Mesh #include "UnityEngine/Mesh.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_GeometryUtility.GeneratePerTriangle ::ArrayW<UnityEngine::Vector2> HoudiniEngineUnity::HEU_GeometryUtility::GeneratePerTriangle(UnityEngine::Mesh* meshSrc) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeometryUtility::GeneratePerTriangle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeometryUtility", "GeneratePerTriangle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(meshSrc)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<UnityEngine::Vector2>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, meshSrc); } // Autogenerated method: HoudiniEngineUnity.HEU_GeometryUtility.GenerateSecondaryUVSet void HoudiniEngineUnity::HEU_GeometryUtility::GenerateSecondaryUVSet(UnityEngine::Mesh* meshsrc) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeometryUtility::GenerateSecondaryUVSet"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeometryUtility", "GenerateSecondaryUVSet", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(meshsrc)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, meshsrc); } // Autogenerated method: HoudiniEngineUnity.HEU_GeometryUtility.CalculateMeshTangents void HoudiniEngineUnity::HEU_GeometryUtility::CalculateMeshTangents(UnityEngine::Mesh* mesh) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeometryUtility::CalculateMeshTangents"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeometryUtility", "CalculateMeshTangents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(mesh)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, mesh); } // Autogenerated method: HoudiniEngineUnity.HEU_GeometryUtility.GenerateCubeMeshFromPoints UnityEngine::Mesh* HoudiniEngineUnity::HEU_GeometryUtility::GenerateCubeMeshFromPoints(::ArrayW<UnityEngine::Vector3> points, ::ArrayW<UnityEngine::Color> pointsColor, float size) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeometryUtility::GenerateCubeMeshFromPoints"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeometryUtility", "GenerateCubeMeshFromPoints", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(points), ::il2cpp_utils::ExtractType(pointsColor), ::il2cpp_utils::ExtractType(size)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Mesh*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, points, pointsColor, size); } // Autogenerated method: HoudiniEngineUnity.HEU_GeometryUtility.GetInstanceOutputName ::Il2CppString* HoudiniEngineUnity::HEU_GeometryUtility::GetInstanceOutputName(::Il2CppString* partName, ::ArrayW<::Il2CppString*> userPrefix, int index) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_GeometryUtility::GetInstanceOutputName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_GeometryUtility", "GetInstanceOutputName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(partName), ::il2cpp_utils::ExtractType(userPrefix), ::il2cpp_utils::ExtractType(index)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, partName, userPrefix, index); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputData #include "HoudiniEngineUnity/HEU_InputData.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.GameObject _inputObject UnityEngine::GameObject*& HoudiniEngineUnity::HEU_InputData::dyn__inputObject() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputData::dyn__inputObject"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inputObject"))->offset; return *reinterpret_cast<UnityEngine::GameObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputInterface #include "HoudiniEngineUnity/HEU_InputInterface.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public System.Int32 DEFAULT_PRIORITY int HoudiniEngineUnity::HEU_InputInterface::_get_DEFAULT_PRIORITY() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::_get_DEFAULT_PRIORITY"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("HoudiniEngineUnity", "HEU_InputInterface", "DEFAULT_PRIORITY")); } // Autogenerated static field setter // Set static field: static public System.Int32 DEFAULT_PRIORITY void HoudiniEngineUnity::HEU_InputInterface::_set_DEFAULT_PRIORITY(int value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::_set_DEFAULT_PRIORITY"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_InputInterface", "DEFAULT_PRIORITY", value)); } // Autogenerated instance field getter // Get instance field: protected System.Int32 _priority int& HoudiniEngineUnity::HEU_InputInterface::dyn__priority() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::dyn__priority"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_priority"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterface.get_Priority int HoudiniEngineUnity::HEU_InputInterface::get_Priority() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::get_Priority"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Priority", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterface.RegisterInterface void HoudiniEngineUnity::HEU_InputInterface::RegisterInterface() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::RegisterInterface"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterInterface", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterface.IsThisInputObjectSupported bool HoudiniEngineUnity::HEU_InputInterface::IsThisInputObjectSupported(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::IsThisInputObjectSupported"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsThisInputObjectSupported", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, inputObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterface.CreateInputNodeWithDataUpload bool HoudiniEngineUnity::HEU_InputInterface::CreateInputNodeWithDataUpload(HoudiniEngineUnity::HEU_SessionBase* session, int connectNodeID, UnityEngine::GameObject* inputObject, ByRef<int> inputNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterface::CreateInputNodeWithDataUpload"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateInputNodeWithDataUpload", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(connectNodeID), ::il2cpp_utils::ExtractType(inputObject), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, connectNodeID, inputObject, byref(inputNodeID)); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputInterfaceMesh #include "HoudiniEngineUnity/HEU_InputInterfaceMesh.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterfaceMesh/HoudiniEngineUnity.HEU_InputDataMeshes #include "HoudiniEngineUnity/HEU_InputInterfaceMesh_HEU_InputDataMeshes.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterfaceMesh/HoudiniEngineUnity.HEU_InputDataMesh #include "HoudiniEngineUnity/HEU_InputInterfaceMesh_HEU_InputDataMesh.hpp" // Including type: UnityEngine.Mesh #include "UnityEngine/Mesh.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HEU_InputData #include "HoudiniEngineUnity/HEU_InputData.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.GetUVsFromMesh void HoudiniEngineUnity::HEU_InputInterfaceMesh::GetUVsFromMesh(UnityEngine::Mesh* mesh, ::ArrayW<UnityEngine::Vector2> srcUVs, System::Collections::Generic::List_1<UnityEngine::Vector3>* destUVs, int index) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::GetUVsFromMesh"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputInterfaceMesh", "GetUVsFromMesh", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(mesh), ::il2cpp_utils::ExtractType(srcUVs), ::il2cpp_utils::ExtractType(destUVs), ::il2cpp_utils::ExtractType(index)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, mesh, srcUVs, destUVs, index); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.UploadData bool HoudiniEngineUnity::HEU_InputInterfaceMesh::UploadData(HoudiniEngineUnity::HEU_SessionBase* session, int inputNodeID, HoudiniEngineUnity::HEU_InputData* inputData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::UploadData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UploadData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(inputNodeID), ::il2cpp_utils::ExtractType(inputData)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, inputNodeID, inputData); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.GenerateMeshDatasFromGameObject HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMeshes* HoudiniEngineUnity::HEU_InputInterfaceMesh::GenerateMeshDatasFromGameObject(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::GenerateMeshDatasFromGameObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GenerateMeshDatasFromGameObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMeshes*, false>(this, ___internal__method, inputObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.CreateSingleMeshData HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh* HoudiniEngineUnity::HEU_InputInterfaceMesh::CreateSingleMeshData(UnityEngine::GameObject* meshGameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::CreateSingleMeshData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputInterfaceMesh", "CreateSingleMeshData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(meshGameObject)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, meshGameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.GetMeshFromObject UnityEngine::Mesh* HoudiniEngineUnity::HEU_InputInterfaceMesh::GetMeshFromObject(UnityEngine::GameObject* meshGameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::GetMeshFromObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputInterfaceMesh", "GetMeshFromObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(meshGameObject)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Mesh*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, meshGameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.CreateInputNodeWithDataUpload bool HoudiniEngineUnity::HEU_InputInterfaceMesh::CreateInputNodeWithDataUpload(HoudiniEngineUnity::HEU_SessionBase* session, int connectNodeID, UnityEngine::GameObject* inputObject, ByRef<int> inputNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::CreateInputNodeWithDataUpload"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateInputNodeWithDataUpload", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(connectNodeID), ::il2cpp_utils::ExtractType(inputObject), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, connectNodeID, inputObject, byref(inputNodeID)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceMesh.IsThisInputObjectSupported bool HoudiniEngineUnity::HEU_InputInterfaceMesh::IsThisInputObjectSupported(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::IsThisInputObjectSupported"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsThisInputObjectSupported", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, inputObject); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputInterfaceMesh/HoudiniEngineUnity.HEU_InputDataMeshes #include "HoudiniEngineUnity/HEU_InputInterfaceMesh_HEU_InputDataMeshes.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterfaceMesh/HoudiniEngineUnity.HEU_InputDataMesh #include "HoudiniEngineUnity/HEU_InputInterfaceMesh_HEU_InputDataMesh.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_InputInterfaceMesh/HoudiniEngineUnity.HEU_InputDataMesh> _inputMeshes System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh*>*& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMeshes::dyn__inputMeshes() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMeshes::dyn__inputMeshes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inputMeshes"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _hasLOD bool& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMeshes::dyn__hasLOD() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMeshes::dyn__hasLOD"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_hasLOD"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_InputInterfaceMesh/HoudiniEngineUnity.HEU_InputDataMesh #include "HoudiniEngineUnity/HEU_InputInterfaceMesh_HEU_InputDataMesh.hpp" // Including type: UnityEngine.Mesh #include "UnityEngine/Mesh.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" // Including type: UnityEngine.Transform #include "UnityEngine/Transform.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.Mesh _mesh UnityEngine::Mesh*& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__mesh() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__mesh"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_mesh"))->offset; return *reinterpret_cast<UnityEngine::Mesh**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Material[] _materials ::ArrayW<UnityEngine::Material*>& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__materials() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__materials"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_materials"))->offset; return *reinterpret_cast<::ArrayW<UnityEngine::Material*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _meshPath ::Il2CppString*& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__meshPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__meshPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _meshName ::Il2CppString*& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__meshName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__meshName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _numVertices int& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__numVertices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__numVertices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_numVertices"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _numSubMeshes int& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__numSubMeshes() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__numSubMeshes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_numSubMeshes"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.UInt32[] _indexStart ::ArrayW<uint>& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__indexStart() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__indexStart"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_indexStart"))->offset; return *reinterpret_cast<::ArrayW<uint>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.UInt32[] _indexCount ::ArrayW<uint>& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__indexCount() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__indexCount"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_indexCount"))->offset; return *reinterpret_cast<::ArrayW<uint>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _LODScreenTransition float& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__LODScreenTransition() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__LODScreenTransition"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_LODScreenTransition"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Transform _transform UnityEngine::Transform*& HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__transform() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceMesh::HEU_InputDataMesh::dyn__transform"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_transform"))->offset; return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_InputInterfaceTerrain #include "HoudiniEngineUnity/HEU_InputInterfaceTerrain.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterfaceTerrain/HoudiniEngineUnity.HEU_InputDataTerrain #include "HoudiniEngineUnity/HEU_InputInterfaceTerrain_HEU_InputDataTerrain.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HAPI_VolumeInfo #include "HoudiniEngineUnity/HAPI_VolumeInfo.hpp" // Including type: UnityEngine.TerrainData #include "UnityEngine/TerrainData.hpp" // Including type: UnityEngine.TerrainLayer #include "UnityEngine/TerrainLayer.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.SetMaskLayer bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetMaskLayer(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain* idt, ByRef<HoudiniEngineUnity::HAPI_VolumeInfo> baseVolumeInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetMaskLayer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetMaskLayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(idt), ::il2cpp_utils::ExtractType(baseVolumeInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, idt, byref(baseVolumeInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.CreateHeightFieldInputNode bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::CreateHeightFieldInputNode(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain* idt) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::CreateHeightFieldInputNode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateHeightFieldInputNode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(idt)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, idt); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.UploadHeightValuesWithTransform bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::UploadHeightValuesWithTransform(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain* idt, ByRef<HoudiniEngineUnity::HAPI_VolumeInfo> volumeInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::UploadHeightValuesWithTransform"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UploadHeightValuesWithTransform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(idt), ::il2cpp_utils::ExtractType(volumeInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, idt, byref(volumeInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.UploadAlphaMaps bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::UploadAlphaMaps(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain* idt, ByRef<HoudiniEngineUnity::HAPI_VolumeInfo> baseVolumeInfo, ByRef<bool> bMaskSet) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::UploadAlphaMaps"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UploadAlphaMaps", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(idt), ::il2cpp_utils::ExtractType(baseVolumeInfo), ::il2cpp_utils::ExtractIndependentType<bool&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, idt, byref(baseVolumeInfo), byref(bMaskSet)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.SetHeightFieldData bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetHeightFieldData(HoudiniEngineUnity::HEU_SessionBase* session, int volumeNodeID, int partID, ::ArrayW<float> heightValues, ::Il2CppString* heightFieldName, ByRef<HoudiniEngineUnity::HAPI_VolumeInfo> baseVolumeInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetHeightFieldData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetHeightFieldData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(volumeNodeID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(heightValues), ::il2cpp_utils::ExtractType(heightFieldName), ::il2cpp_utils::ExtractType(baseVolumeInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, volumeNodeID, partID, heightValues, heightFieldName, byref(baseVolumeInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.SetTerrainDataAttributesToHeightField bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTerrainDataAttributesToHeightField(HoudiniEngineUnity::HEU_SessionBase* session, int geoNodeID, int partID, UnityEngine::TerrainData* terrainData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTerrainDataAttributesToHeightField"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetTerrainDataAttributesToHeightField", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoNodeID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(terrainData)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, geoNodeID, partID, terrainData); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.SetTerrainLayerAttributesToHeightField bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTerrainLayerAttributesToHeightField(HoudiniEngineUnity::HEU_SessionBase* session, int geoNodeID, int partID, UnityEngine::TerrainLayer* terrainLayer) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTerrainLayerAttributesToHeightField"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetTerrainLayerAttributesToHeightField", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoNodeID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(terrainLayer)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, geoNodeID, partID, terrainLayer); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.SetTreePrototypes void HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTreePrototypes(HoudiniEngineUnity::HEU_SessionBase* session, int geoNodeID, int partID, UnityEngine::TerrainData* terrainData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTreePrototypes"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetTreePrototypes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoNodeID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(terrainData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, geoNodeID, partID, terrainData); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.SetTreeInstances void HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTreeInstances(HoudiniEngineUnity::HEU_SessionBase* session, int geoNodeID, int partID, UnityEngine::TerrainData* terrainData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::SetTreeInstances"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetTreeInstances", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoNodeID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(terrainData)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, session, geoNodeID, partID, terrainData); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.GenerateTerrainDataFromGameObject HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain* HoudiniEngineUnity::HEU_InputInterfaceTerrain::GenerateTerrainDataFromGameObject(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::GenerateTerrainDataFromGameObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GenerateTerrainDataFromGameObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain*, false>(this, ___internal__method, inputObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.CreateInputNodeWithDataUpload bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::CreateInputNodeWithDataUpload(HoudiniEngineUnity::HEU_SessionBase* session, int connectNodeID, UnityEngine::GameObject* inputObject, ByRef<int> inputNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::CreateInputNodeWithDataUpload"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateInputNodeWithDataUpload", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(connectNodeID), ::il2cpp_utils::ExtractType(inputObject), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, connectNodeID, inputObject, byref(inputNodeID)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTerrain.IsThisInputObjectSupported bool HoudiniEngineUnity::HEU_InputInterfaceTerrain::IsThisInputObjectSupported(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::IsThisInputObjectSupported"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsThisInputObjectSupported", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, inputObject); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_InputInterfaceTerrain/HoudiniEngineUnity.HEU_InputDataTerrain #include "HoudiniEngineUnity/HEU_InputInterfaceTerrain_HEU_InputDataTerrain.hpp" // Including type: UnityEngine.Terrain #include "UnityEngine/Terrain.hpp" // Including type: UnityEngine.TerrainData #include "UnityEngine/TerrainData.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.String _heightFieldName ::Il2CppString*& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightFieldName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightFieldName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightFieldName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _parentNodeID int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__parentNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__parentNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_parentNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _voxelSize float& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__voxelSize() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__voxelSize"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_voxelSize"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Terrain _terrain UnityEngine::Terrain*& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__terrain() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__terrain"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrain"))->offset; return *reinterpret_cast<UnityEngine::Terrain**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.TerrainData _terrainData UnityEngine::TerrainData*& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__terrainData() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__terrainData"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_terrainData"))->offset; return *reinterpret_cast<UnityEngine::TerrainData**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _numPointsX int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__numPointsX() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__numPointsX"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_numPointsX"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _numPointsY int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__numPointsY() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__numPointsY"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_numPointsY"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_Transform _transform HoudiniEngineUnity::HAPI_Transform& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__transform() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__transform"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_transform"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_Transform*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single _heightScale float& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightScale() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightScale"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightScale"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _heightfieldNodeID int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightfieldNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightfieldNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightfieldNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _heightNodeID int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__heightNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_heightNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _maskNodeID int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__maskNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__maskNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maskNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 _mergeNodeID int& HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__mergeNodeID() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTerrain::HEU_InputDataTerrain::dyn__mergeNodeID"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_mergeNodeID"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputInterfaceTilemapSettings #include "HoudiniEngineUnity/HEU_InputInterfaceTilemapSettings.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Boolean _createGroupsForTiles bool& HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__createGroupsForTiles() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__createGroupsForTiles"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_createGroupsForTiles"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _exportUnusedTiles bool& HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__exportUnusedTiles() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__exportUnusedTiles"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_exportUnusedTiles"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _applyTileColor bool& HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__applyTileColor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__applyTileColor"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_applyTileColor"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _applyTilemapOrientation bool& HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__applyTilemapOrientation() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings::dyn__applyTilemapOrientation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_applyTilemapOrientation"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputInterfaceTilemap #include "HoudiniEngineUnity/HEU_InputInterfaceTilemap.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterfaceTilemap/HoudiniEngineUnity.HEU_InputDataTilemap #include "HoudiniEngineUnity/HEU_InputInterfaceTilemap_HEU_InputDataTilemap.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterfaceTilemapSettings #include "HoudiniEngineUnity/HEU_InputInterfaceTilemapSettings.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HEU_InputData #include "HoudiniEngineUnity/HEU_InputData.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.HEU_InputInterfaceTilemapSettings settings HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings*& HoudiniEngineUnity::HEU_InputInterfaceTilemap::dyn_settings() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::dyn_settings"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "settings"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTilemap.Initialize void HoudiniEngineUnity::HEU_InputInterfaceTilemap::Initialize(HoudiniEngineUnity::HEU_InputInterfaceTilemapSettings* settings) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::Initialize"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Initialize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(settings)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, settings); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTilemap.UploadData bool HoudiniEngineUnity::HEU_InputInterfaceTilemap::UploadData(HoudiniEngineUnity::HEU_SessionBase* session, int inputNodeID, HoudiniEngineUnity::HEU_InputData* inputData) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::UploadData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UploadData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(inputNodeID), ::il2cpp_utils::ExtractType(inputData)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, inputNodeID, inputData); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTilemap.GenerateTilemapDataFromGameObject HoudiniEngineUnity::HEU_InputInterfaceTilemap::HEU_InputDataTilemap* HoudiniEngineUnity::HEU_InputInterfaceTilemap::GenerateTilemapDataFromGameObject(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::GenerateTilemapDataFromGameObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GenerateTilemapDataFromGameObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterfaceTilemap::HEU_InputDataTilemap*, false>(this, ___internal__method, inputObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTilemap.CreateInputNodeWithDataUpload bool HoudiniEngineUnity::HEU_InputInterfaceTilemap::CreateInputNodeWithDataUpload(HoudiniEngineUnity::HEU_SessionBase* session, int connectNodeID, UnityEngine::GameObject* inputObject, ByRef<int> inputNodeID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::CreateInputNodeWithDataUpload"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateInputNodeWithDataUpload", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(connectNodeID), ::il2cpp_utils::ExtractType(inputObject), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, session, connectNodeID, inputObject, byref(inputNodeID)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputInterfaceTilemap.IsThisInputObjectSupported bool HoudiniEngineUnity::HEU_InputInterfaceTilemap::IsThisInputObjectSupported(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::IsThisInputObjectSupported"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsThisInputObjectSupported", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, inputObject); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputInterfaceTilemap/HoudiniEngineUnity.HEU_InputDataTilemap #include "HoudiniEngineUnity/HEU_InputInterfaceTilemap_HEU_InputDataTilemap.hpp" // Including type: UnityEngine.Tilemaps.Tilemap #include "UnityEngine/Tilemaps/Tilemap.hpp" // Including type: UnityEngine.Transform #include "UnityEngine/Transform.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.Tilemaps.Tilemap _tilemap UnityEngine::Tilemaps::Tilemap*& HoudiniEngineUnity::HEU_InputInterfaceTilemap::HEU_InputDataTilemap::dyn__tilemap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::HEU_InputDataTilemap::dyn__tilemap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tilemap"))->offset; return *reinterpret_cast<UnityEngine::Tilemaps::Tilemap**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Transform _transform UnityEngine::Transform*& HoudiniEngineUnity::HEU_InputInterfaceTilemap::HEU_InputDataTilemap::dyn__transform() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputInterfaceTilemap::HEU_InputDataTilemap::dyn__transform"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_transform"))->offset; return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_InputMeshUtility #include "HoudiniEngineUnity/HEU_InputMeshUtility.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HAPI_PartInfo #include "HoudiniEngineUnity/HAPI_PartInfo.hpp" // Including type: UnityEngine.Mesh #include "UnityEngine/Mesh.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshPointAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, int tupleSize, ::ArrayW<UnityEngine::Vector3> data, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo, bool bConvertToHoudiniCoordinateSystem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshPointAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(tupleSize), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(partInfo), ::il2cpp_utils::ExtractType(bConvertToHoudiniCoordinateSystem)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, tupleSize, data, byref(partInfo), bConvertToHoudiniCoordinateSystem); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshPointAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, int tupleSize, ::ArrayW<float> data, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshPointAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(tupleSize), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, tupleSize, data, byref(partInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshVertexAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshVertexAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, int tupleSize, ::ArrayW<UnityEngine::Vector3> data, ::ArrayW<int> indices, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo, bool bConvertToHoudiniCoordinateSystem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshVertexAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshVertexAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(tupleSize), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(indices), ::il2cpp_utils::ExtractType(partInfo), ::il2cpp_utils::ExtractType(bConvertToHoudiniCoordinateSystem)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, tupleSize, data, indices, byref(partInfo), bConvertToHoudiniCoordinateSystem); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshVertexFloatAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshVertexFloatAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, int tupleSize, ::ArrayW<float> data, ::ArrayW<int> indices, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshVertexFloatAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshVertexFloatAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(tupleSize), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(indices), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, tupleSize, data, indices, byref(partInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.UploadMeshIntoHoudiniNode bool HoudiniEngineUnity::HEU_InputMeshUtility::UploadMeshIntoHoudiniNode(HoudiniEngineUnity::HEU_SessionBase* session, int assetNodeID, int objectID, int geoID, ByRef<UnityEngine::Mesh*> mesh) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::UploadMeshIntoHoudiniNode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "UploadMeshIntoHoudiniNode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(assetNodeID), ::il2cpp_utils::ExtractType(objectID), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(mesh)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, assetNodeID, objectID, geoID, byref(mesh)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshPointAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, int tupleSize, ::ArrayW<UnityEngine::Vector3Int> data, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshPointAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(tupleSize), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, tupleSize, data, byref(partInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshPointAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, ::ArrayW<::Il2CppString*> data, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshPointAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshPointAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, data, byref(partInfo)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputMeshUtility.SetMeshDetailAttribute bool HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshDetailAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* attrName, int tupleSize, UnityEngine::Vector3 data, ByRef<HoudiniEngineUnity::HAPI_PartInfo> partInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputMeshUtility::SetMeshDetailAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputMeshUtility", "SetMeshDetailAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(attrName), ::il2cpp_utils::ExtractType(tupleSize), ::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(partInfo)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, attrName, tupleSize, data, byref(partInfo)); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_InputUtility #include "HoudiniEngineUnity/HEU_InputUtility.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_InputInterface #include "HoudiniEngineUnity/HEU_InputInterface.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: HoudiniEngineUnity.HEU_InputObjectInfo #include "HoudiniEngineUnity/HEU_InputObjectInfo.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HEU_InputNode #include "HoudiniEngineUnity/HEU_InputNode.hpp" // Including type: HoudiniEngineUnity.HEU_HoudiniAsset #include "HoudiniEngineUnity/HEU_HoudiniAsset.hpp" // Including type: HoudiniEngineUnity.HEU_InputHDAInfo #include "HoudiniEngineUnity/HEU_InputHDAInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_InputInterface> _inputInterfaces System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputInterface*>* HoudiniEngineUnity::HEU_InputUtility::_get__inputInterfaces() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::_get__inputInterfaces"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputInterface*>*>("HoudiniEngineUnity", "HEU_InputUtility", "_inputInterfaces")); } // Autogenerated static field setter // Set static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_InputInterface> _inputInterfaces void HoudiniEngineUnity::HEU_InputUtility::_set__inputInterfaces(System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputInterface*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::_set__inputInterfaces"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_InputUtility", "_inputInterfaces", value)); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility..cctor void HoudiniEngineUnity::HEU_InputUtility::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.GetHighestPriority int HoudiniEngineUnity::HEU_InputUtility::GetHighestPriority() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::GetHighestPriority"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "GetHighestPriority", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.RegisterInputInterface void HoudiniEngineUnity::HEU_InputUtility::RegisterInputInterface(HoudiniEngineUnity::HEU_InputInterface* inputInterface) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::RegisterInputInterface"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "RegisterInputInterface", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputInterface)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, inputInterface); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.UnregisterInputInterface void HoudiniEngineUnity::HEU_InputUtility::UnregisterInputInterface(HoudiniEngineUnity::HEU_InputInterface* inputInterface) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::UnregisterInputInterface"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "UnregisterInputInterface", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputInterface)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, inputInterface); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.GetInputInterfaceByType HoudiniEngineUnity::HEU_InputInterface* HoudiniEngineUnity::HEU_InputUtility::GetInputInterfaceByType(System::Type* type) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::GetInputInterfaceByType"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "GetInputInterfaceByType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterface*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, type); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.GetInputInterface HoudiniEngineUnity::HEU_InputInterface* HoudiniEngineUnity::HEU_InputUtility::GetInputInterface(UnityEngine::GameObject* inputObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::GetInputInterface"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "GetInputInterface", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObject)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterface*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, inputObject); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.GetInputInterface HoudiniEngineUnity::HEU_InputInterface* HoudiniEngineUnity::HEU_InputUtility::GetInputInterface(HoudiniEngineUnity::HEU_InputObjectInfo* inputObjectInfo) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::GetInputInterface"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "GetInputInterface", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inputObjectInfo)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_InputInterface*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, inputObjectInfo); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.CreateInputNodeWithMultiObjects bool HoudiniEngineUnity::HEU_InputUtility::CreateInputNodeWithMultiObjects(HoudiniEngineUnity::HEU_SessionBase* session, int assetID, ByRef<int> connectMergeID, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputObjectInfo*>*> inputObjects, ByRef<System::Collections::Generic::List_1<int>*> inputObjectsConnectedAssetIDs, HoudiniEngineUnity::HEU_InputNode* inputNode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::CreateInputNodeWithMultiObjects"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "CreateInputNodeWithMultiObjects", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(assetID), ::il2cpp_utils::ExtractType(connectMergeID), ::il2cpp_utils::ExtractType(inputObjects), ::il2cpp_utils::ExtractType(inputObjectsConnectedAssetIDs), ::il2cpp_utils::ExtractType(inputNode)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, assetID, byref(connectMergeID), byref(inputObjects), byref(inputObjectsConnectedAssetIDs), inputNode); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.CreateInputNodeWithMultiAssets bool HoudiniEngineUnity::HEU_InputUtility::CreateInputNodeWithMultiAssets(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_HoudiniAsset* parentAsset, ByRef<int> connectMergeID, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_InputHDAInfo*>*> inputAssetInfos, bool bKeepWorldTransform, int mergeParentID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::CreateInputNodeWithMultiAssets"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "CreateInputNodeWithMultiAssets", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(parentAsset), ::il2cpp_utils::ExtractType(connectMergeID), ::il2cpp_utils::ExtractType(inputAssetInfos), ::il2cpp_utils::ExtractType(bKeepWorldTransform), ::il2cpp_utils::ExtractType(mergeParentID)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, parentAsset, byref(connectMergeID), byref(inputAssetInfos), bKeepWorldTransform, mergeParentID); } // Autogenerated method: HoudiniEngineUnity.HEU_InputUtility.UploadInputObjectTransform bool HoudiniEngineUnity::HEU_InputUtility::UploadInputObjectTransform(HoudiniEngineUnity::HEU_SessionBase* session, HoudiniEngineUnity::HEU_InputObjectInfo* inputObject, int inputNodeID, bool bKeepWorldTransform) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_InputUtility::UploadInputObjectTransform"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_InputUtility", "UploadInputObjectTransform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(inputObject), ::il2cpp_utils::ExtractType(inputNodeID), ::il2cpp_utils::ExtractType(bKeepWorldTransform)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, inputObject, inputNodeID, bKeepWorldTransform); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_Logger #include "HoudiniEngineUnity/HEU_Logger.hpp" // Including type: System.Exception #include "System/Exception.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_Logger.Log void HoudiniEngineUnity::HEU_Logger::Log(::Il2CppString* text) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::Log"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "Log", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogFormat void HoudiniEngineUnity::HEU_Logger::LogFormat(::Il2CppString* text, ::ArrayW<::Il2CppObject*> args) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogFormat"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogFormat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text), ::il2cpp_utils::ExtractType(args)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text, args); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogWarning void HoudiniEngineUnity::HEU_Logger::LogWarning(::Il2CppString* text) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogWarning"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogWarningFormat void HoudiniEngineUnity::HEU_Logger::LogWarningFormat(::Il2CppString* text, ::ArrayW<::Il2CppObject*> args) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogWarningFormat"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogWarningFormat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text), ::il2cpp_utils::ExtractType(args)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text, args); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogError void HoudiniEngineUnity::HEU_Logger::LogError(::Il2CppString* text) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogError"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogError", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogErrorFormat void HoudiniEngineUnity::HEU_Logger::LogErrorFormat(::Il2CppString* text, ::ArrayW<::Il2CppObject*> args) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogErrorFormat"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogErrorFormat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text), ::il2cpp_utils::ExtractType(args)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text, args); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogError void HoudiniEngineUnity::HEU_Logger::LogError(System::Exception* ex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogError"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogError", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(ex)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, ex); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogAssertion void HoudiniEngineUnity::HEU_Logger::LogAssertion(::Il2CppString* text) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogAssertion"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogAssertion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogAssertionFormat void HoudiniEngineUnity::HEU_Logger::LogAssertionFormat(::Il2CppString* text, ::ArrayW<::Il2CppObject*> args) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogAssertionFormat"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogAssertionFormat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text), ::il2cpp_utils::ExtractType(args)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text, args); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogToCookLogsIfOn void HoudiniEngineUnity::HEU_Logger::LogToCookLogsIfOn(::Il2CppString* text) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogToCookLogsIfOn"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogToCookLogsIfOn", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text); } // Autogenerated method: HoudiniEngineUnity.HEU_Logger.LogToCookLogsIfOnFormat void HoudiniEngineUnity::HEU_Logger::LogToCookLogsIfOnFormat(::Il2CppString* text, ::ArrayW<::Il2CppObject*> args) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Logger::LogToCookLogsIfOnFormat"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_Logger", "LogToCookLogsIfOnFormat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text), ::il2cpp_utils::ExtractType(args)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, text, args); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_MeshData #include "HoudiniEngineUnity/HEU_MeshData.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<System.Int32> _indices System::Collections::Generic::List_1<int>*& HoudiniEngineUnity::HEU_MeshData::dyn__indices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__indices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_indices"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<int>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<UnityEngine.Vector3> _vertices System::Collections::Generic::List_1<UnityEngine::Vector3>*& HoudiniEngineUnity::HEU_MeshData::dyn__vertices() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__vertices"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_vertices"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<UnityEngine::Vector3>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<UnityEngine.Color32> _colors System::Collections::Generic::List_1<UnityEngine::Color32>*& HoudiniEngineUnity::HEU_MeshData::dyn__colors() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__colors"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colors"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<UnityEngine::Color32>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<UnityEngine.Vector3> _normals System::Collections::Generic::List_1<UnityEngine::Vector3>*& HoudiniEngineUnity::HEU_MeshData::dyn__normals() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__normals"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normals"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<UnityEngine::Vector3>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<UnityEngine.Vector4> _tangents System::Collections::Generic::List_1<UnityEngine::Vector4>*& HoudiniEngineUnity::HEU_MeshData::dyn__tangents() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__tangents"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tangents"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<UnityEngine::Vector4>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<UnityEngine.Vector4>[] _uvs ::ArrayW<System::Collections::Generic::List_1<UnityEngine::Vector4>*>& HoudiniEngineUnity::HEU_MeshData::dyn__uvs() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__uvs"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_uvs"))->offset; return *reinterpret_cast<::ArrayW<System::Collections::Generic::List_1<UnityEngine::Vector4>*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<UnityEngine.Vector3> _triangleNormals System::Collections::Generic::List_1<UnityEngine::Vector3>*& HoudiniEngineUnity::HEU_MeshData::dyn__triangleNormals() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__triangleNormals"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_triangleNormals"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<UnityEngine::Vector3>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.Dictionary`2<System.Int32,System.Int32> _pointIndexToMeshIndexMap System::Collections::Generic::Dictionary_2<int, int>*& HoudiniEngineUnity::HEU_MeshData::dyn__pointIndexToMeshIndexMap() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__pointIndexToMeshIndexMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_pointIndexToMeshIndexMap"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<int, int>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.MeshTopology _meshTopology UnityEngine::MeshTopology& HoudiniEngineUnity::HEU_MeshData::dyn__meshTopology() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshData::dyn__meshTopology"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshTopology"))->offset; return *reinterpret_cast<UnityEngine::MeshTopology*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_MeshIndexFormat #include "HoudiniEngineUnity/HEU_MeshIndexFormat.hpp" // Including type: UnityEngine.Mesh #include "UnityEngine/Mesh.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.Rendering.IndexFormat _indexFormat UnityEngine::Rendering::IndexFormat& HoudiniEngineUnity::HEU_MeshIndexFormat::dyn__indexFormat() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshIndexFormat::dyn__indexFormat"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_indexFormat"))->offset; return *reinterpret_cast<UnityEngine::Rendering::IndexFormat*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.HEU_MeshIndexFormat.CalculateIndexFormat void HoudiniEngineUnity::HEU_MeshIndexFormat::CalculateIndexFormat(int numVertices) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshIndexFormat::CalculateIndexFormat"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CalculateIndexFormat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(numVertices)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, numVertices); } // Autogenerated method: HoudiniEngineUnity.HEU_MeshIndexFormat.SetFormatForMesh void HoudiniEngineUnity::HEU_MeshIndexFormat::SetFormatForMesh(UnityEngine::Mesh* mesh) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_MeshIndexFormat::SetFormatForMesh"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetFormatForMesh", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(mesh)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, mesh); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_PipelineType #include "HoudiniEngineUnity/HEU_PipelineType.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_PipelineType Unsupported HoudiniEngineUnity::HEU_PipelineType HoudiniEngineUnity::HEU_PipelineType::_get_Unsupported() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_get_Unsupported"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_PipelineType>("HoudiniEngineUnity", "HEU_PipelineType", "Unsupported")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_PipelineType Unsupported void HoudiniEngineUnity::HEU_PipelineType::_set_Unsupported(HoudiniEngineUnity::HEU_PipelineType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_set_Unsupported"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_PipelineType", "Unsupported", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_PipelineType BiRP HoudiniEngineUnity::HEU_PipelineType HoudiniEngineUnity::HEU_PipelineType::_get_BiRP() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_get_BiRP"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_PipelineType>("HoudiniEngineUnity", "HEU_PipelineType", "BiRP")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_PipelineType BiRP void HoudiniEngineUnity::HEU_PipelineType::_set_BiRP(HoudiniEngineUnity::HEU_PipelineType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_set_BiRP"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_PipelineType", "BiRP", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_PipelineType URP HoudiniEngineUnity::HEU_PipelineType HoudiniEngineUnity::HEU_PipelineType::_get_URP() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_get_URP"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_PipelineType>("HoudiniEngineUnity", "HEU_PipelineType", "URP")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_PipelineType URP void HoudiniEngineUnity::HEU_PipelineType::_set_URP(HoudiniEngineUnity::HEU_PipelineType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_set_URP"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_PipelineType", "URP", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_PipelineType HDRP HoudiniEngineUnity::HEU_PipelineType HoudiniEngineUnity::HEU_PipelineType::_get_HDRP() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_get_HDRP"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_PipelineType>("HoudiniEngineUnity", "HEU_PipelineType", "HDRP")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_PipelineType HDRP void HoudiniEngineUnity::HEU_PipelineType::_set_HDRP(HoudiniEngineUnity::HEU_PipelineType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::_set_HDRP"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_PipelineType", "HDRP", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_PipelineType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_PipelineType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_RenderingPipelineDefines #include "HoudiniEngineUnity/HEU_RenderingPipelineDefines.hpp" // Including type: HoudiniEngineUnity.HEU_PipelineType #include "HoudiniEngineUnity/HEU_PipelineType.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines..cctor void HoudiniEngineUnity::HEU_RenderingPipelineDefines::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines.UpdateDefines void HoudiniEngineUnity::HEU_RenderingPipelineDefines::UpdateDefines() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::UpdateDefines"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", "UpdateDefines", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines.GetPipeline HoudiniEngineUnity::HEU_PipelineType HoudiniEngineUnity::HEU_RenderingPipelineDefines::GetPipeline() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::GetPipeline"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", "GetPipeline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_PipelineType, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines.AddDefine void HoudiniEngineUnity::HEU_RenderingPipelineDefines::AddDefine(::Il2CppString* define) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::AddDefine"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", "AddDefine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(define)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, define); } // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines.RemoveDefine void HoudiniEngineUnity::HEU_RenderingPipelineDefines::RemoveDefine(::Il2CppString* define) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::RemoveDefine"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", "RemoveDefine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(define)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, define); } // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines.GetDefines System::Collections::Generic::List_1<::Il2CppString*>* HoudiniEngineUnity::HEU_RenderingPipelineDefines::GetDefines() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::GetDefines"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", "GetDefines", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<::Il2CppString*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_RenderingPipelineDefines.SetDefines void HoudiniEngineUnity::HEU_RenderingPipelineDefines::SetDefines(System::Collections::Generic::List_1<::Il2CppString*>* definesList) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_RenderingPipelineDefines::SetDefines"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_RenderingPipelineDefines", "SetDefines", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(definesList)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, definesList); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_ShelfToolData #include "HoudiniEngineUnity/HEU_ShelfToolData.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.String _name ::Il2CppString*& HoudiniEngineUnity::HEU_ShelfToolData::dyn__name() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__name"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_name"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType _toolType HoudiniEngineUnity::HEU_ShelfToolData::ToolType& HoudiniEngineUnity::HEU_ShelfToolData::dyn__toolType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__toolType"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_toolType"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HEU_ShelfToolData::ToolType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _toolTip ::Il2CppString*& HoudiniEngineUnity::HEU_ShelfToolData::dyn__toolTip() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__toolTip"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_toolTip"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _iconPath ::Il2CppString*& HoudiniEngineUnity::HEU_ShelfToolData::dyn__iconPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__iconPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_iconPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _assetPath ::Il2CppString*& HoudiniEngineUnity::HEU_ShelfToolData::dyn__assetPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__assetPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_assetPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _helpURL ::Il2CppString*& HoudiniEngineUnity::HEU_ShelfToolData::dyn__helpURL() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__helpURL"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_helpURL"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String[] _targets ::ArrayW<::Il2CppString*>& HoudiniEngineUnity::HEU_ShelfToolData::dyn__targets() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__targets"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_targets"))->offset; return *reinterpret_cast<::ArrayW<::Il2CppString*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _jsonPath ::Il2CppString*& HoudiniEngineUnity::HEU_ShelfToolData::dyn__jsonPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::dyn__jsonPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_jsonPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType #include "HoudiniEngineUnity/HEU_ShelfToolData.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType GENERATOR HoudiniEngineUnity::HEU_ShelfToolData::ToolType HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_GENERATOR() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_GENERATOR"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ShelfToolData::ToolType>("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "GENERATOR")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType GENERATOR void HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_GENERATOR(HoudiniEngineUnity::HEU_ShelfToolData::ToolType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_GENERATOR"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "GENERATOR", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType OPERATOR_SINGLE HoudiniEngineUnity::HEU_ShelfToolData::ToolType HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_OPERATOR_SINGLE() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_OPERATOR_SINGLE"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ShelfToolData::ToolType>("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "OPERATOR_SINGLE")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType OPERATOR_SINGLE void HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_OPERATOR_SINGLE(HoudiniEngineUnity::HEU_ShelfToolData::ToolType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_OPERATOR_SINGLE"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "OPERATOR_SINGLE", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType OPERATOR_MULTI HoudiniEngineUnity::HEU_ShelfToolData::ToolType HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_OPERATOR_MULTI() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_OPERATOR_MULTI"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ShelfToolData::ToolType>("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "OPERATOR_MULTI")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType OPERATOR_MULTI void HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_OPERATOR_MULTI(HoudiniEngineUnity::HEU_ShelfToolData::ToolType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_OPERATOR_MULTI"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "OPERATOR_MULTI", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType BATCH HoudiniEngineUnity::HEU_ShelfToolData::ToolType HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_BATCH() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_get_BATCH"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::HEU_ShelfToolData::ToolType>("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "BATCH")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.HEU_ShelfToolData/HoudiniEngineUnity.ToolType BATCH void HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_BATCH(HoudiniEngineUnity::HEU_ShelfToolData::ToolType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::_set_BATCH"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfToolData/ToolType", "BATCH", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::HEU_ShelfToolData::ToolType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfToolData::ToolType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_Shelf #include "HoudiniEngineUnity/HEU_Shelf.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_ShelfToolData #include "HoudiniEngineUnity/HEU_ShelfToolData.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.String _shelfName ::Il2CppString*& HoudiniEngineUnity::HEU_Shelf::dyn__shelfName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Shelf::dyn__shelfName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_shelfName"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String _shelfPath ::Il2CppString*& HoudiniEngineUnity::HEU_Shelf::dyn__shelfPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Shelf::dyn__shelfPath"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_shelfPath"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _defaultShelf bool& HoudiniEngineUnity::HEU_Shelf::dyn__defaultShelf() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Shelf::dyn__defaultShelf"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_defaultShelf"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_ShelfToolData> _tools System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ShelfToolData*>*& HoudiniEngineUnity::HEU_Shelf::dyn__tools() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_Shelf::dyn__tools"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tools"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ShelfToolData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_ShelfTools #include "HoudiniEngineUnity/HEU_ShelfTools.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_Shelf #include "HoudiniEngineUnity/HEU_Shelf.hpp" // Including type: System.String #include "System/String.hpp" // Including type: HoudiniEngineUnity.HEU_ShelfToolData #include "HoudiniEngineUnity/HEU_ShelfToolData.hpp" // Including type: UnityEngine.Vector3 #include "UnityEngine/Vector3.hpp" // Including type: UnityEngine.Quaternion #include "UnityEngine/Quaternion.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Shelf> _shelves System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Shelf*>* HoudiniEngineUnity::HEU_ShelfTools::_get__shelves() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_get__shelves"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Shelf*>*>("HoudiniEngineUnity", "HEU_ShelfTools", "_shelves")); } // Autogenerated static field setter // Set static field: static private System.Collections.Generic.List`1<HoudiniEngineUnity.HEU_Shelf> _shelves void HoudiniEngineUnity::HEU_ShelfTools::_set__shelves(System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_Shelf*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_set__shelves"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfTools", "_shelves", value)); } // Autogenerated static field getter // Get static field: static private System.Boolean _shelvesLoaded bool HoudiniEngineUnity::HEU_ShelfTools::_get__shelvesLoaded() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_get__shelvesLoaded"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<bool>("HoudiniEngineUnity", "HEU_ShelfTools", "_shelvesLoaded")); } // Autogenerated static field setter // Set static field: static private System.Boolean _shelvesLoaded void HoudiniEngineUnity::HEU_ShelfTools::_set__shelvesLoaded(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_set__shelvesLoaded"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfTools", "_shelvesLoaded", value)); } // Autogenerated static field getter // Get static field: static private System.Int32 _currentSelectedShelf int HoudiniEngineUnity::HEU_ShelfTools::_get__currentSelectedShelf() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_get__currentSelectedShelf"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("HoudiniEngineUnity", "HEU_ShelfTools", "_currentSelectedShelf")); } // Autogenerated static field setter // Set static field: static private System.Int32 _currentSelectedShelf void HoudiniEngineUnity::HEU_ShelfTools::_set__currentSelectedShelf(int value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_set__currentSelectedShelf"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfTools", "_currentSelectedShelf", value)); } // Autogenerated static field getter // Get static field: static public System.String TARGET_ALL ::Il2CppString* HoudiniEngineUnity::HEU_ShelfTools::_get_TARGET_ALL() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_get_TARGET_ALL"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Il2CppString*>("HoudiniEngineUnity", "HEU_ShelfTools", "TARGET_ALL")); } // Autogenerated static field setter // Set static field: static public System.String TARGET_ALL void HoudiniEngineUnity::HEU_ShelfTools::_set_TARGET_ALL(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_set_TARGET_ALL"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfTools", "TARGET_ALL", value)); } // Autogenerated static field getter // Get static field: static public System.String TARGET_UNITY ::Il2CppString* HoudiniEngineUnity::HEU_ShelfTools::_get_TARGET_UNITY() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_get_TARGET_UNITY"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Il2CppString*>("HoudiniEngineUnity", "HEU_ShelfTools", "TARGET_UNITY")); } // Autogenerated static field setter // Set static field: static public System.String TARGET_UNITY void HoudiniEngineUnity::HEU_ShelfTools::_set_TARGET_UNITY(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::_set_TARGET_UNITY"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "HEU_ShelfTools", "TARGET_UNITY", value)); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools..cctor void HoudiniEngineUnity::HEU_ShelfTools::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.AreShelvesLoaded bool HoudiniEngineUnity::HEU_ShelfTools::AreShelvesLoaded() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::AreShelvesLoaded"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "AreShelvesLoaded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.SetReloadShelves void HoudiniEngineUnity::HEU_ShelfTools::SetReloadShelves() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::SetReloadShelves"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "SetReloadShelves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ClearShelves void HoudiniEngineUnity::HEU_ShelfTools::ClearShelves() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ClearShelves"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ClearShelves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetNumShelves int HoudiniEngineUnity::HEU_ShelfTools::GetNumShelves() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetNumShelves"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetNumShelves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetCurrentShelfIndex int HoudiniEngineUnity::HEU_ShelfTools::GetCurrentShelfIndex() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetCurrentShelfIndex"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetCurrentShelfIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.SetCurrentShelf void HoudiniEngineUnity::HEU_ShelfTools::SetCurrentShelf(int index) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::SetCurrentShelf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "SetCurrentShelf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(index)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, index); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetShelf HoudiniEngineUnity::HEU_Shelf* HoudiniEngineUnity::HEU_ShelfTools::GetShelf(int index) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetShelf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetShelf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(index)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_Shelf*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, index); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetShelf HoudiniEngineUnity::HEU_Shelf* HoudiniEngineUnity::HEU_ShelfTools::GetShelf(::Il2CppString* shelfName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetShelf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetShelf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(shelfName)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_Shelf*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, shelfName); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetShelfStorageEntry ::Il2CppString* HoudiniEngineUnity::HEU_ShelfTools::GetShelfStorageEntry(::Il2CppString* shelfName, ::Il2CppString* shelfPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetShelfStorageEntry"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetShelfStorageEntry", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(shelfName), ::il2cpp_utils::ExtractType(shelfPath)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, shelfName, shelfPath); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetSplitShelfEntry void HoudiniEngineUnity::HEU_ShelfTools::GetSplitShelfEntry(::Il2CppString* shelfEntry, ByRef<::Il2CppString*> shelfName, ByRef<::Il2CppString*> shelfPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetSplitShelfEntry"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetSplitShelfEntry", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(shelfEntry), ::il2cpp_utils::ExtractIndependentType<::Il2CppString*&>(), ::il2cpp_utils::ExtractIndependentType<::Il2CppString*&>()}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, shelfEntry, byref(shelfName), byref(shelfPath)); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.LoadShelves void HoudiniEngineUnity::HEU_ShelfTools::LoadShelves() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::LoadShelves"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "LoadShelves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.LoadToolsFromDirectory bool HoudiniEngineUnity::HEU_ShelfTools::LoadToolsFromDirectory(::Il2CppString* folderPath, ByRef<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ShelfToolData*>*> tools) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::LoadToolsFromDirectory"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "LoadToolsFromDirectory", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(folderPath), ::il2cpp_utils::ExtractIndependentType<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_ShelfToolData*>*&>()}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, folderPath, byref(tools)); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.LoadToolFromJsonFile HoudiniEngineUnity::HEU_ShelfToolData* HoudiniEngineUnity::HEU_ShelfTools::LoadToolFromJsonFile(::Il2CppString* jsonFilePath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::LoadToolFromJsonFile"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "LoadToolFromJsonFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(jsonFilePath)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_ShelfToolData*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, jsonFilePath); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.LoadToolFromJsonString HoudiniEngineUnity::HEU_ShelfToolData* HoudiniEngineUnity::HEU_ShelfTools::LoadToolFromJsonString(::Il2CppString* json, ::Il2CppString* jsonFilePath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::LoadToolFromJsonString"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "LoadToolFromJsonString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(json), ::il2cpp_utils::ExtractType(jsonFilePath)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_ShelfToolData*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, json, jsonFilePath); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.AddShelf HoudiniEngineUnity::HEU_Shelf* HoudiniEngineUnity::HEU_ShelfTools::AddShelf(::Il2CppString* shelfName, ::Il2CppString* shelfPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::AddShelf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "AddShelf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(shelfName), ::il2cpp_utils::ExtractType(shelfPath)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HEU_Shelf*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, shelfName, shelfPath); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.RemoveShelf void HoudiniEngineUnity::HEU_ShelfTools::RemoveShelf(int shelfIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::RemoveShelf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "RemoveShelf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(shelfIndex)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, shelfIndex); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.SaveShelf void HoudiniEngineUnity::HEU_ShelfTools::SaveShelf() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::SaveShelf"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "SaveShelf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ExecuteTool void HoudiniEngineUnity::HEU_ShelfTools::ExecuteTool(int toolSlot) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ExecuteTool"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ExecuteTool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toolSlot)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, toolSlot); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ExecuteToolGenerator void HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolGenerator(::Il2CppString* toolName, ::Il2CppString* toolPath, UnityEngine::Vector3 targetPosition, UnityEngine::Quaternion targetRotation, UnityEngine::Vector3 targetScale) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolGenerator"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ExecuteToolGenerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toolName), ::il2cpp_utils::ExtractType(toolPath), ::il2cpp_utils::ExtractType(targetPosition), ::il2cpp_utils::ExtractType(targetRotation), ::il2cpp_utils::ExtractType(targetScale)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, toolName, toolPath, targetPosition, targetRotation, targetScale); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.IsValidInput bool HoudiniEngineUnity::HEU_ShelfTools::IsValidInput(UnityEngine::GameObject* gameObject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::IsValidInput"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "IsValidInput", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(gameObject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, gameObject); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ExecuteToolNoInput void HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolNoInput(::Il2CppString* toolName, ::Il2CppString* toolPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolNoInput"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ExecuteToolNoInput", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toolName), ::il2cpp_utils::ExtractType(toolPath)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, toolName, toolPath); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ExecuteToolOperatorSingle void HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolOperatorSingle(::Il2CppString* toolName, ::Il2CppString* toolPath, ::ArrayW<UnityEngine::GameObject*> inputObjects) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolOperatorSingle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ExecuteToolOperatorSingle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toolName), ::il2cpp_utils::ExtractType(toolPath), ::il2cpp_utils::ExtractType(inputObjects)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, toolName, toolPath, inputObjects); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ExecuteToolOperatorMultiple void HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolOperatorMultiple(::Il2CppString* toolName, ::Il2CppString* toolPath, ::ArrayW<UnityEngine::GameObject*> inputObjects) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolOperatorMultiple"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ExecuteToolOperatorMultiple", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toolName), ::il2cpp_utils::ExtractType(toolPath), ::il2cpp_utils::ExtractType(inputObjects)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, toolName, toolPath, inputObjects); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.ExecuteToolBatch void HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolBatch(::Il2CppString* toolName, ::Il2CppString* toolPath, ::ArrayW<UnityEngine::GameObject*> batchObjects) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::ExecuteToolBatch"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "ExecuteToolBatch", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toolName), ::il2cpp_utils::ExtractType(toolPath), ::il2cpp_utils::ExtractType(batchObjects)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, toolName, toolPath, batchObjects); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetToolResourcePath ::Il2CppString* HoudiniEngineUnity::HEU_ShelfTools::GetToolResourcePath(HoudiniEngineUnity::HEU_ShelfToolData* tool, ::Il2CppString* inPath, ::Il2CppString* ext) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetToolResourcePath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetToolResourcePath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(tool), ::il2cpp_utils::ExtractType(inPath), ::il2cpp_utils::ExtractType(ext)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, tool, inPath, ext); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetToolIconPath ::Il2CppString* HoudiniEngineUnity::HEU_ShelfTools::GetToolIconPath(HoudiniEngineUnity::HEU_ShelfToolData* tool, ::Il2CppString* inPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetToolIconPath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetToolIconPath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(tool), ::il2cpp_utils::ExtractType(inPath)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, tool, inPath); } // Autogenerated method: HoudiniEngineUnity.HEU_ShelfTools.GetToolAssetPath ::Il2CppString* HoudiniEngineUnity::HEU_ShelfTools::GetToolAssetPath(HoudiniEngineUnity::HEU_ShelfToolData* tool, ::Il2CppString* inPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_ShelfTools::GetToolAssetPath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_ShelfTools", "GetToolAssetPath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(tool), ::il2cpp_utils::ExtractType(inPath)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, tool, inPath); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType Array HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_Array() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_Array"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "Array")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType Array void HoudiniEngineUnity::JSONNodeType::_set_Array(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_Array"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "Array", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType Object HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_Object() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_Object"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "Object")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType Object void HoudiniEngineUnity::JSONNodeType::_set_Object(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_Object"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "Object", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType String HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_String() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_String"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "String")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType String void HoudiniEngineUnity::JSONNodeType::_set_String(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_String"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "String", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType Number HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_Number() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_Number"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "Number")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType Number void HoudiniEngineUnity::JSONNodeType::_set_Number(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_Number"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "Number", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType NullValue HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_NullValue() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_NullValue"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "NullValue")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType NullValue void HoudiniEngineUnity::JSONNodeType::_set_NullValue(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_NullValue"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "NullValue", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType Boolean HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_Boolean() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_Boolean"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "Boolean")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType Boolean void HoudiniEngineUnity::JSONNodeType::_set_Boolean(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_Boolean"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "Boolean", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType None HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_None() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_None"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "None")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType None void HoudiniEngineUnity::JSONNodeType::_set_None(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_None"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "None", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNodeType Custom HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNodeType::_get_Custom() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_get_Custom"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNodeType>("HoudiniEngineUnity", "JSONNodeType", "Custom")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNodeType Custom void HoudiniEngineUnity::JSONNodeType::_set_Custom(HoudiniEngineUnity::JSONNodeType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::_set_Custom"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNodeType", "Custom", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::JSONNodeType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNodeType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONTextMode Compact HoudiniEngineUnity::JSONTextMode HoudiniEngineUnity::JSONTextMode::_get_Compact() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONTextMode::_get_Compact"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONTextMode>("HoudiniEngineUnity", "JSONTextMode", "Compact")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONTextMode Compact void HoudiniEngineUnity::JSONTextMode::_set_Compact(HoudiniEngineUnity::JSONTextMode value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONTextMode::_set_Compact"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONTextMode", "Compact", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONTextMode Indent HoudiniEngineUnity::JSONTextMode HoudiniEngineUnity::JSONTextMode::_get_Indent() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONTextMode::_get_Indent"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONTextMode>("HoudiniEngineUnity", "JSONTextMode", "Indent")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONTextMode Indent void HoudiniEngineUnity::JSONTextMode::_set_Indent(HoudiniEngineUnity::JSONTextMode value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONTextMode::_set_Indent"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONTextMode", "Indent", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::JSONTextMode::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONTextMode::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode #include "HoudiniEngineUnity/JSONNode.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator #include "HoudiniEngineUnity/JSONNode_ValueEnumerator.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator #include "HoudiniEngineUnity/JSONNode_KeyEnumerator.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator #include "HoudiniEngineUnity/JSONNode_LinqEnumerator.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40 #include "HoudiniEngineUnity/JSONNode_-get_Children-d__40.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42 #include "HoudiniEngineUnity/JSONNode_-get_DeepChildren-d__42.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Collections.Generic.IEnumerable`1 #include "System/Collections/Generic/IEnumerable_1.hpp" // Including type: HoudiniEngineUnity.JSONArray #include "HoudiniEngineUnity/JSONArray.hpp" // Including type: HoudiniEngineUnity.JSONObject #include "HoudiniEngineUnity/JSONObject.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" // Including type: UnityEngine.Vector2 #include "UnityEngine/Vector2.hpp" // Including type: UnityEngine.Vector3 #include "UnityEngine/Vector3.hpp" // Including type: UnityEngine.Vector4 #include "UnityEngine/Vector4.hpp" // Including type: UnityEngine.Quaternion #include "UnityEngine/Quaternion.hpp" // Including type: UnityEngine.Rect #include "UnityEngine/Rect.hpp" // Including type: UnityEngine.RectOffset #include "UnityEngine/RectOffset.hpp" // Including type: UnityEngine.Matrix4x4 #include "UnityEngine/Matrix4x4.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public System.Boolean forceASCII bool HoudiniEngineUnity::JSONNode::_get_forceASCII() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_get_forceASCII"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<bool>("HoudiniEngineUnity", "JSONNode", "forceASCII")); } // Autogenerated static field setter // Set static field: static public System.Boolean forceASCII void HoudiniEngineUnity::JSONNode::_set_forceASCII(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_set_forceASCII"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode", "forceASCII", value)); } // Autogenerated static field getter // Get static field: static public System.Boolean longAsString bool HoudiniEngineUnity::JSONNode::_get_longAsString() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_get_longAsString"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<bool>("HoudiniEngineUnity", "JSONNode", "longAsString")); } // Autogenerated static field setter // Set static field: static public System.Boolean longAsString void HoudiniEngineUnity::JSONNode::_set_longAsString(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_set_longAsString"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode", "longAsString", value)); } // Autogenerated static field getter // Get static field: static private System.Text.StringBuilder m_EscapeBuilder System::Text::StringBuilder* HoudiniEngineUnity::JSONNode::_get_m_EscapeBuilder() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_get_m_EscapeBuilder"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Text::StringBuilder*>("HoudiniEngineUnity", "JSONNode", "m_EscapeBuilder")); } // Autogenerated static field setter // Set static field: static private System.Text.StringBuilder m_EscapeBuilder void HoudiniEngineUnity::JSONNode::_set_m_EscapeBuilder(System::Text::StringBuilder* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_set_m_EscapeBuilder"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode", "m_EscapeBuilder", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONContainerType VectorContainerType HoudiniEngineUnity::JSONContainerType HoudiniEngineUnity::JSONNode::_get_VectorContainerType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_get_VectorContainerType"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONContainerType>("HoudiniEngineUnity", "JSONNode", "VectorContainerType")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONContainerType VectorContainerType void HoudiniEngineUnity::JSONNode::_set_VectorContainerType(HoudiniEngineUnity::JSONContainerType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_set_VectorContainerType"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode", "VectorContainerType", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONContainerType QuaternionContainerType HoudiniEngineUnity::JSONContainerType HoudiniEngineUnity::JSONNode::_get_QuaternionContainerType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_get_QuaternionContainerType"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONContainerType>("HoudiniEngineUnity", "JSONNode", "QuaternionContainerType")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONContainerType QuaternionContainerType void HoudiniEngineUnity::JSONNode::_set_QuaternionContainerType(HoudiniEngineUnity::JSONContainerType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_set_QuaternionContainerType"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode", "QuaternionContainerType", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONContainerType RectContainerType HoudiniEngineUnity::JSONContainerType HoudiniEngineUnity::JSONNode::_get_RectContainerType() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_get_RectContainerType"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONContainerType>("HoudiniEngineUnity", "JSONNode", "RectContainerType")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONContainerType RectContainerType void HoudiniEngineUnity::JSONNode::_set_RectContainerType(HoudiniEngineUnity::JSONContainerType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::_set_RectContainerType"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode", "RectContainerType", value)); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNode::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::get_Item(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_Item void HoudiniEngineUnity::JSONNode::set_Item(int aIndex, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aIndex, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::get_Item(::Il2CppString* aKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aKey); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_Item void HoudiniEngineUnity::JSONNode::set_Item(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Value ::Il2CppString* HoudiniEngineUnity::JSONNode::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_Value void HoudiniEngineUnity::JSONNode::set_Value(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Count int HoudiniEngineUnity::JSONNode::get_Count() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Count"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Count", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_IsNumber bool HoudiniEngineUnity::JSONNode::get_IsNumber() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_IsNumber"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsNumber", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_IsString bool HoudiniEngineUnity::JSONNode::get_IsString() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_IsString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_IsBoolean bool HoudiniEngineUnity::JSONNode::get_IsBoolean() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_IsBoolean"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsBoolean", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_IsNull bool HoudiniEngineUnity::JSONNode::get_IsNull() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_IsNull"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsNull", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_IsArray bool HoudiniEngineUnity::JSONNode::get_IsArray() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_IsArray"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_IsObject bool HoudiniEngineUnity::JSONNode::get_IsObject() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_IsObject"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Inline bool HoudiniEngineUnity::JSONNode::get_Inline() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Inline"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Inline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_Inline void HoudiniEngineUnity::JSONNode::set_Inline(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_Inline"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Inline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Children System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONNode::get_Children() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Children"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Children", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_DeepChildren System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONNode::get_DeepChildren() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_DeepChildren"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DeepChildren", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Linq System::Collections::Generic::IEnumerable_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>>* HoudiniEngineUnity::JSONNode::get_Linq() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Linq"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Linq", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerable_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Keys HoudiniEngineUnity::JSONNode::KeyEnumerator HoudiniEngineUnity::JSONNode::get_Keys() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Keys"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Keys", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::KeyEnumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_Values HoudiniEngineUnity::JSONNode::ValueEnumerator HoudiniEngineUnity::JSONNode::get_Values() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_Values"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Values", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::ValueEnumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsDouble double HoudiniEngineUnity::JSONNode::get_AsDouble() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsDouble"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsDouble", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<double, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_AsDouble void HoudiniEngineUnity::JSONNode::set_AsDouble(double value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_AsDouble"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsDouble", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsInt int HoudiniEngineUnity::JSONNode::get_AsInt() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsInt"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsInt", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_AsInt void HoudiniEngineUnity::JSONNode::set_AsInt(int value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_AsInt"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsInt", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsFloat float HoudiniEngineUnity::JSONNode::get_AsFloat() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsFloat"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsFloat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<float, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_AsFloat void HoudiniEngineUnity::JSONNode::set_AsFloat(float value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_AsFloat"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsFloat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsBool bool HoudiniEngineUnity::JSONNode::get_AsBool() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_AsBool void HoudiniEngineUnity::JSONNode::set_AsBool(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsLong int64_t HoudiniEngineUnity::JSONNode::get_AsLong() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsLong"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsLong", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int64_t, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.set_AsLong void HoudiniEngineUnity::JSONNode::set_AsLong(int64_t value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::set_AsLong"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsLong", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsArray HoudiniEngineUnity::JSONArray* HoudiniEngineUnity::JSONNode::get_AsArray() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsArray"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONArray*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_AsObject HoudiniEngineUnity::JSONObject* HoudiniEngineUnity::JSONNode::get_AsObject() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_AsObject"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.get_EscapeBuilder System::Text::StringBuilder* HoudiniEngineUnity::JSONNode::get_EscapeBuilder() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::get_EscapeBuilder"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "get_EscapeBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Text::StringBuilder*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode..cctor void HoudiniEngineUnity::JSONNode::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Add void HoudiniEngineUnity::JSONNode::Add(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* aItem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Add"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(aItem)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, aItem); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Add void HoudiniEngineUnity::JSONNode::Add(HoudiniEngineUnity::JSONNode* aItem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Add"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aItem)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aItem); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::Remove(::Il2CppString* aKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aKey); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::Remove(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::Remove(HoudiniEngineUnity::JSONNode* aNode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aNode)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aNode); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ToString ::Il2CppString* HoudiniEngineUnity::JSONNode::ToString(int aIndent) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndent)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method, aIndent); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteToStringBuilder void HoudiniEngineUnity::JSONNode::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated method: HoudiniEngineUnity.JSONNode.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONNode::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Escape ::Il2CppString* HoudiniEngineUnity::JSONNode::Escape(::Il2CppString* aText) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Escape"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "Escape", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aText)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, aText); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ParseElement HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::ParseElement(::Il2CppString* token, bool quoted) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ParseElement"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "ParseElement", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(token), ::il2cpp_utils::ExtractType(quoted)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, token, quoted); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Parse HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::Parse(::Il2CppString* aJSON) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Parse"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "Parse", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aJSON)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, aJSON); } // Autogenerated method: HoudiniEngineUnity.JSONNode.GetContainer HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::GetContainer(HoudiniEngineUnity::JSONContainerType aType) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::GetContainer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "GetContainer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aType)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, aType); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector2 UnityEngine::Vector2 HoudiniEngineUnity::JSONNode::ReadVector2(UnityEngine::Vector2 aDefault) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector2"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDefault)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector2, false>(this, ___internal__method, aDefault); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector2 UnityEngine::Vector2 HoudiniEngineUnity::JSONNode::ReadVector2(::Il2CppString* aXName, ::Il2CppString* aYName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector2"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aXName), ::il2cpp_utils::ExtractType(aYName)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector2, false>(this, ___internal__method, aXName, aYName); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector2 UnityEngine::Vector2 HoudiniEngineUnity::JSONNode::ReadVector2() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector2"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector2, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteVector2 HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteVector2(UnityEngine::Vector2 aVec, ::Il2CppString* aXName, ::Il2CppString* aYName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteVector2"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteVector2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aVec), ::il2cpp_utils::ExtractType(aXName), ::il2cpp_utils::ExtractType(aYName)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aVec, aXName, aYName); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector3 UnityEngine::Vector3 HoudiniEngineUnity::JSONNode::ReadVector3(UnityEngine::Vector3 aDefault) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector3"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDefault)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(this, ___internal__method, aDefault); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector3 UnityEngine::Vector3 HoudiniEngineUnity::JSONNode::ReadVector3(::Il2CppString* aXName, ::Il2CppString* aYName, ::Il2CppString* aZName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector3"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aXName), ::il2cpp_utils::ExtractType(aYName), ::il2cpp_utils::ExtractType(aZName)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(this, ___internal__method, aXName, aYName, aZName); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector3 UnityEngine::Vector3 HoudiniEngineUnity::JSONNode::ReadVector3() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector3"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteVector3 HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteVector3(UnityEngine::Vector3 aVec, ::Il2CppString* aXName, ::Il2CppString* aYName, ::Il2CppString* aZName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteVector3"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteVector3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aVec), ::il2cpp_utils::ExtractType(aXName), ::il2cpp_utils::ExtractType(aYName), ::il2cpp_utils::ExtractType(aZName)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aVec, aXName, aYName, aZName); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector4 UnityEngine::Vector4 HoudiniEngineUnity::JSONNode::ReadVector4(UnityEngine::Vector4 aDefault) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector4"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector4", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDefault)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector4, false>(this, ___internal__method, aDefault); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadVector4 UnityEngine::Vector4 HoudiniEngineUnity::JSONNode::ReadVector4() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadVector4"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadVector4", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector4, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteVector4 HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteVector4(UnityEngine::Vector4 aVec) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteVector4"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteVector4", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aVec)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aVec); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadQuaternion UnityEngine::Quaternion HoudiniEngineUnity::JSONNode::ReadQuaternion(UnityEngine::Quaternion aDefault) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadQuaternion"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadQuaternion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDefault)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(this, ___internal__method, aDefault); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadQuaternion UnityEngine::Quaternion HoudiniEngineUnity::JSONNode::ReadQuaternion() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadQuaternion"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadQuaternion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteQuaternion HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteQuaternion(UnityEngine::Quaternion aRot) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteQuaternion"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteQuaternion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aRot)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aRot); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadRect UnityEngine::Rect HoudiniEngineUnity::JSONNode::ReadRect(UnityEngine::Rect aDefault) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadRect"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadRect", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDefault)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Rect, false>(this, ___internal__method, aDefault); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadRect UnityEngine::Rect HoudiniEngineUnity::JSONNode::ReadRect() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadRect"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadRect", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Rect, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteRect HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteRect(UnityEngine::Rect aRect) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteRect"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteRect", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aRect)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aRect); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadRectOffset UnityEngine::RectOffset* HoudiniEngineUnity::JSONNode::ReadRectOffset(UnityEngine::RectOffset* aDefault) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadRectOffset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadRectOffset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDefault)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::RectOffset*, false>(this, ___internal__method, aDefault); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadRectOffset UnityEngine::RectOffset* HoudiniEngineUnity::JSONNode::ReadRectOffset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadRectOffset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadRectOffset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::RectOffset*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteRectOffset HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteRectOffset(UnityEngine::RectOffset* aRect) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteRectOffset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteRectOffset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aRect)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aRect); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ReadMatrix UnityEngine::Matrix4x4 HoudiniEngineUnity::JSONNode::ReadMatrix() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ReadMatrix"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadMatrix", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Matrix4x4, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.WriteMatrix HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::WriteMatrix(UnityEngine::Matrix4x4 aMatrix) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::WriteMatrix"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteMatrix", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aMatrix)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aMatrix); } // Autogenerated method: HoudiniEngineUnity.JSONNode.ToString ::Il2CppString* HoudiniEngineUnity::JSONNode::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.Equals bool HoudiniEngineUnity::JSONNode::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.JSONNode.GetHashCode int HoudiniEngineUnity::JSONNode::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode.op_Equality bool HoudiniEngineUnity::operator ==(HoudiniEngineUnity::JSONNode* a, ::Il2CppObject& b) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::op_Equality"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "op_Equality", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(&b)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, &b); } // Autogenerated method: HoudiniEngineUnity.JSONNode.op_Inequality bool HoudiniEngineUnity::operator !=(HoudiniEngineUnity::JSONNode* a, ::Il2CppObject& b) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::op_Inequality"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNode", "op_Inequality", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(&b)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, &b); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type type HoudiniEngineUnity::JSONNode::Enumerator::Type& HoudiniEngineUnity::JSONNode::Enumerator::dyn_type() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::dyn_type"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "type"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode::Enumerator::Type*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2/System.Collections.Generic.Enumerator<System.String,HoudiniEngineUnity.JSONNode> m_Object typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator& HoudiniEngineUnity::JSONNode::Enumerator::dyn_m_Object() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::dyn_m_Object"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Object"))->offset; return *reinterpret_cast<typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1/System.Collections.Generic.Enumerator<HoudiniEngineUnity.JSONNode> m_Array typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator& HoudiniEngineUnity::JSONNode::Enumerator::dyn_m_Array() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::dyn_m_Array"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Array"))->offset; return *reinterpret_cast<typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator.get_IsValid bool HoudiniEngineUnity::JSONNode::Enumerator::get_IsValid() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::get_IsValid"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_IsValid", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator.get_Current System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*> HoudiniEngineUnity::JSONNode::Enumerator::get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::get_Current"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator..ctor HoudiniEngineUnity::JSONNode::Enumerator::Enumerator(typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator aArrayEnum) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aArrayEnum)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aArrayEnum); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator..ctor HoudiniEngineUnity::JSONNode::Enumerator::Enumerator(typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator aDictEnum) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDictEnum)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aDictEnum); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator.MoveNext bool HoudiniEngineUnity::JSONNode::Enumerator::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::MoveNext"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type None HoudiniEngineUnity::JSONNode::Enumerator::Type HoudiniEngineUnity::JSONNode::Enumerator::Type::_get_None() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::_get_None"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNode::Enumerator::Type>("HoudiniEngineUnity", "JSONNode/Enumerator/Type", "None")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type None void HoudiniEngineUnity::JSONNode::Enumerator::Type::_set_None(HoudiniEngineUnity::JSONNode::Enumerator::Type value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::_set_None"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode/Enumerator/Type", "None", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type Array HoudiniEngineUnity::JSONNode::Enumerator::Type HoudiniEngineUnity::JSONNode::Enumerator::Type::_get_Array() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::_get_Array"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNode::Enumerator::Type>("HoudiniEngineUnity", "JSONNode/Enumerator/Type", "Array")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type Array void HoudiniEngineUnity::JSONNode::Enumerator::Type::_set_Array(HoudiniEngineUnity::JSONNode::Enumerator::Type value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::_set_Array"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode/Enumerator/Type", "Array", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type Object HoudiniEngineUnity::JSONNode::Enumerator::Type HoudiniEngineUnity::JSONNode::Enumerator::Type::_get_Object() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::_get_Object"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNode::Enumerator::Type>("HoudiniEngineUnity", "JSONNode/Enumerator/Type", "Object")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator/HoudiniEngineUnity.Type Object void HoudiniEngineUnity::JSONNode::Enumerator::Type::_set_Object(HoudiniEngineUnity::JSONNode::Enumerator::Type value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::_set_Object"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNode/Enumerator/Type", "Object", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::JSONNode::Enumerator::Type::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::Enumerator::Type::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator #include "HoudiniEngineUnity/JSONNode_ValueEnumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator m_Enumerator HoudiniEngineUnity::JSONNode::Enumerator& HoudiniEngineUnity::JSONNode::ValueEnumerator::dyn_m_Enumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ValueEnumerator::dyn_m_Enumerator"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Enumerator"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator.get_Current HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::ValueEnumerator::get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ValueEnumerator::get_Current"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator..ctor HoudiniEngineUnity::JSONNode::ValueEnumerator::ValueEnumerator(typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator aArrayEnum) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ValueEnumerator::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aArrayEnum)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aArrayEnum); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator..ctor HoudiniEngineUnity::JSONNode::ValueEnumerator::ValueEnumerator(typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator aDictEnum) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ValueEnumerator::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDictEnum)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aDictEnum); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator..ctor // ABORTED elsewhere. HoudiniEngineUnity::JSONNode::ValueEnumerator::ValueEnumerator(HoudiniEngineUnity::JSONNode::Enumerator aEnumerator) // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator.MoveNext bool HoudiniEngineUnity::JSONNode::ValueEnumerator::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ValueEnumerator::MoveNext"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.ValueEnumerator.GetEnumerator HoudiniEngineUnity::JSONNode::ValueEnumerator HoudiniEngineUnity::JSONNode::ValueEnumerator::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::ValueEnumerator::GetEnumerator"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::ValueEnumerator, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator #include "HoudiniEngineUnity/JSONNode_KeyEnumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator m_Enumerator HoudiniEngineUnity::JSONNode::Enumerator& HoudiniEngineUnity::JSONNode::KeyEnumerator::dyn_m_Enumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::KeyEnumerator::dyn_m_Enumerator"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Enumerator"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator.get_Current ::Il2CppString* HoudiniEngineUnity::JSONNode::KeyEnumerator::get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::KeyEnumerator::get_Current"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator..ctor HoudiniEngineUnity::JSONNode::KeyEnumerator::KeyEnumerator(typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator aArrayEnum) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::KeyEnumerator::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aArrayEnum)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aArrayEnum); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator..ctor HoudiniEngineUnity::JSONNode::KeyEnumerator::KeyEnumerator(typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator aDictEnum) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::KeyEnumerator::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aDictEnum)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aDictEnum); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator..ctor // ABORTED elsewhere. HoudiniEngineUnity::JSONNode::KeyEnumerator::KeyEnumerator(HoudiniEngineUnity::JSONNode::Enumerator aEnumerator) // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator.MoveNext bool HoudiniEngineUnity::JSONNode::KeyEnumerator::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::KeyEnumerator::MoveNext"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.KeyEnumerator.GetEnumerator HoudiniEngineUnity::JSONNode::KeyEnumerator HoudiniEngineUnity::JSONNode::KeyEnumerator::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::KeyEnumerator::GetEnumerator"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::KeyEnumerator, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator #include "HoudiniEngineUnity/JSONNode_LinqEnumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode m_Node HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONNode::LinqEnumerator::dyn_m_Node() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::dyn_m_Node"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Node"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator m_Enumerator HoudiniEngineUnity::JSONNode::Enumerator& HoudiniEngineUnity::JSONNode::LinqEnumerator::dyn_m_Enumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::dyn_m_Enumerator"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Enumerator"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.get_Current System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*> HoudiniEngineUnity::JSONNode::LinqEnumerator::get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.System.Collections.IEnumerator.get_Current ::Il2CppObject* HoudiniEngineUnity::JSONNode::LinqEnumerator::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.MoveNext bool HoudiniEngineUnity::JSONNode::LinqEnumerator::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.Dispose void HoudiniEngineUnity::JSONNode::LinqEnumerator::Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.GetEnumerator System::Collections::Generic::IEnumerator_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>>* HoudiniEngineUnity::JSONNode::LinqEnumerator::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerator_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.Reset void HoudiniEngineUnity::JSONNode::LinqEnumerator::Reset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.LinqEnumerator.System.Collections.IEnumerable.GetEnumerator System::Collections::IEnumerator* HoudiniEngineUnity::JSONNode::LinqEnumerator::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::LinqEnumerator::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40 #include "HoudiniEngineUnity/JSONNode_-get_Children-d__40.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 <>1__state int& HoudiniEngineUnity::JSONNode::$get_Children$d__40::dyn_$$1__state() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::dyn_$$1__state"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode <>2__current HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONNode::$get_Children$d__40::dyn_$$2__current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::dyn_$$2__current"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <>l__initialThreadId int& HoudiniEngineUnity::JSONNode::$get_Children$d__40::dyn_$$l__initialThreadId() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::dyn_$$l__initialThreadId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>l__initialThreadId"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::$get_Children$d__40::System_Collections_Generic_IEnumerator$HoudiniEngineUnity_JSONNode$_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.System.Collections.IEnumerator.get_Current ::Il2CppObject* HoudiniEngineUnity::JSONNode::$get_Children$d__40::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.System.IDisposable.Dispose void HoudiniEngineUnity::JSONNode::$get_Children$d__40::System_IDisposable_Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::System.IDisposable.Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.MoveNext bool HoudiniEngineUnity::JSONNode::$get_Children$d__40::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.System.Collections.IEnumerator.Reset void HoudiniEngineUnity::JSONNode::$get_Children$d__40::System_Collections_IEnumerator_Reset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::System.Collections.IEnumerator.Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONNode::$get_Children$d__40::System_Collections_Generic_IEnumerable$HoudiniEngineUnity_JSONNode$_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_Children>d__40.System.Collections.IEnumerable.GetEnumerator System::Collections::IEnumerator* HoudiniEngineUnity::JSONNode::$get_Children$d__40::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_Children$d__40::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42 #include "HoudiniEngineUnity/JSONNode_-get_DeepChildren-d__42.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 <>1__state int& HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$1__state() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$1__state"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode <>2__current HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$2__current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$2__current"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <>l__initialThreadId int& HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$l__initialThreadId() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$l__initialThreadId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>l__initialThreadId"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.JSONNode <>4__this HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$4__this() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$4__this"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.IEnumerator`1<HoudiniEngineUnity.JSONNode> <>7__wrap1 System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>*& HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$7__wrap1() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$7__wrap1"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>7__wrap1"))->offset; return *reinterpret_cast<System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.IEnumerator`1<HoudiniEngineUnity.JSONNode> <>7__wrap2 System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>*& HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$7__wrap2() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::dyn_$$7__wrap2"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>7__wrap2"))->offset; return *reinterpret_cast<System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System_Collections_Generic_IEnumerator$HoudiniEngineUnity_JSONNode$_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.System.Collections.IEnumerator.get_Current ::Il2CppObject* HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.System.IDisposable.Dispose void HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System_IDisposable_Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System.IDisposable.Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.MoveNext bool HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.<>m__Finally1 void HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::$$m__Finally1() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::<>m__Finally1"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<>m__Finally1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.<>m__Finally2 void HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::$$m__Finally2() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::<>m__Finally2"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<>m__Finally2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.System.Collections.IEnumerator.Reset void HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System_Collections_IEnumerator_Reset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System.Collections.IEnumerator.Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System_Collections_Generic_IEnumerable$HoudiniEngineUnity_JSONNode$_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.<get_DeepChildren>d__42.System.Collections.IEnumerable.GetEnumerator System::Collections::IEnumerator* HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNode::$get_DeepChildren$d__42::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONArray #include "HoudiniEngineUnity/JSONArray.hpp" // Including type: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22 #include "HoudiniEngineUnity/JSONArray_-get_Children-d__22.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Collections.Generic.IEnumerable`1 #include "System/Collections/Generic/IEnumerable_1.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<HoudiniEngineUnity.JSONNode> m_List System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>*& HoudiniEngineUnity::JSONArray::dyn_m_List() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::dyn_m_List"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_List"))->offset; return *reinterpret_cast<System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean inline bool& HoudiniEngineUnity::JSONArray::dyn_inline() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::dyn_inline"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "inline"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_Inline bool HoudiniEngineUnity::JSONArray::get_Inline() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_Inline"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Inline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray.set_Inline void HoudiniEngineUnity::JSONArray::set_Inline(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::set_Inline"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Inline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONArray::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_IsArray bool HoudiniEngineUnity::JSONArray::get_IsArray() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_IsArray"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONArray::get_Item(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONArray.set_Item void HoudiniEngineUnity::JSONArray::set_Item(int aIndex, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aIndex, value); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONArray::get_Item(::Il2CppString* aKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aKey); } // Autogenerated method: HoudiniEngineUnity.JSONArray.set_Item void HoudiniEngineUnity::JSONArray::set_Item(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, value); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_Count int HoudiniEngineUnity::JSONArray::get_Count() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_Count"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Count", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray.get_Children System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONArray::get_Children() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::get_Children"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Children", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONArray::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray.Add void HoudiniEngineUnity::JSONArray::Add(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* aItem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::Add"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(aItem)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, aItem); } // Autogenerated method: HoudiniEngineUnity.JSONArray.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONArray::Remove(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONArray.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONArray::Remove(HoudiniEngineUnity::JSONNode* aNode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aNode)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aNode); } // Autogenerated method: HoudiniEngineUnity.JSONArray.WriteToStringBuilder void HoudiniEngineUnity::JSONArray::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22 #include "HoudiniEngineUnity/JSONArray_-get_Children-d__22.hpp" // Including type: HoudiniEngineUnity.JSONNode #include "HoudiniEngineUnity/JSONNode.hpp" // Including type: System.Collections.IEnumerator #include "System/Collections/IEnumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 <>1__state int& HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$1__state() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$1__state"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode <>2__current HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$2__current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$2__current"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <>l__initialThreadId int& HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$l__initialThreadId() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$l__initialThreadId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>l__initialThreadId"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.JSONArray <>4__this HoudiniEngineUnity::JSONArray*& HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$4__this() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$4__this"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONArray**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1/System.Collections.Generic.Enumerator<HoudiniEngineUnity.JSONNode> <>7__wrap1 typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator& HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$7__wrap1() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::dyn_$$7__wrap1"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>7__wrap1"))->offset; return *reinterpret_cast<typename System::Collections::Generic::List_1<HoudiniEngineUnity::JSONNode*>::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONArray::$get_Children$d__22::System_Collections_Generic_IEnumerator$HoudiniEngineUnity_JSONNode$_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.System.Collections.IEnumerator.get_Current ::Il2CppObject* HoudiniEngineUnity::JSONArray::$get_Children$d__22::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.System.IDisposable.Dispose void HoudiniEngineUnity::JSONArray::$get_Children$d__22::System_IDisposable_Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::System.IDisposable.Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.MoveNext bool HoudiniEngineUnity::JSONArray::$get_Children$d__22::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.<>m__Finally1 void HoudiniEngineUnity::JSONArray::$get_Children$d__22::$$m__Finally1() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::<>m__Finally1"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<>m__Finally1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.System.Collections.IEnumerator.Reset void HoudiniEngineUnity::JSONArray::$get_Children$d__22::System_Collections_IEnumerator_Reset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::System.Collections.IEnumerator.Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONArray::$get_Children$d__22::System_Collections_Generic_IEnumerable$HoudiniEngineUnity_JSONNode$_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONArray/HoudiniEngineUnity.<get_Children>d__22.System.Collections.IEnumerable.GetEnumerator System::Collections::IEnumerator* HoudiniEngineUnity::JSONArray::$get_Children$d__22::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONArray::$get_Children$d__22::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONObject #include "HoudiniEngineUnity/JSONObject.hpp" // Including type: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<>c__DisplayClass21_0 #include "HoudiniEngineUnity/JSONObject_--c__DisplayClass21_0.hpp" // Including type: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23 #include "HoudiniEngineUnity/JSONObject_-get_Children-d__23.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Collections.Generic.IEnumerable`1 #include "System/Collections/Generic/IEnumerable_1.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.String,HoudiniEngineUnity.JSONNode> m_Dict System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>*& HoudiniEngineUnity::JSONObject::dyn_m_Dict() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::dyn_m_Dict"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Dict"))->offset; return *reinterpret_cast<System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean inline bool& HoudiniEngineUnity::JSONObject::dyn_inline() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::dyn_inline"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "inline"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_Inline bool HoudiniEngineUnity::JSONObject::get_Inline() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_Inline"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Inline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject.set_Inline void HoudiniEngineUnity::JSONObject::set_Inline(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::set_Inline"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Inline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONObject::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_IsObject bool HoudiniEngineUnity::JSONObject::get_IsObject() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_IsObject"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONObject::get_Item(::Il2CppString* aKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aKey); } // Autogenerated method: HoudiniEngineUnity.JSONObject.set_Item void HoudiniEngineUnity::JSONObject::set_Item(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, value); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONObject::get_Item(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONObject.set_Item void HoudiniEngineUnity::JSONObject::set_Item(int aIndex, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aIndex, value); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_Count int HoudiniEngineUnity::JSONObject::get_Count() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_Count"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Count", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject.get_Children System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONObject::get_Children() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::get_Children"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Children", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerable_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONObject::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject.Add void HoudiniEngineUnity::JSONObject::Add(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* aItem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::Add"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(aItem)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, aItem); } // Autogenerated method: HoudiniEngineUnity.JSONObject.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONObject::Remove(::Il2CppString* aKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aKey); } // Autogenerated method: HoudiniEngineUnity.JSONObject.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONObject::Remove(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONObject.Remove HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONObject::Remove(HoudiniEngineUnity::JSONNode* aNode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::Remove"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aNode)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aNode); } // Autogenerated method: HoudiniEngineUnity.JSONObject.WriteToStringBuilder void HoudiniEngineUnity::JSONObject::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<>c__DisplayClass21_0 #include "HoudiniEngineUnity/JSONObject_--c__DisplayClass21_0.hpp" // Including type: HoudiniEngineUnity.JSONNode #include "HoudiniEngineUnity/JSONNode.hpp" // Including type: System.Collections.Generic.KeyValuePair`2 #include "System/Collections/Generic/KeyValuePair_2.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.JSONNode aNode HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONObject::$$c__DisplayClass21_0::dyn_aNode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$$c__DisplayClass21_0::dyn_aNode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "aNode"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<>c__DisplayClass21_0.<Remove>b__0 bool HoudiniEngineUnity::JSONObject::$$c__DisplayClass21_0::$Remove$b__0(System::Collections::Generic::KeyValuePair_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*> k) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$$c__DisplayClass21_0::<Remove>b__0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Remove>b__0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, k); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23 #include "HoudiniEngineUnity/JSONObject_-get_Children-d__23.hpp" // Including type: HoudiniEngineUnity.JSONNode #include "HoudiniEngineUnity/JSONNode.hpp" // Including type: System.Collections.IEnumerator #include "System/Collections/IEnumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 <>1__state int& HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$1__state() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$1__state"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode <>2__current HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$2__current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$2__current"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <>l__initialThreadId int& HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$l__initialThreadId() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$l__initialThreadId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>l__initialThreadId"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.JSONObject <>4__this HoudiniEngineUnity::JSONObject*& HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$4__this() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$4__this"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2/System.Collections.Generic.Enumerator<System.String,HoudiniEngineUnity.JSONNode> <>7__wrap1 typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator& HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$7__wrap1() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::dyn_$$7__wrap1"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>7__wrap1"))->offset; return *reinterpret_cast<typename System::Collections::Generic::Dictionary_2<::Il2CppString*, HoudiniEngineUnity::JSONNode*>::Enumerator*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONObject::$get_Children$d__23::System_Collections_Generic_IEnumerator$HoudiniEngineUnity_JSONNode$_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<HoudiniEngineUnity.JSONNode>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.System.Collections.IEnumerator.get_Current ::Il2CppObject* HoudiniEngineUnity::JSONObject::$get_Children$d__23::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.System.IDisposable.Dispose void HoudiniEngineUnity::JSONObject::$get_Children$d__23::System_IDisposable_Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::System.IDisposable.Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.MoveNext bool HoudiniEngineUnity::JSONObject::$get_Children$d__23::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.<>m__Finally1 void HoudiniEngineUnity::JSONObject::$get_Children$d__23::$$m__Finally1() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::<>m__Finally1"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<>m__Finally1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.System.Collections.IEnumerator.Reset void HoudiniEngineUnity::JSONObject::$get_Children$d__23::System_Collections_IEnumerator_Reset() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::System.Collections.IEnumerator.Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>* HoudiniEngineUnity::JSONObject::$get_Children$d__23::System_Collections_Generic_IEnumerable$HoudiniEngineUnity_JSONNode$_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerable<HoudiniEngineUnity.JSONNode>.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::IEnumerator_1<HoudiniEngineUnity::JSONNode*>*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONObject/HoudiniEngineUnity.<get_Children>d__23.System.Collections.IEnumerable.GetEnumerator System::Collections::IEnumerator* HoudiniEngineUnity::JSONObject::$get_Children$d__23::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONObject::$get_Children$d__23::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONString #include "HoudiniEngineUnity/JSONString.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.String m_Data ::Il2CppString*& HoudiniEngineUnity::JSONString::dyn_m_Data() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::dyn_m_Data"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Data"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONString.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONString::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONString.get_IsString bool HoudiniEngineUnity::JSONString::get_IsString() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::get_IsString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONString.get_Value ::Il2CppString* HoudiniEngineUnity::JSONString::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::get_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONString.set_Value void HoudiniEngineUnity::JSONString::set_Value(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::set_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONString.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONString::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONString.WriteToStringBuilder void HoudiniEngineUnity::JSONString::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated method: HoudiniEngineUnity.JSONString.Equals bool HoudiniEngineUnity::JSONString::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.JSONString.GetHashCode int HoudiniEngineUnity::JSONString::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONString::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNumber #include "HoudiniEngineUnity/JSONNumber.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Double m_Data double& HoudiniEngineUnity::JSONNumber::dyn_m_Data() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::dyn_m_Data"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Data"))->offset; return *reinterpret_cast<double*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.IsNumeric bool HoudiniEngineUnity::JSONNumber::IsNumeric(::Il2CppObject* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::IsNumeric"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNumber", "IsNumeric", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNumber::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.get_IsNumber bool HoudiniEngineUnity::JSONNumber::get_IsNumber() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::get_IsNumber"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsNumber", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.get_Value ::Il2CppString* HoudiniEngineUnity::JSONNumber::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::get_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.set_Value void HoudiniEngineUnity::JSONNumber::set_Value(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::set_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.get_AsDouble double HoudiniEngineUnity::JSONNumber::get_AsDouble() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::get_AsDouble"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsDouble", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<double, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.set_AsDouble void HoudiniEngineUnity::JSONNumber::set_AsDouble(double value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::set_AsDouble"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsDouble", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.get_AsLong int64_t HoudiniEngineUnity::JSONNumber::get_AsLong() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::get_AsLong"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsLong", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int64_t, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.set_AsLong void HoudiniEngineUnity::JSONNumber::set_AsLong(int64_t value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::set_AsLong"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsLong", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONNumber::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.WriteToStringBuilder void HoudiniEngineUnity::JSONNumber::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.Equals bool HoudiniEngineUnity::JSONNumber::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.JSONNumber.GetHashCode int HoudiniEngineUnity::JSONNumber::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNumber::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONBool #include "HoudiniEngineUnity/JSONBool.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Boolean m_Data bool& HoudiniEngineUnity::JSONBool::dyn_m_Data() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::dyn_m_Data"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Data"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONBool.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONBool::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONBool.get_IsBoolean bool HoudiniEngineUnity::JSONBool::get_IsBoolean() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::get_IsBoolean"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsBoolean", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONBool.get_Value ::Il2CppString* HoudiniEngineUnity::JSONBool::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::get_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONBool.set_Value void HoudiniEngineUnity::JSONBool::set_Value(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::set_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONBool.get_AsBool bool HoudiniEngineUnity::JSONBool::get_AsBool() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::get_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONBool.set_AsBool void HoudiniEngineUnity::JSONBool::set_AsBool(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::set_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONBool.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONBool::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONBool.WriteToStringBuilder void HoudiniEngineUnity::JSONBool::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated method: HoudiniEngineUnity.JSONBool.Equals bool HoudiniEngineUnity::JSONBool::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.JSONBool.GetHashCode int HoudiniEngineUnity::JSONBool::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONBool::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONNull #include "HoudiniEngineUnity/JSONNull.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private HoudiniEngineUnity.JSONNull m_StaticInstance HoudiniEngineUnity::JSONNull* HoudiniEngineUnity::JSONNull::_get_m_StaticInstance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::_get_m_StaticInstance"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONNull*>("HoudiniEngineUnity", "JSONNull", "m_StaticInstance")); } // Autogenerated static field setter // Set static field: static private HoudiniEngineUnity.JSONNull m_StaticInstance void HoudiniEngineUnity::JSONNull::_set_m_StaticInstance(HoudiniEngineUnity::JSONNull* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::_set_m_StaticInstance"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNull", "m_StaticInstance", value)); } // Autogenerated static field getter // Get static field: static public System.Boolean reuseSameInstance bool HoudiniEngineUnity::JSONNull::_get_reuseSameInstance() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::_get_reuseSameInstance"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<bool>("HoudiniEngineUnity", "JSONNull", "reuseSameInstance")); } // Autogenerated static field setter // Set static field: static public System.Boolean reuseSameInstance void HoudiniEngineUnity::JSONNull::_set_reuseSameInstance(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::_set_reuseSameInstance"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONNull", "reuseSameInstance", value)); } // Autogenerated method: HoudiniEngineUnity.JSONNull.CreateOrGet HoudiniEngineUnity::JSONNull* HoudiniEngineUnity::JSONNull::CreateOrGet() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::CreateOrGet"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNull", "CreateOrGet", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNull*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONNull::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.get_IsNull bool HoudiniEngineUnity::JSONNull::get_IsNull() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::get_IsNull"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsNull", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.get_Value ::Il2CppString* HoudiniEngineUnity::JSONNull::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::get_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.set_Value void HoudiniEngineUnity::JSONNull::set_Value(::Il2CppString* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::set_Value"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNull.get_AsBool bool HoudiniEngineUnity::JSONNull::get_AsBool() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::get_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.set_AsBool void HoudiniEngineUnity::JSONNull::set_AsBool(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::set_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONNull..cctor void HoudiniEngineUnity::JSONNull::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONNull", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONNull::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.Equals bool HoudiniEngineUnity::JSONNull::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.JSONNull.GetHashCode int HoudiniEngineUnity::JSONNull::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONNull.WriteToStringBuilder void HoudiniEngineUnity::JSONNull::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONNull::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSONLazyCreator #include "HoudiniEngineUnity/JSONLazyCreator.hpp" // Including type: HoudiniEngineUnity.JSONNode/HoudiniEngineUnity.Enumerator #include "HoudiniEngineUnity/JSONNode_Enumerator.hpp" // Including type: HoudiniEngineUnity.JSONNodeType #include "HoudiniEngineUnity/JSONNodeType.hpp" // Including type: HoudiniEngineUnity.JSONArray #include "HoudiniEngineUnity/JSONArray.hpp" // Including type: HoudiniEngineUnity.JSONObject #include "HoudiniEngineUnity/JSONObject.hpp" // Including type: System.Text.StringBuilder #include "System/Text/StringBuilder.hpp" // Including type: HoudiniEngineUnity.JSONTextMode #include "HoudiniEngineUnity/JSONTextMode.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private HoudiniEngineUnity.JSONNode m_Node HoudiniEngineUnity::JSONNode*& HoudiniEngineUnity::JSONLazyCreator::dyn_m_Node() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::dyn_m_Node"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Node"))->offset; return *reinterpret_cast<HoudiniEngineUnity::JSONNode**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_Key ::Il2CppString*& HoudiniEngineUnity::JSONLazyCreator::dyn_m_Key() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::dyn_m_Key"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Key"))->offset; return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_Tag HoudiniEngineUnity::JSONNodeType HoudiniEngineUnity::JSONLazyCreator::get_Tag() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_Tag"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Tag", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNodeType, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONLazyCreator::get_Item(int aIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aIndex); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_Item void HoudiniEngineUnity::JSONLazyCreator::set_Item(int aIndex, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aIndex), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aIndex, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_Item HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSONLazyCreator::get_Item(::Il2CppString* aKey) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(this, ___internal__method, aKey); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_Item void HoudiniEngineUnity::JSONLazyCreator::set_Item(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_Item"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsInt int HoudiniEngineUnity::JSONLazyCreator::get_AsInt() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsInt"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsInt", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_AsInt void HoudiniEngineUnity::JSONLazyCreator::set_AsInt(int value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_AsInt"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsInt", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsFloat float HoudiniEngineUnity::JSONLazyCreator::get_AsFloat() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsFloat"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsFloat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<float, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_AsFloat void HoudiniEngineUnity::JSONLazyCreator::set_AsFloat(float value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_AsFloat"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsFloat", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsDouble double HoudiniEngineUnity::JSONLazyCreator::get_AsDouble() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsDouble"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsDouble", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<double, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_AsDouble void HoudiniEngineUnity::JSONLazyCreator::set_AsDouble(double value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_AsDouble"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsDouble", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsLong int64_t HoudiniEngineUnity::JSONLazyCreator::get_AsLong() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsLong"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsLong", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int64_t, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_AsLong void HoudiniEngineUnity::JSONLazyCreator::set_AsLong(int64_t value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_AsLong"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsLong", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsBool bool HoudiniEngineUnity::JSONLazyCreator::get_AsBool() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.set_AsBool void HoudiniEngineUnity::JSONLazyCreator::set_AsBool(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::set_AsBool"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_AsBool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, value); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsArray HoudiniEngineUnity::JSONArray* HoudiniEngineUnity::JSONLazyCreator::get_AsArray() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsArray"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONArray*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.get_AsObject HoudiniEngineUnity::JSONObject* HoudiniEngineUnity::JSONLazyCreator::get_AsObject() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::get_AsObject"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_AsObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONObject*, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.GetEnumerator HoudiniEngineUnity::JSONNode::Enumerator HoudiniEngineUnity::JSONLazyCreator::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode::Enumerator, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.Add void HoudiniEngineUnity::JSONLazyCreator::Add(HoudiniEngineUnity::JSONNode* aItem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::Add"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aItem)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aItem); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.Add void HoudiniEngineUnity::JSONLazyCreator::Add(::Il2CppString* aKey, HoudiniEngineUnity::JSONNode* aItem) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::Add"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aKey), ::il2cpp_utils::ExtractType(aItem)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aKey, aItem); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.Equals bool HoudiniEngineUnity::JSONLazyCreator::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, obj); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.GetHashCode int HoudiniEngineUnity::JSONLazyCreator::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<int, false>(this, ___internal__method); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.WriteToStringBuilder void HoudiniEngineUnity::JSONLazyCreator::WriteToStringBuilder(System::Text::StringBuilder* aSB, int aIndent, int aIndentInc, HoudiniEngineUnity::JSONTextMode aMode) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::WriteToStringBuilder"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WriteToStringBuilder", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aSB), ::il2cpp_utils::ExtractType(aIndent), ::il2cpp_utils::ExtractType(aIndentInc), ::il2cpp_utils::ExtractType(aMode)}))); ::il2cpp_utils::RunMethodThrow<void, false>(this, ___internal__method, aSB, aIndent, aIndentInc, aMode); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.op_Equality bool HoudiniEngineUnity::operator ==(HoudiniEngineUnity::JSONLazyCreator* a, ::Il2CppObject& b) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::op_Equality"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONLazyCreator", "op_Equality", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(&b)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, &b); } // Autogenerated method: HoudiniEngineUnity.JSONLazyCreator.op_Inequality bool HoudiniEngineUnity::operator !=(HoudiniEngineUnity::JSONLazyCreator* a, ::Il2CppObject& b) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONLazyCreator::op_Inequality"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSONLazyCreator", "op_Inequality", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(&b)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, &b); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.JSON #include "HoudiniEngineUnity/JSON.hpp" // Including type: HoudiniEngineUnity.JSONNode #include "HoudiniEngineUnity/JSONNode.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.JSON.Parse HoudiniEngineUnity::JSONNode* HoudiniEngineUnity::JSON::Parse(::Il2CppString* aJSON) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSON::Parse"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "JSON", "Parse", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(aJSON)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::JSONNode*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, aJSON); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.JSONContainerType #include "HoudiniEngineUnity/JSONContainerType.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONContainerType Array HoudiniEngineUnity::JSONContainerType HoudiniEngineUnity::JSONContainerType::_get_Array() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONContainerType::_get_Array"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONContainerType>("HoudiniEngineUnity", "JSONContainerType", "Array")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONContainerType Array void HoudiniEngineUnity::JSONContainerType::_set_Array(HoudiniEngineUnity::JSONContainerType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONContainerType::_set_Array"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONContainerType", "Array", value)); } // Autogenerated static field getter // Get static field: static public HoudiniEngineUnity.JSONContainerType Object HoudiniEngineUnity::JSONContainerType HoudiniEngineUnity::JSONContainerType::_get_Object() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONContainerType::_get_Object"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<HoudiniEngineUnity::JSONContainerType>("HoudiniEngineUnity", "JSONContainerType", "Object")); } // Autogenerated static field setter // Set static field: static public HoudiniEngineUnity.JSONContainerType Object void HoudiniEngineUnity::JSONContainerType::_set_Object(HoudiniEngineUnity::JSONContainerType value) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONContainerType::_set_Object"); THROW_UNLESS(il2cpp_utils::SetFieldValue("HoudiniEngineUnity", "JSONContainerType", "Object", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& HoudiniEngineUnity::JSONContainerType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::JSONContainerType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_TerrainUtility #include "HoudiniEngineUnity/HEU_TerrainUtility.hpp" // Including type: HoudiniEngineUnity.HEU_SessionBase #include "HoudiniEngineUnity/HEU_SessionBase.hpp" // Including type: HoudiniEngineUnity.HAPI_VolumeInfo #include "HoudiniEngineUnity/HAPI_VolumeInfo.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.TerrainData #include "UnityEngine/TerrainData.hpp" // Including type: UnityEngine.Vector3 #include "UnityEngine/Vector3.hpp" // Including type: UnityEngine.Terrain #include "UnityEngine/Terrain.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: HoudiniEngineUnity.HEU_TreePrototypeInfo #include "HoudiniEngineUnity/HEU_TreePrototypeInfo.hpp" // Including type: HoudiniEngineUnity.HEU_VolumeScatterTrees #include "HoudiniEngineUnity/HEU_VolumeScatterTrees.hpp" // Including type: HoudiniEngineUnity.HEU_DetailPrototype #include "HoudiniEngineUnity/HEU_DetailPrototype.hpp" // Including type: HoudiniEngineUnity.HEU_DetailProperties #include "HoudiniEngineUnity/HEU_DetailProperties.hpp" // Including type: UnityEngine.TerrainLayer #include "UnityEngine/TerrainLayer.hpp" // Including type: HoudiniEngineUnity.HFLayerType #include "HoudiniEngineUnity/HFLayerType.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GenerateTerrainFromVolume bool HoudiniEngineUnity::HEU_TerrainUtility::GenerateTerrainFromVolume(HoudiniEngineUnity::HEU_SessionBase* session, ByRef<HoudiniEngineUnity::HAPI_VolumeInfo> volumeInfo, int geoID, int partID, UnityEngine::GameObject* gameObject, ByRef<UnityEngine::TerrainData*> terrainData, ByRef<UnityEngine::Vector3> volumePositionOffset, ByRef<UnityEngine::Terrain*> terrain, ::Il2CppString* bakedMaterialPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GenerateTerrainFromVolume"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GenerateTerrainFromVolume", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(volumeInfo), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(gameObject), ::il2cpp_utils::ExtractType(terrainData), ::il2cpp_utils::ExtractIndependentType<UnityEngine::Vector3&>(), ::il2cpp_utils::ExtractType(terrain), ::il2cpp_utils::ExtractType(bakedMaterialPath)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, byref(volumeInfo), geoID, partID, gameObject, byref(terrainData), byref(volumePositionOffset), byref(terrain), bakedMaterialPath); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.SetTerrainMaterial void HoudiniEngineUnity::HEU_TerrainUtility::SetTerrainMaterial(UnityEngine::Terrain* terrain, ::Il2CppString* specifiedMaterialName, ::Il2CppString* bakedMaterialPath) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::SetTerrainMaterial"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "SetTerrainMaterial", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(terrain), ::il2cpp_utils::ExtractType(specifiedMaterialName), ::il2cpp_utils::ExtractType(bakedMaterialPath)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, terrain, specifiedMaterialName, bakedMaterialPath); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetDefaultTerrainShaderName ::Il2CppString* HoudiniEngineUnity::HEU_TerrainUtility::GetDefaultTerrainShaderName() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetDefaultTerrainShaderName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetDefaultTerrainShaderName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetDefaultTerrainMaterialPath ::Il2CppString* HoudiniEngineUnity::HEU_TerrainUtility::GetDefaultTerrainMaterialPath() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetDefaultTerrainMaterialPath"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetDefaultTerrainMaterialPath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetNormalizedHeightmapFromPartWithMinMax ::ArrayW<float> HoudiniEngineUnity::HEU_TerrainUtility::GetNormalizedHeightmapFromPartWithMinMax(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, int heightMapWidth, int heightMapHeight, ByRef<float> minHeight, ByRef<float> maxHeight, ByRef<float> heightRange, bool bUseHeightRangeOverride) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetNormalizedHeightmapFromPartWithMinMax"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetNormalizedHeightmapFromPartWithMinMax", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(heightMapWidth), ::il2cpp_utils::ExtractType(heightMapHeight), ::il2cpp_utils::ExtractType(minHeight), ::il2cpp_utils::ExtractType(maxHeight), ::il2cpp_utils::ExtractType(heightRange), ::il2cpp_utils::ExtractType(bUseHeightRangeOverride)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<float>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, heightMapWidth, heightMapHeight, byref(minHeight), byref(maxHeight), byref(heightRange), bUseHeightRangeOverride); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetDetailMapFromPart ::ArrayW<int> HoudiniEngineUnity::HEU_TerrainUtility::GetDetailMapFromPart(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ByRef<int> detailResolution) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetDetailMapFromPart"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetDetailMapFromPart", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractIndependentType<int&>()}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<int>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, byref(detailResolution)); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetHeightmapFromPart bool HoudiniEngineUnity::HEU_TerrainUtility::GetHeightmapFromPart(HoudiniEngineUnity::HEU_SessionBase* session, int xLength, int yLength, int geoID, int partID, ByRef<::ArrayW<float>> heightValues, ByRef<float> minHeight, ByRef<float> maxHeight) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetHeightmapFromPart"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetHeightmapFromPart", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(xLength), ::il2cpp_utils::ExtractType(yLength), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(heightValues), ::il2cpp_utils::ExtractType(minHeight), ::il2cpp_utils::ExtractType(maxHeight)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, xLength, yLength, geoID, partID, byref(heightValues), byref(minHeight), byref(maxHeight)); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.ConvertHeightMapHoudiniToUnity ::ArrayW<float> HoudiniEngineUnity::HEU_TerrainUtility::ConvertHeightMapHoudiniToUnity(int heightMapWidth, int heightMapHeight, ::ArrayW<float> heightValues) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::ConvertHeightMapHoudiniToUnity"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "ConvertHeightMapHoudiniToUnity", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(heightMapWidth), ::il2cpp_utils::ExtractType(heightMapHeight), ::il2cpp_utils::ExtractType(heightValues)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<float>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, heightMapWidth, heightMapHeight, heightValues); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.ConvertHeightFieldToAlphaMap ::ArrayW<float> HoudiniEngineUnity::HEU_TerrainUtility::ConvertHeightFieldToAlphaMap(int heightMapWidth, int heightMapHeight, System::Collections::Generic::List_1<::ArrayW<float>>* heightFields) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::ConvertHeightFieldToAlphaMap"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "ConvertHeightFieldToAlphaMap", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(heightMapWidth), ::il2cpp_utils::ExtractType(heightMapHeight), ::il2cpp_utils::ExtractType(heightFields)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<float>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, heightMapWidth, heightMapHeight, heightFields); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.AppendConvertedHeightFieldToAlphaMap ::ArrayW<float> HoudiniEngineUnity::HEU_TerrainUtility::AppendConvertedHeightFieldToAlphaMap(int heightMapWidth, int heightMapHeight, ::ArrayW<float> existingAlphaMaps, System::Collections::Generic::List_1<::ArrayW<float>>* heightFields, ::ArrayW<float> strengths, System::Collections::Generic::List_1<int>* alphaMapIndices) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::AppendConvertedHeightFieldToAlphaMap"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "AppendConvertedHeightFieldToAlphaMap", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(heightMapWidth), ::il2cpp_utils::ExtractType(heightMapHeight), ::il2cpp_utils::ExtractType(existingAlphaMaps), ::il2cpp_utils::ExtractType(heightFields), ::il2cpp_utils::ExtractType(strengths), ::il2cpp_utils::ExtractType(alphaMapIndices)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<float>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, heightMapWidth, heightMapHeight, existingAlphaMaps, heightFields, strengths, alphaMapIndices); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetVolumePositionOffset UnityEngine::Vector3 HoudiniEngineUnity::HEU_TerrainUtility::GetVolumePositionOffset(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, UnityEngine::Vector3 volumePosition, float terrainSizeX, float heightMapSize, int mapWidth, int mapHeight, float minHeight) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetVolumePositionOffset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetVolumePositionOffset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(volumePosition), ::il2cpp_utils::ExtractType(terrainSizeX), ::il2cpp_utils::ExtractType(heightMapSize), ::il2cpp_utils::ExtractType(mapWidth), ::il2cpp_utils::ExtractType(mapHeight), ::il2cpp_utils::ExtractType(minHeight)}))); return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, volumePosition, terrainSizeX, heightMapSize, mapWidth, mapHeight, minHeight); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetTreePrototypeInfosFromPart System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_TreePrototypeInfo*>* HoudiniEngineUnity::HEU_TerrainUtility::GetTreePrototypeInfosFromPart(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetTreePrototypeInfosFromPart"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetTreePrototypeInfosFromPart", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID)}))); return ::il2cpp_utils::RunMethodThrow<System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_TreePrototypeInfo*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.PopulateScatterTrees void HoudiniEngineUnity::HEU_TerrainUtility::PopulateScatterTrees(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, int pointCount, ByRef<HoudiniEngineUnity::HEU_VolumeScatterTrees*> scatterTrees, bool throwWarningIfNoTileAttribute) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::PopulateScatterTrees"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "PopulateScatterTrees", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(pointCount), ::il2cpp_utils::ExtractType(scatterTrees), ::il2cpp_utils::ExtractType(throwWarningIfNoTileAttribute)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, pointCount, byref(scatterTrees), throwWarningIfNoTileAttribute); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.ApplyScatterTrees void HoudiniEngineUnity::HEU_TerrainUtility::ApplyScatterTrees(UnityEngine::TerrainData* terrainData, HoudiniEngineUnity::HEU_VolumeScatterTrees* scatterTrees, int tileIndex) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::ApplyScatterTrees"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "ApplyScatterTrees", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(terrainData), ::il2cpp_utils::ExtractType(scatterTrees), ::il2cpp_utils::ExtractType(tileIndex)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, terrainData, scatterTrees, tileIndex); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.PopulateDetailPrototype void HoudiniEngineUnity::HEU_TerrainUtility::PopulateDetailPrototype(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ByRef<HoudiniEngineUnity::HEU_DetailPrototype*> detailPrototype) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::PopulateDetailPrototype"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "PopulateDetailPrototype", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(detailPrototype)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, byref(detailPrototype)); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.PopulateDetailProperties void HoudiniEngineUnity::HEU_TerrainUtility::PopulateDetailProperties(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ByRef<HoudiniEngineUnity::HEU_DetailProperties*> detailProperties) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::PopulateDetailProperties"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "PopulateDetailProperties", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(detailProperties)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, byref(detailProperties)); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.ApplyDetailLayers void HoudiniEngineUnity::HEU_TerrainUtility::ApplyDetailLayers(UnityEngine::Terrain* terrain, UnityEngine::TerrainData* terrainData, HoudiniEngineUnity::HEU_DetailProperties* detailProperties, System::Collections::Generic::List_1<HoudiniEngineUnity::HEU_DetailPrototype*>* heuDetailPrototypes, System::Collections::Generic::List_1<::ArrayW<int>>* convertedDetailMaps) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::ApplyDetailLayers"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "ApplyDetailLayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(terrain), ::il2cpp_utils::ExtractType(terrainData), ::il2cpp_utils::ExtractType(detailProperties), ::il2cpp_utils::ExtractType(heuDetailPrototypes), ::il2cpp_utils::ExtractType(convertedDetailMaps)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, terrain, terrainData, detailProperties, heuDetailPrototypes, convertedDetailMaps); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetTerrainLayerIndexByName int HoudiniEngineUnity::HEU_TerrainUtility::GetTerrainLayerIndexByName(::Il2CppString* layerName, ::ArrayW<UnityEngine::TerrainLayer*> terrainLayers) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetTerrainLayerIndexByName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetTerrainLayerIndexByName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerName), ::il2cpp_utils::ExtractType(terrainLayers)}))); return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, layerName, terrainLayers); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetTerrainLayerIndex int HoudiniEngineUnity::HEU_TerrainUtility::GetTerrainLayerIndex(UnityEngine::TerrainLayer* layer, ::ArrayW<UnityEngine::TerrainLayer*> terrainLayers) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetTerrainLayerIndex"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetTerrainLayerIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layer), ::il2cpp_utils::ExtractType(terrainLayers)}))); return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, layer, terrainLayers); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.VolumeLayerHasAttributes bool HoudiniEngineUnity::HEU_TerrainUtility::VolumeLayerHasAttributes(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::VolumeLayerHasAttributes"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "VolumeLayerHasAttributes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetHeightfieldLayerType HoudiniEngineUnity::HFLayerType HoudiniEngineUnity::HEU_TerrainUtility::GetHeightfieldLayerType(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID, ::Il2CppString* volumeName) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetHeightfieldLayerType"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetHeightfieldLayerType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID), ::il2cpp_utils::ExtractType(volumeName)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::HFLayerType, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID, volumeName); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetHeightRangeFromHeightfield float HoudiniEngineUnity::HEU_TerrainUtility::GetHeightRangeFromHeightfield(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetHeightRangeFromHeightfield"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetHeightRangeFromHeightfield", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID)}))); return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.GetTerrainDataExportPathFromHeightfieldAttribute ::Il2CppString* HoudiniEngineUnity::HEU_TerrainUtility::GetTerrainDataExportPathFromHeightfieldAttribute(HoudiniEngineUnity::HEU_SessionBase* session, int geoID, int partID) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::GetTerrainDataExportPathFromHeightfieldAttribute"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "GetTerrainDataExportPathFromHeightfieldAttribute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(session), ::il2cpp_utils::ExtractType(geoID), ::il2cpp_utils::ExtractType(partID)}))); return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, session, geoID, partID); } // Autogenerated method: HoudiniEngineUnity.HEU_TerrainUtility.ResampleData ::ArrayW<float> HoudiniEngineUnity::HEU_TerrainUtility::ResampleData(::ArrayW<float> data, int oldWidth, int oldHeight, int newWidth, int newHeight) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TerrainUtility::ResampleData"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TerrainUtility", "ResampleData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(oldWidth), ::il2cpp_utils::ExtractType(oldHeight), ::il2cpp_utils::ExtractType(newWidth), ::il2cpp_utils::ExtractType(newHeight)}))); return ::il2cpp_utils::RunMethodThrow<::ArrayW<float>, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, data, oldWidth, oldHeight, newWidth, newHeight); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HoudiniEngineUnity.HEU_TestHelpers #include "HoudiniEngineUnity/HEU_TestHelpers.hpp" // Including type: HoudiniEngineUnity.HEU_TestHelpers/HoudiniEngineUnity.RequireStruct`1 #include "HoudiniEngineUnity/HEU_TestHelpers_RequireStruct_1.hpp" // Including type: HoudiniEngineUnity.HEU_TestHelpers/HoudiniEngineUnity.RequireClass`1 #include "HoudiniEngineUnity/HEU_TestHelpers_RequireClass_1.hpp" // Including type: System.ValueType #include "System/ValueType.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: HoudiniEngineUnity.IEquivable`1 #include "HoudiniEngineUnity/IEquivable_1.hpp" // Including type: HoudiniEngineUnity.IEquivableWrapperClass`1 #include "HoudiniEngineUnity/IEquivableWrapperClass_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.AssertTrueLogEquivalent bool HoudiniEngineUnity::HEU_TestHelpers::AssertTrueLogEquivalent(UnityEngine::GameObject* a, UnityEngine::GameObject* b, ByRef<bool> result, ::Il2CppString* header, ::Il2CppString* subject, ::Il2CppString* optional1, ::Il2CppString* optional2, ::Il2CppString* optional3) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::AssertTrueLogEquivalent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "AssertTrueLogEquivalent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(result), ::il2cpp_utils::ExtractType(header), ::il2cpp_utils::ExtractType(subject), ::il2cpp_utils::ExtractType(optional1), ::il2cpp_utils::ExtractType(optional2), ::il2cpp_utils::ExtractType(optional3)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, b, byref(result), header, subject, optional1, optional2, optional3); } // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.AssertTrueLogEquivalent bool HoudiniEngineUnity::HEU_TestHelpers::AssertTrueLogEquivalent(::Il2CppString* a, ::Il2CppString* b, ByRef<bool> result, ::Il2CppString* header, ::Il2CppString* subject, ::Il2CppString* optional1, ::Il2CppString* optional2, ::Il2CppString* optional3) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::AssertTrueLogEquivalent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "AssertTrueLogEquivalent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(result), ::il2cpp_utils::ExtractType(header), ::il2cpp_utils::ExtractType(subject), ::il2cpp_utils::ExtractType(optional1), ::il2cpp_utils::ExtractType(optional2), ::il2cpp_utils::ExtractType(optional3)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, b, byref(result), header, subject, optional1, optional2, optional3); } // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.AssertTrueLogEquivalent bool HoudiniEngineUnity::HEU_TestHelpers::AssertTrueLogEquivalent(::ArrayW<::Il2CppString*> a, ::ArrayW<::Il2CppString*> b, ByRef<bool> result, ::Il2CppString* header, ::Il2CppString* subject, ::Il2CppString* optional1, ::Il2CppString* optional2, ::Il2CppString* optional3) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::AssertTrueLogEquivalent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "AssertTrueLogEquivalent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(result), ::il2cpp_utils::ExtractType(header), ::il2cpp_utils::ExtractType(subject), ::il2cpp_utils::ExtractType(optional1), ::il2cpp_utils::ExtractType(optional2), ::il2cpp_utils::ExtractType(optional3)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, b, byref(result), header, subject, optional1, optional2, optional3); } // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.PrintTestLogAndSetResult void HoudiniEngineUnity::HEU_TestHelpers::PrintTestLogAndSetResult(bool expression, ByRef<bool> result, ::Il2CppString* header, ::Il2CppString* subject, ::Il2CppString* optional1, ::Il2CppString* optional2, ::Il2CppString* optional3) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::PrintTestLogAndSetResult"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "PrintTestLogAndSetResult", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(expression), ::il2cpp_utils::ExtractType(result), ::il2cpp_utils::ExtractType(header), ::il2cpp_utils::ExtractType(subject), ::il2cpp_utils::ExtractType(optional1), ::il2cpp_utils::ExtractType(optional2), ::il2cpp_utils::ExtractType(optional3)}))); ::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, expression, byref(result), header, subject, optional1, optional2, optional3); } // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.ShouldBeTested bool HoudiniEngineUnity::HEU_TestHelpers::ShouldBeTested(UnityEngine::GameObject* a, UnityEngine::GameObject* b, ByRef<bool> bResult, ::Il2CppString* header, ::Il2CppString* subject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::ShouldBeTested"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "ShouldBeTested", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(bResult), ::il2cpp_utils::ExtractType(header), ::il2cpp_utils::ExtractType(subject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, b, byref(bResult), header, subject); } // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.ShouldBeTested bool HoudiniEngineUnity::HEU_TestHelpers::ShouldBeTested(::Il2CppString* a, ::Il2CppString* b, ByRef<bool> bResult, ::Il2CppString* header, ::Il2CppString* subject) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::ShouldBeTested"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "ShouldBeTested", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(bResult), ::il2cpp_utils::ExtractType(header), ::il2cpp_utils::ExtractType(subject)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, b, byref(bResult), header, subject); } // Autogenerated method: HoudiniEngineUnity.HEU_TestHelpers.TestOutputObjectEquivalence bool HoudiniEngineUnity::HEU_TestHelpers::TestOutputObjectEquivalence(UnityEngine::GameObject* a, UnityEngine::GameObject* b) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::HEU_TestHelpers::TestOutputObjectEquivalence"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "HEU_TestHelpers", "TestOutputObjectEquivalence", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, a, b); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_AssetInfo #include "HoudiniEngineUnity/Test_HAPI_AssetInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_AssetInfo self HoudiniEngineUnity::HAPI_AssetInfo& HoudiniEngineUnity::Test_HAPI_AssetInfo::dyn_self() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_AssetInfo::dyn_self"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "self"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_AssetInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.Test_HAPI_AssetInfo.IsEquivalentTo bool HoudiniEngineUnity::Test_HAPI_AssetInfo::IsEquivalentTo(HoudiniEngineUnity::Test_HAPI_AssetInfo* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_AssetInfo::IsEquivalentTo"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsEquivalentTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, other); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_AssetInfo_Extensions #include "HoudiniEngineUnity/Test_HAPI_AssetInfo_Extensions.hpp" // Including type: HoudiniEngineUnity.Test_HAPI_AssetInfo #include "HoudiniEngineUnity/Test_HAPI_AssetInfo.hpp" // Including type: HoudiniEngineUnity.HAPI_AssetInfo #include "HoudiniEngineUnity/HAPI_AssetInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.Test_HAPI_AssetInfo_Extensions.ToTestObject HoudiniEngineUnity::Test_HAPI_AssetInfo* HoudiniEngineUnity::Test_HAPI_AssetInfo_Extensions::ToTestObject(HoudiniEngineUnity::HAPI_AssetInfo self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_AssetInfo_Extensions::ToTestObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "Test_HAPI_AssetInfo_Extensions", "ToTestObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::Test_HAPI_AssetInfo*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_NodeInfo #include "HoudiniEngineUnity/Test_HAPI_NodeInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_NodeInfo self HoudiniEngineUnity::HAPI_NodeInfo& HoudiniEngineUnity::Test_HAPI_NodeInfo::dyn_self() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_NodeInfo::dyn_self"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "self"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_NodeInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.Test_HAPI_NodeInfo.IsEquivalentTo bool HoudiniEngineUnity::Test_HAPI_NodeInfo::IsEquivalentTo(HoudiniEngineUnity::Test_HAPI_NodeInfo* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_NodeInfo::IsEquivalentTo"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsEquivalentTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, other); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_NodeInfo_Extensions #include "HoudiniEngineUnity/Test_HAPI_NodeInfo_Extensions.hpp" // Including type: HoudiniEngineUnity.Test_HAPI_NodeInfo #include "HoudiniEngineUnity/Test_HAPI_NodeInfo.hpp" // Including type: HoudiniEngineUnity.HAPI_NodeInfo #include "HoudiniEngineUnity/HAPI_NodeInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.Test_HAPI_NodeInfo_Extensions.ToTestObject HoudiniEngineUnity::Test_HAPI_NodeInfo* HoudiniEngineUnity::Test_HAPI_NodeInfo_Extensions::ToTestObject(HoudiniEngineUnity::HAPI_NodeInfo self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_NodeInfo_Extensions::ToTestObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "Test_HAPI_NodeInfo_Extensions", "ToTestObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::Test_HAPI_NodeInfo*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_ObjectInfo #include "HoudiniEngineUnity/Test_HAPI_ObjectInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_ObjectInfo self HoudiniEngineUnity::HAPI_ObjectInfo& HoudiniEngineUnity::Test_HAPI_ObjectInfo::dyn_self() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_ObjectInfo::dyn_self"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "self"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_ObjectInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.Test_HAPI_ObjectInfo.IsEquivalentTo bool HoudiniEngineUnity::Test_HAPI_ObjectInfo::IsEquivalentTo(HoudiniEngineUnity::Test_HAPI_ObjectInfo* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_ObjectInfo::IsEquivalentTo"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsEquivalentTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, other); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_ObjectInfo_Extensions #include "HoudiniEngineUnity/Test_HAPI_ObjectInfo_Extensions.hpp" // Including type: HoudiniEngineUnity.Test_HAPI_ObjectInfo #include "HoudiniEngineUnity/Test_HAPI_ObjectInfo.hpp" // Including type: HoudiniEngineUnity.HAPI_ObjectInfo #include "HoudiniEngineUnity/HAPI_ObjectInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.Test_HAPI_ObjectInfo_Extensions.ToTestObject HoudiniEngineUnity::Test_HAPI_ObjectInfo* HoudiniEngineUnity::Test_HAPI_ObjectInfo_Extensions::ToTestObject(HoudiniEngineUnity::HAPI_ObjectInfo self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_ObjectInfo_Extensions::ToTestObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "Test_HAPI_ObjectInfo_Extensions", "ToTestObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::Test_HAPI_ObjectInfo*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_Transform #include "HoudiniEngineUnity/Test_HAPI_Transform.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_Transform self HoudiniEngineUnity::HAPI_Transform& HoudiniEngineUnity::Test_HAPI_Transform::dyn_self() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_Transform::dyn_self"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "self"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_Transform*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.Test_HAPI_Transform.IsEquivalentTo bool HoudiniEngineUnity::Test_HAPI_Transform::IsEquivalentTo(HoudiniEngineUnity::Test_HAPI_Transform* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_Transform::IsEquivalentTo"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsEquivalentTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, other); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_Transform_Extensions #include "HoudiniEngineUnity/Test_HAPI_Transform_Extensions.hpp" // Including type: HoudiniEngineUnity.Test_HAPI_Transform #include "HoudiniEngineUnity/Test_HAPI_Transform.hpp" // Including type: HoudiniEngineUnity.HAPI_Transform #include "HoudiniEngineUnity/HAPI_Transform.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.Test_HAPI_Transform_Extensions.ToTestObject HoudiniEngineUnity::Test_HAPI_Transform* HoudiniEngineUnity::Test_HAPI_Transform_Extensions::ToTestObject(HoudiniEngineUnity::HAPI_Transform self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_Transform_Extensions::ToTestObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "Test_HAPI_Transform_Extensions", "ToTestObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::Test_HAPI_Transform*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_GeoInfo #include "HoudiniEngineUnity/Test_HAPI_GeoInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public HoudiniEngineUnity.HAPI_GeoInfo self HoudiniEngineUnity::HAPI_GeoInfo& HoudiniEngineUnity::Test_HAPI_GeoInfo::dyn_self() { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_GeoInfo::dyn_self"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "self"))->offset; return *reinterpret_cast<HoudiniEngineUnity::HAPI_GeoInfo*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: HoudiniEngineUnity.Test_HAPI_GeoInfo.IsEquivalentTo bool HoudiniEngineUnity::Test_HAPI_GeoInfo::IsEquivalentTo(HoudiniEngineUnity::Test_HAPI_GeoInfo* other) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_GeoInfo::IsEquivalentTo"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsEquivalentTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodThrow<bool, false>(this, ___internal__method, other); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: HoudiniEngineUnity.Test_HAPI_GeoInfo_Extensions #include "HoudiniEngineUnity/Test_HAPI_GeoInfo_Extensions.hpp" // Including type: HoudiniEngineUnity.Test_HAPI_GeoInfo #include "HoudiniEngineUnity/Test_HAPI_GeoInfo.hpp" // Including type: HoudiniEngineUnity.HAPI_GeoInfo #include "HoudiniEngineUnity/HAPI_GeoInfo.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: HoudiniEngineUnity.Test_HAPI_GeoInfo_Extensions.ToTestObject HoudiniEngineUnity::Test_HAPI_GeoInfo* HoudiniEngineUnity::Test_HAPI_GeoInfo_Extensions::ToTestObject(HoudiniEngineUnity::HAPI_GeoInfo self) { static auto ___internal__logger = ::Logger::get().WithContext("HoudiniEngineUnity::Test_HAPI_GeoInfo_Extensions::ToTestObject"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("HoudiniEngineUnity", "Test_HAPI_GeoInfo_Extensions", "ToTestObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(self)}))); return ::il2cpp_utils::RunMethodThrow<HoudiniEngineUnity::Test_HAPI_GeoInfo*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, self); }
92.730149
706
0.794606
[ "mesh", "object", "vector", "transform" ]
208a7e432c6788142537d1b8027bc885068ffed2
6,398
cpp
C++
src/GameGrid.cpp
thamstras/GamesProgramming
b576760cd12c1a13347bc488a2eb3d5a141abac1
[ "MIT" ]
null
null
null
src/GameGrid.cpp
thamstras/GamesProgramming
b576760cd12c1a13347bc488a2eb3d5a141abac1
[ "MIT" ]
null
null
null
src/GameGrid.cpp
thamstras/GamesProgramming
b576760cd12c1a13347bc488a2eb3d5a141abac1
[ "MIT" ]
null
null
null
#include "GameGrid.h" #include "glm\glm.hpp" ShipData * zSortShips(ShipData * ships) { ShipData * output = new ShipData[6]; int i = 0; for (int x = 0; x < 10; x++) { for (int s = 0; s < 6; s++) { if (ships[s].x == x) { output[i] = ships[s]; i++; } } } return output; } GameGrid::GameGrid(GridTypes gridType, SDL_Renderer * ren, std::string id) : RenderObject(id) { this->renderer = ren; // Setup Grid type = OUR_GRID; gridData = new int[100]; ships = new Ship*[6]; // Load Player Data playerData1 = Scene::getScene().p1Data; playerData2 = Scene::getScene().p2Data; p1Hits = 0; p2Hits = 0; p1ShotData = ShotData(); p2ShotData = ShotData(); // Draw Local Ships ShipData * shipsData = zSortShips(playerData1.ships); for (int s = 0; s < 6; s++) { std::string sid = this->id + "_ship" + std::to_string(s); ships[s] = new Ship(ren, sid, shipsData[s].x, shipsData[s].y, shipsData[s].size, shipsData[s].dir, s, 1); } // Prep Balls ourBall = new Ball(ren, glm::vec2(50, 50), glm::vec2(0, 0), 100, this->id + "_ourABall"); ourBall->bindPlayer(1); theirBall = new Ball(ren, glm::vec2(50, 50), glm::vec2(0, 0), 100, this->id + "_thierABall"); theirBall->bindPlayer(2); ourBall->move(550, 550); // Defending position theirBall->move(50, 50); // Attacking position // register all renders for (int s = 0; s < 6; s++) { Scene::getScene().registerRender(ships[s]); } Scene::getScene().registerRender(ourBall); Scene::getScene().registerRender(theirBall); // If HOST, Switch Grid. // IF CLIENT, dont. if (Scene::getScene().isServer) swapGrid(); } GameGrid::~GameGrid() { } void GameGrid::swapGrid() { std::cout << "SwapGrid()" << std::endl; if (type == OUR_GRID) { type = THEIR_GRID; for (int i = 0; i < 6; i++) { ships[i]->deltaShip(-1000, 0); } for each (auto shot in shotSrpites) { shot->moveSprite(shot->getXPos() - 1000, shot->getYPos()); } ourBall->move(550, 550); theirBall->move(50, 50); } else { type = OUR_GRID; for (int i = 0; i < 6; i++) { ships[i]->deltaShip(1000, 0); } for each (auto shot in shotSrpites) { shot->moveSprite(shot->getXPos() + 1000, shot->getYPos()); } ourBall->move(50, 50); theirBall->move(550, 550); } } void GameGrid::update(double simLength) { Scene::getScene().p1PosX = ourBall->phys->_position.x; Scene::getScene().p1PosY = ourBall->phys->_position.y; Scene::getScene().p2PosX = theirBall->phys->_position.x; Scene::getScene().p2PosY = theirBall->phys->_position.y; if (type == OUR_GRID) Scene::getScene().ourTurn = false; else Scene::getScene().ourTurn = true; if (type == OUR_GRID) { if (Scene::getScene().p2Fire) { int droneX = theirBall->sprite->getXPos(); int droneY = theirBall->sprite->getYPos(); int gridX = droneX / Scene::getScene().gridWidth; int gridY = droneY / Scene::getScene().gridHeight; int grid = gridY * 10 + gridX; buildGrid(true); bool hit = false; Ship* ship; switch (gridData[grid]) { case 0: //Miss ship = nullptr; break; case 1: //Hit ship = ships[0]; hit = true; break; case 2: ship = ships[1]; hit = true; break; case 3: ship = ships[2]; hit = true; break; case 4: ship = ships[3]; hit = true; break; case 5: ship = ships[4]; hit = true; break; case 6: ship = ships[5]; hit = true; break; default: //Error break; } if (hit) { std::cout << "P2 hit!" << std::endl; //ship->hit(gridX, gridY); if (p2ShotData.getState(gridX, gridY) != 0) { p2Hits++; p2ShotData.addHit(gridX, gridY); } Scene::getScene().lastShotHit = true; if (p2Hits >= maxHits) { Scene::getScene().loadScene(SCENE_P2_WIN); } StaticSprite* shot = new StaticSprite("hitshot", renderer, this->id + "_shot"); shot->moveSprite(gridX * 60, gridY * 60); Scene::getScene().registerRender(shot); shotSrpites.push_back(shot); } else { p2ShotData.addMiss(gridX, gridY); std::cout << "P2 Missed!" << std::endl; Scene::getScene().lastShotHit = false; StaticSprite* shot = new StaticSprite("missshot", renderer, this->id + "_shot"); shot->moveSprite(gridX * 60, gridY * 60); Scene::getScene().registerRender(shot); shotSrpites.push_back(shot); } swapGrid(); } } else { if (Scene::getScene().p1Fire) { int droneX = ourBall->sprite->getXPos() + 30; int droneY = ourBall->sprite->getYPos() + 30; int gridX = droneX / Scene::getScene().gridWidth; int gridY = droneY / Scene::getScene().gridHeight; int grid = gridY * 10 + gridX; bool hit = false; buildGrid(false); if (gridData[grid] != 0) hit = true; //wtf is this for? if (hit) { if (p1ShotData.getState(gridX, gridY) == 0) { p1Hits++; p1ShotData.addHit(gridX, gridY); } if (p1Hits >= maxHits) { Scene::getScene().loadScene(SCENE_P1_WIN); } std::cout << "P1 hit something!" << std::endl; StaticSprite* shot = new StaticSprite("hitshot", renderer, this->id + "_shot"); shot->moveSprite(gridX * 60, gridY * 60); Scene::getScene().registerRender(shot); shotSrpites.push_back(shot); swapGrid(); return; } else { p1ShotData.addMiss(gridX, gridY); std::cout << "P1 missed!" << std::endl; StaticSprite* shot = new StaticSprite("missshot", renderer, this->id + "_shot"); shot->moveSprite(gridX * 60, gridY * 60); Scene::getScene().registerRender(shot); shotSrpites.push_back(shot); swapGrid(); return; } } } } void GameGrid::render(SDL_Renderer * ren) { } void GameGrid::closeGrid(int X, int Y, int s) { if (X > 9 || Y > 9) return; if (X < 0 || Y < 0) return; int i = (Y * 10) + X; gridData[i] = s; } void GameGrid::placeOnGrid(int X, int Y, int size, int direction, int s) { if (direction == 0) { for (int i = 0; i < size; i++) { closeGrid(X + i, Y, s); } } else { for (int i = 0; i < size; i++) { closeGrid(X, Y + i, s); } } } void GameGrid::buildGrid(bool local) { for (int i = 0; i < 100; i++) { gridData[i] = 0; } PlayerData data; if (local) data = playerData1; else data = playerData2; ShipData* shipData = data.ships; for (int s = 0; s < 6; s++) { placeOnGrid(shipData[s].x, shipData[s].y, shipData[s].size, shipData[s].dir, s+1); } }
22.215278
107
0.597218
[ "render" ]
208cf4346e72964b2529aa929b15f9b2af2b9ae6
4,387
cpp
C++
Criteria/RFIDCriterion.cpp
francescodelduchetto/nbs_ros
dd544818b845ce1e67aecdb942ca809c89669581
[ "MIT" ]
null
null
null
Criteria/RFIDCriterion.cpp
francescodelduchetto/nbs_ros
dd544818b845ce1e67aecdb942ca809c89669581
[ "MIT" ]
null
null
null
Criteria/RFIDCriterion.cpp
francescodelduchetto/nbs_ros
dd544818b845ce1e67aecdb942ca809c89669581
[ "MIT" ]
null
null
null
// // Created by pulver on 29/07/2019. // #include "Criteria/RFIDCriterion.h" #include "Criteria/criteriaName.h" #include "Eigen/Eigen" #include "newray.h" #include "utils.h" #include <math.h> using namespace dummy; using namespace grid_map; RFIDCriterion::RFIDCriterion(double weight) : Criterion(RFID_READING, weight, true) { // minValue = 0.0; } RFIDCriterion::~RFIDCriterion() {} double RFIDCriterion::evaluate(Pose &p, dummy::Map *map, ros::ServiceClient *path_client, double *batteryTime, GridMap *belief_map) { // Calculate entropy around the cell this->RFIDInfoGain = evaluateEntropyOverBelief(p, belief_map); if (isnan(this->RFIDInfoGain)){ this->RFIDInfoGain = 0.0; } Criterion::insertEvaluation(p, this->RFIDInfoGain); return this->RFIDInfoGain; } double RFIDCriterion::evaluateEntropyOverBelief(Pose &p, GridMap *belief_map) { float RFIDInfoGain = 0.0; double entropy_cell = 0.0; int buffer_size = 2; std::vector<string> layers_name = belief_map->getLayers(); // The layers_name vector contains "ref_map, X, Y" which are for not for finding the tags. // So we can remove their name to avoid checking this layers. layers_name.erase(layers_name.begin(), layers_name.begin()+3); // If there are no belief maps built (no signal received up to now), // the entropy is maximum if (layers_name.size() == 0){ RFIDInfoGain = 1.0; // default: max entropy } for (auto it = layers_name.begin(); it != layers_name.end(); it++){ int tag_id = std::stoi( *it ); // convert string to int entropy_cell = getTotalEntropyEllipse(p, p.getRange(), -1.0, tag_id, belief_map); RFIDInfoGain += entropy_cell; } return RFIDInfoGain; } double RFIDCriterion::getTotalEntropyEllipse(Pose target, double maxX, double minX, int tag_i, GridMap *belief_map){ //1.- Get elipsoid iterator. // Antenna is at one of the focus of the ellipse with center at antennaX, antennaY, tilted antennaHeading . // http://www.softschools.com/math/calculus/finding_the_foci_of_an_ellipse/ // if a is mayor axis and b is minor axis // a-c= minX // a+c= maxX // a = (maxX + minX)/2 // c = maxX/2 + minX // b = sqrt(a^2-c^2) // mirror y axis!!!! double antennaX = target.getX(); double antennaY = target.getY(); double antennaHeading = target.getOrientation() * 3.14/180; double a = (abs(maxX) + abs(minX))/2.0; double c = (abs(maxX) - abs(minX))/2; double b = sqrt((a*a)-(c*c)); double xc = antennaX + (c*cos(antennaHeading)); double yc = antennaY + (c*sin(antennaHeading)); Position center(xc, yc); // meters Length length(2*a, 2*b); grid_map::EllipseIterator el_iterator(*belief_map, center, length, antennaHeading); return getTotalEntropyEllipse(target, el_iterator, tag_i, belief_map); } double RFIDCriterion::getTotalEntropyEllipse(Pose target, grid_map::EllipseIterator iterator, int tag_i, GridMap *belief_map) { double total_entropy; Position point; double likelihood, neg_likelihood, log2_likelihood, log2_neg_likelihood = 0.0; std::string tagLayerName = getTagLayerName(tag_i); total_entropy = 0; for (iterator; !iterator.isPastEnd(); ++iterator) { belief_map->getPosition(*iterator, point); // check if is inside global map if (belief_map->isInside(point)) { // We don't add belief from positions considered obstacles... if (belief_map->atPosition("ref_map", point) == _free_space_val) { likelihood = belief_map->atPosition(tagLayerName, point); if (isnan(likelihood)) likelihood = 0.0; neg_likelihood = 1 - likelihood; if (isnan(neg_likelihood)) neg_likelihood = 0.0; log2_likelihood = log2(likelihood); if (isinf(log2_likelihood)) log2_likelihood = 0.0; log2_neg_likelihood = log2(neg_likelihood); if (isinf(log2_neg_likelihood)) log2_neg_likelihood = 0.0; // cout << " l: " << log2_likelihood << endl; // likelihood = // rfid_tools->rm.getBeliefMaps().atPosition(layerName,rel_point); total_entropy += -likelihood * log2_likelihood - neg_likelihood * log2_neg_likelihood; } } } return total_entropy; } std::string RFIDCriterion::getTagLayerName(int tag_num) { return std::to_string(tag_num); }
35.959016
133
0.673353
[ "vector" ]
2099fbbc247990200bc8d693135425b9e5a529d5
7,169
cc
C++
chrome/browser/support_tool/support_tool_handler.cc
chromium/chromium
df46e572c3449a4b108d6e02fbe4f6d24cf98381
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
chrome/browser/support_tool/support_tool_handler.cc
chromium/chromium
df46e572c3449a4b108d6e02fbe4f6d24cf98381
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
86
2015-10-21T13:02:42.000Z
2022-03-14T07:50:50.000Z
chrome/browser/support_tool/support_tool_handler.cc
chromium/chromium
df46e572c3449a4b108d6e02fbe4f6d24cf98381
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// Copyright 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/support_tool/support_tool_handler.h" #include <algorithm> #include <cstddef> #include <map> #include <memory> #include <set> #include <vector> #include "base/barrier_closure.h" #include "base/bind.h" #include "base/callback.h" #include "base/check.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/location.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "base/task/bind_post_task.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/support_tool/data_collector.h" #include "components/feedback/pii_types.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/zlib/google/zip.h" // Zip archieves the contents of `src_path` into `target_path`. Adds ".zip" // extension to target file path. Returns true on success, false otherwise. bool ZipOutput(base::FilePath src_path, base::FilePath target_path) { base::FilePath zip_path = target_path.AddExtension(FILE_PATH_LITERAL(".zip")); if (!zip::Zip(src_path, zip_path, true)) { LOG(ERROR) << "Couldn't zip files"; return false; } return true; } // Creates a unique temp directory to store the output files. The caller is // responsible for deleting the returned directory. Returns an empty FilePath in // case of an error. base::FilePath CreateTempDirForOutput() { base::ScopedTempDir temp_dir; if (!temp_dir.CreateUniqueTempDir()) { LOG(ERROR) << "Unable to create temp dir."; return base::FilePath{}; } return temp_dir.Take(); } SupportToolHandler::SupportToolHandler() = default; SupportToolHandler::~SupportToolHandler() { CleanUp(); } void SupportToolHandler::CleanUp() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Clean the temporary directory in a worker thread if it hasn't been removed // yet. if (!temp_dir_.empty()) { base::ThreadPool::PostTask( FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::BLOCK_SHUTDOWN}, base::BindOnce(base::GetDeletePathRecursivelyCallback(), std::move(temp_dir_))); temp_dir_.clear(); } } void SupportToolHandler::AddDataCollector( std::unique_ptr<DataCollector> collector) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(collector); data_collectors_.emplace_back(std::move(collector)); } void SupportToolHandler::CollectSupportData( SupportToolDataCollectedCallback on_data_collection_done_callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!on_data_collection_done_callback.is_null()); DCHECK(!data_collectors_.empty()); on_data_collection_done_callback_ = std::move(on_data_collection_done_callback); base::RepeatingClosure collect_data_barrier_closure = base::BarrierClosure( data_collectors_.size(), base::BindOnce(&SupportToolHandler::OnAllDataCollected, weak_ptr_factory_.GetWeakPtr())); for (auto& data_collector : data_collectors_) { data_collector->CollectDataAndDetectPII(base::BindOnce( &SupportToolHandler::OnDataCollected, weak_ptr_factory_.GetWeakPtr(), collect_data_barrier_closure)); } } void SupportToolHandler::OnDataCollected( base::RepeatingClosure barrier_closure, absl::optional<SupportToolError> error) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (error) { collected_errors_.insert(error.value()); } std::move(barrier_closure).Run(); } void SupportToolHandler::OnAllDataCollected() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto& data_collector : data_collectors_) { const PIIMap& collected = data_collector->GetDetectedPII(); for (auto& pii_data : collected) { detected_pii_[pii_data.first].insert(pii_data.second.begin(), pii_data.second.end()); } } std::move(on_data_collection_done_callback_) .Run(detected_pii_, collected_errors_); } void SupportToolHandler::ExportCollectedData( std::set<feedback::PIIType> pii_types_to_keep, base::FilePath target_path, SupportToolDataExportedCallback on_data_exported_callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Clear the set of previously collected errors. collected_errors_.clear(); on_data_export_done_callback_ = std::move(on_data_exported_callback); base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::BindOnce(&CreateTempDirForOutput), base::BindOnce(&SupportToolHandler::ExportIntoTempDir, weak_ptr_factory_.GetWeakPtr(), pii_types_to_keep, target_path)); } void SupportToolHandler::ExportIntoTempDir( std::set<feedback::PIIType> pii_types_to_keep, base::FilePath target_path, base::FilePath tmp_path) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (tmp_path.empty()) { collected_errors_.insert( SupportToolError::kDataExportTempDirCreationFailed); std::move(on_data_export_done_callback_).Run(collected_errors_); return; } temp_dir_ = tmp_path; base::RepeatingClosure export_data_barrier_closure = base::BarrierClosure( data_collectors_.size(), base::BindOnce(&SupportToolHandler::OnAllDataCollectorsDoneExporting, weak_ptr_factory_.GetWeakPtr(), temp_dir_, target_path)); for (auto& data_collector : data_collectors_) { data_collector->ExportCollectedDataWithPII( pii_types_to_keep, temp_dir_, base::BindOnce(&SupportToolHandler::OnDataCollectorDoneExporting, weak_ptr_factory_.GetWeakPtr(), export_data_barrier_closure)); } } void SupportToolHandler::OnDataCollectorDoneExporting( base::RepeatingClosure barrier_closure, absl::optional<SupportToolError> error) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (error) { collected_errors_.insert(error.value()); } std::move(barrier_closure).Run(); } void SupportToolHandler::OnAllDataCollectorsDoneExporting( base::FilePath tmp_path, base::FilePath path) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Archive the contents in the `tmp_path` into `path` in a zip file. base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::BindOnce(&ZipOutput, tmp_path, path), base::BindOnce(&SupportToolHandler::OnDataExportDone, weak_ptr_factory_.GetWeakPtr())); } void SupportToolHandler::OnDataExportDone(bool success) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Clean-up the temporary directory after exporting the data. CleanUp(); if (!success) { collected_errors_.insert(SupportToolError::kDataExportCreateArchiveFailed); } std::move(on_data_export_done_callback_).Run(collected_errors_); }
34.970732
80
0.740131
[ "vector" ]
209a49982ad2c81fc8f3bc34ac793b199b924a4c
7,147
cpp
C++
src/plugins/tabsessmanager/tabsessmanager.cpp
MellonQ/leechcraft
71cbb238d2dade56b3865278a6a8e6a58c217fc5
[ "BSL-1.0" ]
null
null
null
src/plugins/tabsessmanager/tabsessmanager.cpp
MellonQ/leechcraft
71cbb238d2dade56b3865278a6a8e6a58c217fc5
[ "BSL-1.0" ]
null
null
null
src/plugins/tabsessmanager/tabsessmanager.cpp
MellonQ/leechcraft
71cbb238d2dade56b3865278a6a8e6a58c217fc5
[ "BSL-1.0" ]
null
null
null
/********************************************************************** * LeechCraft - modular cross-platform feature rich internet client. * Copyright (C) 2006-2014 Georg Rudoy * * Boost Software License - Version 1.0 - August 17th, 2003 * * Permission is hereby granted, free of charge, to any person or organization * obtaining a copy of the software and accompanying documentation covered by * this license (the "Software") to use, reproduce, display, distribute, * execute, and transmit the Software, and to prepare derivative works of the * Software, and to permit third-parties to whom the Software is furnished to * do so, all subject to the following: * * The copyright notices in the Software and this entire statement, including * the above license grant, this restriction and the following disclaimer, * must be included in all copies of the Software, in whole or in part, and * all derivative works of the Software, unless such copies or derivative * works are solely in the form of machine-executable object code generated by * a source language processor. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. **********************************************************************/ #include "tabsessmanager.h" #include <algorithm> #include <QIcon> #include <QTimer> #include <QSettings> #include <QApplication> #include <QMenu> #include <QtDebug> #include <util/util.h> #include <interfaces/core/icoreproxy.h> #include <interfaces/core/irootwindowsmanager.h> #include <interfaces/core/ipluginsmanager.h> #include <interfaces/core/icoretabwidget.h> #include <interfaces/ihaverecoverabletabs.h> #include <interfaces/ihavetabs.h> #include "recinfo.h" #include "sessionmenumanager.h" #include "sessionsmanager.h" #include "util.h" namespace LeechCraft { namespace TabSessManager { void Plugin::Init (ICoreProxy_ptr proxy) { Util::InstallTranslator ("tabsessmanager"); UncloseMenu_ = new QMenu (tr ("Unclose tabs")); SessionsMgr_ = new SessionsManager { proxy }; SessionMenuMgr_ = new SessionMenuManager; connect (SessionMenuMgr_, SIGNAL (loadRequested (QString)), SessionsMgr_, SLOT (loadCustomSession (QString))); connect (SessionMenuMgr_, SIGNAL (addRequested (QString)), SessionsMgr_, SLOT (addCustomSession (QString))); connect (SessionMenuMgr_, SIGNAL (deleteRequested (QString)), SessionsMgr_, SLOT (deleteCustomSession (QString))); connect (SessionMenuMgr_, SIGNAL (saveCustomSessionRequested ()), SessionsMgr_, SLOT (saveCustomSession ())); connect (SessionsMgr_, SIGNAL (gotCustomSession (QString)), SessionMenuMgr_, SLOT (addCustomSession (QString))); Proxy_ = proxy; for (const auto& name : SessionsMgr_->GetCustomSessions ()) SessionMenuMgr_->addCustomSession (name); } void Plugin::SecondInit () { QTimer::singleShot (5000, SessionsMgr_, SLOT (recover ())); } QByteArray Plugin::GetUniqueID () const { return "org.LeechCraft.TabSessManager"; } void Plugin::Release () { QSettings settings (QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_TabSessManager"); settings.setValue ("CleanShutdown", true); } QString Plugin::GetName () const { return "TabSessManager"; } QString Plugin::GetInfo () const { return tr ("Manages sessions of tabs in LeechCraft."); } QIcon Plugin::GetIcon () const { return {}; } QSet<QByteArray> Plugin::GetPluginClasses () const { QSet<QByteArray> result; result << "org.LeechCraft.Core.Plugins/1.0"; return result; } QList<QAction*> Plugin::GetActions (ActionsEmbedPlace place) const { switch (place) { case ActionsEmbedPlace::ToolsMenu: return { SessionMenuMgr_->GetSessionsMenu ()->menuAction (), UncloseMenu_->menuAction () }; case ActionsEmbedPlace::CommonContextMenu: return { UncloseMenu_->menuAction () }; default: return {}; } } void Plugin::hookTabIsRemoving (IHookProxy_ptr, int index, int windowId) { const auto rootWM = Proxy_->GetRootWindowsManager (); const auto tabWidget = rootWM->GetTabWidget (windowId); const auto widget = tabWidget->Widget (index); handleRemoveTab (widget); SessionsMgr_->handleRemoveTab (widget); } void Plugin::handleRemoveTab (QWidget *widget) { auto tab = qobject_cast<ITabWidget*> (widget); if (!tab) return; auto recTab = qobject_cast<IRecoverableTab*> (widget); if (!recTab) return; const auto& recoverData = recTab->GetTabRecoverData (); if (recoverData.isEmpty ()) return; TabUncloseInfo info { { recoverData, GetSessionProps (widget) }, qobject_cast<IHaveRecoverableTabs*> (tab->ParentMultiTabs ()) }; const auto rootWM = Proxy_->GetRootWindowsManager (); const auto winIdx = rootWM->GetWindowForTab (tab); const auto tabIdx = rootWM->GetTabWidget (winIdx)->IndexOf (widget); info.RecInfo_.DynProperties_.append ({ "TabSessManager/Position", tabIdx }); const auto pos = std::find_if (UncloseAct2Data_.begin (), UncloseAct2Data_.end (), [&info] (const TabUncloseInfo& that) { return that.RecInfo_.Data_ == info.RecInfo_.Data_; }); if (pos != UncloseAct2Data_.end ()) { auto act = pos.key (); UncloseMenu_->removeAction (act); UncloseAct2Data_.erase (pos); delete act; } const auto& fm = UncloseMenu_->fontMetrics (); const QString& elided = fm.elidedText (recTab->GetTabRecoverName (), Qt::ElideMiddle, 300); QAction *action = new QAction (recTab->GetTabRecoverIcon (), elided, this); UncloseAct2Data_ [action] = info; connect (action, SIGNAL (triggered ()), this, SLOT (handleUnclose ())); if (UncloseMenu_->defaultAction ()) UncloseMenu_->defaultAction ()->setShortcut (QKeySequence ()); UncloseMenu_->insertAction (UncloseMenu_->actions ().value (0), action); UncloseMenu_->setDefaultAction (action); action->setShortcut (QString ("Ctrl+Shift+T")); } void Plugin::handleUnclose () { auto action = qobject_cast<QAction*> (sender ()); if (!action) { qWarning () << Q_FUNC_INFO << "sender is not an action:" << sender (); return; } if (!UncloseAct2Data_.contains (action)) return; action->deleteLater (); auto data = UncloseAct2Data_.take (action); if (UncloseMenu_->defaultAction () == action) { auto nextAct = UncloseMenu_->actions ().value (1); if (nextAct) { UncloseMenu_->setDefaultAction (nextAct); nextAct->setShortcut (QString ("Ctrl+Shift+T")); } } UncloseMenu_->removeAction (action); data.Plugin_->RecoverTabs (QList<TabRecoverInfo> () << data.RecInfo_); } } } LC_EXPORT_PLUGIN (leechcraft_tabsessmanager, LeechCraft::TabSessManager::Plugin);
28.818548
97
0.700014
[ "object" ]
209c38377652f998862d8346efe2fb41333d4768
1,138
cpp
C++
[187] Repeated DNA Sequences/187.repeated-dna-sequences.cpp
Coolzyh/Leetcode
4abf685501427be0ce36b83016c4fa774cdf1a1a
[ "MIT" ]
null
null
null
[187] Repeated DNA Sequences/187.repeated-dna-sequences.cpp
Coolzyh/Leetcode
4abf685501427be0ce36b83016c4fa774cdf1a1a
[ "MIT" ]
null
null
null
[187] Repeated DNA Sequences/187.repeated-dna-sequences.cpp
Coolzyh/Leetcode
4abf685501427be0ce36b83016c4fa774cdf1a1a
[ "MIT" ]
null
null
null
/* * @lc app=leetcode id=187 lang=cpp * * [187] Repeated DNA Sequences */ // @lc code=start class Solution { public: vector<string> findRepeatedDnaSequences(string s) { // https://leetcode.com/problems/repeated-dna-sequences/discuss/53877/I-did-it-in-10-lines-of-C%2B%2B // bit-manipulation method // A is 0x41, C is 0x43, G is 0x47, T is 0x54. // A is 0101, C is 0103, G is 0107, T is 0124. The last digit in octal are different for all four letters. // We can simply use s[i] & 7 to get the last digit which are just the last 3 bits unordered_map<int, int> map; vector<string> res; int t = 0, i = 0, len = s.size(); // t to save the next previous 9 letters while (i < 9) t = t << 3 | s[i++] & 7; while (i < len) { if (map[t = t << 3 & 0x3FFFFFFF | s[i++] & 7]++ == 1) res.push_back(s.substr(i - 10, 10)); // in case of t << 3 exceed int limit if (t>>29 & 0x1 == 1) { t = t & 0x1FFFFFFF; } } return res; } }; // @lc code=end
32.514286
115
0.522847
[ "vector" ]
20a207cb088436bbcff94d2a493f65b7ce2e6015
9,376
cc
C++
src/algs/stogo/local.cc
bowie7070/nlopt
95df031058531d84fe9c0727458129f773d22959
[ "MIT-0", "MIT" ]
1,224
2015-01-14T22:56:04.000Z
2022-03-30T18:52:57.000Z
nlopt/src/algs/stogo/local.cc
yjjuan/automl_cplusplus
7c427584ed94915b549d31a2097f952c3cfdef36
[ "Apache-2.0" ]
349
2015-01-16T22:22:32.000Z
2022-03-29T18:30:05.000Z
nlopt/src/algs/stogo/local.cc
yjjuan/automl_cplusplus
7c427584ed94915b549d31a2097f952c3cfdef36
[ "Apache-2.0" ]
437
2015-02-20T07:40:41.000Z
2022-03-30T15:21:01.000Z
/* Local search - A trust region algorithm with BFGS update. */ #include <iostream> #include <stdlib.h> #include "stogo_config.h" #include "global.h" #include "local.h" #include "tools.h" //////////////////////////////////////////////////////////////////////// // SGJ, 2007: allow local to use local optimizers in NLopt, to compare // to the BFGS code below #if 0 #include "nlopt.h" typedef struct { Global *glob; double maxgrad; nlopt_stopping *stop; } f_local_data; static double f_local(int n, const double *x, double *grad, void *data_) { f_local_data *data = (f_local_data *) data_; double f; RVector xv, gv; // hack to avoid pointless copy of x and grad xv.len = gv.len = n; xv.elements = const_cast<double *>(x); gv.elements = grad; f=data->glob->ObjectiveGradient(xv, gv, grad?OBJECTIVE_AND_GRADIENT:OBJECTIVE_ONLY); if (grad) data->maxgrad = max(data->maxgrad, normInf(gv)); xv.elements = gv.elements = 0; // prevent deallocation ++ *(data->stop->nevals_p); return f; } #endif //////////////////////////////////////////////////////////////////////// int local(Trial &T, TBox &box, TBox &domain, double eps_cl, double *mgr, Global &glob, int axis, RCRVector x_av #ifdef NLOPT_UTIL_H , nlopt_stopping *stop #endif ) { int n=box.GetDim(); RVector x(n); double tmp, f; x=T.xvals ; #ifdef LS_DEBUG cout << "Local Search, x=" << x << endl; #endif if (box.OutsideBox(x, domain) != 0) { cout << "Starting point is not inside the boundary. Exiting...\n" ; exit(1) ; return LS_Out ; } // Check if we are close to a stationary point located previously if (box.CloseToMin(x, &tmp, eps_cl)) { #ifdef LS_DEBUG cout << "Close to a previously located stationary point, exiting" << endl; #endif T.objval=tmp; return LS_Old ; } #if 0 if (axis != -1) { cout << "NLopt code only works with axis == -1, exiting...\n" ; exit(EXIT_FAILURE); } f_local_data data; data.glob = &glob; data.maxgrad = *mgr; data.stop = stop; nlopt_result ret = nlopt_minimize(NLOPT_LOCAL_LBFGS, n, f_local, &data, box.lb.raw_data(), box.ub.raw_data(), x.raw_data(), &f, stop->minf_max, stop->ftol_rel, stop->ftol_abs, stop->xtol_rel, stop->xtol_abs, stop->maxeval - *(stop->nevals_p), stop->maxtime - stop->start); *mgr = data.maxgrad; T.xvals=x ; T.objval=f ; if (ret == NLOPT_MAXEVAL_REACHED || ret == NLOPT_MAXTIME_REACHED) return LS_MaxEvalTime; else if (ret > 0) return LS_New; else return LS_Out; // failure #else /* not using NLopt local optimizer ... use original STOgo BFGS code */ int k_max, info, outside = 0; int k, i, good_enough, iTmp ; double maxgrad, delta, f_new; double alpha, gamma, beta, d2, s2, nom, den, ro ; double nrm_sd, nrm_hn, snrm_hn, nrm_dl ; RVector g(n), h_sd(n), h_dl(n), h_n(n), x_new(n), g_new(n) ; RVector s(n),y(n),z(n),w(n) ; // Temporary vectors RMatrix B(n), H(n) ; // Hessian and it's inverse k_max = max_iter*n ; // Initially B and H are equal to the identity matrix B=0 ; H=0 ; for (i=0 ; i<n ; i++) { B(i,i)=1 ; H(i,i)=1 ; } RVector g_av(x_av.GetLength()); if (axis==-1) { f=glob.ObjectiveGradient(x,g,OBJECTIVE_AND_GRADIENT); } else { x_av(axis)=x(0); f=glob.ObjectiveGradient(x_av,g_av,OBJECTIVE_AND_GRADIENT); g(0)=g_av(axis); } ++ *(stop->nevals_p); if (nlopt_stop_evalstime(stop)) return LS_MaxEvalTime; FC++;GC++; if (axis == -1) { // Skipping AV #ifdef INI3 // Elaborate scheme to initalize delta delta=delta_coef*norm2(g) ; copy(g,z) ; axpy(1.0,x,z) ; if (!box.InsideBox(z)) { if (box.Intersection(x,g,z)==TRUE) { axpy(-1.0,x,z) ; delta=min(delta,delta_coef*norm2(z)) ; } else { // Algorithm broke down, use INI1 delta = (1.0/7)*box.ShortestSide(&iTmp) ; } } #endif #ifdef INI2 // Use INI2 scheme delta = box.ClosestSide(x)*delta_coef ; if (delta<MacEpsilon) // Patch to avoid trust region with radius close to zero delta = (1.0/7)*box.ShortestSide(&iTmp) ; #endif #ifdef INI1 delta = delta_coef*box.ShortestSide(&iTmp) ; #endif } else { // Use a simple scheme for the 1D minimization (INI1) delta = (1.0/7.0)*box.ShortestSide(&iTmp) ; } k=0 ; good_enough = 0 ; info=LS_New ; outside=0 ; maxgrad=*mgr ; while (good_enough == 0) { k++ ; if (k>k_max) { #ifdef LS_DEBUG cout << "Maximum number of iterations reached\n" ; #endif info=LS_MaxIter ; break ; } // Update maximal gradient value maxgrad=max(maxgrad,normInf(g)) ; // Steepest descent, h_sd = -g copy(g,h_sd) ; scal(-1.0,h_sd) ; nrm_sd=norm2(h_sd) ; if (nrm_sd < epsilon) { // Stop criterion (gradient) fullfilled #ifdef LS_DEBUG cout << "Gradient small enough" << endl ; #endif good_enough = 1 ; break ; } // Compute Newton step, h_n = -H*g gemv('N',-1.0, H, g, 0.0, h_n) ; nrm_hn = norm2(h_n) ; if (nrm_hn < delta) { // Pure Newton step copy(h_n, h_dl) ; #ifdef LS_DEBUG cout << "[Newton step] " ; #endif } else { gemv('N',1.0,B,g,0.0,z) ; tmp=dot(g,z) ; if (tmp==0) { info = LS_Unstable ; break ; } alpha=(nrm_sd*nrm_sd)/tmp ; // Normalization (N38,eq. 3.30) scal(alpha,h_sd) ; nrm_sd=fabs(alpha)*nrm_sd ; if (nrm_sd >= delta) { gamma = delta/nrm_sd ; // Normalization (N38, eq. 3.33) copy(h_sd,h_dl) ; scal(gamma,h_dl) ; #ifdef LS_DEBUG cout << "[Steepest descent] " ; #endif } else { // Combination of Newton and SD steps d2 = delta*delta ; copy(h_sd,s) ; s2=nrm_sd*nrm_sd ; nom = d2 - s2 ; snrm_hn=nrm_hn*nrm_hn ; tmp = dot(h_n,s) ; den = tmp-s2 + sqrt((tmp-d2)*(tmp-d2)+(snrm_hn-d2)*(d2-s2)) ; if (den==0) { info = LS_Unstable ; break ; } // Normalization (N38, eq. 3.31) beta = nom/den ; copy(h_n,h_dl) ; scal(beta,h_dl) ; axpy((1-beta),h_sd,h_dl) ; #ifdef LS_DEBUG cout << "[Mixed step] " ; #endif } } nrm_dl=norm2(h_dl) ; //x_new = x+h_dl ; copy(x,x_new) ; axpy(1.0,h_dl,x_new) ; // Check if x_new is inside the box iTmp=box.OutsideBox(x_new, domain) ; if (iTmp == 1) { #ifdef LS_DEBUG cout << "x_new is outside the box " << endl ; #endif outside++ ; if (outside>max_outside_steps) { // Previous point was also outside, exit break ; } } else if (iTmp == 2) { #ifdef LS_DEBUG cout << " x_new is outside the domain" << endl ; #endif info=LS_Out ; break ; } else { outside=0 ; } // Compute the gain if (axis==-1) f_new=glob.ObjectiveGradient(x_new,g_new,OBJECTIVE_AND_GRADIENT); else { x_av(axis)=x_new(0); f_new=glob.ObjectiveGradient(x_av,g_av,OBJECTIVE_AND_GRADIENT); } ++ *(stop->nevals_p); if (nlopt_stop_evalstime(stop)) return LS_MaxEvalTime; FC++; GC++; gemv('N',0.5,B,h_dl,0.0,z); ro = (f_new-f) / (dot(g,h_dl) + dot(h_dl,z)); // Quadratic model if (ro > 0.75) { delta = delta*2; } if (ro < 0.25) { delta = delta/3; } if (ro > 0) { // Update the Hessian and it's inverse using the BFGS formula if (axis != -1) g_new(0)=g_av(axis); // y=g_new-g copy(g_new,y); axpy(-1.0,g,y); // Check curvature condition alpha=dot(y,h_dl); if (alpha <= sqrt(MacEpsilon)*nrm_dl*norm2(y)) { #ifdef LS_DEBUG cout << "Curvature condition violated " ; #endif } else { // Update Hessian gemv('N',1.0,B,h_dl,0.0,z) ; // z=Bh_dl beta=-1/dot(h_dl,z) ; ger(1/alpha,y,y,B) ; ger(beta,z,z,B) ; // Update Hessian inverse gemv('N',1.0,H,y,0.0,z) ; // z=H*y gemv('T',1.0,H,y,0.0,w) ; // w=y'*H beta=dot(y,z) ; beta=(1+beta/alpha)/alpha ; // It should be possible to do this updating more efficiently, by // exploiting the fact that (h_dl*y'*H) = transpose(H*y*h_dl') ger(beta,h_dl,h_dl,H) ; ger(-1/alpha,z,h_dl,H) ; ger(-1/alpha,h_dl,w,H) ; } if (nrm_dl < norm2(x)*epsilon) { // Stop criterion (iteration progress) fullfilled #ifdef LS_DEBUG cout << "Progress is marginal" ; #endif good_enough = 1 ; } // Check if we are close to a stationary point located previously if (box.CloseToMin(x_new, &f_new, eps_cl)) { // Note that x_new and f_new may be overwritten on exit from CloseToMin #ifdef LS_DEBUG cout << "Close to a previously located stationary point, exiting" << endl; #endif info = LS_Old ; good_enough = 1 ; } // Update x, g and f copy(x_new,x) ; copy(g_new,g) ; f=f_new ; #ifdef LS_DEBUG cout << " x=" << x << endl ; #endif } else { #ifdef LS_DEBUG cout << "Step is no good, ro=" << ro << " delta=" << delta << endl ; #endif } } // wend // Make sure the routine returns correctly... // Check if last iterate is outside the boundary if (box.OutsideBox(x, domain) != 0) { info=LS_Out; f=DBL_MAX; } if (info == LS_Unstable) { cout << "Local search became unstable. No big deal but exiting anyway\n" ; exit(1); } *mgr=maxgrad ; T.xvals=x ; T.objval=f ; if (outside>0) return LS_Out ; else return info ; #endif }
23.796954
79
0.583404
[ "model" ]
20a297b5cb791033cb748b782c4d8bfad252e7bd
621
cpp
C++
examples/serialization/main.cpp
XenotriX/CppProperties
d78713e33a2b5d5d030988456f5be25d7e9bb11d
[ "MIT" ]
null
null
null
examples/serialization/main.cpp
XenotriX/CppProperties
d78713e33a2b5d5d030988456f5be25d7e9bb11d
[ "MIT" ]
null
null
null
examples/serialization/main.cpp
XenotriX/CppProperties
d78713e33a2b5d5d030988456f5be25d7e9bb11d
[ "MIT" ]
null
null
null
#include <iostream> #include "../../lib/properties.hpp" struct shape : properties::properties { MAKE_PROPERTY(x, int); MAKE_PROPERTY(y, int); MAKE_PROPERTY(name, std::string); }; int main() { // Create object shape s1; s1.x = 24; s1.y = 48; s1.name = "My Shape"; // Serialize to XML file s1.to_xml_file("shape.xml"); // Create another object shape s2; // Deserialize from XML file s2.from_xml_file("shape.xml"); // Print both s1 and s2; std::cout << s1.to_string() << std::endl; std::cout << s2.to_string() << std::endl; return 0; }
17.25
45
0.58132
[ "object", "shape" ]
20a3ac00cd9e7c1ba56b245af1ec4397d40e2907
7,864
hpp
C++
CPPUtils/Iterators/ZipIterator.hpp
JackHunt/CPPUtils
e086a257d8d2ebffaa3ca0bb6e3e9baafe98edb8
[ "BSD-3-Clause" ]
null
null
null
CPPUtils/Iterators/ZipIterator.hpp
JackHunt/CPPUtils
e086a257d8d2ebffaa3ca0bb6e3e9baafe98edb8
[ "BSD-3-Clause" ]
null
null
null
CPPUtils/Iterators/ZipIterator.hpp
JackHunt/CPPUtils
e086a257d8d2ebffaa3ca0bb6e3e9baafe98edb8
[ "BSD-3-Clause" ]
null
null
null
/* BSD 3-Clause License Copyright (c) 2018,2019 Jack Miles Hunt All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CPP_UTILS_ZIP_ITERATOR #define CPP_UTILS_ZIP_ITERATOR #include <iterator> #include <tuple> #include <ostream> #include <utility> #include <algorithm> #include <CPPUtils/ContainerTools/TupleTools.hpp> namespace CPPUtils::Iterators { // Pull in tupleFor to apply per-element lambda's to a tuple. using CPPUtils::ContainerTools::Tuple::tupleFor; template<typename... T> class ZipIterator { public: using value_type = std::tuple<T...>; using reference = const value_type&; using pointer = const value_type*; using difference_type = typename std::iterator<std::random_access_iterator_tag, value_type>::difference_type; using iterator_category = std::random_access_iterator_tag; protected: value_type val; public: ZipIterator() = delete; ZipIterator(value_type val) : val(val) { // } ZipIterator(const ZipIterator &iter) : val(iter.base()) { // } virtual ~ZipIterator() { // } value_type const &base() const { return val; } reference operator*() const { return val; } ZipIterator &operator++() { tupleFor(val, [](size_t idx, auto &elem) { return ++elem; }); return *this; } ZipIterator &operator--() { tupleFor(val, [](size_t idx, auto &elem) { return --elem; }); return *this; } ZipIterator operator++(int) { ZipIterator tmp(*this); tupleFor(val, [](size_t idx, auto &elem) { return ++elem; }); return tmp; } ZipIterator operator--(int) { ZipIterator tmp(*this); tupleFor(val, [](size_t idx, auto &elem) { return --elem; }); return tmp; } ZipIterator &operator+=(difference_type rhs) { tupleFor(val, [&rhs](size_t idx, auto &elem) { elem += std::get<idx>(rhs); }); return *this; } ZipIterator &operator-=(difference_type rhs) { tupleFor(val, [&rhs](size_t idx, auto &elem) { elem -= std::get<idx>(rhs); }); return *this; } difference_type operator-(const ZipIterator &rhs) const { auto rhsVal = rhs.base(); value_type res; tupleFor(res, [this, &rhsVal](size_t idx, auto &elem) { elem = std::get<idx>(val) - std::get<idx>(rhsVal); }); return res; } ZipIterator operator+(difference_type rhs) const { value_type res; tupleFor(res, [this, &rhs](size_t idx, auto &elem) { elem = std::get<idx>(val) + std::get<idx>(rhs); }); return ZipIterator(res); } ZipIterator operator-(difference_type rhs) const { value_type res; tupleFor(res, [this, &rhs](size_t idx, auto &elem) { elem = std::get<idx>(val) - std::get<idx>(rhs); }); return ZipIterator(res); } friend ZipIterator operator+(difference_type lhs, const ZipIterator &rhs) { return ZipIterator(lhs + rhs); } friend ZipIterator operator-(difference_type lhs, const ZipIterator &rhs) { return ZipIterator(lhs - rhs); } bool operator==(const ZipIterator &rhs) const { return val == rhs.base(); } bool operator!=(const ZipIterator &rhs) const { return val != rhs.base(); } bool operator>(const ZipIterator &rhs) const { return val > rhs.base(); } bool operator<(const ZipIterator &rhs) const { return val < rhs.base(); } bool operator>=(const ZipIterator &rhs) const { return val >= rhs.base(); } bool operator<=(const ZipIterator &rhs) const { return val <= rhs.base(); } }; template<typename T> class Zipper { protected: T beginIter, endIter; public: Zipper() = delete; Zipper(T beginIter, T endIter) : beginIter(beginIter), endIter(endIter) { // } virtual ~Zipper(){ // } const T &begin() const { return beginIter; } const T &end() const { return endIter; } T &begin() { return beginIter; } T &end() { return endIter; } }; template<typename... T> class ZipperFactory { protected: template<typename U, typename... V> static std::vector<size_t> getLengths(std::vector<size_t> lengths, const U &head, const V& ...tail) { lengths.push_back(head.size()); return getLengths(lengths, tail...); } static std::vector<size_t> getLengths(std::vector<size_t> lengths) { return lengths; } template<typename W, typename U, typename... V> static auto getIterators(W tuplePair, size_t maxLen, const U& head, const V& ...tail) { // Get begin iterator. auto iter = head.begin(); auto beginIter = std::tuple_cat(tuplePair.first, std::make_tuple(iter)); // Get truncated end iterator. std::advance(iter, maxLen); auto endIter = std::tuple_cat(tuplePair.second, std::make_tuple(iter)); return getIterators(std::make_pair(beginIter, endIter), maxLen, tail...); } template<typename W> static auto getIterators(W tuplePair, size_t maxLen) { return tuplePair; } public: auto operator()(const T&... containers) const { // Get container lengths and min length. const auto lengths = getLengths(std::vector<size_t>(), containers...); const size_t minLength = *std::min_element(lengths.begin(), lengths.end()); // Get iterators. auto emptyPair = std::make_pair(std::tuple<>(), std::tuple<>()); auto iterators = getIterators(emptyPair, minLength, containers...); // Get begin and end iterators. return Zipper(ZipIterator(iterators.first), ZipIterator(iterators.second)); } }; } #endif
31.582329
122
0.594227
[ "vector" ]
20a4e824cfbeb6019200c5f7b80f9a2635c5896b
5,246
cc
C++
source/common/upstream/ring_hash_lb.cc
Sodman/envoy
9cb135e059ac6af052e5a5aa6c6c279aada1850b
[ "Apache-2.0" ]
null
null
null
source/common/upstream/ring_hash_lb.cc
Sodman/envoy
9cb135e059ac6af052e5a5aa6c6c279aada1850b
[ "Apache-2.0" ]
null
null
null
source/common/upstream/ring_hash_lb.cc
Sodman/envoy
9cb135e059ac6af052e5a5aa6c6c279aada1850b
[ "Apache-2.0" ]
1
2020-12-30T17:12:11.000Z
2020-12-30T17:12:11.000Z
#include "common/upstream/ring_hash_lb.h" #include <cstdint> #include <string> #include <vector> #include "common/common/assert.h" #include "common/upstream/load_balancer_impl.h" namespace Envoy { namespace Upstream { RingHashLoadBalancer::RingHashLoadBalancer( PrioritySet& priority_set, ClusterStats& stats, Runtime::Loader& runtime, Runtime::RandomGenerator& random, const Optional<envoy::api::v2::Cluster::RingHashLbConfig>& config) : host_set_(*priority_set.hostSetsPerPriority()[0]), stats_(stats), runtime_(runtime), random_(random), config_(config) { priority_set.addMemberUpdateCb([this](uint32_t priority, const std::vector<HostSharedPtr>&, const std::vector<HostSharedPtr>&) -> void { // priority!=0 will be blocked by EDS validation. ASSERT(priority == 0); // TODO(alyssawilk) make ring hash LB priority-aware. UNREFERENCED_PARAMETER(priority); refresh(); }); refresh(); } HostConstSharedPtr RingHashLoadBalancer::chooseHost(LoadBalancerContext* context) { if (LoadBalancerUtility::isGlobalPanic(host_set_, runtime_)) { stats_.lb_healthy_panic_.inc(); return all_hosts_ring_.chooseHost(context, random_); } else { return healthy_hosts_ring_.chooseHost(context, random_); } } HostConstSharedPtr RingHashLoadBalancer::Ring::chooseHost(LoadBalancerContext* context, Runtime::RandomGenerator& random) { if (ring_.empty()) { return nullptr; } // If there is no hash in the context, just choose a random value (this effectively becomes // the random LB but it won't crash if someone configures it this way). // computeHashKey() may be computed on demand, so get it only once. Optional<uint64_t> hash; if (context) { hash = context->computeHashKey(); } const uint64_t h = hash.valid() ? hash.value() : random.random(); // Ported from https://github.com/RJ/ketama/blob/master/libketama/ketama.c (ketama_get_server) // I've generally kept the variable names to make the code easier to compare. // NOTE: The algorithm depends on using signed integers for lowp, midp, and highp. Do not // change them! int64_t lowp = 0; int64_t highp = ring_.size(); while (true) { int64_t midp = (lowp + highp) / 2; if (midp == static_cast<int64_t>(ring_.size())) { return ring_[0].host_; } uint64_t midval = ring_[midp].hash_; uint64_t midval1 = midp == 0 ? 0 : ring_[midp - 1].hash_; if (h <= midval && h > midval1) { return ring_[midp].host_; } if (midval < h) { lowp = midp + 1; } else { highp = midp - 1; } if (lowp > highp) { return ring_[0].host_; } } } void RingHashLoadBalancer::Ring::create( const Optional<envoy::api::v2::Cluster::RingHashLbConfig>& config, const std::vector<HostSharedPtr>& hosts) { ENVOY_LOG(trace, "ring hash: building ring"); ring_.clear(); if (hosts.empty()) { return; } // Currently we specify the minimum size of the ring, and determine the replication factor // based on the number of hosts. It's possible we might want to support more sophisticated // configuration in the future. // NOTE: Currently we keep a ring for healthy hosts and unhealthy hosts, and this is done per // thread. This is the simplest implementation, but it's expensive from a memory // standpoint and duplicates the regeneration computation. In the future we might want // to generate the rings centrally and then just RCU them out to each thread. This is // sufficient for getting started. const uint64_t min_ring_size = config.valid() ? PROTOBUF_GET_WRAPPED_OR_DEFAULT(config.value(), minimum_ring_size, 1024) : 1024; uint64_t hashes_per_host = 1; if (hosts.size() < min_ring_size) { hashes_per_host = min_ring_size / hosts.size(); if ((min_ring_size % hosts.size()) != 0) { hashes_per_host++; } } ENVOY_LOG(info, "ring hash: min_ring_size={} hashes_per_host={}", min_ring_size, hashes_per_host); ring_.reserve(hosts.size() * hashes_per_host); const bool use_std_hash = config.valid() ? PROTOBUF_GET_WRAPPED_OR_DEFAULT(config.value().deprecated_v1(), use_std_hash, true) : true; for (const auto& host : hosts) { for (uint64_t i = 0; i < hashes_per_host; i++) { const std::string hash_key(host->address()->asString() + "_" + std::to_string(i)); const uint64_t hash = use_std_hash ? std::hash<std::string>()(hash_key) : HashUtil::xxHash64(hash_key); ENVOY_LOG(trace, "ring hash: hash_key={} hash={}", hash_key, hash); ring_.push_back({hash, host}); } } std::sort(ring_.begin(), ring_.end(), [](const RingEntry& lhs, const RingEntry& rhs) -> bool { return lhs.hash_ < rhs.hash_; }); #ifndef NVLOG for (auto entry : ring_) { ENVOY_LOG(trace, "ring hash: host={} hash={}", entry.host_->address()->asString(), entry.hash_); } #endif } void RingHashLoadBalancer::refresh() { all_hosts_ring_.create(config_, host_set_.hosts()); healthy_hosts_ring_.create(config_, host_set_.healthyHosts()); } } // namespace Upstream } // namespace Envoy
35.208054
100
0.669844
[ "vector" ]
20adf4c88217d738ff068b1e14691e600a85a406
812
cpp
C++
AtCoder/AGC/AGC031/b.cpp
eduidl/procon
a95d33074771281ff135bf199ded8b57788c151d
[ "MIT" ]
null
null
null
AtCoder/AGC/AGC031/b.cpp
eduidl/procon
a95d33074771281ff135bf199ded8b57788c151d
[ "MIT" ]
null
null
null
AtCoder/AGC/AGC031/b.cpp
eduidl/procon
a95d33074771281ff135bf199ded8b57788c151d
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() using namespace std; const int INF = 1 << 25; const int MOD = 1000000007; template <class T> void chmin(T& a, const T& b) { a = min(a, b); } template <class T> void chmax(T& a, const T& b) { a = max(a, b); } int main() { size_t N; cin >> N; int c; vector<int> pos(200001, -1); vector<int> dp(0); for (int i = 0; i < N; ++i) { cin >> c; if (i == 0) { dp.push_back(1); } else if (0 <= pos[c] && pos[c] < i - 1) { dp.push_back((dp[i - 1] + dp[pos[c]]) % MOD); } else { dp.push_back(dp[i - 1]); } pos[c] = i; } cout << dp[N - 1] << endl; }
19.804878
71
0.487685
[ "vector" ]
20b17626e82b584d4cf49f15288950f298cfef28
10,328
cpp
C++
High_int.cpp
XiaoXueTu555/High
ff8734c0299e3b9c5ac9c81e40b1c28862b19b23
[ "BSD-3-Clause" ]
null
null
null
High_int.cpp
XiaoXueTu555/High
ff8734c0299e3b9c5ac9c81e40b1c28862b19b23
[ "BSD-3-Clause" ]
null
null
null
High_int.cpp
XiaoXueTu555/High
ff8734c0299e3b9c5ac9c81e40b1c28862b19b23
[ "BSD-3-Clause" ]
null
null
null
#include <math.h> #include "High_int.h" #define High_int_NULL (High_int)0 /*构造函数*/ High_int::High_int() { this->sign = true; this->data.push_back(0); } High_int::High_int(const int64_t data) { this->sign = true; this->data.push_back(0); *this = data; } /*析构函数*/ High_int::~High_int() { return; } /*赋值运算符重载*/ High_int High_int::operator=(int64_t data) { High_int result; result.Data().clear(); result.Sign() = (data >= 0) ? true : false; data = abs(data); while (data >= 10) { result.Data().push_back(data % 10); data /= 10; } result.Data().push_back((char)data); *this = result; for (int64_t i = 0; i != result.Data().size(); i++) { this->Data().at(i) = result.Data().at(result.Data().size() - 1 - i); } return *this; } High_int High_int::operator=(High_int data) { this->sign = data.sign; this->data = data.data; return *this; } /*转换函数*/ High_int::operator int64_t() { int64_t data = 0; int64_t multiple = 1; for (int64_t i = this->Data().size() - 1; i > 0; i--) { data += this->Data().at(i) * multiple; multiple *= 10; } data += this->Data().at(0) * multiple; if (this->Sign() == false) data = -data; return data; } /*判断运算符重载*/ bool High_int::operator==(High_int data) { return (this->data == data.data && this->sign == data.sign) ? true : false; } bool High_int::operator!=(High_int data) { return (*this == data) ? false : true; } bool High_int::operator>(High_int data) { if (this->sign > data.sign) return true; else if (this->sign < data.sign) return false; else if (this->sign == true && data.sign == true) { if (this->data.size() > data.Data().size()) return true; if (this->data.size() < data.Data().size()) return false; for (uint64_t i = 0; i < this->data.size(); i++) { if (this->data.at(i) > data.Data().at(i)) return true; else if (this->data.at(i) < data.Data().at(i)) return false; } } else if (this->sign == false && data.sign == false) { if (this->data.size() > data.Data().size()) return false; if (this->data.size() < data.Data().size()) return true; for (uint64_t i = 0; i < this->data.size(); i++) { if (this->data.at(i) > data.Data().at(i)) return false; else if (this->data.at(i) < data.Data().at(i)) return true; } } return false; } bool High_int::operator>=(High_int data) { return (*this > data || *this == data) ? true : false; } bool High_int::operator<(High_int data) { return (*this >= data) ? false : true; } bool High_int::operator<=(High_int data) { return (*this < data || *this == data) ? true : false; } /*四则运算符重载*/ High_int High_int::operator+(High_int b) { High_int result; if (*this == High_int_NULL) return b; else if (b == High_int_NULL) return *this; if (*this >= High_int_NULL && b < High_int_NULL) { b.sign = true; return *this - b; } else if (*this < High_int_NULL && b >= High_int_NULL) { result = *this; result.sign = true; result -= b; result.sign = false; return result; } else if (*this < High_int_NULL && b < High_int_NULL) { this->sign = true; b.Sign() = true; result = *this + b; result.sign = false; this->sign = false; return result; } if (*this < b) return b + *this; b.AlignToSuitableSize(*this); result.AlignToSuitableSize(*this); for (uint64_t i = 0; i < this->data.size(); i++) { result.Data().at(this->data.size() - 1 - i) += this->data.at(this->data.size() - 1 - i) + b.Data().at(this->data.size() - 1 - i); if (result.Data().at(this->data.size() - 1 - i) >= 10 && (this->data.size() - 1 - i) == 0) { result.Data().at(this->data.size() - 1 - i) -= 10; result.Data().insert(result.Data().begin(), 1); } else if (result.Data().at(this->data.size() - 1 - i) >= 10) { result.Data().at(this->data.size() - 1 - i) -= 10; ++result.Data().at(this->data.size() - 2 - i); } } return result; } High_int High_int::operator-(High_int b) { if (*this >= High_int_NULL && b < High_int_NULL) { b.sign = true; return *this + b; } else if (*this < High_int_NULL && b >= High_int_NULL) { this->sign = true; High_int result = *this + b; result.sign = false; this->sign = false; return result; } else if (*this < High_int_NULL && b < High_int_NULL) { this->sign = true; b.sign = true; High_int result = b - *this; this->sign = false; return result; } if (*this < b) { High_int result = b - *this; result.sign = false; return result; } High_int a = *this; High_int result; a.AlignToSuitableSize(b); a.AlignToSuitableSize(result); for (uint64_t i = 0; i < a.data.size(); i++) { if (a.Data().at(a.Data().size() - 1 - i) < b.Data().at(a.Data().size() - 1 - i)) { a.Data().at(a.Data().size() - 1 - i) += 10; --a.Data().at(a.Data().size() - 2 - i); } result.Data().at(a.Data().size() - 1 - i) += a.Data().at(a.Data().size() - 1 - i) - b.Data().at(a.Data().size() - 1 - i); } result.Shrink_to_fit(); return result; } High_int High_int::operator*(High_int b) { High_int result; High_int temp_result; int64_t a_size = this->data.size(); int64_t b_size = b.Data().size(); if (*this == High_int_NULL || b == High_int_NULL) { return result; } if (*this < High_int_NULL && b >= High_int_NULL) { result = *this; result.Sign() = true; result *= b; result.Sign() = false; return result; } else if (*this > High_int_NULL && b < High_int_NULL) { b.sign = true; result = *this * b; result.sign = false; return result; } else if (*this < High_int_NULL && b < High_int_NULL) { b.sign = true; result = *this; result.sign = true; result *= b; return result; } if (*this < b) return b * *this; this->AlignToSuitableSize(b); this->AlignToSuitableSize(temp_result); for (int64_t i = 0; i < b_size; i++) { for (int64_t j = 0; j < a_size; j++) { temp_result.Data().at(this->data.size() - 1 - j) += b.Data().at(this->data.size() - 1 - i) * this->data.at(this->data.size() - 1 - j); if (temp_result.Data().at(this->data.size() - 1 - j) >= 10 && this->data.size() - 1 - j == 0) { temp_result.Data().insert(temp_result.data.begin(), temp_result.Data().at(this->data.size() - 1 - j) / 10); temp_result.Data().at(this->data.size() - j) %= 10; } else if (temp_result.Data().at(this->data.size() - 1 - j) >= 10) { temp_result.Data().at(this->data.size() - 2 - j) += temp_result.Data().at(this->data.size() - 1 - j) / 10; temp_result.Data().at(this->data.size() - 1 - j) %= 10; } } temp_result.Data().insert(temp_result.Data().end(), i, 0); result += temp_result; temp_result = 0; this->AlignToSuitableSize(temp_result); } result.Shrink_to_fit(); return result; } High_int High_int::operator/(High_int b) { if (b == High_int_NULL) throw "Division by zero condition!"; High_int result; High_int remainder; uint64_t align_position = 0; uint64_t temp_record = 0; result.Data().clear(); remainder.Data().clear(); if (*this == High_int_NULL) return High_int_NULL; if (*this > High_int_NULL && b < High_int_NULL) { b.sign = true; result = *this / b; result.sign = false; return result; } else if (*this < High_int_NULL && b >= High_int_NULL) { result = *this; result.Sign() = true; result /= b; if (result == High_int_NULL) return result; result.sign = false; return result; } else if (*this < High_int_NULL && b < High_int_NULL) { result = *this; result.sign = true; b.sign = true; return result / b; } while (remainder < b) { if (temp_record == this->data.size()) break; remainder.Data().push_back(this->data.at(temp_record++)); } align_position = remainder.data.size() - 1; while (result.data.size() + align_position < this->data.size()) { result.Data().push_back(remainder.basic_Division(b)); remainder -= (High_int)result.Data().at(result.Data().size() - 1) * b; if (remainder.data.size() == 1 && remainder.data.at(0) == 0) remainder.data.clear(); while (remainder < b) { if (temp_record == this->data.size()) break; remainder.Data().push_back(this->data.at(temp_record++)); if (remainder < b) result.data.push_back(0); } remainder.Shrink_to_fit(); } return result; } High_int High_int::operator%(High_int b) { return *this - ((*this / b) * b); } High_int High_int::operator++() { *this += (High_int)1; return *this; } High_int High_int::operator++(int) { High_int temp = *this; *this += (High_int)1; return temp; } High_int High_int::operator--() { *this -= (High_int)1; return *this; } High_int High_int::operator--(int) { High_int temp = *this; *this -= (High_int)1; return temp; } High_int High_int::operator+=(High_int data) { *this = *this + data; return *this; } High_int High_int::operator-=(High_int data) { *this = *this - data; return *this; } High_int High_int::operator*=(High_int data) { *this = *this * data; return *this; } High_int High_int::operator/=(High_int data) { *this = *this / data; return *this; } High_int High_int::operator%=(High_int data) { *this = *this % data; return *this; } bool& High_int::Sign() { return this->sign; } std::vector<char>& High_int::Data() { return this->data; } void High_int::private_Shrink_to_fit() { this->Shrink_to_fit(); } void High_int::AlignToSuitableSize(High_int& data) { if (*this > data) data.Data().insert(data.Data().begin(), this->data.size() - data.Data().size(), 0); else if (*this < data) data.AlignToSuitableSize(*this); return; } void High_int::Shrink_to_fit() { if (this->data.size() == 0) { this->data.push_back(0); return; } while (this->data.at(0) == 0 && *this != High_int_NULL) { this->data.erase(this->data.begin()); } return; } char High_int::basic_Division(High_int b) { char result = 0; if (*this < b) return result; High_int temp; while (temp <= *this) { temp += b; ++result; } if (temp > b) --result; return result; }
22.16309
112
0.581816
[ "vector" ]