hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
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
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
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
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
6c3b6618016e83ba579608bf99dd63f2e7066503
2,905
hpp
C++
include/Ephippion/Transforms/SymbolicEncapsulation.hpp
compor/Ephippion
42e4270e14489ba93b935c8973adf13525c067bd
[ "MIT" ]
null
null
null
include/Ephippion/Transforms/SymbolicEncapsulation.hpp
compor/Ephippion
42e4270e14489ba93b935c8973adf13525c067bd
[ "MIT" ]
1
2019-09-17T15:40:15.000Z
2019-09-17T15:42:03.000Z
include/Ephippion/Transforms/SymbolicEncapsulation.hpp
compor/Ephippion
42e4270e14489ba93b935c8973adf13525c067bd
[ "MIT" ]
null
null
null
// // // #pragma once #include "Ephippion/Config.hpp" #include "Ephippion/Support/IR/ArgSpec.hpp" #include "llvm/IR/LLVMContext.h" // using llvm::LLVMContext #include "llvm/IR/Function.h" // using llvm::Function #include "llvm/IR/Type.h" // using llvm::Type #include "llvm/IR/DerivedTypes.h" // using llvm::FunctionType #include "llvm/ADT/ArrayRef.h" // using llvm::ArrayRef #include "llvm/ADT/SmallVector.h" // using llvm::SmallVectorImpl #include "llvm/ADT/StringRef.h" // using llvm::StringRef #include <string> // using std::string #include <cstdint> // using uint32_t namespace llvm { class Module; class Function; } // namespace llvm namespace ephippion { class SymbolicEncapsulation { public: using IterationsNumTy = uint32_t; private: llvm::StringRef HarnessNamePrefix; llvm::StringRef HeapAllocFuncName; llvm::StringRef HeapDeallocFuncName; void setupHarnessArgs(llvm::Function &EncapsulatedFunc, llvm::ArrayRef<ArgSpec> ArgSpecs, llvm::BasicBlock &SetupBlock, llvm::BasicBlock &TeardownBlock, IterationsNumTy IterationsNum, llvm::SmallVectorImpl<llvm::Value *> &CallArgs1, llvm::SmallVectorImpl<llvm::Value *> &CallArgs2); void createSymbolicDeclarations(llvm::BasicBlock &Block, llvm::Function &Func, llvm::SmallVectorImpl<llvm::Value *> &Values1, llvm::SmallVectorImpl<llvm::Value *> &Values2, IterationsNumTy IterationsNum, llvm::ArrayRef<ArgSpec> ArgSpecs); void createSymbolicAssertions(llvm::BasicBlock &StartBlock, llvm::BasicBlock &EndBlock, llvm::SmallVectorImpl<llvm::Value *> &Values1, llvm::SmallVectorImpl<llvm::Value *> &Values2, IterationsNumTy IterationsNum, llvm::ArrayRef<ArgSpec> ArgSpecs); void createCall(llvm::BasicBlock &Block, llvm::Function &EncapsulatedFunc, llvm::SmallVectorImpl<llvm::Value *> &Args); bool encapsulateImpl(llvm::Function &F, IterationsNumTy IterationsNum, llvm::ArrayRef<ArgSpec> ArgSpecs); public: explicit SymbolicEncapsulation(llvm::StringRef Prefix = "symenc_") : HarnessNamePrefix{Prefix}, HeapAllocFuncName{"malloc"}, HeapDeallocFuncName{"free"} {} SymbolicEncapsulation(const SymbolicEncapsulation &) = default; bool encapsulate(llvm::Module &M, IterationsNumTy IterationsNum); bool encapsulate(llvm::Function &F, IterationsNumTy IterationsNum); bool encapsulate(llvm::Function &F, IterationsNumTy IterationsNum, llvm::ArrayRef<ArgSpec> ArgSpecs); }; } // namespace ephippion
30.578947
80
0.632358
compor
6c3fc4b656007efe9ec562ff6fa757b8b73440de
544
cpp
C++
Templates/Verve/source/Verve/Extension/Game/VSpawnSphereGroup.cpp
AnteSim/Verve
22a55d182f86e3d7684fdc52f628ca57837cac8a
[ "MIT" ]
1
2021-01-02T09:17:18.000Z
2021-01-02T09:17:18.000Z
Templates/Verve/source/Verve/Extension/Game/VSpawnSphereGroup.cpp
AnteSim/Verve
22a55d182f86e3d7684fdc52f628ca57837cac8a
[ "MIT" ]
null
null
null
Templates/Verve/source/Verve/Extension/Game/VSpawnSphereGroup.cpp
AnteSim/Verve
22a55d182f86e3d7684fdc52f628ca57837cac8a
[ "MIT" ]
4
2015-05-16T17:35:07.000Z
2021-01-02T09:17:26.000Z
//----------------------------------------------------------------------------- // Verve // Copyright (C) - Violent Tulip //----------------------------------------------------------------------------- #include "Verve/Extension/Game/VSpawnSphereGroup.h" //----------------------------------------------------------------------------- IMPLEMENT_CONOBJECT( VSpawnSphereGroup ); //----------------------------------------------------------------------------- VSpawnSphereGroup::VSpawnSphereGroup( void ) { setLabel( "SpawnSphereGroup" ); };
36.266667
79
0.308824
AnteSim
6c404f5a6892fa8033a0fa55d649fa1815251506
5,206
hpp
C++
libnhttp/nhttp/server/xfwk/xfwk_target.hpp
jay94ks/libnhttp
a244eb2d04c339454ef4831b43d1ab270ee7d13d
[ "MIT" ]
4
2021-04-11T22:46:13.000Z
2021-05-27T06:01:37.000Z
libnhttp/nhttp/server/xfwk/xfwk_target.hpp
jay94ks/libnhttp
a244eb2d04c339454ef4831b43d1ab270ee7d13d
[ "MIT" ]
3
2021-05-26T04:16:56.000Z
2021-05-27T04:34:14.000Z
libnhttp/nhttp/server/xfwk/xfwk_target.hpp
jay94ks/libnhttp
a244eb2d04c339454ef4831b43d1ab270ee7d13d
[ "MIT" ]
1
2021-04-11T22:46:15.000Z
2021-04-11T22:46:15.000Z
#pragma once #include "../http_context.hpp" #include "../../utils/this_ptr.hpp" #include "xfwk_facade.hpp" namespace nhttp { namespace server { namespace xfwk { class xfwk_target; using xfwk_target_ptr = std::shared_ptr<xfwk_target>; class xfwk_middleware_stack; /** * class xfwk_target. * a resource target for single. */ class NHTTP_API xfwk_target : public xfwk_facade_middlewares { private: std::shared_ptr<xfwk_middleware_stack> middlewares; public: virtual ~xfwk_target() { } public: /** * -- xfwk_facade_middlewares interface -- * get or set middleware stack. @warn: DO NOT set under routing process! */ virtual std::shared_ptr<xfwk_middleware_stack> get_middlewares() const override { return middlewares; } virtual void set_middlewares(const std::shared_ptr<xfwk_middleware_stack>& middlewares) override { this->middlewares = middlewares; } public: /* determines this target is unified or not. */ virtual bool is_unifed() const { return false; } /* handle request and generate response. */ virtual http_response_ptr handle(http_request_ptr request) const = 0; }; /** * class xfwk_lambda_target. * a resource target by lambda expression. */ template<typename lambda_type> class NHTTP_API xfwk_lambda_target : public xfwk_target { private: lambda_type lambda; public: xfwk_lambda_target(lambda_type&& lambda) : lambda(std::forward<lambda_type>(lambda)) { } public: virtual http_response_ptr handle(http_request_ptr request) const override { return lambda(request); } }; /* create a target with lambda expression. */ template<typename lambda_type> inline auto target_by(lambda_type&& lambda) { return std::make_shared<xfwk_lambda_target<lambda_type>>(std::move(lambda)); } /** * class xfwk_method_target. * a resource target by class method. */ template<typename class_type> class NHTTP_API xfwk_method_target : public xfwk_target { public: typedef http_response_ptr(class_type::* method)(http_request_ptr); typedef http_response_ptr(class_type::* const_method)(http_request_ptr) const; private: std::shared_ptr<class_type> instance; int32_t type; union { method _method; const_method _const_method; } target; public: xfwk_method_target(std::shared_ptr<class_type> instance, method _method) : instance(instance), type(0) { target._method = _method; } xfwk_method_target(std::shared_ptr<class_type> instance, const_method _const_method) : instance(instance), type(1) { target._const_method = _const_method; } public: virtual http_response_ptr handle(http_request_ptr request) const override { if (type) { const class_type* obj = instance.get(); const_method mptr = target._const_method; return (obj->*mptr)(request); } else { class_type* obj = instance.get(); method mptr = target._method; return (obj->*mptr)(request); } } }; /* create a target with an object and its method. */ template<typename class_type> inline auto target_by(std::shared_ptr<class_type> instance, http_response_ptr(class_type::* method)(http_request_ptr)) { return std::make_shared<xfwk_method_target<class_type>>(instance, method); } /* create a target with an object and its method. */ template<typename class_type> inline auto target_by(std::shared_ptr<class_type> instance, http_response_ptr(class_type::* method)(http_request_ptr) const) { return std::make_shared<xfwk_method_target<class_type>>(instance, method); } /** * class xfwk_unified_target. * a collection of resource targets that implement individual methods. */ class NHTTP_API xfwk_unified_target : public xfwk_target { private: std::map<http_method, xfwk_target_ptr> targets; public: virtual ~xfwk_unified_target() { } public: /* determines this target is unified or not. */ virtual bool is_unifed() const { return true; } /* determines a target implemented for method or not. */ inline bool has_target_for(const http_method& method) const { return targets.find(method) != targets.end(); } /* get target for method. */ inline xfwk_target_ptr get_target_for(const http_method& method) const { auto i = targets.find(method); if (i != targets.end()) return i->second; return nullptr; } /* set target for method. */ inline this_ptr<xfwk_unified_target> set_target_for(const http_method& method, xfwk_target_ptr target) { if (target) targets.emplace(method, target); else unset_target_for(method); return this; } /* unset target for method. */ inline this_ptr<xfwk_unified_target> unset_target_for(const http_method& method) { auto i = targets.find(method); if (i != targets.end()) targets.erase(method); return this; } public: /* call individual method for handling the request. */ virtual http_response_ptr handle(http_request_ptr request) const { auto i = targets.find(request->get_target().get_method()); if (i != targets.end() && i->second) { return i->second->handle(request); } if (targets.size()) /* if other methods implemented, */ return make_response(405); /* otherwise, returns no response. */ return nullptr; } }; } } }
27.256545
135
0.722244
jay94ks
6c44653bc9d9db9b5c5ac483d1111af104d42285
422
cpp
C++
Recursion/static_global.cpp
M1NH42/learn-dsa
70b5011a83dd5c29d39b754ed856cb9e023511f3
[ "MIT" ]
null
null
null
Recursion/static_global.cpp
M1NH42/learn-dsa
70b5011a83dd5c29d39b754ed856cb9e023511f3
[ "MIT" ]
null
null
null
Recursion/static_global.cpp
M1NH42/learn-dsa
70b5011a83dd5c29d39b754ed856cb9e023511f3
[ "MIT" ]
null
null
null
// program shows the working of static and globalvariable in recursion #include<bits/stdc++.h> using namespace std; int fun(int n) { static int x = 0; if(n>0) { x++; //here x becomes 5 by incrementing each time the fun is called return fun(n-1)+x; // x is called in returning phase } return 0; } int main() { int i; cin>>i; cout<<fun(i); // returns 25 return 0; }
15.62963
75
0.590047
M1NH42
6c45a49709c95593420abe453adc3a2c24bc62d6
1,311
cpp
C++
chapter06/assignment/assign6.11.6.cpp
chuckbruno/cpp
5df742c15d463a46351bd72b5c58144086b0a9d2
[ "Apache-2.0" ]
null
null
null
chapter06/assignment/assign6.11.6.cpp
chuckbruno/cpp
5df742c15d463a46351bd72b5c58144086b0a9d2
[ "Apache-2.0" ]
null
null
null
chapter06/assignment/assign6.11.6.cpp
chuckbruno/cpp
5df742c15d463a46351bd72b5c58144086b0a9d2
[ "Apache-2.0" ]
null
null
null
#include <iostream> #include <string> struct patron { std::string name; double donation; }; const int Maxnum = 5; int main() { int i = 0; int num; std::cout << "Enter the donation num: " << std::endl; std::cin >> num; patron** parPtr = new patron*[num]; std::cout << "Input patron name and donation: " << std::endl; while(i < num) { patron* paPtr = new patron(); std::cin >> paPtr->name >> paPtr->donation; parPtr[i] = paPtr; i++; } std::cout << "Grand Patrons: " << std::endl; int check = 0; for(int i =0; i < num; i++) { if (parPtr[i]->donation > 10000){ std::cout << parPtr[i]->name << ": " << parPtr[i]->donation << std::endl; check += 1; } } if (check == 0) { std::cout << "None" << std::endl; } check = 0; std::cout << "Patrons: " << std::endl; for(int i=0; i < num; i++) { if(parPtr[i]->donation < 10000) { std::cout << parPtr[i]->name << ": " << parPtr[i]->donation << std::endl; check += 1; } } if (check == 0) std::cout << "None" << std::endl; for(int i = 0; i < num; i++) { delete parPtr[i]; } delete[] parPtr; return 0; }
19
85
0.455378
chuckbruno
6c4a53df574b09c5c1a211628f4a1e74dd9e3f1d
641
hpp
C++
danger/cfgFunctions.hpp
genesis92x/LambsMods
d7a281ef74b1927ea3e8aba1063feeab2a97593a
[ "Unlicense" ]
1
2021-07-10T10:06:23.000Z
2021-07-10T10:06:23.000Z
danger/cfgFunctions.hpp
genesis92x/LambsMods
d7a281ef74b1927ea3e8aba1063feeab2a97593a
[ "Unlicense" ]
null
null
null
danger/cfgFunctions.hpp
genesis92x/LambsMods
d7a281ef74b1927ea3e8aba1063feeab2a97593a
[ "Unlicense" ]
null
null
null
class cfgFunctions { class lambs_danger { tag = "lambs_danger"; class functions { file = "danger\functions"; class assault; class assaultBuilding; class assaultVehicle; class checkBody; class coward; class gesture; class hideInside; class nearBuildings; class panic; class rotateVehicle; class shareInformation; class suppress; class suppressVehicle; class zettings {preinit = 1;}; }; }; };
29.136364
50
0.477379
genesis92x
6c4fe7953608550de68d8d774e3a2970c21568be
41,767
cpp
C++
Source/main.cpp
playmer/PadInput
eb1b11ef8de9234f0c1d9d8819dba5d3bb3cc5d8
[ "MIT" ]
null
null
null
Source/main.cpp
playmer/PadInput
eb1b11ef8de9234f0c1d9d8819dba5d3bb3cc5d8
[ "MIT" ]
null
null
null
Source/main.cpp
playmer/PadInput
eb1b11ef8de9234f0c1d9d8819dba5d3bb3cc5d8
[ "MIT" ]
null
null
null
#include <stdio.h> #include <cstdint> #include <iostream> #include <array> #include <filesystem> #include <set> #include <string> #include <algorithm> #include <iostream> #include <vector> #include <functional> #include <tuple> #include <charconv> #include <fstream> #include "SOIS/ImGuiSample.hpp" #include "SOIS/ApplicationContext.hpp" #include "imgui_node_editor/Source/crude_json.h" #include "imgui_node_editor.h" #include "imgui/imgui_stdlib.h" #include "imgui/imgui_internal.h" #include "nfd.h" #include "SendEvents.hpp" template <typename T, typename TIter = decltype(std::begin(std::declval<T>())), typename = decltype(std::end(std::declval<T>()))> constexpr auto enumerate(T && iterable) { struct iterator { size_t i; TIter iter; bool operator != (const iterator & other) const { return iter != other.iter; } void operator ++ () { ++i; ++iter; } auto operator * () const { return std::tie(i, *iter); } }; struct iterable_wrapper { T iterable; auto begin() { return iterator{ 0, std::begin(iterable) }; } auto end() { return iterator{ 0, std::end(iterable) }; } }; return iterable_wrapper{ std::forward<T>(iterable) }; } struct SplitGenerator { SplitGenerator(std::string_view aText, std::string_view aDelimiter) : mText{ aText } , mDelimiter{ aDelimiter } , mIndex{ 0 } { } std::string_view operator()() { std::string_view toReturn; if (mIndex > mText.size()) { return toReturn; } const auto second = mText.find_first_of(mDelimiter, mIndex); if (mIndex != second) { toReturn = mText.substr(mIndex, second-mIndex); } //if (second == std::string_view::npos) //{ // break; //} mIndex = second + mDelimiter.size(); return toReturn; } std::string_view mText; std::string_view mDelimiter; size_t mIndex; }; std::string_view ChooseNewlineStyle(std::string_view aText) { if (std::string_view::npos != aText.find_first_of("\r\n", 0)) { return "\r\n"; } else { return "\n"; } } // Modified from SDL Documentation: https://wiki.libsdl.org/SDL_RWread std::vector<char> file_read(const char* filename) { std::vector<char> toReturn; SDL_RWops* rw = SDL_RWFromFile(filename, "rb"); if (rw == nullptr) { return toReturn; } Sint64 res_size = SDL_RWsize(rw); toReturn.resize(res_size + 1); Sint64 nb_read_total = 0, nb_read = 1; char* buf = toReturn.data(); while (nb_read_total < res_size && nb_read != 0) { nb_read = SDL_RWread(rw, buf, 1, (res_size - nb_read_total)); nb_read_total += nb_read; buf += nb_read; } SDL_RWclose(rw); if (nb_read_total != res_size) { toReturn.resize(0); return toReturn; } toReturn[nb_read_total] = '\0'; toReturn.resize(nb_read_total); return toReturn; } std::string GetImGuiIniPath() { auto sdlIniPath = SDL_GetPrefPath("PlaymerTools", "PadInput"); std::filesystem::path path{ sdlIniPath }; SDL_free(sdlIniPath); path /= "imgui.ini"; return path.u8string(); } constexpr const char* ConvertToString(Uint8 aButton) { switch (aButton) { case SDL_CONTROLLER_BUTTON_A: return "SDL_CONTROLLER_BUTTON_A"; case SDL_CONTROLLER_BUTTON_B: return "SDL_CONTROLLER_BUTTON_B"; case SDL_CONTROLLER_BUTTON_X: return "SDL_CONTROLLER_BUTTON_X"; case SDL_CONTROLLER_BUTTON_Y: return "SDL_CONTROLLER_BUTTON_Y"; case SDL_CONTROLLER_BUTTON_BACK: return "SDL_CONTROLLER_BUTTON_BACK"; case SDL_CONTROLLER_BUTTON_GUIDE: return "SDL_CONTROLLER_BUTTON_GUIDE"; case SDL_CONTROLLER_BUTTON_START: return "SDL_CONTROLLER_BUTTON_START"; case SDL_CONTROLLER_BUTTON_LEFTSTICK: return "SDL_CONTROLLER_BUTTON_LEFTSTICK"; case SDL_CONTROLLER_BUTTON_RIGHTSTICK: return "SDL_CONTROLLER_BUTTON_RIGHTSTICK"; case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: return "SDL_CONTROLLER_BUTTON_LEFTSHOULDER"; case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: return "SDL_CONTROLLER_BUTTON_RIGHTSHOULDER"; case SDL_CONTROLLER_BUTTON_DPAD_UP: return "SDL_CONTROLLER_BUTTON_DPAD_UP"; case SDL_CONTROLLER_BUTTON_DPAD_DOWN: return "SDL_CONTROLLER_BUTTON_DPAD_DOWN"; case SDL_CONTROLLER_BUTTON_DPAD_LEFT: return "SDL_CONTROLLER_BUTTON_DPAD_LEFT"; case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: return "SDL_CONTROLLER_BUTTON_DPAD_RIGHT"; } return "ERROR"; } constexpr size_t ConvertToIndex(Uint8 aButton) { switch (aButton) { case SDL_CONTROLLER_BUTTON_A: return 0; case SDL_CONTROLLER_BUTTON_B: return 1; case SDL_CONTROLLER_BUTTON_X: return 2; case SDL_CONTROLLER_BUTTON_Y: return 3; case SDL_CONTROLLER_BUTTON_BACK: return 4; case SDL_CONTROLLER_BUTTON_GUIDE: return 5; case SDL_CONTROLLER_BUTTON_START: return 6; case SDL_CONTROLLER_BUTTON_LEFTSTICK: return 7; case SDL_CONTROLLER_BUTTON_RIGHTSTICK: return 8; case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: return 9; case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: return 10; case SDL_CONTROLLER_BUTTON_DPAD_UP: return 11; case SDL_CONTROLLER_BUTTON_DPAD_DOWN: return 12; case SDL_CONTROLLER_BUTTON_DPAD_LEFT: return 13; case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: return 14; } return static_cast<size_t>(-1); } Uint8 from_string_to_gamepad(std::string_view aValue) { if (aValue == "SDL_CONTROLLER_BUTTON_A") return SDL_CONTROLLER_BUTTON_A; else if (aValue == "SDL_CONTROLLER_BUTTON_B") return SDL_CONTROLLER_BUTTON_B; else if (aValue == "SDL_CONTROLLER_BUTTON_X") return SDL_CONTROLLER_BUTTON_X; else if (aValue == "SDL_CONTROLLER_BUTTON_Y") return SDL_CONTROLLER_BUTTON_Y; else if (aValue == "SDL_CONTROLLER_BUTTON_BACK") return SDL_CONTROLLER_BUTTON_BACK; else if (aValue == "SDL_CONTROLLER_BUTTON_GUIDE") return SDL_CONTROLLER_BUTTON_GUIDE; else if (aValue == "SDL_CONTROLLER_BUTTON_START") return SDL_CONTROLLER_BUTTON_START; else if (aValue == "SDL_CONTROLLER_BUTTON_LEFTSTICK") return SDL_CONTROLLER_BUTTON_LEFTSTICK; else if (aValue == "SDL_CONTROLLER_BUTTON_RIGHTSTICK") return SDL_CONTROLLER_BUTTON_RIGHTSTICK; else if (aValue == "SDL_CONTROLLER_BUTTON_LEFTSHOULDER") return SDL_CONTROLLER_BUTTON_LEFTSHOULDER; else if (aValue == "SDL_CONTROLLER_BUTTON_RIGHTSHOULDER") return SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; else if (aValue == "SDL_CONTROLLER_BUTTON_DPAD_UP") return SDL_CONTROLLER_BUTTON_DPAD_UP; else if (aValue == "SDL_CONTROLLER_BUTTON_DPAD_DOWN") return SDL_CONTROLLER_BUTTON_DPAD_DOWN; else if (aValue == "SDL_CONTROLLER_BUTTON_DPAD_LEFT") return SDL_CONTROLLER_BUTTON_DPAD_LEFT; else if (aValue == "SDL_CONTROLLER_BUTTON_DPAD_RIGHT") return SDL_CONTROLLER_BUTTON_DPAD_RIGHT; else __debugbreak(); return 0; } Uint8 from_string_to_mouse(std::string_view aValue) { if (aValue == "SDL_BUTTON_LEFT") return SDL_BUTTON_LEFT; else if (aValue == "SDL_BUTTON_RIGHT") return SDL_BUTTON_RIGHT; else if (aValue == "SDL_BUTTON_MIDDLE") return SDL_BUTTON_MIDDLE; else if (aValue == "SDL_BUTTON_X1") return SDL_BUTTON_X1; else if (aValue == "SDL_BUTTON_X2") return SDL_BUTTON_X2; else __debugbreak(); return 0; } int64_t from_string_to_keyboard(std::string_view aValue) { if (aValue == "SDLK_a") return SDLK_a; else if (aValue == "SDLK_b") return SDLK_b; else if (aValue == "SDLK_c") return SDLK_c; else if (aValue == "SDLK_d") return SDLK_d; else if (aValue == "SDLK_e") return SDLK_e; else if (aValue == "SDLK_f") return SDLK_f; else if (aValue == "SDLK_g") return SDLK_g; else if (aValue == "SDLK_h") return SDLK_h; else if (aValue == "SDLK_i") return SDLK_i; else if (aValue == "SDLK_j") return SDLK_j; else if (aValue == "SDLK_k") return SDLK_k; else if (aValue == "SDLK_l") return SDLK_l; else if (aValue == "SDLK_m") return SDLK_m; else if (aValue == "SDLK_n") return SDLK_n; else if (aValue == "SDLK_o") return SDLK_o; else if (aValue == "SDLK_p") return SDLK_p; else if (aValue == "SDLK_q") return SDLK_q; else if (aValue == "SDLK_r") return SDLK_r; else if (aValue == "SDLK_s") return SDLK_s; else if (aValue == "SDLK_t") return SDLK_t; else if (aValue == "SDLK_u") return SDLK_u; else if (aValue == "SDLK_v") return SDLK_v; else if (aValue == "SDLK_w") return SDLK_w; else if (aValue == "SDLK_x") return SDLK_x; else if (aValue == "SDLK_y") return SDLK_y; else if (aValue == "SDLK_z") return SDLK_z; else if (aValue == "SDLK_1") return SDLK_1; else if (aValue == "SDLK_2") return SDLK_2; else if (aValue == "SDLK_3") return SDLK_3; else if (aValue == "SDLK_4") return SDLK_4; else if (aValue == "SDLK_5") return SDLK_5; else if (aValue == "SDLK_6") return SDLK_6; else if (aValue == "SDLK_7") return SDLK_7; else if (aValue == "SDLK_8") return SDLK_8; else if (aValue == "SDLK_9") return SDLK_9; else if (aValue == "SDLK_0") return SDLK_0; else if (aValue == "SDLK_RETURN") return SDLK_RETURN; else if (aValue == "SDLK_ESCAPE") return SDLK_ESCAPE; else if (aValue == "SDLK_BACKSPACE") return SDLK_BACKSPACE; else if (aValue == "SDLK_TAB") return SDLK_TAB; else if (aValue == "SDLK_SPACE") return SDLK_SPACE; else if (aValue == "SDLK_MINUS") return SDLK_MINUS; else if (aValue == "SDLK_KP_PLUS") return SDLK_KP_PLUS; else if (aValue == "SDLK_PERIOD") return SDLK_PERIOD; else if (aValue == "SDLK_PAUSE") return SDLK_PAUSE; else if (aValue == "SDLK_EQUALS") return SDLK_EQUALS; else if (aValue == "SDLK_LEFTBRACKET") return SDLK_LEFTBRACKET; else if (aValue == "SDLK_RIGHTBRACKET") return SDLK_RIGHTBRACKET; else if (aValue == "SDLK_BACKSLASH") return SDLK_BACKSLASH; else if (aValue == "SDLK_SEMICOLON") return SDLK_SEMICOLON; else if (aValue == "SDLK_QUOTE") return SDLK_QUOTE; else if (aValue == "SDLK_BACKQUOTE") return SDLK_BACKQUOTE; else if (aValue == "SDLK_COMMA") return SDLK_COMMA; else if (aValue == "SDLK_SLASH") return SDLK_SLASH; else if (aValue == "SDLK_PRINTSCREEN") return SDLK_PRINTSCREEN; else if (aValue == "SDLK_INSERT") return SDLK_INSERT; else if (aValue == "SDLK_DELETE") return SDLK_DELETE; else if (aValue == "SDLK_PAGEUP") return SDLK_PAGEUP; else if (aValue == "SDLK_PAGEDOWN") return SDLK_PAGEDOWN; else if (aValue == "SDLK_HOME") return SDLK_HOME; else if (aValue == "SDLK_END") return SDLK_END; else if (aValue == "SDLK_UP") return SDLK_UP; else if (aValue == "SDLK_DOWN") return SDLK_DOWN; else if (aValue == "SDLK_RIGHT") return SDLK_RIGHT; else if (aValue == "SDLK_LEFT") return SDLK_LEFT; else if (aValue == "SDLK_CAPSLOCK") return SDLK_CAPSLOCK; else if (aValue == "SDLK_SCROLLLOCK") return SDLK_SCROLLLOCK; else if (aValue == "SDLK_NUMLOCKCLEAR") return SDLK_NUMLOCKCLEAR; else if (aValue == "SDLK_KP_DIVIDE") return SDLK_KP_DIVIDE; else if (aValue == "SDLK_KP_MULTIPLY") return SDLK_KP_MULTIPLY; else if (aValue == "SDLK_KP_1") return SDLK_KP_1; else if (aValue == "SDLK_KP_2") return SDLK_KP_2; else if (aValue == "SDLK_KP_3") return SDLK_KP_3; else if (aValue == "SDLK_KP_4") return SDLK_KP_4; else if (aValue == "SDLK_KP_5") return SDLK_KP_5; else if (aValue == "SDLK_KP_6") return SDLK_KP_6; else if (aValue == "SDLK_KP_7") return SDLK_KP_7; else if (aValue == "SDLK_KP_8") return SDLK_KP_8; else if (aValue == "SDLK_KP_9") return SDLK_KP_9; else if (aValue == "SDLK_KP_0") return SDLK_KP_0; else if (aValue == "SDLK_KP_PERIOD") return SDLK_KP_PERIOD; else if (aValue == "SDLK_KP_ENTER") return SDLK_KP_ENTER; else if (aValue == "SDLK_KP_EQUALS") return SDLK_KP_EQUALS; else if (aValue == "SDLK_F1") return SDLK_F1; else if (aValue == "SDLK_F2") return SDLK_F2; else if (aValue == "SDLK_F3") return SDLK_F3; else if (aValue == "SDLK_F4") return SDLK_F4; else if (aValue == "SDLK_F5") return SDLK_F5; else if (aValue == "SDLK_F6") return SDLK_F6; else if (aValue == "SDLK_F7") return SDLK_F7; else if (aValue == "SDLK_F8") return SDLK_F8; else if (aValue == "SDLK_F9") return SDLK_F9; else if (aValue == "SDLK_F10") return SDLK_F10; else if (aValue == "SDLK_F11") return SDLK_F11; else if (aValue == "SDLK_F12") return SDLK_F12; else if (aValue == "SDLK_F13") return SDLK_F13; else if (aValue == "SDLK_F14") return SDLK_F14; else if (aValue == "SDLK_F15") return SDLK_F15; else if (aValue == "KMOD_CTRL") return KMOD_CTRL; else if (aValue == "SDLK_LCTRL") return SDLK_LCTRL; else if (aValue == "SDLK_RCTRL") return SDLK_RCTRL; else if (aValue == "KMOD_SHIFT") return KMOD_SHIFT; else if (aValue == "SDLK_LSHIFT") return SDLK_LSHIFT; else if (aValue == "SDLK_RSHIFT") return SDLK_RSHIFT; else if (aValue == "KMOD_ALT") return KMOD_ALT; else if (aValue == "SDLK_LALT") return SDLK_LALT; else if (aValue == "SDLK_RALT") return SDLK_RALT; else __debugbreak(); return 0; } constexpr auto endKeyIndex = ConvertToIndex(SDL_CONTROLLER_BUTTON_DPAD_RIGHT) + 1; struct EventToSend { enum class EventType { None, Keyboard, Mouse }; EventToSend() : mType{EventType::None} , mKey{0} { } EventToSend(EventType aType, int64_t aKey) : mType{aType} , mKey{aKey} { } EventType mType; int64_t mKey; }; const char* SdlMouseToString(Uint8 aButton) { switch (aButton) { case SDL_BUTTON_LEFT: return "SDL_BUTTON_LEFT"; case SDL_BUTTON_RIGHT: return "SDL_BUTTON_RIGHT"; case SDL_BUTTON_MIDDLE: return "SDL_BUTTON_MIDDLE"; case SDL_BUTTON_X1: return "SDL_BUTTON_X1"; case SDL_BUTTON_X2: return "SDL_BUTTON_X2"; } return "ERROR"; } constexpr const char* SdlScancodeToString(int64_t aScancode) { switch (aScancode) { case SDLK_a: return "SDLK_a"; // A case SDLK_b: return "SDLK_b"; // B case SDLK_c: return "SDLK_c"; // C case SDLK_d: return "SDLK_d"; // D case SDLK_e: return "SDLK_e"; // E case SDLK_f: return "SDLK_f"; // F case SDLK_g: return "SDLK_g"; // G case SDLK_h: return "SDLK_h"; // H case SDLK_i: return "SDLK_i"; // I case SDLK_j: return "SDLK_j"; // J case SDLK_k: return "SDLK_k"; // K case SDLK_l: return "SDLK_l"; // L case SDLK_m: return "SDLK_m"; // M case SDLK_n: return "SDLK_n"; // N case SDLK_o: return "SDLK_o"; // O case SDLK_p: return "SDLK_p"; // P case SDLK_q: return "SDLK_q"; // Q case SDLK_r: return "SDLK_r"; // R case SDLK_s: return "SDLK_s"; // S case SDLK_t: return "SDLK_t"; // T case SDLK_u: return "SDLK_u"; // U case SDLK_v: return "SDLK_v"; // V case SDLK_w: return "SDLK_w"; // W case SDLK_x: return "SDLK_x"; // X case SDLK_y: return "SDLK_y"; // Y case SDLK_z: return "SDLK_z"; // Z case SDLK_1: return "SDLK_1"; // N1 case SDLK_2: return "SDLK_2"; // N2 case SDLK_3: return "SDLK_3"; // N3 case SDLK_4: return "SDLK_4"; // N4 case SDLK_5: return "SDLK_5"; // N5 case SDLK_6: return "SDLK_6"; // N6 case SDLK_7: return "SDLK_7"; // N7 case SDLK_8: return "SDLK_8"; // N8 case SDLK_9: return "SDLK_9"; // N9 case SDLK_0: return "SDLK_0"; // N0 case SDLK_RETURN: return "SDLK_RETURN"; // Return case SDLK_ESCAPE: return "SDLK_ESCAPE"; // Escape case SDLK_BACKSPACE: return "SDLK_BACKSPACE"; // Backspace case SDLK_TAB: return "SDLK_TAB"; // Tab case SDLK_SPACE: return "SDLK_SPACE"; // Space case SDLK_MINUS: return "SDLK_MINUS"; // Minus case SDLK_KP_PLUS: return "SDLK_KP_PLUS"; // KP_Plus case SDLK_PERIOD: return "SDLK_PERIOD"; // Period case SDLK_PAUSE: return "SDLK_PAUSE"; // Pause case SDLK_EQUALS: return "SDLK_EQUALS"; // Equals case SDLK_LEFTBRACKET: return "SDLK_LEFTBRACKET"; // LeftBracket case SDLK_RIGHTBRACKET: return "SDLK_RIGHTBRACKET"; // RightBracket case SDLK_BACKSLASH: return "SDLK_BACKSLASH"; // Backslash case SDLK_SEMICOLON: return "SDLK_SEMICOLON"; // Semicolon case SDLK_QUOTE: return "SDLK_QUOTE"; // Apostrophe case SDLK_BACKQUOTE: return "SDLK_BACKQUOTE"; // Grave case SDLK_COMMA: return "SDLK_COMMA"; // Comma case SDLK_SLASH: return "SDLK_SLASH"; // ForwardSlash case SDLK_PRINTSCREEN: return "SDLK_PRINTSCREEN"; // PrintScreen case SDLK_INSERT: return "SDLK_INSERT"; // Insert case SDLK_DELETE: return "SDLK_DELETE"; // Delete case SDLK_PAGEUP: return "SDLK_PAGEUP"; // PageUp case SDLK_PAGEDOWN: return "SDLK_PAGEDOWN"; // PageDown case SDLK_HOME: return "SDLK_HOME"; // Home case SDLK_END: return "SDLK_END"; // End case SDLK_UP: return "SDLK_UP"; // Up case SDLK_DOWN: return "SDLK_DOWN"; // Down case SDLK_RIGHT: return "SDLK_RIGHT"; // Right case SDLK_LEFT: return "SDLK_LEFT"; // Left case SDLK_CAPSLOCK: return "SDLK_CAPSLOCK"; // Capslock case SDLK_SCROLLLOCK: return "SDLK_SCROLLLOCK"; // ScrollLock case SDLK_NUMLOCKCLEAR: return "SDLK_NUMLOCKCLEAR"; // NumLock case SDLK_KP_DIVIDE: return "SDLK_KP_DIVIDE"; // KP_Divide case SDLK_KP_MULTIPLY: return "SDLK_KP_MULTIPLY"; // KP_Multiply case SDLK_KP_1: return "SDLK_KP_1"; // KP_1 case SDLK_KP_2: return "SDLK_KP_2"; // KP_2 case SDLK_KP_3: return "SDLK_KP_3"; // KP_3 case SDLK_KP_4: return "SDLK_KP_4"; // KP_4 case SDLK_KP_5: return "SDLK_KP_5"; // KP_5 case SDLK_KP_6: return "SDLK_KP_6"; // KP_6 case SDLK_KP_7: return "SDLK_KP_7"; // KP_7 case SDLK_KP_8: return "SDLK_KP_8"; // KP_8 case SDLK_KP_9: return "SDLK_KP_9"; // KP_9 case SDLK_KP_0: return "SDLK_KP_0"; // KP_0 case SDLK_KP_PERIOD: return "SDLK_KP_PERIOD"; // KP_Period case SDLK_KP_ENTER: return "SDLK_KP_ENTER"; // KP_Enter case SDLK_KP_EQUALS: return "SDLK_KP_EQUALS"; // KP_Equals case SDLK_F1: return "SDLK_F1"; // F1 case SDLK_F2: return "SDLK_F2"; // F2 case SDLK_F3: return "SDLK_F3"; // F3 case SDLK_F4: return "SDLK_F4"; // F4 case SDLK_F5: return "SDLK_F5"; // F5 case SDLK_F6: return "SDLK_F6"; // F6 case SDLK_F7: return "SDLK_F7"; // F7 case SDLK_F8: return "SDLK_F8"; // F8 case SDLK_F9: return "SDLK_F9"; // F9 case SDLK_F10: return "SDLK_F10"; // F10 case SDLK_F11: return "SDLK_F11"; // F11 case SDLK_F12: return "SDLK_F12"; // F12 case SDLK_F13: return "SDLK_F13"; // F13 case SDLK_F14: return "SDLK_F14"; // F14 case SDLK_F15: return "SDLK_F15"; // F15 case KMOD_CTRL: return "KMOD_CTRL"; // Control case SDLK_LCTRL: return "SDLK_LCTRL"; // LeftControl case SDLK_RCTRL: return "SDLK_RCTRL"; // RightControl case KMOD_SHIFT: return "KMOD_SHIFT"; // Shift case SDLK_LSHIFT: return "SDLK_LSHIFT"; // LeftShift case SDLK_RSHIFT: return "SDLK_RSHIFT"; // RightShift case KMOD_ALT: return "KMOD_ALT"; // Alt case SDLK_LALT: return "SDLK_LALT"; // LeftAlt case SDLK_RALT: return "SDLK_RALT"; // RightAlt } return "ERROR"; } class Controller { public: Controller() { __debugbreak(); } Controller(SDL_GameController* aGameController) : mGameController{aGameController} { mName = SDL_GameControllerName(aGameController); mPreviousButtons.fill(false); mCurrentButtons.fill(false); LeftStick = glm::vec2{0.f,0.f}; RightStick = glm::vec2{0.f,0.f}; LeftTrigger = 0.f; RightTrigger = 0.f; Reset(); } void Reset() { mPreviousButtons = mCurrentButtons; } float ToFloat(Sint16 aValue) { return (static_cast<float>(aValue + 32768.f) / 65535.f); } void HandleMotion(SDL_ControllerAxisEvent& aEvent) { switch (aEvent.axis) { case SDL_CONTROLLER_AXIS_LEFTX: LeftStick.x = 2.f * (ToFloat(aEvent.value) - .5f); return; case SDL_CONTROLLER_AXIS_LEFTY: LeftStick.y = 2.f * (ToFloat(aEvent.value) - .5f); return; case SDL_CONTROLLER_AXIS_RIGHTX: RightStick.x = 2.f * (ToFloat(aEvent.value) - .5f); return; case SDL_CONTROLLER_AXIS_RIGHTY: RightStick.y = 2.f * (ToFloat(aEvent.value) - .5f); return; case SDL_CONTROLLER_AXIS_TRIGGERLEFT: LeftTrigger = 2.f * (ToFloat(aEvent.value) - .5f); return; case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: RightTrigger = 2.f * (ToFloat(aEvent.value) - .5f); return; } } void HandleButton(SDL_ControllerButtonEvent& aEvent) { mCurrentButtons[ConvertToIndex(aEvent.button)] = aEvent.state == SDL_PRESSED ? true : false; printf("%s %s\n", ConvertToString(aEvent.button), aEvent.state == SDL_PRESSED ? "Pressed" : "Released"); } SDL_GameController* mGameController; const char* mName; std::array<bool, 15> mPreviousButtons; std::array<bool, 15> mCurrentButtons; glm::vec2 LeftStick; glm::vec2 RightStick; float LeftTrigger; float RightTrigger; }; struct Controllers { Controllers() { //for(int i = 0; i < SDL_NumJoysticks(); i++ ) //{ // if (SDL_IsGameController(i)) // { // auto pad = SDL_GameControllerOpen(i); // // if (pad) // { // auto name = SDL_GameControllerName(pad); // auto instanceId = SDL_JoystickGetDeviceInstanceID(i); // // printf("Added %s, %d\n", name, instanceId); // mControllers.emplace(instanceId, Controller(pad)); // } // } //} } void HandleEvent(SDL_Event& aEvent) { switch (aEvent.type) { // Joypad Events case SDL_CONTROLLERDEVICEADDED: { auto event = aEvent.cdevice; auto pad = SDL_GameControllerOpen(event.which); if (pad) { auto name = SDL_GameControllerName(pad); SDL_Joystick* joystick = SDL_GameControllerGetJoystick(pad); SDL_JoystickID instanceId = SDL_JoystickInstanceID(joystick); printf("Added %s, %d\n", name, instanceId); mControllers.emplace(instanceId, Controller(pad)); } } case SDL_CONTROLLERDEVICEREMOVED: { auto event = aEvent.cdevice; //if (auto it = mControllers.find(event.which); // it != mControllers.end()) //{ // mControllers.erase(it); //} printf("Removed %d\n", event.which); break; } // Controller Events case SDL_CONTROLLERAXISMOTION: { mControllers[aEvent.caxis.which].HandleMotion(aEvent.caxis); break; } case SDL_CONTROLLERBUTTONDOWN: case SDL_CONTROLLERBUTTONUP: { mControllers[aEvent.cbutton.which].HandleButton(aEvent.cbutton); break; } case SDL_CONTROLLERDEVICEREMAPPED: { puts("Remaped\n"); break; } case SDL_MOUSEBUTTONUP: { mEventsReceivedThisFrame.emplace_back(EventToSend(EventToSend::EventType::Mouse, aEvent.button.button)); } case SDL_KEYUP: { mEventsReceivedThisFrame.emplace_back(EventToSend(EventToSend::EventType::Keyboard, aEvent.key.keysym.sym)); } } } void EndFrame() { for (auto& [key, controller] : mControllers) { controller.Reset(); } mEventsReceivedThisFrame.clear(); } std::map<SDL_JoystickID, Controller> mControllers; std::vector<EventToSend> mEventsReceivedThisFrame; }; void ControllerEventHandler(SDL_Event& aEvent, void* aUserData) { Controllers* controllers = static_cast<Controllers*>(aUserData); controllers->HandleEvent(aEvent); } struct ImGuiDockPlacement { ImGuiDockPlacement() { constexpr ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None; //ImGuiIO& io = ImGui::GetIO(); ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->Pos); ImGui::SetNextWindowSize(viewport->Size); ImGui::SetNextWindowViewport(viewport->ID); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); ImGuiWindowFlags window_flags = /* ImGuiWindowFlags_NoMenuBar | */ ImGuiWindowFlags_NoDocking; window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); bool openWindow = true; ImGui::Begin("MainWindow", &openWindow, window_flags); ImGui::PopStyleVar(); ImGui::PopStyleVar(2); mDockspaceId = ImGui::GetID("MainDockSpace"); ImGui::DockSpace(mDockspaceId, viewport->Size, dockspaceFlags); InitializeDockspaceLayoutOnce(); ImGui::End(); } void InitializeDockspaceLayoutOnce() { if (ImGui::DockBuilderGetNode(mDockspaceId) != nullptr) { return; } //ImGuiID dockspaceId = ImGui::GetID("MyDockSpace"); //ImGui::DockSpace(dockspaceId, ImVec2(0.0f, 0.0f), dockspaceFlags); // //ImGuiID leftSide; //ImGui::DockBuilderSplitNode(dockspaceId, ImGuiDir_::ImGuiDir_Right, .66f, &mGraphDock, &leftSide); // //ImGui::DockBuilderSplitNode(leftSide, ImGuiDir_::ImGuiDir_Down, .5f, &mCommonColumnsDock, &mTablesDock); ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::DockBuilderRemoveNode(mDockspaceId); // Clear out existing layout ImGui::DockBuilderSetNodeSize(mDockspaceId, viewport->Size); ImGui::DockBuilderAddNode(mDockspaceId, ImGuiDockNodeFlags_DockSpace); // Add empty node //ImGuiID dock_main_id = mDockspaceId; // This variable will track the document node, however we are not using it here as we aren't docking anything into it. mTablesDock = ImGui::DockBuilderSplitNode(mDockspaceId, ImGuiDir_Left, 0.20f, NULL, &mDockspaceId); mCommonColumnsDock = ImGui::DockBuilderSplitNode(mDockspaceId, ImGuiDir_Left, 0.20f, NULL, &mDockspaceId); //ImGui::DockBuilderDockWindow("Databases", leftDock1); //ImGui::DockBuilderDockWindow("Common Columns", leftDock2); //ImGui::DockBuilderDockWindow("Table Graph", mDockspaceId); mGraphDock = mDockspaceId; ImGui::DockBuilderFinish(mDockspaceId); } ImGuiID mDockspaceId; ImGuiID mCommonColumnsDock; ImGuiID mTablesDock; ImGuiID mGraphDock; }; struct Profile { std::array<EventToSend, endKeyIndex> mRedirectionMapping; // Mouse Related int mPixelsToMove = 20; bool mLeftStickMapToMouse = false; bool mRightStickMapToMouse = false; // Gamepad related float mLeftStickDeadZone = 0.0f; float mRightStickDeadZone = 0.0f; bool mLeftTriggerMapToButton = false; bool mRightTriggerMapToButton = false; void SaveToFile(std::string aFilename) { std::string buffer; for (auto [i, redirect] : enumerate(mRedirectionMapping)) { // Name of the button buffer += ConvertToString(static_cast<Uint8>(i)); buffer += ':'; // Redirecting to type: buffer += redirect.mType == EventToSend::EventType::Mouse ? "Mouse" : redirect.mType == EventToSend::EventType::Keyboard ? "Keyboard" : "None"; buffer += ':'; // Redirecting to button: buffer += redirect.mType == EventToSend::EventType::Mouse ? SdlMouseToString(static_cast<Uint8>(redirect.mKey)) : redirect.mType == EventToSend::EventType::Keyboard ? SdlScancodeToString(redirect.mKey) : "0"; buffer += '\n'; } buffer += "PixelsToMove"; buffer += ':'; buffer += std::to_string(mPixelsToMove); buffer += '\n'; buffer += "LeftStickMapToMouse"; buffer += ':'; buffer += mLeftStickMapToMouse ? "true" : "false"; buffer += '\n'; buffer += "RightStickMapToMouse"; buffer += ':'; buffer += mRightStickMapToMouse ? "true" : "false"; buffer += '\n'; buffer += "LeftStickDeadZone"; buffer += ':'; buffer += std::to_string(mLeftStickDeadZone); buffer += '\n'; buffer += "RightStickDeadZone"; buffer += ':'; buffer += std::to_string(mRightStickDeadZone); buffer += '\n'; buffer += "LeftTriggerMapToButton"; buffer += ':'; buffer += mLeftTriggerMapToButton ? "true" : "false"; buffer += '\n'; buffer += "RightTriggerMapToButton"; buffer += ':'; buffer += mRightTriggerMapToButton ? "true" : "false"; buffer += '\n'; std::ofstream out = std::ofstream{ aFilename }; out << buffer; } template <typename tType> static void ReadLine(std::string_view aLine, std::string_view aName, tType& aValueToReadInto) { SplitGenerator splitter(aLine, ":"); auto name = splitter(); auto value = splitter(); assert(name == aName); auto result = std::from_chars(value.data(), value.data() + value.size(), aValueToReadInto); } template <> static void ReadLine<bool>(std::string_view aLine, std::string_view aName, bool& aValueToReadInto) { SplitGenerator splitter(aLine, ":"); auto name = splitter(); auto value = splitter(); assert(name == aName); assert(value == "false" || value == "true"); aValueToReadInto = value == "true" ? true : false; } void ReadFromFile(std::string aFilename) { auto fileTextVec = file_read(aFilename.c_str()); std::string_view text{ fileTextVec.data(), fileTextVec.size() }; auto newLineDelimiter = ChooseNewlineStyle(text); SplitGenerator lineSplitter(text, newLineDelimiter); size_t i = 0; for (auto& redirect : mRedirectionMapping) { SplitGenerator splitter(lineSplitter(), ":"); auto buttonName = splitter(); auto redirectionType = splitter(); auto redirectionKey = splitter(); assert(i == from_string_to_gamepad(buttonName)); redirect.mType = redirectionType == "Mouse" ? EventToSend::EventType::Mouse: redirectionType == "Keyboard" ? EventToSend::EventType::Keyboard: EventToSend::EventType::None; redirect.mKey = redirectionType == "Mouse" ? from_string_to_mouse(redirectionKey) : redirectionType == "Keyboard" ? from_string_to_keyboard(redirectionKey) : 0; ++i; } ReadLine(lineSplitter(), "PixelsToMove", mPixelsToMove); ReadLine(lineSplitter(), "LeftStickMapToMouse", mLeftStickMapToMouse); ReadLine(lineSplitter(), "RightStickMapToMouse", mRightStickMapToMouse); ReadLine(lineSplitter(), "LeftStickDeadZone", mLeftStickDeadZone); ReadLine(lineSplitter(), "RightStickDeadZone", mRightStickDeadZone); ReadLine(lineSplitter(), "LeftTriggerMapToButton", mLeftTriggerMapToButton); ReadLine(lineSplitter(), "RightTriggerMapToButton", mRightTriggerMapToButton); } }; void DoPadInputWork(Controller aController, std::vector<EventToSend> aEventsSendThisFrame, Profile& aProfile); void DoRedirections(Controller& aController, Profile& aProfile); std::vector<std::string> get_file_list() { std::vector<std::string> toReturn; return toReturn; } int main(int, char**) { SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SOIS::ApplicationInitialization(); auto iniPath = GetImGuiIniPath(); Controllers controllers; SOIS::ApplicationContextConfig config; config.aBlocking = false; config.aHandler = &ControllerEventHandler; config.aUserData = &controllers; config.aIniFile = iniPath.c_str(); config.aWindowName = "PadInput"; SOIS::ApplicationContext context{config}; SOIS::ImGuiSample sample; std::string lookingFor = ""; SDL_JoystickID lookingForId = 0; Profile profile; if (!controllers.mControllers.empty()) { auto& [key, controller] = *controllers.mControllers.begin(); lookingForId = key; lookingFor = controller.mName; } while (context.Update()) { static bool updateNow = true; if (updateNow) { context.SetCallbackInfo(&ControllerEventHandler, &controllers); updateNow = false; } if (false == (SDL_GetWindowFlags(context.mWindow) & SDL_WINDOW_INPUT_FOCUS)) { SDL_GameControllerUpdate(); } ImGuiDockPlacement dock; sample.Update(); ImGui::Begin("Controller Info"); if (ImGui::Button("Save###Save_Profile")) { profile.SaveToFile("profile.ini"); } ImGui::SameLine(); if (ImGui::Button("Save As###SaveAs_Profile")) { } ImGui::SameLine(); if (ImGui::Button("Load###Load_Profile")) { profile.ReadFromFile("profile.ini"); } if (ImGui::BeginCombo("Select Controller:", lookingFor.c_str())) { for (auto& [key, controller] : controllers.mControllers) { ImGui::PushID(key); if (ImGui::Selectable(controller.mName, lookingForId == key)) { lookingFor = controller.mName; lookingForId = key; } ImGui::PopID(); } ImGui::EndCombo(); } auto it = controllers.mControllers.find(lookingForId); if (it != controllers.mControllers.end()) { DoPadInputWork(it->second, controllers.mEventsReceivedThisFrame, profile); } ImGui::End(); DoRedirections(it->second, profile); controllers.EndFrame(); } return 0; } template<typename tReturn> tReturn GetMousePosition() { glm::i32vec2 toReturn; SDL_GetGlobalMouseState(&toReturn.x, &toReturn.y); return tReturn(toReturn); } void SetCursorPositionInScreenCoordinates(glm::i32vec2 aPosition) { SDL_WarpMouseGlobal(aPosition.x, aPosition.y); } struct GamepadButtonImGuiIds { GamepadButtonImGuiIds() { } GamepadButtonImGuiIds(size_t aButton) : cClearButtonId{} , cSetButtonId{} , cCheckBoxId{} , cButtonNameLabelId{} , cRedirectLabelId{} { std::string baseName = "###"; baseName += ConvertToString(static_cast<Uint8>(aButton)); cClearButtonId = baseName + "_ClearButtonId"; cSetButtonId = baseName + "_SetButtonId"; cCheckBoxId = baseName + "_CheckBoxId"; cButtonNameLabelId = baseName + "_ButtonNameLabelId"; cRedirectLabelId = baseName + "_RedirectLabelId"; } std::string cClearButtonId; std::string cSetButtonId; std::string cCheckBoxId; std::string cButtonNameLabelId; std::string cRedirectLabelId; }; std::array<GamepadButtonImGuiIds, endKeyIndex> FilledGamepadImGuiIds() { std::array<GamepadButtonImGuiIds, endKeyIndex> toReturn; for (size_t i = 0; i < endKeyIndex; ++i) { toReturn[i] = GamepadButtonImGuiIds(i); } return toReturn; } // Horrible hack: https://github.com/ocornut/imgui/issues/1655#issuecomment-489174962 template <size_t N> void SetColumnWidth(float aWidth) { static unsigned short initial_column_spacing = 0; if (initial_column_spacing < 2) { ImGui::SetColumnWidth(N, aWidth); initial_column_spacing++; } } bool OutsideDeadZone(glm::vec2 aStickPosition, float aDeadzone) { return glm::length(aStickPosition) > aDeadzone; } void DoPadInputWork(Controller aController, std::vector<EventToSend> aEventsSendThisFrame, Profile& aProfile) { static const std::array<GamepadButtonImGuiIds, endKeyIndex> imguiIds = FilledGamepadImGuiIds(); // Set Related Statics (to be moved to a struct/class at some point) static bool currentlySetting = false; static size_t indexSetting = 0; // Set Related work: if (currentlySetting && (false == aEventsSendThisFrame.empty())) { currentlySetting = false; aProfile.mRedirectionMapping[indexSetting] = aEventsSendThisFrame.front(); } // Outputing controller state { ////////////////////////////////////////////////////////////// // Mouse Speed ImGui::DragInt("Pixels to move Mouse", &aProfile.mPixelsToMove, 1, 1, 200); ////////////////////////////////////////////////////////////// // Left Stick ImGui::DragFloat2("Left Stick", &aController.LeftStick[0], 0.0f); ImGui::SameLine(); ImGui::Checkbox("Map to Mouse###LeftMapToMouse", &aProfile.mLeftStickMapToMouse); if (ImGui::Button("Set Left Stick Deadzone")) { aProfile.mLeftStickDeadZone = glm::length(aController.LeftStick); } ImGui::SameLine(); ImGui::DragFloat("Left Stick Deadzone", &aProfile.mLeftStickDeadZone, 0.001f, 0.f, 1.f); ////////////////////////////////////////////////////////////// // Right Stick ImGui::DragFloat2("Right Stick", &aController.RightStick[0], 0.0f); ImGui::SameLine(); ImGui::Checkbox("Map to Mouse###RightMapToMouse", &aProfile.mRightStickMapToMouse); if (ImGui::Button("Set Right Stick Deadzone")) { aProfile.mRightStickDeadZone = glm::length(aController.RightStick); } ImGui::SameLine(); ImGui::DragFloat("Right Stick Deadzone", &aProfile.mRightStickDeadZone, 0.001f, 0.f, 1.f); ////////////////////////////////////////////////////////////// // Left Trigger ImGui::DragFloat("Left Trigger", &aController.LeftTrigger, 0.0f); ImGui::SameLine(); ImGui::Checkbox("Treat as Button", &aProfile.mLeftTriggerMapToButton); ////////////////////////////////////////////////////////////// // Right Trigger ImGui::DragFloat("Right Trigger", &aController.RightTrigger, 0.0f); ImGui::SameLine(); ImGui::Checkbox("Treat as Button", &aProfile.mRightTriggerMapToButton); ////////////////////////////////////////////////////////////// // Buttons ImGui::Columns(5, "GamepadButtons"); // 4-ways, with border ImGui::Separator(); ImGui::Text("Clear"); SetColumnWidth<0>(60.f); ImGui::NextColumn(); ImGui::Text("Set"); SetColumnWidth<1>(40.f); ImGui::NextColumn(); ImGui::Text("Pressed"); SetColumnWidth<2>(60.f); ImGui::NextColumn(); ImGui::Text("Button Name"); ImGui::NextColumn(); ImGui::Text("Redirected To"); ImGui::NextColumn(); ImGui::Separator(); for (size_t i = 0; i < endKeyIndex; ++i) { ////////////////////////////////////////////////////////////// // Clear ImGui::PushID(imguiIds[i].cClearButtonId.c_str()); if (ImGui::Button("Clear")) { aProfile.mRedirectionMapping[i] = EventToSend(); // If the user clicks clear, we should also void out anything currently being set. currentlySetting = false; } ImGui::PopID(); ImGui::NextColumn(); ////////////////////////////////////////////////////////////// // Set ImGui::PushID(imguiIds[i].cSetButtonId.c_str()); if (ImGui::Button("Set")) { currentlySetting = true; indexSetting = i; } ImGui::PopID(); ImGui::NextColumn(); ////////////////////////////////////////////////////////////// // Active // // We don't actually want ImGui to set this bool, but we can't have a non-interactable checkbox, so we'll just reset // the bool to it was prior to the call. bool previous = aController.mCurrentButtons[i]; ImGui::Checkbox(imguiIds[i].cCheckBoxId.c_str(), &aController.mCurrentButtons[i]); aController.mCurrentButtons[i] = previous; ImGui::NextColumn(); ////////////////////////////////////////////////////////////// // Button Name auto buttonName = ConvertToString(static_cast<Uint8>(i)); ImGui::LabelText(imguiIds[i].cButtonNameLabelId.c_str(), "%s", buttonName); ImGui::NextColumn(); ////////////////////////////////////////////////////////////// // Redirected To const char* buttonRedirectName = "None"; auto& eventToSend = aProfile.mRedirectionMapping[i]; switch (eventToSend.mType) { case EventToSend::EventType::None: break; case EventToSend::EventType::Keyboard: buttonRedirectName = SdlScancodeToString(eventToSend.mKey); break; case EventToSend::EventType::Mouse: buttonRedirectName = SdlMouseToString(static_cast<Uint8>(eventToSend.mKey)); break; } ImGui::LabelText(imguiIds[i].cRedirectLabelId.c_str(), " Redirected to: %s", buttonRedirectName); ImGui::NextColumn(); } ImGui::Columns(1); ImGui::Separator(); } } void DoRedirections(Controller& aController, Profile& aProfile) { // Mouse Related Locals glm::ivec2 mouseMovement = glm::ivec2{ 0,0 }; if (/*aController.mCurrentButtons[ConvertToIndex(SDL_CONTROLLER_BUTTON_A)] &&*/ aProfile.mLeftStickMapToMouse && OutsideDeadZone(aController.LeftStick, aProfile.mLeftStickDeadZone)) { auto movementVector = aController.LeftStick * static_cast<float>(aProfile.mPixelsToMove); mouseMovement += movementVector; } if (/*aController.mCurrentButtons[ConvertToIndex(SDL_CONTROLLER_BUTTON_A)] &&*/ aProfile.mRightStickMapToMouse && OutsideDeadZone(aController.RightStick, aProfile.mRightStickDeadZone)) { auto movementVector = aController.RightStick * static_cast<float>(aProfile.mPixelsToMove); mouseMovement += movementVector; } if (mouseMovement.x != 0 || mouseMovement.y != 0) { auto newPosition = glm::ivec2(GetMousePosition<glm::ivec2>()) + mouseMovement; SetCursorPositionInScreenCoordinates(newPosition); } for (size_t i = 0; i < endKeyIndex; ++i) { auto& redirect = aProfile.mRedirectionMapping[i]; ButtonEvent event = ButtonEvent::None; // If it's now down, and it wasn't before, it was just pressed. if (aController.mCurrentButtons[i] && !aController.mPreviousButtons[i]) { event = ButtonEvent::Pressed; } // If it's now up, but it was down before, it was just released. else if (!aController.mCurrentButtons[i] && aController.mPreviousButtons[i]) { event = ButtonEvent::Released; } if (event != ButtonEvent::None) { switch (redirect.mType) { case EventToSend::EventType::Keyboard: SendKeyboardEvent(redirect.mKey, event); case EventToSend::EventType::Mouse: SendMouseEvent(redirect.mKey, event); } } } }
33.017391
161
0.665837
playmer
6c58c4cc9d314b033797ffb60ee1bf04cc30f423
203
cpp
C++
Codeforces/CF1434/B.cpp
jinzhengyu1212/Clovers
0efbb0d87b5c035e548103409c67914a1f776752
[ "MIT" ]
null
null
null
Codeforces/CF1434/B.cpp
jinzhengyu1212/Clovers
0efbb0d87b5c035e548103409c67914a1f776752
[ "MIT" ]
null
null
null
Codeforces/CF1434/B.cpp
jinzhengyu1212/Clovers
0efbb0d87b5c035e548103409c67914a1f776752
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=500005; void solve(){ } int main(){ int T=1; //scanf("%d",&T); while(T--){ solve(); } return 0; }
12.6875
30
0.546798
jinzhengyu1212
6c5d3a903501362d1030223a895ba2f4783239c2
59,612
hpp
C++
api/direct_bt/BTAdapter.hpp
sgothel/direct_bt
e19a11a60d509a42a1a1167a2b7215345784e462
[ "MIT" ]
10
2020-09-03T16:23:12.000Z
2022-03-10T13:51:40.000Z
api/direct_bt/BTAdapter.hpp
sgothel/direct_bt
e19a11a60d509a42a1a1167a2b7215345784e462
[ "MIT" ]
null
null
null
api/direct_bt/BTAdapter.hpp
sgothel/direct_bt
e19a11a60d509a42a1a1167a2b7215345784e462
[ "MIT" ]
3
2020-09-03T05:21:46.000Z
2020-09-04T18:44:00.000Z
/* * Author: Sven Gothel <sgothel@jausoft.com> * Copyright (c) 2020 Gothel Software e.K. * Copyright (c) 2020 ZAFENA AB * * 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. */ #ifndef BT_ADAPTER_HPP_ #define BT_ADAPTER_HPP_ #include <cstring> #include <string> #include <memory> #include <cstdint> #include <mutex> #include <atomic> #include <jau/darray.hpp> #include <jau/cow_darray.hpp> #include "BTTypes1.hpp" #include "BTDevice.hpp" #include "HCIHandler.hpp" #include "DBGattServer.hpp" #include "SMPKeyBin.hpp" namespace direct_bt { class BTAdapter; // forward class BTManager; // forward /** * Discovery policy defines the BTAdapter discovery mode after connecting a remote BTDevice: * - turned-off (DiscoveryPolicy::AUTO_OFF) * - paused until all connected BTDevice become disconnected, effectively until AdapterStatusListener::deviceDisconnected() (DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_DISCONNECTED). * - paused until all connected devices reach readiness inclusive optional SMP pairing (~120ms) and GATT service discovery (~700ms), effectively until AdapterStatusListener::deviceReady(). (DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY, default) * - paused until all connected devices are optionally SMP paired (~120ms), exclusive GATT service discovery (~700ms -> ~1200ms, DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_PAIRED) * - always enabled, i.e. re-enabled if automatically turned-off by HCI host OS as soon as possible (DiscoveryPolicy::ALWAYS_ON) * * Policy is set via BTAdapter::startDiscovery() * * Default is DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY, as it has been shown that continuous advertising * reduces the bandwidth for the initial bring-up time including GATT service discovery considerably. * Continuous advertising would increase the readiness lag of the remote device until AdapterStatusListener::deviceReady(). * * In case users favors faster parallel discovery of new remote devices and hence a slower readiness, * DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_PAIRED or even DiscoveryPolicy::ALWAYS_ON can be used. * * @since 2.5.0 */ enum class DiscoveryPolicy : uint8_t { /** Turn off discovery when connected and leave discovery disabled, if turned off by host system. */ AUTO_OFF = 0, /** * Pause discovery until all connected BTDevice become disconnected, * effectively until AdapterStatusListener::deviceDisconnected(). */ PAUSE_CONNECTED_UNTIL_DISCONNECTED = 1, /** * Pause discovery until all connected BTDevice reach readiness inclusive optional SMP pairing (~120ms) and GATT service discovery (~700ms), * effectively until AdapterStatusListener::deviceReady(). This is the default! */ PAUSE_CONNECTED_UNTIL_READY = 2, /** Pause discovery until all connected BTDevice are optionally SMP paired (~120ms), exclusive GATT service discovery (~700ms -> ~1200ms). */ PAUSE_CONNECTED_UNTIL_PAIRED = 3, /** Always keep discovery enabled, i.e. re-enabled if automatically turned-off by HCI host OS as soon as possible. */ ALWAYS_ON = 4 }; constexpr uint8_t number(const DiscoveryPolicy rhs) noexcept { return static_cast<uint8_t>(rhs); } constexpr DiscoveryPolicy to_DiscoveryPolicy(const uint8_t v) noexcept { if( 1 <= v && v <= 4 ) { return static_cast<DiscoveryPolicy>(v); } return DiscoveryPolicy::AUTO_OFF; } std::string to_string(const DiscoveryPolicy v) noexcept; /** * {@link BTAdapter} status listener for {@link BTDevice} discovery events: Added, updated and removed; * as well as for certain {@link BTAdapter} events. * <p> * User implementations shall return as early as possible to avoid blocking the event-handler thread, * if not specified within the methods otherwise (see AdapterStatusListener::deviceReady()).<br> * Especially complex mutable operations on BTDevice or BTAdapter should be issued off-thread! * </p> * <p> * A listener instance may be attached to a {@link BTAdapter} via * {@link BTAdapter::addStatusListener(std::shared_ptr<AdapterStatusListener>)}. * </p> * <p> * The listener receiver maintains a unique set of listener instances without duplicates. * </p> */ class AdapterStatusListener { public: /** * Custom filter for all 'device*' notification methods, * which will not be called if this method returns false. * <p> * User may override this method to test whether the 'device*' methods shall be called * for the given device. * </p> * <p> * Defaults to true; * </p> */ virtual bool matchDevice(const BTDevice & device) { (void)device; return true; } /** * BTAdapter setting(s) changed. * @param adapter the adapter which settings have changed. * @param oldmask the previous settings mask. AdapterSetting::NONE indicates the initial setting notification, see BTAdapter::addStatusListener(). * @param newmask the new settings mask * @param changedmask the changes settings mask. AdapterSetting::NONE indicates the initial setting notification, see BTAdapter::addStatusListener(). * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). */ virtual void adapterSettingsChanged(BTAdapter &adapter, const AdapterSetting oldmask, const AdapterSetting newmask, const AdapterSetting changedmask, const uint64_t timestamp) { (void)adapter; (void)oldmask; (void)newmask; (void)changedmask; (void)timestamp; } /** * BTAdapter's discovery state has changed, i.e. enabled or disabled. * @param adapter the adapter which discovering state has changed. * @param currentMeta the current meta ScanType * @param changedType denotes the changed native ScanType * @param changedEnabled denotes whether the changed native ScanType has been enabled or disabled * @param policy the current DiscoveryPolicy of the BTAdapter, chosen via BTAdapter::startDiscovery() * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). * * changeScanType(const ScanType current, const bool enable, const ScanType enableChanged) noexcept { */ virtual void discoveringChanged(BTAdapter &adapter, const ScanType currentMeta, const ScanType changedType, const bool changedEnabled, const DiscoveryPolicy policy, const uint64_t timestamp) { (void)adapter; (void)currentMeta; (void)changedType; (void)changedEnabled; (void)policy; (void)timestamp; } /** * A BTDevice has been newly discovered. * <p> * The boolean return value informs the adapter whether the device shall be made persistent for connection `true`, * or that it can be discarded `false`.<br> * If no registered AdapterStatusListener::deviceFound() implementation returns `true`, * the device instance will be removed from all internal lists and can no longer being used.<br> * If any registered AdapterStatusListener::deviceFound() implementation returns `true`, * the device will be made persistent, is ready to connect and BTDevice::remove() shall be called after usage. * </p> * * BTDevice::unpair() has been called already. * * @param device the found device * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). * @return true if the device shall be made persistent and BTDevice::remove() issued later. Otherwise false to remove device right away. * @see BTDevice::unpair() */ virtual bool deviceFound(BTDeviceRef device, const uint64_t timestamp) { (void)device; (void)timestamp; return false; } /** * An already discovered BTDevice has been updated. * @param device the updated device * @param updateMask the update mask of changed data * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). */ virtual void deviceUpdated(BTDeviceRef device, const EIRDataType updateMask, const uint64_t timestamp) { (void)device; (void)updateMask; (void)timestamp; } /** * BTDevice got connected * * If a BTRole::Master BTDevice gets connected, BTDevice::unpair() has been called already. * * @param device the device which has been connected, holding the new connection handle. * @param handle the new connection handle, which has been assigned to the device already * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). * @see BTDevice::unpair() */ virtual void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) { (void)device; (void)handle; (void)timestamp; } /** * An already connected BTDevice's ::SMPPairingState has changed. * @param device the device which PairingMode has been changed. * @param state the current ::SMPPairingState of the connected device, see BTDevice::getCurrentPairingState() * @param mode the current ::PairingMode of the connected device, see BTDevice::getCurrentPairingMode() * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). * @see BTDevice::setPairingPasskey() * @see BTDevice::setPairingNumericComparison() */ virtual void devicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, const uint64_t timestamp) { (void)device; (void)state; (void)mode; (void)timestamp; } /** * BTDevice is ready for user (GATT) processing, i.e. already connected, optionally (SMP) paired. * In case of a LE connection, GATT MTU size is negotiated and GATT services discovered. * <p> * Method is being called from a dedicated native thread, hence restrictions on method duration and complex mutable operations don't apply here. * </p> * @param device the device ready to use * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). * @see ::SMPPairingState::COMPLETED */ virtual void deviceReady(BTDeviceRef device, const uint64_t timestamp) { (void)device; (void)timestamp; } /** * BTDevice got disconnected * * BTDevice::unpair() has been called already. * * @param device the device which has been disconnected with zeroed connection handle. * @param reason the HCIStatusCode reason for disconnection * @param handle the disconnected connection handle, which has been unassigned from the device already * @param timestamp the time in monotonic milliseconds when this event occurred. See BasicTypes::getCurrentMilliseconds(). * @see BTDevice::unpair() */ virtual void deviceDisconnected(BTDeviceRef device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) { (void)device; (void)reason; (void)handle; (void)timestamp; } virtual ~AdapterStatusListener() {} virtual std::string toString() const = 0; /** * Default comparison operator, merely testing for same memory reference. * <p> * Specializations may override. * </p> */ virtual bool operator==(const AdapterStatusListener& rhs) const { return this == &rhs; } bool operator!=(const AdapterStatusListener& rhs) const { return !(*this == rhs); } }; // ************************************************* // ************************************************* // ************************************************* namespace impl { struct StatusListenerPair { /** The actual listener */ std::shared_ptr<AdapterStatusListener> listener; /** The optional weak device reference. Weak, b/c it shall not block destruction */ std::weak_ptr<BTDevice> wbr_device; }; } /** * BTAdapter represents one local Bluetooth Controller. * * @anchor BTAdapterRoles * Local BTAdapter roles (see getRole()): * * - {@link BTRole::Master}: The local adapter is discovering remote ::BTRole::Slave {@link BTDevice}s and may initiate connections. Enabled via startDiscovery(), but also per default at construction. * - {@link BTRole::Slave}: The local adapter is advertising to remote ::BTRole::Master {@link BTDevice}s and may accept connections. Enabled explicitly via startAdvertising() until startDiscovery(). * * Note the remote {@link BTDevice}'s [opposite role](@ref BTDeviceRoles). * * Controlling Environment variables: * - 'direct_bt.debug.adapter.event': Debug messages about events, see debug_events * * @see BTDevice * @see @ref BTDeviceRoles * @see @ref BTGattHandlerRoles * @see [Bluetooth Specification](https://www.bluetooth.com/specifications/bluetooth-core-specification/) */ class BTAdapter : public BTObject { private: friend BTManager; const bool debug_event, debug_lock; BTManager& mgmt; AdapterInfo adapterInfo; /** Flag signaling whether initialize() has been called, regardless of success. */ jau::sc_atomic_bool adapter_initialized; /** Flag signaling whether initialize() has powered-on this adapter. */ jau::sc_atomic_bool adapter_poweredon_at_init; LE_Features le_features; /** BT5: Using extended scanning. */ bool hci_uses_ext_scan; /** BT5: Using extended connect. */ bool hci_uses_ext_conn; /** BT5: Using extended advertising. */ bool hci_uses_ext_adv; /** * Either the adapter's initially reported public address or a random address setup via HCI before discovery or advertising. */ BDAddressAndType visibleAddressAndType; public: /** * Adapter's internal temporary device id. * <p> * The internal device id is constant across the adapter lifecycle, * but may change after its destruction. */ const uint16_t dev_id; private: jau::ordered_atomic<BTRole, std::memory_order::memory_order_relaxed> btRole; // = BTRole::Master (default) HCIHandler hci; jau::ordered_atomic<AdapterSetting, std::memory_order::memory_order_relaxed> old_settings; jau::ordered_atomic<ScanType, std::memory_order::memory_order_relaxed> currentMetaScanType; // = ScanType::NONE jau::ordered_atomic<DiscoveryPolicy, std::memory_order::memory_order_relaxed> discovery_policy; // = DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY jau::relaxed_atomic_bool scan_filter_dup; // = true; SMPIOCapability iocap_defaultval = SMPIOCapability::UNSET; const BTDevice* single_conn_device_ptr = nullptr; std::mutex mtx_single_conn_device; std::condition_variable cv_single_conn_device; typedef jau::darray<BTDeviceRef> device_list_t; typedef jau::darray<std::weak_ptr<BTDevice>> weak_device_list_t; /** All discovered devices: Transient until removeDiscoveredDevices(), startDiscovery(). */ device_list_t discoveredDevices; /** All connected devices: Transient until disconnect or removal. */ device_list_t connectedDevices; /** All active shared devices: Persistent until removal. Final holder of BTDevice lifecycle! */ device_list_t sharedDevices; /** All connected devices for which discovery has been paused. */ weak_device_list_t pausing_discovery_devices; typedef jau::cow_darray<impl::StatusListenerPair> statusListenerList_t; statusListenerList_t statusListenerList; // Storing SMPKeyBin entries, referenced by their remote address, i.e. BTDevice address. std::string key_path; typedef std::shared_ptr<SMPKeyBin> SMPKeyBinRef; typedef jau::darray<SMPKeyBinRef> key_list_t; key_list_t key_list; DBGattServerRef gattServerData = nullptr; mutable std::mutex mtx_discoveredDevices; mutable std::mutex mtx_connectedDevices; mutable std::mutex mtx_pausingDiscoveryDevices; mutable std::mutex mtx_discovery; mutable std::mutex mtx_sharedDevices; // final mutex of all BTDevice lifecycle mutable std::mutex mtx_keys; mutable jau::sc_atomic_bool sync_data; bool updateDataFromHCI() noexcept; bool updateDataFromAdapterInfo() noexcept; bool initialSetup() noexcept; bool enableListening(const bool enable) noexcept; static BTDeviceRef findDevice(device_list_t & devices, const EUI48 & address, const BDAddressType addressType) noexcept; static BTDeviceRef findDevice(device_list_t & devices, BTDevice const & device) noexcept; static BTDeviceRef findWeakDevice(weak_device_list_t & devices, const EUI48 & address, const BDAddressType addressType) noexcept; static BTDeviceRef findWeakDevice(weak_device_list_t & devices, BTDevice const & device) noexcept; static void printDeviceList(const std::string& prefix, const BTAdapter::device_list_t& list) noexcept; static void printWeakDeviceList(const std::string& prefix, BTAdapter::weak_device_list_t& list) noexcept; /** Private class only for private make_shared(). */ class ctor_cookie { friend BTAdapter; ctor_cookie(const uint16_t secret) { (void)secret; } }; /** Private std::make_shared<BTAdapter>(..) vehicle for friends. */ static std::shared_ptr<BTAdapter> make_shared(BTManager& mgmt_, const AdapterInfo& adapterInfo_) { return std::make_shared<BTAdapter>(BTAdapter::ctor_cookie(0), mgmt_, adapterInfo_); } /** * Closes all device connections, stops discovery and cleans up all references. * <p> * To be called at * * - destructor or when powered off (active = true) * - AdapterSetting changed, POWERED disabled, just powered off (active = false) * - when `!isPowered()` is detected in methods (active = false) * </p> * @param active true if still powered and actively stopDiscovery and disconnect devices, otherwise this is a passive operation */ void poweredOff(bool active) noexcept; friend BTDeviceRef BTDevice::getSharedInstance() const noexcept; friend void BTDevice::remove() noexcept; friend BTDevice::~BTDevice() noexcept; friend std::shared_ptr<ConnectionInfo> BTDevice::getConnectionInfo() noexcept; friend void BTDevice::sendMgmtEvDeviceDisconnected(std::unique_ptr<MgmtEvent> evt) noexcept; friend HCIStatusCode BTDevice::disconnect(const HCIStatusCode reason) noexcept; friend HCIStatusCode BTDevice::connectLE(uint16_t interval, uint16_t window, uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t supervision_timeout) noexcept; friend HCIStatusCode BTDevice::connectBREDR(const uint16_t pkt_type, const uint16_t clock_offset, const uint8_t role_switch) noexcept; friend void BTDevice::processL2CAPSetup(BTDeviceRef sthis); friend bool BTDevice::updatePairingState(BTDeviceRef sthis, const MgmtEvent& evt, const HCIStatusCode evtStatus, SMPPairingState claimed_state) noexcept; friend void BTDevice::hciSMPMsgCallback(BTDeviceRef sthis, const SMPPDUMsg& msg, const HCIACLData::l2cap_frame& source) noexcept; friend void BTDevice::processDeviceReady(BTDeviceRef sthis, const uint64_t timestamp); friend bool BTDevice::connectGATT(std::shared_ptr<BTDevice> sthis) noexcept; bool lockConnect(const BTDevice & device, const bool wait, const SMPIOCapability io_cap) noexcept; bool unlockConnect(const BTDevice & device) noexcept; bool unlockConnectAny() noexcept; bool addDevicePausingDiscovery(const BTDeviceRef & device) noexcept; bool removeDevicePausingDiscovery(const BTDevice & device, const bool off_thread_enable) noexcept; BTDeviceRef findDevicePausingDiscovery (const EUI48 & address, const BDAddressType & addressType) noexcept; void clearDevicesPausingDiscovery() noexcept; bool hasDevicesPausingDiscovery() noexcept; bool addConnectedDevice(const BTDeviceRef & device) noexcept; bool removeConnectedDevice(const BTDevice & device) noexcept; int disconnectAllDevices(const HCIStatusCode reason=HCIStatusCode::REMOTE_USER_TERMINATED_CONNECTION ) noexcept; BTDeviceRef findConnectedDevice (const EUI48 & address, const BDAddressType & addressType) noexcept; int getConnectedDeviceCount() const noexcept; bool addDiscoveredDevice(BTDeviceRef const &device) noexcept; void removeDevice(BTDevice & device) noexcept; bool addSharedDevice(BTDeviceRef const &device) noexcept; BTDeviceRef getSharedDevice(const BTDevice & device) noexcept; void removeSharedDevice(const BTDevice & device) noexcept; static SMPKeyBinRef findSMPKeyBin(key_list_t & keys, BDAddressAndType const & remoteAddress) noexcept; static bool removeSMPKeyBin(key_list_t & keys, BDAddressAndType const & remoteAddress, const bool remove_file, const std::string key_path_) noexcept; SMPKeyBinRef findSMPKeyBin(BDAddressAndType const & remoteAddress) noexcept; /** Adding a SMPKeyBin will remove previous entry. */ bool addSMPKeyBin(const SMPKeyBinRef& key, const bool write_file) noexcept; bool removeSMPKeyBin(BDAddressAndType const & remoteAddress, const bool remove_file) noexcept; bool mgmtEvNewSettingsMgmt(const MgmtEvent& e) noexcept; void updateAdapterSettings(const bool off_thread, const AdapterSetting new_settings, const bool sendEvent, const uint64_t timestamp) noexcept; bool mgmtEvDeviceDiscoveringMgmt(const MgmtEvent& e) noexcept; bool mgmtEvLocalNameChangedMgmt(const MgmtEvent& e) noexcept; bool mgmtEvDeviceFoundHCI(const MgmtEvent& e) noexcept; bool mgmtEvPairDeviceCompleteMgmt(const MgmtEvent& e) noexcept; bool mgmtEvNewLongTermKeyMgmt(const MgmtEvent& e) noexcept; bool mgmtEvNewLinkKeyMgmt(const MgmtEvent& e) noexcept; bool mgmtEvHCIAnyHCI(const MgmtEvent& e) noexcept; bool mgmtEvDeviceDiscoveringHCI(const MgmtEvent& e) noexcept; bool mgmtEvDeviceConnectedHCI(const MgmtEvent& e) noexcept; bool mgmtEvConnectFailedHCI(const MgmtEvent& e) noexcept; bool mgmtEvHCILERemoteUserFeaturesHCI(const MgmtEvent& e) noexcept; bool mgmtEvHCILEPhyUpdateCompleteHCI(const MgmtEvent& e) noexcept; bool mgmtEvDeviceDisconnectedHCI(const MgmtEvent& e) noexcept; // Local BTRole::Slave bool mgmtEvLELTKReqEventHCI(const MgmtEvent& e) noexcept; bool mgmtEvLELTKReplyAckCmdHCI(const MgmtEvent& e) noexcept; bool mgmtEvLELTKReplyRejCmdHCI(const MgmtEvent& e) noexcept; // Local BTRole::Master bool mgmtEvLEEnableEncryptionCmdHCI(const MgmtEvent& e) noexcept; bool mgmtEvHCIEncryptionChangedHCI(const MgmtEvent& e) noexcept; bool mgmtEvHCIEncryptionKeyRefreshCompleteHCI(const MgmtEvent& e) noexcept; void updateDeviceDiscoveringState(const ScanType eventScanType, const bool eventEnabled, const bool off_thread) noexcept; bool mgmtEvDeviceDiscoveringAny(const ScanType eventScanType, const bool eventEnabled, const uint64_t eventTimestamp, const bool hciSourced, const bool off_thread) noexcept; bool mgmtEvPinCodeRequestMgmt(const MgmtEvent& e) noexcept; bool mgmtEvUserConfirmRequestMgmt(const MgmtEvent& e) noexcept; bool mgmtEvUserPasskeyRequestMgmt(const MgmtEvent& e) noexcept; bool mgmtEvAuthFailedMgmt(const MgmtEvent& e) noexcept; bool mgmtEvDeviceUnpairedMgmt(const MgmtEvent& e) noexcept; bool hciSMPMsgCallback(const BDAddressAndType & addressAndType, const SMPPDUMsg& msg, const HCIACLData::l2cap_frame& source) noexcept; void sendDevicePairingState(BTDeviceRef device, const SMPPairingState state, const PairingMode mode, uint64_t timestamp) noexcept; void notifyPairingStageDone(BTDeviceRef device, uint64_t timestamp) noexcept; void sendDeviceReady(BTDeviceRef device, uint64_t timestamp) noexcept; void startDiscoveryBackground() noexcept; void checkDiscoveryState() noexcept; void sendAdapterSettingsChanged(const AdapterSetting old_settings_, const AdapterSetting current_settings, AdapterSetting changes, const uint64_t timestampMS) noexcept; void sendAdapterSettingsInitial(AdapterStatusListener & asl, const uint64_t timestampMS) noexcept; void sendDeviceUpdated(std::string cause, BTDeviceRef device, uint64_t timestamp, EIRDataType updateMask) noexcept; int removeAllStatusListener(const BTDevice& d); public: /** Private ctor for private BTAdapter::make_shared() intended for friends. */ BTAdapter(const BTAdapter::ctor_cookie& cc, BTManager& mgmt_, const AdapterInfo& adapterInfo_) noexcept; BTAdapter(const BTAdapter&) = delete; void operator=(const BTAdapter&) = delete; /** * Releases this instance. */ ~BTAdapter() noexcept; /** * Closes this instance, usually being called by destructor or when this adapter is being removed * as recognized and handled by BTManager. * <p> * In case initialize() has powered-on this adapter and was not powered-on before, * it will be powered-off. * </p> * <p> * Renders this adapter's BTAdapter#isValid() state to false. * </p> * @see initialize() * @see setPowered() */ void close() noexcept; std::string get_java_class() const noexcept override { return java_class(); } static std::string java_class() noexcept { return std::string(JAVA_DBT_PACKAGE "DBTAdapter"); } /** * Returns whether the adapter is valid, plugged in and powered. * @return true if BTAdapter::isValid(), HCIHandler::isOpen() and AdapterSetting::POWERED state is set. * @see #isSuspended() * @see #isValid() */ bool isPowered() const noexcept { return isValid() && hci.isOpen() && adapterInfo.isCurrentSettingBitSet(AdapterSetting::POWERED); } /** * Returns whether the adapter is suspended, i.e. valid and plugged in, but not powered. * @return true if BTAdapter::isValid(), HCIHandler::isOpen() and AdapterSetting::POWERED state is not set. * @see #isPowered() * @see #isValid() */ bool isSuspended() const noexcept { return isValid() && hci.isOpen() && !adapterInfo.isCurrentSettingBitSet(AdapterSetting::POWERED); } bool hasSecureConnections() const noexcept { return adapterInfo.isCurrentSettingBitSet(AdapterSetting::SECURE_CONN); } bool hasSecureSimplePairing() const noexcept { return adapterInfo.isCurrentSettingBitSet(AdapterSetting::SSP); } /** * Return LE_Features for this controller. * <pre> * BT Core Spec v5.2: Vol 6, Part B, 4.6 (LE LL) Feature Support * </pre> */ constexpr LE_Features getLEFeatures() const noexcept { return le_features; } /** Returns true if HCI_LE_Set_Extended_Scan_Parameters and HCI_LE_Set_Extended_Scan_Enable is supported (Bluetooth 5.0). */ constexpr bool hasHCIExtScan() const noexcept { return hci_uses_ext_scan; } /** Returns true if HCI_LE_Extended_Create_Connection is supported (Bluetooth 5.0). */ constexpr bool hasHCIExtConn() const noexcept { return hci_uses_ext_conn; } /** Returns true if HCI_LE_Extended_Advertising Data is supported (Bluetooth 5.0). */ constexpr bool hasHCIExtAdv() const noexcept { return hci_uses_ext_adv; } /** * Returns whether the adapter is valid, i.e. reference is valid, plugged in and generally operational, * but not necessarily BTAdapter::isPowered() powered. * @return true if this adapter references are valid and hasn't been BTAdapter::close() 'ed * @see #isPowered() * @see #isSuspended() */ bool isValid() const noexcept { return BTObject::isValid(); } /** * Return the current BTRole of this adapter. * @see BTRole * @see @ref BTAdapterRoles * @since 2.4.0 */ BTRole getRole() const noexcept { return btRole; } /** * Returns the current BTMode of this adapter. */ BTMode getBTMode() const noexcept { return adapterInfo.getCurrentBTMode(); } /** * Returns the adapter's public BDAddressAndType. * <p> * The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType::BDADDR_LE_PUBLIC. * </p> * @since 2.2.8 * @see #getVisibleAddressAndType() */ BDAddressAndType const & getAddressAndType() const noexcept { return adapterInfo.addressAndType; } /** * Returns the adapter's currently visible BDAddressAndType. * <p> * The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType::BDADDR_LE_PUBLIC. * </p> * <p> * The adapter's visible BDAddressAndType might be set to BDAddressType::BDADDR_LE_RANDOM before scanning / discovery mode (TODO). * </p> * @since 2.2.8 * @see #getAddressAndType() */ BDAddressAndType const & getVisibleAddressAndType() const noexcept { return visibleAddressAndType; } /** * Returns the name. * <p> * Can be changed via setName() while powered-off. * </p> * @see setName() */ std::string getName() const noexcept { return adapterInfo.getName(); } /** * Returns the short name. * <p> * Can be changed via setName() while powered-off. * </p> * @see setName() */ std::string getShortName() const noexcept { return adapterInfo.getShortName(); } /** * Sets the name and short-name. * <p> * Shall be performed while powered-off. * </p> * <p> * The corresponding management event will change the name and short-name. * </p> * @see getName() * @see getShortName() * @since 2.4.0 */ HCIStatusCode setName(const std::string &name, const std::string &short_name) noexcept; /** * Set the power state of the adapter. * * In case current power state is already as desired, method will not change the power state. * * @param power_on true will power on this adapter if it is powered-off and vice versa. * @return true if successfully powered-on, -off or unchanged, false on failure * @see isInitialized() * @see close() * @see initialize() */ bool setPowered(const bool power_on) noexcept; /** * Returns whether Secure Connections (SC) is enabled. * @see setSecureConnections() * @since 2.4.0 */ bool getSecureConnectionsEnabled() const noexcept { return adapterInfo.isCurrentSettingBitSet(AdapterSetting::SECURE_CONN); } /** * Enable or disable Secure Connections (SC) of the adapter. * * By default, Secure Connections (SC) is enabled if supported. * * @param enable * @return true if successful, otherwise false * @see getSecureConnectionsEnabled() * @since 2.4.0 */ bool setSecureConnections(const bool enable) noexcept; /** * Set the adapter's persistent storage directory for SMPKeyBin files. * - if set, all SMPKeyBin instances will be managed and persistent. * - if not set, all SMPKeyBin instances will be transient only. * * When called, all keys within the path will be loaded, * i.e. issuing uploadKeys() for all keys belonging to this BTAdapter. * * Persistent SMPKeyBin management is only functional when BTAdapter is in BTRole::Slave peripheral mode. * * For each SMPKeyBin file one shared BTDevice in BTRole::Master will be instantiated * when uploadKeys() is called. * * @param path persistent storage path to SMPKeyBin files * @see uploadKeys() */ void setSMPKeyPath(const std::string path) noexcept; /** * Associate the given SMPKeyBin with the contained remote address, i.e. SMPKeyBin::getRemoteAddrAndType(). * * Further uploads the Long Term Key (LTK) and Link Key (LK) for a potential upcoming connection, * if they are contained in the given SMPKeyBin file. * * This method is provided to support BTRole::Slave peripheral adapter mode, * allowing user to inject all required keys after initialize() * * One shared BTDevice in BTRole::Master is instantiated. * * @param bin SMPKeyBin instance, might be persistent in filesystem * @param write if true, write file to persistent storage, otherwise not * @return HCIStatusCode::SUCCESS or an error state on failure * @see setSMPKeyPath() * @see BTDevice::uploadKeys() */ HCIStatusCode uploadKeys(SMPKeyBin& bin, const bool write) noexcept; /** * Initialize the adapter with default values, including power-on. * <p> * Method shall be issued on the desired adapter found via ChangedAdapterSetFunc. * </p> * <p> * While initialization, the adapter is first powered-off, setup and then powered-on. * </p> * <p> * Calling the method will allow close() to power-off the adapter, * if not powered on before. * </p> * @param btMode the desired adapter's BTMode, defaults to BTMode::DUAL * @return HCIStatusCode::SUCCESS or an error state on failure (e.g. power-on) * @see isInitialized() * @see close() * @see setPowered() * @since 2.4.0 */ HCIStatusCode initialize(const BTMode btMode=BTMode::DUAL) noexcept; /** * Returns true, if initialize() has already been called for this adapter, otherwise false. * * @see initialize() * @since 2.4.0 */ bool isInitialized() const noexcept { return adapter_initialized.load(); } /** * Reset the adapter. * <p> * The semantics are specific to the HCI host implementation, * however, it shall comply at least with the HCI Reset command * and bring up the device from standby into a POWERED functional state afterwards. * </p> * <pre> * BT Core Spec v5.2: Vol 4, Part E HCI: 7.3.2 Reset command * </pre> */ HCIStatusCode reset() noexcept; /** * Sets default preference of LE_PHYs. * * BT Core Spec v5.2: Vol 4, Part E, 7.8.49 LE Set PHY command * * @param Tx transmitter LE_PHYs bit mask of preference if not set to LE_PHYs::NONE (ignored). * @param Rx receiver LE_PHYs bit mask of preference if not set to LE_PHYs::NONE (ignored). * @return * @see BTDevice::getTxPhys() * @see BTDevice::getRxPhys() * @see BTDevice::getConnectedLE_PHY() * @see BTDevice::setConnectedLE_PHY() * @since 2.4.0 */ HCIStatusCode setDefaultLE_PHY(const LE_PHYs Tx, const LE_PHYs Rx) noexcept; /** * Returns a reference to the used singleton BTManager instance, used to create this adapter. */ BTManager& getManager() const noexcept { return mgmt; } /** * Returns a reference to the aggregated HCIHandler instance. */ HCIHandler& getHCI() noexcept { return hci; } /** * Returns true, if the adapter's device is already whitelisted. */ bool isDeviceWhitelisted(const BDAddressAndType & addressAndType) noexcept; /** * Add the given device to the adapter's autoconnect whitelist. * <p> * The given connection parameter will be uploaded to the kernel for the given device first. * </p> * <p> * Method will reject duplicate devices, in which case it should be removed first. * </p> * * @param address * @param address_type * @param ctype * @param conn_interval_min in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms] * @param conn_interval_max in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms] * @param conn_latency slave latency in units of connection events, default value 0; Value range [0 .. 0x01F3]. * @param supervision_timeout in units of 10ms, default value >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s]. * @return true if the device was already added or has been newly added to the adapter's whitelist. */ bool addDeviceToWhitelist(const BDAddressAndType & addressAndType, const HCIWhitelistConnectType ctype, const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12, const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15)); /** Remove the given device from the adapter's autoconnect whitelist. */ bool removeDeviceFromWhitelist(const BDAddressAndType & addressAndType); // device discovery aka device scanning /** * Add the given listener to the list if not already present. * <p> * In case the AdapterStatusListener's lifecycle and event delivery * shall be constrained to this device, please use * BTDevice::addStatusListener(). * </p> * <p> * Returns true if the given listener is not element of the list and has been newly added, * otherwise false. * </p> * <p> * The newly added AdapterStatusListener will receive an initial * AdapterStatusListener::adapterSettingsChanged(..) event, * passing an empty AdapterSetting::NONE oldMask and changedMask, as well as current AdapterSetting newMask. <br> * This allows the receiver to be aware of this adapter's current settings. * </p> * @see BTDevice::addStatusListener() * @see removeStatusListener() * @see removeAllStatusListener() */ bool addStatusListener(std::shared_ptr<AdapterStatusListener> l); /** * Please use BTDevice::addStatusListener() for clarity, merely existing here to allow JNI access. */ bool addStatusListener(const BTDevice& d, std::shared_ptr<AdapterStatusListener> l); /** * Remove the given listener from the list. * <p> * Returns true if the given listener is an element of the list and has been removed, * otherwise false. * </p> * @see BTDevice::removeStatusListener() * @see addStatusListener() */ bool removeStatusListener(std::shared_ptr<AdapterStatusListener> l); /** * Remove the given listener from the list. * <p> * Returns true if the given listener is an element of the list and has been removed, * otherwise false. * </p> * @see BTDevice::removeStatusListener() * @see addStatusListener() */ bool removeStatusListener(const AdapterStatusListener * l); /** * Remove all status listener from the list. * <p> * Returns the number of removed status listener. * </p> */ int removeAllStatusListener() noexcept; /** * Starts discovery. * * Returns HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state; * * Depending on given DiscoveryPolicy `policy`, the discovery mode may be turned-off, * paused until a certain readiness stage has been reached or preserved at all times. * Default is DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY. * * Using startDiscovery(keepAlive=true) and stopDiscovery() * is the recommended workflow for a reliable discovery process. * * <pre> * + --+-------+--------+-----------+----------------------------------------------------+ * | # | meta | native | keepAlive | Note * +---+-------+--------+-----------+----------------------------------------------------+ * | 1 | true | true | false | - * | 2 | false | false | false | - * +---+-------+--------+-----------+----------------------------------------------------+ * | 3 | true | true | true | - * | 4 | true | false | true | temporarily disabled -> startDiscoveryBackground() * | 5 | false | false | true | [4] -> [5] requires manual DISCOVERING event * +---+-------+--------+-----------+----------------------------------------------------+ * </pre> * * Default parameter values are chosen for using public address resolution * and usual discovery intervals etc. * * Method will always clear previous discovered devices via removeDiscoveredDevices(). * * Method fails if isAdvertising(). * * If successful, method also changes [this adapter's role](@ref BTAdapterRoles) to ::BTRole::Master. * * This adapter's HCIHandler instance is used to initiate scanning, * see HCIHandler::le_start_scan(). * * @param policy defaults to DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY, see DiscoveryPolicy * @param le_scan_active true enables delivery of active scanning PDUs like EIR w/ device name (default), otherwise no scanning PDUs shall be sent. * @param le_scan_interval in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s] * @param le_scan_window in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]. Shall be <= le_scan_interval * @param filter_policy 0x00 accepts all PDUs (default), 0x01 only of whitelisted, ... * @param filter_dup true to filter out duplicate AD PDUs (default), otherwise all will be reported. * @return HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state * @see stopDiscovery() * @see isDiscovering() * @see isAdvertising() * @see DiscoveryPolicy * @see @ref BTAdapterRoles * @since 2.5.0 */ HCIStatusCode startDiscovery(const DiscoveryPolicy policy=DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_READY, const bool le_scan_active=true, const uint16_t le_scan_interval=24, const uint16_t le_scan_window=24, const uint8_t filter_policy=0x00, const bool filter_dup=true) noexcept; private: HCIStatusCode stopDiscovery(const bool forceDiscoveringEvent, const bool temporary) noexcept; public: /** * Ends discovery. * <p> * This adapter's HCIHandler instance is used to stop scanning, * see HCIHandler::le_enable_scan(). * </p> * @return HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state * @see startDiscovery() * @see isDiscovering() */ HCIStatusCode stopDiscovery() noexcept; /** * Return the current DiscoveryPolicy, set via startDiscovery(). * @since 2.5.1 */ DiscoveryPolicy getCurrentDiscoveryPolicy() const noexcept { return discovery_policy; } /** * Manual DiscoveryPolicy intervention point, allowing user to remove the ready device from * the queue of pausing-discovery devices. * * Manual intervention might be desired, if using DiscoveryPolicy::PAUSE_CONNECTED_UNTIL_DISCONNECTED, * but allowing discovery at an earlier processing step from AdapterStatusListener::deviceReady(). * * Re-enabling discovery is performed on the current thread. * * @param device the BTDevice to remove from the pausing-discovery queue * @return true if this was the last BTDevice, re-enabling discovery. Otherwise false. * @since 2.5.1 */ bool removeDevicePausingDiscovery(const BTDevice & device) noexcept { return removeDevicePausingDiscovery(device, false /* off_thread_enable */); } /** * Returns the current meta discovering ScanType. It can be modified through startDiscovery(..) and stopDiscovery(). * <p> * Note that if startDiscovery(..) has been issued with keepAlive==true, * the meta ScanType will still keep the desired ScanType enabled * even if it has been temporarily disabled. * </p> * @see startDiscovery() * @see stopDiscovery() */ ScanType getCurrentScanType() const noexcept { return currentMetaScanType; } /** * Returns the adapter's current native discovering ScanType. * It can be modified through startDiscovery(..) and stopDiscovery(). * @see startDiscovery() * @see stopDiscovery() */ ScanType getCurrentNativeScanType() const noexcept{ return hci.getCurrentScanType(); } /** * Returns true if the meta discovering state is not ::ScanType::NONE. * It can be modified through startDiscovery(..) and stopDiscovery(). * @see startDiscovery() * @see stopDiscovery() * @since 2.4.0 */ bool isDiscovering() const noexcept { return ScanType::NONE != currentMetaScanType; } /** * Returns discovered devices from the last discovery. * <p> * Note that this list will be cleared when a new discovery is started over via startDiscovery(). * </p> * <p> * Note that devices in this list might be no more available, * use 'DeviceStatusListener::deviceFound(..)' callback. * </p> */ jau::darray<BTDeviceRef> getDiscoveredDevices() const noexcept; /** Discards all discovered devices. Returns number of removed discovered devices. */ int removeDiscoveredDevices() noexcept; /** Discards matching discovered devices. Returns `true` if found and removed, otherwise false. */ bool removeDiscoveredDevice(const BDAddressAndType & addressAndType) noexcept; /** Returns shared BTDevice if found, otherwise nullptr */ BTDeviceRef findDiscoveredDevice (const EUI48 & address, const BDAddressType addressType) noexcept; /** Returns shared BTDevice if found, otherwise nullptr */ BTDeviceRef findSharedDevice (const EUI48 & address, const BDAddressType addressType) noexcept; /** * Starts advertising * <pre> * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.53 LE Set Extended Advertising Parameters command (Bluetooth 5.0) * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.54 LE Set Extended Advertising Data command (Bluetooth 5.0) * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.55 LE Set Extended Scan Response Data command (Bluetooth 5.0) * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0) * * if available, otherwise using * * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.5 LE Set Advertising Parameters command * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.7 LE Set Advertising Data command * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.8 LE Set Scan Response Data command * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command * </pre> * * Method fails if isDiscovering() or has any open or pending connected remote {@link BTDevice}s. * * * If successful, method also changes [this adapter's role](@ref BTAdapterRoles) to ::BTRole::Slave * and treat connected BTDevice as ::BTRole::Master while service ::GATTRole::Server. * * * This adapter's HCIHandler instance is used to initiate scanning, * see HCIHandler::le_start_adv(). * * @param gattServerData_ the DBGattServer data to be advertised and offered via GattHandler as ::GATTRole::Server. * Its handles will be setup via DBGattServer::setServicesHandles(). * Reference is held until next disconnect. * @param adv_interval_min in units of 0.625ms, default value 0x0800 for 1.28s; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s] * @param adv_interval_max in units of 0.625ms, default value 0x0800 for 1.28s; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s] * @param adv_type see AD_PDU_Type, default ::AD_PDU_Type::ADV_IND * @param adv_chan_map bit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled) * @param filter_policy 0x00 accepts all PDUs (default), 0x01 only of whitelisted, ... * @return HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state * @see stopAdvertising() * @see isAdvertising() * @see isDiscovering() * @see @ref BTAdapterRoles * @see DBGattServer::setServicesHandles() * @since 2.4.0 */ HCIStatusCode startAdvertising(DBGattServerRef gattServerData_, const uint16_t adv_interval_min=0x0800, const uint16_t adv_interval_max=0x0800, const AD_PDU_Type adv_type=AD_PDU_Type::ADV_IND, const uint8_t adv_chan_map=0x07, const uint8_t filter_policy=0x00) noexcept; /** * Ends advertising. * <pre> * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0) * * if available, otherwise using * * BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command * </pre> * <p> * This adapter's HCIHandler instance is used to stop scanning, * see HCIHandler::le_enable_adv(). * </p> * @return HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state * @see startAdvertising() * @see isAdvertising() * @since 2.4.0 */ HCIStatusCode stopAdvertising() noexcept; /** * Returns the adapter's current advertising state. It can be modified through startAdvertising(..) and stopAdvertising(). * @see startAdvertising() * @see stopAdvertising() * @since 2.4.0 */ bool isAdvertising() const noexcept { return hci.isAdvertising(); } /** * Return the user's DBGattServer shared reference if in ::BTRole::Slave mode * as set via startAdvertising() and valid until subsequent disconnect. * * Returns nullptr if in ::BTRole::Master mode. */ DBGattServerRef getGATTServerData() { return gattServerData; } std::string toString() const noexcept override { return toString(false); } std::string toString(bool includeDiscoveredDevices) const noexcept; /** * Print the internally maintained BTDevice lists to stderr: * - sharedDevices * - connectedDevice * - discoveredDevices * - StatusListener * * This is intended as a debug facility. */ void printDeviceLists() noexcept; void printStatusListenerList() noexcept; }; } // namespace direct_bt #endif /* BT_ADAPTER_HPP_ */
49.968148
248
0.600785
sgothel
6c628f48178e2969e1a3b1913a239104d7effd65
601
cpp
C++
src/lib/Stage.cpp
radixzz/SDL-3d-particles
4df9a453c3524740f4a57ab24a152c6e987fa019
[ "MIT" ]
null
null
null
src/lib/Stage.cpp
radixzz/SDL-3d-particles
4df9a453c3524740f4a57ab24a152c6e987fa019
[ "MIT" ]
null
null
null
src/lib/Stage.cpp
radixzz/SDL-3d-particles
4df9a453c3524740f4a57ab24a152c6e987fa019
[ "MIT" ]
null
null
null
#include <SDL.h> #include <memory> #include "Stage.h" #include "Log.h" namespace sax { Stage::Stage() { container = std::make_unique< DisplayObject >(); viewport = { 0 }; } Stage::~Stage() { } void Stage::setViewport( SDL_Rect viewport ) { this->viewport = viewport; } void Stage::render( RendererDescriptor* rendererDescriptor ) { container->draw( rendererDescriptor ); } void Stage::addChild( DisplayObject* displayObject ) { container->addChild( displayObject ); } void Stage::removeChild( DisplayObject* displayObject ) { container->removeChild( displayObject ); } }
18.78125
63
0.690516
radixzz
483fee2d59969f231f2e26680426893c992c4c8c
470
cpp
C++
iri_navigation/iri_akp_local_planner_car/src/akp_local_planner_car_alg.cpp
yinzixuan126/modified_dwa
b379c01e37adc1f6414005750633b05e1a024ae5
[ "MIT" ]
6
2019-12-30T04:00:16.000Z
2021-09-10T23:59:30.000Z
iri_navigation/iri_akp_local_planner_car/src/akp_local_planner_car_alg.cpp
yinzixuan126/modified_dwa
b379c01e37adc1f6414005750633b05e1a024ae5
[ "MIT" ]
null
null
null
iri_navigation/iri_akp_local_planner_car/src/akp_local_planner_car_alg.cpp
yinzixuan126/modified_dwa
b379c01e37adc1f6414005750633b05e1a024ae5
[ "MIT" ]
5
2019-05-17T02:35:36.000Z
2021-04-17T00:34:53.000Z
#include "akp_local_planner_car_alg.h" AkpLocalPlannerAlgorithm::AkpLocalPlannerAlgorithm(void) { pthread_mutex_init(&this->access_,NULL); } AkpLocalPlannerAlgorithm::~AkpLocalPlannerAlgorithm(void) { pthread_mutex_destroy(&this->access_); } void AkpLocalPlannerAlgorithm::config_update(Config& new_cfg, uint32_t level) { this->lock(); // save the current configuration this->config_=new_cfg; this->unlock(); } // AkpLocalPlannerAlgorithm Public API
19.583333
77
0.776596
yinzixuan126
4844af78d23c1fb8f7375d1f53ceb61fe2b82af8
1,320
cpp
C++
espaudio/SineWave.cpp
tmerr/electronics
414b8ec9594d97e394032ccf47f135b500bcf9ee
[ "MIT" ]
1
2020-01-04T19:20:05.000Z
2020-01-04T19:20:05.000Z
espaudio/SineWave.cpp
tmerr/electronics
414b8ec9594d97e394032ccf47f135b500bcf9ee
[ "MIT" ]
null
null
null
espaudio/SineWave.cpp
tmerr/electronics
414b8ec9594d97e394032ccf47f135b500bcf9ee
[ "MIT" ]
null
null
null
#include "SineWave.hpp" #include "build/sintable.c" #include <math.h> SineWave::SineWave(uint32_t period): period(period), phase(0) {} // compute the index into the sine table, ignoring phase uint32_t compute_index(uint32_t time, uint32_t period) { return ((SINRESOLUTION * (uint64_t)time) / (uint64_t)period) % SINRESOLUTION; } uint32_t add_modulo_sin_res(uint32_t a, uint32_t b) { uint32_t result = a + b; if (result >= SINRESOLUTION) { result -= SINRESOLUTION; } return result; } uint32_t sub_modulo_sin_res(uint32_t a, uint32_t b) { return add_modulo_sin_res(a, SINRESOLUTION - b); } uint16_t SineWave::sample(uint32_t time) { uint32_t index = add_modulo_sin_res(this->phase, compute_index(time, this->period)); return sinetable[index]; } uint16_t SineWave::sampleAndChangePeriod(uint32_t time, uint32_t newperiod) { if (newperiod == this->period) { return sample(time); } else { uint32_t phaseless = compute_index(time, newperiod); this->phase = add_modulo_sin_res( this->phase, sub_modulo_sin_res( compute_index(time, this->period), phaseless ) ); this->period = newperiod; return sinetable[add_modulo_sin_res(this->phase, phaseless)]; } }
29.333333
88
0.662121
tmerr
484d10262e51731d560227991ff72c378e40c2fb
430
cpp
C++
src/TextColor.cpp
chakaponden/meetangee-task
bc340ae5ea6817691f76de1f299e380ba26182fb
[ "MIT" ]
null
null
null
src/TextColor.cpp
chakaponden/meetangee-task
bc340ae5ea6817691f76de1f299e380ba26182fb
[ "MIT" ]
null
null
null
src/TextColor.cpp
chakaponden/meetangee-task
bc340ae5ea6817691f76de1f299e380ba26182fb
[ "MIT" ]
null
null
null
/** * @file TextColor.cpp * @brief A simple C++ wrapper for terminal text colorize implementation */ #include "TextColor.h" using Color::TextColor; TextColor::TextColor(const Color::TextColorCode& colorCode) noexcept : _code(colorCode) { } void TextColor::SetCode(const Color::TextColorCode& colorCode) noexcept { _code = colorCode; } Color::TextColorCode TextColor::GetCode() const noexcept { return _code; }
17.916667
72
0.727907
chakaponden
484d9af039fac79abef150a98adc7d61c07be5af
793
hpp
C++
libs/parse/include/fcppt/parse/state_impl.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
libs/parse/include/fcppt/parse/state_impl.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
libs/parse/include/fcppt/parse/state_impl.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
// Copyright Carl Philipp Reh 2009 - 2018. // 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 FCPPT_PARSE_STATE_IMPL_HPP_INCLUDED #define FCPPT_PARSE_STATE_IMPL_HPP_INCLUDED #include <fcppt/reference_impl.hpp> #include <fcppt/parse/state_decl.hpp> #include <fcppt/config/external_begin.hpp> #include <iosfwd> #include <fcppt/config/external_end.hpp> template< typename Ch > fcppt::parse::state< Ch >::state( fcppt::reference< stream_type > const _stream ) : stream_{ _stream } { } template< typename Ch > typename fcppt::parse::state< Ch >::stream_type & fcppt::parse::state< Ch >::stream() const { return this->stream_.get(); } #endif
15.86
61
0.717528
pmiddend
4852ca4726d896ec09dc49e5807c6c0cb860c3e1
7,985
hpp
C++
sdk/include/meta.hpp
qianxj/XExplorer
00e326da03ffcaa21115a2345275452607c6bab5
[ "MIT" ]
null
null
null
sdk/include/meta.hpp
qianxj/XExplorer
00e326da03ffcaa21115a2345275452607c6bab5
[ "MIT" ]
null
null
null
sdk/include/meta.hpp
qianxj/XExplorer
00e326da03ffcaa21115a2345275452607c6bab5
[ "MIT" ]
null
null
null
#ifndef META_H #define META_H #include "turing.hpp" #include "pred.hpp" #include "word.hpp" #include <stack> #include "hashcontext.hpp" #include "wpppred.hpp" #include "type.hpp" using namespace std; using namespace wpp::how; struct VLANG3_API WContext { CWord global; #pragma warning( push ) #pragma warning( disable : 4251 ) stack<CWord> scope; #pragma warning( pop ) CHashContext hashContext; const static int eAny = 0x00; const static int eType = 0x01; const static int eClass = 0x02; const static int eMethod = 0x04; const static int eField = 0x08; const static int eParam = 0x10; const static int eVar = 0x20; const static int eItem = eField|eParam|eVar; int id_undef; WContext(); CWord get_scope_top(); CWord & push_item(CWord & w); CWord & enter_scope(CWord & w); void leave_scope(); CWord lookup(const wchar_t* name,int what = eAny); CWord lookup_item(const wchar_t * name); CWord lookup_method(const wchar_t * name); CWord lookup_type(const wchar_t * name); CWord lookup_class(const wchar_t * name); CWord lookup_in(CWord& w,const wchar_t* name); CWord lookup(CWord axis, const wchar_t* name); CWord lookup(CWord axis, const wchar_t* name,int what); CWord lookup_item(CWord axis,const wchar_t * name); CWord lookup_method(CWord axis,const wchar_t * name); CWord lookup_type(CWord axis,const wchar_t * name); CWord lookup_class(CWord axis,const wchar_t * name); }; class VLANG3_API wMetaTable { private: WContext wcontext_; public: WContext * get_context(); #if 0 public: struct wMethod; struct VLANG3_API wClass { int ntype; int nField; int nParam; wMetaTable* metaTable; wClass(){} wClass(wMetaTable* metaTable_):ntype(0),nField(0),nParam(0), metaTable(metaTable_){} wClass& append_super(unsigned spec, const wchar_t* name); wClass& append_super(unsigned spec, CWord & pSuper); wClass& append_field(unsigned spec, const wchar_t* name, int ntype, int dval=0); wMethod* append_method(unsigned spec, const wchar_t* name, int ntype); wClass& append_param(unsigned spec, const wchar_t* name, int ntype, int dval=0); void leave_scope(); CWord get_word(); }; struct VLANG3_API wMethod { int nMethod; int nParam; int nArg; int nVar; wClass* wclass; wMetaTable* metaTable; wMethod(wClass* wclass_):nVar(0),nArg(0),nParam(0),nMethod(0),wclass(wclass_),metaTable(wclass_->metaTable){} wMethod(wMetaTable* metaTable_):nMethod(0),nVar(0),nArg(0),nParam(0),wclass(0),metaTable(metaTable_){} wMethod& append_param(unsigned spec, const wchar_t* name, int ntype, int dval=0); wMethod& append_arg(unsigned spec, const wchar_t* name, int ntype, int dval=0); wMethod& append_var(unsigned spec, const wchar_t* name, int ntype); wMethod& append_type(unsigned spec, const wchar_t* name, int ntype); wMethod& append_code(vector<unsigned char> & code, int from); wClass& leave_scope(); wClass& get_class() { return *wclass;} int get_method_addr(); CWord get_word(); int make_var_frame(); void* get_var_frame(); int make_param_frame(); void* get_param_frame(); int get_param_count(); int get_var_count(); CWord::iterator get_var_begin(); CWord::iterator get_param_begin(); CWord::iterator get_param(int nIndex); CWord::iterator get_var(int nIndex); int get_param_offset(int nIndex); int get_var_offset(int nIndex); int get_param_type(int nIndex); int get_var_type(int nIndex); int get_item_index(CWord item,int & nItemType); }; #endif public: wMetaTable(); public: void init_context(WContext& context); public: #if 0 wClass* declare_class(const wchar_t* name, const wchar_t* area); wClass* declare_class(CWord w); wMethod* append_method(unsigned spec, const wchar_t* name, int ntype); //wMethod* append_method(unsigned spec, const wchar_t* name, int ntype); public: unsigned int get_spec(const wchar_t* spec); int get_type(const wchar_t* name); #endif public: //method #if 0 int make_var_frame(CWord fn); void* get_var_frame(CWord fn); int make_param_frame(CWord fn); void* get_param_frame(CWord fn); #endif int get_method_addr(CWord fn); int get_param_count(CWord fn); int get_var_count(CWord fn); CWord::iterator get_var_begin(CWord fn); CWord::iterator get_param_begin(CWord fn); #if 0 int get_param_offset(CWord fn,int nIndex); int get_var_offset(CWord fn,int nIndex); int get_param_type(CWord fn,int nIndex); int get_var_type(CWord fn,int nIndex); #endif CWord::iterator get_param(CWord fn,int nIndex); CWord::iterator get_var(CWord fn,int nIndex); #if 0 int get_tvm_type(const wchar_t* typname); int get_item_index(CWord fn,CWord item,int & nItemType); #endif public: const CWordValue & get_node_type(CWord& node); void set_node_type(CWord & node, wpp_ast_t nodetype); //get node by word bool is_class_node(CWord& node); bool is_namespace_node(CWord& node); bool is_param_node(CWord& node); bool is_arg_node(CWord& node); bool is_var_node(CWord& node); bool is_field_node(CWord& node); bool is_method_node(CWord& node); //get node by word value bool is_class_node(const CWordValue & v); bool is_namespace_node(const CWordValue & v); bool is_param_node(const CWordValue & v); bool is_var_node(const CWordValue & v); bool is_arg_node(const CWordValue & v); bool is_field_node(const CWordValue & v); bool is_method_node(const CWordValue & v); public: bool is_static_spec(int spec) {return spec & wpp::type_spec::static_?true:false;} bool is_byref_spec(int spec){ return spec & wpp::type_spec::byref_?true:false;} public: bool is_class_type(wpp::type_t typ){return typ == wpp::type::class_ || typ == wpp::type::struct_ ||typ == wpp::type::interface_;} bool is_struct_type(wpp::type_t typ){return typ == wpp::type::struct_;} public: int calc_arg_offset(CWord fn,CWord & arg,bool owner = false); int calc_var_offset(CWord fn,CWord & var,bool owner = false); int calc_var_offset(CWord fn); int calc_arg_offset(CWord fn); public: int get_size(CWord & typ); int get_static_size(CWord & typ); public: int calc_class_align_size(CWord & wclass,int & msize, int align = 4); int calc_field_offset(CWord & wclass, CWord & field, int align = 4); int calc_field_offset(CWord & wclass, CWord & field,bool & bfound, int align = 4); public: bool type_can_imp_conv(wpp::type_t ty1,wpp::type_t ty2); static wpp::type_t node_to_type(CWord & ty); public: int find_matched_method( CWord * nest, const wchar_t* ident, int nargs,const std::vector<wpp::type_t> &typs); bool method_arg_matched(CWord & fn, int nargs,const std::vector<wpp::type_t> &typs); public: CWord find_method(wchar_t * class_name, wchar_t* method_name); CWord findOleChild(CWord &item,const wchar_t * tk); public: int get_method_args( CWord fn, std::vector<wpp::type_t> &typs); int get_method_args_spec( CWord fn, std::vector<wpp::type_t> &spec); CWord get_method_arg( CWord fn, int index); public: CWord declare_class(const wchar_t* name,bool enter_scope=true); CWord declare_class(CWord& ns, const wchar_t* name,bool enter_scope=true); CWord append_super(CWord &wc, unsigned spec, const wchar_t* name); void append_super(CWord &wc, unsigned spec, CWord & pSuper); CWord append_field(CWord &wc, unsigned spec, const wchar_t* name, int ntype, int dval=0); CWord append_method(CWord &wc, unsigned spec, const wchar_t* name, int ntype); CWord append_param(CWord &wc, unsigned spec, const wchar_t* name, int ntype, int dval=0); CWord append_pred(CWord &wc, const wchar_t* name); CWord append_preditem(CWord &wc, const wchar_t* name,int ns); CWord append_arg(CWord &wm,unsigned spec, const wchar_t* name, int ntype, int dval=0); CWord append_var(CWord &wm,unsigned spec, const wchar_t* name, int ntype); CWord append_type(CWord &wm,unsigned spec,const wchar_t* name, int ntype); public: bool is_super(CWord &super, CWord &w); public: const static int native_ptr_offset = 4; int calc_class_vtable(CWord &wc,std::vector<int> &items); static int find_match_as_method(CWord &wc, CWord &wm); }; #endif //META_H
34.5671
130
0.742768
qianxj
4856d65039f79c17e14c99f7796cd8cc62222e7d
2,380
hpp
C++
components/misc/utf8stream.hpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
components/misc/utf8stream.hpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
components/misc/utf8stream.hpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
#ifndef MISC_UTF8ITER_HPP #define MISC_UTF8ITER_HPP #include <boost/tuple/tuple.hpp> class Utf8Stream { public: typedef uint32_t UnicodeChar; typedef unsigned char const * Point; //static const unicode_char sBadChar = 0xFFFFFFFF; gcc can't handle this static UnicodeChar sBadChar () { return UnicodeChar (0xFFFFFFFF); } Utf8Stream (Point begin, Point end) : cur (begin), nxt (begin), end (end), val(Utf8Stream::sBadChar()) { } Utf8Stream (std::pair <Point, Point> range) : cur (range.first), nxt (range.first), end (range.second), val(Utf8Stream::sBadChar()) { } bool eof () const { return cur == end; } Point current () const { return cur; } UnicodeChar peek () { if (cur == nxt) next (); return val; } UnicodeChar consume () { if (cur == nxt) next (); cur = nxt; return val; } static std::pair <UnicodeChar, Point> decode (Point cur, Point end) { if ((*cur & 0x80) == 0) { UnicodeChar chr = *cur++; return std::make_pair (chr, cur); } int octets; UnicodeChar chr; boost::tie (octets, chr) = octet_count (*cur++); if (octets > 5) return std::make_pair (sBadChar(), cur); Point eoc = cur + octets; if (eoc > end) return std::make_pair (sBadChar(), cur); while (cur != eoc) { if ((*cur & 0xC0) != 0x80) // check continuation mark return std::make_pair (sBadChar(), cur); chr = (chr << 6) | UnicodeChar ((*cur++) & 0x3F); } return std::make_pair (chr, cur); } private: static std::pair <int, UnicodeChar> octet_count (unsigned char octet) { int octets; unsigned char mark = 0xC0; unsigned char mask = 0xE0; for (octets = 1; octets <= 5; ++octets) { if ((octet & mask) == mark) break; mark = (mark >> 1) | 0x80; mask = (mask >> 1) | 0x80; } return std::make_pair (octets, octet & ~mask); } void next () { boost::tie (val, nxt) = decode (nxt, end); } Point cur; Point nxt; Point end; UnicodeChar val; }; #endif
20.34188
93
0.509664
Bodillium
485e7e5a2dd98d6fafe79e49f5e36233af8d0911
8,670
cpp
C++
src/lib/foundations/data_structures/classify_bitvectors.cpp
abetten/orbiter
5994d0868a26c37676d6aadfc66a1f1bcb715c4b
[ "RSA-MD" ]
15
2016-10-27T15:18:28.000Z
2022-02-09T11:13:07.000Z
src/lib/foundations/data_structures/classify_bitvectors.cpp
abetten/orbiter
5994d0868a26c37676d6aadfc66a1f1bcb715c4b
[ "RSA-MD" ]
4
2019-12-09T11:49:11.000Z
2020-07-30T17:34:45.000Z
src/lib/foundations/data_structures/classify_bitvectors.cpp
abetten/orbiter
5994d0868a26c37676d6aadfc66a1f1bcb715c4b
[ "RSA-MD" ]
15
2016-06-10T20:05:30.000Z
2020-12-18T04:59:19.000Z
// classify_bitvectors.cpp // // Anton Betten // // December 23, 2017 #include "foundations.h" using namespace std; namespace orbiter { namespace foundations { classify_bitvectors::classify_bitvectors() { null(); } classify_bitvectors::~classify_bitvectors() { freeself(); } void classify_bitvectors::null() { nb_types = 0; Type_data = NULL; Type_rep = NULL; Type_mult = NULL; Type_extra_data = NULL; rep_len = 0; n = 0; N = 0; type_of = NULL; C_type_of = NULL; perm = NULL; } void classify_bitvectors::freeself() { int i; if (Type_data) { for (i = 0; i < nb_types; i++) { FREE_uchar(Type_data[i]); } FREE_puchar(Type_data); } if (Type_extra_data) { for (i = 0; i < nb_types; i++) { //FREE_uchar(Type_data[i]); } FREE_pvoid(Type_extra_data); } if (Type_rep) { FREE_int(Type_rep); } if (Type_mult) { FREE_int(Type_mult); } if (type_of) { FREE_int(type_of); } if (C_type_of) { FREE_OBJECT(C_type_of); } if (perm) { FREE_int(perm); } null(); } void classify_bitvectors::init(int N, int rep_len, int verbose_level) { int f_v = (verbose_level >= 1); int i; if (f_v) { cout << "classify_bitvectors::init" << endl; } classify_bitvectors::N = N; classify_bitvectors::rep_len = rep_len; Type_data = NEW_puchar(N); Type_extra_data = NEW_pvoid(N); Type_rep = NEW_int(N); Type_mult = NEW_int(N); type_of = NEW_int(N); for (i = 0; i < N; i++) { type_of[i] = -1; } nb_types = 0; n = 0; C_type_of = NULL; perm = NULL; if (f_v) { cout << "classify_bitvectors::init done" << endl; } } int classify_bitvectors::search(uchar *data, int &idx, int verbose_level) { int f_v = (verbose_level >= 1); int ret; sorting Sorting; if (f_v) { cout << "classify_bitvectors::search" << endl; } if (Sorting.vec_search((void **) Type_data, compare_func_for_bitvectors, (void *) this, nb_types, data, idx, 0 /*verbose_level - 1*/)) { ret = TRUE; } else { ret = FALSE; } if (f_v) { cout << "classify_bitvectors::search done ret=" << ret << endl; } return ret; } void classify_bitvectors::search_and_add_if_new(uchar *data, void *extra_data, int &f_found, int &idx, int verbose_level) { int f_v = (verbose_level >= 1); sorting Sorting; if (f_v) { cout << "classify_bitvectors::add rep_len=" << rep_len << endl; } if (n >= N) { cout << "classify_bitvectors::add n >= N" << endl; cout << "n=" << n << endl; cout << "N=" << N << endl; exit(1); } if (Sorting.vec_search((void **) Type_data, compare_func_for_bitvectors, (void *) this, nb_types, data, idx, verbose_level - 2)) { if (f_v) { cout << "classify_bitvectors::add vec_search returns TRUE, idx=" << idx << endl; } type_of[n] = idx; Type_mult[idx]++; f_found = TRUE; } else { if (f_v) { cout << "classify_bitvectors::add vec_search returns FALSE, new bitvector, before add_at_idx" << endl; } add_at_idx(data, extra_data, idx, 0/*verbose_level*/); if (f_v) { cout << "classify_bitvectors::add vec_search returns FALSE, new bitvector, after add_at_idx" << endl; } f_found = FALSE; } n++; if (f_v) { cout << "classify_bitvectors::add done, nb_types=" << nb_types << endl; } } int classify_bitvectors::compare_at(uchar *data, int idx) { int ret; ret = compare_func_for_bitvectors((void **) Type_data[idx], data, (void *) this); return ret; } void classify_bitvectors::add_at_idx(uchar *data, void *extra_data, int idx, int verbose_level) { int f_v = (verbose_level >= 1); int i; sorting Sorting; if (f_v) { cout << "classify_bitvectors::add_at_idx" << endl; } for (i = nb_types; i > idx; i--) { Type_data[i] = Type_data[i - 1]; Type_extra_data[i] = Type_extra_data[i - 1]; Type_rep[i] = Type_rep[i - 1]; Type_mult[i] = Type_mult[i - 1]; } Type_data[idx] = NEW_uchar(rep_len); for (i = 0; i < rep_len; i++) { Type_data[idx][i] = data[i]; } Type_extra_data[idx] = extra_data; Type_rep[idx] = n; Type_mult[idx] = 1; nb_types++; for (i = 0; i < n; i++) { if (type_of[i] >= idx) { type_of[i]++; } } type_of[n] = idx; } void classify_bitvectors::finalize(int verbose_level) { int f_v = (verbose_level >= 1); sorting Sorting; if (f_v) { cout << "classify_bitvectors::finalize" << endl; } C_type_of = NEW_OBJECT(tally); C_type_of->init(type_of, N, FALSE, 0); int *v; int i; perm = NEW_int(nb_types); v = NEW_int(nb_types); for (i = 0; i < nb_types; i++) { perm[i] = i; v[i] = Type_rep[i]; } Sorting.int_vec_heapsort_with_log(v, perm, nb_types); FREE_int(v); if (f_v) { cout << "classify_bitvectors::finalize done" << endl; } } void classify_bitvectors::print_reps() { int i; cout << "We found " << nb_types << " types:" << endl; for (i = 0; i < nb_types; i++) { cout << i << " : " << Type_rep[i] << " : " << Type_mult[i] << " : "; #if 0 for (j = 0; j < rep_len; j++) { cout << (int) Type_data[i][j]; if (j < rep_len - 1) { cout << ", "; } } #endif cout << endl; } } void classify_bitvectors::print_table() { int i, j; cout << "We found " << nb_types << " types:" << endl; for (i = 0; i < nb_types; i++) { cout << i << " : " << Type_rep[i] << " : " << Type_mult[i] << " : "; for (j = 0; j < rep_len; j++) { cout << (int) Type_data[i][j]; if (j < rep_len - 1) { cout << ", "; } } cout << endl; } } void classify_bitvectors::save( std::string &prefix, void (*encode_function)(void *extra_data, long int *&encoding, int &encoding_sz, void *global_data), void (*get_group_order_or_NULL)(void *extra_data, longinteger_object &go, void *global_data), void *global_data, int verbose_level) { int f_v = (verbose_level >= 1); string fname_txt; string fname_csv; int i, j; if (f_v) { cout << "classify_bitvectors::save" << endl; } fname_txt.assign(prefix); fname_txt.append("_iso.txt"); fname_csv.assign(prefix); fname_csv.append("_iso.csv"); if (perm == NULL) { cout << "classify_bitvectors::save perm == NULL" << endl; exit(1); } long int *Reps = NULL; // [nb_types * sz] int sz = 0; if (f_v) { cout << "classify_bitvectors::save writing file " << fname_txt << endl; } { ofstream fp(fname_txt); int h; for (i = 0; i < nb_types; i++) { j = perm[i]; long int *encoding; int encoding_sz; if (f_v) { cout << "classify_bitvectors::save " << i << " / " << nb_types << " j=" << j << " before encode_function" << endl; } (*encode_function)(Type_extra_data[j], encoding, encoding_sz, global_data); if (f_v) { cout << "classify_bitvectors::save " << i << " / " << nb_types << " encoding_sz=" << encoding_sz << endl; } fp << encoding_sz; for (h = 0; h < encoding_sz; h++) { fp << " " << encoding[h]; } if (get_group_order_or_NULL) { longinteger_object go; (*get_group_order_or_NULL)(Type_extra_data[j], go, global_data); fp << " "; go.print_not_scientific(fp); } fp << endl; if (i == 0) { sz = encoding_sz; Reps = NEW_lint(nb_types * sz); Orbiter->Lint_vec.copy(encoding, Reps, sz); } else { if (encoding_sz != sz) { cout << "encoding_sz != sz" << endl; exit(1); } Orbiter->Lint_vec.copy(encoding, Reps + i * sz, sz); } FREE_lint(encoding); } fp << "-1 " << nb_types << " " << N << endl; } file_io Fio; if (f_v) { cout << "classify_bitvectors::save Written " "file " << fname_txt << " of size " << Fio.file_size(fname_txt) << " with " << nb_types << " orbit representatives obtained from " << N << " candidates, encoding size = " << sz << endl; } if (f_v) { cout << "classify_bitvectors::save writing " "file " << fname_csv << endl; } Fio.lint_matrix_write_csv(fname_csv, Reps, nb_types, sz); if (f_v) { cout << "classify_bitvectors::save " "Written file " << fname_csv << " of size " << Fio.file_size(fname_csv) << " with " << nb_types << " orbit representatives obtained from " << N << " candidates, encoding size = " << sz << endl; } if (Reps) { FREE_lint(Reps); } if (f_v) { cout << "classify_bitvectors::save done" << endl; } } int compare_func_for_bitvectors(void *a, void *b, void *data) { classify_bitvectors *CB = (classify_bitvectors *) data; uchar *A = (uchar *) a; uchar *B = (uchar *) b; int i; //cout << "compare_func_for_bitvectors CB->rep_len=" << CB->rep_len << endl; for (i = 0; i < CB->rep_len; i++) { //cout << "i = " << i << " A[i]=" << (int) A[i] << " B[i]=" << (int) B[i] << endl; if (A[i] < B[i]) { return -1; } if (A[i] > B[i]) { return 1; } } return 0; } }}
20.023095
105
0.593772
abetten
486965c56f0d0027406a56fb38a1179563781e2c
28,937
hxx
C++
ivp/ivp_physics/ivp_core.hxx
DannyParker0001/Kisak-Strike
99ed85927336fe3aff2efd9b9382b2b32eb1d05d
[ "Unlicense" ]
252
2020-12-16T15:34:43.000Z
2022-03-31T23:21:37.000Z
ivp/ivp_physics/ivp_core.hxx
DannyParker0001/Kisak-Strike
99ed85927336fe3aff2efd9b9382b2b32eb1d05d
[ "Unlicense" ]
23
2020-12-20T18:02:54.000Z
2022-03-28T16:58:32.000Z
ivp/ivp_physics/ivp_core.hxx
DannyParker0001/Kisak-Strike
99ed85927336fe3aff2efd9b9382b2b32eb1d05d
[ "Unlicense" ]
42
2020-12-19T04:32:33.000Z
2022-03-30T06:00:28.000Z
// Copyright (C) Ipion Software GmbH 1999-2000. All rights reserved. // IVP_EXPORT_PUBLIC #ifndef _IVP_CORE_INCLUDED #define _IVP_CORE_INCLUDED #ifndef WIN32 # pragma interface #endif /******************************************************************************** * Name: ivp_core.hxx * Description: the real simulation core of an object * Attention: many internal variables are defined here, so don't get confused. * Version Info: this file constantly evolves, handle with care ********************************************************************************/ const IVP_DOUBLE MAX_OBJECT_ROT_SPEED = IVP_PI * 0.5f; // max_rotation speed class IVP_Object; class IVP_Real_Object; class IVP_Core; class IVP_Friction_System; class IVP_Environment; class IVP_Friction_Info_For_Core; class IVP_Core_Merged; class IVP_Friction_Hash; class IVP_Simulation_Unit; #define IVP_OBJECT_MOVING_FAST 1.0f /*[m/sec]*/ // #define DEBUG_FRICTION_CONSISTENCY /******************************************************************************** * Name: IVP_Vec_PCore * Description: Class used as convinient way to calculate the core * coordinates of a direction. * Attention: Does only work during PSIs ********************************************************************************/ class IVP_Vec_PCore : public IVP_U_Float_Point { public: IVP_Vec_PCore(const IVP_Core *pc, const IVP_U_Float_Point *direction_ws_in); }; class IVP_Old_Sync_Rot_Z { public: IVP_U_Float_Point old_sync_rot_speed; IVP_U_Quat old_sync_q_world_f_core_next_psi; IVP_BOOL was_pushed_during_i_s; }; /******************************************************************************** * Name: IVP_Core_Friction_Info * Description: internal usage ********************************************************************************/ union IVP_Core_Friction_Info { struct { IVP_Friction_Hash *l_friction_info_hash; } for_unmoveables; struct { IVP_Friction_Info_For_Core *moveable_core_friction_info; } for_moveables; }; class IVP_Vector_of_Objects:public IVP_U_Vector<IVP_Real_Object> { IVP_Real_Object *elem_buffer[1]; public: IVP_Vector_of_Objects(): IVP_U_Vector<IVP_Real_Object>( (void **)&elem_buffer[0],1 ){;}; void reset(){ elems = (void **)&elem_buffer[0]; memsize = 1; } }; /******************************************************************************** * Name: IVP_Core * Description: The core of an object is the class handling the physical * simulation part of an object that is independent from * surface descriptions etc. Through splitting the logical * object from this simulation part, you can use a * single core for more than one object, thus allowing merged * objects (e.g. to create breakable objects). * Attention: Use only functions that are declared at the end * of this class declaration. ********************************************************************************/ class IVP_Core_Fast_Static { friend class IVP_Real_Object; public: /******************************************************************************** * type: private, public READ ONLY * section: basic, non redundant, long time unchangeable section * Note (*): Only values marked with (*) may be changed during simulation without problems * (don't forget to call calc_calc() afterwards) * Note: For memory reasons, the flags will be combined to a bit-area soon. * So use the corresponding functions to read/set them. ********************************************************************************/ IVP_BOOL fast_piling_allowed_flag:2; IVP_BOOL physical_unmoveable:2; // never any movement IVP_BOOL is_in_wakeup_vec:2; IVP_BOOL rot_inertias_are_equal:2; IVP_BOOL pinned:2; IVP_FLOAT upper_limit_radius; // the radius of the object around the mass center IVP_FLOAT max_surface_deviation; // for all P of all Surfaces S: maximum P * S IVP_Environment *environment; // Backlink class IVP_Constraint_Car_Object *car_wheel; // bad bad hack for optimized wheel behaviour; protected: IVP_U_Float_Hesse rot_inertia; // needed for energy calculation, mass is w part public: IVP_U_Float_Point rot_speed_damp_factor; // (*) dampening of speed, one value per axis: new speed *= 1/e**(rot_speed_damp_factor * delta_time) /******************************************************************************** * type: private, public READ ONLY * section: basic, redundant, long time unchangeable section (updated by calc_calc) ********************************************************************************/ private: IVP_U_Float_Hesse inv_rot_inertia; // 1.0f/rot_inertia, 4th value is inverse_mass public: IVP_FLOAT speed_damp_factor; // (*) same for speed IVP_FLOAT inv_object_diameter; // 2.0f/upper_limit_radius IVP_U_Float_Point *spin_clipping; // if set, than angular velocities are individually clipped against this value /******************************************************************************** * section: internal logical section ********************************************************************************/ IVP_Vector_of_Objects objects; // All objects for this core. /******************************************************************************** * type: private, internal * section: friction, systems ********************************************************************************/ IVP_Core_Friction_Info core_friction_info; const class IVP_U_Point_4 *get_inv_masses(){ return (class IVP_U_Point_4*)& inv_rot_inertia;} // combined solution for inertias IVP_FLOAT get_mass() const{ return rot_inertia.hesse_val; }; const IVP_U_Float_Point *get_rot_inertia()const{ return &rot_inertia;}; const IVP_U_Float_Point *get_inv_rot_inertia() const{ return &inv_rot_inertia;}; IVP_FLOAT get_inv_mass() const{ return inv_rot_inertia.hesse_val;}; }; class IVP_Core_Fast_PSI: public IVP_Core_Fast_Static { public: /******************************************************************************** * type private, public READ ONLY * section: basic simulation part, non redundant part ********************************************************************************/ IVP_Movement_Type movement_state:8; // Movement state IVP_BOOL temporarily_unmovable:8; short impacts_since_last_PSI; IVP_Time time_of_last_psi; // Indicates point in simulation time the last matrizes are valid at. /******************************************************************************** * type: private, public READ ONLY * section: basic simulation part, redundant part, calculated by calc_next_PSI_matrix ********************************************************************************/ IVP_FLOAT i_delta_time; // 1.0f / (delta_time) // #+# check for empty space (due to align(16)) IVP_U_Float_Point rot_speed_change; // Accumulates async_rot_pushes, units like this->rot_speed. IVP_U_Float_Point speed_change; // Accumulates async_pushes, units like this->speed. IVP_U_Float_Point rot_speed; // Rotation speed around core axles [rad/s] IVP_U_Float_Point speed; // Translation speed in world system [m/s] IVP_U_Point pos_world_f_core_last_psi; IVP_U_Float_Point delta_world_f_core_psis; IVP_U_Quat q_world_f_core_last_psi; // Rotation of core using quaternions (see m_world_f_core_x_PSI) IVP_U_Quat q_world_f_core_next_psi; // is is the quat to use at a psi IVP_U_Matrix m_world_f_core_last_psi; /* The core matrix valid at PSI (rotation part is redundant, see q_world_f_core_last_psi), * use get_m_world_f_core_PSI() to get a valid pointer to this matrix */ }; /******************************************************************************** * type: IVP_Core_Fast * description: data neded between two psis ********************************************************************************/ class IVP_Core_Fast : public IVP_Core_Fast_PSI { public: // needed for collision detection IVP_U_Float_Point rotation_axis_world_space; // normized q_ncore_f_core IVP_FLOAT current_speed; // speed.real_length() IVP_FLOAT abs_omega; // absolute angular velocity interpolated movement IVP_FLOAT max_surface_rot_speed; // abs_omega * max_surface_deviation }; class IVP_Core: public IVP_Core_Fast { // friend class IVP_Environment; protected: void init(IVP_Real_Object *io); IVP_Core(IVP_Real_Object *io); public: IVP_U_Vector<class IVP_Controller> controllers_of_core; //all controllers our core is controlled of (friction systems, constraints, force fields ...) IVP_Core_Merged *merged_core_which_replace_this_core; // Or NULL when core is terminal. IVP_Simulation_Unit *sim_unit_of_core; /******************************************************************************** * type: private: internal * section: reference matrizes used for movement checking, #+# maybe only for moving objects ********************************************************************************/ IVP_Time time_of_calm_reference[2]; IVP_U_Float_Quat q_world_f_core_calm_reference[2]; // used to check the movement of an objec IVP_U_Float_Point position_world_f_core_calm_reference[2]; #ifdef DEBUG_FRICTION_CONSISTENCY IVP_U_Vector<IVP_Friction_Info_For_Core> list_debug_hash; #endif IVP_Core *union_find_get_father(); union { // #+# merge with tmp_null IVP_Core *union_find_father; // for friction system }tmp; //any values is allowed when not used union { IVP_Old_Sync_Rot_Z *old_sync_info; //is also used as flag ("is core known to impact system") } tmp_null; //warning: tmp_null has to be 0 when not used (some values are flags) IVP_Time_CODE mindist_event_already_done; // used at the end of a impact_system cmp to environment->mindist_event_timestamp_reference /******************************************************************************** * type: private, internal * section: constructor ********************************************************************************/ IVP_Core(IVP_Real_Object *object, const IVP_U_Quat *q_world_f_object_init, const IVP_U_Point *position, IVP_BOOL physical_unmoveable_, IVP_BOOL enable_piling_optimization); ~IVP_Core(); void add_core_controller(IVP_Controller *cntrl); void rem_core_controller(IVP_Controller *cntrl); void add_friction_info(IVP_Friction_Info_For_Core *my_fr_system); void delete_friction_info(IVP_Friction_Info_For_Core *my_fr_system); void unlink_friction_info(IVP_Friction_Info_For_Core *my_fr_system); IVP_BOOL grow_friction_system(); //returns true when system has been grown IVP_Friction_Info_For_Core *get_friction_info(IVP_Friction_System *my_fr_system); IVP_Friction_Info_For_Core *moveable_core_has_friction_info(); void unmovable_core_debug_friction_hash(); /******************************************************************************** * type: private, internal * section: friction debug ********************************************************************************/ void core_plausible_check(); void rot_speed_plausible_check(const IVP_U_Float_Point *rot_speed); void debug_vec_movement_state(); void debug_out_movement_vars(); /******************************************************************************** * type: private, internal * section: FUNCTIONS friction ********************************************************************************/ void update_exact_mindist_events_of_core();// sets mindist_event_already_done and recalculates exact mindist events to all objects with flag not set /******************************************************************************** * type: private, internal * section: FUNCTIONS logical ********************************************************************************/ void unlink_obj_from_core_and_maybe_destroy(IVP_Real_Object *remove_obj); void core_add_link_to_obj(IVP_Real_Object *add_obj); void set_fast_piling_allowed(IVP_BOOL bool_flag) { fast_piling_allowed_flag=bool_flag; }; IVP_BOOL fast_piling_allowed() { return (IVP_BOOL)fast_piling_allowed_flag; }; /******************************************************************************** * type: private, public handle with care * section: initializing basic, non redundant, long time unchangeable section ********************************************************************************/ void set_radius(IVP_FLOAT upper_limit, IVP_FLOAT max_dev); void transform_PSI_matrizes_core(const IVP_U_Matrix *m_core_f_core); // Multiply matrizes with m_core_f_core /******************************************************************************** * Name: set_mass * Description: sets the mass and multiplies all rot_inertias with * new_mass/old_mass. * Attention: Does not update spring constants that are declared * relative. * set_mass is not forwarded to original cores, thus * set_mass may only temporarly change the mass of the * object (till next PSI, object breaks .) ********************************************************************************/ void set_mass(IVP_FLOAT mass); void set_rotation_inertia( const IVP_U_Float_Point *); inline void clip_velocity(IVP_U_Float_Point *velocity, IVP_U_Float_Point *angular_velocity); // parameters are input and output !!! inline void calc_next_PSI_matrix(IVP_U_Vector<IVP_Core> *cores_which_needs_calc_next_psi, class IVP_Event_Sim *){ // call commit_all_calc_next_PSI_matrix afterwards cores_which_needs_calc_next_psi->add(this); } void calc_next_PSI_matrix_zero_speed(class IVP_Event_Sim *); /******************************************************************************** * type: public * section: updates the redundant, long time unchangeable section ********************************************************************************/ void calc_calc(); // calculate redundant part void synchronize_with_rot_z(); // synchronize m_world_f_core_last_psi and time_of_last_psi with interpolation void undo_synchronize_rot_z(); /******************************************************************************** * type: private, internal * section: core state change handling ********************************************************************************/ void init_core_for_simulation(); void stop_physical_movement(); // to avoid unwanted inter/extrapolations on calm objects void fire_event_object_frozen(); // just send events void freeze_simulation_core(); void stop_movement_without_collision_recheck(); IVP_BOOL revive_simulation_core(); // returns true when datastructures are changed void ensure_core_in_simulation_delayed() { environment->add_revive_core(this); } void revive_adjacent_to_unmoveable(); void ensure_core_to_be_in_simulation(); void ensure_all_core_objs_in_simulation(); // for merged cores! void ensure_all_core_objs_in_simulation_now(); // for merged cores! void reset_freeze_check_values(); /******************************************************************************** * type: private, internal * section: different simulation functions ********************************************************************************/ IVP_Movement_Type calc_movement_state(IVP_Time psi_time); void create_collision_merged_core_with(IVP_Core *other_core); // create a merged core void set_matrizes_and_speed(IVP_Core_Merged *template_core, IVP_U_Matrix *m_CORE_f_core_out); // for splitting void reset_time( IVP_Time offset); void damp_object(IVP_DOUBLE virt_delta_time,const IVP_U_Float_Point *rotation_factor, IVP_DOUBLE speed_factor); void global_damp_core(IVP_DOUBLE delta_time); /******************************************************************************** * type: PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC * type: PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC * type: PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC * type: PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC * type: PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC * Description: All functions below this line are meant real public. * * Notes: Use these methods ONLY at PSI!! * floats are used for os and cs and directions * duoble is used for ws * * async_ The core has two sets of speed variables: * speed (rot_speed) and speed_change (rot_speed_change) * the xxx_change variables are used to collect changes to * be added to the real values later. * ALL FUNCTIONS, WHICH MODIFY THE xxx_change VARIABLES * HAVE THE async PREFIX * * test_ In some cases the user does not want to modify the core but * wants to get the result in his own speed and rot_speed variables * THIS FUNCTIONS HAVE THE test_ PREFIX * * _ws xxx_ws means function/variable works in world space * _cs xxx_cs means function/variable works in core space * No such suffix means functions needs parameters defined in different spaces, * check the variable names for details. * * inline_ All inline functions have got the 'inline_' prefix, include ivp_core_macros.hxx * to use them. * * _AT Means: Any time, not restricted to PSI states * (If not otherwise mentioned, functions work correctly at PSI time only) * * rot_push_ The 'rot_' prefix means that the function exerts a rotation * impulse only. * * center_push_ the 'center_' prefix means, core is pushed in mass center, * rot_speed is not changed. * * _on_test In all standard situations, the core's speed and rot_speed * variables are taken as source. If these values are parameters * to the function, the _on_test suffix is appended to the * function name ********************************************************************************/ /******************************************************************************** * section: get the ws speed of any point fixed in core space ********************************************************************************/ void get_surface_speed( const IVP_U_Float_Point *position_cs_in, IVP_U_Float_Point *speed_ws_out) const; void get_surface_speed_ws( const IVP_U_Point *position_ws_in, IVP_U_Float_Point *speed_ws_out); void get_surface_speed_on_test(const IVP_U_Float_Point *position_cs_in, const IVP_U_Float_Point *center_speed_in, const IVP_U_Float_Point *rot_speed_in, IVP_U_Float_Point *speed_ws_out) const; /******************************************************************************** * Name: get_diff_surface_speed_of_two_cores * Description: core_A->get_surface_speed() - core_B->get_surface_speed() ********************************************************************************/ static void get_diff_surface_speed_of_two_cores(const IVP_Core *core_A, const IVP_Core *core_B, const IVP_U_Float_Point *position_A_cs, const IVP_U_Float_Point *position_B_cs, IVP_U_Float_Point *speed_ws_A_minus_B_out); // #+# remove, use inline_get_surface_speed_parallel_to_vector_on_test instead static void get_diff_surface_speed_of_two_cores_on_test(const IVP_Core *core_A, const IVP_Core *core_B, const IVP_U_Float_Point *position_A_cs, const IVP_U_Float_Point *position_B_cs, const IVP_U_Float_Point *speed_A, const IVP_U_Float_Point *rot_speed_A, const IVP_U_Float_Point *speed_B, const IVP_U_Float_Point *rot_speed_B, IVP_U_Float_Point *speed_ws_A_minus_B_out); /******************************************************************************** * section: push the core at a given point and given impulse (#+# will be removed soon) ********************************************************************************/ void push_core (const IVP_U_Float_Point *position_cs_in, const IVP_U_Float_Point *impulse_cs_in, const IVP_U_Float_Point *impulse_ws_in); // very fast, but needs redundant input values void async_push_core (const IVP_U_Float_Point *position_cs_in, const IVP_U_Float_Point *impulse_cs_in, const IVP_U_Float_Point *impulse_ws_in); void test_push_core (const IVP_U_Float_Point *position_cs_in, const IVP_U_Float_Point *impulse_cs_in, const IVP_U_Float_Point *impulse_ws_in, IVP_U_Float_Point *speed_change_out, IVP_U_Float_Point *rot_change_out) const; // very fast, but needs redundant input values /******************************************************************************** * Description: convinient routines of the above functions ********************************************************************************/ void push_core_ws( const IVP_U_Point *position_ws, const IVP_U_Float_Point *impulse_ws); void async_push_core_ws( const IVP_U_Point *position_ws, const IVP_U_Float_Point *impulse_ws); /******************************************************************************** * Description: apply an impulse at the center of mass ********************************************************************************/ void center_push_core_multiple_ws(const IVP_U_Float_Point *impulse_ws, IVP_DOUBLE factor = 1.0f); void async_center_push_core_multiple_ws(const IVP_U_Float_Point *impulse_ws, IVP_DOUBLE factor = 1.0f); /******************************************************************************** * Description: apply an angular impulse at the center of mass ********************************************************************************/ void rot_push_core_multiple_ws(const IVP_U_Float_Point *angular_impulse_ws, IVP_DOUBLE factor = 1.0f); void async_rot_push_core_multiple_ws(const IVP_U_Float_Point *angular_impulse_ws, IVP_DOUBLE factor = 1.0f); /******************************************************************************* * Name: Rot Pushes * Description: Exerts a rotation impulse * Note: The length of the axis * [factor] is the power of rotation impulse ********************************************************************************/ void rot_push_core_cs ( const IVP_U_Float_Point *angular_impulse_cs); void rot_push_core_multiple_cs ( const IVP_U_Float_Point *angular_impulse_cs, IVP_DOUBLE factor = 1.0f); void async_rot_push_core_multiple_cs ( const IVP_U_Float_Point *angular_impulse_cs, IVP_DOUBLE factor = 1.0f); void test_rot_push_core_multiple_cs ( const IVP_U_Float_Point *angular_impulse_cs, IVP_DOUBLE factor, IVP_U_Float_Point *delta_rot_speed_out); /******************************************************************************** * Name: get_energy_on_test * Description: Returns the kinetic energy of the object ********************************************************************************/ IVP_DOUBLE get_energy_on_test(const IVP_U_Float_Point *speed_vec, const IVP_U_Float_Point *rot_speed_vec); /******************************************************************************** * Name: get_rot_inertia_cs * Description: Get the virtual projected rotation inertia for one cs axis ********************************************************************************/ IVP_DOUBLE get_rot_inertia_cs(const IVP_U_Float_Point *normized_axis_cs); /******************************************************************************** * Name: get_rot_speed_cs * Description: Get projected rotation speed for one given axis ********************************************************************************/ IVP_DOUBLE get_rot_speed_cs( const IVP_U_Float_Point *normized_axis_cs); /******************************************************************************** * Name: xxx_all_async_pushes * Description: handle xxx_change variables of core * Note: not really for public use, handle with care ********************************************************************************/ void abort_all_async_pushes(); // clear all xxx_change variables void commit_all_async_pushes(); // make all asynchronous pushes permanent IVP_Environment *get_environment() { return this->environment; }; /******************************************************************************** * Name: calc_correct_virt_mass * Description: Get the virtual mass of a core space point, * given a core direction and a world direction (e.g. of an assumed force vector). * Works like calc_virt_mass but slower and more accurately. ********************************************************************************/ IVP_DOUBLE calc_correct_virt_mass(const IVP_U_Float_Point *position_cs,const IVP_U_Float_Point *direction_core,const IVP_U_Float_Point *direction_world) const; /******************************************************************************** * Name: calc_virt_mass * Description: Estimates the virtual mass of a core space point, * given a core direction (e.g. of an assumed force vector). ********************************************************************************/ IVP_DOUBLE calc_virt_mass(const IVP_U_Float_Point *core_point, const IVP_U_Float_Point *direction)const; // calc the virtual mass of a point /******************************************************************************** * Name: calc_virt_mass_worst_case * Description: Same as above, coarse calculation of minimal virt. mass, * regarding all directions. ********************************************************************************/ IVP_DOUBLE calc_virt_mass_worst_case(const IVP_U_Float_Point *core_point)const; /******************************************************************************************* * section: Calculate core matrix/quaternion/position at a user defined time between * last and next PSI *******************************************************************************************/ void calc_at_matrix(IVP_Time current_time, IVP_U_Matrix *m_world_f_core_out) const; // calc a matrix at any time inline void inline_calc_at_quaternion(IVP_Time time, IVP_U_Quat *quat_out) const; inline void inline_calc_at_position(IVP_Time time, IVP_U_Point *position_out) const; /******************************************************************************** * Name: get_m_world_f_core_PSI * Description: Get the core matrix at PSI time ********************************************************************************/ const IVP_U_Matrix *get_m_world_f_core_PSI() { return &m_world_f_core_last_psi; }; const IVP_U_Point *get_position_PSI() { return m_world_f_core_last_psi.get_position(); }; /******************************************************************************** * Name: values_changed_recalc_redundants * Description: The mass, rotation inertia, or material of associated object * changed. Recalculate some internal variables. Pretty fast. * Call at any time. ********************************************************************************/ void values_changed_recalc_redundants(); //lwss added void apply_velocity_limit(); //lwss end }; #endif /* _IVP_CORE_INCLUDED */
52.90128
212
0.550506
DannyParker0001
486b17ac93b57d8d3261faea2b5ddad9f6f6969e
3,644
cpp
C++
Engine/source/EtFramework/Systems/TransformSystem.cpp
logzero/ETEngine
f766f1a0d702b826b94023edbf64da83dbcf7bc6
[ "MIT" ]
552
2017-08-21T18:12:52.000Z
2022-03-31T15:41:56.000Z
Engine/source/EtFramework/Systems/TransformSystem.cpp
logzero/ETEngine
f766f1a0d702b826b94023edbf64da83dbcf7bc6
[ "MIT" ]
14
2017-08-07T23:36:13.000Z
2021-05-10T08:41:19.000Z
Engine/source/EtFramework/Systems/TransformSystem.cpp
logzero/ETEngine
f766f1a0d702b826b94023edbf64da83dbcf7bc6
[ "MIT" ]
40
2017-10-10T14:42:22.000Z
2022-03-10T07:14:33.000Z
#include "stdafx.h" #include "TransformSystem.h" #include "RigidBodySystem.h" #include <EtFramework/SceneGraph/UnifiedScene.h> namespace et { namespace fw { //===================== // Transform System //===================== //----------------------------------- // TransformSystem::OnComponentAdded // // Register transform components in the render scene when they are added to the ECS // void TransformSystem::OnComponentAdded(EcsController& controller, TransformComponent& component, T_EntityId const entity) { UNUSED(controller); UNUSED(entity); component.m_NodeId = UnifiedScene::Instance().GetRenderScene().AddNode(component.GetWorld()); } //------------------------------------- // TransformSystem::OnComponentRemoved // // Remove respectively // void TransformSystem::OnComponentRemoved(EcsController& controller, TransformComponent& component, T_EntityId const entity) { UNUSED(controller); UNUSED(entity); UnifiedScene::Instance().GetRenderScene().RemoveNode(component.GetNodeId()); } //--------------------------------- // TransformSystem::Compute::c-tor // // dependency setup // TransformSystem::Compute::Compute() { DeclareDependencies<RigidBodySystem>(); // the rigid body system may update transformations DeclareDependents<TransformSystem::Reset>(); } //----------------------------------- // TransformSystem::Compute::Process // // Update transforms // void TransformSystem::Compute::Process(ComponentRange<TransformSystem::ComputeView>& range) { render::Scene& renderScene = UnifiedScene::Instance().GetRenderScene(); for (ComputeView& view : range) { // if neither this component nor the parent component has an updated transform, we don't need to recalculate anything if (!view.transf->HasTransformChanged() && (!view.parent.IsValid() || !view.parent->HasTransformChanged())) { continue; } // this is the local matrix view.transf->m_WorldTransform = math::scale(view.transf->m_Scale) * math::rotate(view.transf->m_Rotation) * math::translate(view.transf->m_Position); if (view.parent.IsValid()) { // transform based on parent matrix view.transf->m_WorldTransform = view.transf->m_WorldTransform * view.parent->m_WorldTransform; // update world variables view.transf->m_WorldPosition = (view.parent->m_WorldTransform * vec4(view.transf->m_Position, 0)).xyz; view.transf->m_WorldRotation = view.parent->GetWorldRotation() * view.transf->m_WorldRotation; view.transf->m_WorldScale = view.parent->GetWorldScale() * view.transf->m_Scale; } else { view.transf->m_WorldPosition = view.transf->m_Position; view.transf->m_WorldRotation = view.transf->m_Rotation; view.transf->m_WorldScale = view.transf->m_Scale; } // orientation helpers view.transf->m_Forward = view.transf->m_WorldRotation * vec3::FORWARD; view.transf->m_Right = view.transf->m_WorldRotation * vec3::RIGHT; view.transf->m_Up = math::cross(view.transf->m_Forward, view.transf->m_Right); // update in the rendering scene renderScene.UpdateNode(view.transf->m_NodeId, view.transf->m_WorldTransform); // since we changed our transform we need to set the transform changed flags so that the change trickles down to children view.transf->m_TransformChanged = TransformComponent::E_TransformChanged::All; } } //--------------------------------- // TransformSystem::Reset::Process // // Reset dirty flag // void TransformSystem::Reset::Process(ComponentRange<TransformSystem::ResetView>& range) { for (ResetView& view : range) { view.transf->m_TransformChanged = TransformComponent::E_TransformChanged::None; } } } // namespace fw } // namespace et
29.387097
123
0.700604
logzero
486cfce8eee2ab5cc06405f384dd23b202f15a5d
2,184
cpp
C++
src/core.cpp
aannleax/vlog
f8b30e298baa90f75aea9fb0cf5a5ff438ce4f2e
[ "Apache-2.0" ]
null
null
null
src/core.cpp
aannleax/vlog
f8b30e298baa90f75aea9fb0cf5a5ff438ce4f2e
[ "Apache-2.0" ]
null
null
null
src/core.cpp
aannleax/vlog
f8b30e298baa90f75aea9fb0cf5a5ff438ce4f2e
[ "Apache-2.0" ]
null
null
null
#include "launcher/vloglayer.cpp" #include "launcher/vlogscan.cpp" #include "vlog/backward/materialization.cpp" #include "vlog/backward/optimizer.cpp" #include "vlog/backward/qsqquery.cpp" #include "vlog/backward/qsqr.cpp" #include "vlog/backward/ruleexecutor.cpp" #include "vlog/common/bindingstable.cpp" #include "vlog/common/concepts.cpp" #include "vlog/common/edb.cpp" #include "vlog/common/edbconf.cpp" #include "vlog/common/exporter.cpp" #include "vlog/common/graph.cpp" #include "vlog/common/idxtupletable.cpp" #include "vlog/common/sqltable.cpp" #include "vlog/cycles/checker.cpp" #include "vlog/deps/detector.cpp" #include "vlog/deps/mapping.cpp" #include "vlog/deps/tgpath.cpp" #include "vlog/forward/chasemgmt.cpp" #include "vlog/forward/column.cpp" #include "vlog/forward/edbfcinternaltable.cpp" #include "vlog/forward/extcolumns.cpp" #include "vlog/forward/extresultjoinproc.cpp" #include "vlog/forward/fcinttable.cpp" #include "vlog/forward/fctable.cpp" #include "vlog/forward/filterer.cpp" #include "vlog/forward/filterhashjoin.cpp" #include "vlog/forward/finresultjoinproc.cpp" #include "vlog/forward/joinprocessor.cpp" #include "vlog/forward/resultjoinproc.cpp" #include "vlog/forward/ruleexecdetails.cpp" #include "vlog/forward/ruleexecplan.cpp" #include "vlog/forward/segment.cpp" #include "vlog/forward/seminaiver.cpp" #include "vlog/forward/seminaiver_ordered.cpp" #include "vlog/forward/seminaiver_threaded.cpp" #include "vlog/forward/seminaiver_trigger.cpp" #include "vlog/inmemory/inmemorytable.cpp" #include "vlog/magic/wizard.cpp" #include "vlog/mapi/mapitable.cpp" #include "vlog/mdlite/mdlitetable.cpp" #include "vlog/ml/ml.cpp" #include "vlog/mysql/mysqltable.cpp" #include "vlog/odbc/odbctable.cpp" #include "vlog/reasoner.cpp" #include "vlog/reliances/positive.cpp" #include "vlog/reliances/restrain.cpp" #include "vlog/reliances/common.cpp" #include "vlog/sparql/sparqliterator.cpp" #include "vlog/sparql/sparqltable.cpp" #include "vlog/text/elastictable.cpp" #include "vlog/trident/tridentiterator.cpp" #include "vlog/trident/tridenttable.cpp" #include "vlog/trident/tridenttupleitr.cpp" #include "vlog/utils.cpp" #include "vlog/web/webinterface.cpp"
37.655172
47
0.79304
aannleax
486deb8bf85c17857216304d9cbbfed4f40c3563
1,903
cpp
C++
RedBlackTree/rb_tree/rb_tree_test.cpp
suiyili/Algorithms
d6ddc8262c5d681ecc78938b6140510793a29d91
[ "MIT" ]
null
null
null
RedBlackTree/rb_tree/rb_tree_test.cpp
suiyili/Algorithms
d6ddc8262c5d681ecc78938b6140510793a29d91
[ "MIT" ]
null
null
null
RedBlackTree/rb_tree/rb_tree_test.cpp
suiyili/Algorithms
d6ddc8262c5d681ecc78938b6140510793a29d91
[ "MIT" ]
null
null
null
#ifdef TEST #include <catch2/catch_test_macros.hpp> #include "../algorithm/item_inserter/item_inserter.hpp" #include "../algorithm/item_remover/item_remover.hpp" #include "rb_tree.hpp" using namespace btree::item; using namespace btree::algorithm; namespace btree { using item_inserter_t = item_inserter<int>; SCENARIO("red black tree test", "[rb_tree]") { GIVEN("a number of items inserted") { const int key_exists = 9, non_existing_key = 32; rb_tree<int> tree; std::vector<item_inserter_t> inserters; inserters.reserve(10); inserters.emplace_back(-2); inserters.emplace_back(key_exists); inserters.emplace_back(8); inserters.emplace_back(15); inserters.emplace_back(6); inserters.emplace_back(33); for (auto &i : inserters) tree.accept(i); WHEN("search the given key") { auto found = tree.contains(key_exists); THEN("it should be found") { REQUIRE(found); } } AND_WHEN("search a non-exsiting key") { THEN("it should return false") { REQUIRE_FALSE(tree.contains(non_existing_key)); } } AND_WHEN("insert an existing key") { THEN("it will throw") { item_inserter_t insert_existing(key_exists); REQUIRE_THROWS_AS(tree.accept(insert_existing), item_already_exists); } } AND_WHEN("remove an existing key") { const int to_remove(key_exists); item_remover remove_existing(to_remove); tree.accept(remove_existing); THEN("the key should be removed from the tree") { REQUIRE_FALSE(tree.contains(key_exists)); } } AND_WHEN("remove non-existing key") { const int to_remove(non_existing_key); THEN("it will throw") { item_remover remove_existing(to_remove); REQUIRE_THROWS_AS(tree.accept(remove_existing), item_not_exists); } } } } } // namespace btree #endif // TEST
26.068493
77
0.67052
suiyili
4875f63e0829688d340967079ce0741ffbdb1766
30,790
hpp
C++
inc/math/expression/Spline.hpp
davidson16807/libtectonics
aa0ae2b8a4a1d2a9a346bbdeb334be876ad75646
[ "CC-BY-4.0" ]
null
null
null
inc/math/expression/Spline.hpp
davidson16807/libtectonics
aa0ae2b8a4a1d2a9a346bbdeb334be876ad75646
[ "CC-BY-4.0" ]
null
null
null
inc/math/expression/Spline.hpp
davidson16807/libtectonics
aa0ae2b8a4a1d2a9a346bbdeb334be876ad75646
[ "CC-BY-4.0" ]
null
null
null
#pragma once // std libraries #include <algorithm> // copy, back_inserter #include <initializer_list> #include <iostream> // in-house libraries #include "Identity.hpp" #include "Scaling.hpp" #include "Shifting.hpp" #include "Railcar.hpp" #include "Railcar_to_string.hpp" namespace math { /* A `Spline` in this code base represents a sum of piecewise polynomials. The above definition for a spline is broader than most. Unlike Ahlberg (1967), it does not place restrictions on the degree of the polynomial, the continuity of its derivatives, or even the continuity of the function itself, and it allows instances to be represented by the sum of overlapping Railcar polynomials. We adopt this definition over others since we value closure - a spline defined as such is closed under addition, subtraction, multiplication, derivation, and integration, making it a very attractive structure to implement on a computer. Earlier versions of code called this entity `SumOfPiecewisePolynomials`, however the name was changed after its widespread usage brought about the need for brevity. */ template<typename T, int Plo, int Phi> struct Spline { std::vector<Railcar<T,Polynomial<T,Plo,Phi>>> boxes; Spline() : boxes() { } Spline(const Spline<T,Plo,Phi>& p) : boxes(p.boxes) { } explicit Spline(const std::vector<Railcar<T,Polynomial<T,Plo,Phi>>> pieces_) : boxes(pieces_) { } explicit Spline(std::initializer_list<Railcar<T,Polynomial<T,Plo,Phi>>> ts) { std::copy(ts.begin(), ts.end(), std::back_inserter(boxes)); } T operator()(const T x) const { T y(0.0f); for (std::size_t i=0; i<boxes.size(); i++) { y += boxes[i](x); } return y; } constexpr std::vector<T> knots() const { // gather all boundaries for all boxes std::vector<T> bounds; for (std::size_t i=0; i<boxes.size(); i++) { bounds.push_back(boxes[i].lo); bounds.push_back(boxes[i].hi); } std::sort(bounds.begin(), bounds.end()); auto last = std::unique(bounds.begin(), bounds.end()); bounds.erase(last, bounds.end()); return bounds; } Spline<T,Plo,Phi>& operator+=(const T k) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; const T oo = std::numeric_limits<T>::max(); F f; f[0] = k; boxes.push_back(G(-oo, oo, f)); return *this; } Spline<T,Plo,Phi>& operator-=(const T k) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; const T oo = std::numeric_limits<T>::max(); F f; f[0] = -k; boxes.push_back(G(-oo, oo, f)); return *this; } Spline<T,Plo,Phi>& operator*=(const T k) { for (std::size_t i=0; i<boxes.size(); i++) { boxes[i].content *= k; } return *this; } Spline<T,Plo,Phi>& operator/=(const T k) { for (std::size_t i=0; i<boxes.size(); i++) { boxes[i].content /= k; } return *this; } Spline<T,Plo,Phi>& operator+=(const Polynomial<T,Plo,Phi>& p) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; const T oo = std::numeric_limits<T>::max(); F f(p); boxes.push_back(G(-oo, oo, p)); return *this; } Spline<T,Plo,Phi>& operator-=(const Polynomial<T,Plo,Phi>& p) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; const T oo = std::numeric_limits<T>::max(); F f(p); boxes.push_back(G(-oo, oo, p)); return *this; } template<int Qlo, int Qhi> Spline<T,Plo,Phi>& operator+=(const Spline<T,Qlo,Qhi>& q) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; for (std::size_t i=0; i<q.boxes.size(); i++) { boxes.push_back(G(q.boxes[i].lo, q.boxes[i].hi, F(q.boxes[i].content))); } return *this; } template<int Qlo, int Qhi> Spline<T,Plo,Phi>& operator-=(const Spline<T,Qlo,Qhi>& q) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; for (std::size_t i=0; i<q.boxes.size(); i++) { boxes.push_back(G(q.boxes[i].lo, q.boxes[i].hi, F(-q.boxes[i].content))); } return *this; } }; template<typename T, int Plo, int Phi> constexpr std::string to_string(const Spline<T,Plo,Phi>& s) { std::string output("\r\n"); for (std::size_t i=0; i<s.boxes.size(); i++) { output += to_string(s.boxes[i]); output += "\r\n"; } return output; } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo,Phi> simplify(const Spline<T,Plo,Phi>& s) { std::vector<T> knots = s.knots(); using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; std::vector<G> boxes; for (std::size_t i=1; i<knots.size(); i++) { F f; // add together all boxes that intersect the region from knots[i-1] to knots[i] for (std::size_t j=0; j<s.boxes.size(); j++) { if (std::max(s.boxes[j].lo, knots[i-1]) < std::min(s.boxes[j].hi, knots[i])) { f += s.boxes[j].content; } } boxes.push_back(G(knots[i-1], knots[i], f)); } return Spline<T,Plo,Phi>(boxes); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(0,Plo),std::max(0,Phi)> operator+(const Spline<T,Plo,Phi>& f, const T k) { Spline<T,std::min(0,Plo),std::max(0,Phi)> y; y += f; y += k; return simplify(y); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(0,Plo),std::max(0,Phi)> operator+(const T k, const Spline<T,Plo,Phi>& f) { Spline<T,std::min(0,Plo),std::max(0,Phi)> y; y += f; y += k; return simplify(y); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(0,Plo),std::max(0,Phi)> operator-(const Spline<T,Plo,Phi>& f, const T k) { Spline<T,std::min(0,Plo),std::max(0,Phi)> y; y += f; y -= k; return simplify(y); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(0,Plo),std::max(0,Phi)> operator-(const T k, const Spline<T,Plo,Phi>& f) { Spline<T,std::min(0,Plo),std::max(0,Phi)> y; y -= f; y += k; return simplify(y); } template<typename T, int Plo, int Phi> constexpr auto operator*(const Spline<T,Plo,Phi>& f, const T k) { Spline<T,Plo,Phi> y(f); y *= k; return y; } template<typename T, int Plo, int Phi> constexpr auto operator*(const T k, const Spline<T,Plo,Phi>& f) { Spline<T,Plo,Phi> y(f); y *= k; return y; } template<typename T, int Plo, int Phi> constexpr auto operator/(const Spline<T,Plo,Phi>& f, const T k) { Spline<T,Plo,Phi> y(f); y /= k; return y; } template<typename T, int Plo, int Phi> constexpr auto operator-(const Spline<T,Plo,Phi>& f) { Spline<T,Plo,Phi> y(f); y *= -1; return y; } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> operator+(const Spline<T,Plo,Phi>& s, const Polynomial<T,Qlo,Qhi> p) { Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> y; y += s; y += p; return y; } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> operator-(const Spline<T,Plo,Phi>& s, const Polynomial<T,Qlo,Qhi> p) { Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> y; y += s; y -= p; return y; } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr auto operator*(const Spline<T,Plo,Phi>& p, const Polynomial<T,Qlo,Qhi> q) { using F = Polynomial<T,Plo+Qlo,Phi+Qhi>; using G = Railcar<T,F>; std::vector<G> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(G(p.boxes[i].lo, p.boxes[i].hi, F(p.boxes[i].content*q))); } return Spline<T,Plo+Qlo,Phi+Qhi>(boxes); } template<typename T, int Plo, int Phi, int Q> constexpr auto operator/(const Spline<T,Plo,Phi>& p, const Polynomial<T,Q,Q> q) { using F = Polynomial<T,Plo-Q,Phi-Q>; using G = Railcar<T,F>; std::vector<G> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(G(p.boxes[i].lo, p.boxes[i].hi, F(p.boxes[i].content/q))); } return Spline<T,Plo-Q,Phi-Q>(boxes); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> operator+(const Polynomial<T,Qlo,Qhi> p, const Spline<T,Plo,Phi>& s) { Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> y; y += s; y += p; return y; } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> operator-(const Polynomial<T,Qlo,Qhi> p, const Spline<T,Plo,Phi>& s) { Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> y; y += p; y -= s; return y; } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr auto operator*(const Polynomial<T,Qlo,Qhi> p, const Spline<T,Plo,Phi>& s) { using F = Polynomial<T,Plo+Qlo,Phi+Qhi>; using G = Railcar<T,F>; std::vector<G> boxes; for (std::size_t i=0; i<s.boxes.size(); i++) { boxes.push_back(G(s.boxes[i].lo, s.boxes[i].hi, F(s.boxes[i].content*p))); } return Spline<T,Plo+Qlo,Phi+Qhi>(boxes); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr auto operator+(const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q) { using F = Polynomial<T,std::min(Plo,Qlo),std::max(Phi,Qhi)>; using G = Railcar<T,F>; std::vector<G> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(G(p.boxes[i].lo, p.boxes[i].hi, F(p.boxes[i].content))); } for (std::size_t i=0; i<q.boxes.size(); i++) { boxes.push_back(G(q.boxes[i].lo, q.boxes[i].hi, F(q.boxes[i].content))); } return simplify(Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)>(boxes)); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr auto operator-(const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q) { using F = Polynomial<T,std::min(Plo,Qlo),std::max(Phi,Qhi)>; using G = Railcar<T,F>; std::vector<G> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(G(p.boxes[i].lo, p.boxes[i].hi, F(p.boxes[i].content))); } for (std::size_t i=0; i<q.boxes.size(); i++) { boxes.push_back(G(q.boxes[i].lo, q.boxes[i].hi, F(-q.boxes[i].content))); } return simplify(Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)>(boxes)); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr auto operator*(const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q) { using F = Polynomial<T,Plo+Qlo,Phi+Qhi>; using G = Railcar<T,F>; std::vector<G> boxes; T lo, hi; for (std::size_t i=0; i<p.boxes.size(); i++) { for (std::size_t j=0; j<q.boxes.size(); j++) { lo = std::max(p.boxes[i].lo, q.boxes[j].lo); hi = std::min(p.boxes[i].hi, q.boxes[j].hi); if (lo<hi) { boxes.push_back(G(lo, hi, p.boxes[i].content * q.boxes[j].content)); } } } return simplify(Spline<T,Plo+Qlo,Phi+Qhi>(boxes)); } template<typename T, int Plo, int Phi> constexpr auto operator+(const Spline<T,Plo,Phi>& p, const Shifting<T> f) { return p + Polynomial<T,0,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator+(const Shifting<T> f, const Spline<T,Plo,Phi>& p) { return Polynomial<T,0,1>(f) + p; } template<typename T, int Plo, int Phi> constexpr auto operator-(const Spline<T,Plo,Phi>& p, const Shifting<T> f) { return p - Polynomial<T,0,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator-(const Shifting<T> f, const Spline<T,Plo,Phi>& p) { return Polynomial<T,0,1>(f) - p; } template<typename T, int Plo, int Phi> constexpr auto operator*(const Spline<T,Plo,Phi>& p, const Shifting<T> f) { return p * Polynomial<T,0,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator*(const Shifting<T> f, const Spline<T,Plo,Phi>& p) { return Polynomial<T,0,1>(f) * p; } template<typename T, int Plo, int Phi> constexpr auto operator+(const Spline<T,Plo,Phi>& p, const Scaling<T> f) { return p + Polynomial<T,1,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator+(const Scaling<T> f, const Spline<T,Plo,Phi>& p) { return Polynomial<T,1,1>(f) + p; } template<typename T, int Plo, int Phi> constexpr auto operator-(const Spline<T,Plo,Phi>& p, const Scaling<T> f) { return p - Polynomial<T,1,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator-(const Scaling<T> f, const Spline<T,Plo,Phi>& p) { return Polynomial<T,1,1>(f) - p; } template<typename T, int Plo, int Phi> constexpr auto operator*(const Spline<T,Plo,Phi>& p, const Scaling<T> f) { return p * Polynomial<T,1,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator*(const Scaling<T> f, const Spline<T,Plo,Phi>& p) { return Polynomial<T,1,1>(f) * p; } template<typename T, int Plo, int Phi> constexpr auto operator/(const Spline<T,Plo,Phi>& p, const Scaling<T> f) { return p / Polynomial<T,1,1>(f); } template<typename T, int Plo, int Phi> constexpr auto operator+(const Spline<T,Plo,Phi>& p, const Identity<T> e) { return p + Polynomial<T,1,1>(e); } template<typename T, int Plo, int Phi> constexpr auto operator+(const Identity<T> e, const Spline<T,Plo,Phi>& p) { return Polynomial<T,1,1>(e) + p; } template<typename T, int Plo, int Phi> constexpr auto operator-(const Spline<T,Plo,Phi>& p, const Identity<T> e) { return p - Polynomial<T,1,1>(e); } template<typename T, int Plo, int Phi> constexpr auto operator-(const Identity<T> e, const Spline<T,Plo,Phi>& p) { return Polynomial<T,1,1>(e) - p; } template<typename T, int Plo, int Phi> constexpr auto operator*(const Spline<T,Plo,Phi>& p, const Identity<T> e) { return p * Polynomial<T,1,1>(e); } template<typename T, int Plo, int Phi> constexpr auto operator*(const Identity<T> e, const Spline<T,Plo,Phi>& p) { return Polynomial<T,1,1>(e) * p; } template<typename T, int Plo, int Phi> constexpr auto operator/(const Spline<T,Plo,Phi>& p, const Identity<T> e) { return p / Polynomial<T,1,1>(e); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo*Qlo,Phi*Qhi),std::max(Plo*Qlo,Phi*Qhi)> compose(const Spline<T,Plo,Phi>& p, const Polynomial<T,Qlo,Qhi> q) { using PiecewisePolynomial = Railcar<T,Polynomial<T,std::min(Plo*Qlo,Phi*Qhi),std::max(Plo*Qlo,Phi*Qhi)>>; std::vector<PiecewisePolynomial> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(PiecewisePolynomial(p.boxes[i].lo, p.boxes[i].hi, compose(p.boxes[i].content, q))); } return Spline(boxes); } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo,Phi> compose(const Spline<T,Plo,Phi>& p, const Scaling<T> g) { using PiecewisePolynomial = Railcar<T,Polynomial<T,Plo,Phi>>; std::vector<PiecewisePolynomial> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(PiecewisePolynomial(p.boxes[i].lo, p.boxes[i].hi, compose(p.boxes[i].content, g))); } return Spline(boxes); } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo,Phi> compose(const Spline<T,Plo,Phi>& p, const Shifting<T> g) { using PiecewisePolynomial = Railcar<T,Polynomial<T,Plo,Phi>>; std::vector<PiecewisePolynomial> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(PiecewisePolynomial(p.boxes[i].lo, p.boxes[i].hi, compose(p.boxes[i].content, g))); } return Spline(boxes); } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo,Phi> compose(const Spline<T,Plo,Phi>& p, const Identity<T> e) { return p; } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo-1,Phi-1> derivative(const Spline<T,Plo,Phi>& p) { using PiecewisePolynomial = Railcar<T,Polynomial<T,Plo-1,Phi-1>>; std::vector<PiecewisePolynomial> boxes; for (std::size_t i=0; i<p.boxes.size(); i++) { boxes.push_back(PiecewisePolynomial(p.boxes[i].lo, p.boxes[i].hi, derivative(p.boxes[i].content))); } return Spline(boxes); } /* `derivative` returns the derivative of a polynomial at a point. It is meant to compliment the method signature for integral(p, lo, hi) */ template<typename T, int Plo, int Phi> T derivative(const Spline<T,Plo,Phi>& p, const T x) { T dydx(0.0f); for (std::size_t i=0; i<p.boxes.size(); i++) { dydx += derivative(p.boxes[i], x); } return dydx; } /* `integral` returns the definite integral of a polynomial without representing the integral as its own function object. This is meant to be used as a fallback in the event the function is a Laurent polynomial with a coefficient of degree -1, since the integral for such a function includes a logarithmic term. */ template<typename T, int Plo, int Phi> T integral(const Spline<T,Plo,Phi>& p, const T x) { T I(0.0f); for (std::size_t i=0; i<p.boxes.size(); i++) { if (p.boxes[i].lo < x) { I += integral(p.boxes[i].content, std::min(x, p.boxes[i].hi)) - integral(p.boxes[i].content, p.boxes[i].lo); } } return I; } template<typename T, int Plo, int Phi> T integral(const Spline<T,Plo,Phi>& p, const T lo, const T hi) { T I(0.0f); for (std::size_t i=0; i<p.boxes.size(); i++) { /* Q: Why do we check for lo < p.boxes[i].hi? A: If p.boxes[i].hi < lo, then p.boxes[i].hi < hi as well, so we know the difference in the integral between lo and hi is 0. However the result of the integral may still be big, so we could be trying to find a nonexistant difference between two big numbers. To avoid destructive cancellation we do not calculate. Similar statements could be made for p.boxes[i].lo < hi. */ if (lo < p.boxes[i].hi && p.boxes[i].lo < hi) { I += integral(p.boxes[i].content, std::min(hi, p.boxes[i].hi)) - integral(p.boxes[i].content, std::max(lo, p.boxes[i].lo)); } } return I; } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo+1,Phi+1> integral(const Spline<T,Plo,Phi>& p) { using F = Polynomial<T,Plo+1,Phi+1>; using G = Railcar<T,F>; const T oo = std::numeric_limits<T>::max(); std::vector<G> boxes; G g, gmax; for (std::size_t i=0; i<p.boxes.size(); i++) { g = G(p.boxes[i].lo, p.boxes[i].hi, integral(p.boxes[i].content) - integral(p.boxes[i].content, p.boxes[i].lo)); gmax = G(g.hi, oo, F() ); gmax.content[0] = g.content(g.hi); boxes.push_back(g); boxes.push_back(gmax); } return Spline(boxes); } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo,Phi> restriction(const Spline<T,Plo,Phi>& p, const T lo, const T hi) { using F = Polynomial<T,Plo,Phi>; using G = Railcar<T,F>; std::vector<G> boxes; const T oo = std::numeric_limits<T>::max(); for (std::size_t i=0; i<p.boxes.size(); i++) { if (lo < p.boxes[i].lo || p.boxes[i].hi <= hi) { if (boxes.size() < 1) { boxes.push_back( G(oo, p.boxes[i].lo, F( p.boxes[i].content(p.boxes[i].lo) ) )); } boxes.push_back(p.boxes[i]); } } boxes.push_back( Railcar<T,Polynomial<T,Plo,Phi>>( boxes[boxes.size()-1].hi, std::numeric_limits<T>::max(), Polynomial<T,Plo,Phi>( boxes[boxes.size()-1].content( boxes[boxes.size()-1].hi ) ) )); return Spline(boxes); } template<typename T, int Plo, int Phi> constexpr Spline<T,Plo*2,Phi*2> square(const Spline<T,Plo,Phi>& p){ return p*p; // Spline<T,Plo,Phi> q = simplify(p); // using F = Polynomial<T,Plo*2,Phi*2>; // using G = Railcar<T,F>; // std::vector<G> boxes; // for (std::size_t i = 0; i < q.boxes.size(); ++i) // { // boxes.push_back(G(q.boxes[i].lo, q.boxes[i].hi, q.boxes[i].content*q.boxes[i].content)); // } // return Spline<T,Plo*2,Phi*2>(boxes); } /* `distance` is the root of the integrated squared difference between two polynomials over a given range divided by the range. It provides a metric that expresses the extent to which two polynomials differ using the same units as the output of the polynomial. It is analogous to the standard deviation of a dataset in statistics, and it satisfies all criteria needed to be considered a metric: * d(a,b) ∈ ℝ⁺ * d(a,b) = 0 ⟺ a=b * d(a,b) = d(b,a) * d(a,b) ≤ d(a,c)+d(c,b) We do not presume that this metric serves more naturally as a distance metric compared to others, however we address this function as `distance` since the alternative names are either unwieldy (`root_mean_square_difference`) or nonobvious (`rmsd`). */ template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T distance( const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q, const T lo, const T hi ){ const auto difference = p-q; return std::sqrt(std::max(T(0), integral(square(difference), lo, hi))) / (hi-lo); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T distance(const Spline<T,Plo,Phi>& p, const Polynomial<T,Qlo,Qhi> q, const T lo, const T hi) { return std::sqrt(std::max(T(0), integral(square(p-q), lo, hi))) / (hi-lo); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T distance(const Polynomial<T,Plo,Phi> p, const Spline<T,Qlo,Qhi> q, const T lo, const T hi) { return std::sqrt(std::max(T(0), integral(square(p-q), lo, hi))) / (hi-lo); } template<typename T, int Plo, int Phi> constexpr T distance(const Spline<T,Plo,Phi>& p, const T k, const T lo, const T hi) { return std::sqrt(std::max(T(0), integral(square(p-k), lo, hi))) / (hi-lo); } template<typename T, int Plo, int Phi> constexpr T distance(const T k, const Spline<T,Plo, Phi> p, const T lo, const T hi) { return std::sqrt(std::max(T(0), integral(square(p-k), lo, hi))) / (hi-lo); } /* `dot` is the integral of the product between the output of two functions. It is analogous to the dot product of vectors however it treats functions as vectors in a function space with infinitely many dimensions. */ template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T dot( const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q, const T lo, const T hi ){ return integral(p*q, lo, hi); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T dot(const Spline<T,Plo,Phi>& p, const Polynomial<T,Qlo,Qhi> q, const T lo, const T hi) { return integral(p*q, lo, hi); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T dot(const Polynomial<T,Plo,Phi> p, const Spline<T,Qlo,Qhi> q, const T lo, const T hi) { return integral(p*q, lo, hi); } template<typename T, int Plo, int Phi> constexpr T dot(const Spline<T,Plo,Phi>& p, const T k, const T lo, const T hi) { return integral(p*k, lo, hi); } template<typename T, int Plo, int Phi> constexpr T dot(const T k, const Spline<T,Plo, Phi> p, const T lo, const T hi) { return integral(p*k, lo, hi); } /* `length` is the root of the dot product of a function with itself. It is analogous to the Euclidean length of a vector, however it treats functions as vectors in a function space with infinitely many dimensions. */ template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T length( const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q, const T lo, const T hi ){ return std::sqrt(integral(p*p, lo, hi)); } /* `similarity` is dot product of two functions divided by their lengths. It is analogous to the cosine similarity between two vectors, however it treats functions as vectors in a function space with infinitely many dimensions. */ template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T similarity( const Spline<T,Plo,Phi>& p, const Spline<T,Qlo,Qhi>& q, const T lo, const T hi ){ return dot(p,q,lo,hi) / (length(p,lo,hi)*length(q,lo,hi)); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T similarity(const Spline<T,Plo,Phi>& p, const Polynomial<T,Qlo,Qhi> q, const T lo, const T hi) { return dot(p,q,lo,hi) / (length(p,lo,hi)*length(q,lo,hi)); } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr T similarity(const Polynomial<T,Plo,Phi> p, const Spline<T,Qlo,Qhi> q, const T lo, const T hi) { return dot(p,q,lo,hi) / (length(p,lo,hi)*length(q,lo,hi)); } template<typename T, int Plo, int Phi> constexpr T similarity(const Spline<T,Plo,Phi>& p, const T k, const T lo, const T hi) { return dot(p,k,lo,hi) / (length(p,lo,hi)*length(k,lo,hi)); } template<typename T, int Plo, int Phi> constexpr T similarity(const T k, const Spline<T,Plo, Phi> p, const T lo, const T hi) { return dot(p,k,lo,hi) / (length(p,lo,hi)*length(k,lo,hi)); } /* template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> max(const Polynomial<T,Plo,Phi> p, const Polynomial<T,Qlo,Qhi> q) { auto candidates = solve(p-q, 0.0f); std::vector<T> solutions; reals(candidates.begin(), candidates.end(), std::back_inserter(solutions), 1e-7); std::sort(solutions.begin(), solutions.end()); T lo, hi, x; Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> spline; for(int i=0; i<=solutions.size(); i++) { lo = i<1? solutions[i-1] : -std::numeric_limits<T>::max(); hi = i==solutions.size()? solutions[i] : std::numeric_limits<T>::max(); x = (lo+hi) / 2.0f; spline.push_back(G(lo, hi, p(x) > q(x)? p : q)); } return spline; } template<typename T, int Plo, int Phi, int Qlo, int Qhi> constexpr Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> min(const Polynomial<T,Plo,Phi> p, const Polynomial<T,Qlo,Qhi> q) { auto candidates = solve(p-q, 0.0f); std::vector<T> solutions; reals(candidates.begin(), candidates.end(), std::back_inserter(solutions), 1e-7); std::sort(solutions.begin(), solutions.end()); T lo, hi, x; Spline<T,std::min(Plo,Qlo),std::max(Phi,Qhi)> spline; for(int i=0; i<=solutions.size(); i++) { lo = i<1? solutions[i-1] : -std::numeric_limits<T>::max(); hi = i==solutions.size()? solutions[i] : std::numeric_limits<T>::max(); x = (lo+hi) / T(2.0); spline.push_back(G(lo, hi, p(x) < q(x)? p : q)); } return spline; } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(Plo,0),std::max(Phi,0)> max(const Polynomial<T,Plo,Phi> p, const T k) { return max(p,Polynomial<T,0,0>{k}); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(Plo,0),std::max(Phi,0)> max(const T k, const Polynomial<T,Plo, Phi> p) { return max(p,Polynomial<T,0,0>{k}); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(Plo,0),std::max(Phi,0)> max(const Polynomial<T,Plo,Phi> p, const T k) { return max(p,Polynomial<T,0,0>{k}); } template<typename T, int Plo, int Phi> constexpr Spline<T,std::min(Plo,0),std::max(Phi,0)> max(const T k, const Polynomial<T,Plo, Phi> p) { return max(p,Polynomial<T,0,0>{k}); } */ }
33.071966
142
0.554303
davidson16807
48760c0617ec5cf0f5ebaa336f86e3147a38cd09
3,747
cc
C++
engine/platformWin32/winOpenAL.cc
ClayHanson/B4v21-Public-Repo
c812aa7bf2ecb267e02969c85f0c9c2a29be0d28
[ "MIT" ]
1
2020-08-18T19:45:34.000Z
2020-08-18T19:45:34.000Z
engine/platformWin32/winOpenAL.cc
ClayHanson/B4v21-Launcher-Public-Repo
c812aa7bf2ecb267e02969c85f0c9c2a29be0d28
[ "MIT" ]
null
null
null
engine/platformWin32/winOpenAL.cc
ClayHanson/B4v21-Launcher-Public-Repo
c812aa7bf2ecb267e02969c85f0c9c2a29be0d28
[ "MIT" ]
null
null
null
//----------------------------------------------------------------------------- // Torque Game Engine // Copyright (C) GarageGames.com, Inc. //----------------------------------------------------------------------------- #include "platformWin32/platformWin32.h" #include "console/console.h" #include "al/altypes.h" #include "al/alctypes.h" #define INITGUID #include "al/eaxtypes.h" // Define the OpenAL and Extension Stub functions #define AL_FUNCTION(fn_return, fn_name, fn_args, fn_value) fn_return stub_##fn_name fn_args{ fn_value } #include "al/al_func.h" #include "al/alc_func.h" #include "al/eax_func.h" #undef AL_FUNCTION // Declare the OpenAL and Extension Function pointers // And initialize them to the stub functions #define AL_FUNCTION(fn_return,fn_name,fn_args, fn_value) fn_return (*fn_name)fn_args = stub_##fn_name; #include "al/al_func.h" #include "al/alc_func.h" #include "al/eax_func.h" #undef AL_FUNCTION /*! Get a function address from the OpenAL DLL and bind it to the * function pointer */ static bool bindFunction( void *&fnAddress, const char *name ) { // JMQ: MinGW gcc 3.2 needs the cast to void* fnAddress = (void*)(GetProcAddress( winState.hinstOpenAL, name )); if( !fnAddress ) Con::errorf(ConsoleLogEntry::General, " Missing OpenAL function '%s'", name); return (fnAddress != NULL); } /*! Get a function address for an OpenAL extension function and bind it * to it's function pointer */ static bool bindExtensionFunction( void *&fnAddress, const char *name ) { fnAddress = alGetProcAddress( (ALubyte*)name ); if( !fnAddress ) Con::errorf(ConsoleLogEntry::General, " Missing OpenAL Extension function '%s'", name); return (fnAddress != NULL); } /*! Bind the functions in the OpenAL DLL to the al interface functions */ static bool bindOpenALFunctions() { bool result = true; #define AL_FUNCTION(fn_return, fn_name, fn_args, fn_value) result &= bindFunction( *(void**)&fn_name, #fn_name); #include "al/al_func.h" #include "al/alc_func.h" #undef AL_FUNCTION return result; } /*! Bind the stub functions to the al interface functions */ static void unbindOpenALFunctions() { #define AL_FUNCTION(fn_return, fn_name, fn_args, fn_value) fn_name = stub_##fn_name; #include "al/al_func.h" #include "al/alc_func.h" #include "al/eax_func.h" #undef AL_FUNCTION } /*! Bind the EAX Extension functions to the EAX interface functions */ static bool bindEAXFunctions() { bool result = true; #define AL_FUNCTION(fn_return, fn_name, fn_args, fn_value) result &= bindExtensionFunction( *(void**)&fn_name, #fn_name); #include "al/eax_func.h" #undef AL_FUNCTION return result; } namespace Audio { /*! Shutdown and Unload the OpenAL DLL */ void OpenALDLLShutdown() { if (winState.hinstOpenAL) FreeLibrary(winState.hinstOpenAL); winState.hinstOpenAL = NULL; unbindOpenALFunctions(); } /*! Dynamically Loads the OpenAL DLL if present and binds all the functions. * If there is no DLL or an unexpected error occurs binding functions the * stub functions are automatically bound. */ bool OpenALDLLInit() { OpenALDLLShutdown(); winState.hinstOpenAL = LoadLibrary( dT("OpenAl32.dll") ); if(winState.hinstOpenAL != NULL) { // if the DLL loaded bind the OpenAL function pointers if(bindOpenALFunctions()) { // if EAX is available bind it's function pointers //if (alIsExtensionPresent((ALubyte*)"EAX" )) // Do not bind the EAX extensions for the time being - MDF // bindEAXFunctions(); return(true); } // an error occured, shutdown OpenALDLLShutdown(); } return(false); } } // end namespace Audio
28.172932
124
0.669602
ClayHanson
4876a30de4b298cd2af92cc2a6af51f08833dfeb
5,335
cpp
C++
scripts/sample_data/test_project/kernel_wrapper2.dp.cpp
UCL-oneAPI/CTA-oneAPI
beed196edda3172e99fe3e9e3e58cfab2b0bd842
[ "MIT" ]
3
2021-10-05T16:52:38.000Z
2022-03-01T09:28:23.000Z
scripts/sample_data/test_project/kernel_wrapper2.dp.cpp
UCL-oneAPI/CTA-oneAPI
beed196edda3172e99fe3e9e3e58cfab2b0bd842
[ "MIT" ]
4
2021-08-02T13:58:18.000Z
2021-08-25T03:02:34.000Z
scripts/sample_data/test_project/kernel_wrapper2.dp.cpp
UCL-oneAPI/CTA-oneAPI
beed196edda3172e99fe3e9e3e58cfab2b0bd842
[ "MIT" ]
null
null
null
#include <CL/sycl.hpp> #include <dpct/dpct.hpp> #include <stdio.h> #include "../common.h" #include "../util/timer/timer.h" #include "./kernel2.dp.cpp" #include "./kernel2_wrapper.h" void kernel2_wrapper( knode *knodes, long knodes_elem, long knodes_mem, int order, long maxheight, int count, long *currKnode, long *offset, long *lastKnode, long *offset_2, int *start, int *end, int *recstart, int *reclength) { dpct::device_ext &dev_ct1 = dpct::get_current_device(); sycl::queue &q_ct1 = dev_ct1.default_queue(); long long offload_start = get_time(); //====================================================================================================100 // EXECUTION PARAMETERS //====================================================================================================100 int numBlocks; numBlocks = count; int threadsPerBlock; threadsPerBlock = order < 256 ? order : 256; /* DPCT1065:3: Consider replacing sycl::nd_item::barrier() with * sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better * performance, if there is no access to global memory. */ item_ct1.barrier(); printf("# of blocks = %d, # of threads/block = %d (ensure that device can handle)\n", numBlocks, threadsPerBlock); //==================================================50 // knodesD //==================================================50 knode *knodesD; knodesD = (knode *)sycl::malloc_device(knodes_mem, q_ct1); //==================================================50 // currKnodeD //==================================================50 long *currKnodeD; currKnodeD = sycl::malloc_device<long>(count, q_ct1); //==================================================50 // offsetD //==================================================50 long *offsetD; offsetD = sycl::malloc_device<long>(count, q_ct1); //==================================================50 // lastKnodeD //==================================================50 long *lastKnodeD; lastKnodeD = sycl::malloc_device<long>(count, q_ct1); //==================================================50 // offset_2D //==================================================50 long *offset_2D; offset_2D = sycl::malloc_device<long>(count, q_ct1); //==================================================50 // startD //==================================================50 int *startD; startD = sycl::malloc_device<int>(count, q_ct1); //==================================================50 // endD //==================================================50 int *endD; endD = sycl::malloc_device<int>(count, q_ct1); //==================================================50 // ansDStart //==================================================50 int *ansDStart; ansDStart = sycl::malloc_device<int>(count, q_ct1); //==================================================50 // ansDLength //==================================================50 int *ansDLength; ansDLength = sycl::malloc_device<int>(count, q_ct1); q_ct1.memcpy(knodesD, knodes, knodes_mem); q_ct1.memcpy(currKnodeD, currKnode, count * sizeof(long)); q_ct1.memcpy(offsetD, offset, count * sizeof(long)); q_ct1.memcpy(lastKnodeD, lastKnode, count * sizeof(long)); q_ct1.memcpy(offset_2D, offset_2, count * sizeof(long)); /* DPCT1003:28: Migrated API does not return error code. (*, 0) is inserted. You may need to rewrite this code. */ CUDA_SAFE_CALL((sycl::free(c->N, q_ct1), 0)); q_ct1.memcpy(startD, start, count * sizeof(int)); q_ct1.memcpy(endD, end, count * sizeof(int)); q_ct1.memcpy(ansDStart, recstart, count * sizeof(int)); q_ct1.memcpy(ansDLength, reclength, count * sizeof(int)); // [GPU] findRangeK kernel /* DPCT1049:3: The workgroup size passed to the SYCL kernel may exceed the limit. To get the device limit, query info::device::max_work_group_size. Adjust the workgroup size if needed. */ q_ct1.submit([&](sycl::handler &cgh) { cgh.parallel_for( sycl::nd_range<3>(sycl::range<3>(1, 1, numBlocks) * sycl::range<3>(1, 1, threadsPerBlock), sycl::range<3>(1, 1, threadsPerBlock)), [=](sycl::nd_item<3> item_ct1) { findRangeK(maxheight, knodesD, knodes_elem, currKnodeD, offsetD, lastKnodeD, offset_2D, startD, endD, ansDStart, ansDLength, item_ct1); }); }); q_ct1.memcpy(recstart, ansDStart, count * sizeof(int)); q_ct1.memcpy(reclength, ansDLength, count * sizeof(int)); dev_ct1.queues_wait_and_throw(); sycl::free(knodesD, q_ct1); sycl::free(currKnodeD, q_ct1); sycl::free(offsetD, q_ct1); sycl::free(lastKnodeD, q_ct1); sycl::free(offset_2D, q_ct1); sycl::free(startD, q_ct1); sycl::free(endD, q_ct1); sycl::free(ansDStart, q_ct1); sycl::free(ansDLength, q_ct1); long long offload_end = get_time(); #ifdef DEBUG for (int i = 0; i < count; i++) printf("recstart[%d] = %d\n", i, recstart[i]); for (int i = 0; i < count; i++) printf("reclength[%d] = %d\n", i, reclength[i]); #endif printf("Total time:\n"); printf("%.12f s\n", (float) (offload_end-offload_start) / 1000000); }
28.529412
116
0.506467
UCL-oneAPI
4882c5dec4a8ca0eca30861457cb6b376cf62183
1,516
cpp
C++
algospot/jumpgame/main.cpp
seirion/code
3b8bf79764107255185061cec33decbc2235d03a
[ "Apache-2.0" ]
13
2015-06-07T09:26:26.000Z
2019-05-01T13:23:38.000Z
algospot/jumpgame/main.cpp
seirion/code
3b8bf79764107255185061cec33decbc2235d03a
[ "Apache-2.0" ]
null
null
null
algospot/jumpgame/main.cpp
seirion/code
3b8bf79764107255185061cec33decbc2235d03a
[ "Apache-2.0" ]
4
2016-03-05T06:21:05.000Z
2017-02-17T15:34:18.000Z
// http://algospot.com/judge/problem/read/JUMPGAME #include <iostream> #include <set> using namespace std; class Goto { public: Goto(char i, char j) : row(i), col(j) {} char row, col; bool operator <(const Goto& g) const { return row == g.row ? col < g.col : row < g.row; } }; int n; int in[100][100]; void getInput() { cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> in[i][j]; } } } void solve() { set<Goto> v0, v1; v0.insert(Goto(0,0)); bool solved = false; do { set<Goto>::const_iterator it = v0.begin(); for (; it != v0.end(); it++) { int i = it->row; int j = it->col; int value = in[i][j]; if (i + value < n) { if (i + value == n-1 && j == n-1) { solved = true; break; } v1.insert(Goto(i + value, j)); } if (j + value < n) { if (i == n-1 && j + value == n-1) { solved = true; break; } v1.insert(Goto(i, j + value)); } } v0.clear(); v0.swap(v1); } while (!v0.empty()); if (solved) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main() { int num; cin >> num; for (int i = 0; i < num; i++) {getInput(); solve();} return 0; }
20.486486
56
0.388522
seirion
4883370242c2959ab30cb6e9e1da7a0fa3339755
6,363
cpp
C++
turtlebot_arm_object_manipulation/test/object_manipulation_actions.cpp
turtlebot/turtlebot_arm
fd6aa08575c19f930a7ac1a0619ebb9a97406340
[ "BSD-3-Clause" ]
47
2015-08-03T21:06:59.000Z
2022-03-06T22:37:44.000Z
turtlebot_arm_object_manipulation/test/object_manipulation_actions.cpp
turtlebot/turtlebot_arm
fd6aa08575c19f930a7ac1a0619ebb9a97406340
[ "BSD-3-Clause" ]
24
2015-04-15T18:47:24.000Z
2021-05-03T05:39:18.000Z
turtlebot_arm_object_manipulation/test/object_manipulation_actions.cpp
turtlebot/turtlebot_arm
fd6aa08575c19f930a7ac1a0619ebb9a97406340
[ "BSD-3-Clause" ]
35
2015-02-28T10:29:51.000Z
2022-01-20T03:44:21.000Z
/* * Copyright (c) 2011, Willow Garage, Inc. * 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 Willow Garage, Inc. 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 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. */ #include <ros/ros.h> #include <actionlib/client/simple_action_client.h> #include <turtlebot_arm_object_manipulation/ObjectDetectionAction.h> #include <turtlebot_arm_object_manipulation/PickAndPlaceAction.h> #include <interactive_markers/interactive_marker_server.h> using namespace visualization_msgs; const std::string arm_link = "/arm_base_link"; class ObjectManipulationAction { private: interactive_markers::InteractiveMarkerServer server_; ros::NodeHandle nh_; // Actions actionlib::SimpleActionClient<turtlebot_arm_object_manipulation::ObjectDetectionAction> object_detection_action_; actionlib::SimpleActionClient<turtlebot_arm_object_manipulation::PickAndPlaceAction> pick_and_place_action_; turtlebot_arm_object_manipulation::ObjectDetectionGoal object_detection_goal_; turtlebot_arm_object_manipulation::PickAndPlaceGoal pick_and_place_goal_; geometry_msgs::Pose old_pose_; public: ObjectManipulationAction() : server_("object_controls"), object_detection_action_("object_detection", true), pick_and_place_action_("pick_and_place", true) { server_.applyChanges(); // Initialize goals object_detection_goal_.frame = arm_link; pick_and_place_goal_.frame = arm_link; ROS_INFO("Finished initializing, waiting for servers..."); object_detection_action_.waitForServer(); pick_and_place_action_.waitForServer(); ROS_INFO("Found servers."); detectObjects(); } void detectObjects() { server_.clear(); server_.applyChanges(); object_detection_action_.sendGoal(object_detection_goal_, boost::bind( &ObjectManipulationAction::addObjects, this, _1, _2)); } void addObjects(const actionlib::SimpleClientGoalState& state, const turtlebot_arm_object_manipulation::ObjectDetectionResultConstPtr& result) { ROS_INFO("Got object detection callback. Adding objects."); for (unsigned int i=0; i < result->obj_names.size(); i++) { // addObject(object.position.x, object.position.y, object.position.z, i); TODO ROS_INFO("Added %d objects: '%s'", i, result->obj_names[i].c_str()); } server_.applyChanges(); } // Move the real object! void feedbackCb( const InteractiveMarkerFeedbackConstPtr &feedback ) { switch ( feedback->event_type ) { case visualization_msgs::InteractiveMarkerFeedback::MOUSE_DOWN: ROS_INFO_STREAM("Staging " << feedback->marker_name); old_pose_ = feedback->pose; break; case visualization_msgs::InteractiveMarkerFeedback::MOUSE_UP: ROS_INFO_STREAM("Now moving " << feedback->marker_name); moveObject(old_pose_, feedback->pose); detectObjects(); break; } server_.applyChanges(); } bool moveObject(const geometry_msgs::Pose& start_pose, const geometry_msgs::Pose& end_pose) { pick_and_place_goal_.pick_pose = start_pose; pick_and_place_goal_.place_pose = end_pose; pick_and_place_action_.sendGoalAndWait(pick_and_place_goal_, ros::Duration(30.0), ros::Duration(30.0)); if ( object_detection_action_.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) { return true; } else { return false; } } // Make a box Marker makeBox( InteractiveMarker &msg, float r, float g, float b ) { Marker m; m.type = Marker::CUBE; m.scale.x = msg.scale; m.scale.y = msg.scale; m.scale.z = msg.scale; m.color.r = r; m.color.g = g; m.color.b = b; m.color.a = 1.0; return m; } // Add a new object void addObject( float x, float y, float z, int n) { InteractiveMarker marker; marker.header.frame_id = arm_link; marker.pose.position.x = x; marker.pose.position.y = y; marker.pose.position.z = z; marker.scale = 0.03; std::stringstream conv; conv << n; conv.str(); marker.name = "object" + conv.str(); InteractiveMarkerControl control; control.orientation.w = 1; control.orientation.x = 0; control.orientation.y = 1; control.orientation.z = 0; control.interaction_mode = InteractiveMarkerControl::MOVE_PLANE; marker.controls.push_back( control ); control.markers.push_back( makeBox(marker, .5, .5, .5) ); control.always_visible = true; marker.controls.push_back( control ); server_.insert( marker ); server_.setCallback( marker.name, boost::bind( &ObjectManipulationAction::feedbackCb, this, _1 )); } }; int main(int argc, char** argv) { // initialize node ros::init(argc, argv, "object_manipulation"); ObjectManipulationAction manip; // everything is done in cloud callback, just spin ros::spin(); }
30.88835
144
0.710042
turtlebot
48894836f96dd942e2b55b838afa2f3ec566f8f2
4,036
hpp
C++
include/utils/binaryreader.hpp
aethelwerka/astraea
cf700a854d4183a263c7185b8ee3ab5d496215dc
[ "BSD-3-Clause" ]
4
2021-08-22T17:27:05.000Z
2021-08-24T22:30:48.000Z
include/utils/binaryreader.hpp
aethelwerka/astraea
cf700a854d4183a263c7185b8ee3ab5d496215dc
[ "BSD-3-Clause" ]
null
null
null
include/utils/binaryreader.hpp
aethelwerka/astraea
cf700a854d4183a263c7185b8ee3ab5d496215dc
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright 2020 Krayfaus * All rights reserved. * * This source code is licensed under the BSD-style license that can be * found in the LICENSE file in the root directory of this source tree. */ #pragma once #include "array.hpp" // IWYU pragma: export #include "endian.hpp" // IWYU pragma: export #include "platform_string.hpp" #include <filesystem> #include <fstream> #include <limits> namespace binaryreader { using File = std::fstream; using Offset = std::streampos; using Path = std::filesystem::path; using Stream = std::iostream; /* * Opens a file handle. */ inline File open_file(Path file_path) { #ifdef OS_WINDOWS return File(platform::utf8_to_winapi(file_path.string()), File::in | File::out | File::binary); #elif defined OS_POSIX return File(file_path.string(), File::in | File::out | File::binary); #endif } /* * Closes a file handle. */ inline void close_file(File &file) { file.close(); } /** * Get current offset of the stream. */ inline Offset tell(Stream &file) { return file.tellp(); } /** * Seek an offset in the stream. */ inline void seek(Stream &file, Offset pos) { file.seekp(pos); if (file.bad()) { // std::cerr << "Error while seeking pos in file." << std::endl; } } inline uint64_t file_size(Stream &file) { auto old_pos = tell(file); seek(file, 0x0); file.ignore(std::numeric_limits<std::streamsize>::max()); auto lenght = file.gcount(); file.clear(); seek(file, old_pos); return (uint64_t)lenght; } /* * Reads basic type from stream. */ template <typename Type> constexpr auto read(Stream &file, Endian endian = Endian::native) { auto data = Type{}; file.read(reinterpret_cast<char *>(&data), sizeof(Type)); if (file.fail()) { // std::cerr << "Error while reading file." << std::endl; // std::cerr << "Only " << fs.gcount() << " bytes could be read." << std::endl; } maybe_endian_swap(&data, 1, endian); return data; } /* * Read an array of _lenght_ Types */ template <typename Type, uint32_t lenght> constexpr auto read(Stream &file, Endian endian = Endian::native) { auto array = Array<Type>(lenght); array.count = lenght; file.read(reinterpret_cast<char *>(array.data), sizeof(Type) * lenght); if (file.fail()) { // std::cerr << "Error while reading file." << std::endl; // std::cerr << "Only " << fs.gcount() << " bytes could be read." << std::endl; } maybe_endian_swap(array.data, lenght, endian); return array; } /* * Read an array of Types from _beg_ till _end_.. */ template <typename Type> Array<Type> read(Stream &file, Offset begin, Offset end, Endian endian = Endian::native) { assert((end - begin) % sizeof(Type) == 0); // "It's not possible to fit the requested array lenght in the offsets." uint32_t lenght = (uint32_t)(end - begin) / sizeof(Type); auto array = Array<Type>(lenght); array.count = lenght; auto old_pos = tell(file); seek(file, begin); file.read(reinterpret_cast<char *>(array.data), sizeof(Type) * lenght); if (file.fail()) { // std::cerr << "Error while reading file." << std::endl; // std::cerr << "Only " << fs.gcount() << " bytes could be read." << std::endl; } seek(file, old_pos); maybe_endian_swap(array.data, lenght, endian); return array; } /* * Read an array of _lenght_ Types to &data. */ template <typename Type, uint32_t lenght> void read(Stream &file, Type (&r_data)[lenght], Endian endian = Endian::native) { file.read(reinterpret_cast<char *>(r_data), sizeof(Type) * lenght); if (file.fail()) { // std::cerr << "Error while reading file." << std::endl; // std::cerr << "Only " << fs.gcount() << " bytes could be read." << std::endl; } maybe_endian_swap(r_data, lenght, endian); } } // namespace binaryreader
25.544304
100
0.610753
aethelwerka
48913e58bf82bcd0f2cb5b0de87c3c0c4ee8aad4
57
hpp
C++
src/boost_math_distributions_non_central_beta.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
10
2018-03-17T00:58:42.000Z
2021-07-06T02:48:49.000Z
src/boost_math_distributions_non_central_beta.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
2
2021-03-26T15:17:35.000Z
2021-05-20T23:55:08.000Z
src/boost_math_distributions_non_central_beta.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
4
2019-05-28T21:06:37.000Z
2021-07-06T03:06:52.000Z
#include <boost/math/distributions/non_central_beta.hpp>
28.5
56
0.842105
miathedev
4895c13aef139096f2222f5df9c63eb0fc39ce83
8,028
cpp
C++
PathfindingDemo/PathfindingTest/PathfindingTest/PathfindingTest/Node.cpp
robotx211/PathfindingDemo
449b8037c9ca96fc179d7ddb5821f5a59346e7ef
[ "MIT" ]
1
2020-01-21T11:17:40.000Z
2020-01-21T11:17:40.000Z
PathfindingDemo/PathfindingTest/PathfindingTest/PathfindingTest/Node.cpp
robotx211/PathfindingDemo
449b8037c9ca96fc179d7ddb5821f5a59346e7ef
[ "MIT" ]
null
null
null
PathfindingDemo/PathfindingTest/PathfindingTest/PathfindingTest/Node.cpp
robotx211/PathfindingDemo
449b8037c9ca96fc179d7ddb5821f5a59346e7ef
[ "MIT" ]
null
null
null
/// @file Node.cpp /// @brief Node class definition #include <SDL2\SDL.h> #include <SDL2\SDL_ttf.h> #include <cstdlib> #include <string> #include <sstream> #include <vector> #include <iostream> #include "Node.h" //Module Contents void Node::SetParent(Node *_parent) { //sets the parent node to the passed node pointer m_parent = _parent; //Code under this was used for debugging loops of parent nodes /* Node *current = this; std::vector<Node*> process; m_parent = _parent; while (current->m_parent != nullptr) { for (int i = 0; i < process.size(); i++) { if (process.at(i) == current) { throw std::exception(); } } process.push_back(current); current = current->m_parent; */ } void Node::SetHWeight(Node *_goal) { //sets the h weight of the node to be the manhattan distance to the goal node //eg: this node = (2,3), goal = (6,6), h weight = 4 + 3 = 7 m_hWeight = (std::abs(this->m_posX - _goal->m_posX) + std::abs(this->m_posY - _goal->m_posY)); } void Node::SetPathDistance() { //sets the path distance to be equal to the distance from start to the parent node + the distance from the parent to this node if (m_parent != nullptr) { //if manhattan distance from parent to this node = 1 (up, down, left, or right expansion), +1.0f to path distance if (std::abs(m_posX - m_parent->m_posX) + std::abs(m_posY - m_parent->m_posY) == 1) { m_pathDistance = 1.0f + m_parent->m_pathDistance; } //if manhattan distance from parent to this node = 2 (diagonal expansion), +1.4142f to path distance else if (std::abs(m_posX - m_parent->m_posX) + std::abs(m_posY - m_parent->m_posY) == 2) { m_pathDistance = 1.4142f + m_parent->m_pathDistance; } } } void Node::SetFWeight() { m_fWeight = m_hWeight + m_gWeight; } void Node::SetGWeight() { //sets g weight to equal total path distance and total path weight cost SetPathDistance(); SetTotalPathCost(); m_gWeight = m_pathDistance + m_totalCost; } void Node::SetCost(float _cost) { //sets cost of node to be what the user input, then sets the main colour to be a greyscale based on that weight m_cost = _cost; m_mainColour = { (Uint8)floor(255.0f - (_cost * 8.0f)), (Uint8)floor(255.0f - (_cost * 8.0f)), (Uint8)floor(255.0f - (_cost * 8.0f)) }; } void Node::SetTotalPathCost() { //if this node has a parent, sets the total cost to equal the parents totl cost + it's total cost if (m_parent != nullptr) { m_totalCost = m_parent->m_totalCost + m_cost; } //else it's total cost equals it's cost else { m_totalCost = m_cost; } } void Node::SetThreatLevel(float _threat) { //sets threat level of node to be what the user input, then sets the border colour to be a redscale based on that value. //If threat level = 0.0, border colour is set to black, to avoid confusion when drawing m_threatLevel = _threat; if (_threat == 0.0f) { m_borderColour = { 0,0,0 }; } else { m_borderColour = { 255, (Uint8)floor(255.0f - (_threat * 10.0f)), (Uint8)floor(255.0f - (_threat * 10.0f)), 0}; } } void Node::ToggleObject() { //toggles whether a node is an object, and sets it's colour to be white if false, and black if true if (m_isObject == true) { m_isObject = false; m_mainColour = { 255,255,255,0 }; } else if (m_isObject == false) { m_isObject = true; m_mainColour = { 0,0,0,0 }; } } void Node::ToggleStart() { //toggles whether a node is the start node, and sets it's colour to be white if false, and green if true if (m_isStart == true) { m_isStart = false; m_mainColour = { 255,255,255,0 }; } else if (m_isStart == false) { m_isStart = true; m_mainColour = { 0,255,0,0 }; } } void Node::ToggleGoal() { //toggles whether a node is the goal node, and sets it's colour to be white if false, and yellow if true if (m_isGoal == true) { m_isGoal = false; m_mainColour = { 255,255,255,0 }; } else if (m_isGoal == false) { m_isGoal = true; m_mainColour = { 255,255,0,0 }; } } void Node::DrawNode(SDL_Renderer *_renderer) { //draws the node, with it's colours, size and position //nodes are drawn as a filled square, set to be the main colour, and an unfilled square, set to be the border colour DrawRect.h = m_size; DrawRect.w = m_size; DrawRect.x = m_size * m_posX; DrawRect.y = m_size * m_posY; //if the main colour is orange (so it is the current node in a pathing algorithm, set it's filled square colour to be orange (it's border colour) if (m_borderColour.r == 255 && m_borderColour.g == 146 && m_borderColour.b == 0) { SDL_SetRenderDrawColor(_renderer, m_borderColour.r, m_borderColour.g, m_borderColour.b, 255); } else { SDL_SetRenderDrawColor(_renderer, m_mainColour.r, m_mainColour.g, m_mainColour.b, 255); } SDL_RenderFillRect(_renderer, &DrawRect); SDL_SetRenderDrawColor(_renderer, m_borderColour.r, m_borderColour.g, m_borderColour.b, 255); SDL_RenderDrawRect(_renderer, &DrawRect); } void Node::DrawParentLine(SDL_Renderer *_renderer) { //draws a line between the centre of the this node to the centre of the parent node, on screen if (m_parent != nullptr) { SDL_SetRenderDrawColor(_renderer, 0, 0, 0, 255); SDL_RenderDrawLine(_renderer, m_posX * m_size + m_size / 2, m_posY * m_size + m_size / 2, m_parent->m_posX * m_size + m_size / 2, m_parent->m_posY * m_size + m_size / 2); } } void Node::DrawWeights(SDL_Renderer *_renderer, TTF_Font *_font) { //used to write the h, g and f weights of nodes onto the grid //text does not scale well at low sizes, so it not included in the final build //only really works at a vrey high node size //also decreases performacne drastically //prints the f weight in the top left corner, h weight in bottom left corner and g weight in bottom right corner std::stringstream fString, gString, hString; DrawRect.h = 8; DrawRect.w = 24; if (m_fWeight != 0) { DrawRect.h = 16; if (m_fWeight <= 99) { fString << "00" << m_fWeight; } else if (m_fWeight <= 999) { fString << "0" << m_fWeight; } else { fString << m_fWeight; } m_weightsSur = TTF_RenderText_Solid(_font, fString.str().c_str(), { 0,0,0 }); m_weightsTex = SDL_CreateTextureFromSurface(_renderer, m_weightsSur); DrawRect.x = m_size * m_posX + 2; DrawRect.y = m_size * m_posY + 2; SDL_RenderCopy(_renderer, m_weightsTex, NULL, &DrawRect); if (m_gWeight <= 99) { gString << "00" << m_gWeight; } else if (m_gWeight <= 999) { gString << "0" << m_gWeight; } else { gString << m_gWeight; } m_weightsSur = TTF_RenderText_Solid(_font, gString.str().c_str(), { 0,0,0 }); m_weightsTex = SDL_CreateTextureFromSurface(_renderer, m_weightsSur); DrawRect.y = m_size * m_posY + m_size - 2 - 12; SDL_RenderCopy(_renderer, m_weightsTex, NULL, &DrawRect); if (m_hWeight <= 99) { hString << "00" << m_hWeight; } else if (m_hWeight <= 999) { hString << "0" << m_hWeight; } else { hString << m_hWeight; } m_weightsSur = TTF_RenderText_Solid(_font, hString.str().c_str(), { 0,0,0 }); m_weightsTex = SDL_CreateTextureFromSurface(_renderer, m_weightsSur); DrawRect.x = m_size * m_posX + m_size - 2 - 24; SDL_RenderCopy(_renderer, m_weightsTex, NULL, &DrawRect); SDL_FreeSurface(m_weightsSur); } } void Node::ResetNode() { //resets all node values m_mainColour = { 255,255,255,0 }; m_borderColour = { 0,0,0,0 }; m_hWeight = 0.0f; m_gWeight = 0.0f; m_fWeight = 0.0f; if (m_isStart == true) { ToggleStart(); } if (m_isGoal == true) { ToggleGoal(); } if (m_isObject == true) { ToggleObject(); } m_pathDistance = 0.0f; SetCost(0.0f); m_totalCost = 0.0f; SetThreatLevel(0.0f); m_parent = nullptr; }
23.751479
173
0.645366
robotx211
4895cc9a6988601b3f20593a46226a4844680e9e
2,356
cpp
C++
0x05/zadanie_1.cpp
DevxMike/lessons
87ea02a9680d342ef3dafba5a8ce918bbb44ed6e
[ "MIT" ]
null
null
null
0x05/zadanie_1.cpp
DevxMike/lessons
87ea02a9680d342ef3dafba5a8ce918bbb44ed6e
[ "MIT" ]
null
null
null
0x05/zadanie_1.cpp
DevxMike/lessons
87ea02a9680d342ef3dafba5a8ce918bbb44ed6e
[ "MIT" ]
1
2020-11-09T19:09:41.000Z
2020-11-09T19:09:41.000Z
#include <iostream> #include <cstdlib> using std::cout; using std::cin; using std::endl; float suma(float a, float b); float roznica(float a, float b); float iloczyn(float a, float b); float iloraz(float a, float b); char pobierz_znak(void); void blad(int x); void koniec(void); float wykonaj_dzialanie(float a, float b, char c){ float wynik; switch (c) { case '+': { wynik = suma(a, b); break; } case '-': { wynik = roznica(a, b); break; } case '*': { wynik = iloczyn(a, b); break; } case '/': { if(b != 0.0f){ wynik = iloraz(a, b); } else{ wynik = 0.0f; blad(0); } break; } case 'K': { koniec(); break; } } return wynik; } // ---> dodatkowo zmodyfikować funkcje powyższą tak aby zwracała wynik przez wskaźnik a później tak aby zwracała przez referencje <--- // potestować różne możliwości int main() { char c = pobierz_znak(); while(c != 'K'){ if(c == -1){ blad(1); while((c = pobierz_znak()) == -1){ blad(1); continue; } if(c == 'K'){ koniec(); } } float a, b, wynik; cout << "Podaj a: "; cin >> a; cout << "Podaj b: "; cin >> b; cout << "Wynik dzialania: " << wykonaj_dzialanie(a, b, c) << endl << endl; c = pobierz_znak(); } } char pobierz_znak(void){ char c; cout << "'+' \t '-' \t '*' \t '/' \t 'K' - Koniec Programu" << endl; cout << "\tWybierz: " << endl; cin >> c; if(c != '+' && c != '-' && c != '*' && c != '/' && c != 'K'){ return c = -1; //powiadamiamy, że wystąpił błąd } return c; } float suma(float a, float b){ return a + b; } float roznica(float a, float b){ return a - b; } float iloczyn(float a, float b){ return a * b; } float iloraz(float a, float b){ return a / b; } void blad(int x) { static int ilosc_dzielenia_zero = 0; static int ilosc_blednych_znakow = 0; if (x == 0) { cout << "Dzielenie przez zero ZABRONIONE!" << endl; cout << "Blad nr " << ++ilosc_dzielenia_zero << endl; } if (x == 1) { cout << "bledny znak!" << endl; cout << "Blad nr " << ++ilosc_blednych_znakow << endl; } } void koniec(void) { exit(0); }
16.475524
134
0.498727
DevxMike
48982a7de079cf043677cff92ff9c0d5bb0a217f
445
cpp
C++
Basic-Programming/Memory/Array Memory Show.cpp
arifparvez14/Basic-and-competetive-programming
4cb9ee7fbed3c70307d0f63499fcede86ed3c732
[ "MIT" ]
null
null
null
Basic-Programming/Memory/Array Memory Show.cpp
arifparvez14/Basic-and-competetive-programming
4cb9ee7fbed3c70307d0f63499fcede86ed3c732
[ "MIT" ]
null
null
null
Basic-Programming/Memory/Array Memory Show.cpp
arifparvez14/Basic-and-competetive-programming
4cb9ee7fbed3c70307d0f63499fcede86ed3c732
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> using namespace std; int main() { int a[5]= {50,60,70,80,90}; printf("Value of Array is %d, %d, %d, %d, %d\n",a[0],a[1],a[2],a[3],a[4]); printf("Address of a is %p\n",a); printf("Address of a[0] is %p\n",a[0]); printf("Address of a[1] is %p\n",a[1]); printf("Address of a[2] is %p\n",a[2]); printf("Address of a[3] is %p\n",a[3]); printf("Address of a[4] is %p\n",a[4]); return 0; }
26.176471
78
0.525843
arifparvez14
489de03917e420fd27b87151c94fcf97960a3a68
3,281
hpp
C++
include/NetEase/Docker/IDock.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/NetEase/Docker/IDock.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/NetEase/Docker/IDock.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes // Including type: NetEase.Docker.InitializeData #include "NetEase/Docker/InitializeData.hpp" // Including type: NetEase.Docker.LoginData #include "NetEase/Docker/LoginData.hpp" // Including type: NetEase.Docker.LogoutData #include "NetEase/Docker/LogoutData.hpp" // Including type: NetEase.Docker.ReceivedHighscoreData #include "NetEase/Docker/ReceivedHighscoreData.hpp" // Completed includes // Begin forward declares // Forward declaring namespace: System namespace System { // Forward declaring type: Action`1<T> template<typename T> class Action_1; } // Forward declaring namespace: NetEase::Docker namespace NetEase::Docker { // Forward declaring type: UploadScoreData struct UploadScoreData; // Forward declaring type: RequestHighscoreData struct RequestHighscoreData; } // Completed forward declares // Type namespace: NetEase.Docker namespace NetEase::Docker { // Size: 0x0 #pragma pack(push, 1) // Autogenerated type: NetEase.Docker.IDock class IDock { public: // Creating value type constructor for type: IDock IDock() noexcept {} // public System.Void SetInitializeCallback(System.Action`1<NetEase.Docker.InitializeData> callbackAction) // Offset: 0xFFFFFFFF void SetInitializeCallback(System::Action_1<NetEase::Docker::InitializeData>* callbackAction); // public System.Void Initialize() // Offset: 0xFFFFFFFF void Initialize(); // public System.Void SetLoginCallback(System.Action`1<NetEase.Docker.LoginData> callbackAction) // Offset: 0xFFFFFFFF void SetLoginCallback(System::Action_1<NetEase::Docker::LoginData>* callbackAction); // public System.Void Login() // Offset: 0xFFFFFFFF void Login(); // public System.Void SetLogoutCallback(System.Action`1<NetEase.Docker.LogoutData> callbackAction) // Offset: 0xFFFFFFFF void SetLogoutCallback(System::Action_1<NetEase::Docker::LogoutData>* callbackAction); // public System.Void Logout() // Offset: 0xFFFFFFFF void Logout(); // public System.Void UploadScore(NetEase.Docker.UploadScoreData scoreData) // Offset: 0xFFFFFFFF void UploadScore(NetEase::Docker::UploadScoreData scoreData); // public System.Boolean WillProvideHighscore() // Offset: 0xFFFFFFFF bool WillProvideHighscore(); // public System.Void SetHighscoreReceivedCallback(System.Action`1<NetEase.Docker.ReceivedHighscoreData> callbackAction) // Offset: 0xFFFFFFFF void SetHighscoreReceivedCallback(System::Action_1<NetEase::Docker::ReceivedHighscoreData>* callbackAction); // public System.Void RequestHighscoreList(NetEase.Docker.RequestHighscoreData highscoreRequest) // Offset: 0xFFFFFFFF void RequestHighscoreList(NetEase::Docker::RequestHighscoreData highscoreRequest); // public System.Void UpdateLoop() // Offset: 0xFFFFFFFF void UpdateLoop(); }; // NetEase.Docker.IDock #pragma pack(pop) } #include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp" DEFINE_IL2CPP_ARG_TYPE(NetEase::Docker::IDock*, "NetEase.Docker", "IDock");
42.61039
125
0.722341
darknight1050
48a3291076112b0ea2143614fafc9912604299b6
3,001
cpp
C++
dlls/asheep/barney9mmar.cpp
malortie/hl-asheep
58a402d5e1982b1b7b9476108d04856d0fdeb8b8
[ "Apache-2.0" ]
null
null
null
dlls/asheep/barney9mmar.cpp
malortie/hl-asheep
58a402d5e1982b1b7b9476108d04856d0fdeb8b8
[ "Apache-2.0" ]
6
2021-11-28T06:39:56.000Z
2021-12-31T13:59:26.000Z
dlls/asheep/barney9mmar.cpp
malortie/hl-asheep
58a402d5e1982b1b7b9476108d04856d0fdeb8b8
[ "Apache-2.0" ]
null
null
null
/*** * * Copyright (c) 1996-2001, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ #include "extdll.h" #include "util.h" #include "cbase.h" #include "monsters.h" #include "weapons.h" #include "nodes.h" #include "player.h" #include "soundent.h" #include "gamerules.h" enum mp5_e { BARNEY9MMAR_LONGIDLE = 0, BARNEY9MMAR_IDLE1, BARNEY9MMAR_LAUNCH, BARNEY9MMAR_RELOAD, BARNEY9MMAR_DEPLOY, BARNEY9MMAR_FIRE1, BARNEY9MMAR_FIRE2, BARNEY9MMAR_FIRE3, BARNEY9MMAR_HOLSTER, }; LINK_ENTITY_TO_CLASS(weapon_barney9mmar, CBarney9MMAR); int CBarney9MMAR::GetItemInfo(ItemInfo *p) { p->pszName = STRING(pev->classname); p->pszAmmo1 = "9mm"; p->iMaxAmmo1 = BARNEY9MMAR_MAX_CARRY; p->pszAmmo2 = "ARgrenades"; p->iMaxAmmo2 = M203_GRENADE_MAX_CARRY; p->iMaxClip = BARNEY9MMAR_MAX_CLIP; p->iSlot = 2; p->iPosition = 1; p->iFlags = 0; p->iId = m_iId = GetWeaponID(); p->iWeight = BARNEY9MMAR_WEIGHT; return 1; } int CBarney9MMAR::GetWeaponID() { return WEAPON_BARNEY9MMAR; } const char* CBarney9MMAR::GetThirdpersonModel() { return "models/p_9mmAR.mdl"; } const char* CBarney9MMAR::GetViewModel() { return "models/v_barney9mmar.mdl"; } const char* CBarney9MMAR::GetWorldModel() { return "models/w_9mmAR.mdl"; } void CBarney9MMAR::PrecacheModels() { BaseClass::PrecacheModels(); PRECACHE_MODEL("models/v_barney9mmar.mdl"); PRECACHE_MODEL("models/w_9mmAR.mdl"); PRECACHE_MODEL("models/p_9mmAR.mdl"); } void CBarney9MMAR::PrecacheEvents() { m_usBarney9MMAR = PRECACHE_EVENT(1, "events/mp5.sc"); m_usBarney9MMAR2 = PRECACHE_EVENT(1, "events/mp52.sc"); } void CBarney9MMAR::GiveFirstTimeSpawnDefaultAmmo() { m_iDefaultAmmo = BARNEY9MMAR_DEFAULT_GIVE; } const unsigned short& CBarney9MMAR::GetFireEvent() const { return m_usBarney9MMAR; } const unsigned short& CBarney9MMAR::GetGrenadeLaunchEvent() const { return m_usBarney9MMAR2; } int CBarney9MMAR::GetBulletType() { return BULLET_PLAYER_MP5; } int CBarney9MMAR::GetDeploySequence() { return BARNEY9MMAR_DEPLOY; } int CBarney9MMAR::GetHolsterSequence() { return BARNEY9MMAR_HOLSTER; } int CBarney9MMAR::GetReloadSequence() { return BARNEY9MMAR_RELOAD; } float CBarney9MMAR::GetHolsterSequenceDuration() { return 16.0f / 30.0f; } float CBarney9MMAR::GetReloadSequenceDuration() { return 1.5; } float CBarney9MMAR::PlayIdleAnimation() { int iAnim; switch (RANDOM_LONG(0, 1)) { case 0: iAnim = BARNEY9MMAR_LONGIDLE; break; default: case 1: iAnim = BARNEY9MMAR_IDLE1; break; } SendWeaponAnim(iAnim); return UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); }
19.237179
77
0.749417
malortie
48a486482490e65357ff4f6a4e35ab8358e3bbb0
2,212
hpp
C++
vef/reader.hpp
Melown/libvef
cb7df31d09a58d5ed4b894a4dc3bb66c6b8be825
[ "BSD-2-Clause" ]
2
2017-04-22T20:26:52.000Z
2017-10-03T15:12:54.000Z
vef/reader.hpp
Melown/libvef
cb7df31d09a58d5ed4b894a4dc3bb66c6b8be825
[ "BSD-2-Clause" ]
1
2019-08-09T12:56:02.000Z
2019-08-09T15:20:12.000Z
vef/reader.hpp
Melown/libvef
cb7df31d09a58d5ed4b894a4dc3bb66c6b8be825
[ "BSD-2-Clause" ]
1
2019-09-26T06:52:28.000Z
2019-09-26T06:52:28.000Z
/** * Copyright (c) 2017 Melown Technologies SE * * 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. * * 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 vef_reader_hpp_included_ #define vef_reader_hpp_included_ #include <vector> #include <boost/optional.hpp> #include "roarchive/roarchive.hpp" #include "vef.hpp" namespace vef { /** VEF archive reader */ class Archive { public: using list = std::vector<Archive>; Archive(const boost::filesystem::path &root); Archive(roarchive::RoArchive &archive); const Manifest& manifest() const { return manifest_; } const roarchive::RoArchive archive() const { return archive_; } const boost::filesystem::path path() const { return archive_.path(); } /** Get istream for mesh */ roarchive::IStream::pointer meshIStream(const Mesh &mesh) const; private: roarchive::RoArchive archive_; /** Loaded manifest. */ Manifest manifest_; }; } // namespace vef #endif // vef_reader_hpp_included_
31.6
78
0.738698
Melown
48a734d93dcf26accb1d68c3cabc0f1e45d14756
2,098
cpp
C++
src/macro/Macro.cpp
auroralimin/montador-assembly-inventado
b7deeb4a00f27e941636921a84d5222dd7b008a5
[ "Apache-2.0" ]
null
null
null
src/macro/Macro.cpp
auroralimin/montador-assembly-inventado
b7deeb4a00f27e941636921a84d5222dd7b008a5
[ "Apache-2.0" ]
null
null
null
src/macro/Macro.cpp
auroralimin/montador-assembly-inventado
b7deeb4a00f27e941636921a84d5222dd7b008a5
[ "Apache-2.0" ]
null
null
null
#include <string> #include <iostream> #include <fstream> #include "DriverMacro.hpp" enum PType { mcr, o }; std::string process(mac::Driver *driver, std::string src, std::string dst, PType pType); int main(int argc, char **argv) { if (argc < 4) { std::cerr << "É necessário especificar: " "<arquivo de entrada> <arquivo de saída> <argumento>" << std::endl; return EXIT_FAILURE; } std::string src(argv[1]), dst(argv[2]), flag(argv[3]); mac::Driver *driver = new mac::Driver(argv[1]); std::string str(argv[1]); if (flag == "0") { process(driver, str, dst, PType::mcr); } else if (flag == "1") { str = process(driver, str, dst, PType::mcr); process(driver, str, dst, PType::o); } else { delete driver; std::cerr << "Erro" << std::endl; return EXIT_FAILURE; } delete driver; return EXIT_SUCCESS; } std::string process(mac::Driver *driver, std::string src, std::string dst, PType pType) { std::string ext[2] = {".mcr", ".o"}; dst = dst.substr(0, dst.find(".")) + ext[pType]; //Coloca endl no final do arquivo de entrada para evitar problemas std::ofstream oFile; oFile.open(src, std::ios_base::app); oFile << std::endl; oFile.close(); std::ifstream stream(src); if (!stream.good()) { std::cerr << "Não foi possível abrir o arquivo:" << src << "." << std::endl; exit(EXIT_FAILURE); } switch (pType) { case mcr: if (DEBUG) { std::cout << "Macro src = " << src << ", Macro dst = " << dst << std::endl; } driver->macroProcess(stream, dst); break; case o: if (DEBUG) { std::cout << "OnePass src = " << src << ", OnePass dst = " << dst << std::endl; } driver->onePassProcess(src, dst); break; } return dst; }
25.585366
74
0.492374
auroralimin
48a8d557daedc39ceb26d0523655c0faeb21996d
1,213
cpp
C++
src/utils/glslinterop.cpp
Stellaris-code/Rayfun
2c9e5e2b0cd1636f0a046d6dce0efdce60f094cb
[ "WTFPL" ]
null
null
null
src/utils/glslinterop.cpp
Stellaris-code/Rayfun
2c9e5e2b0cd1636f0a046d6dce0efdce60f094cb
[ "WTFPL" ]
null
null
null
src/utils/glslinterop.cpp
Stellaris-code/Rayfun
2c9e5e2b0cd1636f0a046d6dce0efdce60f094cb
[ "WTFPL" ]
null
null
null
/* glslinterop %{Cpp:License:ClassName} - Yann BOUCHER (yann) 18/08/2016 ** ** ** DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE ** Version 2, December 2004 ** ** Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> ** ** Everyone is permitted to copy and distribute verbatim or modified ** copies of this license document, and changing it is allowed as long ** as the name is changed. ** ** DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE ** TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ** ** 0. You just DO WHAT THE FUCK YOU WANT TO. */ #include "utils/glslinterop.hpp" #include "map.hpp" namespace Rayfun { namespace Utility { std::vector<uint8_t> mapToBuffer(const Map &t_map) { std::vector<uint8_t> buffer; for (size_t j { 0 }; j < t_map.size().y; ++j) { for (size_t i { 0 }; i < t_map.size().x; ++i) { const auto& tileAt = t_map.tileAt({i, j}); buffer.push_back(tileAt.tex[Side::North]); buffer.push_back(tileAt.tex[Side::South]); buffer.push_back(tileAt.tex[Side::East]); buffer.push_back(tileAt.tex[Side::West]); } } return buffer; } } }
23.326923
73
0.611707
Stellaris-code
48aa2327c0328586b9d7e91ee792d4eb559c947c
733
hpp
C++
fac/Common.hpp
fa-org/fa
13bba132b682554beccc25e6d016e04b7b67998f
[ "MIT" ]
20
2021-11-23T23:38:25.000Z
2022-03-13T04:39:24.000Z
fac/Common.hpp
fa-org/fa
13bba132b682554beccc25e6d016e04b7b67998f
[ "MIT" ]
5
2021-11-24T04:48:59.000Z
2022-01-02T15:27:12.000Z
fac/Common.hpp
fa-org/fa
13bba132b682554beccc25e6d016e04b7b67998f
[ "MIT" ]
10
2021-11-24T03:36:12.000Z
2022-03-06T19:13:10.000Z
#ifndef __COMMON_HPP__ #define __COMMON_HPP__ enum class PublicLevel { Public, Internal, Protected, Private }; inline PublicLevel GetPublicLevel (FaParser::PublicLevelContext *_ctx) { if (_ctx) { if (_ctx->Public ()) { return PublicLevel::Public; } else if (_ctx->Internal ()) { return PublicLevel::Internal; } else if (_ctx->Protected ()) { return PublicLevel::Protected; } } return PublicLevel::Private; } inline std::string GetId (FaParser::IdContext *_ctx) { return _ctx ? _ctx->getText () : ""; } inline std::string GetId (FaParser::IdsContext *_ctx) { return _ctx ? _ctx->getText () : ""; } inline std::string Indent (size_t _indent) { return std::string (_indent * 4, ' '); } #endif //__COMMON_HPP__
28.192308
94
0.68895
fa-org
48abbe74799c0fcf3a5f1706ac86ac7b67158645
845
cpp
C++
Lesson02/OddOccurrencesInArray/OddOccurrencesInArray/main.cpp
rlan/CodilityLessons
6ce4b1a19e7ce90fce39f9ec7fc207e620662676
[ "MIT" ]
null
null
null
Lesson02/OddOccurrencesInArray/OddOccurrencesInArray/main.cpp
rlan/CodilityLessons
6ce4b1a19e7ce90fce39f9ec7fc207e620662676
[ "MIT" ]
null
null
null
Lesson02/OddOccurrencesInArray/OddOccurrencesInArray/main.cpp
rlan/CodilityLessons
6ce4b1a19e7ce90fce39f9ec7fc207e620662676
[ "MIT" ]
null
null
null
// // Codility // Lesson 2 Arrays // OddOccurrencesInArray // https://codility.com/programmers/lessons/2-arrays/odd_occurrences_in_array/ // // 100% score // // Created by Rick Lan on 3/28/17. // See LICENSE. // #include <iostream> #include <vector> using namespace std; // XOR int solution(vector<int> &A) { if (A.size() == 0) { return -1; } int sol = A[0]; for (unsigned int ii = 1; ii < A.size(); ii++) { sol ^= A[ii]; } return sol; } int main(int argc, const char * argv[]) { vector<int> A; int N; cout << "N: "; cin >> N; if (N > 0) { A.resize(N); for (int ii = 0; ii < N; ii++) { cout << "A[" << ii << "]: "; cin >> A[ii]; } } cout << "Solution: " << solution(A) << endl; return 0; }
17.244898
79
0.47574
rlan
48add2f442499adf87beae92cd4c8a3ed1608bf2
1,028
cpp
C++
parallel.cpp
TomoyoSang/Parallel_Processing_RISCV
f64d7d53521774d886b5bb0a4396d465f0f90d2d
[ "MIT" ]
null
null
null
parallel.cpp
TomoyoSang/Parallel_Processing_RISCV
f64d7d53521774d886b5bb0a4396d465f0f90d2d
[ "MIT" ]
null
null
null
parallel.cpp
TomoyoSang/Parallel_Processing_RISCV
f64d7d53521774d886b5bb0a4396d465f0f90d2d
[ "MIT" ]
null
null
null
#include "parallel.h" using namespace std; InterMem im; Instruction_Fetch my_fet; Instruction_Decode my_dec; Execution my_ex; Memory_Access my_ma; Write_Back my_wb; int main() { //freopen("pi.data", "r", stdin); im.readin(); int cnt = 1; pass_oj if_end, id_end, ex_end, ma_end; while (1) { my_wb.WB(ma_end); reset(ma_end); ma_end = my_ma.MA(ex_end, im); reset(ex_end); ex_end = my_ex.Ex(id_end); reset(id_end); id_end = my_dec.Decode(if_end); reset(if_end); if (wait_time <= 0) if_end = my_fet.fetcher(im); if (wait_time > 0)wait_time--; else wait_time = 0; Initial(EX_exRenew); Initial(EX_maRenew); update_changes(); Initial(EX_Forward); Initial(MA_Forward); FeedBack(ex_end, id_end, if_end); cnt++; if (!flag) { cout << (reg.Register[10] & 255u); break; } } //if ((Pred_False + Pred_True) != 0)cout << "\n" << ((double)Pred_True / (Pred_False + Pred_True) * 100) << "%" << "\n"; //cout << Pred_True << " " << Pred_False+Pred_True; return 0; }
16.852459
121
0.633268
TomoyoSang
48b1da64e23eb368f519e0ff9cd3db64cab3c874
1,167
cpp
C++
src/core/CutsceneScriptSegment.cpp
tedvalson/NovelTea
f731951f25936cb7f5ff23e543e0301c1b5bfe82
[ "MIT" ]
null
null
null
src/core/CutsceneScriptSegment.cpp
tedvalson/NovelTea
f731951f25936cb7f5ff23e543e0301c1b5bfe82
[ "MIT" ]
null
null
null
src/core/CutsceneScriptSegment.cpp
tedvalson/NovelTea
f731951f25936cb7f5ff23e543e0301c1b5bfe82
[ "MIT" ]
null
null
null
#include <NovelTea/CutsceneScriptSegment.hpp> #include <NovelTea/Cutscene.hpp> #include <NovelTea/Game.hpp> #include <NovelTea/ScriptManager.hpp> namespace NovelTea { CutsceneScriptSegment::CutsceneScriptSegment() : m_autosaveAfter(false) , m_autosaveBefore(false) { setDuration(10); setDelay(10); } json CutsceneScriptSegment::toJson() const { auto j = sj::Array( static_cast<int>(type()), m_autosaveAfter, m_autosaveBefore, m_comment, m_script ); return j; } bool CutsceneScriptSegment::fromJson(const json &j) { m_autosaveAfter = j[1].ToBool(); m_autosaveBefore = j[2].ToBool(); m_comment = j[3].ToString(); m_script = j[4].ToString(); return true; } CutsceneSegment::Type CutsceneScriptSegment::type() const { return CutsceneSegment::Script; } void CutsceneScriptSegment::runScript(const std::shared_ptr<Cutscene> &cutscene) const { if (m_script.empty()) return; try { auto script = "function _f(cutscene){" + m_script + "}"; ActiveGame->getScriptManager()->call(script, "_f", cutscene); } catch (std::exception &e) { std::cerr << "CutsceneScriptSegment::runScript() " << e.what() << std::endl; } } } // namespace NovelTea
20.839286
86
0.718081
tedvalson
48b896a5f53d39391b6ccb2e4cca109227ca97d0
1,101
cpp
C++
NeuralNetwork/Common/ActivationFunctions.cpp
hailunchina/AIEngine
14a5e4f4230a31459f9e2246e09e48435535ae99
[ "MIT" ]
4
2019-05-16T13:26:10.000Z
2019-07-30T13:31:25.000Z
NeuralNetwork/Common/ActivationFunctions.cpp
hailunchina/AIEngine
14a5e4f4230a31459f9e2246e09e48435535ae99
[ "MIT" ]
8
2019-05-26T22:40:36.000Z
2020-02-16T16:36:38.000Z
NeuralNetwork/Common/ActivationFunctions.cpp
hailunchina/AIEngine
14a5e4f4230a31459f9e2246e09e48435535ae99
[ "MIT" ]
null
null
null
#include "ActivationFunctions.h" namespace NeuralNetwork { namespace activation { double thresholdValue = 0.5; double sigmoid(const double& value) { double result = 1.0 / (1.0 + std::exp(-value)); return result; } void sigmoid(std::vector<double>& vector) { for (double& i : vector) { i = sigmoid(i); } } double sign(const double& value) { if (value > 0.0) { return 1.0; } return -1.0; } double threshold(const double& value) { if (value >= thresholdValue) { return 1.0; } return 0.0; } void threshold(std::vector<double>& vector) { for (double& i : vector) { i = threshold(i); } } void setThreshold(const double&& threshold) { thresholdValue = threshold; } } }
20.018182
59
0.412352
hailunchina
48bbce09e648bf5d565847d0b00516b39caacbc9
11,742
hpp
C++
include/System/Net/Sockets/SocketAsyncEventArgs.hpp
v0idp/virtuoso-codegen
6f560f04822c67f092d438a3f484249072c1d21d
[ "Unlicense" ]
null
null
null
include/System/Net/Sockets/SocketAsyncEventArgs.hpp
v0idp/virtuoso-codegen
6f560f04822c67f092d438a3f484249072c1d21d
[ "Unlicense" ]
null
null
null
include/System/Net/Sockets/SocketAsyncEventArgs.hpp
v0idp/virtuoso-codegen
6f560f04822c67f092d438a3f484249072c1d21d
[ "Unlicense" ]
1
2022-03-30T21:07:35.000Z
2022-03-30T21:07:35.000Z
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/byref.hpp" // Including type: System.EventArgs #include "System/EventArgs.hpp" // Including type: System.IDisposable #include "System/IDisposable.hpp" // Including type: System.Net.Sockets.SocketError #include "System/Net/Sockets/SocketError.hpp" // Completed includes // Begin forward declares // Forward declaring namespace: System::Net namespace System::Net { // Forward declaring type: EndPoint class EndPoint; } // Forward declaring namespace: System::Net::Sockets namespace System::Net::Sockets { // Forward declaring type: Socket class Socket; } // Forward declaring namespace: System namespace System { // Forward declaring type: EventHandler`1<TEventArgs> template<typename TEventArgs> class EventHandler_1; } // Completed forward declares // Type namespace: System.Net.Sockets namespace System::Net::Sockets { // Forward declaring type: SocketAsyncEventArgs class SocketAsyncEventArgs; } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" NEED_NO_BOX(::System::Net::Sockets::SocketAsyncEventArgs); DEFINE_IL2CPP_ARG_TYPE(::System::Net::Sockets::SocketAsyncEventArgs*, "System.Net.Sockets", "SocketAsyncEventArgs"); // Type namespace: System.Net.Sockets namespace System::Net::Sockets { // Size: 0x40 #pragma pack(push, 1) // Autogenerated type: System.Net.Sockets.SocketAsyncEventArgs // [TokenAttribute] Offset: FFFFFFFF class SocketAsyncEventArgs : public ::System::EventArgs/*, public ::System::IDisposable*/ { public: public: // private System.Boolean disposed // Size: 0x1 // Offset: 0x10 bool disposed; // Field size check static_assert(sizeof(bool) == 0x1); // Padding between fields: disposed and: in_progress char __padding0[0x3] = {}; // System.Int32 in_progress // Size: 0x4 // Offset: 0x14 int in_progress; // Field size check static_assert(sizeof(int) == 0x4); // System.Net.EndPoint remote_ep // Size: 0x8 // Offset: 0x18 ::System::Net::EndPoint* remote_ep; // Field size check static_assert(sizeof(::System::Net::EndPoint*) == 0x8); // System.Net.Sockets.Socket current_socket // Size: 0x8 // Offset: 0x20 ::System::Net::Sockets::Socket* current_socket; // Field size check static_assert(sizeof(::System::Net::Sockets::Socket*) == 0x8); // private System.Net.Sockets.Socket <AcceptSocket>k__BackingField // Size: 0x8 // Offset: 0x28 ::System::Net::Sockets::Socket* AcceptSocket; // Field size check static_assert(sizeof(::System::Net::Sockets::Socket*) == 0x8); // private System.Int32 <BytesTransferred>k__BackingField // Size: 0x4 // Offset: 0x30 int BytesTransferred; // Field size check static_assert(sizeof(int) == 0x4); // private System.Net.Sockets.SocketError <SocketError>k__BackingField // Size: 0x4 // Offset: 0x34 ::System::Net::Sockets::SocketError SocketError; // Field size check static_assert(sizeof(::System::Net::Sockets::SocketError) == 0x4); // private System.EventHandler`1<System.Net.Sockets.SocketAsyncEventArgs> Completed // Size: 0x8 // Offset: 0x38 ::System::EventHandler_1<::System::Net::Sockets::SocketAsyncEventArgs*>* Completed; // Field size check static_assert(sizeof(::System::EventHandler_1<::System::Net::Sockets::SocketAsyncEventArgs*>*) == 0x8); public: // Creating interface conversion operator: operator ::System::IDisposable operator ::System::IDisposable() noexcept { return *reinterpret_cast<::System::IDisposable*>(this); } // Get instance field reference: private System.Boolean disposed [[deprecated("Use field access instead!")]] bool& dyn_disposed(); // Get instance field reference: System.Int32 in_progress [[deprecated("Use field access instead!")]] int& dyn_in_progress(); // Get instance field reference: System.Net.EndPoint remote_ep [[deprecated("Use field access instead!")]] ::System::Net::EndPoint*& dyn_remote_ep(); // Get instance field reference: System.Net.Sockets.Socket current_socket [[deprecated("Use field access instead!")]] ::System::Net::Sockets::Socket*& dyn_current_socket(); // Get instance field reference: private System.Net.Sockets.Socket <AcceptSocket>k__BackingField [[deprecated("Use field access instead!")]] ::System::Net::Sockets::Socket*& dyn_$AcceptSocket$k__BackingField(); // Get instance field reference: private System.Int32 <BytesTransferred>k__BackingField [[deprecated("Use field access instead!")]] int& dyn_$BytesTransferred$k__BackingField(); // Get instance field reference: private System.Net.Sockets.SocketError <SocketError>k__BackingField [[deprecated("Use field access instead!")]] ::System::Net::Sockets::SocketError& dyn_$SocketError$k__BackingField(); // Get instance field reference: private System.EventHandler`1<System.Net.Sockets.SocketAsyncEventArgs> Completed [[deprecated("Use field access instead!")]] ::System::EventHandler_1<::System::Net::Sockets::SocketAsyncEventArgs*>*& dyn_Completed(); // public System.Net.Sockets.Socket get_AcceptSocket() // Offset: 0xDA4D8C ::System::Net::Sockets::Socket* get_AcceptSocket(); // public System.Void set_AcceptSocket(System.Net.Sockets.Socket value) // Offset: 0xDA4D94 void set_AcceptSocket(::System::Net::Sockets::Socket* value); // System.Void set_BytesTransferred(System.Int32 value) // Offset: 0xDA4D9C void set_BytesTransferred(int value); // public System.Void set_SocketError(System.Net.Sockets.SocketError value) // Offset: 0xDA4DA4 void set_SocketError(::System::Net::Sockets::SocketError value); // private System.Void Dispose(System.Boolean disposing) // Offset: 0xDA4DAC void Dispose(bool disposing); // public System.Void Dispose() // Offset: 0xDA4DC0 void Dispose(); // System.Void Complete() // Offset: 0xDA4E30 void Complete(); // protected System.Void OnCompleted(System.Net.Sockets.SocketAsyncEventArgs e) // Offset: 0xDA4E40 void OnCompleted(::System::Net::Sockets::SocketAsyncEventArgs* e); }; // System.Net.Sockets.SocketAsyncEventArgs #pragma pack(pop) static check_size<sizeof(SocketAsyncEventArgs), 56 + sizeof(::System::EventHandler_1<::System::Net::Sockets::SocketAsyncEventArgs*>*)> __System_Net_Sockets_SocketAsyncEventArgsSizeCheck; static_assert(sizeof(SocketAsyncEventArgs) == 0x40); } #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::get_AcceptSocket // Il2CppName: get_AcceptSocket template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Net::Sockets::Socket* (System::Net::Sockets::SocketAsyncEventArgs::*)()>(&System::Net::Sockets::SocketAsyncEventArgs::get_AcceptSocket)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "get_AcceptSocket", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::set_AcceptSocket // Il2CppName: set_AcceptSocket template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)(::System::Net::Sockets::Socket*)>(&System::Net::Sockets::SocketAsyncEventArgs::set_AcceptSocket)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("System.Net.Sockets", "Socket")->byval_arg; return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "set_AcceptSocket", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::set_BytesTransferred // Il2CppName: set_BytesTransferred template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)(int)>(&System::Net::Sockets::SocketAsyncEventArgs::set_BytesTransferred)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("System", "Int32")->byval_arg; return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "set_BytesTransferred", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::set_SocketError // Il2CppName: set_SocketError template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)(::System::Net::Sockets::SocketError)>(&System::Net::Sockets::SocketAsyncEventArgs::set_SocketError)> { static const MethodInfo* get() { static auto* value = &::il2cpp_utils::GetClassFromName("System.Net.Sockets", "SocketError")->byval_arg; return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "set_SocketError", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::Dispose // Il2CppName: Dispose template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)(bool)>(&System::Net::Sockets::SocketAsyncEventArgs::Dispose)> { static const MethodInfo* get() { static auto* disposing = &::il2cpp_utils::GetClassFromName("System", "Boolean")->byval_arg; return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "Dispose", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{disposing}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::Dispose // Il2CppName: Dispose template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)()>(&System::Net::Sockets::SocketAsyncEventArgs::Dispose)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "Dispose", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::Complete // Il2CppName: Complete template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)()>(&System::Net::Sockets::SocketAsyncEventArgs::Complete)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "Complete", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: System::Net::Sockets::SocketAsyncEventArgs::OnCompleted // Il2CppName: OnCompleted template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::SocketAsyncEventArgs::*)(::System::Net::Sockets::SocketAsyncEventArgs*)>(&System::Net::Sockets::SocketAsyncEventArgs::OnCompleted)> { static const MethodInfo* get() { static auto* e = &::il2cpp_utils::GetClassFromName("System.Net.Sockets", "SocketAsyncEventArgs")->byval_arg; return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::SocketAsyncEventArgs*), "OnCompleted", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{e}); } };
53.372727
230
0.731051
v0idp
48be668bf42d66b9ef382c4d5ff35d4fc171400c
3,987
cxx
C++
Libs/Widgets/GUI/Midas3TreeItem.cxx
midasplatform/MidasClient
728d4a5969691b54b7d0efd2dbad5a4df85d1a0e
[ "Apache-2.0" ]
null
null
null
Libs/Widgets/GUI/Midas3TreeItem.cxx
midasplatform/MidasClient
728d4a5969691b54b7d0efd2dbad5a4df85d1a0e
[ "Apache-2.0" ]
null
null
null
Libs/Widgets/GUI/Midas3TreeItem.cxx
midasplatform/MidasClient
728d4a5969691b54b7d0efd2dbad5a4df85d1a0e
[ "Apache-2.0" ]
null
null
null
/****************************************************************************** * Copyright 2011 Kitware Inc. * * 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 "Midas3TreeItem.h" #include "Midas3FolderTreeItem.h" #include <QStringList> #include <QPixmap> #include <QStyle> #include <QTime> Midas3TreeItem::Midas3TreeItem(const QList<QVariant> & itemData, Midas3TreeModel* model, Midas3TreeItem *parent) : m_DecorationRole(Collapsed), m_Model(model), m_ItemData(itemData), m_ParentItem(parent), m_Lifespan(600) { m_Timestamp = QTime::currentTime().second(); m_FetchedChildren = true; m_DynamicFetch = false; m_ClientResource = false; } Midas3TreeItem::~Midas3TreeItem() { qDeleteAll(m_ChildItems); } void Midas3TreeItem::SetDynamicFetch(bool value) { m_DynamicFetch = value; } bool Midas3TreeItem::IsDynamicFetch() const { return m_DynamicFetch; } bool Midas3TreeItem::operator==(const Midas3TreeItem* other) const { return this->GetId() == other->GetId(); } bool Midas3TreeItem::IsValid() const { uint current = QTime::currentTime().second(); return m_Timestamp + m_Lifespan > current; } void Midas3TreeItem::AppendChild(Midas3TreeItem* item) { m_ChildItems.append(item); } void Midas3TreeItem::RemoveChild(Midas3TreeItem *item) { m_ChildItems.removeAt(m_ChildItems.indexOf(item) ); } void Midas3TreeItem::RemoveAllChildren() { Midas3TreeItem* midasTreeItem = NULL; foreach(midasTreeItem, m_ChildItems) { this->RemoveChild(midasTreeItem); } } Midas3TreeItem * Midas3TreeItem::GetChild(int row) { return m_ChildItems.value(row); } void Midas3TreeItem::SetFetchedChildren(bool value) { m_FetchedChildren = value; } bool Midas3TreeItem::IsFetchedChildren() const { return m_FetchedChildren; } int Midas3TreeItem::ChildCount() const { return m_ChildItems.count(); } int Midas3TreeItem::ColumnCount() const { return m_ItemData.count(); } void Midas3TreeItem::SetData(const QVariant& value, int column) { m_ItemData.replace(column, value); } QVariant Midas3TreeItem::GetData(int column) const { return m_ItemData.value(column); } Midas3TreeItem * Midas3TreeItem::GetParent() { return m_ParentItem; } const Midas3TreeItem * Midas3TreeItem::GetParent() const { return m_ParentItem; } int Midas3TreeItem::GetRow() const { if( m_ParentItem ) { return m_ParentItem->m_ChildItems.indexOf( const_cast<Midas3TreeItem *>(this) ); } return m_TopLevelFolders->indexOf( reinterpret_cast<Midas3FolderTreeItem *>( const_cast<Midas3TreeItem *>(this) ) ); } QPixmap Midas3TreeItem::GetDecoration() { std::string role = ":icons/gpl_folder"; if( m_DecorationRole & Expanded ) { role += "_open"; } if( m_DecorationRole & Dirty ) { role += "_red"; } role += ".png"; return QPixmap(role.c_str() ); } void Midas3TreeItem::SetDecorationRole(DecorationRoles role) { if( m_DecorationRole & Dirty ) { m_DecorationRole = role | Dirty; } else { m_DecorationRole = role; } } void Midas3TreeItem::SetTopLevelFolders(QList<Midas3FolderTreeItem *>* tlf) { m_TopLevelFolders = tlf; } bool Midas3TreeItem::IsClientResource() const { return m_ClientResource; } void Midas3TreeItem::SetClientResource(bool val) { m_ClientResource = val; } QList<Midas3TreeItem *> Midas3TreeItem::GetChildren() { return m_ChildItems; }
21.551351
112
0.697015
midasplatform
48c3a3f6b1c6d0fb91a74dfa160fc704122fc601
2,636
cpp
C++
src/eventdispatcherfactory.cpp
helloer/polybobin
63b2cea40d3afcfc9d6f62f49acbfacf6a8783e1
[ "MIT" ]
8
2016-10-06T11:49:14.000Z
2021-11-06T21:06:36.000Z
src/eventdispatcherfactory.cpp
helloer/polybobin
63b2cea40d3afcfc9d6f62f49acbfacf6a8783e1
[ "MIT" ]
20
2017-04-25T14:23:02.000Z
2018-12-04T22:46:04.000Z
src/eventdispatcherfactory.cpp
helloer/polybobin
63b2cea40d3afcfc9d6f62f49acbfacf6a8783e1
[ "MIT" ]
4
2018-07-04T00:14:41.000Z
2018-07-17T09:08:25.000Z
#include "eventdispatcherfactory.hpp" #include "tools/transformtool.hpp" #include "tools/polygontool.hpp" #include "tools/vertexselectiontool.hpp" #include "tools/selectiontool.hpp" #include "tools/scenerytool.hpp" #include "tools/spawnpointtool.hpp" #include "tools/colortool.hpp" #include "tools/vertexcolortool.hpp" #include "tools/texturetool.hpp" #include "tools/waypointtool.hpp" #include "tools/colorpickertool.hpp" #include "tools/sketchtool.hpp" #include "tools/lightstool.hpp" #include "tools/depthtool.hpp" #include "mainframe.hpp" std::unique_ptr<EventDispatcher> CreateEventDispatcher(GLCanvas& canvas, MainFrame& mainFrame, SelectionManager& selectionManager) { ToolSet toolSet; toolSet.emplace_back(std::make_unique<TransformTool>(selectionManager, canvas)); toolSet.emplace_back(std::make_unique<PolygonTool>(canvas, mainFrame.GetPaletteFrame())); toolSet.emplace_back(std::make_unique<VertexSelectionTool>(selectionManager, canvas)); toolSet.emplace_back(std::make_unique<SelectionTool>(selectionManager, canvas)); toolSet.emplace_back(std::make_unique<VertexColorTool>()); toolSet.emplace_back(std::make_unique<ColorTool>(canvas, selectionManager, mainFrame.GetPaletteFrame())); toolSet.emplace_back(std::make_unique<TextureTool>(selectionManager, canvas)); toolSet.emplace_back(std::make_unique<SceneryTool>(canvas, mainFrame.GetSettings(), mainFrame.GetSceneryFrame(), mainFrame.GetPaletteFrame())); toolSet.emplace_back(std::make_unique<WaypointTool>()); toolSet.emplace_back(std::make_unique<SpawnPointTool>(canvas)); toolSet.emplace_back(std::make_unique<ColorPickerTool>(canvas, selectionManager, mainFrame.GetPaletteFrame())); toolSet.emplace_back(std::make_unique<SketchTool>()); // TODO: useless tool, it will be deleted toolSet.emplace_back(std::make_unique<LightsTool>()); // TODO: useless tool, it will be deleted toolSet.emplace_back(std::make_unique<DepthTool>()); // TODO: useless tool, it will be deleted std::unique_ptr<EventDispatcher> dispatcher = std::make_unique<EventDispatcher>(std::move(toolSet), canvas); canvas.Bind(wxEVT_LEFT_DOWN, &EventDispatcher::OnCanvasLeftMouseButtonClick, dispatcher.get()); canvas.Bind(wxEVT_LEFT_UP, &EventDispatcher::OnCanvasLeftMouseButtonRelease, dispatcher.get()); canvas.Bind(wxEVT_RIGHT_UP, &EventDispatcher::OnCanvasRightMouseButtonRelease, dispatcher.get()); canvas.Bind(wxEVT_MOTION, &EventDispatcher::OnCanvasMouseMotion, dispatcher.get()); canvas.Bind(wxEVT_CHAR_HOOK, &EventDispatcher::OnCanvasKeyPress, dispatcher.get()); return dispatcher; }
57.304348
130
0.781487
helloer
48c415348b3462388f27d0fee18bf2831d482a82
74
cpp
C++
docs/mfc/reference/codesnippet/CPP/cmousemanager-class_1.cpp
jmittert/cpp-docs
cea5a8ee2b4764b2bac4afe5d386362ffd64e55a
[ "CC-BY-4.0", "MIT" ]
14
2018-01-28T18:10:55.000Z
2021-11-16T13:21:18.000Z
docs/mfc/reference/codesnippet/CPP/cmousemanager-class_1.cpp
jmittert/cpp-docs
cea5a8ee2b4764b2bac4afe5d386362ffd64e55a
[ "CC-BY-4.0", "MIT" ]
null
null
null
docs/mfc/reference/codesnippet/CPP/cmousemanager-class_1.cpp
jmittert/cpp-docs
cea5a8ee2b4764b2bac4afe5d386362ffd64e55a
[ "CC-BY-4.0", "MIT" ]
2
2018-11-01T12:33:08.000Z
2021-11-16T13:21:19.000Z
GetMouseManager()->AddView (IDR_MAINFRAME, _T("My view"), IDR_MAINFRAME);
74
74
0.756757
jmittert
48c8840dde5d20f5cad61d340de106f559557877
683
hpp
C++
etcd/v3/AsyncLeaseRevokeAction.hpp
emusgrave/etcd-cpp-apiv3
8b2d044aeab0a124cc57ac7a7ce3a28aeb4099f9
[ "BSD-3-Clause" ]
null
null
null
etcd/v3/AsyncLeaseRevokeAction.hpp
emusgrave/etcd-cpp-apiv3
8b2d044aeab0a124cc57ac7a7ce3a28aeb4099f9
[ "BSD-3-Clause" ]
null
null
null
etcd/v3/AsyncLeaseRevokeAction.hpp
emusgrave/etcd-cpp-apiv3
8b2d044aeab0a124cc57ac7a7ce3a28aeb4099f9
[ "BSD-3-Clause" ]
null
null
null
#ifndef __ASYNC_LEASEREVOKEACTION_HPP__ #define __ASYNC_LEASEREVOKEACTION_HPP__ #include <grpc++/grpc++.h> #include "etcd/v3/Action.hpp" #include "etcd/v3/AsyncLeaseRevokeResponse.hpp" #include "proto/rpc.grpc.pb.h" using etcdserverpb::LeaseRevokeRequest; using etcdserverpb::LeaseRevokeResponse; using grpc::ClientAsyncResponseReader; namespace etcdv3 { class AsyncLeaseRevokeAction : public etcdv3::Action { public: AsyncLeaseRevokeAction(etcdv3::ActionParameters param); AsyncLeaseRevokeResponse ParseResponse(); private: LeaseRevokeResponse reply; std::unique_ptr<ClientAsyncResponseReader<LeaseRevokeResponse>> response_reader; }; } // namespace etcdv3 #endif
24.392857
82
0.811127
emusgrave
48ca685d3246f422053f03f6a3901311a5121027
1,858
hxx
C++
externals/src/moderngpu/kernel_join.hxx
aka-chris/mini
608751ff11f74e1ee59222399cbf6c9ee92208fb
[ "Apache-2.0" ]
216
2021-07-21T02:24:54.000Z
2021-07-30T03:33:10.000Z
externals/src/moderngpu/kernel_join.hxx
aka-chris/mini
608751ff11f74e1ee59222399cbf6c9ee92208fb
[ "Apache-2.0" ]
null
null
null
externals/src/moderngpu/kernel_join.hxx
aka-chris/mini
608751ff11f74e1ee59222399cbf6c9ee92208fb
[ "Apache-2.0" ]
94
2021-07-21T02:24:56.000Z
2021-07-24T23:50:38.000Z
// moderngpu copyright (c) 2016, Sean Baxter http://www.moderngpu.com #pragma once #include "kernel_sortedsearch.hxx" #include "kernel_scan.hxx" #include "kernel_load_balance.hxx" BEGIN_MGPU_NAMESPACE template<typename launch_arg_t = empty_t, typename a_it, typename b_it, typename comp_t> mem_t<int2> inner_join(a_it a, int a_count, b_it b, int b_count, comp_t comp, context_t& context) { // Compute lower and upper bounds of a into b. mem_t<int> lower(a_count, context); mem_t<int> upper(a_count, context); sorted_search<bounds_lower, launch_arg_t>(a, a_count, b, b_count, lower.data(), comp, context); sorted_search<bounds_upper, launch_arg_t>(a, a_count, b, b_count, upper.data(), comp, context); // Compute output ranges by scanning upper - lower. Retrieve the reduction // of the scan, which specifies the size of the output array to allocate. mem_t<int> scanned_sizes(a_count, context); const int* lower_data = lower.data(); const int* upper_data = upper.data(); mem_t<int> count(1, context); transform_scan<int>([=]MGPU_DEVICE(int index) { return upper_data[index] - lower_data[index]; }, a_count, scanned_sizes.data(), plus_t<int>(), count.data(), context); // Allocate an int2 output array and use load-balancing search to compute // the join. int join_count = from_mem(count)[0]; mem_t<int2> output(join_count, context); int2* output_data = output.data(); // Use load-balancing search on the segmens. The output is a pair with // a_index = seg and b_index = lower_data[seg] + rank. auto k = [=]MGPU_DEVICE(int index, int seg, int rank, tuple<int> lower) { output_data[index] = make_int2(seg, get<0>(lower) + rank); }; transform_lbs<launch_arg_t>(k, join_count, scanned_sizes.data(), a_count, make_tuple(lower_data), context); return output; } END_MGPU_NAMESPACE
36.431373
76
0.720129
aka-chris
48cde15a149a9473cf5d0403fdbcbbecd638e8a4
1,968
cpp
C++
examples/google-code-jam/IguanaBen/b.cpp
rbenic-fer/progauthfp
d0fd96c31ab0aab1a9acdcb7c75f2b430f51c675
[ "MIT" ]
null
null
null
examples/google-code-jam/IguanaBen/b.cpp
rbenic-fer/progauthfp
d0fd96c31ab0aab1a9acdcb7c75f2b430f51c675
[ "MIT" ]
null
null
null
examples/google-code-jam/IguanaBen/b.cpp
rbenic-fer/progauthfp
d0fd96c31ab0aab1a9acdcb7c75f2b430f51c675
[ "MIT" ]
null
null
null
#include <iostream> #include <map> #include <vector> #include <algorithm> #include <queue> #include <string.h> #include <set> #define ll long long using namespace std; // LOOOOOOOOOOOL solve_br doesnt even works, but im leaving it string flip(string s, int b){ string res = s; for(int i=0; i<=b; ++i) if(res[i] == '+') res[i] = '-'; else res[i] = '+'; for(int i=0; i<=b-i; ++i) { char c = res[i]; res[i] = res[b-i]; res[b-i] = c; } return res; } map<string, int> dp; int solve_br(string str){ if(dp.find(str) != dp.end()){ return dp[str]; } int x = 0; for(int i=0; i<str.length(); ++i) if(str[i] == '-') x++; if(!x){ dp[str] = 0; return 0; } int mn = 1000000; dp[str] = mn; for(int i=0; i<str.size(); ++i){ string s = flip(str, i); mn = min(solve_br(s) + 1, mn); } dp[str] = mn; return mn; } int solve_non_br(string str){ int cnt = 0; // -+- // "+-+-+++++----" for(int i=0; i<str.length()-1; ++i){ if(str[i] == '+' && str[i+1] == '-'){ cnt++; } } // if(str[str.length()-1] == '-') // cnt++; if(str[0] == '+'){ return 2*cnt; } else { return 2*cnt + 1; } } string gen_str(int seed){ string res; while(seed){ if(seed % 2) res += "+"; else res += "-"; seed /= 2; } return res; } void solve(int t) { string str; cin>>str; // for(int i=1; i<40; ++i){ // string str = gen_str(i); // dp.clear(); cout<<"Case #"<<t<<": "<<solve_non_br(str)<<"\n"; // cout<<"Case #"<<t<<": "<<str<<" "<<solve_br(str)<<" "<<solve_non_br(str)<<" "<<solve_non_br(str)-solve_br(str)<<"\n"; // cout<<"Case #"<<t<<": "<<str<<" "<<solve_br(str)<<" "<<solve_non_br(str)<<" "<<solve_non_br(str)-solve_br(str)<<"\n"; // } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int T; cin>>T; int t = 1; while(T--) solve(t++); return 0; }
15.870968
123
0.481707
rbenic-fer
48cf3ad0d25a20489cd8ac672fc1af63014e0be0
24
cpp
C++
chapter-12/12.30.cpp
zero4drift/Cpp-Primer-5th-Exercises
d3d0f0d228e8c2c5a3b3fe1fd03ce34e0894e93f
[ "MIT" ]
null
null
null
chapter-12/12.30.cpp
zero4drift/Cpp-Primer-5th-Exercises
d3d0f0d228e8c2c5a3b3fe1fd03ce34e0894e93f
[ "MIT" ]
null
null
null
chapter-12/12.30.cpp
zero4drift/Cpp-Primer-5th-Exercises
d3d0f0d228e8c2c5a3b3fe1fd03ce34e0894e93f
[ "MIT" ]
null
null
null
// See TextQuery-1230.h
12
23
0.708333
zero4drift
48d01137e070d7e962a5e9b911d71e8cd6a7a4fb
1,348
cpp
C++
Codeforces/div3/656/D_a_Good_String.cpp
vkashkumar/Competitive-Programming
c457e745208c0ca3e45b1ffce254a21504533f51
[ "MIT" ]
2
2019-01-30T12:45:18.000Z
2021-05-06T19:02:51.000Z
Codeforces/div3/656/D_a_Good_String.cpp
vkashkumar/Competitive-Programming
c457e745208c0ca3e45b1ffce254a21504533f51
[ "MIT" ]
null
null
null
Codeforces/div3/656/D_a_Good_String.cpp
vkashkumar/Competitive-Programming
c457e745208c0ca3e45b1ffce254a21504533f51
[ "MIT" ]
3
2020-10-02T15:42:04.000Z
2022-03-27T15:14:16.000Z
#include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false);cin.tie(0) #define pb push_back #define digit(x) floor(log10(x))+1 #define mod 1000000007 #define endl "\n" #define int long long #define matrix vector<vector<int> > #define vi vector<int> #define pii pair<int,int> #define vs vector<string> #define vp vector<pii> #define test() int t;cin>>t;while(t--) #define all(x) x.begin(),x.end() #define debug(x) cerr << #x << " is " << x << endl; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; const int sz = 100005; void showArr(int *arr, int n){for(int i=0;i<n;i++) cout<<arr[i]<<" ";} //=================================================================// int cnt(int st, int end, string &s, char ch) { int res = 0; for(int i=st;i<=end;i++) { if(s[i]!=ch) res++; } return res; } int solve(string &s, char ch, int sz, int st, int end) { if(sz==0) { if(s[st]==ch) return 0; return 1; } int op1 = cnt(st, (end+st)/2, s, ch) + solve(s, ch+1, sz/2, (end+st)/2+1, end); int op2 = cnt((end+st)/2 + 1, end, s, ch) + solve(s, ch+1, sz/2, st, (end+st)/2); return min(op1, op2); } int32_t main(){ fast; test() { int n; cin>>n; string s; cin>>s; cout<<solve(s, 'a', n/2, 0, n-1)<<endl; } return 0; }
25.433962
85
0.518546
vkashkumar
48d1372573dd3033fa8d22e7c9adace9f9dda178
1,097
cc
C++
src/base/logger.cc
Kledsky/s3fuse
2f2670f16a926ed128ca7bd326e27f43da673d61
[ "Apache-2.0" ]
2
2016-05-26T14:58:48.000Z
2016-10-05T18:46:23.000Z
src/base/logger.cc
Kledsky/s3fuse
2f2670f16a926ed128ca7bd326e27f43da673d61
[ "Apache-2.0" ]
5
2016-03-08T05:06:12.000Z
2017-11-13T07:30:55.000Z
src/base/logger.cc
Kledsky/s3fuse
2f2670f16a926ed128ca7bd326e27f43da673d61
[ "Apache-2.0" ]
2
2018-04-02T09:09:20.000Z
2022-01-20T11:55:29.000Z
/* * base/logger.cc * ------------------------------------------------------------------------- * Definitions for s3::base::logger static members and init() method. * ------------------------------------------------------------------------- * * Copyright (c) 2012, Tarick Bedeir. * * 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 <limits.h> #include "logger.h" using s3::base::logger; // log all messages unless instructed otherwise int logger::s_max_level = INT_MAX; void logger::init(int max_level) { s_max_level = max_level; openlog(PACKAGE_NAME, 0, 0); }
29.648649
76
0.623519
Kledsky
48d54b120e97218908b45051c84109c4e7e565fb
11,765
cpp
C++
Win32/Loading PCX Files/bitmap_class.cpp
Allenjonesing/tutorials
c729fdd655130b021ec7ca9b619e147ae636cfa5
[ "MIT" ]
367
2015-01-12T22:43:04.000Z
2022-03-31T02:03:27.000Z
Win32/Loading PCX Files/bitmap_class.cpp
uag515/tutorials
c729fdd655130b021ec7ca9b619e147ae636cfa5
[ "MIT" ]
3
2016-04-17T06:02:01.000Z
2019-01-20T16:07:53.000Z
Win32/Loading PCX Files/bitmap_class.cpp
uag515/tutorials
c729fdd655130b021ec7ca9b619e147ae636cfa5
[ "MIT" ]
212
2015-01-14T14:13:34.000Z
2022-03-04T01:08:41.000Z
// In Visual Studio 2005 Microsoft added safer versions (denoted by a "_s" suffix) to many // common C/C++ run time functions. Currently the ISO Standards Committee for C and C++ // is determining if they are going to add them to the official language set. Until then, // this define will remove warnings about using the "unsafe" versions of these functions. #define _CRT_SECURE_NO_DEPRECATE #include <assert.h> #include "bitmap_class.h" // Some helpful defines for loading #define PCX_HEADER_SIZE 128 // The size in bytes of a .pcx header file #define PCX_PALETTE_TEST 769 // This is the offset from the bottom of a .pcx file // that (in a version 5 PCX file only) will be set to '12' // if the .pcx file has a palette associated with it // Before you can load any file, it's important to know how it's laid out. Below // is a struct that defines how a PCX header is constructed struct SPCXHeader { char manufacturer; // Always 10 -- char version; // version information // 0 = Ver2.5, 2 = Ver2.8 with palette, 3 = Ver2.8 without palette, // 4 = PC Paintbrush for Windows, 5 = Ver 3.0 char encoding; // 1 = Run Length encoding char bitsPerPixel; // Number of bits that represent a pixel short xMin, yMin, xMax, yMax; // Image Dimensions short horDPI; // Horizontal Resolution of pixels in dots per inch short verDPI; // Vertical Resolution of pixels in dots per inch char colormap[48]; // Color palette setting char reserved; // Should be set to zero char planes; // Number of color planes short bytesPerLine; // Number of bytes to allocate per scanline // Must be an even number short paletteInfo; // How to interpret the palette short horScreenSize; // Horizontal screen size in pixels short verScreenSize; // Vertical screen size in pixels char filler[54]; // An additional 54 bytes that must be set to 0 -- // Total size of a .pcx header must be 128 bytes }; // Loads a PCX file bool CBitmap::loadPCX(const char *fileName) { FILE *filePtr = fopen(fileName,"rb"); // Open the file BYTE *scanLine = NULL; // A pointer to contain a row of pixel data in the PCX SPCXHeader header = {0}; // Create a zeroed out SPCXHeader // We want to do robust error checking so we'll wrap the loading code in a // try...catch block so we can deal with errors in only place try { // Error Check if(!filePtr) throw "Couldn't open .pcx file"; // Read in the .pcx file header if(!fread(&header,sizeof(SPCXHeader),1,filePtr)) throw "Couldn't read .pcx header"; // Error Check -- manufacturer better equal 10 otherwise this // for sure isn't a .pcx file if((int)header.manufacturer != 10) throw "Not a valid .pcx file"; // Okay we have the header. Let's determine the width, height, and number of channels // that are in the .pcx file. Notice the +1 for width and height int width = header.xMax - header.xMin + 1; int height = header.yMax - header.yMin + 1; int channels = header.planes; // Okay let's set the size of our CBitmap if(!setSize(width,height,channels)) throw "Couldn't create bitmap for loading .pcx into"; // Now we need to test to see if there is a palette // If the header version equals 5, there is a chance that there is a palette if((int)header.version == 5) { // Since it's a version 5 .pcx it's possible that it has a palette so // now we must test further BYTE test_byte; // byte to check to see if it's a 8-bit .pcx file // Seek to where the test byte is if(fseek(filePtr,-PCX_PALETTE_TEST,SEEK_END)) throw "PCX file is corrupt"; // Read in the test byte if(!fread(&test_byte,sizeof(BYTE),1,filePtr)) throw "PCX file is corrupt"; // Check the test byte -- If it EQUALS '12' we have a palette to read in if(test_byte == 12) { // Load the palette if(!loadPCXPalette(filePtr)) throw "Couldn't load palette"; } } // Next seek past the SPCXHeader if(fseek(filePtr,PCX_HEADER_SIZE,SEEK_SET)) throw "PCX file is corrupt"; // The total number of bytes in a scanline int totalBytes = (int)header.planes * header.bytesPerLine; // Allocate the scanline scanLine = new BYTE[totalBytes]; // Error Check if(scanLine == NULL) throw "Couldn't allocate memory"; // Now loop over the entire .pcx file -- We'll fill each "scanLine" and then // convert that scanLine to our CBitmap depending on what type of .pcx we're dealing with for(int lineCount = 0; lineCount < height; lineCount++) { if(!readScanLine(filePtr, scanLine, totalBytes)) throw "Error reading scanLine"; // If it's an 8-bit .pcx file, simply copy over the scanline if((int)header.planes == 1) memcpy(getLinePtr(lineCount),scanLine,getStride()); else // Converge "scanLine" into the same form as a CBitmap 24-bit scanline { uchar *pixels = getLinePtr(lineCount); // Loop through the entire line of pixels. for(int i = 0; i < width; ++i) { /* What does this mess do? Well lets break down what each part is doing. i * header.planes - This puts "pixels" at the current pixel + RED_BITMAP_OFFSET - Offset from the current pixel to the 'R' color component + GREEN_BITMAP_OFFSET - Offset from the current pixel to the 'G' color component + BLUE_BITMAP_OFFSET - Offset from the current pixel to the 'B' color component PCX stores the scanline as a sequence of 'R', then a sequence of 'G', then a sequence of 'B' so "i + header.bytesPerLine" moves to the sequence containing the 'G' components and "i + header.bytesPerLine * 2" moves to the sequence containing the 'B' components */ pixels[i * header.planes + RED_BITMAP_OFFSET] = scanLine[i]; pixels[i * header.planes + GREEN_BITMAP_OFFSET] = scanLine[i + header.bytesPerLine]; pixels[i * header.planes + BLUE_BITMAP_OFFSET] = scanLine[i + header.bytesPerLine * 2]; } } // end of if...else ((int)header.planes == 1) } // end of for(int lineCount = 0; lineCount < height; lineCount++) } catch (char *str) // If an error happened, catch it here and cleanup { MessageBox(NULL, str, "ERROR", MB_OK | MB_ICONERROR); if(filePtr) fclose(filePtr); if(scanLine) delete[] scanLine; return false; } delete[] scanLine; // Free mem fclose(filePtr); // Close the file return true; // PCX was successfully loaded } // Sizes the bitmap to the (width x height) and number of channels passed in // Returns true for success -- false otherwise bool CBitmap::setSize(int width, int height, int channels) { // If CBitmap has already been set -- clear it out first freeMem(); mWidth = width; mHeight = height; mChannels = channels; // Set stride mStride = mWidth * mChannels; while((mStride % 4) != 0) // Ensure mStride is dword aligned mStride++; // Create a DC that is compatible with the current monitor resolution mHDC = CreateCompatibleDC(NULL); // Error Check if(!mHDC) return false; BITMAPINFO bmp_info = {0}; // Initialize the parameters that we care about bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp_info.bmiHeader.biWidth = width; bmp_info.bmiHeader.biHeight = height; bmp_info.bmiHeader.biPlanes = 1; bmp_info.bmiHeader.biBitCount = channels * 8; bmp_info.bmiHeader.biCompression = BI_RGB; bmp_info.bmiHeader.biClrUsed = (mChannels == 1? 256:0); // If it's 8-bit set to 256 // Otherwise set to 0 // Create a DIBSection. Note that this returns us two // things - an HBITMAP handle and a memory pointer, in // mPixels. mBmp = CreateDIBSection(mHDC, &bmp_info, DIB_RGB_COLORS, (void**)&mPixels, 0, 0); // Error Check if(!mBmp) return false; // Select our DIBSection bitmap into our DC. // This allows us to draw to the bitmap using GDI functions. mOldBmp = (HBITMAP)SelectObject(mHDC,mBmp); // Error Check if (!mOldBmp) return false; return true; } // end of setSize(int width, int height, int channels) bool CBitmap::setPalette(int startColor, int numColors, RGBQUAD *colors) { // If the CBitmap is not an 8-bit bitmap, CAN NOT set palette if(mChannels != 1) return false; // Returns 0 on failure, number of entries set on success if(SetDIBColorTable(mHDC, startColor, numColors, colors)) return true; else return false; } // Returns the address in memory of the specified line. This gives you a pointer to at least // width * channels bytes. Lines are numbered such that when the bitmap // is displayed line zero is at the top. uchar* CBitmap::getLinePtr(int which_line) { // Windows stores bitmaps upside down so (mHeight - which_line - 1) // flips the bitmap over return (mPixels + mStride * (mHeight - which_line - 1)); } // Deconstructor CBitmap::~CBitmap() { freeMem(); } // *** Private Methods *** // // Release the memory void CBitmap::freeMem() { if(!mOldBmp) return; if(!SelectObject(mHDC,mOldBmp)) // get the old stuff back return; if(!DeleteObject(mBmp)) // delete the new stuff return; if(!DeleteDC(mHDC)) // release the device context return; // Zero out all data associated with CBitmap mOldBmp = mBmp = NULL; mHDC = NULL; mWidth = mHeight = mChannels = mStride = 0; mPixels = NULL; return; } // Loads the palette of the .pcx file // Returns true on success, false otherwise bool CBitmap::loadPCXPalette(FILE *filePtr) { assert(filePtr != NULL); // Safety check // PCX palettes all contain 256 entries const int kPaletteEntries = 256; RGBQUAD paletteInfo[kPaletteEntries] = {0}; // Our array of colors in the palette BYTE rgb[3] = {0}; // One byte for RED, GREEN, and BLUE in that order // Get all the values in the palette for(int i = 0; i < kPaletteEntries; ++i) { // Fill "rgb" with the corresponding bytes -- Checking for errors each read if(!fread(rgb,sizeof(rgb),1,filePtr)) return false; // Set the palette's color components paletteInfo[i].rgbRed = rgb[0]; paletteInfo[i].rgbGreen = rgb[1]; paletteInfo[i].rgbBlue = rgb[2]; } // Set the palette of the bitmap -- Returning error check return setPalette(0,kPaletteEntries,paletteInfo); } bool CBitmap::readScanLine(FILE *filePtr, BYTE *scanLine, int totalBytes) { BYTE byteVal = 0; // The value of a particular byte (ie a color component) BYTE byteCount = 0; // How many times this color is repeated BYTE temp = 0; // A temporary place holder to determine if a particular color is // repeated or not int scanLineCount = 0; // Number of bytes we've traversed from left to right in // a particular scanline // Loop till the end of the scanline is reached while(scanLineCount < totalBytes) { // Read in temp -- We'll use this to determine if the color needs to be // repeated if(!fread(&temp,sizeof(BYTE),1,filePtr)) return false; // *** NOTE *** /* The encoding method works like this: For each byte X read from the file, if the top two bits of X are 1's then count = 6 lowest bits of X data = next byte following X otherwise, count = 1 and data = X */ // If the top two bits are set if((temp & 0xC0) == 0xC0) { byteCount = temp & 0x3F; // bottom six bits are count of bytes to repeat // of the next byte read in // read the byte value for repetition, check for errors if(!fread(&byteVal,sizeof(BYTE),1,filePtr)) return false; } else // byte that was read in is only repeated once { byteCount = 1; byteVal = temp; } // Fill the current portion of the scanline for(int i = 0; i < byteCount; i++, scanLineCount++) scanLine[scanLineCount] = byteVal; } // end of while(scanLineCount < totalBytes) return true; // "scanLine" filled successfully }
30.960526
93
0.684148
Allenjonesing
48d7103e2b8f4f1848cca0c1534dd80c87347fd6
7,581
cpp
C++
class/controladores/configuracion_ejercicio.cpp
TheMarlboroMan/japavocards
df1d9922e2a087c6212c4c600796ec35f41432ca
[ "Beerware" ]
null
null
null
class/controladores/configuracion_ejercicio.cpp
TheMarlboroMan/japavocards
df1d9922e2a087c6212c4c600796ec35f41432ca
[ "Beerware" ]
null
null
null
class/controladores/configuracion_ejercicio.cpp
TheMarlboroMan/japavocards
df1d9922e2a087c6212c4c600796ec35f41432ca
[ "Beerware" ]
null
null
null
#include "configuracion_ejercicio.h" #include <functional> #include <video/gestores/gestor_texturas.h> #include "estados_controladores.h" #include "../app/framework_impl/input.h" #include "../app/localizacion.h" #include "../app/eventos/cambio_modo_etiqueta.h" #include "../app/eventos/cambio_direccion.h" #include "../app/eventos/cambio_palabras.h" #include "../app/eventos/cambio_limitar_palabras.h" #include "../app/recursos.h" using namespace App; Controlador_configuracion_ejercicio::Controlador_configuracion_ejercicio(DLibH::Log_base& l, const Fuentes& f, const Localizador& loc, const Configuracion_ejercicio& c) :log(l), fuentes(f), localizador(loc), configuracion_ejercicio(c), camara(), componente_menu(), estado_transicion(estados_transicion::activo), tiempo_menu(0.0f) { vista.mapear_textura("background", DLibV::Gestor_texturas::obtener(App::Recursos_graficos::RGT_BACKGROUND)); vista.mapear_fuente("akashi20", &fuentes.obtener_fuente("akashi", 20)); vista.mapear_fuente("kanas32", &fuentes.obtener_fuente("kanas", 32)); crear_menu_opciones(); } void Controlador_configuracion_ejercicio::preloop(DFramework::Input& input, float delta) { } void Controlador_configuracion_ejercicio::loop(DFramework::Input& input, float delta) { if(input.es_senal_salida()) { abandonar_aplicacion(); } else { switch(estado_transicion) { case estados_transicion::activo: input_activo(input, delta); break; case estados_transicion::entrada: if(worker_animacion.es_activo()) worker_animacion.turno(delta); else estado_transicion=estados_transicion::activo; break; case estados_transicion::salida: if(worker_animacion.es_activo()) worker_animacion.turno(delta); else solicitar_cambio_estado(menu); break; } } } void Controlador_configuracion_ejercicio::postloop(DFramework::Input& input, float delta) { } void Controlador_configuracion_ejercicio::dibujar(DLibV::Pantalla& pantalla) { vista.volcar(pantalla, camara); } void Controlador_configuracion_ejercicio::despertar() { try { log<<"Despertando controlador configuración ejercicio"<<std::endl; vista.registrar_externa("listado", componente_menu.rep()); vista.registrar_externa("selector", componente_menu.rep_selector()); vista.parsear("data/layout/configuracion_ejercicio.dnot", "layout"); configurar_camara_y_menu(vista, camara, componente_menu); generar_vista_menu(); estado_transicion=estados_transicion::entrada; transicion_entrada(vista, worker_animacion); static_cast<DLibV::Representacion_TTF *>(vista.obtener_por_id("txt_titulo"))->asignar(localizador.obtener(localizacion::menu_ejercicio)); } catch(std::exception& e) { std::string err="Error al despertar controlador config aplicación: "; err+=e.what(); throw std::runtime_error(err); } } void Controlador_configuracion_ejercicio::dormir() { log<<"Durmiendo controlador configuración ejercicio"<<std::endl; vista.vaciar_vista(); vista.vaciar_constantes(); componente_menu.desmontar(); } bool Controlador_configuracion_ejercicio::es_posible_abandonar_estado() const { return true; } void Controlador_configuracion_ejercicio::input_activo(DFramework::Input& input, float delta) { //std::function<bool(DFramework::Input&, unsigned int)> up=&DFramework::Input::es_input_up; auto hay_cambio=[&input](std::function<bool(DFramework::Input&, unsigned int)> f, int& dir) { bool resultado=f(input, App::Input::izquierda) || f(input, App::Input::derecha) || f(input, App::Input::aceptar); if(resultado) dir=f(input, App::Input::izquierda) ? -1 : 1; return resultado; }; int dir=0; if(input.es_input_down(App::Input::escape)) { estado_transicion=estados_transicion::salida; transicion_salida_horizontal(worker_animacion, camara, 600.f); } else if(input.es_input_down(App::Input::abajo) || input.es_input_down(App::Input::arriba)) { tiempo_menu=0.0f; componente_menu.cambiar_item(input.es_input_down(App::Input::arriba) ? -1 : 1); } else if(hay_cambio(&DFramework::Input::es_input_down, dir)) { menu_down(componente_menu.item_actual(), dir, delta, false); } else if(hay_cambio(&DFramework::Input::es_input_pulsado, dir)) { menu_down(componente_menu.item_actual(), dir, delta, true); } else if(hay_cambio(&DFramework::Input::es_input_up, dir)) { tiempo_menu=0.0f; } } void Controlador_configuracion_ejercicio::generar_vista_menu() { componente_menu.traducir_menu_opciones(localizador); auto f=[this](Herramientas_proyecto::Listado_vertical<item_config_ejercicio>& l, Herramientas_proyecto::Menu_opciones<std::string>& m, const std::vector<std::string>& v) { for(const auto& c : v) l.insertar({fuentes, c, m.nombre_opcion(c)+" : "+m.nombre_seleccion(c)}); }; componente_menu.montar(f); } void Controlador_configuracion_ejercicio::crear_menu_opciones() { componente_menu.crear_menu_opciones("data/config/valores.dnot", "config_ejercicio", localizador); componente_menu.menu().asignar_por_valor_templated<std::string>("01_K_DIRECCION", direccion_a_string(configuracion_ejercicio.acc_direccion())); componente_menu.menu().asignar_por_valor_templated<std::string>("02_K_MODO_ETIQUETAS", modo_etiquetas_a_string(configuracion_ejercicio.acc_modo_etiquetas())); componente_menu.menu().asignar_por_valor_templated<bool>("03_K_LIMITE_PALABRAS", configuracion_ejercicio.es_palabras_limitadas()); componente_menu.menu().asignar_por_valor_int("04_K_NUMERO_PALABRAS", configuracion_ejercicio.acc_palabras()); } void Controlador_configuracion_ejercicio::menu_down(item_config_ejercicio& item, int dir, float delta, bool pulsado) { const std::string& clave=item.clave; if(clave=="01_K_DIRECCION") { if(pulsado) return; auto direccion=configuracion_ejercicio.acc_direccion(); ciclar_direccion(direccion); auto ev=DFramework::uptr_evento(new Eventos::Evento_cambio_direccion(direccion)); enviar_evento(ev); componente_menu.menu().asignar_por_valor_templated<std::string>(clave, direccion_a_string(direccion)); } else if(clave=="02_K_MODO_ETIQUETAS") { if(pulsado) return; auto modo=configuracion_ejercicio.acc_modo_etiquetas(); ciclar_modo_etiquetas(modo, dir); auto ev=DFramework::uptr_evento(new Eventos::Evento_cambio_modo_etiqueta(modo)); enviar_evento(ev); componente_menu.menu().asignar_por_valor_templated<std::string>(clave, modo_etiquetas_a_string(modo)); } else if(clave=="03_K_LIMITE_PALABRAS") { if(pulsado) return; bool limitadas=!configuracion_ejercicio.es_palabras_limitadas(); auto ev=DFramework::uptr_evento(new Eventos::Evento_cambio_limitar_palabras(limitadas)); enviar_evento(ev); componente_menu.menu().asignar_por_valor_templated<bool>(clave, limitadas); } else if(clave=="04_K_NUMERO_PALABRAS") { if(pulsado && tiempo_menu < 0.5f) { tiempo_menu+=delta; return; } int palabras=configuracion_ejercicio.acc_palabras(); cambiar_cantidad_palabras(palabras, dir); auto ev=DFramework::uptr_evento(new Eventos::Evento_cambio_palabras(palabras)); enviar_evento(ev); componente_menu.menu().asignar_por_valor_int(clave, palabras); } item.texto=componente_menu.menu().nombre_opcion(clave)+" : "+componente_menu.menu().nombre_seleccion(clave); generar_vista_menu(); componente_menu.regenerar_listado(); } void Controlador_configuracion_ejercicio::item_config_ejercicio::generar_representacion_listado(DLibV::Representacion_agrupada& rep, int x, int y) const { auto * txt=new DLibV::Representacion_TTF(fuentes.obtener_fuente("akashi", 20), {255, 255, 255, 255}, texto); txt->establecer_posicion(x, y); rep.insertar_representacion(txt); }
33.544248
170
0.774436
TheMarlboroMan
48d751acd2ea53f86f0ae014e52c2e85160e9b95
77,393
cc
C++
src_py/src/python-BaseCurve.cc
MatteoRagni/Clothoids-1
b7fa270e65ba291a67ff3a3612810595fa436d0f
[ "BSD-2-Clause" ]
null
null
null
src_py/src/python-BaseCurve.cc
MatteoRagni/Clothoids-1
b7fa270e65ba291a67ff3a3612810595fa436d0f
[ "BSD-2-Clause" ]
null
null
null
src_py/src/python-BaseCurve.cc
MatteoRagni/Clothoids-1
b7fa270e65ba291a67ff3a3612810595fa436d0f
[ "BSD-2-Clause" ]
null
null
null
/** * PYTHON Wrapper for Clothoids * * License MIT - See LICENSE file * 2019 Matteo Ragni, Claudio Kerov Ghiglianovich, * Enrico Bertolazzi, Marco Frego */ #include "python-BaseCurve.hh" #include "pybind11/stl.h" namespace G2lib { namespace python { void wrap_BaseCurve(py::module & m) { py::enum_<CurveType>(m, "CurveType") .value("G2LIB_LINE", G2lib::CurveType::G2LIB_LINE) .value("G2LIB_POLYLINE", G2lib::CurveType::G2LIB_POLYLINE) .value("G2LIB_CIRCLE", G2lib::CurveType::G2LIB_CIRCLE) .value("G2LIB_BIARC", G2lib::CurveType::G2LIB_BIARC) .value("G2LIB_BIARC_LIST", G2lib::CurveType::G2LIB_BIARC_LIST) .value("G2LIB_CLOTHOID", G2lib::CurveType::G2LIB_CLOTHOID) .value("G2LIB_CLOTHOID_LIST", G2lib::CurveType::G2LIB_CLOTHOID_LIST) .export_values(); py::class_<BaseCurve, PythonicBaseCurve>(m, "BaseCurve", R"S( The base curve that rapresents the base for all the curves that are contained inside the library. The default constructor select the type from the CurveType enum. The class is a pure abstract class and cannot be directly instantiated by the user, but acts as a prototype. Several methods are defined in ISO or SAE standard. The difference is in the signs for the reference frame attached to the curve. * ISO: the positive normal direction is on the left, while the negative is on the right. This standard is used also in the undefined standard methods, where the offset is always considered to be 0. This standard follows the right-hand rule. * SAE: the positive normal direction is on the right while the negative is on the right. Select your methods accordinglu :param CurveType type: enum representing the type of the curve )S") .def(py::init<CurveType const &>(), py::arg("type")) .def("type", &BaseCurve::type, R"S( Returns the type of the curve :return: the type of the curve :rtype: CurveType )S") .def("length", &BaseCurve::length, R"S( Length of the current curve :return: length of the curve :rtype: float )S") .def("length_ISO", &BaseCurve::length_ISO, py::arg("offs"), R"S( Length of the current curve, with offset (ISO) :param float offs: curve offset :return: length with offset (ISO) :rtype: float )S") .def("length_SAE", &BaseCurve::length_SAE, py::arg("offs"), R"S( Length of the current curve, with offset (SAE) :param float offs: curve offset :return: length with offset (SAE) :rtype: float )S") .def("bbox", [](const BaseCurve & self) { real_type x_min, y_min, x_max, y_max; self.bbox(x_min, y_min, x_max, y_max); return std::make_tuple( std::make_tuple(x_min, y_min), std::make_tuple(x_max, y_max)); }, R"S( Compute the bounding box of the curve, as a tuple of tuples with minimum point and maximum point. :return: the extrema of the bounding box of the curve :rtype: Tuple[Tuple[float, float], Tuple[float, float]] )S") .def("bbox_ISO", [](const BaseCurve & self, real_type offs) { real_type x_min, y_min, x_max, y_max; self.bbox_ISO(offs, x_min, y_min, x_max, y_max); return std::make_tuple( std::make_tuple(x_min, y_min), std::make_tuple(x_max, y_max)); }, py::arg("offs"), R"S( Compute the bounding box of the curve, as a tuple of tuples with minimum point and maximum point. With ISO offset :param float offs: curve offset :return: the extrema of the bounding box of the curve, with ISO offset :rtype: Tuple[Tuple[float, float], Tuple[float, float]] )S") .def("bbox_SAE", [](const BaseCurve & self, real_type offs) { real_type x_min, y_min, x_max, y_max; self.bbox_SAE(offs, x_min, y_min, x_max, y_max); return std::make_tuple( std::make_tuple(x_min, y_min), std::make_tuple(x_max, y_max)); }, py::arg("offs"), R"S( Compute the bounding box of the curve, as a tuple of tuples with minimum point and maximum point. With ISO offset :param float offs: curve offset :return: the extrema of the bounding box of the curve, with ISO offset :rtype: Tuple[Tuple[float, float], Tuple[float, float]] )S") .def("bbTriangles", [](const BaseCurve & self, real_type max_angle, real_type max_size, int_type icurve) { std::vector<Triangle2D> tvec; self.bbTriangles(tvec, max_angle, max_size, icurve); return tvec; }, py::arg("max_angle") = Utils::m_pi/18, py::arg("max_size") = 1e100, py::arg("icurve") = 0, R"S( Build a cover with triangles of the curve. Returns a list of triangles. :param float max_angle: maximum angle variation of the curve covered by a triangle :param float max_size: maximum admissible size of the covering tirnagles :param int icurve: index of the covering triangles :return: list of covering triangles :rtype: List[Triangle2D] )S") .def("bbTriangles_ISO", [](const BaseCurve & self, real_type offs, real_type max_angle, real_type max_size, int_type icurve) { std::vector<Triangle2D> tvec; self.bbTriangles_ISO(offs, tvec, max_angle, max_size, icurve); return tvec; }, py::arg("offs"), py::arg("max_angle") = Utils::m_pi/18, py::arg("max_size") = 1e100, py::arg("icurve") = 0, R"S( Build a cover with triangles of the curve, using an ISO curve offset. Returns a list of triangles. :param float offs: curve offset :param float max_angle: maximum angle variation of the curve covered by a triangle :param float max_size: maximum admissible size of the covering tirnagles :param int icurve: index of the covering triangles :return: list of covering triangles :rtype: List[Triangle2D] )S") .def("bbTriangles_SAE", [](const BaseCurve & self, real_type offs, real_type max_angle, real_type max_size, int_type icurve) { std::vector<Triangle2D> tvec; self.bbTriangles_SAE(offs, tvec, max_angle, max_size, icurve); return tvec; }, py::arg("offs"), py::arg("max_angle") = Utils::m_pi/18, py::arg("max_size") = 1e100, py::arg("icurve") = 0, R"S( Build a cover with triangles of the curve, using a SAE curve offset. Returns a list of triangles. :param float offs: curve offset :param float max_angle: maximum angle variation of the curve covered by a triangle :param float max_size: maximum admissible size of the covering tirnagles :param int icurve: index of the covering triangles :return: list of covering triangles :rtype: List[Triangle2D] )S") .def("thetaBegin", &BaseCurve::theta_begin, R"S( Initial angle of the curve .. warning:: Deprecated for ``theta_begin`` :return: the initial angle of the curve :rtype: float )S") .def("theta_begin", &BaseCurve::theta_begin, R"S( Initial angle of the curve :return: the initial angle of the curve :rtype: float )S") .def("theta", &BaseCurve::theta, py::arg("s"), R"S( Angle of the curve at curvilinear value **s** :param float s: curvilinear abscissa :return: the angle of the curve at **s** :rtype: float )S") .def("theta", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.theta(s[i]); return ret; }, py::arg("s"), R"S( Angle of the curve at curvilinear value **s**. Vectorial Version. :param List[float] s: curvilinear abscissa :return: the angle of the curve at **s** :rtype: List[float] )S") .def("thetaEnd", &BaseCurve::theta_end, R"S( Final angle of the curve .. warning:: deprecated for ``theta_end`` :return: the final angle of the curve :rtype: float )S") .def("theta_end", &BaseCurve::theta_end, R"S( Final angle of the curve :return: the final angle of the curve :rtype: float )S") .def("kappaBegin", &BaseCurve::kappa_begin, R"S( Initial curvature of the curve .. warning:: deprecated for ``kappa_begin`` :return: the initial curvature of the curve :rtype: float )S") .def("kappa_begin", &BaseCurve::kappa_begin, R"S( Initial curvature of the curve :return: the initial curvature of the curve :rtype: float )S") .def("kappa", &BaseCurve::kappa, py::arg("s"), R"S( Curvature of the curve at curvilinear value **s** :param float s: curvilinear abscissa :return: the curvature angle of the curve :rtype: float )S") .def("kappa", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.kappa(s[i]); return ret; }, py::arg("s"), R"S( Curvature of the curve at curvilinear value **s**. Vectorial Version. :param List[float] s: curvilinear abscissa :return: the curvature of the curve at **s** :rtype: List[float] )S") .def("kappaEnd", &BaseCurve::kappa_end, R"S( Final curvature of the curve .. warning:: deprecated for ``kappa_end`` :return: the final curvature of the curve :rtype: float )S") .def("kappa_end", &BaseCurve::kappa_end, R"S( Final curvature of the curve :return: the final curvature of the curve :rtype: float )S") .def("xBegin", &BaseCurve::x_begin, R"S( Initial coordinate **x** of the curve .. warning:: deprecated for ``x_begin`` :return: the initial coordinate **x** of the curve :rtype: float )S") .def("x_begin", &BaseCurve::x_begin, R"S( Initial coordinate **x** of the curve :return: the initial coordinate **x** of the curve :rtype: float )S") .def("X", &BaseCurve::X, py::arg("s"), R"S( Coordinate **x** of the curve at curvilinear value **s** :param float s: curvilinear abscissa :return: coordinate **x** of the curve :rtype: float )S") .def("X", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.X(s[i]); return ret; }, py::arg("s"), R"S( Coordinate **x** of the curve at curvilinear value **s**. Vectorial Version. :param List[float] s: curvilinear abscissa :return: coordinate **x** of the curve :rtype: List[float] )S") .def("xEnd", &BaseCurve::x_end, R"S( Final coordinate **x** of the curve .. warning:: deprecated for ``x_end`` :return: the final coordinate **x** of the curve :rtype: float )S") .def("x_end", &BaseCurve::x_end, R"S( Final coordinate **x** of the curve :return: the final coordinate **x** of the curve :rtype: float )S") .def("yBegin", &BaseCurve::y_begin, R"S( Initial coordinate **y** of the curve .. warning:: deprecated for ``y_begin`` :return: the initial coordinate **y** of the curve :rtype: float )S") .def("y_begin", &BaseCurve::y_begin, R"S( Initial coordinate **y** of the curve :return: the initial coordinate **y** of the curve :rtype: float )S") .def("Y", &BaseCurve::Y, py::arg("s"), R"S( Coordinate **y** of the curve at curvilinear value **s** :param float s: curvilinear abscissa :return: coordinate **y** of the curve :rtype: float )S") .def("Y", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.Y(s[i]); return ret; }, py::arg("s"), R"S( Coordinate **y** of the curve at curvilinear value **s**. Vectorial Version. :param List[float] s: curvilinear abscissa :return: coordinate **y** of the curve :rtype: List[float] )S") .def("yEnd", &BaseCurve::y_end, R"S( Final coordinate **y** of the curve .. warning:: deprecated for ``y_end`` :return: the final coordinate **y** of the curve :rtype: float )S") .def("y_end", &BaseCurve::y_end, R"S( Final coordinate **y** of the curve :return: the final coordinate **y** of the curve :rtype: float )S") .def("xBegin_ISO", &BaseCurve::x_begin_ISO, py::arg("offs"), R"S( Initial coordinate **x** of the curve, with ISO offset .. warning:: Deprecated for ``x_begin_ISO`` :param float offs: curve ISO offset :return: the initial coordinate **x** of the curve :rtype: float )S") .def("x_begin_ISO", &BaseCurve::x_begin_ISO, py::arg("offs"), R"S( Initial coordinate **x** of the curve, with ISO offset :param float offs: curve ISO offset :return: the initial coordinate **x** of the curve :rtype: float )S") .def("X_ISO", &BaseCurve::X_ISO, py::arg("s"), py::arg("offs"), R"S( Coordinate **x** of the curve at curvilinear value **s** :param float s: curvilinear abscissa :param float offs: curve ISO offset :return: coordinate **x** of the curve :rtype: float )S") .def("X_ISO", [](const BaseCurve & self, std::vector<real_type> s, std::vector<real_type> offs) { const size_t n = std::min(s.size(), offs.size()); std::vector<real_type> x(n); for (size_t i = 0; i < n; i++) { x[i] = self.X_ISO(s[i], offs[i]); } return x; }, py::arg("s"), py::arg("offs"), R"S( Coordinate **x** of the curve at curvilinear value **s**. Vectorial version. :param List[float] s: curvilinear abscissa :param List[float] offs: curve ISO offset :return: coordinate **x** of the curve :rtype: List[float] )S") .def("xEnd_ISO", &BaseCurve::x_end_ISO, py::arg("offs"), R"S( Final coordinate **x** of the curve, with ISO offset .. warning:: deprecated for ``x_end_ISO`` :param float offs: curve ISO offset :return: the final coordinate **x** of the curve :rtype: float )S") .def("x_end_ISO", &BaseCurve::x_end_ISO, py::arg("offs"), R"S( Final coordinate **x** of the curve, with ISO offset :param float offs: curve ISO offset :return: the final coordinate **x** of the curve :rtype: float )S") .def("yBegin_ISO", &BaseCurve::y_begin_ISO, py::arg("offs"), R"S( Initial coordinate **y** of the curve, with ISO offset .. warning:: Deprecated for ``y_begin_iso`` :param float offs: curve ISO offset :return: the initial coordinate **y** of the curve :rtype: float )S") .def("y_begin_ISO", &BaseCurve::y_begin_ISO, py::arg("offs"), R"S( Initial coordinate **y** of the curve, with ISO offset :param float offs: curve ISO offset :return: the initial coordinate **y** of the curve :rtype: float )S") .def("Y_ISO", &BaseCurve::Y_ISO, py::arg("s"), py::arg("offs"), R"S( Coordinate **y** of the curve at curvilinear value **s**, with ISO offset :param s: curvilinear abscissa :param float offs: curve ISO offset :return: coordinate **y** of the curve :rtype: float )S") .def("Y_ISO", [](const BaseCurve & self, std::vector<real_type> s, std::vector<real_type> offs) { const size_t n = std::min(s.size(), offs.size()); std::vector<real_type> y(n); for (size_t i = 0; i < n; i++) { y[i] = self.Y_ISO(s[i], offs[i]); } return y; }, py::arg("s"), py::arg("offs"), R"S( Coordinate **y** of the curve at curvilinear value **s**. Vectorial version. :param List[float] s: curvilinear abscissa :param List[float] offs: curve ISO offset :return: coordinate **y** of the curve :rtype: List[float] )S") .def("yEnd_ISO", &BaseCurve::y_end_ISO, py::arg("offs"), R"S( Final coordinate **y** of the curve, with ISO offset .. warning:: deprecated for ``y_end_ISO`` :param float offs: curve ISO offset :return: the final coordinate **y** of the curve :rtype: float )S") .def("y_end_ISO", &BaseCurve::y_end_ISO, py::arg("offs"), R"S( Final coordinate **y** of the curve, with ISO offset :param float offs: curve ISO offset :return: the final coordinate **y** of the curve :rtype: float )S") .def("xBegin_SAE", &BaseCurve::x_begin_SAE, py::arg("offs"), R"S( Initial coordinate **x** of the curve, with SAE offset .. warning:: deprecated for ``x_begin_SAE`` :param float offs: curve SAE offset :return: the initial coordinate **x** of the curve :rtype: float )S") .def("x_begin_SAE", &BaseCurve::x_begin_SAE, py::arg("offs"), R"S( Initial coordinate **x** of the curve, with SAE offset :param float offs: curve SAE offset :return: the initial coordinate **x** of the curve :rtype: float )S") .def("X_SAE", &BaseCurve::X_SAE, py::arg("s"), py::arg("offs"), R"S( Coordinate **x** of the curve at curvilinear value **s** :param float s: curvilinear abscissa :param float offs: curve SAE offset :return: coordinate **x** of the curve :rtype: float )S") .def("xEnd_SAE", &BaseCurve::x_end_SAE, py::arg("offs"), R"S( Final coordinate **x** of the curve, with SAE offset .. warning:: deprecated for ``x_end_SAE`` :param float offs: curve SAE offset :return: the final coordinate **x** of the curve :rtype: float )S") .def("x_end_SAE", &BaseCurve::x_end_SAE, py::arg("offs"), R"S( Final coordinate **x** of the curve, with SAE offset :param float offs: curve SAE offset :return: the final coordinate **x** of the curve :rtype: float )S") .def("yBegin_SAE", &BaseCurve::y_begin_SAE, py::arg("offs"), R"S( Initial coordinate **y** of the curve, with SAE offset .. warning:: deprecated for ``y_begin_SAE`` :param float offs: curve SAE offset :return: the initial coordinate **y** of the curve :rtype: float )S") .def("y_begin_SAE", &BaseCurve::y_begin_SAE, py::arg("offs"), R"S( Initial coordinate **y** of the curve, with SAE offset :param float offs: curve SAE offset :return: the initial coordinate **y** of the curve :rtype: float )S") .def("Y_SAE", &BaseCurve::Y_SAE, py::arg("s"), py::arg("offs"), R"S( Coordinate **y** of the curve at curvilinear value **s**, with SAE offset :param s: curvilinear abscissa :param float offs: curve SAE offset :return: coordinate **y** of the curve :rtype: float )S") .def("yEnd_SAE", &BaseCurve::y_end_SAE, py::arg("offs"), R"S( Final coordinate **y** of the curve, with SAE offset .. warning:: deprecated for ``y_end_SAE`` :param float offs: curve SAE offset :return: the final coordinate **y** of the curve :rtype: float )S") .def("y_end_SAE", &BaseCurve::y_end_SAE, py::arg("offs"), R"S( Final coordinate **y** of the curve, with SAE offset :param float offs: curve SAE offset :return: the final coordinate **y** of the curve :rtype: float )S") .def("tx_Begin", &BaseCurve::tx_Begin, R"S( Initial tangent **x** coordinate :return: the initial tangent **x** coordinate :rtype: float )S") .def("tx", &BaseCurve::tx, py::arg("s"), R"S( Tangent **x** coordinate for the curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **x** coordinate :rtype: float )S") .def("tx", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.tx(s[i]); return ret; }, py::arg("s"), R"S( Tangent **x** coordinate for the curvilinear abscissa **s**. Vectorial version. :param List[float] s: curvilinear abscissa :return: the tangent **x** coordinate :rtype: List[float] )S") .def("tx_End", &BaseCurve::tx_End, R"S( Final tangent **x** coordinate :return: the final tangent **x** coordinate :rtype: float )S") .def("ty_Begin", &BaseCurve::ty_Begin, R"S( Initial tangent **y** coordinate :return: the initial tangent **y** coordinate :rtype: float )S") .def("ty", &BaseCurve::ty, py::arg("s"), R"S( Tangent **y** coordinate for the curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **y** coordinate :rtype: float )S") .def("ty", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.ty(s[i]); return ret; }, py::arg("s"), R"S( Tangent **y** coordinate for the curvilinear abscissa **s**. Vectorial version. :param List[float] s: curvilinear abscissa :return: the tangent **y** coordinate :rtype: List[float] )S") .def("ty_End", &BaseCurve::ty_End, R"S( Final tangent **y** coordinate :return: the final tangent **y** coordinate :rtype: float )S") .def("nx_Begin_ISO", &BaseCurve::nx_Begin_ISO, R"S( Initial normal **x** coordinate, in ISO standard :return: the initial normal **x** coordinate :rtype: float )S") .def("ny_Begin_ISO", &BaseCurve::ny_Begin_ISO, R"S( Initial normal **y** coordinate, in ISO standard :return: the initial normal **y** coordinate :rtype: float )S") .def("nx_End_ISO", &BaseCurve::nx_End_ISO, R"S( Final normal **x** coordinate, in ISO standard :return: the final normal **x** coordinate :rtype: float )S") .def("ny_End_ISO", &BaseCurve::ny_End_ISO, R"S( Final normal **y** coordinate, in ISO standard :return: the final normal **y** coordinate :rtype: float )S") .def("nx_Begin_SAE", &BaseCurve::nx_Begin_SAE, R"S( Initial normal **x** coordinate, in SAE standard :return: the initial normal **x** coordinate :rtype: float )S") .def("ny_Begin_SAE", &BaseCurve::ny_Begin_SAE, R"S( Initial normal **y** coordinate, in SAE standard :return: the initial normal **y** coordinate :rtype: float )S") .def("nx_End_SAE", &BaseCurve::nx_End_SAE, R"S( Final normal **x** coordinate, in SAE standard :return: the final normal **x** coordinate :rtype: float )S") .def("ny_End_SAE", &BaseCurve::ny_End_SAE, R"S( Final normal **y** coordinate, in SAE standard :return: the final normal **y** coordinate :rtype: float )S") .def("theta_D", &BaseCurve::theta_D, py::arg("s"), R"S( Angle derivative (curvature) at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the angle derivative at **s** :rtype: float )S") .def("theta_D", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.theta_D(s[i]); return ret; }, py::arg("s"), R"S( Angle derivative (curvature) at curvilinear abscissa **s**. Vectorial version. :param List[float] s: curvilinear abscissa :return: the angle derivative at **s** :rtype: List[float] )S") .def("theta_DD", &BaseCurve::theta_DD, py::arg("s"), R"S( Angle second derivative (derivative of curvature) at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the derivative of curvature at **s** :rtype: float )S") .def("theta_DD", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.theta_DD(s[i]); return ret; }, py::arg("s"), R"S( Angle second derivative (curvature derivative) at curvilinear abscissa **s**. Vectorial version. :param List[float] s: curvilinear abscissa :return: the curvature derivative at **s** :rtype: List[float] )S") .def("theta_DDD", &BaseCurve::theta_DDD, py::arg("s"), R"S( Angle third derivative (second derivative of curvature) at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the second derivative of curvature at **s** :rtype: float )S") .def("theta_DDD", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> ret(n); for (size_t i = 0; i < n; i++) ret[i] = self.theta_DDD(s[i]); return ret; }, py::arg("s"), R"S( Angle third derivative (curvature second derivative) at curvilinear abscissa **s**. Vectorial version. :param List[float] s: curvilinear abscissa :return: the curvature second derivative at **s** :rtype: List[float] )S") .def("kappa_D", &BaseCurve::kappa_D, py::arg("s"), R"S( Curvature derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the derivative of curvature at **s** :rtype: float )S") .def("kappa_DD", &BaseCurve::kappa_DD, py::arg("s"), R"S( Curvature second derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the second derivative of curvature at **s** :rtype: float )S") .def("tx_D", &BaseCurve::tx_D, py::arg("s"), R"S( Tangent **x** coordinate derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **x** coordinate derivative at **s** :rtype: float )S") .def("tx_DD", &BaseCurve::tx_DD, py::arg("s"), R"S( Tangent **x** coordinate second derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **x** coordinate second derivative at **s** :rtype: float )S") .def("tx_DDD", &BaseCurve::tx_DDD, py::arg("s"), R"S( Tangent **x** coordinate third derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **x** coordinate third derivative at **s** :rtype: float )S") .def("ty_D", &BaseCurve::ty_D, py::arg("s"), R"S( Tangent **y** coordinate derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **y** coordinate derivative at **s** :rtype: float )S") .def("ty_DD", &BaseCurve::ty_DD, py::arg("s"), R"S( Tangent **y** coordinate second derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **y** coordinate second derivative at **s** :rtype: float )S") .def("ty_DDD", &BaseCurve::ty_DDD, py::arg("s"), R"S( Tangent **y** coordinate third derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: the tangent **y** coordinate third derivative at **s** :rtype: float )S") .def("nx_ISO", &BaseCurve::nx_ISO, py::arg("s"), R"S( Normal **x** coordinate at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **x** coordinate at **s** :rtype: float )S") .def("nx_ISO_D", &BaseCurve::nx_ISO_D, py::arg("s"), R"S( Normal **x** coordinate derivative at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **x** coordinate derivative at **s** :rtype: float )S") .def("nx_ISO_DD", &BaseCurve::nx_ISO_DD, py::arg("s"), R"S( Normal **x** coordinate second derivative at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **x** coordinate second derivative at **s** :rtype: float )S") .def("nx_ISO_DDD", &BaseCurve::nx_ISO_DDD, py::arg("s"), R"S( Normal **x** coordinate third derivative at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **x** coordinate third derivative at **s** :rtype: float )S") .def("ny_ISO", &BaseCurve::ny_ISO, py::arg("s"), R"S( Normal **y** coordinate at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **y** coordinate at **s** :rtype: float )S") .def("ny_ISO_D", &BaseCurve::ny_ISO_D, py::arg("s"), R"S( Normal **y** coordinate derivative at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **y** coordinate derivative at **s** :rtype: float )S") .def("ny_ISO_DD", &BaseCurve::ny_ISO_DD, py::arg("s"), R"S( Normal **y** coordinate second derivative at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **x** coordinate second derivative at **s** :rtype: float )S") .def("ny_ISO_DDD", &BaseCurve::ny_ISO_DDD, py::arg("s"), R"S( Normal **x** coordinate third derivative at curvilinear abscissa **s**, in ISO standard :param float s: curvilinear abscissa :return: normal **x** coordinate third derivative at **s** :rtype: float )S") .def("nx_SAE", &BaseCurve::nx_SAE, py::arg("s"), R"S( Normal **x** coordinate at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **x** coordinate at **s** :rtype: float )S") .def("nx_SAE_D", &BaseCurve::nx_SAE_D, py::arg("s"), R"S( Normal **x** coordinate derivative at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **x** coordinate derivative at **s** :rtype: float )S") .def("nx_SAE_DD", &BaseCurve::nx_SAE_DD, py::arg("s"), R"S( Normal **x** coordinate second derivative at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **x** coordinate second derivative at **s** :rtype: float )S") .def("nx_SAE_DDD", &BaseCurve::nx_SAE_DDD, py::arg("s"), R"S( Normal **x** coordinate third derivative at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **x** coordinate third derivative at **s** :rtype: float )S" ) .def("ny_SAE", &BaseCurve::ny_SAE, py::arg("s"), R"S( Normal **y** coordinate at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **y** coordinate at **s** :rtype: float )S") .def("ny_SAE_D", &BaseCurve::ny_SAE_D, py::arg("s"), R"S( Normal **y** coordinate derivative at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **y** coordinate derivative at **s** :rtype: float )S") .def("ny_SAE_DD", &BaseCurve::ny_SAE_DD, py::arg("s"), R"S( Normal **y** coordinate second derivative at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **x** coordinate second derivative at **s** :rtype: float )S") .def("ny_SAE_DDD", &BaseCurve::ny_SAE_DDD, py::arg("s"), R"S( Normal **x** coordinate third derivative at curvilinear abscissa **s**, in SAE standard :param float s: curvilinear abscissa :return: normal **x** coordinate third derivative at **s** :rtype: float )S") .def("tg", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.tg(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Tangent at curvilinear coordinates **s** :param float s: :return: the tangent at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("tg_D", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.tg_D(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Tangent derivative at curvilinear coordinates **s** :param float s: :return: the tangent derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("tg_DD", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.tg_DD(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Tangent second derivative at curvilinear coordinates **s** :param float s: :return: the tangent second derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("tg_DDD", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.tg_DDD(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Tangent third derivative at curvilinear coordinates **s** :param float s: :return: the tangent third derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_ISO", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_ISO(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal at curvilinear coordinates **s**, in ISO standard :param float s: :return: the normal at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_ISO_D", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_ISO_D(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal first derivative at curvilinear coordinates **s**, in ISO standard :param float s: :return: the normal first derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_ISO_DD", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_ISO_DD(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal second derivative at curvilinear coordinates **s**, in ISO standard :param float s: :return: the normal second derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_ISO_DDD", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_ISO_DDD(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal third derivative at curvilinear coordinates **s**, in ISO standard :param float s: :return: the normal third derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_SAE", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_SAE(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal at curvilinear coordinates **s**, in SAE standard :param float s: :return: the normal at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_SAE_D", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_SAE_D(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal first derivative at curvilinear coordinates **s**, in SAE standard :param float s: :return: the normal first derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_SAE_DD", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_SAE_DD(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal second derivative at curvilinear coordinates **s**, in SAE standard :param float s: :return: the normal second derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("nor_SAE_DDD", [](const BaseCurve & self, real_type s) { real_type r_x, r_y; self.nor_SAE_DDD(s, r_x, r_y); return std::make_tuple(r_x, r_y); }, py::arg("s"), R"S( Normal third derivative at curvilinear coordinates **s**, in SAE standard :param float s: :return: the normal third derivative at curvilinear coordinate **s** :rtype: Tuple[float, float] )S") .def("evaluate", [](const BaseCurve & self, real_type s) { real_type th, k, x, y; self.evaluate(s, th, k, x, y); return std::make_tuple(th, k, x, y); }, py::arg("s"), R"S( Evaluate curve at curvilinear coordinate `s`. :param float s: curvilinear coordinate :return: a tuple with angle, curvature, x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float, float, float] )S") .def("evaluate", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> th(s), k(s), x(s), y(s); for (size_t i = 0; i < n; i++) { self.evaluate(s[i], th[i], k[i], x[i], y[i]); } return std::make_tuple(th, k, x, y); }, py::arg("s"), R"S( Evaluate curve at curvilinear coordinate `s`. :param float s: curvilinear coordinate :return: a tuple with angle, curvature, x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float, float, float] )S") .def("eval", [](const BaseCurve & self, real_type s) { real_type x, y; self.eval(s, x, y); return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve at curvilinear coordinate `s`. :param float s: curvilinear coordinate :return: a tuple with x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float] )S") .def("eval", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> x(n), y(n); for (size_t i = 0; i < n; i++) { self.eval(s[i], x[i], y[i]); } return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve at curvilinear coordinate `s`. :param List[float] s: list of curvilinear coordinate :return: a tuple of lists with x-coordinate and y-coordinate at **s** :rtype: Tuple[List[float], List[float]] )S") .def("evaluate_ISO", [](const BaseCurve & self, real_type s, real_type offs) { real_type th, k, x, y; self.evaluate_ISO(s, offs, th, k, x, y); return std::make_tuple(th, k, x, y); }, py::arg("s"), py::arg("offs"), R"S( Evaluate curve at curvilinear coordinate `s`, with an additional offset that follows the ISO standard. :param float s: curvilinear coordinate :param float offs: :return: a tuple with angle, curvature, x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float, float, float] )S") .def("evaluate_ISO", [](const BaseCurve & self, const std::vector<real_type> & s, const std::vector<real_type> & offs) { const size_t n = std::min(s.size(), offs.size()); std::vector<real_type> th(n), k(n), x(n), y(n); for (size_t i = 0; i < n; i++) { self.evaluate_ISO(s[i], offs[i], th[i], k[i], x[i], y[i]); } return std::make_tuple(th, k, x, y); }, py::arg("s"), py::arg("offs"), R"S( Evaluate curve at curvilinear coordinate `s`, with an additional offset that follows the ISO standard. :param List[float] s: curvilinear coordinate :param List[float] offs: :return: a tuple with angle, curvature, x-coordinate and y-coordinate at **s** :rtype: Tuple[List[float], List[float], List[float], List[float]] )S") .def("eval_ISO", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_ISO(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Evaluate curve at curvilinear coordinate `s`, with an additional offset that follows the ISO standard. :param float s: curvilinear coordinate :param float offs: :return: a tuple with x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float] )S") .def("eval_ISO", [](const BaseCurve & self, const std::vector<real_type> & s, const std::vector<real_type> & offs) { const size_t n = std::min(s.size(), offs.size()); std::vector<real_type> x(n), y(n); for (size_t i = 0; i < n; i++) { self.eval_ISO(s[i], offs[i], x[i], y[i]); } return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Evaluate curve at curvilinear coordinate `s`, with an additional offset that follows the ISO standard. Vector version. :param List[float] s: curvilinear coordinate :param List[float] offs: :return: a tuple with x-coordinate and y-coordinate at **s** :rtype: Tuple[List[float], List[float]] )S") .def("evaluate_SAE", [](const BaseCurve & self, real_type s, real_type offs) { real_type th, k, x, y; self.evaluate_SAE(s, offs, th, k, x, y); return std::make_tuple(th, k, x, y); }, py::arg("s"), py::arg("offs"), R"S( Evaluate curve at curvilinear coordinate `s`, with an additional offset that follows the SAE standard. :param float s: curvilinear coordinate :param float offs: :return: a tuple with angle, curvature, x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float, float, float] )S") .def("eval_SAE", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_SAE(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Evaluate curve at curvilinear coordinate `s`, with an additional offset that follows the SAE standard. :param float s: curvilinear coordinate :param float offs: :return: a tuple with x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float] )S") .def("X_D", &BaseCurve::X_D, py::arg("s"), R"S( **x** coordinate derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: **x** coordinate derivative :rtype: float )S") .def("X_DD", &BaseCurve::X_DD, py::arg("s"), R"S( **x** coordinate second derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: **x** coordinate second derivative :rtype: float )S") .def("X_DDD", &BaseCurve::X_DDD, py::arg("s"), R"S( **x** coordinate third derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: **x** coordinate third derivative :rtype: float )S") .def("Y_D", &BaseCurve::Y_D, py::arg("s"), R"S( **y** coordinate derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: **y** coordinate derivative :rtype: float )S") .def("Y_DD", &BaseCurve::Y_DD, py::arg("s"), R"S( **y** coordinate second derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: **y** coordinate second derivative :rtype: float )S") .def("Y_DDD", &BaseCurve::Y_DDD, py::arg("s"), R"S( **y** coordinate third derivative at curvilinear abscissa **s** :param float s: curvilinear abscissa :return: **y** coordinate third derivative :rtype: float )S") .def("eval_D", [](const BaseCurve & self, real_type s) { real_type x, y; self.eval_D(s, x, y); return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve first derivative at curvilinear coordinate `s`. :param float s: curvilinear coordinate :return: a tuple with derivative x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float] )S") .def("eval_D", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> x(n), y(n); for (size_t i = 0; i < n; i++) { self.eval_D(s[i], x[i], y[i]); } return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve first derivative at curvilinear coordinate `s`. Vector version. :param List[float] s: curvilinear coordinate :return: a tuple with derivative x-coordinate and y-coordinate at **s** :rtype: Tuple[List[float], List[float]] )S") .def("eval_DD", [](const BaseCurve & self, real_type s) { real_type x, y; self.eval_DD(s, x, y); return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve second derivative at curvilinear coordinate `s`. :param float s: curvilinear coordinate :return: a tuple with second derivative x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float] )S") .def("eval_DD", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> x(n), y(n); for (size_t i = 0; i < n; i++) { self.eval_DD(s[i], x[i], y[i]); } return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve second derivative at curvilinear coordinate `s`. Vector version :param List[float] s: curvilinear coordinate :return: a tuple with second derivative x-coordinate and y-coordinate at **s** :rtype: Tuple[List[float], List[float]] )S") .def("eval_DDD", [](const BaseCurve & self, real_type s) { real_type x, y; self.eval_DDD(s, x, y); return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve third derivative at curvilinear coordinate `s`. :param float s: curvilinear coordinate :return: a tuple with third derivative x-coordinate and y-coordinate at **s** :rtype: Tuple[float, float] )S") .def("eval_DDD", [](const BaseCurve & self, const std::vector<real_type> & s) { const size_t n = s.size(); std::vector<real_type> x(n), y(n); for (size_t i = 0; i < n; i++) { self.eval_DDD(s[i], x[i], y[i]); } return std::make_tuple(x, y); }, py::arg("s"), R"S( Evaluate curve third derivative at curvilinear coordinate `s`. Vector version. :param List[float] s: curvilinear coordinate :return: a tuple with third derivative x-coordinate and y-coordinate at **s** :rtype: Tuple[List[float], List[float]] )S") .def("X_ISO_D", &BaseCurve::X_ISO_D, py::arg("s"), py::arg("offs"), R"S( **x** coordinate derivative at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **x** coordinate derivative :rtype: float )S") .def("X_ISO_DD", &BaseCurve::X_ISO_DD, py::arg("s"), py::arg("offs"), R"S( **x** coordinate second derivative at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **x** coordinate second derivative :rtype: float )S") .def("X_ISO_DDD", &BaseCurve::X_ISO_DDD, py::arg("s"), py::arg("offs"), R"S( **x** coordinate third derivative at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **x** coordinate third derivative :rtype: float )S") .def("Y_ISO_D", &BaseCurve::Y_ISO_D, py::arg("s"), py::arg("offs"), R"S( **y** coordinate derivative at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **y** coordinate derivative :rtype: float )S") .def("Y_ISO_DD", &BaseCurve::Y_ISO_DD, py::arg("s"), py::arg("offs"), R"S( **y** coordinate second derivative at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **y** coordinate second derivative :rtype: float )S") .def("Y_ISO_DDD", &BaseCurve::Y_ISO_DDD, py::arg("s"), py::arg("offs"), R"S( **y** coordinate third derivative at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **y** coordinate third derivative :rtype: float )S") // SAE .def("X_SAE_D", &BaseCurve::X_SAE_D, py::arg("s"), py::arg("offs"), R"S( **x** coordinate derivative at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **x** coordinate derivative :rtype: float )S") .def("X_SAE_DD", &BaseCurve::X_SAE_DD, py::arg("s"), py::arg("offs"), R"S( **x** coordinate second derivative at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **x** coordinate second derivative :rtype: float )S") .def("X_SAE_DDD", &BaseCurve::X_SAE_DDD, py::arg("s"), py::arg("offs"), R"S( **x** coordinate third derivative at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **x** coordinate third derivative :rtype: float )S") .def("Y_SAE_D", &BaseCurve::Y_SAE_D, py::arg("s"), py::arg("offs"), R"S( **y** coordinate derivative at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **y** coordinate derivative :rtype: float )S") .def("Y_SAE_DD", &BaseCurve::Y_SAE_DD, py::arg("s"), py::arg("offs"), R"S( **y** coordinate second derivative at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **y** coordinate second derivative :rtype: float )S") .def("Y_SAE_DDD", &BaseCurve::Y_SAE_DDD, py::arg("s"), py::arg("offs"), R"S( **y** coordinate third derivative at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: **y** coordinate third derivative :rtype: float )S") .def("eval_ISO_D", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_ISO_D(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Coordinate derivatives at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: coordinate derivatives :rtype: Tuple[float, float] )S") .def("eval_ISO_DD", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_ISO_DD(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Coordinate second derivatives at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: coordinate second derivatives :rtype: Tuple[float, float] )S") .def("eval_ISO_DDD", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_ISO_DDD(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Coordinate third derivatives at curvilinear abscissa **s**, in ISO reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: coordinate third derivatives :rtype: Tuple[float, float] )S") .def("eval_SAE_D", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_SAE_D(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Coordinate derivatives at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: coordinate derivatives :rtype: Tuple[float, float] )S") .def("eval_SAE_DD", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_SAE_DD(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Coordinate second derivatives at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: coordinate second derivatives :rtype: Tuple[float, float] )S") .def("eval_SAE_DDD", [](const BaseCurve & self, real_type s, real_type offs) { real_type x, y; self.eval_SAE_DDD(s, offs, x, y); return std::make_tuple(x, y); }, py::arg("s"), py::arg("offs"), R"S( Coordinate third derivatives at curvilinear abscissa **s**, in SAE reference frame :param float s: curvilinear abscissa :param float offs: offset from the curve :return: coordinate third derivatives :rtype: Tuple[float, float] )S") .def("translate", &BaseCurve::translate, py::arg("tx"), py::arg("ty"), R"S( Translate the curve by :math:`(t_x, t_y)`. This method works in place, and forces the recalculation of the AABBtree of the curve :param float tx: **x** coordinates offset :param float ty: **y** coordinates offset :return: nothing, works in place :rtype: NoneType )S") .def("rotate", &BaseCurve::rotate, py::arg("angle"), py::arg("cx"), py::arg("cy"), R"S( Rotate curve by angle :math:`\theta` centered at point :math:`(c_x, c_y)`. This method works in place and forces the recalculation of the AABBtree of the curve :param float angle: angle :math:`\theta` :param float cx: center origin coordinate :math:`c_x` :param float cy: center origin coordinate :math:`c_y` :return: nothing, works in place :rtype: NoneType )S") .def("scale", &BaseCurve::scale, py::arg("scale"), R"S( Scale a curve by the factor provided as input. This method works in place and forces the recalculation of the AABBtree of the curve. :param float sc: the scaling factor :return: nothing, works in place :rtype: NoneType )S") .def("reverse", &BaseCurve::reverse, R"S( Reverses the curve parametrization. This method works in place and forces the recalculation of the AABBtree of the curve :return: nothing, works in place :rtype: NoneType )S") .def("changeOrigin", &BaseCurve::change_origin, py::arg("newx0"), py::arg("newy0"), R"S( Translate the curve so that the origin will be :math:`(x_{0,new}, y_{0,new})`. This method works in place and forces the recalculation of the AABBtree of the curve. .. warning:: This function is deprecated for ``change_origin`` :param float newx0: new origin **x** coordinate :param float newy0: new origin **y** coordinate :return: nothing, works in place :rtype: NoneType )S") .def("change_origin", &BaseCurve::change_origin, py::arg("newx0"), py::arg("newy0"), R"S( Translate the curve so that the origin will be :math:`(x_{0,new}, y_{0,new})`. This method works in place and forces the recalculation of the AABBtree of the curve. :param float newx0: new origin **x** coordinate :param float newy0: new origin **y** coordinate :return: nothing, works in place :rtype: NoneType )S") .def("trim", &BaseCurve::trim, py::arg("s_begin"), py::arg("s_end"), R"S( Cuts the curve between parametric curvilinear abscissa range :math:`(s_{begin}, s_{end})`. This method works in place and forces the recalculation of the AABBtree of the curve :param float s_begin: starting curvilinear abscissa :param float e_sen: ending curvilinear abscissa :return: nothing, works in place :rtype: NoneType )S") .def("collision", &BaseCurve::collision, py::arg("curve"), R"S( Checks collisions with another curve :param BaseCurve curve: the other curve to check :return: true if curves collide :rtype: bool )S") .def("collision_ISO", &BaseCurve::collision_ISO, py::arg("offs"), py::arg("curve"), py::arg("curve_offs"), R"S( Checks collisions with another curve, considering offset on both curves. Uses ISO standard references :param float offs: offset on the current curve :param BaseCurve curve: the other curve to check :param float curve_offs: offset on the other curve :return: true if curves collide :rtype: bool )S") .def("collision_SAE", &BaseCurve::collision_SAE, py::arg("offs"), py::arg("curve"), py::arg("curve_offs"), R"S( Checks collisions with another curve, considering offset on both curves. Uses SAE standard references :param float offs: offset on the current curve :param BaseCurve curve: the other curve to check :param float curve_offs: offset on the other curve :return: true if curves collide :rtype: bool )S") .def("intersect", [](const BaseCurve & self, const BaseCurve & curve, bool swap_s_vals) { IntersectList ilist; self.intersect(curve, ilist, swap_s_vals); return ilist; }, py::arg("curve"), py::arg("swap_s_vals") = false, R"S( Intersect the curve with another curve. The result is a list of pairs, where each element of the pair represents the ascissa coordinate at which intersection occurs :param BaseCurve curve: second curve intersect :param bool swap_s_vals: if true store `(s2,s1)` instead of `(s1,s2)` for each intersection. Default false. :return: a list of pair with intersection coordinates on both curves :rtype: List[Tuple[float, float]] )S") .def("intersect_ISO", [](const BaseCurve & self, real_type offs, const BaseCurve & curve, real_type curve_offs, bool swap_s_vals) { IntersectList ilist; self.intersect_ISO(offs, curve, curve_offs, ilist, swap_s_vals); return ilist; }, py::arg("offs"), py::arg("curve"), py::arg("curve_offs"), py::arg("swap_s_vals") = false, R"S( Intersect the curve with another curve. The result is a list of pairs, where each element of the pair represents the ascissa coordinate at which intersection occurs. Version with offset in ISO standard reference :param float offs: offset on the curve :param BaseCurve curve: second curve intersect :param float curve_offs: offset on the second curve :param bool swap_s_vals: if true store `(s2,s1)` instead of `(s1,s2)` for each intersection. Default false. :return: a list of pair with intersection coordinates on both curves :rtype: List[Tuple[float, float]] )S") .def("intersect_SAE", [](const BaseCurve & self, real_type offs, const BaseCurve & curve, real_type curve_offs, bool swap_s_vals) { IntersectList ilist; self.intersect_SAE(offs, curve, curve_offs, ilist, swap_s_vals); return ilist; }, py::arg("offs"), py::arg("curve"), py::arg("curve_offs"), py::arg("swap_s_vals") = false, R"S( Intersect the curve with another curve. The result is a list of pairs, where each element of the pair represents the ascissa coordinate at which intersection occurs. Version with offset in ISO standard reference :param float offs: offset on the curve :param BaseCurve curve: second curve intersect :param float curve_offs: offset on the second curve :param bool swap_s_vals: if true store `(s2,s1)` instead of `(s1,s2)` for each intersection. Default false. :return: a list of pair with intersection coordinates on both curves :rtype: List[Tuple[float, float]] )S") .def("closestPoint", [](const BaseCurve & self, real_type qx, real_type qy) { int_type ret; real_type x, y, s, t, dst; ret = self.closest_point_ISO(qx, qy, x, y, s, t, dst); return std::make_tuple(ret, x, y, s, t, dst); }, py::arg("qx"), py::arg("qy"), R"S( Given a point :math:`(q_x, q_y)`, finds the closest point on the curve. There are 6 values in the response tuple: 1. result of the projection. If the value is 1 the projection is unique and orthogonal, if the value is 0 there is more than one orthogonal projection and only the first is returned, if the value is -1 the minimum distance point has a projection which is not orthogonal 2. **x** coordinate of the point on the clothoid 3. **y** coordinate of the point on the clothoid 4. **s** curvilinear abscissa of the point 5. **t** normal distance of the point on curvilinear abscissa 6. **dst** distance of the point from the curve :param float qx: x coordinates of the point :param float qy: y coordinates of the point :return: a tuple of results as described :rtype: Tuple[int, float, float, float, float, int] )S") .def("closestPoint", [](const BaseCurve & self, const std::vector<real_type> & qx, const std::vector<real_type> & qy) { const size_t n = std::min(qx.size(), qy.size()); std::vector<int_type> ret(n); std::vector<real_type> x(n), y(n), s(n), t(n), dst(n); for (size_t i = 0; i < n; i++) { ret[i] = self.closest_point_ISO(qx[i], qy[i], x[i], y[i], s[i], t[i], dst[i]); } return std::make_tuple(ret, x, y, s, t, dst); }, py::arg("qx"), py::arg("qy"), R"S( Given a point :math:`(q_x, q_y)`, finds the closest point on the curve. Vectorial version. There are 6 values in the response tuple: 1. result of the projection. If the value is 1 the projection is unique and orthogonal, if the value is 0 there is more than one orthogonal projection and only the first is returned, if the value is -1 the minimum distance point has a projection which is not orthogonal 2. **x** coordinate of the point on the clothoid 3. **y** coordinate of the point on the clothoid 4. **s** curvilinear abscissa of the point 5. **t** normal distance of the point on curvilinear abscissa 6. **dst** distance of the point from the curve :param List[float] qx: x coordinates of the point :param List[float] qy: y coordinates of the point :return: a tuple of results as described :rtype: Tuple[List[int], List[float], List[float], List[float], List[float], List[int]] )S") .def("closestPoint_ISO", [](const BaseCurve & self, real_type qx, real_type qy) { int_type ret; real_type x, y, s, t, dst; ret = self.closest_point_ISO(qx, qy, x, y, s, t, dst); return std::make_tuple(ret, x, y, s, t, dst); }, py::arg("qx"), py::arg("qy"), R"S( Given a point :math:`(q_x, q_y)`, finds the closest point on the curve. This function uses the ISO standard. There are 6 values in the response tuple: 1. result of the projection. If the value is 1 the projection is unique and orthogonal, if the value is 0 there is more than one orthogonal projection and only the first is returned, if the value is -1 the minimum distance point has a projection which is not orthogonal 2. **x** coordinate of the point on the clothoid 3. **y** coordinate of the point on the clothoid 4. **s** curvilinear abscissa of the point 5. **t** normal distance of the point on curvilinear abscissa 6. **dst** distance of the point from the curve :param float qx: x coordinates of the point :param float qy: y coordinates of the point :return: a tuple of results as described :rtype: Tuple[int, float, float, float, float, int] )S") .def("closestPoint_SAE", [](const BaseCurve & self, real_type qx, real_type qy) { int_type ret; real_type x, y, s, t, dst; ret = self.closest_point_SAE(qx, qy, x, y, s, t, dst); return std::make_tuple(ret, x, y, s, t, dst); }, py::arg("qx"), py::arg("qy"), R"S( Given a point :math:`(q_x, q_y)`, finds the closest point on the curve. This function uses SAE standard. There are 6 values in the response tuple: 1. result of the projection. If the value is 1 the projection is unique and orthogonal, if the value is 0 there is more than one orthogonal projection and only the first is returned, if the value is -1 the minimum distance point has a projection which is not orthogonal 2. **x** coordinate of the point on the clothoid 3. **y** coordinate of the point on the clothoid 4. **s** curvilinear abscissa of the point 5. **t** normal distance of the point on curvilinear abscissa 6. **dst** distance of the point from the curve :param float qx: x coordinates of the point :param float qy: y coordinates of the point :return: a tuple of results as described :rtype: Tuple[int, float, float, float, float, int] )S") .def("distance", &BaseCurve::distance, py::arg("qx"), py::arg("qy"), R"S( Given a point :math:`(q_x, q_y)`, finds the distance between the point and the curve. :param float qx: x coordinates of the point :param float qy: y coordinates of the point :return: the distance of the point :rtype: float )S") .def("distance_ISO", &BaseCurve::distance_ISO, py::arg("qx"), py::arg("qy"), py::arg("offs"), R"S( Given a point :math:`(q_x, q_y)`, finds the distance between the point and the curve, even with an offset. It uses ISO standard reference frame. :param float qx: x coordinates of the point :param float qy: y coordinates of the point :param float offs: offset from the curve :return: the distance of the point :rtype: float )S") .def("distance_SAE", &BaseCurve::distance_SAE, py::arg("qx"), py::arg("qy"), py::arg("offs"), R"S( Given a point :math:`(q_x, q_y)`, finds the distance between the point and the curve, even with an offset. It uses SAE standard reference frame. :param float qx: x coordinates of the point :param float qy: y coordinates of the point :param float offs: offset from the curve :return: the distance of the point :rtype: float )S") .def("findST", [](const BaseCurve & self, real_type x, real_type y) { real_type s, t; bool ret = self.findST_ISO(x, y, s, t); return std::make_tuple(ret, s, t); }, py::arg("x"), py::arg("y"), R"S( Find the curvilinear coordinate of point :math:`P = (x, y)` with respect to the curve, such that: :math:`P = C(s) + t\,N(s)` where :math:`C(s)` is the curve position respect to the curvilinear coordinates and :math:`t` is the normal :math:`N(s)` at the point. :param float x: **x** component :param float y: **y** component :return: a tuple with a boolean value (projection found or not) and the **s** and **t** coordinates on the curve. :rtype: Tuple[bool, float, float] )S") .def("findST", [](const BaseCurve & self, const std::vector<real_type> & x, const std::vector<real_type> & y) { const size_t n = std::min(x.size(), y.size()); std::vector<real_type> s(n), t(n); std::vector<bool> ret(n); for (size_t i = 0; i < n; i++) { ret[i] = self.findST_ISO(x[i], y[i], s[i], t[i]); } return std::make_tuple(ret, s, t); }, py::arg("x"), py::arg("y"), R"S( Find the curvilinear coordinate of point :math:`P = (x, y)` with respect to the curve, such that: :math:`P = C(s) + t\,N(s)` where :math:`C(s)` is the curve position respect to the curvilinear coordinates and :math:`t` is the normal :math:`N(s)` at the point. Vectorial version. :param List[float] x: **x** component :param List[float] y: **y** component :return: a tuple with a boolean value (projection found or not) and the **s** and **t** coordinates on the curve. :rtype: Tuple[List[bool], List[float], List[float]] )S") .def("findST_ISO", [](const BaseCurve & self, real_type x, real_type y) { real_type s, t; bool ret = self.findST_ISO(x, y, s, t); return std::make_tuple(ret, s, t); }, py::arg("x"), py::arg("y"), R"S( Find the curvilinear coordinate of point :math:`P = (x, y)` with respect to the curve, such that: :math:`P = C(s) + t\,N(s)` where :math:`C(s)` is the curve position respect to the curvilinear coordinates and :math:`t` is the normal :math:`N(s)` at the point. It uses the ISO reference frame. :param float x: **x** component :param float y: **y** component :return: a tuple with a boolean value (projection found or not) and the **s** and **t** coordinates on the curve. :rtype: Tuple[bool, float, float] )S") .def("findST_ISO", [](const BaseCurve & self, std::vector<real_type> xs, std::vector<real_type> ys) { const size_t size = std::min(xs.size(), ys.size()); std::vector<bool> ret(size); std::vector<real_type> s(size), t(size); for (size_t i = 0; i < size; i++) { real_type s_, t_; bool ret_ = self.findST_ISO(xs[i], ys[i], s_, t_); ret[i] = ret_; s[i] = s_; t[i] = t_; } return std::make_tuple(ret, s, t); }, py::arg("x"), py::arg("y"), R"S( Find the curvilinear coordinate of point :math:`P = (x, y)` with respect to the curve, such that: :math:`P = C(s) + t\,N(s)` where :math:`C(s)` is the curve position respect to the curvilinear coordinates and :math:`t` is the normal :math:`N(s)` at the point. It uses the ISO reference frame. Vectorial version :param float x: **x** component :param float y: **y** component :return: a tuple with a boolean value (projection found or not) and the **s** and **t** coordinates on the curve. :rtype: Tuple[bool, float, float] )S") .def("findST_SAE", [](const BaseCurve & self, real_type x, real_type y) { real_type s, t; bool ret = self.findST_SAE(x, y, s, t); return std::make_tuple(ret, s, t); }, py::arg("x"), py::arg("y"), R"S( Find the curvilinear coordinate of point :math:`P = (x, y)` with respect to the curve, such that: :math:`P = C(s) + t\,N(s)` where :math:`C(s)` is the curve position respect to the curvilinear coordinates and :math:`t` is the normal :math:`N(s)` at the point. It uses the SAE reference frame. :param float x: **x** component :param float y: **y** component :return: a tuple with a boolean value (projection found or not) and the **s** and **t** coordinates on the curve. :rtype: Tuple[bool, float, float] )S") .def("__str__", [](const BaseCurve & self) { std::ostringstream str; self.info(str); return str.str(); }); } } }
34.877422
132
0.573023
MatteoRagni
48db8c96d5adaf28c0ca04982b945a4f6fbf673d
310
cpp
C++
Dimik OJ/bornomala theke sonkha.cpp
Sohelr360/my_codes
9bdd28f62d3850aad8f8af2a253ba66138a7057c
[ "MIT" ]
null
null
null
Dimik OJ/bornomala theke sonkha.cpp
Sohelr360/my_codes
9bdd28f62d3850aad8f8af2a253ba66138a7057c
[ "MIT" ]
null
null
null
Dimik OJ/bornomala theke sonkha.cpp
Sohelr360/my_codes
9bdd28f62d3850aad8f8af2a253ba66138a7057c
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int main() { int t; string s; cin>>t; while(t--) { cin>>s; for(int i = 0; i < s.length(); i++) { int t = s[i] - 'A'; t++; cout<<t; } cout<<endl; } return 0; }
14.090909
43
0.354839
Sohelr360
48dea8946482d2ab2d8cad98d6cd001e890235f9
2,304
hpp
C++
include/asymmetric_distribution.hpp
mirandaconrado/probability-distributions
6b7d86e181237eb134e6df6da60200beed66922f
[ "MIT" ]
null
null
null
include/asymmetric_distribution.hpp
mirandaconrado/probability-distributions
6b7d86e181237eb134e6df6da60200beed66922f
[ "MIT" ]
null
null
null
include/asymmetric_distribution.hpp
mirandaconrado/probability-distributions
6b7d86e181237eb134e6df6da60200beed66922f
[ "MIT" ]
null
null
null
#ifndef __PROBABILITY_DISTRIBUTIONS__ASYMMETRIC_DISTRIBUTION_HPP__ #define __PROBABILITY_DISTRIBUTIONS__ASYMMETRIC_DISTRIBUTION_HPP__ #include "distribution.hpp" namespace ProbabilityDistributions { template <class Dist, class D, class W = D, class T = W> class AsymmetricDistribution: public Distribution<D,W,T> { public: AsymmetricDistribution(T p, T mu, T eps = 1e-4, T tol = 1e-6); static constexpr unsigned int sample_size = 1; void fix_p(bool fixed = true) { fixed_p_ = fixed; } void fix_mu(bool fixed = true) { fixed_mu_ = fixed; } bool is_p_fixed() const { return fixed_p_; } bool is_mu_fixed() const { return fixed_mu_; } void set_p(T p); void set_mu(T mu) { mu_ = mu; } T get_p() const { return p_; } T get_mu() const { return mu_; } template <class RNG> void sample(MA::Array<D>& samples, size_t n_samples, RNG& rng) const; using Distribution<D,W,T>::log_likelihood; T log_likelihood(MA::ConstArray<D> const& data, MA::ConstArray<W> const& weight) const; using Distribution<D,W,T>::MLE; void MLE(MA::ConstArray<D> const& data, MA::ConstArray<W> const& weight, std::vector<size_t> const& indexes = std::vector<size_t>()); bool require_sorted() const { return true; } protected: void init(); T fix_step(T p, T step) const; virtual void init_MLE(MA::ConstArray<D> const& data, MA::ConstArray<W> const& weight, std::vector<size_t> const& indexes) { } virtual void end_MLE() { } virtual void updated_p() { } virtual T constant_likelihood() const { return 0; } virtual T negative_ll(T s, T mu) const = 0; virtual T positive_ll(T s, T mu) const = 0; virtual void set_parameter_vector(std::vector<T> const& p) = 0; virtual std::vector<T> get_parameter_vector() const = 0; virtual void MLE_fixed_p(MA::ConstArray<D> const& data, MA::ConstArray<W> const& weight, std::vector<size_t> const& indexes) = 0; virtual void check_data_and_weight(MA::ConstArray<D> const& data, MA::ConstArray<W> const& weight) const; bool fixed_mu_, fixed_p_; T mu_, p_, eps_, tol_; }; }; #include "asymmetric_distribution_impl.hpp" #endif
33.882353
78
0.648872
mirandaconrado
48e1b0bdb0596f6479bb829768c77151695d74d3
2,534
cpp
C++
geotrans3.7/CCS/src/dtcc/CoordinateTuples/CoordinateTuple.cpp
mjj203/tippecanoe
140ae1da6438a23d82f41e9c7b7b129107bf6e2d
[ "BSD-2-Clause" ]
1
2021-07-05T07:40:49.000Z
2021-07-05T07:40:49.000Z
geotrans3.7/CCS/src/dtcc/CoordinateTuples/CoordinateTuple.cpp
mjj203/tippecanoe
140ae1da6438a23d82f41e9c7b7b129107bf6e2d
[ "BSD-2-Clause" ]
1
2015-01-13T10:08:35.000Z
2015-01-13T10:08:35.000Z
geotrans3.7/CCS/src/dtcc/CoordinateTuples/CoordinateTuple.cpp
mjj203/tippecanoe
140ae1da6438a23d82f41e9c7b7b129107bf6e2d
[ "BSD-2-Clause" ]
2
2017-07-24T13:34:49.000Z
2017-11-14T16:52:38.000Z
// CLASSIFICATION: UNCLASSIFIED #include <stdio.h> #include <string.h> #include "CoordinateTuple.h" #include "CoordinateType.h" using namespace MSP::CCS; CoordinateTuple::CoordinateTuple() : _coordinateType( CoordinateType::geodetic ) { strcpy( _errorMessage, ""); strcpy( _warningMessage, ""); // _warningMessage[0] = '\0'; } CoordinateTuple::CoordinateTuple( CoordinateType::Enum __coordinateType ) : _coordinateType( __coordinateType ) { strcpy( _errorMessage, ""); strcpy( _warningMessage, ""); // _warningMessage[0] = '\0'; } CoordinateTuple::CoordinateTuple( MSP::CCS::CoordinateType::Enum __coordinateType, const char* __warningMessage ) : _coordinateType( __coordinateType ) { strcpy( _errorMessage, ""); // _warningMessage[0] = '\0'; strcpy( _warningMessage, __warningMessage ); } CoordinateTuple::CoordinateTuple( const CoordinateTuple &ct ) { _coordinateType = ct._coordinateType; // _errorMessage[0] = '\0'; strcpy( _errorMessage, ct._errorMessage ); // _warningMessage[0] = '\0'; strcpy( _warningMessage, ct._warningMessage ); } CoordinateTuple::~CoordinateTuple() { // if( strlen( _warningMessage ) > 0 ) // delete [] _warningMessage; } CoordinateTuple& CoordinateTuple::operator=( const CoordinateTuple &ct ) { if( this != &ct ) { _coordinateType = ct._coordinateType; // _errorMessage[0] = '\0'; strcpy( _errorMessage, ct._errorMessage ); // _warningMessage[0] = '\0'; strcpy( _warningMessage, ct._warningMessage ); } return *this; } void CoordinateTuple::setCoordinateType( MSP::CCS::CoordinateType::Enum __coordinateType ) { _coordinateType = __coordinateType; } CoordinateType::Enum CoordinateTuple::coordinateType() const { return _coordinateType; } void CoordinateTuple::set(MSP::CCS::CoordinateType::Enum __coordinateType, const char* __warningMessage, const char* __errorMessage) { _coordinateType = __coordinateType; strcpy( _warningMessage, __warningMessage ); strcpy( _errorMessage, __errorMessage ); } void CoordinateTuple::setErrorMessage( const char* __errorMessage ) { // _errorMessage[0] = '\0'; strcpy( _errorMessage, __errorMessage ); } const char* CoordinateTuple::errorMessage() const { return _errorMessage; } void CoordinateTuple::setWarningMessage( const char* __warningMessage ) { // _warningMessage[0] = '\0'; strcpy( _warningMessage, __warningMessage ); } const char* CoordinateTuple::warningMessage() const { return _warningMessage; } // CLASSIFICATION: UNCLASSIFIED
20.435484
132
0.722573
mjj203
48e51119690ed4615a28c1a0b18930a6ca6faf23
1,988
cpp
C++
601-700/692-Top_K_Frequent_Words-m.cpp
ysmiles/leetcode-cpp
e7e6ef11224c7383071ed8efbe2feac313824a71
[ "BSD-3-Clause" ]
1
2018-10-02T22:44:52.000Z
2018-10-02T22:44:52.000Z
601-700/692-Top_K_Frequent_Words-m.cpp
ysmiles/leetcode-cpp
e7e6ef11224c7383071ed8efbe2feac313824a71
[ "BSD-3-Clause" ]
null
null
null
601-700/692-Top_K_Frequent_Words-m.cpp
ysmiles/leetcode-cpp
e7e6ef11224c7383071ed8efbe2feac313824a71
[ "BSD-3-Clause" ]
null
null
null
// Given a non-empty list of words, return the k most frequent elements. // Your answer should be sorted by frequency from highest to lowest. If two // words have the same frequency, then the word with the lower alphabetical // order comes first. // Example 1: // Input: ["i", "love", "leetcode", "i", "love", "coding"], k = 2 // Output: ["i", "love"] // Explanation: "i" and "love" are the two most frequent words. // Note that "i" comes before "love" due to a lower alphabetical order. // Example 2: // Input: ["the", "day", "is", "sunny", "the", "the", "the", "sunny", "is", // "is"], k = 4 Output: ["the", "is", "sunny", "day"] Explanation: "the", "is", // "sunny" and "day" are the four most frequent words, // with the number of occurrence being 4, 3, 2 and 1 respectively. // Note: // You may assume k is always valid, 1 ≤ k ≤ number of unique elements. // Input words contain only lowercase letters. // Follow up: // Try to solve it in O(n log k) time and O(n) extra space. class Solution { public: vector<string> topKFrequent(vector<string> &words, int k) { unordered_map<string, int> wordMap; // O(n) for_each(words.begin(), words.end(), [&](auto &w) { ++wordMap[w]; }); static constexpr auto compCnt = [](auto &a, auto &b) { if (a.second == b.second) return a.first < b.first; // higher alphabetical at beginning to pop return a.second > b.second; // smaller cnt at beginning to pop }; // O(nlogk) priority_queue<pair<string, int>, vector<pair<string, int>>, decltype(compCnt)> pq(compCnt); for (auto &wCnt : wordMap) { pq.push(wCnt); if (pq.size() > k) pq.pop(); } // O(k) vector<string> ret(k); while (!pq.empty()) { ret[--k] = pq.top().first; pq.pop(); } return ret; } };
33.133333
79
0.554326
ysmiles
48e53134196a79de5e9630170cb29bf67161bc52
204
cc
C++
tests/pe.cc
lethalbit/libalfheim
e70db0db7a7998e974e08fe2a955814e247e1ff6
[ "BSD-3-Clause" ]
1
2021-05-05T15:58:36.000Z
2021-05-05T15:58:36.000Z
tests/pe.cc
lethalbit/libalfheim
e70db0db7a7998e974e08fe2a955814e247e1ff6
[ "BSD-3-Clause" ]
null
null
null
tests/pe.cc
lethalbit/libalfheim
e70db0db7a7998e974e08fe2a955814e247e1ff6
[ "BSD-3-Clause" ]
null
null
null
/* SPDX-License-Identifier: BSD-3-Clause */ /* pe.cc - libalfheim `pe` test suite */ #include <libalfheim/pe.hh> #define CATCH_CONFIG_MAIN #include <catch2/catch.hpp> TEST_CASE( "~~?~~", "[pe]" ) { }
17
43
0.647059
lethalbit
48e6a3cfb94ee3ba124dcfba65feb77e2e280580
12,434
cpp
C++
ks/src/unix_manager.cpp
acplt/acplt-ks
9c1acdeeabd93d1627a0fe4c5ac7888144c950fe
[ "Artistic-1.0-cl8", "Apache-2.0" ]
null
null
null
ks/src/unix_manager.cpp
acplt/acplt-ks
9c1acdeeabd93d1627a0fe4c5ac7888144c950fe
[ "Artistic-1.0-cl8", "Apache-2.0" ]
null
null
null
ks/src/unix_manager.cpp
acplt/acplt-ks
9c1acdeeabd93d1627a0fe4c5ac7888144c950fe
[ "Artistic-1.0-cl8", "Apache-2.0" ]
null
null
null
/* -*-plt-c++-*- */ /* $Header: /home/david/cvs/acplt/ks/src/unix_manager.cpp,v 1.19 2007-04-25 12:57:21 martin Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 1999 * Lehrstuhl fuer Prozessleittechnik, RWTH Aachen * D-52064 Aachen, Germany. * All rights reserved. * * This file is part of the ACPLT/KS Package which is licensed as open * source under the Artistic License; you can use, redistribute and/or * modify it under the terms of that license. * * You should have received a copy of the Artistic License along with * this Package; see the file ARTISTIC-LICENSE. If not, write to the * Copyright Holder. * * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES * OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* Author: Martin Kneissl <martin@plt.rwth-aachen.de> */ #include "ks/manager.h" #include "plt/log.h" #include <signal.h> #include <unistd.h> #include <errno.h> ////////////////////////////////////////////////////////////////////// const char PROG_NAME[] = "manager"; const KsString KS_MANAGER_VERSION(KS_VERSION_STRING); ////////////////////////////////////////////////////////////////////////////// // First, we'll now entering a very dangerous terrain of unix land: the // signals. Depending on the os vendor, we might be either running on top of // BSD or SYS V R4. Whereas the first one has made the signal() mechanism // reliable some time back in the good old days without changing the API, // SYS V R4 has still the old unreliable signal() interface. Bottom line: to // get reliable signals, we must use sigaction() (fortunately, all the // contemporary systems support this -- and those which don't are (by // conclusion) *not* contemporary. // typedef void (*reliableSignalHandler)(...); static bool reliableSignal(int signo, reliableSignalHandler handler) { struct sigaction act; act.sa_handler = handler; sigemptyset(&act.sa_mask); act.sa_flags = 0; #ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT; #endif return (sigaction(signo, &act, 0) >= 0) ? true : false; } // reliableSignal ////////////////////////////////////////////////////////////////////////////// // If we catch a signal, we will tell the server object to graceously shut // down all services. Basically, the downServer() method just signals to end // the services as soon as possible. Eventually, after returning from the // signal handler, the kernel will terminate the current kernel call with an // EINTR error code. This then allows us very soon to check for the shutdown // flag. // extern "C" void shutDownSignalHandler() { KsServerBase::getServerObject().downServer(); } // shutDownSignalHandler ////////////////////////////////////////////////////////////////////////////// // And now for that signal I like most: the SIGPIPE. We must catch it to // prevent bad clients from killing us. Although we don't do anything in this // signal handler, this will result in the affected communication getting // aborted. And that is, what we want. // extern "C" void brokenPipeSignalHandler() { // Just do *nothing* } // brokenPipeSignalHandler ////////////////////////////////////////////////////////////////////// class KsUnixManager : public KsManager { public: KsUnixManager(int port); virtual KsString getServerVersion() const; }; ////////////////////////////////////////////////////////////////////// KsUnixManager::KsUnixManager(int port) : KsManager(port) { if ( _is_ok && initVendorTree() ) { // // We're catching some typical signals here which usually tell a process // to "hit the road". In our case we'll eventually shut down the server // graceously before exiting. // if ( !reliableSignal(SIGINT, shutDownSignalHandler) ) { PltLog::Error("KsUnixManager::KsUnixManager(): can't install SIGINT handler. Continuing..."); } if ( !reliableSignal(SIGHUP, shutDownSignalHandler) ) { PltLog::Error("KsUnixManager::KsUnixManager(): can't install SIGHUP handler. Continuing..."); } if ( !reliableSignal(SIGTERM, shutDownSignalHandler) ) { PltLog::Error("KsUnixManager::KsUnixManager(): can't install SIGTERM handler. Continuing..."); } // // Also catch that infamous SIGPIPE. // if ( !reliableSignal(SIGPIPE, brokenPipeSignalHandler) ) { PltLog::Error("KsUnixManager::KsUnixManager(): can't install SIGPIPE handler. " "Expect trouble with broken clients. Continuing..."); } } } ////////////////////////////////////////////////////////////////////// KsString KsUnixManager::getServerVersion() const { return KS_MANAGER_VERSION; } ////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { bool daemon = false; bool argsok = true; int port = KsServerBase::KS_ANYPORT; int reuseaddr = false; int idx = 0; PltLog * pLog = 0; // // parse command line // while ( ++idx < argc ) { if ( strcmp(argv[idx], "--help") == 0 ) { argsok = false; break; } else if ( strcmp(argv[idx], "--version") == 0 ) { cerr << PROG_NAME << " version " << (const char *) KS_MANAGER_VERSION << endl; return EXIT_FAILURE; } else if ( (strcmp(argv[idx], "-d") == 0) || (strcmp(argv[idx], "--detach") == 0) ) { daemon = true; } else if ( (strcmp(argv[idx], "-p") == 0) || (strcmp(argv[idx], "--port") == 0) ) { if ( ++idx < argc ) { char *endptr; port = strtol(argv[idx], &endptr, 10); if ( (argv[idx][0] == '\0') || *endptr || (port <= 0) ) { argsok = false; break; } } else { argsok = false; break; } } else if ( (strcmp(argv[idx], "-r") == 0) || (strcmp(argv[idx], "--reuseaddr") == 0) ) { reuseaddr = true; } else { argsok = false; break; } } if (!argsok) { cerr << "Usage: " << PROG_NAME << "[options]" << endl << "Runs the ACPLT/KS Manager process for un*x operating systems" << endl << endl << " -d, --detach sends ACPLT/KS manager process into background" << endl << " -p #, --port # binds the ACPLT/KS manager to port number #" << endl << " -r, --reuseaddr reuse socket address" << endl << " --help display this help and exit" << endl << " --version output version information and exit" << endl; return EXIT_FAILURE; } if ( daemon ) { // // Daemon mode is requested, detach and report to syslog // switch (fork()) { case -1: // error cerr << "fork failed: " << strerror(errno) << endl; return EXIT_FAILURE; break; case 0: // child //cerr << "fork passed (in child)" << endl; for (int i = 0; i<FD_SETSIZE; ++i) { close(i); } //cerr << "about to setpgrp()" << endl; #if PLT_SYSTEM_FREEBSD setpgid(0, 0); #else setpgrp(); #endif pLog = new PltSyslog(PROG_NAME); break; default: // parent return EXIT_SUCCESS; } } else { // // Attached mode, report to cerr. // pLog = new PltCerrLog(PROG_NAME); if (!pLog) { cerr << "Could not create log." << endl; } } // // Ok, let's go! // KsUnixManager m(port); if (m.isOk()) { m.setReuseAddr(reuseaddr); m.startServer(); if ( m.isOk() ) { PltLog::Info("KsUnixManager started."); m.run(); PltLog::Info("KsUnixManager exiting..."); } m.stopServer(); PltLog::Info("exited."); } else { PltLog::Error("KsUnixManager could not get initialized."); } if (pLog) delete pLog; return EXIT_SUCCESS; } ////////////////////////////////////////////////////////////////////// // Template instantiation: What a mess! ////////////////////////////////////////////////////////////////////// #if PLT_COMPILER_GCC #include "plt/priorityqueue_impl.h" #include "plt/hashtable_impl.h" #include "ks/array_impl.h" #include "ks/handle_impl.h" #include "ks/list_impl.h" #endif #if PLT_COMPILER_WATCOM #include "plt/priorityqueue_impl.h" #include "plt/hashtable_impl.h" #include "ks/array_impl.h" #include "ks/array_builtins.h" #include "ks/handle_impl.h" #include "ks/list_impl.h" #endif #if PLT_COMPILER_BORLAND #include "plt/priorityqueue.h" #include "plt/hashtable.h" #include "ks/array.h" #include "ks/array_builtins.h" #include "ks/handle.h" #include "ks/list.h" #endif #include "plt/comparable.h" #if PLT_INSTANTIATE_TEMPLATES template class PltAssoc<KsAuthType, KsAvTicket *(*)(XDR *)>; template class PltAssoc<KsString, PltPtrHandle<KssCommObject> >; template class PltAssoc<PltKeyPtr<KsServerDesc>, KsmServer *>; template class PltContainer<PltAssoc<KsString, PltPtrHandle<KssCommObject> > >; template class PltContainer<PltAssoc<PltKeyPtr<KsServerDesc>, KsmServer *> >; template class PltContainer<PltPtrComparable<KsTimerEvent> >; template class PltContainer_<KssCommObject>; template class PltContainer<PltAssoc<KsAuthType, KsAvTicket *(*)(XDR *)> >; template class PltContainer_<PltAssoc<KsString, PltPtrHandle<KssCommObject> > >; template class PltContainer_<PltAssoc<PltKeyPtr<KsServerDesc>, KsmServer *> >; template class PltContainer_<PltPtrComparable<KsTimerEvent> >; template class PltContainer_<PltAssoc<KsAuthType, KsAvTicket *(*)(XDR *)> >; template class PltDictionary<KsAuthType, KsAvTicket *(*)(XDR *)>; template class PltDictionary<KsString, PltPtrHandle<KssCommObject> >; template class PltDictionary<PltKeyPtr<KsServerDesc>, KsmServer *>; template class PltHandle<KssCommObject>; template class PltHandle<KssDomain>; template class PltHandle<PltHandleIterator<KssCommObject> >; template class PltHandleContainer<KssCommObject>; template class PltHandleIterator<KssCommObject>; template class PltHashIterator<KsString, PltPtrHandle<KssCommObject> >; template class PltHashIterator<PltKeyPtr<KsServerDesc>, KsmServer *>; template class PltHashTable<KsString, PltPtrHandle<KssCommObject> >; template class PltHashTable<PltKeyPtr<KsServerDesc>, KsmServer *>; template class PltHashTable_<KsString, PltPtrHandle<KssCommObject> >; template class PltHashTable_<PltKeyPtr<KsServerDesc>, KsmServer *>; template class PltIterator<PltAssoc<KsString, PltPtrHandle<KssCommObject> > >; template class PltIterator<PltAssoc<PltKeyPtr<KsServerDesc>, KsmServer *> >; template class PltIterator<PltPtrComparable<KsTimerEvent> >; template class PltIterator_<KssCommObject>; template class PltIterator_<PltAssoc<KsString, PltPtrHandle<KssCommObject> > >; template class PltIterator_<PltAssoc<PltKeyPtr<KsServerDesc>, KsmServer *> >; template class PltIterator_<PltPtrComparable<KsTimerEvent> >; template class PltHashIterator<KsAuthType, KsAvTicket *(*)(XDR *)>; template class PltHashTable<KsAuthType, KsAvTicket *(*)(XDR *)>; template class PltIterator_<PltAssoc<KsAuthType, KsAvTicket *(*)(XDR *)> >; template class PltIterator<PltAssoc<KsAuthType, KsAvTicket *(*)(XDR *)> >; template class PltHashTable_<KsAuthType, KsAvTicket *(*)(XDR *)>; template class PltKeyPtr<KsServerDesc>; template class PltPQIterator<PltPtrComparable<KsTimerEvent> >; template class PltPriorityQueue<PltPtrComparable<KsTimerEvent> >; template class PltPtrComparable<KsTimerEvent>; template class PltPtrComparable<KsmExpireServerEvent>; template class PltPtrHandle<KssCommObject>; template class PltPtrHandle<KssDomain>; template class PltPtrHandle<PltHandleIterator<KssCommObject> >; template class Plt_AtArrayNew<KssCommObject>; template class Plt_AtArrayNew<KssDomain>; template class Plt_AtArrayNew<PltHandleIterator<KssCommObject> >; template class Plt_AtNew<KssCommObject>; template class Plt_AtNew<KssDomain>; template class Plt_AtNew<PltHandleIterator<KssCommObject> >; #endif // EOF unix_manager.cpp
36.896142
106
0.618465
acplt
f707907e276729b3c66631c99a895c99f23f2a70
1,320
cc
C++
oak/client/authorization_bearer_token_metadata.cc
blaxill/oak
0f3f00b984b8c7b34fbf414a27471390ab819f8d
[ "Apache-2.0" ]
null
null
null
oak/client/authorization_bearer_token_metadata.cc
blaxill/oak
0f3f00b984b8c7b34fbf414a27471390ab819f8d
[ "Apache-2.0" ]
null
null
null
oak/client/authorization_bearer_token_metadata.cc
blaxill/oak
0f3f00b984b8c7b34fbf414a27471390ab819f8d
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2019 The Project Oak Authors * * 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 "oak/client/authorization_bearer_token_metadata.h" #include <map> #include "oak/common/policy.h" namespace oak { AuthorizationBearerTokenMetadata::AuthorizationBearerTokenMetadata( const std::string& authorization_bearer_token) : authorization_bearer_token_(authorization_bearer_token) {} grpc::Status AuthorizationBearerTokenMetadata::GetMetadata( grpc::string_ref service_url, grpc::string_ref method_name, const grpc::AuthContext& channel_auth_context, std::multimap<grpc::string, grpc::string>* metadata) { metadata->insert( std::make_pair(kOakAuthorizationBearerTokenGrpcMetadataKey, authorization_bearer_token_)); return grpc::Status::OK; } } // namespace oak
33.846154
96
0.765909
blaxill
f70799f5a78e22f9b6503ae65d04ffb807617423
213
cpp
C++
src/Engine/RHI/RHICommandList.cpp
slavidodo/game-engine
0be66b100648d28557b7755b4ab190e48cffce59
[ "Apache-2.0" ]
3
2020-02-29T05:50:59.000Z
2020-06-17T14:16:20.000Z
src/Engine/RHI/RHICommandList.cpp
slavidodo/game-engine
0be66b100648d28557b7755b4ab190e48cffce59
[ "Apache-2.0" ]
1
2020-04-23T16:36:31.000Z
2020-04-23T16:36:31.000Z
src/Engine/RHI/RHICommandList.cpp
slavidodo/game-engine
0be66b100648d28557b7755b4ab190e48cffce59
[ "Apache-2.0" ]
5
2020-04-18T08:58:37.000Z
2020-10-06T12:14:42.000Z
#include "pch.h" #include "RHICommandList.h" RHICommandListExecutor gRHICommandList; RHICommandListImmediate& RHICommandListExecutor::GetImmediateCommandList() { return gRHICommandList.ImmediateCommandList; }
19.363636
74
0.840376
slavidodo
f709ee42b49bcd717f2301868032f85c8a3a9a44
1,728
hpp
C++
sc-memory/sc-memory/sc_template_search.hpp
Zioba/sc-machine
acc578d29f983f3b05252b2e47ec543b55c43931
[ "MIT" ]
13
2016-11-15T07:22:51.000Z
2021-10-02T10:11:09.000Z
sc-memory/sc-memory/sc_template_search.hpp
fintarin/sc-machine
1419571f69063be10ca7180879489196038a3e3e
[ "MIT" ]
136
2016-11-08T20:29:39.000Z
2021-11-27T14:14:29.000Z
sc-memory/sc-memory/sc_template_search.hpp
fintarin/sc-machine
1419571f69063be10ca7180879489196038a3e3e
[ "MIT" ]
16
2016-10-31T11:30:05.000Z
2021-08-31T22:51:06.000Z
#pragma once #include "sc_template.hpp" #include "sc_template_named_struct.hpp" #include "sc_template_params.hpp" #include <limits> #include <string> class ScTemplateSearchImpl; /*! * \brief This class allows to run template based search. */ class ScTemplateSearch final { public: class Iterator { friend class ScTemplateSearch; protected: static size_t const kEndIndex = std::numeric_limits<size_t>::max(); Iterator(ScTemplateSearchImpl & search, ScTemplateNamedStruct & namedStruct, size_t idx = kEndIndex) : m_search(search) , m_struct(namedStruct) , m_index(idx) { } public: bool operator == (Iterator const & other) const; bool operator != (Iterator const & other) const; Iterator & operator ++ (); ScTemplateNamedStruct const & operator * () const; ScAddr operator[](std::string const & name) const; ScAddr operator[](ScAddr const & addr) const; private: ScTemplateSearchImpl & m_search; ScTemplateNamedStruct & m_struct; size_t m_index = std::numeric_limits<size_t>::max(); }; ScTemplateSearch(ScMemoryContext & ctx, ScTemplate const & templ, ScTemplateParams const & params = {}, ScAddr const & structAddr = ScAddr::Empty); ~ScTemplateSearch(); Iterator begin(); Iterator end(); protected: std::pair<ScTemplateNamedStruct const &, bool> DoStep(); private: void ApplyParameters(); private: ScMemoryContext & m_ctx; ScTemplate const & m_template; ScTemplatePtr m_templateWithParams; ScAddr m_structAddr; ScTemplateParams m_params; std::unique_ptr<ScTemplateSearchImpl> m_impl; ScTemplateNamedStruct m_result; };
22.441558
71
0.682292
Zioba
f70d257f885241fd8c6c8d9398b6a90568c1fab7
41,617
cc
C++
test/web_server/http/form_validation.cc
varqox/sim
b115a4e858dda1288917243e511751b835c28482
[ "MIT" ]
12
2017-11-05T21:02:58.000Z
2022-03-28T23:11:51.000Z
test/web_server/http/form_validation.cc
varqox/sim
b115a4e858dda1288917243e511751b835c28482
[ "MIT" ]
11
2017-01-05T18:11:41.000Z
2019-11-01T12:40:55.000Z
test/web_server/http/form_validation.cc
krzyk240/sim
b115a4e858dda1288917243e511751b835c28482
[ "MIT" ]
6
2016-12-25T11:22:34.000Z
2020-10-20T16:03:51.000Z
#include "src/web_server/http/form_validation.hh" #include "sim/sql_fields/blob.hh" #include "sim/sql_fields/bool.hh" #include "sim/sql_fields/varbinary.hh" #include "simlib/concat_tostr.hh" #include "simlib/enum_with_string_conversions.hh" #include "simlib/random_bytes.hh" #include "simlib/ranges.hh" #include "simlib/result.hh" #include "simlib/string_view.hh" #include "src/web_server/http/form_fields.hh" #include <cassert> #include <cstdint> #include <gtest/gtest.h> #include <initializer_list> #include <limits> #include <optional> #include <string> #include <type_traits> using std::nullopt; using std::optional; using std::string; using std::string_view; using web_server::http::ApiParam; using web_server::http::FormFields; namespace { class ValidationTest { FormFields ff; public: ValidationTest() = default; template <class T, class ResT = T> Result<ResT, string> validate(optional<string> form_field_value) { ff = FormFields{}; if (form_field_value) { ff.add_field("abc", std::move(*form_field_value)); } constexpr ApiParam<T> param_abc{"abc", "ABC"}; VALIDATE(ff, [&](auto&& errors) { return Err{errors}; }, (abc, param_abc) ); static_assert(std::is_same_v<decltype(abc), ResT>); return Ok{abc}; } template <class T, class ResT = T> Result<ResT, string> validate_allow_blank(optional<string> form_field_value) { ff = FormFields{}; if (form_field_value) { ff.add_field("abc", std::move(*form_field_value)); } constexpr ApiParam<T> param_abc{"abc", "ABC"}; VALIDATE(ff, [&](auto&& errors) { return Err{errors}; }, (abc, param_abc, ALLOW_BLANK) ); static_assert(std::is_same_v<decltype(abc), ResT>); return Ok{abc}; } template <class T, class ResT = T> Result<optional<ResT>, string> validate_allow_if(optional<string> form_field_value, bool condition) { ff = FormFields{}; if (form_field_value) { ff.add_field("abc", std::move(*form_field_value)); } constexpr ApiParam<T> param_abc{"abc", "ABC"}; VALIDATE(ff, [&](auto&& errors) { return Err{errors}; }, (abc, param_abc, ALLOW_IF(condition)) ); static_assert(std::is_same_v<decltype(abc), optional<ResT>>); return Ok{abc}; } template <class T, class ResT = T> Result<optional<ResT>, string> validate_allow_blank_allow_if(optional<string> form_field_value, bool condition) { ff = FormFields{}; if (form_field_value) { ff.add_field("abc", std::move(*form_field_value)); } constexpr ApiParam<T> param_abc{"abc", "ABC"}; VALIDATE(ff, [&](auto&& errors) { return Err{errors}; }, (abc, param_abc, ALLOW_BLANK_ALLOW_IF(condition)) ); static_assert(std::is_same_v<decltype(abc), optional<ResT>>); return Ok{abc}; } }; } // namespace constexpr size_t test_str_default_max_len = 70'000; template <class StrType> static void test_str(size_t max_len = test_str_default_max_len) { ValidationTest t; assert(max_len >= strlen("test value")); EXPECT_EQ(t.validate<StrType>("test value"), Ok{"test value"}); EXPECT_EQ(t.validate<StrType>(""), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate<StrType>(nullopt), Err{"abc: ABC is not set"}); auto str = random_bytes(max_len); EXPECT_EQ(t.validate<StrType>(str), Ok{str}); } template <class StrType> static void test_str_allow_blank(size_t max_len = test_str_default_max_len) { ValidationTest t; assert(max_len >= strlen("test value")); EXPECT_EQ(t.validate_allow_blank<StrType>("test value"), Ok{"test value"}); EXPECT_EQ(t.validate_allow_blank<StrType>(""), Ok{""}); EXPECT_EQ(t.validate_allow_blank<StrType>(nullopt), Err{"abc: ABC is not set"}); auto str = random_bytes(max_len); EXPECT_EQ(t.validate<StrType>(str), Ok{str}); } template <class StrType> static void test_str_allow_if(size_t max_len = test_str_default_max_len) { ValidationTest t; assert(max_len >= strlen("test value")); EXPECT_EQ(t.validate_allow_if<StrType>("test value", true), Ok{"test value"}); EXPECT_EQ(t.validate_allow_if<StrType>("", true), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate_allow_if<StrType>(nullopt, true), Err{"abc: ABC is not set"}); EXPECT_EQ( t.validate_allow_if<StrType>("test value", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<StrType>("", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ(t.validate_allow_if<StrType>(nullopt, false), Ok{nullopt}); auto str = random_bytes(max_len); EXPECT_EQ(t.validate_allow_if<StrType>(str, true), Ok{str}); EXPECT_EQ( t.validate_allow_if<StrType>(str, false), Err{"abc: ABC should not be sent within request at all"}); } template <class StrType> static void test_str_allow_blank_allow_if(size_t max_len = test_str_default_max_len) { ValidationTest t; assert(max_len >= strlen("test value")); EXPECT_EQ(t.validate_allow_blank_allow_if<StrType>("test value", true), Ok{"test value"}); EXPECT_EQ(t.validate_allow_blank_allow_if<StrType>("", true), Ok{""}); EXPECT_EQ( t.validate_allow_blank_allow_if<StrType>(nullopt, true), Err{"abc: ABC is not set"}); EXPECT_EQ( t.validate_allow_blank_allow_if<StrType>("test value", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<StrType>("", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ(t.validate_allow_blank_allow_if<StrType>(nullopt, false), Ok{nullopt}); auto str = random_bytes(max_len); EXPECT_EQ(t.validate_allow_if<StrType>(str, true), Ok{str}); EXPECT_EQ( t.validate_allow_if<StrType>(str, false), Err{"abc: ABC should not be sent within request at all"}); } // NOLINTNEXTLINE TEST(form_validation, cstring_view) { test_str<CStringView>(); } // NOLINTNEXTLINE TEST(form_validation, cstring_view_allow_blank) { test_str_allow_blank<CStringView>(); } // NOLINTNEXTLINE TEST(form_validation, cstring_view_allow_if) { test_str_allow_if<CStringView>(); } // NOLINTNEXTLINE TEST(form_validation, cstring_view_allow_blank_allow_if) { test_str_allow_blank_allow_if<CStringView>(); } // NOLINTNEXTLINE TEST(form_validation, sql_blob) { test_str<sim::sql_fields::Blob<>>(); } // NOLINTNEXTLINE TEST(form_validation, sql_blob_allow_blank) { test_str_allow_blank<sim::sql_fields::Blob<>>(); } // NOLINTNEXTLINE TEST(form_validation, sql_blob_allow_if) { test_str_allow_if<sim::sql_fields::Blob<>>(); } // NOLINTNEXTLINE TEST(form_validation, sql_blob_allow_blank_allow_if) { test_str_allow_blank_allow_if<sim::sql_fields::Blob<>>(); } // NOLINTNEXTLINE TEST(form_validation, sql_varbinary) { ValidationTest t; constexpr size_t max_len = 14; using T = sim::sql_fields::Varbinary<max_len>; test_str<T>(max_len); for (size_t len = 1; len < max_len + 5; ++len) { auto str = random_bytes(len); using RT = Result<string, string>; EXPECT_EQ( t.validate<T>(str), len <= max_len ? RT{Ok{str}} : RT{Err{concat_tostr("abc: ABC cannot be longer than ", max_len, " bytes")}}); } } // NOLINTNEXTLINE TEST(form_validation, sql_varbinary_allow_blank) { ValidationTest t; constexpr size_t max_len = 14; using T = sim::sql_fields::Varbinary<max_len>; test_str_allow_blank<T>(max_len); for (size_t len = 1; len < max_len + 5; ++len) { auto str = random_bytes(len); using RT = Result<string, string>; EXPECT_EQ( t.validate_allow_blank<T>(str), len <= max_len ? RT{Ok{str}} : RT{Err{concat_tostr("abc: ABC cannot be longer than ", max_len, " bytes")}}); } } // NOLINTNEXTLINE TEST(form_validation, sql_varbinary_allow_if) { ValidationTest t; constexpr size_t max_len = 14; using T = sim::sql_fields::Varbinary<max_len>; test_str_allow_if<T>(max_len); for (size_t len = 1; len < max_len + 5; ++len) { auto str = random_bytes(len); using RT = Result<string, string>; EXPECT_EQ( t.validate_allow_if<T>(str, true), len <= max_len ? RT{Ok{str}} : RT{Err{concat_tostr("abc: ABC cannot be longer than ", max_len, " bytes")}}); EXPECT_EQ( t.validate_allow_if<T>(str, false), Err{concat_tostr("abc: ABC should not be sent within request at all")}); } } // NOLINTNEXTLINE TEST(form_validation, sql_varbinary_allow_blank_allow_if) { ValidationTest t; constexpr size_t max_len = 14; using T = sim::sql_fields::Varbinary<max_len>; test_str_allow_blank_allow_if<T>(max_len); for (size_t len = 1; len < max_len + 5; ++len) { auto str = random_bytes(len); using RT = Result<string, string>; EXPECT_EQ( t.validate_allow_blank_allow_if<T>(str, true), len <= max_len ? RT{Ok{str}} : RT{Err{concat_tostr("abc: ABC cannot be longer than ", max_len, " bytes")}}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>(str, false), Err{concat_tostr("abc: ABC should not be sent within request at all")}); } } template <class Bool, class ResT = Bool> static void test_bool() { ValidationTest t; EXPECT_EQ((t.validate<Bool, ResT>("true")), Ok{true}); EXPECT_EQ((t.validate<Bool, ResT>("false")), Ok{false}); EXPECT_EQ((t.validate<Bool, ResT>("on")), Err{"abc: ABC has invalid value"}); EXPECT_EQ((t.validate<Bool, ResT>("")), Err{"abc: ABC cannot be blank"}); EXPECT_EQ((t.validate<Bool, ResT>(nullopt)), Err{"abc: ABC is not set"}); } template <class Bool, class ResT = Bool> static void test_bool_allow_blank() { ValidationTest t; EXPECT_EQ((t.validate_allow_blank<Bool, ResT>("true")), Ok{true}); EXPECT_EQ((t.validate_allow_blank<Bool, ResT>("false")), Ok{false}); EXPECT_EQ((t.validate_allow_blank<Bool, ResT>("on")), Err{"abc: ABC has invalid value"}); EXPECT_EQ((t.validate_allow_blank<Bool, ResT>("")), Err{"abc: ABC has invalid value"}); EXPECT_EQ((t.validate_allow_blank<Bool, ResT>(nullopt)), Err{"abc: ABC is not set"}); } template <class Bool, class ResT = Bool> static void test_bool_allow_if() { ValidationTest t; EXPECT_EQ((t.validate_allow_if<Bool, ResT>("true", true)), Ok{true}); EXPECT_EQ((t.validate_allow_if<Bool, ResT>("false", true)), Ok{false}); EXPECT_EQ( (t.validate_allow_if<Bool, ResT>("on", true)), Err{"abc: ABC has invalid value"}); EXPECT_EQ((t.validate_allow_if<Bool, ResT>("", true)), Err{"abc: ABC cannot be blank"}); EXPECT_EQ((t.validate_allow_if<Bool, ResT>(nullopt, true)), Err{"abc: ABC is not set"}); EXPECT_EQ( (t.validate_allow_if<Bool, ResT>("true", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( (t.validate_allow_if<Bool, ResT>("false", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( (t.validate_allow_if<Bool, ResT>("on", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( (t.validate_allow_if<Bool, ResT>("", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ((t.validate_allow_if<Bool, ResT>(nullopt, false)), Ok{nullopt}); } template <class Bool, class ResT = Bool> static void test_bool_allow_blank_allow_if() { ValidationTest t; EXPECT_EQ((t.validate_allow_blank_allow_if<Bool, ResT>("true", true)), Ok{true}); EXPECT_EQ((t.validate_allow_blank_allow_if<Bool, ResT>("false", true)), Ok{false}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>("on", true)), Err{"abc: ABC has invalid value"}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>("", true)), Err{"abc: ABC has invalid value"}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>(nullopt, true)), Err{"abc: ABC is not set"}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>("true", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>("false", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>("on", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( (t.validate_allow_blank_allow_if<Bool, ResT>("", false)), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ((t.validate_allow_blank_allow_if<Bool, ResT>(nullopt, false)), Ok{nullopt}); } // NOLINTNEXTLINE TEST(form_validation, bool) { test_bool<bool>(); } // NOLINTNEXTLINE TEST(form_validation, bool_allow_blank) { test_bool_allow_blank<bool>(); } // NOLINTNEXTLINE TEST(form_validation, bool_allow_if) { test_bool_allow_if<bool>(); } // NOLINTNEXTLINE TEST(form_validation, bool_allow_blank_allow_if) { test_bool_allow_blank_allow_if<bool>(); } // NOLINTNEXTLINE TEST(form_validation, sql_bool) { test_bool<sim::sql_fields::Bool, bool>(); } // NOLINTNEXTLINE TEST(form_validation, sql_bool_allow_blank) { test_bool_allow_blank<sim::sql_fields::Bool, bool>(); } // NOLINTNEXTLINE TEST(form_validation, sql_bool_allow_if) { test_bool_allow_if<sim::sql_fields::Bool, bool>(); } // NOLINTNEXTLINE TEST(form_validation, sql_bool_allow_blank_allow_if) { test_bool_allow_blank_allow_if<sim::sql_fields::Bool, bool>(); } template <class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> static void test_int() { ValidationTest t; using nl = std::numeric_limits<T>; auto err_val_str = Err{concat_tostr("abc: ABC is not in range [", nl::min(), ", ", nl::max(), "]")}; EXPECT_EQ(t.validate<T>("0"), Ok{T{}}); EXPECT_EQ(t.validate<T>(std::to_string(nl::min())), Ok{nl::min()}); EXPECT_EQ(t.validate<T>(std::to_string(nl::min() + 1)), Ok{nl::min() + 1}); if constexpr (std::is_signed_v<T>) { EXPECT_EQ(t.validate<T>("-1"), Ok{T{-1}}); EXPECT_EQ(t.validate<T>("-42"), Ok{T{-42}}); } EXPECT_EQ(t.validate<T>(std::to_string(nl::max())), Ok{nl::max()}); EXPECT_EQ(t.validate<T>(std::to_string(nl::max() - 1)), Ok{nl::max() - 1}); EXPECT_EQ(t.validate<T>(""), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate<T>("x"), Err{err_val_str}); EXPECT_EQ(t.validate<T>("abc"), Err{err_val_str}); EXPECT_EQ(t.validate<T>("1-1"), Err{err_val_str}); EXPECT_EQ(t.validate<T>("4.4"), Err{err_val_str}); EXPECT_EQ(t.validate<T>(nullopt), Err{"abc: ABC is not set"}); } template <class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> static void test_int_allow_blank() { ValidationTest t; using nl = std::numeric_limits<T>; auto err_val_str = Err{concat_tostr("abc: ABC is not in range [", nl::min(), ", ", nl::max(), "]")}; EXPECT_EQ(t.validate_allow_blank<T>("0"), Ok{T{}}); EXPECT_EQ(t.validate_allow_blank<T>(std::to_string(nl::min())), Ok{nl::min()}); EXPECT_EQ(t.validate_allow_blank<T>(std::to_string(nl::min() + 1)), Ok{nl::min() + 1}); if constexpr (std::is_signed_v<T>) { EXPECT_EQ(t.validate_allow_blank<T>("-1"), Ok{T{-1}}); EXPECT_EQ(t.validate_allow_blank<T>("-42"), Ok{T{-42}}); } EXPECT_EQ(t.validate_allow_blank<T>(std::to_string(nl::max())), Ok{nl::max()}); EXPECT_EQ(t.validate_allow_blank<T>(std::to_string(nl::max() - 1)), Ok{nl::max() - 1}); EXPECT_EQ(t.validate_allow_blank<T>(""), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank<T>("x"), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank<T>("abc"), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank<T>("1-1"), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank<T>("4.4"), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank<T>(nullopt), Err{"abc: ABC is not set"}); } template <class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> static void test_int_allow_if() { ValidationTest t; using nl = std::numeric_limits<T>; auto err_val_str = Err{concat_tostr("abc: ABC is not in range [", nl::min(), ", ", nl::max(), "]")}; EXPECT_EQ(t.validate_allow_if<T>("0", true), Ok{T{}}); EXPECT_EQ(t.validate_allow_if<T>(std::to_string(nl::min()), true), Ok{nl::min()}); EXPECT_EQ(t.validate_allow_if<T>(std::to_string(nl::min() + 1), true), Ok{nl::min() + 1}); if constexpr (std::is_signed_v<T>) { EXPECT_EQ(t.validate_allow_if<T>("-1", true), Ok{T{-1}}); EXPECT_EQ(t.validate_allow_if<T>("-42", true), Ok{T{-42}}); } EXPECT_EQ(t.validate_allow_if<T>(std::to_string(nl::max()), true), Ok{nl::max()}); EXPECT_EQ(t.validate_allow_if<T>(std::to_string(nl::max() - 1), true), Ok{nl::max() - 1}); EXPECT_EQ(t.validate_allow_if<T>("", true), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate_allow_if<T>("x", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_if<T>("abc", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_if<T>("1-1", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_if<T>("4.4", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_if<T>(nullopt, true), Err{"abc: ABC is not set"}); for (auto field_val : std::initializer_list<string>{ "0", std::to_string(nl::min()), std::to_string(nl::min() + 1), "-1", "-42", std::to_string(nl::max()), std::to_string(nl::max() - 1), "", "x", "abc", "1-1", "4.4"}) { EXPECT_EQ( t.validate_allow_if<T>(field_val, false), Err{"abc: ABC should not be sent within request at all"}); } EXPECT_EQ(t.validate_allow_if<T>(nullopt, false), Ok{nullopt}); } template <class T, std::enable_if_t<std::is_integral_v<T>, int> = 0> static void test_int_allow_blank_allow_if() { ValidationTest t; using nl = std::numeric_limits<T>; auto err_val_str = Err{concat_tostr("abc: ABC is not in range [", nl::min(), ", ", nl::max(), "]")}; EXPECT_EQ(t.validate_allow_blank_allow_if<T>("0", true), Ok{T{}}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>(std::to_string(nl::min()), true), Ok{nl::min()}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>(std::to_string(nl::min() + 1), true), Ok{nl::min() + 1}); if constexpr (std::is_signed_v<T>) { EXPECT_EQ(t.validate_allow_blank_allow_if<T>("-1", true), Ok{T{-1}}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("-42", true), Ok{T{-42}}); } EXPECT_EQ( t.validate_allow_blank_allow_if<T>(std::to_string(nl::max()), true), Ok{nl::max()}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>(std::to_string(nl::max() - 1), true), Ok{nl::max() - 1}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("x", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("abc", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("1-1", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("4.4", true), Err{err_val_str}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>(nullopt, true), Err{"abc: ABC is not set"}); for (auto field_val : std::initializer_list<string>{ "0", std::to_string(nl::min()), std::to_string(nl::min() + 1), "-1", "-42", std::to_string(nl::max()), std::to_string(nl::max() - 1), "", "x", "abc", "1-1", "4.4"}) { EXPECT_EQ( t.validate_allow_blank_allow_if<T>(field_val, false), Err{"abc: ABC should not be sent within request at all"}); } EXPECT_EQ(t.validate_allow_blank_allow_if<T>(nullopt, false), Ok{nullopt}); } #define test_integers(func) \ func<int>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<ssize_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<int8_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<int16_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<int32_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<int64_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ \ func<unsigned>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<size_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<uint8_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<uint16_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<uint32_t>(); /* NOLINT(bugprone-macro-parentheses) */ \ func<uint64_t>() /* NOLINT(bugprone-macro-parentheses) */ // NOLINTNEXTLINE TEST(form_validation, integers) { test_integers(test_int); } // NOLINTNEXTLINE TEST(form_validation, integers_allow_blank) { test_integers(test_int_allow_blank); } // NOLINTNEXTLINE TEST(form_validation, integers_allow_if) { test_integers(test_int_allow_if); } // NOLINTNEXTLINE TEST(form_validation, integers_allow_blank_allow_if) { test_integers(test_int_allow_blank_allow_if); } static constexpr auto predicate = [](const sim::sql_fields::Varbinary<20>& x) { return x.size % 10 == 7; }; static constexpr char predicate_description[] = "does not have length ending with 7"; // NOLINTNEXTLINE TEST(form_validation, satisfying_predicate) { ValidationTest t; using sim::sql_fields::SatisfyingPredicate; using sim::sql_fields::Varbinary; using T = SatisfyingPredicate<Varbinary<20>, predicate, predicate_description>; EXPECT_EQ(t.validate<T>("1234567"), Ok{"1234567"}); EXPECT_EQ(t.validate<T>("12345678901234567"), Ok{"12345678901234567"}); EXPECT_EQ(t.validate<T>("test"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate<T>("123456789012345678"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate<T>("1234567890123456789"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate<T>("12345678901234567890"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate<T>("123456789012345678901"), Err{"abc: ABC cannot be longer than 20 bytes"}); EXPECT_EQ(t.validate<T>(""), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate<T>(nullopt), Err{"abc: ABC is not set"}); } // NOLINTNEXTLINE TEST(form_validation, satisfying_predicate_allow_blank) { ValidationTest t; using sim::sql_fields::SatisfyingPredicate; using sim::sql_fields::Varbinary; using T = SatisfyingPredicate<Varbinary<20>, predicate, predicate_description>; EXPECT_EQ(t.validate_allow_blank<T>("1234567"), Ok{"1234567"}); EXPECT_EQ(t.validate_allow_blank<T>("12345678901234567"), Ok{"12345678901234567"}); EXPECT_EQ( t.validate_allow_blank<T>("test"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank<T>("123456789012345678"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank<T>("1234567890123456789"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank<T>("12345678901234567890"), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank<T>("123456789012345678901"), Err{"abc: ABC cannot be longer than 20 bytes"}); EXPECT_EQ( t.validate_allow_blank<T>(""), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ(t.validate_allow_blank<T>(nullopt), Err{"abc: ABC is not set"}); } // NOLINTNEXTLINE TEST(form_validation, satisfying_predicate_allow_if) { ValidationTest t; using sim::sql_fields::SatisfyingPredicate; using sim::sql_fields::Varbinary; using T = SatisfyingPredicate<Varbinary<20>, predicate, predicate_description>; EXPECT_EQ(t.validate_allow_if<T>("1234567", true), Ok{"1234567"}); EXPECT_EQ(t.validate_allow_if<T>("12345678901234567", true), Ok{"12345678901234567"}); EXPECT_EQ( t.validate_allow_if<T>("test", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_if<T>("123456789012345678", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_if<T>("1234567890123456789", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_if<T>("12345678901234567890", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_if<T>("123456789012345678901", true), Err{"abc: ABC cannot be longer than 20 bytes"}); EXPECT_EQ(t.validate_allow_if<T>("", true), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate_allow_if<T>(nullopt, true), Err{"abc: ABC is not set"}); EXPECT_EQ( t.validate_allow_if<T>("1234567", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("12345678901234567", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("test", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("123456789012345678", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("1234567890123456789", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("12345678901234567890", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("123456789012345678901", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ(t.validate_allow_if<T>(nullopt, false), Ok{nullopt}); } // NOLINTNEXTLINE TEST(form_validation, satisfying_predicate_allow_blank_allow_if) { ValidationTest t; using sim::sql_fields::SatisfyingPredicate; using sim::sql_fields::Varbinary; using T = SatisfyingPredicate<Varbinary<20>, predicate, predicate_description>; EXPECT_EQ(t.validate_allow_blank_allow_if<T>("1234567", true), Ok{"1234567"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("12345678901234567", true), Ok{"12345678901234567"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("test", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("123456789012345678", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("1234567890123456789", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("12345678901234567890", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("123456789012345678901", true), Err{"abc: ABC cannot be longer than 20 bytes"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("", true), Err{"abc: ABC does not have length ending with 7"}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>(nullopt, true), Err{"abc: ABC is not set"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("1234567", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("12345678901234567", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("test", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("123456789012345678", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("1234567890123456789", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("12345678901234567890", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("123456789012345678901", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>(nullopt, false), Ok{nullopt}); } ENUM_WITH_STRING_CONVERSIONS(TestEnum, uint16_t, (FIRST, 111, "> 1 <") (SECOND, 222, "> 2 <") (THIRD, 333, "> 3 <") ); // NOLINTNEXTLINE TEST(form_validation, enum_val_with_string_conversions) { ValidationTest t; using T = EnumVal<TestEnum>; EXPECT_EQ(t.validate<T>("> 1 <"), Ok{TestEnum::FIRST}); EXPECT_EQ(t.validate<T>("> 2 <"), Ok{TestEnum::SECOND}); EXPECT_EQ(t.validate<T>("> 3 <"), Ok{TestEnum::THIRD}); EXPECT_EQ(t.validate<T>(" > 1 <"), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate<T>("> 1 < "), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate<T>("> 1 <> 1 <"), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate<T>(""), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate<T>(nullopt), Err{"abc: ABC is not set"}); } // NOLINTNEXTLINE TEST(form_validation, enum_val_with_string_conversions_allow_blank) { ValidationTest t; using T = EnumVal<TestEnum>; EXPECT_EQ(t.validate_allow_blank<T>("> 1 <"), Ok{TestEnum::FIRST}); EXPECT_EQ(t.validate_allow_blank<T>("> 2 <"), Ok{TestEnum::SECOND}); EXPECT_EQ(t.validate_allow_blank<T>("> 3 <"), Ok{TestEnum::THIRD}); EXPECT_EQ(t.validate_allow_blank<T>(" > 1 <"), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_blank<T>("> 1 < "), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_blank<T>("> 1 <> 1 <"), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_blank<T>(""), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_blank<T>(nullopt), Err{"abc: ABC is not set"}); } // NOLINTNEXTLINE TEST(form_validation, enum_val_with_string_conversions_allow_if) { ValidationTest t; using T = EnumVal<TestEnum>; EXPECT_EQ(t.validate_allow_if<T>("> 1 <", true), Ok{TestEnum::FIRST}); EXPECT_EQ(t.validate_allow_if<T>("> 2 <", true), Ok{TestEnum::SECOND}); EXPECT_EQ(t.validate_allow_if<T>("> 3 <", true), Ok{TestEnum::THIRD}); EXPECT_EQ(t.validate_allow_if<T>(" > 1 <", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_if<T>("> 1 < ", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_if<T>("> 1 <> 1 <", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_if<T>("", true), Err{"abc: ABC cannot be blank"}); EXPECT_EQ(t.validate_allow_if<T>(nullopt, true), Err{"abc: ABC is not set"}); EXPECT_EQ( t.validate_allow_if<T>("> 1 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("> 2 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("> 3 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>(" > 1 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("> 1 < ", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("> 1 <> 1 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_if<T>("", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ(t.validate_allow_if<T>(nullopt, false), Ok{nullopt}); } // NOLINTNEXTLINE TEST(form_validation, enum_val_with_string_conversions_allow_blank_allow_if) { ValidationTest t; using T = EnumVal<TestEnum>; EXPECT_EQ(t.validate_allow_blank_allow_if<T>("> 1 <", true), Ok{TestEnum::FIRST}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("> 2 <", true), Ok{TestEnum::SECOND}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("> 3 <", true), Ok{TestEnum::THIRD}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>(" > 1 <", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 1 < ", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 1 <> 1 <", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>("", true), Err{"abc: ABC has invalid value"}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>(nullopt, true), Err{"abc: ABC is not set"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 1 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 2 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 3 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>(" > 1 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 1 < ", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("> 1 <> 1 <", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ( t.validate_allow_blank_allow_if<T>("", false), Err{"abc: ABC should not be sent within request at all"}); EXPECT_EQ(t.validate_allow_blank_allow_if<T>(nullopt, false), Ok{nullopt}); } // NOLINTNEXTLINE TEST(form_validation, enum_val_with_string_conversions_enum_caps) { auto do_validate = [&](optional<string> form_field_value, bool cap1, bool cap2, bool cap3) -> Result<EnumVal<TestEnum>, string> { FormFields ff; if (form_field_value) { ff.add_field("xyz_field", std::move(*form_field_value)); } constexpr ApiParam<EnumVal<TestEnum>> param_abc{"xyz_field", "AXBYCZ"}; VALIDATE(ff, [&](auto&& errors) { return Err{errors}; }, (abc, param_abc, ENUM_CAPS( (FIRST, cap1) (SECOND, cap2) (THIRD, cap3) )) ); static_assert(std::is_same_v<decltype(abc), EnumVal<TestEnum>>); return Ok{abc}; }; for (auto [idx, str] : enumerate_view(std::array{"> 1 <", "> 2 <", "> 3 <"})) { for (auto cap1 : {true, false}) { for (auto cap2 : {true, false}) { for (auto cap3 : {true, false}) { std::array caps = {cap1, cap2, cap3}; std::array variants = {TestEnum::FIRST, TestEnum::SECOND, TestEnum::THIRD}; using RT = Result<TestEnum, const char*>; EXPECT_EQ( do_validate(str, cap1, cap2, cap3), caps[idx] ? RT{Ok{variants[idx]}} : RT{Err{ "xyz_field: AXBYCZ selects option to which you do not have " "permission"}}) << "idx: " << idx << " caps: " << cap1 << ", " << cap2 << ", " << cap3; } } } } for (auto cap1 : {true, false}) { for (auto cap2 : {true, false}) { for (auto cap3 : {true, false}) { EXPECT_EQ( do_validate(" > 1 <", cap1, cap2, cap3), Err{"xyz_field: AXBYCZ has invalid value"}); EXPECT_EQ( do_validate("> 1 < ", cap1, cap2, cap3), Err{"xyz_field: AXBYCZ has invalid value"}); EXPECT_EQ( do_validate("> 1 <> 1 <", cap1, cap2, cap3), Err{"xyz_field: AXBYCZ has invalid value"}); EXPECT_EQ( do_validate("", cap1, cap2, cap3), Err{"xyz_field: AXBYCZ cannot be blank"}); EXPECT_EQ( do_validate(nullopt, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ is not set"}); } } } } // NOLINTNEXTLINE TEST(form_validation, enum_val_with_string_conversions_enum_caps_allow_if) { auto do_validate = [&](optional<string> form_field_value, bool condition, bool cap1, bool cap2, bool cap3) -> Result<optional<EnumVal<TestEnum>>, string> { FormFields ff; if (form_field_value) { ff.add_field("xyz_field", std::move(*form_field_value)); } constexpr ApiParam<EnumVal<TestEnum>> param_abc{"xyz_field", "AXBYCZ"}; VALIDATE(ff, [&](auto&& errors) { return Err{errors}; }, (abc, param_abc, ENUM_CAPS_ALLOW_IF(condition, (FIRST, cap1) (SECOND, cap2) (THIRD, cap3) )) ); static_assert(std::is_same_v<decltype(abc), optional<EnumVal<TestEnum>>>); return Ok{abc}; }; // ALLOW_IF condition == true for (auto [idx, str] : enumerate_view(std::array{"> 1 <", "> 2 <", "> 3 <"})) { for (auto cap1 : {true, false}) { for (auto cap2 : {true, false}) { for (auto cap3 : {true, false}) { std::array caps = {cap1, cap2, cap3}; std::array variants = {TestEnum::FIRST, TestEnum::SECOND, TestEnum::THIRD}; using RT = Result<TestEnum, const char*>; EXPECT_EQ( do_validate(str, true, cap1, cap2, cap3), caps[idx] ? RT{Ok{variants[idx]}} : RT{Err{ "xyz_field: AXBYCZ selects option to which you do not have " "permission"}}) << "idx: " << idx << " caps: " << cap1 << ", " << cap2 << ", " << cap3; } } } } for (auto cap1 : {true, false}) { for (auto cap2 : {true, false}) { for (auto cap3 : {true, false}) { EXPECT_EQ( do_validate(" > 1 <", true, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ has invalid value"}); EXPECT_EQ( do_validate("> 1 < ", true, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ has invalid value"}); EXPECT_EQ( do_validate("> 1 <> 1 <", true, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ has invalid value"}); EXPECT_EQ( do_validate("", true, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ cannot be blank"}); EXPECT_EQ( do_validate(nullopt, true, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ is not set"}); } } } // ALLOW_IF condition == false for (auto str : {"> 1 <", "> 2 <", "> 3 <"}) { for (auto cap1 : {true, false}) { for (auto cap2 : {true, false}) { for (auto cap3 : {true, false}) { EXPECT_EQ( do_validate(str, false, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ should not be sent within request at all"}) << "str: " << str << " caps: " << cap1 << ", " << cap2 << ", " << cap3; } } } } for (auto cap1 : {true, false}) { for (auto cap2 : {true, false}) { for (auto cap3 : {true, false}) { EXPECT_EQ( do_validate(" > 1 <", false, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ should not be sent within request at all"}); EXPECT_EQ( do_validate("> 1 < ", false, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ should not be sent within request at all"}); EXPECT_EQ( do_validate("> 1 <> 1 <", false, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ should not be sent within request at all"}); EXPECT_EQ( do_validate("", false, cap1, cap2, cap3), Err{"xyz_field: AXBYCZ should not be sent within request at all"}); EXPECT_EQ(do_validate(nullopt, false, cap1, cap2, cap3), Ok{nullopt}); } } } }
43.260915
95
0.619074
varqox
f70e14406b7171b81eec2a46001f9fb82f0eb7ae
12,457
hxx
C++
include/vigra/morpho_basic.hxx
ThomasWalter/vigra
e92c892aae38c3977dc3f6400f46377b0cb61799
[ "MIT" ]
null
null
null
include/vigra/morpho_basic.hxx
ThomasWalter/vigra
e92c892aae38c3977dc3f6400f46377b0cb61799
[ "MIT" ]
null
null
null
include/vigra/morpho_basic.hxx
ThomasWalter/vigra
e92c892aae38c3977dc3f6400f46377b0cb61799
[ "MIT" ]
null
null
null
// Author(s): Thomas Walter // $Date$ // $Rev$ // $URL$ #ifndef MORPHO_BASIC_HXX_ #define MORPHO_BASIC_HXX_ #include "morpho_utilities.hxx" namespace vigra{ namespace morpho{ template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement, class Functor> void morphoBasicSEOperation( Iterator1 srcUpperLeft, Iterator1 srcLowerRight, Accessor1 srca, Iterator2 destUpperLeft, Accessor2 desta, SElement & se, Functor f) { typename Accessor1::value_type neutralElement = f.neutralValue; typename Accessor1::value_type localMax; // border treatment // offsets correspond to the maximal extension of the SE. Diff2D minOffset = se.minOffset(); Diff2D maxOffset = se.maxOffset(); const Iterator1 upperLeftCorner = srcUpperLeft; const Iterator1 lowerRightCorner = srcLowerRight; const Iterator1 upperLeftCritical = srcUpperLeft - minOffset; const Iterator1 lowerRightCritical = srcLowerRight - maxOffset; for(; srcUpperLeft.y < upperLeftCritical.y; ++srcUpperLeft.y, ++destUpperLeft.y) { Iterator1 scurrent = srcUpperLeft; Iterator2 dcurrent = destUpperLeft; for(; scurrent.x < srcLowerRight.x; ++scurrent.x, ++dcurrent.x) { localMax = neutralElement; for(typename SElement::ITERATORTYPE iter = se.begin(); iter != se.end(); ++iter) { if( ( (scurrent + *iter).y >= upperLeftCorner.y) && ( (scurrent + *iter).x >= upperLeftCorner.x) && ( (scurrent + *iter).x < lowerRightCorner.x)) localMax = f(localMax, srca(scurrent + *iter)); } desta.set(localMax, dcurrent); } // end of x loop } // end for the first y-loop. for(; srcUpperLeft.y < lowerRightCritical.y; ++srcUpperLeft.y, ++destUpperLeft.y) { Iterator1 scurrent = srcUpperLeft; Iterator2 dcurrent = destUpperLeft; // x-loop: the left side for(; scurrent.x < upperLeftCritical.x; ++scurrent.x, ++dcurrent.x) { localMax = neutralElement; for(typename SElement::ITERATORTYPE iter = se.begin(); iter != se.end(); ++iter) { if( (scurrent + *iter).x >= upperLeftCorner.x ) localMax = f(localMax, srca(scurrent + *iter)); } desta.set(localMax, dcurrent); } // end of x loop (left) for(; scurrent.x < lowerRightCritical.x; ++scurrent.x, ++dcurrent.x) { localMax = neutralElement; for(typename SElement::ITERATORTYPE iter = se.begin(); iter != se.end(); ++iter) { localMax = f(localMax, srca(scurrent + *iter)); } desta.set(localMax, dcurrent); } // end of the middle x loop // the right side for(; scurrent.x < srcLowerRight.x; ++scurrent.x, ++dcurrent.x) { localMax = neutralElement; for(typename SElement::ITERATORTYPE iter = se.begin(); iter != se.end(); ++iter) { if( (scurrent + *iter).x < lowerRightCorner.x) localMax = f(localMax, srca(scurrent + *iter)); } desta.set(localMax, dcurrent); } // end of the right x loop } // end of y loop (middle) // y-loop: lower for(; srcUpperLeft.y < srcLowerRight.y; ++srcUpperLeft.y, ++destUpperLeft.y) { Iterator1 scurrent = srcUpperLeft; Iterator2 dcurrent = destUpperLeft; for(; scurrent.x < srcLowerRight.x; ++scurrent.x, ++dcurrent.x) { localMax = neutralElement; for(typename SElement::ITERATORTYPE iter = se.begin(); iter != se.end(); ++iter) { if( ( (scurrent + *iter).y < lowerRightCorner.y) && ( (scurrent + *iter).x < lowerRightCorner.x) && ( (scurrent + *iter).x >= upperLeftCorner.x) ) localMax = f(localMax, srca(scurrent + *iter)); } desta.set(localMax, dcurrent); } // end of x loop } // end for the lower y-loop. } // end of morphoBasicSEOperation ///////////////////////////////////////////////////////////////////////// // EROSION AND DILATION ///////////////////////////////////////////////////////////////////////// // Morphological dilation template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement> void morphoDilation(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se) { vigra::BasicImage<typename Accessor2::value_type> temp(dest.second - dest.first); if(se.size > 0) morphoBasicSEOperation(src.first, src.second, src.third, dest.first, dest.third, se, MaxFunctor<typename Accessor1::value_type>()); // a morphological dilation with se of size n // corresponds to n morphological dilations with size 1. for(int i = 1; i < se.size; i++) { if(i%2 == 0) morphoBasicSEOperation(temp.upperLeft(), temp.lowerRight(), temp.accessor(), dest.first, dest.third, se, MaxFunctor<typename Accessor1::value_type>()); else morphoBasicSEOperation(dest.first, dest.second, dest.third, temp.upperLeft(), temp.accessor(), se, MaxFunctor<typename Accessor1::value_type>()); } if(se.size%2 == 0) vigra::copyImage(temp.upperLeft(), temp.lowerRight(), temp.accessor(), dest.first, dest.third); } // end of dilation // Morphological erosion template<class Iterator1, class Accessor1, class Iterator2, class Accessor2,class SElement> void morphoErosion(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se) { vigra::BasicImage<typename Accessor2::value_type> temp(dest.second - dest.first); if(se.size > 0) morphoBasicSEOperation(src.first, src.second, src.third, dest.first, dest.third, se, MinFunctor<typename Accessor1::value_type>()); // a morphological erosion with se of size n // corresponds to n morphological erosions with size 1. for(int i = 1; i < se.size; i++) { if(i%2 == 0) morphoBasicSEOperation(temp.upperLeft(), temp.lowerRight(), temp.accessor(), dest.first, dest.third, se, MinFunctor<typename Accessor1::value_type>()); else morphoBasicSEOperation(dest.first, dest.second, dest.third, temp.upperLeft(), temp.accessor(), se, MinFunctor<typename Accessor1::value_type>()); } if(se.size%2 == 0) vigra::copyImage(temp.upperLeft(), temp.lowerRight(), temp.accessor(), dest.first, dest.third); } // end of erosion ///////////////////////////////////////////////////////////////////////// // OPENING AND CLOSING ///////////////////////////////////////////////////////////////////////// // Morphological opening template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement> void morphoOpening(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se) { vigra::BasicImage<typename Accessor1::value_type> temp(src.second - src.first); morphoErosion(src, vigra::destImageRange(temp), se); se.transpose(); morphoDilation(vigra::srcImageRange(temp), dest, se); se.transpose(); } // end of opening // Morphological closing template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement> void morphoClosing(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se) { vigra::BasicImage<typename Accessor1::value_type> temp(src.second - src.first); morphoDilation(src, vigra::destImageRange(temp), se); se.transpose(); morphoErosion(vigra::srcImageRange(temp), dest, se); se.transpose(); } // end of closing // Morphological gradient template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement> void morphoGradient(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se, typename Accessor2::value_type markerVal = 255) { typedef typename Accessor1::value_type INTYPE; typedef typename Accessor2::value_type OUTTYPE; vigra::BasicImage<INTYPE> dil(src.second - src.first); vigra::BasicImage<INTYPE> ero(src.second - src.first); morphoDilation(src, vigra::destImageRange(dil), se); morphoErosion(src, vigra::destImageRange(ero), se); vigra::combineTwoImages(srcImageRange(dil), srcImage(ero), destIter(dest.first, dest.third), std::minus<INTYPE>() ); } // end of morphogradient // External gradient template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement> void morphoExternalGradient(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se, typename Accessor2::value_type markerVal = 255) { typedef typename Accessor1::value_type INTYPE; typedef typename Accessor2::value_type OUTTYPE; vigra::BasicImage<INTYPE> dil(src.second - src.first); morphoDilation(src, vigra::destImageRange(dil), se); vigra::combineTwoImages(srcImageRange(dil), srcIter(src.first, src.third), destIter(dest.first, dest.third), std::minus<INTYPE>() ); } // Internal gradient template<class Iterator1, class Accessor1, class Iterator2, class Accessor2, class SElement> void morphoInternalGradient(vigra::triple<Iterator1, Iterator1, Accessor1> src, vigra::triple<Iterator2, Iterator2, Accessor2> dest, SElement se, typename Accessor2::value_type markerVal = 255) { typedef typename Accessor1::value_type INTYPE; typedef typename Accessor2::value_type OUTTYPE; vigra::BasicImage<INTYPE> ero(src.second - src.first); morphoErosion(src, vigra::destImageRange(ero), se); vigra::combineTwoImages(srcIterRange(src.first, src.second, src.third), srcImage(ero), destIter(dest.first, dest.third), std::minus<INTYPE>() ); } template<class Image1, class Image2, class SElement> void morphoInternalGradient(const Image1 & imin, Image2 & imout, SElement se) { morphoInternalGradient(srcImageRange(imin), destImageRange(imout), se); } template<class Image1, class Image2, class SElement> void morphoExternalGradient(const Image1 & imin, Image2 & imout, SElement se) { morphoExternalGradient(srcImageRange(imin), destImageRange(imout), se); } template<class Image1, class Image2, class SElement> void morphoGradient(const Image1 & imin, Image2 & imout, SElement se) { morphoGradient(srcImageRange(imin), destImageRange(imout), se); } template<class Image1, class Image2, class SElement> void morphoErosion(const Image1 & imin, Image2 & imout, SElement se) { morphoErosion(srcImageRange(imin), destImageRange(imout), se); } template<class Image1, class Image2, class SElement> void morphoDilation(const Image1 & imin, Image2 & imout, SElement se) { morphoDilation(srcImageRange(imin), destImageRange(imout), se); } // Open and close template<class Image1, class Image2, class SElement> void morphoOpening(const Image1 & imin, Image2 & imout, SElement se) { morphoOpening(srcImageRange(imin), destImageRange(imout), se); } template<class Image1, class Image2, class SElement> void morphoClosing(const Image1 & imin, Image2 & imout, SElement se) { morphoClosing(srcImageRange(imin), destImageRange(imout), se); } }; /* end of namespace morpho */ }; /* end of namespace vigra */ #endif /*BASIC_MORPHO_HXX_*/
35.899135
107
0.614353
ThomasWalter
f710dc3fae8b40712a9448929b784769526e316e
1,789
cpp
C++
sliding window/max_element_in_every_window_of_size_k.cpp
sureshmangs/Code
de91ffc7ef06812a31464fb40358e2436734574c
[ "MIT" ]
16
2020-06-02T19:22:45.000Z
2022-02-05T10:35:28.000Z
sliding window/max_element_in_every_window_of_size_k.cpp
codezoned/Code
de91ffc7ef06812a31464fb40358e2436734574c
[ "MIT" ]
null
null
null
sliding window/max_element_in_every_window_of_size_k.cpp
codezoned/Code
de91ffc7ef06812a31464fb40358e2436734574c
[ "MIT" ]
2
2020-08-27T17:40:06.000Z
2022-02-05T10:33:52.000Z
/* You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window. Example 1: Input: nums = [1,3,-1,-3,5,3,6,7], k = 3 Output: [3,3,5,5,6,7] Explanation: Window position Max --------------- ----- [1 3 -1] -3 5 3 6 7 3 1 [3 -1 -3] 5 3 6 7 3 1 3 [-1 -3 5] 3 6 7 5 1 3 -1 [-3 5 3] 6 7 5 1 3 -1 -3 [5 3 6] 7 6 1 3 -1 -3 5 [3 6 7] 7 Example 2: Input: nums = [1], k = 1 Output: [1] Example 3: Input: nums = [1,-1], k = 1 Output: [1,-1] Example 4: Input: nums = [9,11], k = 2 Output: [11] Example 5: Input: nums = [4,-2], k = 2 Output: [4] Constraints: 1 <= nums.length <= 105 -104 <= nums[i] <= 104 1 <= k <= nums.length */ class Solution { public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { vector <int> res; deque <int> maxi; int start = 0, end = 0, n = nums.size(); while (end < n) { if (maxi.empty()) maxi.push_back(nums[end]); else { while (!maxi.empty() && maxi.back() < nums[end]) { maxi.pop_back(); } maxi.push_back(nums[end]); } if (end - start + 1 < k) { end++; } else if (end - start + 1 == k) { res.push_back(maxi.front()); if (maxi.front() == nums[start]) maxi.pop_front(); start++; end++; } } return res; } };
22.08642
97
0.456121
sureshmangs
f7136b6d97f4371deca47d1160179d2aaed27798
1,951
cxx
C++
Libraries/ITK/RegistrationToolbox/Commands/itkVnlIterationUpdateCommand.cxx
NifTK/NifTK
2358b333c89ff1bba1c232eecbbcdc8003305dfe
[ "BSD-3-Clause" ]
13
2018-07-28T13:36:38.000Z
2021-11-01T19:17:39.000Z
Libraries/ITK/RegistrationToolbox/Commands/itkVnlIterationUpdateCommand.cxx
NifTK/NifTK
2358b333c89ff1bba1c232eecbbcdc8003305dfe
[ "BSD-3-Clause" ]
null
null
null
Libraries/ITK/RegistrationToolbox/Commands/itkVnlIterationUpdateCommand.cxx
NifTK/NifTK
2358b333c89ff1bba1c232eecbbcdc8003305dfe
[ "BSD-3-Clause" ]
10
2018-08-20T07:06:00.000Z
2021-07-07T07:55:27.000Z
/*============================================================================= NifTK: A software platform for medical image computing. Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt in the top level directory for details. =============================================================================*/ #ifndef __itkVnlIterationUpdateCommand_cxx #define __itkVnlIterationUpdateCommand_cxx #include <sstream> #include "itkVnlIterationUpdateCommand.h" #include <itkUCLMacro.h> namespace itk { /** * Constructor. */ VnlIterationUpdateCommand::VnlIterationUpdateCommand() { niftkitkDebugMacro("VnlIterationUpdateCommand():Constructed"); } void VnlIterationUpdateCommand::DoExecute(const itk::Object * object, const itk::EventObject & event) { if( ! itk::IterationEvent().CheckEvent( &event ) ) { return; } OptimizerPointer optimizer; try { optimizer = dynamic_cast< OptimizerPointer >( object ); } catch( std::exception & err ) { std::string msg = "Failed to dynamic_cast optimizer"; niftkitkErrorMacro(<< msg); throw err; } if (optimizer == 0) { std::string msg = "Failed to cast optimizer, pointer is null"; niftkitkErrorMacro(<< msg); } // To track registraiton, we used the cached value. // When the VNL optimizer exits, it sets the normal // values so GetCurrentValue and GetCurrentPosition will work. ParametersType parameters = optimizer->GetCachedCurrentPosition(); MeasureType measure = optimizer->GetCachedValue(); if (parameters.GetSize() > 20) { niftkitkInfoMacro(<<"DoExecute():" << measure ); } else { niftkitkInfoMacro(<<"DoExecute():" << measure << " : " << parameters); } } } // end namespace #endif
25.337662
101
0.639159
NifTK
f71c044ca5230e44fdd9acf425bf63024d88d963
1,520
hpp
C++
RealtekCardReader/OSDictionary.hpp
MK-986123/RealtekCardReader
0b1a4c66082b63d057cba2a54721b62cbf11c0ac
[ "BSD-3-Clause" ]
106
2021-07-16T03:27:28.000Z
2022-03-31T15:35:50.000Z
RealtekCardReader/OSDictionary.hpp
MK-986123/RealtekCardReader
0b1a4c66082b63d057cba2a54721b62cbf11c0ac
[ "BSD-3-Clause" ]
28
2021-07-16T09:03:10.000Z
2022-03-28T03:36:47.000Z
RealtekCardReader/OSDictionary.hpp
MK-986123/RealtekCardReader
0b1a4c66082b63d057cba2a54721b62cbf11c0ac
[ "BSD-3-Clause" ]
14
2021-07-16T16:15:09.000Z
2022-02-24T22:08:21.000Z
// // OSDictionary.hpp // RealtekCardReader // // Created by FireWolf on 8/25/21. // #ifndef OSDictionary_hpp #define OSDictionary_hpp #include <libkern/c++/OSDictionary.h> static inline bool OSDictionaryAddStringToDictionary(OSDictionary* dictionary, const char* key, const char* value) { OSString* v = OSString::withCString(value); if (v == nullptr) { return false; } bool retVal = dictionary->setObject(key, v); v->release(); return retVal; } static inline bool OSDictionaryAddDataToDictionary(OSDictionary* dictionary, const char* key, const void* bytes, IOByteCount length) { OSData* data = OSData::withBytes(bytes, static_cast<UInt32>(length)); if (data == nullptr) { return false; } bool retVal = dictionary->setObject(key, data); data->release(); return retVal; } template <size_t N> static inline bool OSDictionaryAddDataToDictionary(OSDictionary* dictionary, const char* key, const UInt8 (&bytes)[N]) { return OSDictionaryAddDataToDictionary(dictionary, key, bytes, N); } template <typename T> static inline bool OSDictionaryAddIntegerToDictionary(OSDictionary* dictionary, const char* key, T interger) { OSNumber* number = OSNumber::withNumber(interger, sizeof(T) * 8); if (number == nullptr) { return false; } bool retVal = dictionary->setObject(key, number); number->release(); return retVal; } #endif /* OSDictionary_hpp */
22.028986
132
0.668421
MK-986123
f71d4e2f8dbb897afda6b9ea53cdb4ce0fcf05f5
1,741
cpp
C++
examples/05-user-data/05-user-data.cpp
UofUEpi/epiworld
a510644b05803f8c617dfcb7a909805649da3eb2
[ "MIT" ]
null
null
null
examples/05-user-data/05-user-data.cpp
UofUEpi/epiworld
a510644b05803f8c617dfcb7a909805649da3eb2
[ "MIT" ]
null
null
null
examples/05-user-data/05-user-data.cpp
UofUEpi/epiworld
a510644b05803f8c617dfcb7a909805649da3eb2
[ "MIT" ]
null
null
null
#define EPI_DEBUG #include "../../include/epiworld/epiworld.hpp" int main() { // Setting up model -------------------------------------------------------- epiworld::Model<> model; model.add_status("Susceptible", epiworld::default_update_susceptible<>); model.add_status("Exposed", epiworld::default_update_exposed<>); model.add_status("Removed"); model.set_user_data({"agent_id", "virus_id"}); model.agents_from_adjlist( epiworld::rgraph_smallworld(200, 5, .1, false, model) ); model.add_param(.9, "infectiousness"); model.add_param(.3, "recovery"); // Setting up virus -------------------------------------------------------- epiworld::Virus<> v("covid"); v.set_status(1,2,2); EPI_NEW_POSTRECOVERYFUN_LAMBDA(immunity, int) { // Post immunity auto Tpr = m->get_tools()[1u]; p->add_tool(Tpr); m->add_user_data({ static_cast< epiworld_double >(p->get_id()), static_cast< epiworld_double >(v.get_id()) }); }; v.set_post_recovery(immunity); v.set_prob_infecting(&model("infectiousness")); // Setting up tool --------------------------------------------------------- epiworld::Tool<> is("immune system"); is.set_susceptibility_reduction(.3); is.set_death_reduction(.9); is.set_recovery_enhancer(&model("recovery")); epiworld::Tool<> postImm("post immunity"); postImm.set_susceptibility_reduction(1.0); model.add_tool(is, 1.0); model.add_tool_n(postImm, 0u); model.add_virus_n(v, 5); model.init(112, 30); model.run(); model.print(); model.get_user_data().print(); model.get_user_data().write("user-data.txt"); }
26.378788
80
0.568639
UofUEpi
f72091dca8e7fb261fe502acf355fa27d093a6b7
6,638
cpp
C++
include/opensslpp/crypto.cpp
diegomazala/openssl_cpp
92f224834baa88a6c915219da50a4942aebee677
[ "MIT" ]
null
null
null
include/opensslpp/crypto.cpp
diegomazala/openssl_cpp
92f224834baa88a6c915219da50a4942aebee677
[ "MIT" ]
null
null
null
include/opensslpp/crypto.cpp
diegomazala/openssl_cpp
92f224834baa88a6c915219da50a4942aebee677
[ "MIT" ]
null
null
null
#include "crypto.h" #include <openssl/evp.h> #include <fstream> #include <sstream> #include <iostream> #include <vector> #include <opensslpp/base64.h> #include <opensslpp/aes_cbc.h> void base64_encode(const void* in_data, int in_length, char** out_data, int& out_length) { const auto pl = 4 * ((in_length + 2) / 3); *out_data = reinterpret_cast<char*>(calloc(pl + 1, 1)); //+1 for the terminating null that EVP_EncodeBlock adds on out_length = EVP_EncodeBlock(reinterpret_cast<unsigned char*>(*out_data), reinterpret_cast<const unsigned char*>(in_data), in_length); } void base64_decode(const void* in_data, int in_length, unsigned char** out_data, int& out_length) { const auto pl = 3 * in_length / 4; *out_data = reinterpret_cast<unsigned char*>(calloc(pl + 1, 1)); out_length = EVP_DecodeBlock(*out_data, reinterpret_cast<const unsigned char*>(in_data), in_length); } bool base64_encode_text_file(const char* in_filename, const char* out_filename) { try { std::ifstream in_file(in_filename, std::ifstream::in); std::stringstream in_buffer; in_buffer << in_file.rdbuf(); std::vector<uint8_t> decoded_str; std::copy(std::istream_iterator<uint8_t>(in_buffer), std::istream_iterator<uint8_t>(), std::back_inserter(decoded_str)); const std::string encoded = opensslpp::Base64::encode(decoded_str); std::ofstream out_file(out_filename, std::ifstream::out); out_file << encoded; return true; } catch (const std::exception& e) { std::cout << "Error: Could not encode " << in_filename << std::endl; return false; } } bool base64_decode_text_file(const char* in_filename, const char* out_filename) { try { std::ifstream in_file(in_filename, std::ifstream::in); std::stringstream in_buffer; in_buffer << in_file.rdbuf(); const std::vector<uint8_t> decoded = opensslpp::Base64::decode(in_buffer.str()); std::string decoded_str(decoded.begin(), decoded.end()); std::ofstream out_file(out_filename, std::ifstream::out); out_file << decoded_str; } catch (const std::exception& e) { std::cout << "Error: Could not decode " << in_filename << std::endl; return false; } } bool aes_cbc_create_key(const char* out_filename) { try { auto newAes = opensslpp::Aes256Cbc::createNewKey(); if (newAes == nullptr) throw; std::ofstream out_file(out_filename, std::ifstream::out | std::ios::binary); out_file.write(reinterpret_cast<const char*>(newAes->key().data()), newAes->key().size()); out_file.close(); return true; } catch (const std::exception& e) { std::cout << "Error: Could not generate key "<< std::endl; return false; } } bool aes_cbc_encode_to_file( const char* in_filename_data, const char* in_filename_key, const char* out_filename_data) { try { std::vector<uint8_t> in_data; { std::ifstream in_file_data(in_filename_data, std::ifstream::in | std::ifstream::binary); in_file_data.seekg (0, in_file_data.end); int length = in_file_data.tellg(); in_file_data.seekg (0, in_file_data.beg); in_data.resize(length); in_file_data.read(reinterpret_cast<char*>(&in_data[0]), length); in_file_data.close(); } opensslpp::Aes256Cbc::Key key; { std::ifstream in_file_key(in_filename_key, std::ifstream::in | std::ifstream::binary); in_file_key.seekg (0, in_file_key.end); int length = in_file_key.tellg(); in_file_key.seekg (0, in_file_key.beg); char* buffer = new char[length]; in_file_key.read(buffer, length); in_file_key.close(); std::memcpy(key.data(), buffer, length); delete[] buffer; } auto aes = opensslpp::Aes256Cbc::createWithKey(key); std::vector<uint8_t> cipher; if (!aes->encrypt(in_data.data(), in_data.size(), cipher)) throw; std::ofstream out_file_data(out_filename_data, std::ios::out | std::ios::binary); out_file_data.write(reinterpret_cast<const char*>(cipher.data()), cipher.size()); return true; } catch (const std::exception& e) { std::cout << "Error: Could not encode " << in_filename_data << std::endl; return false; } } bool aes_cbc_decode_to_file( const char* in_filename_data, const char* in_filename_key, const char* out_filename_data) { try { std::vector<uint8_t> cipher; { std::ifstream in_file_data(in_filename_data, std::ios::in | std::ios::binary | std::ios::ate); auto fsize = in_file_data.tellg(); in_file_data.seekg(0, std::ios::beg); cipher.resize(fsize); in_file_data.read(reinterpret_cast<char*>(&cipher[0]), fsize); } opensslpp::Aes256Cbc::Key key; std::ifstream in_file_key(in_filename_key, std::ifstream::in | std::ifstream::binary); in_file_key.seekg (0, in_file_key.end); int length = in_file_key.tellg(); in_file_key.seekg (0, in_file_key.beg); char* buffer = new char[length]; in_file_key.read(buffer, length); in_file_key.close(); std::memcpy(key.data(), buffer, length); auto aes = opensslpp::Aes256Cbc::createWithKey(key); delete[] buffer; std::vector<uint8_t> decoded; if (!aes->decrypt(cipher, decoded)) throw("Exception: Failed decrypting"); std::ofstream out_file_data(out_filename_data, std::ios::out | std::ios::binary); out_file_data.write(reinterpret_cast<const char*>(decoded.data()), decoded.size()); } catch (const std::exception& e) { std::cout << "Error: Could not decode " << in_filename_data << std::endl << e.what() << std::endl; return false; } } int aes_cbc_decode_to_str( const char* in_filename_data, const char* in_filename_key, char* out_decoded_data) { try { std::vector<uint8_t> cipher; { std::ifstream in_file_data(in_filename_data, std::ios::in | std::ios::binary | std::ios::ate); auto fsize = in_file_data.tellg(); in_file_data.seekg(0, std::ios::beg); cipher.resize(fsize); in_file_data.read(reinterpret_cast<char*>(&cipher[0]), fsize); } opensslpp::Aes256Cbc::Key key; std::ifstream in_file_key(in_filename_key, std::ifstream::in | std::ifstream::binary); in_file_key.seekg (0, in_file_key.end); int length = in_file_key.tellg(); in_file_key.seekg (0, in_file_key.beg); char* buffer = new char[length]; in_file_key.read(buffer, length); in_file_key.close(); std::memcpy(key.data(), buffer, length); auto aes = opensslpp::Aes256Cbc::createWithKey(key); delete[] buffer; std::vector<uint8_t> decoded; if (!aes->decrypt(cipher, decoded)) throw("Exception: Failed decrypting"); decoded.push_back('\0'); memcpy(out_decoded_data, decoded.data(), decoded.size()); return decoded.size(); } catch (const std::exception& e) { std::cout << "Error: Could not decode " << in_filename_data << std::endl << e.what() << std::endl; return 0; } }
28.127119
135
0.701115
diegomazala
f721e3b455a26c11b74668aa59fdd8d97888931a
3,384
cpp
C++
DivaHook/src/Components/ComponentsManager.cpp
nastys/TotallyLegitArcadeController
06a98ed5af55245265e3e13ccc44fb5e364b7d07
[ "MIT" ]
null
null
null
DivaHook/src/Components/ComponentsManager.cpp
nastys/TotallyLegitArcadeController
06a98ed5af55245265e3e13ccc44fb5e364b7d07
[ "MIT" ]
null
null
null
DivaHook/src/Components/ComponentsManager.cpp
nastys/TotallyLegitArcadeController
06a98ed5af55245265e3e13ccc44fb5e364b7d07
[ "MIT" ]
null
null
null
#include "ComponentsManager.h" #include "Input/InputEmulator.h" #include "Input/TouchSliderEmulator.h" #include "Input/TouchPanelEmulator.h" #include "SysTimer.h" #include "PlayerDataManager.h" #include "FrameRateManager.h" #include "StageManager.h" #include "FastLoader.h" #include "../FileSystem/ConfigFile.h" #include "../MainModule.h" #include "../Constants.h" using ConfigFile = DivaHook::FileSystem::ConfigFile; namespace DivaHook::Components { typedef void EngineUpdateInput(void*); ComponentsManager::ComponentsManager() { } ComponentsManager::~ComponentsManager() { } void ComponentsManager::ParseAddComponents() { EmulatorComponent *allComponents[] { new InputEmulator(), new TouchSliderEmulator(), new TouchPanelEmulator(), new SysTimer(), new PlayerDataManager(), new FrameRateManager(), new StageManager(), new FastLoader(), }; ConfigFile componentsConfig(MainModule::GetModuleDirectory(), COMPONENTS_CONFIG_FILE_NAME); bool success = componentsConfig.OpenRead(); if (!success) { printf("ComponentsManager::ParseAddComponents(): Unable to parse %s\n", COMPONENTS_CONFIG_FILE_NAME.c_str()); return; } size_t componentCount = sizeof(allComponents) / sizeof(EmulatorComponent*); components.reserve(componentCount); std::string trueString = "true", falseString = "false"; for (int i = 0; i < componentCount; i++) { std::string *value; auto name = allComponents[i]->GetDisplayName(); //printf("ComponentsManager::ParseAddComponents(): searching name: %s\n", name); if (componentsConfig.TryGetValue(name, value)) { //printf("ComponentsManager::ParseAddComponents(): %s found\n", name); if (*value == trueString) { //printf("ComponentsManager::ParseAddComponents(): enabling %s...\n", name); components.push_back(allComponents[i]); } else if (*value == falseString) { //printf("ComponentsManager::ParseAddComponents(): disabling %s...\n", name); } else { //printf("ComponentsManager::ParseAddComponents(): invalid value %s for component %s\n", value, name); } delete value; } else { //printf("ParseAddComponents(): component %s not found\n", name); delete allComponents[i]; } } } void ComponentsManager::Initialize() { ParseAddComponents(); updateStopwatch.Start(); for (auto& component : components) component->Initialize(this); } void ComponentsManager::Update() { elpasedTime = updateStopwatch.Restart(); for (auto& component : components) { component->SetElapsedTime(elpasedTime); component->Update(); } } void ComponentsManager::UpdateInput() { if (!GetIsInputEmulatorUsed()) { uint64_t* inputStatePtr = (uint64_t*)INPUT_STATE_PTR_ADDRESS; // poll input using the original PollInput function we overwrote with the update hook instead if (inputStatePtr != nullptr) ((EngineUpdateInput*)ENGINE_UPDATE_INPUT_ADDRESS)((void*)*inputStatePtr); } for (auto& component : components) component->UpdateInput(); } void ComponentsManager::OnFocusGain() { for (auto& component : components) component->OnFocusGain(); } void ComponentsManager::OnFocusLost() { for (auto& component : components) component->OnFocusLost(); } void ComponentsManager::Dispose() { for (auto& component : components) delete component; } }
23.5
112
0.700059
nastys
f7229501e16429503d676776cccbfb96cdc2de77
614
cpp
C++
539.move-zeroes.cpp
DeepDuke/Lintcode-Solution
7c92d03f1267ed84e26180fdeb8abdfc67708019
[ "MIT" ]
null
null
null
539.move-zeroes.cpp
DeepDuke/Lintcode-Solution
7c92d03f1267ed84e26180fdeb8abdfc67708019
[ "MIT" ]
null
null
null
539.move-zeroes.cpp
DeepDuke/Lintcode-Solution
7c92d03f1267ed84e26180fdeb8abdfc67708019
[ "MIT" ]
null
null
null
class Solution { public: /** * @param nums: an integer array * @return: nothing */ void moveZeroes(vector<int> &nums) { // write your code here int swap_pos = 0; for(int i = 0; i < nums.size(); i++){ if(nums[i] == 0){ if(swap_pos < i) swap_pos = i+1; // find non-zero after i for(; swap_pos < nums.size(); swap_pos++){ if(nums[swap_pos] != 0){ swap(nums[i], nums[swap_pos]); break; } } } } } };
27.909091
74
0.395765
DeepDuke
f7250e8105189b956314e2cbc4d61514bd07b97a
6,363
cpp
C++
ocr/src/v20181119/model/RideHailingTransportLicenseOCRResponse.cpp
sinjoywong/tencentcloud-sdk-cpp
1b931d20956a90b15a6720f924e5c69f8786f9f4
[ "Apache-2.0" ]
null
null
null
ocr/src/v20181119/model/RideHailingTransportLicenseOCRResponse.cpp
sinjoywong/tencentcloud-sdk-cpp
1b931d20956a90b15a6720f924e5c69f8786f9f4
[ "Apache-2.0" ]
null
null
null
ocr/src/v20181119/model/RideHailingTransportLicenseOCRResponse.cpp
sinjoywong/tencentcloud-sdk-cpp
1b931d20956a90b15a6720f924e5c69f8786f9f4
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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 <tencentcloud/ocr/v20181119/model/RideHailingTransportLicenseOCRResponse.h> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> using TencentCloud::CoreInternalOutcome; using namespace TencentCloud::Ocr::V20181119::Model; using namespace std; RideHailingTransportLicenseOCRResponse::RideHailingTransportLicenseOCRResponse() : m_operationLicenseNumberHasBeenSet(false), m_vehicleOwnerHasBeenSet(false), m_vehicleNumberHasBeenSet(false), m_startDateHasBeenSet(false), m_endDateHasBeenSet(false), m_releaseDateHasBeenSet(false) { } CoreInternalOutcome RideHailingTransportLicenseOCRResponse::Deserialize(const string &payload) { rapidjson::Document d; d.Parse(payload.c_str()); if (d.HasParseError() || !d.IsObject()) { return CoreInternalOutcome(Error("response not json format")); } if (!d.HasMember("Response") || !d["Response"].IsObject()) { return CoreInternalOutcome(Error("response `Response` is null or not object")); } rapidjson::Value &rsp = d["Response"]; if (!rsp.HasMember("RequestId") || !rsp["RequestId"].IsString()) { return CoreInternalOutcome(Error("response `Response.RequestId` is null or not string")); } string requestId(rsp["RequestId"].GetString()); SetRequestId(requestId); if (rsp.HasMember("Error")) { if (!rsp["Error"].IsObject() || !rsp["Error"].HasMember("Code") || !rsp["Error"]["Code"].IsString() || !rsp["Error"].HasMember("Message") || !rsp["Error"]["Message"].IsString()) { return CoreInternalOutcome(Error("response `Response.Error` format error").SetRequestId(requestId)); } string errorCode(rsp["Error"]["Code"].GetString()); string errorMsg(rsp["Error"]["Message"].GetString()); return CoreInternalOutcome(Error(errorCode, errorMsg).SetRequestId(requestId)); } if (rsp.HasMember("OperationLicenseNumber") && !rsp["OperationLicenseNumber"].IsNull()) { if (!rsp["OperationLicenseNumber"].IsString()) { return CoreInternalOutcome(Error("response `OperationLicenseNumber` IsString=false incorrectly").SetRequestId(requestId)); } m_operationLicenseNumber = string(rsp["OperationLicenseNumber"].GetString()); m_operationLicenseNumberHasBeenSet = true; } if (rsp.HasMember("VehicleOwner") && !rsp["VehicleOwner"].IsNull()) { if (!rsp["VehicleOwner"].IsString()) { return CoreInternalOutcome(Error("response `VehicleOwner` IsString=false incorrectly").SetRequestId(requestId)); } m_vehicleOwner = string(rsp["VehicleOwner"].GetString()); m_vehicleOwnerHasBeenSet = true; } if (rsp.HasMember("VehicleNumber") && !rsp["VehicleNumber"].IsNull()) { if (!rsp["VehicleNumber"].IsString()) { return CoreInternalOutcome(Error("response `VehicleNumber` IsString=false incorrectly").SetRequestId(requestId)); } m_vehicleNumber = string(rsp["VehicleNumber"].GetString()); m_vehicleNumberHasBeenSet = true; } if (rsp.HasMember("StartDate") && !rsp["StartDate"].IsNull()) { if (!rsp["StartDate"].IsString()) { return CoreInternalOutcome(Error("response `StartDate` IsString=false incorrectly").SetRequestId(requestId)); } m_startDate = string(rsp["StartDate"].GetString()); m_startDateHasBeenSet = true; } if (rsp.HasMember("EndDate") && !rsp["EndDate"].IsNull()) { if (!rsp["EndDate"].IsString()) { return CoreInternalOutcome(Error("response `EndDate` IsString=false incorrectly").SetRequestId(requestId)); } m_endDate = string(rsp["EndDate"].GetString()); m_endDateHasBeenSet = true; } if (rsp.HasMember("ReleaseDate") && !rsp["ReleaseDate"].IsNull()) { if (!rsp["ReleaseDate"].IsString()) { return CoreInternalOutcome(Error("response `ReleaseDate` IsString=false incorrectly").SetRequestId(requestId)); } m_releaseDate = string(rsp["ReleaseDate"].GetString()); m_releaseDateHasBeenSet = true; } return CoreInternalOutcome(true); } string RideHailingTransportLicenseOCRResponse::GetOperationLicenseNumber() const { return m_operationLicenseNumber; } bool RideHailingTransportLicenseOCRResponse::OperationLicenseNumberHasBeenSet() const { return m_operationLicenseNumberHasBeenSet; } string RideHailingTransportLicenseOCRResponse::GetVehicleOwner() const { return m_vehicleOwner; } bool RideHailingTransportLicenseOCRResponse::VehicleOwnerHasBeenSet() const { return m_vehicleOwnerHasBeenSet; } string RideHailingTransportLicenseOCRResponse::GetVehicleNumber() const { return m_vehicleNumber; } bool RideHailingTransportLicenseOCRResponse::VehicleNumberHasBeenSet() const { return m_vehicleNumberHasBeenSet; } string RideHailingTransportLicenseOCRResponse::GetStartDate() const { return m_startDate; } bool RideHailingTransportLicenseOCRResponse::StartDateHasBeenSet() const { return m_startDateHasBeenSet; } string RideHailingTransportLicenseOCRResponse::GetEndDate() const { return m_endDate; } bool RideHailingTransportLicenseOCRResponse::EndDateHasBeenSet() const { return m_endDateHasBeenSet; } string RideHailingTransportLicenseOCRResponse::GetReleaseDate() const { return m_releaseDate; } bool RideHailingTransportLicenseOCRResponse::ReleaseDateHasBeenSet() const { return m_releaseDateHasBeenSet; }
32.464286
134
0.702656
sinjoywong
f72764eef2ed23453b607e761d39bff72d60eb78
383
hpp
C++
src/config/config.hpp
rengglian/DataTransformation
afc19d072397b06fa6779c6d2bb0be1f96fd16ed
[ "MIT" ]
null
null
null
src/config/config.hpp
rengglian/DataTransformation
afc19d072397b06fa6779c6d2bb0be1f96fd16ed
[ "MIT" ]
null
null
null
src/config/config.hpp
rengglian/DataTransformation
afc19d072397b06fa6779c6d2bb0be1f96fd16ed
[ "MIT" ]
null
null
null
#pragma once #include <fstream> #include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; class Config { public: Config(std::string fileName); ~Config(); void Read(); const std::string GetDataFile() {return data_path;}; const std::string GetTargetFile() {return target_path;}; private: std::string data_path; std::string target_path; };
15.32
58
0.691906
rengglian
f727dc1beb31a63e51311178d85bceaf85788a92
415
hpp
C++
ParticlePlay/Core/Physics.hpp
spywhere/Legacy-ParticlePlay
0c1ec6e4706f72b64e0408cc79cdeffce535b484
[ "BSD-3-Clause" ]
null
null
null
ParticlePlay/Core/Physics.hpp
spywhere/Legacy-ParticlePlay
0c1ec6e4706f72b64e0408cc79cdeffce535b484
[ "BSD-3-Clause" ]
null
null
null
ParticlePlay/Core/Physics.hpp
spywhere/Legacy-ParticlePlay
0c1ec6e4706f72b64e0408cc79cdeffce535b484
[ "BSD-3-Clause" ]
null
null
null
#ifndef PHYSICS_HEADER #define PHYSICS_HEADER #include <ParticlePlay/Includes.hpp> class ppPhysics{ protected: float ptm; b2World* world; public: ppPhysics(float gx, float gy); b2World* GetWorld(); // ppEffect* GetEffect(); void Update(int delta); void UpdateAllBody(); void SetPTM(float ptm); float GetPTM(); float PixelToWorld(float pixel); float WorldToPixel(float world); ~ppPhysics(); }; #endif
17.291667
36
0.737349
spywhere
f7281280a628f1e9932aa7768b413e7b86cb15c1
3,196
cpp
C++
Practice/2018/2018.11.28/BZOJ3235.cpp
SYCstudio/OI
6e9bfc17dbd4b43467af9b19aa2aed41e28972fa
[ "MIT" ]
4
2017-10-31T14:25:18.000Z
2018-06-10T16:10:17.000Z
Practice/2018/2018.11.28/BZOJ3235.cpp
SYCstudio/OI
6e9bfc17dbd4b43467af9b19aa2aed41e28972fa
[ "MIT" ]
null
null
null
Practice/2018/2018.11.28/BZOJ3235.cpp
SYCstudio/OI
6e9bfc17dbd4b43467af9b19aa2aed41e28972fa
[ "MIT" ]
null
null
null
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define mem(Arr,x) memset(Arr,x,sizeof(Arr)) const int maxN=1010; const int Mod=10007; const int inf=2147483647; int n; char Mp[maxN][maxN]; int Up[maxN][maxN],Down[maxN][maxN]; int F1[maxN][maxN],F2[maxN][maxN],F3[maxN][maxN],F4[maxN][maxN]; pair<int,int> Q[maxN]; int main(){ scanf("%d",&n); for (int i=1;i<=n;i++) scanf("%s",Mp[i]+1); for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) if (Mp[i][j]=='B') Up[i][j]=Up[i-1][j]+1; for (int i=n;i>=1;i--) for (int j=1;j<=n;j++) if (Mp[i][j]=='B') Down[i][j]=Down[i+1][j]+1; for (int i=1;i<=n;i++){ int top=1,sum=Mod-1;Q[1]=make_pair(0,0); for (int j=1;j<=n;j++){ while ((top)&&(Q[top].second>=Up[i][j])){ sum=(sum-1ll*Q[top].second*(Q[top].first-Q[top-1].first)%Mod+Mod)%Mod; --top; } Q[++top]=make_pair(j,Up[i][j]); sum=(sum+1ll*Q[top].second*(Q[top].first-Q[top-1].first)%Mod)%Mod; if (Mp[i][j]=='B') F1[i][j]=sum; } top=1;sum=Mod-1;Q[1]=make_pair(n+1,0); for (int j=n;j>=1;j--){ while ((top)&&(Q[top].second>=Up[i][j])){ sum=(sum-1ll*Q[top].second*(Q[top-1].first-Q[top].first)%Mod+Mod)%Mod; --top; } Q[++top]=make_pair(j,Up[i][j]); sum=(sum+1ll*Q[top].second*(Q[top-1].first-Q[top].first)%Mod)%Mod; if (Mp[i][j]=='B') F2[i][j]=sum; } top=1;sum=Mod-1;Q[1]=make_pair(0,0); for (int j=1;j<=n;j++){ while ((top)&&(Q[top].second>=Down[i][j])){ sum=(sum-1ll*Q[top].second*(Q[top].first-Q[top-1].first)%Mod+Mod)%Mod; --top; } Q[++top]=make_pair(j,Down[i][j]); sum=(sum+1ll*Q[top].second*(Q[top].first-Q[top-1].first)%Mod)%Mod; if (Mp[i][j]=='B') F3[i][j]=sum; } top=1;sum=Mod-1;Q[1]=make_pair(n+1,0); for (int j=n;j>=1;j--){ while ((top)&&(Q[top].second>=Down[i][j])){ sum=(sum-1ll*Q[top].second*(Q[top-1].first-Q[top].first)%Mod+Mod)%Mod; --top; } Q[++top]=make_pair(j,Down[i][j]); sum=(sum+1ll*Q[top].second*(Q[top-1].first-Q[top].first)%Mod)%Mod; if (Mp[i][j]=='B') F4[i][j]=sum; } } /* for (int i=1;i<=n;i++){ for (int j=1;j<=n;j++) cout<<F1[i][j]<<" "; cout<<endl; } cout<<endl; for (int i=1;i<=n;i++){ for (int j=1;j<=n;j++) cout<<F2[i][j]<<" "; cout<<endl; } cout<<endl; for (int i=1;i<=n;i++){ for (int j=1;j<=n;j++) cout<<F3[i][j]<<" "; cout<<endl; } cout<<endl; for (int i=1;i<=n;i++){ for (int j=1;j<=n;j++) cout<<F4[i][j]<<" "; cout<<endl; } cout<<endl; //*/ for (int i=n;i>=1;i--) for (int j=n;j>=1;j--) F4[i][j]=((F4[i][j]+F4[i+1][j]+F4[i][j+1]-F4[i+1][j+1])%Mod+Mod)%Mod; for (int i=1;i<=n;i++) for (int j=n;j>=1;j--) F2[i][j]=((F2[i][j]+F2[i-1][j]+F2[i][j+1]-F2[i-1][j+1])%Mod+Mod)%Mod; int Ans=0; for (int i=1;i<=n;i++) for (int j=1;j<=n;j++){ Ans=(Ans+1ll*F1[i][j]*(F4[i+1][1]+F4[1][j+1]-F4[i+1][j+1]+Mod)%Mod)%Mod; //cout<<"("<<i<<","<<j<<")"<<F1[i][j]<<" "<<F2[i+1][1]+F2[1][j+1]-F2[i+1][j+1]<<endl; Ans=(Ans-1ll*F3[i][j]*F2[i-1][j+1]%Mod+Mod)%Mod; } //int cnt=0; //for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) cnt+=(Mp[i][j]=='B'); //Ans=(Ans-1ll*cnt*(cnt-1)/2%Mod+Mod)%Mod; printf("%d\n",Ans);return 0; }
28.535714
116
0.520651
SYCstudio
f72e5b0b2826faf4a314d77615afd3485177ba41
16,908
cpp
C++
src/detection_output_layer.cpp
samylee/LCNN_SSD
5ac8da7ceb65711eeedcce0e8c78433c305b254d
[ "Apache-2.0" ]
13
2019-03-17T08:51:39.000Z
2021-03-26T11:15:32.000Z
src/detection_output_layer.cpp
samylee/LCNN_SSD
5ac8da7ceb65711eeedcce0e8c78433c305b254d
[ "Apache-2.0" ]
null
null
null
src/detection_output_layer.cpp
samylee/LCNN_SSD
5ac8da7ceb65711eeedcce0e8c78433c305b254d
[ "Apache-2.0" ]
8
2019-03-18T02:30:09.000Z
2021-07-26T09:49:23.000Z
#include "detection_output_layer.h" DetectionOutputLayer::DetectionOutputLayer() { } DetectionOutputLayer::~DetectionOutputLayer() { } void DetectionOutputLayer::layer_set_up(vector<Blob>& bottom_data_, vector<Blob>& top_data_) { objectness_score_ = 0.01; num_classes_ = 21; share_location_ = true; num_loc_classes_ = share_location_ ? 1 : num_classes_; background_label_id_ = 0; code_type_ = "PriorBoxParameter_CodeType_CENTER_SIZE"; variance_encoded_in_target_ = false; keep_top_k_ = 200; confidence_threshold_ = 0.01; // Parameters used in nms. nms_threshold_ = 0.45; eta_ = 1.0; top_k_ = 400; num_priors_ = bottom_data_[2].height_ / 4; // num() and channels() are 1. vector<int> top_shape(2, 1); // Since the number of bboxes to be kept is unknown before nms, we manually // set it to (fake) 1. top_shape.push_back(1); // Each row is a 7 dimension vector, which stores // [image_id, label, confidence, xmin, ymin, xmax, ymax] top_shape.push_back(7); top_data_.resize(1); top_data_[0].reshape(top_shape[0], top_shape[1], top_shape[2], top_shape[3]); } void DetectionOutputLayer::GetLocPredictions(const float* loc_data, const int num, const int num_preds_per_class, const int num_loc_classes, const bool share_location, vector<LabelBBox>* loc_preds) { loc_preds->clear(); loc_preds->resize(num); for (int i = 0; i < num; ++i) { LabelBBox& label_bbox = (*loc_preds)[i]; for (int p = 0; p < num_preds_per_class; ++p) { int start_idx = p * num_loc_classes * 4; for (int c = 0; c < num_loc_classes; ++c) { int label = share_location ? -1 : c; if (label_bbox.find(label) == label_bbox.end()) { label_bbox[label].resize(num_preds_per_class); } label_bbox[label][p].xmin_ = loc_data[start_idx + c * 4]; label_bbox[label][p].ymin_ = loc_data[start_idx + c * 4 + 1]; label_bbox[label][p].xmax_ = loc_data[start_idx + c * 4 + 2]; label_bbox[label][p].ymax_ = loc_data[start_idx + c * 4 + 3]; label_bbox[label][p].has_size_ = false; } } loc_data += num_preds_per_class * num_loc_classes * 4; } } void DetectionOutputLayer::GetConfidenceScores(const float* conf_data, const int num, const int num_preds_per_class, const int num_classes, vector<map<int, vector<float> > >* conf_preds) { conf_preds->clear(); conf_preds->resize(num); for (int i = 0; i < num; ++i) { map<int, vector<float> >& label_scores = (*conf_preds)[i]; for (int p = 0; p < num_preds_per_class; ++p) { int start_idx = p * num_classes; for (int c = 0; c < num_classes; ++c) { label_scores[c].push_back(conf_data[start_idx + c]); } } conf_data += num_preds_per_class * num_classes; } } float DetectionOutputLayer::BBoxSize(const NormalizedBBox& bbox, const bool normalized) { if (bbox.xmax_ < bbox.xmin_ || bbox.ymax_ < bbox.ymin_) { // If bbox is invalid (e.g. xmax < xmin or ymax < ymin), return 0. return 0; } else { if (bbox.has_size_) { return bbox.size_; } else { float width = bbox.xmax_ - bbox.xmin_; float height = bbox.ymax_ - bbox.ymin_; if (normalized) { return width * height; } else { // If bbox is not within range [0, 1]. return (width + 1) * (height + 1); } } } } void DetectionOutputLayer::GetPriorBBoxes(const float* prior_data, const int num_priors, vector<NormalizedBBox>* prior_bboxes, vector<vector<float> >* prior_variances) { prior_bboxes->clear(); prior_variances->clear(); for (int i = 0; i < num_priors; ++i) { int start_idx = i * 4; NormalizedBBox bbox; bbox.xmin_ = prior_data[start_idx]; bbox.ymin_ = prior_data[start_idx + 1]; bbox.xmax_ = prior_data[start_idx + 2]; bbox.ymax_ = prior_data[start_idx + 3]; bbox.has_size_ = false; float bbox_size = BBoxSize(bbox); bbox.size_ = bbox_size; bbox.has_size_ = true; prior_bboxes->push_back(bbox); } for (int i = 0; i < num_priors; ++i) { int start_idx = (num_priors + i) * 4; vector<float> var; for (int j = 0; j < 4; ++j) { var.push_back(prior_data[start_idx + j]); } prior_variances->push_back(var); } } void DetectionOutputLayer::DecodeBBoxes( const vector<NormalizedBBox>& prior_bboxes, const vector<vector<float> >& prior_variances, const string code_type, const bool variance_encoded_in_target, const bool clip_bbox, const vector<NormalizedBBox>& bboxes, vector<NormalizedBBox>* decode_bboxes) { int num_bboxes = prior_bboxes.size(); decode_bboxes->clear(); for (int i = 0; i < num_bboxes; ++i) { NormalizedBBox decode_bbox; DecodeBBox(prior_bboxes[i], prior_variances[i], code_type, variance_encoded_in_target, clip_bbox, bboxes[i], &decode_bbox); decode_bboxes->push_back(decode_bbox); } } void DetectionOutputLayer::DecodeBBox( const NormalizedBBox& prior_bbox, const vector<float>& prior_variance, const string code_type, const bool variance_encoded_in_target, const bool clip_bbox, const NormalizedBBox& bbox, NormalizedBBox* decode_bbox) { if (code_type == "PriorBoxParameter_CodeType_CENTER_SIZE") { float prior_width = prior_bbox.xmax_ - prior_bbox.xmin_; float prior_height = prior_bbox.ymax_ - prior_bbox.ymin_; float prior_center_x = (prior_bbox.xmin_ + prior_bbox.xmax_) / 2.; float prior_center_y = (prior_bbox.ymin_ + prior_bbox.ymax_) / 2.; float decode_bbox_center_x, decode_bbox_center_y; float decode_bbox_width, decode_bbox_height; if (variance_encoded_in_target) { // variance is encoded in target, we simply need to retore the offset // predictions. decode_bbox_center_x = bbox.xmin_ * prior_width + prior_center_x; decode_bbox_center_y = bbox.ymin_ * prior_height + prior_center_y; decode_bbox_width = exp(bbox.xmax_) * prior_width; decode_bbox_height = exp(bbox.ymax_) * prior_height; } else { // variance is encoded in bbox, we need to scale the offset accordingly. decode_bbox_center_x = prior_variance[0] * bbox.xmin_ * prior_width + prior_center_x; decode_bbox_center_y = prior_variance[1] * bbox.ymin_ * prior_height + prior_center_y; decode_bbox_width = exp(prior_variance[2] * bbox.xmax_) * prior_width; decode_bbox_height = exp(prior_variance[3] * bbox.ymax_) * prior_height; } decode_bbox->xmin_ = decode_bbox_center_x - decode_bbox_width / 2.; decode_bbox->ymin_ = decode_bbox_center_y - decode_bbox_height / 2.; decode_bbox->xmax_ = decode_bbox_center_x + decode_bbox_width / 2.; decode_bbox->ymax_ = decode_bbox_center_y + decode_bbox_height / 2.; } else { cout << "Unknown LocLossType."; } decode_bbox->has_size_ = false; float bbox_size = BBoxSize(*decode_bbox); decode_bbox->size_ = bbox_size; decode_bbox->has_size_ = true; } void DetectionOutputLayer::DecodeBBoxesAll(const vector<LabelBBox>& all_loc_preds, const vector<NormalizedBBox>& prior_bboxes, const vector<vector<float> >& prior_variances, const int num, const bool share_location, const int num_loc_classes, const int background_label_id, const string code_type, const bool variance_encoded_in_target, const bool clip, vector<LabelBBox>* all_decode_bboxes) { all_decode_bboxes->clear(); all_decode_bboxes->resize(num); for (int i = 0; i < num; ++i) { // Decode predictions into bboxes. LabelBBox& decode_bboxes = (*all_decode_bboxes)[i]; for (int c = 0; c < num_loc_classes; ++c) { int label = share_location ? -1 : c; if (label == background_label_id) { // Ignore background class. continue; } const vector<NormalizedBBox>& label_loc_preds = all_loc_preds[i].find(label)->second; DecodeBBoxes(prior_bboxes, prior_variances, code_type, variance_encoded_in_target, clip, label_loc_preds, &(decode_bboxes[label])); } } } template <typename T> bool SortScorePairDescend(const pair<float, T>& pair1, const pair<float, T>& pair2) { return pair1.first > pair2.first; } void DetectionOutputLayer::GetMaxScoreIndex(const vector<float>& scores, const float threshold, const int top_k, vector<pair<float, int> >* score_index_vec) { // Generate index score pairs. for (int i = 0; i < scores.size(); ++i) { if (scores[i] > threshold) { score_index_vec->push_back(std::make_pair(scores[i], i)); } } // Sort the score pair according to the scores in descending order std::stable_sort(score_index_vec->begin(), score_index_vec->end(), SortScorePairDescend<int>); // Keep top_k scores if needed. if (top_k > -1 && top_k < score_index_vec->size()) { score_index_vec->resize(top_k); } } void DetectionOutputLayer::IntersectBBox(const NormalizedBBox& bbox1, const NormalizedBBox& bbox2, NormalizedBBox* intersect_bbox) { if (bbox2.xmin_ > bbox1.xmax_ || bbox2.xmax_ < bbox1.xmin_ || bbox2.ymin_ > bbox1.ymax_ || bbox2.ymax_ < bbox1.ymin_) { // Return [0, 0, 0, 0] if there is no intersection. intersect_bbox->xmin_ = 0; intersect_bbox->ymin_ = 0; intersect_bbox->xmax_ = 0; intersect_bbox->ymax_ = 0; } else { intersect_bbox->xmin_ = (std::max(bbox1.xmin_, bbox2.xmin_)); intersect_bbox->ymin_ = (std::max(bbox1.ymin_, bbox2.ymin_)); intersect_bbox->xmax_ = (std::min(bbox1.xmax_, bbox2.xmax_)); intersect_bbox->ymax_ = (std::min(bbox1.ymax_, bbox2.ymax_)); } } float DetectionOutputLayer::JaccardOverlap(const NormalizedBBox& bbox1, const NormalizedBBox& bbox2, const bool normalized) { NormalizedBBox intersect_bbox; IntersectBBox(bbox1, bbox2, &intersect_bbox); float intersect_width, intersect_height; if (normalized) { intersect_width = intersect_bbox.xmax_ - intersect_bbox.xmin_; intersect_height = intersect_bbox.ymax_ - intersect_bbox.ymin_; } else { intersect_width = intersect_bbox.xmax_ - intersect_bbox.xmin_ + 1; intersect_height = intersect_bbox.ymax_ - intersect_bbox.ymin_ + 1; } if (intersect_width > 0 && intersect_height > 0) { float intersect_size = intersect_width * intersect_height; float bbox1_size = BBoxSize(bbox1); float bbox2_size = BBoxSize(bbox2); return intersect_size / (bbox1_size + bbox2_size - intersect_size); } else { return 0.; } } void DetectionOutputLayer::ApplyNMSFast(const vector<NormalizedBBox>& bboxes, const vector<float>& scores, const float score_threshold, const float nms_threshold, const float eta, const int top_k, vector<int>* indices) { // Get top_k scores (with corresponding indices). vector<pair<float, int> > score_index_vec; GetMaxScoreIndex(scores, score_threshold, top_k, &score_index_vec); // Do nms. float adaptive_threshold = nms_threshold; indices->clear(); while (score_index_vec.size() != 0) { const int idx = score_index_vec.front().second; bool keep = true; for (int k = 0; k < indices->size(); ++k) { if (keep) { const int kept_idx = (*indices)[k]; float overlap = JaccardOverlap(bboxes[idx], bboxes[kept_idx]); keep = overlap <= adaptive_threshold; } else { break; } } if (keep) { indices->push_back(idx); } score_index_vec.erase(score_index_vec.begin()); if (keep && eta < 1 && adaptive_threshold > 0.5) { adaptive_threshold *= eta; } } } void DetectionOutputLayer::forward_cpu(vector<Blob>& bottom_data_, vector<Blob>& top_data_) { const float* loc_data = bottom_data_[0].cpu_data(); const float* conf_data = bottom_data_[1].cpu_data(); const float* prior_data = bottom_data_[2].cpu_data(); const int num = bottom_data_[0].num_; // Retrieve all location predictions. vector<LabelBBox> all_loc_preds; GetLocPredictions(loc_data, num, num_priors_, num_loc_classes_, share_location_, &all_loc_preds); // Retrieve all confidences. vector<map<int, vector<float> > > all_conf_scores; GetConfidenceScores(conf_data, num, num_priors_, num_classes_, &all_conf_scores); // Retrieve all prior bboxes. It is same within a batch since we assume all // images in a batch are of same dimension. vector<NormalizedBBox> prior_bboxes; vector<vector<float> > prior_variances; GetPriorBBoxes(prior_data, num_priors_, &prior_bboxes, &prior_variances); // Decode all loc predictions to bboxes. vector<LabelBBox> all_decode_bboxes; const bool clip_bbox = false; DecodeBBoxesAll(all_loc_preds, prior_bboxes, prior_variances, num, share_location_, num_loc_classes_, background_label_id_, code_type_, variance_encoded_in_target_, clip_bbox, &all_decode_bboxes); int num_kept = 0; vector<map<int, vector<int> > > all_indices; for (int i = 0; i < num; ++i) { const LabelBBox& decode_bboxes = all_decode_bboxes[i]; const map<int, vector<float> >& conf_scores = all_conf_scores[i]; map<int, vector<int> > indices; int num_det = 0; for (int c = 0; c < num_classes_; ++c) { if (c == background_label_id_) { // Ignore background class. continue; } const vector<float>& scores = conf_scores.find(c)->second; int label = share_location_ ? -1 : c; if (decode_bboxes.find(label) == decode_bboxes.end()) { continue; } const vector<NormalizedBBox>& bboxes = decode_bboxes.find(label)->second; ApplyNMSFast(bboxes, scores, confidence_threshold_, nms_threshold_, eta_, top_k_, &(indices[c])); num_det += indices[c].size(); } if (keep_top_k_ > -1 && num_det > keep_top_k_) { vector<pair<float, pair<int, int> > > score_index_pairs; for (map<int, vector<int> >::iterator it = indices.begin(); it != indices.end(); ++it) { int label = it->first; const vector<int>& label_indices = it->second; if (conf_scores.find(label) == conf_scores.end()) { continue; } const vector<float>& scores = conf_scores.find(label)->second; for (int j = 0; j < label_indices.size(); ++j) { int idx = label_indices[j]; score_index_pairs.push_back(std::make_pair( scores[idx], std::make_pair(label, idx))); } } // Keep top k results per image. std::sort(score_index_pairs.begin(), score_index_pairs.end(), SortScorePairDescend<pair<int, int> >); score_index_pairs.resize(keep_top_k_); // Store the new indices. map<int, vector<int> > new_indices; for (int j = 0; j < score_index_pairs.size(); ++j) { int label = score_index_pairs[j].second.first; int idx = score_index_pairs[j].second.second; new_indices[label].push_back(idx); } all_indices.push_back(new_indices); num_kept += keep_top_k_; } else { all_indices.push_back(indices); num_kept += num_det; } } vector<int> top_shape(2, 1); top_shape.push_back(num_kept); top_shape.push_back(7); float* top_data; if (num_kept == 0) { top_shape[2] = num; top_data_[0].reshape(top_shape[0], top_shape[1], top_shape[2], top_shape[3]); top_data = top_data_[0].cpu_data(); caffe_set(top_data_[0].counts_, -1, top_data); // Generate fake results per image. for (int i = 0; i < num; ++i) { top_data[0] = i; top_data += 7; } } else { top_data_[0].reshape(top_shape[0], top_shape[1], top_shape[2], top_shape[3]); top_data = top_data_[0].cpu_data(); } int count = 0; for (int i = 0; i < num; ++i) { const map<int, vector<float> >& conf_scores = all_conf_scores[i]; const LabelBBox& decode_bboxes = all_decode_bboxes[i]; for (map<int, vector<int> >::iterator it = all_indices[i].begin(); it != all_indices[i].end(); ++it) { int label = it->first; if (conf_scores.find(label) == conf_scores.end()) { // Something bad happened if there are no predictions for current label. continue; } const vector<float>& scores = conf_scores.find(label)->second; int loc_label = share_location_ ? -1 : label; if (decode_bboxes.find(loc_label) == decode_bboxes.end()) { // Something bad happened if there are no predictions for current label. continue; } const vector<NormalizedBBox>& bboxes = decode_bboxes.find(loc_label)->second; vector<int>& indices = it->second; for (int j = 0; j < indices.size(); ++j) { int idx = indices[j]; top_data[count * 7] = i; top_data[count * 7 + 1] = label; top_data[count * 7 + 2] = scores[idx]; const NormalizedBBox& bbox = bboxes[idx]; top_data[count * 7 + 3] = bbox.xmin_; top_data[count * 7 + 4] = bbox.ymin_; top_data[count * 7 + 5] = bbox.xmax_; top_data[count * 7 + 6] = bbox.ymax_; ++count; } } } //const float* bottom_data_tmp = bottom_data_[0].cpu_data(); //static int count_layer = 1; //string dst_path = "data_file/output/" + to_string(count_layer); //ofstream dst_in(dst_path + "dst_in.txt"); //for (int i = 0; i < bottom_data_[0].counts_; i++) //{ // stringstream strStream; // strStream << bottom_data_tmp[i]; // dst_in << strStream.str() << " "; // if ((i + 1) % 10 == 0) // dst_in << endl; //} //dst_in.close(); //float* top_data_tmp = top_data_[0].cpu_data(); //ofstream dst_out(dst_path + "dst_out.txt"); //for (int i = 0; i < top_data_[0].counts_; i++) //{ // stringstream strStream; // strStream << top_data_tmp[i]; // dst_out << strStream.str() << " "; // if ((i+1) % 10 == 0) // dst_out << endl; //} //dst_out.close(); //count_layer++; }
33.883768
100
0.695588
samylee
f73579f156804e30ab6e7f6f2dace003410ebf43
1,692
cpp
C++
gb-emu-tests/JoypadTests.cpp
VKoskiv/GameLad
0b727eb7ad4fd9f38f73a6a22ce07448f8862124
[ "MIT" ]
510
2015-12-03T06:40:39.000Z
2022-03-11T21:14:25.000Z
gb-emu-tests/JoypadTests.cpp
VKoskiv/GameLad
0b727eb7ad4fd9f38f73a6a22ce07448f8862124
[ "MIT" ]
14
2015-12-03T06:08:33.000Z
2021-04-30T05:34:16.000Z
gb-emu-tests/JoypadTests.cpp
VKoskiv/GameLad
0b727eb7ad4fd9f38f73a6a22ce07448f8862124
[ "MIT" ]
49
2016-07-23T22:02:10.000Z
2021-11-05T23:53:32.000Z
#include "stdafx.h" #include <Emulator.hpp> #include <Joypad.hpp> #define INPUT_ONLY 0x20 #define BUTTONS_ONLY 0x10 #define NO_INPUT 0x30 #define BOTH_INPUT 0x00 TEST_CLASS(JoypadTests) { public: TEST_METHOD(FullInputTest) { std::unique_ptr<Joypad> spJoypad = std::unique_ptr<Joypad>(new Joypad(nullptr)); // No input, no items selected, expected all bits set spJoypad->SetInput(JOYPAD_NONE, JOYPAD_NONE); spJoypad->WriteByte(JoypadAddress, NO_INPUT); Assert::AreEqual(0x3F, (int)spJoypad->ReadByte(JoypadAddress)); // Select buttons only spJoypad->WriteByte(JoypadAddress, BUTTONS_ONLY); Assert::AreEqual(0x1F, (int)spJoypad->ReadByte(JoypadAddress)); // Select input only spJoypad->WriteByte(JoypadAddress, INPUT_ONLY); Assert::AreEqual(0x2F, (int)spJoypad->ReadByte(JoypadAddress)); // Press a button, no change spJoypad->SetInput(JOYPAD_NONE, JOYPAD_BUTTONS_A); Assert::AreEqual(0x2F, (int)spJoypad->ReadByte(JoypadAddress)); // Select buttons now, A button shows as LOW (pressed) spJoypad->WriteByte(JoypadAddress, BUTTONS_ONLY); Assert::AreEqual(0x1E, (int)spJoypad->ReadByte(JoypadAddress)); // Press a direction, no change spJoypad->SetInput(JOYPAD_INPUT_UP, JOYPAD_BUTTONS_A); Assert::AreEqual(0x1E, (int)spJoypad->ReadByte(JoypadAddress)); // Select buttons and input now, UP and A button shows as LOW (pressed) spJoypad->WriteByte(JoypadAddress, BOTH_INPUT); Assert::AreEqual(0x0A, (int)spJoypad->ReadByte(JoypadAddress)); spJoypad.reset(); } };
33.84
88
0.674941
VKoskiv
f73df2a97be719e6a36849fb6371d19d4f6f97b7
1,785
inl
C++
src/cppio/network/http/encoding.inl
yamashi/cppio
a6fa39ccfd72361d0a8b11948a30db030de2ac33
[ "MIT" ]
4
2021-08-29T13:46:22.000Z
2021-11-14T20:27:30.000Z
src/cppio/network/http/encoding.inl
yamashi/cppio
a6fa39ccfd72361d0a8b11948a30db030de2ac33
[ "MIT" ]
null
null
null
src/cppio/network/http/encoding.inl
yamashi/cppio
a6fa39ccfd72361d0a8b11948a30db030de2ac33
[ "MIT" ]
null
null
null
#ifndef CPPIO_NETWORK_HTTP_ENCODING_INL_DO #error Do not include this file directly! #endif #include <cppio/network/http/http.hpp> namespace cppio::network::http { namespace details { inline char from_hex(char ch) { return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10; } inline char to_hex(char code) { static const char hex[] = "0123456789abcdef"; return hex[code & 15]; } } inline std::string url_encode(std::string_view url) { std::string result; result.reserve(url.size() * 3 + 1); for(auto ch : url) { if (isalnum(ch) || ch == '-' || ch == '_' || ch == '.' || ch == '~') result.push_back(ch); else { result.push_back('%'); result.push_back(details::to_hex(ch >> 4)); result.push_back(details::to_hex(ch & 15)); } } result.push_back(0); return result; } inline std::string url_decode(std::string_view url) { std::string result; for (auto it = std::begin(url), end = std::end(url); it != end; ++it) { auto ch = *it; if (ch == '%') { auto part_one = it + 1; auto part_two = it + 2; if (part_one != end && part_two != end) { result.push_back(details::from_hex(*part_one) << 4 | details::from_hex(*part_two)); it += 2; } } else if (ch == '+') result.push_back(' '); else result.push_back(ch); } return result; } }
26.641791
103
0.446499
yamashi
f7445d88f415f67448c333963cd368d29243cb31
565
cpp
C++
ShagDB/database.cpp
RenataRobertovna/ShagDB
26ba60a2f3e01053e551aced105a77fab2b3a5f4
[ "MIT" ]
null
null
null
ShagDB/database.cpp
RenataRobertovna/ShagDB
26ba60a2f3e01053e551aced105a77fab2b3a5f4
[ "MIT" ]
null
null
null
ShagDB/database.cpp
RenataRobertovna/ShagDB
26ba60a2f3e01053e551aced105a77fab2b3a5f4
[ "MIT" ]
null
null
null
#include "database.h" #include "ui_database.h" DataBase::DataBase(QWidget *parent) : QMainWindow(parent) , ui(new Ui::DataBase) { ui->setupUi(this); // Инициализируем второе окно sWindow = new Menu(); // подключаем к слоту запуска главного окна по кнопке во втором окне connect(sWindow, &Menu::firstWindow, this, &DataBase::show); } DataBase::~DataBase() { delete ui; } void DataBase::on_pushButton_clicked() { sWindow->show(); // Показываем второе окно this->close(); // Закрываем основное окно }
22.6
73
0.646018
RenataRobertovna
f74655044e36e274aa7ed818b1753f4e32978ab6
200,645
cpp
C++
bnn/src/network/output/hls-syn/lfcW1A1-pynqZ1-Z2/sol1/syn/systemc/Matrix_Vector_Activa_4.cpp
IceyFong/Lutification
3e42d34d6840d5deb84407aad5c58216527a4b0a
[ "BSD-3-Clause" ]
null
null
null
bnn/src/network/output/hls-syn/lfcW1A1-pynqZ1-Z2/sol1/syn/systemc/Matrix_Vector_Activa_4.cpp
IceyFong/Lutification
3e42d34d6840d5deb84407aad5c58216527a4b0a
[ "BSD-3-Clause" ]
null
null
null
bnn/src/network/output/hls-syn/lfcW1A1-pynqZ1-Z2/sol1/syn/systemc/Matrix_Vector_Activa_4.cpp
IceyFong/Lutification
3e42d34d6840d5deb84407aad5c58216527a4b0a
[ "BSD-3-Clause" ]
null
null
null
#include "Matrix_Vector_Activa.h" #include "AESL_pkg.h" using namespace std; namespace ap_rtl { void Matrix_Vector_Activa::thread_tmp1597_fu_18692_p2() { tmp1597_fu_18692_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_7182_fu_18684_p3.read()); } void Matrix_Vector_Activa::thread_tmp1598_fu_18712_p2() { tmp1598_fu_18712_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_7183_fu_18704_p3.read()); } void Matrix_Vector_Activa::thread_tmp1599_fu_18732_p2() { tmp1599_fu_18732_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_7184_fu_18724_p3.read()); } void Matrix_Vector_Activa::thread_tmp159_cast_fu_43311_p1() { tmp159_cast_fu_43311_p1 = esl_zext<3,2>(tmp93_fu_43305_p2.read()); } void Matrix_Vector_Activa::thread_tmp159_fu_3836_p2() { tmp159_fu_3836_p2 = (tmp_6329_fu_2200_p3.read() ^ tmp_6437_fu_3828_p3.read()); } void Matrix_Vector_Activa::thread_tmp15_fu_1732_p2() { tmp15_fu_1732_p2 = (tmp_6295_fu_1724_p3.read() ^ tmp_6294_fu_1716_p3.read()); } void Matrix_Vector_Activa::thread_tmp1600_fu_18752_p2() { tmp1600_fu_18752_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_7185_fu_18744_p3.read()); } void Matrix_Vector_Activa::thread_tmp1601_fu_67562_p2() { tmp1601_fu_67562_p2 = (!tmp_23_12_60_i_fu_67559_p1.read().is_01() || !p_accu_V_0_12_i_fu_66664_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_12_60_i_fu_67559_p1.read()) + sc_biguint<16>(p_accu_V_0_12_i_fu_66664_p3.read())); } void Matrix_Vector_Activa::thread_tmp1602_fu_51969_p2() { tmp1602_fu_51969_p2 = (!tmp_23_12_59_i_cast_fu_51960_p1.read().is_01() || !tmp_23_12_61_i_cast_fu_51963_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_59_i_cast_fu_51960_p1.read()) + sc_biguint<2>(tmp_23_12_61_i_cast_fu_51963_p1.read())); } void Matrix_Vector_Activa::thread_tmp1603_fu_67571_p2() { tmp1603_fu_67571_p2 = (!tmp1601_fu_67562_p2.read().is_01() || !tmp2412_cast_fu_67568_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1601_fu_67562_p2.read()) + sc_biguint<16>(tmp2412_cast_fu_67568_p1.read())); } void Matrix_Vector_Activa::thread_tmp1604_fu_51975_p2() { tmp1604_fu_51975_p2 = (!tmp_23_12_55_i_cast_fu_51948_p1.read().is_01() || !tmp_23_12_58_i_cast_fu_51957_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_55_i_cast_fu_51948_p1.read()) + sc_biguint<2>(tmp_23_12_58_i_cast_fu_51957_p1.read())); } void Matrix_Vector_Activa::thread_tmp1605_fu_51985_p2() { tmp1605_fu_51985_p2 = (!tmp_23_12_57_i_cast_fu_51954_p1.read().is_01() || !tmp_23_12_54_i_cast_fu_51945_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_57_i_cast_fu_51954_p1.read()) + sc_biguint<2>(tmp_23_12_54_i_cast_fu_51945_p1.read())); } void Matrix_Vector_Activa::thread_tmp1606_fu_51995_p2() { tmp1606_fu_51995_p2 = (!tmp2414_cast_fu_51981_p1.read().is_01() || !tmp2415_cast_fu_51991_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2414_cast_fu_51981_p1.read()) + sc_biguint<3>(tmp2415_cast_fu_51991_p1.read())); } void Matrix_Vector_Activa::thread_tmp1607_fu_67580_p2() { tmp1607_fu_67580_p2 = (!tmp1603_fu_67571_p2.read().is_01() || !tmp2413_cast_fu_67577_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1603_fu_67571_p2.read()) + sc_biguint<16>(tmp2413_cast_fu_67577_p1.read())); } void Matrix_Vector_Activa::thread_tmp1608_fu_52001_p2() { tmp1608_fu_52001_p2 = (!tmp_23_12_47_i_cast_fu_51924_p1.read().is_01() || !tmp_23_12_56_i_cast_fu_51951_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_47_i_cast_fu_51924_p1.read()) + sc_biguint<2>(tmp_23_12_56_i_cast_fu_51951_p1.read())); } void Matrix_Vector_Activa::thread_tmp1609_fu_52011_p2() { tmp1609_fu_52011_p2 = (!tmp_23_12_49_i_cast_fu_51930_p1.read().is_01() || !tmp_23_12_46_i_cast_fu_51921_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_49_i_cast_fu_51930_p1.read()) + sc_biguint<2>(tmp_23_12_46_i_cast_fu_51921_p1.read())); } void Matrix_Vector_Activa::thread_tmp160_cast_fu_43351_p1() { tmp160_cast_fu_43351_p1 = esl_zext<4,3>(tmp97_fu_43345_p2.read()); } void Matrix_Vector_Activa::thread_tmp160_fu_3856_p2() { tmp160_fu_3856_p2 = (tmp_6331_fu_2228_p3.read() ^ tmp_6438_fu_3848_p3.read()); } void Matrix_Vector_Activa::thread_tmp1610_fu_52021_p2() { tmp1610_fu_52021_p2 = (!tmp2418_cast_fu_52007_p1.read().is_01() || !tmp2419_cast_fu_52017_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2418_cast_fu_52007_p1.read()) + sc_biguint<3>(tmp2419_cast_fu_52017_p1.read())); } void Matrix_Vector_Activa::thread_tmp1611_fu_52031_p2() { tmp1611_fu_52031_p2 = (!tmp_23_12_51_i_cast_fu_51936_p1.read().is_01() || !tmp_23_12_48_i_cast_fu_51927_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_51_i_cast_fu_51936_p1.read()) + sc_biguint<2>(tmp_23_12_48_i_cast_fu_51927_p1.read())); } void Matrix_Vector_Activa::thread_tmp1612_fu_52041_p2() { tmp1612_fu_52041_p2 = (!tmp_23_12_53_i_cast_fu_51942_p1.read().is_01() || !tmp_23_12_50_i_cast_fu_51933_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_53_i_cast_fu_51942_p1.read()) + sc_biguint<2>(tmp_23_12_50_i_cast_fu_51933_p1.read())); } void Matrix_Vector_Activa::thread_tmp1613_fu_52051_p2() { tmp1613_fu_52051_p2 = (!tmp2421_cast_fu_52037_p1.read().is_01() || !tmp2422_cast_fu_52047_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2421_cast_fu_52037_p1.read()) + sc_biguint<3>(tmp2422_cast_fu_52047_p1.read())); } void Matrix_Vector_Activa::thread_tmp1614_fu_52061_p2() { tmp1614_fu_52061_p2 = (!tmp2417_cast_fu_52027_p1.read().is_01() || !tmp2420_cast_fu_52057_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2417_cast_fu_52027_p1.read()) + sc_biguint<4>(tmp2420_cast_fu_52057_p1.read())); } void Matrix_Vector_Activa::thread_tmp1615_fu_67589_p2() { tmp1615_fu_67589_p2 = (!tmp1607_fu_67580_p2.read().is_01() || !tmp2416_cast_fu_67586_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1607_fu_67580_p2.read()) + sc_biguint<16>(tmp2416_cast_fu_67586_p1.read())); } void Matrix_Vector_Activa::thread_tmp1616_fu_52067_p2() { tmp1616_fu_52067_p2 = (!tmp_23_12_31_i_cast_fu_51876_p1.read().is_01() || !tmp_23_12_52_i_cast_fu_51939_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_31_i_cast_fu_51876_p1.read()) + sc_biguint<2>(tmp_23_12_52_i_cast_fu_51939_p1.read())); } void Matrix_Vector_Activa::thread_tmp1617_fu_52077_p2() { tmp1617_fu_52077_p2 = (!tmp_23_12_33_i_cast_fu_51882_p1.read().is_01() || !tmp_23_12_30_i_cast_fu_51873_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_33_i_cast_fu_51882_p1.read()) + sc_biguint<2>(tmp_23_12_30_i_cast_fu_51873_p1.read())); } void Matrix_Vector_Activa::thread_tmp1618_fu_52087_p2() { tmp1618_fu_52087_p2 = (!tmp2426_cast_fu_52073_p1.read().is_01() || !tmp2427_cast_fu_52083_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2426_cast_fu_52073_p1.read()) + sc_biguint<3>(tmp2427_cast_fu_52083_p1.read())); } void Matrix_Vector_Activa::thread_tmp1619_fu_52097_p2() { tmp1619_fu_52097_p2 = (!tmp_23_12_35_i_cast_fu_51888_p1.read().is_01() || !tmp_23_12_32_i_cast_fu_51879_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_35_i_cast_fu_51888_p1.read()) + sc_biguint<2>(tmp_23_12_32_i_cast_fu_51879_p1.read())); } void Matrix_Vector_Activa::thread_tmp161_cast_fu_43331_p1() { tmp161_cast_fu_43331_p1 = esl_zext<3,2>(tmp95_fu_43325_p2.read()); } void Matrix_Vector_Activa::thread_tmp161_fu_3876_p2() { tmp161_fu_3876_p2 = (tmp_6333_fu_2256_p3.read() ^ tmp_6439_fu_3868_p3.read()); } void Matrix_Vector_Activa::thread_tmp1620_fu_52107_p2() { tmp1620_fu_52107_p2 = (!tmp_23_12_37_i_cast_fu_51894_p1.read().is_01() || !tmp_23_12_34_i_cast_fu_51885_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_37_i_cast_fu_51894_p1.read()) + sc_biguint<2>(tmp_23_12_34_i_cast_fu_51885_p1.read())); } void Matrix_Vector_Activa::thread_tmp1621_fu_52117_p2() { tmp1621_fu_52117_p2 = (!tmp2429_cast_fu_52103_p1.read().is_01() || !tmp2430_cast_fu_52113_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2429_cast_fu_52103_p1.read()) + sc_biguint<3>(tmp2430_cast_fu_52113_p1.read())); } void Matrix_Vector_Activa::thread_tmp1622_fu_52127_p2() { tmp1622_fu_52127_p2 = (!tmp2425_cast_fu_52093_p1.read().is_01() || !tmp2428_cast_fu_52123_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2425_cast_fu_52093_p1.read()) + sc_biguint<4>(tmp2428_cast_fu_52123_p1.read())); } void Matrix_Vector_Activa::thread_tmp1623_fu_52137_p2() { tmp1623_fu_52137_p2 = (!tmp_23_12_39_i_cast_fu_51900_p1.read().is_01() || !tmp_23_12_36_i_cast_fu_51891_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_39_i_cast_fu_51900_p1.read()) + sc_biguint<2>(tmp_23_12_36_i_cast_fu_51891_p1.read())); } void Matrix_Vector_Activa::thread_tmp1624_fu_52147_p2() { tmp1624_fu_52147_p2 = (!tmp_23_12_41_i_cast_fu_51906_p1.read().is_01() || !tmp_23_12_38_i_cast_fu_51897_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_41_i_cast_fu_51906_p1.read()) + sc_biguint<2>(tmp_23_12_38_i_cast_fu_51897_p1.read())); } void Matrix_Vector_Activa::thread_tmp1625_fu_52157_p2() { tmp1625_fu_52157_p2 = (!tmp2433_cast_fu_52143_p1.read().is_01() || !tmp2434_cast_fu_52153_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2433_cast_fu_52143_p1.read()) + sc_biguint<3>(tmp2434_cast_fu_52153_p1.read())); } void Matrix_Vector_Activa::thread_tmp1626_fu_52167_p2() { tmp1626_fu_52167_p2 = (!tmp_23_12_43_i_cast_fu_51912_p1.read().is_01() || !tmp_23_12_40_i_cast_fu_51903_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_43_i_cast_fu_51912_p1.read()) + sc_biguint<2>(tmp_23_12_40_i_cast_fu_51903_p1.read())); } void Matrix_Vector_Activa::thread_tmp1627_fu_52177_p2() { tmp1627_fu_52177_p2 = (!tmp_23_12_45_i_cast_fu_51918_p1.read().is_01() || !tmp_23_12_42_i_cast_fu_51909_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_45_i_cast_fu_51918_p1.read()) + sc_biguint<2>(tmp_23_12_42_i_cast_fu_51909_p1.read())); } void Matrix_Vector_Activa::thread_tmp1628_fu_52187_p2() { tmp1628_fu_52187_p2 = (!tmp2436_cast_fu_52173_p1.read().is_01() || !tmp2437_cast_fu_52183_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2436_cast_fu_52173_p1.read()) + sc_biguint<3>(tmp2437_cast_fu_52183_p1.read())); } void Matrix_Vector_Activa::thread_tmp1629_fu_52197_p2() { tmp1629_fu_52197_p2 = (!tmp2432_cast_fu_52163_p1.read().is_01() || !tmp2435_cast_fu_52193_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2432_cast_fu_52163_p1.read()) + sc_biguint<4>(tmp2435_cast_fu_52193_p1.read())); } void Matrix_Vector_Activa::thread_tmp162_cast_fu_43341_p1() { tmp162_cast_fu_43341_p1 = esl_zext<3,2>(tmp96_fu_43335_p2.read()); } void Matrix_Vector_Activa::thread_tmp162_fu_3896_p2() { tmp162_fu_3896_p2 = (tmp_6335_fu_2284_p3.read() ^ tmp_6440_fu_3888_p3.read()); } void Matrix_Vector_Activa::thread_tmp1630_fu_52207_p2() { tmp1630_fu_52207_p2 = (!tmp2424_cast_fu_52133_p1.read().is_01() || !tmp2431_cast_fu_52203_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2424_cast_fu_52133_p1.read()) + sc_biguint<5>(tmp2431_cast_fu_52203_p1.read())); } void Matrix_Vector_Activa::thread_tmp1631_fu_67598_p2() { tmp1631_fu_67598_p2 = (!tmp1615_fu_67589_p2.read().is_01() || !tmp2423_cast_fu_67595_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1615_fu_67589_p2.read()) + sc_biguint<16>(tmp2423_cast_fu_67595_p1.read())); } void Matrix_Vector_Activa::thread_tmp1632_fu_52213_p2() { tmp1632_fu_52213_p2 = (!tmp_23_12_i_cast_fu_51780_p1.read().is_01() || !tmp_23_12_44_i_cast_fu_51915_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_i_cast_fu_51780_p1.read()) + sc_biguint<2>(tmp_23_12_44_i_cast_fu_51915_p1.read())); } void Matrix_Vector_Activa::thread_tmp1633_fu_52223_p2() { tmp1633_fu_52223_p2 = (!tmp_23_12_1_i_cast_fu_51783_p1.read().is_01() || !tmp_23_12_2_i_cast_fu_51786_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_1_i_cast_fu_51783_p1.read()) + sc_biguint<2>(tmp_23_12_2_i_cast_fu_51786_p1.read())); } void Matrix_Vector_Activa::thread_tmp1634_fu_52233_p2() { tmp1634_fu_52233_p2 = (!tmp2442_cast_fu_52219_p1.read().is_01() || !tmp2443_cast_fu_52229_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2442_cast_fu_52219_p1.read()) + sc_biguint<3>(tmp2443_cast_fu_52229_p1.read())); } void Matrix_Vector_Activa::thread_tmp1635_fu_52243_p2() { tmp1635_fu_52243_p2 = (!tmp_23_12_3_i_cast_fu_51789_p1.read().is_01() || !tmp_23_12_4_i_cast_fu_51792_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_3_i_cast_fu_51789_p1.read()) + sc_biguint<2>(tmp_23_12_4_i_cast_fu_51792_p1.read())); } void Matrix_Vector_Activa::thread_tmp1636_fu_52253_p2() { tmp1636_fu_52253_p2 = (!tmp_23_12_5_i_cast_fu_51795_p1.read().is_01() || !tmp_23_12_6_i_cast_fu_51798_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_5_i_cast_fu_51795_p1.read()) + sc_biguint<2>(tmp_23_12_6_i_cast_fu_51798_p1.read())); } void Matrix_Vector_Activa::thread_tmp1637_fu_52263_p2() { tmp1637_fu_52263_p2 = (!tmp2445_cast_fu_52249_p1.read().is_01() || !tmp2446_cast_fu_52259_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2445_cast_fu_52249_p1.read()) + sc_biguint<3>(tmp2446_cast_fu_52259_p1.read())); } void Matrix_Vector_Activa::thread_tmp1638_fu_52273_p2() { tmp1638_fu_52273_p2 = (!tmp2441_cast_fu_52239_p1.read().is_01() || !tmp2444_cast_fu_52269_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2441_cast_fu_52239_p1.read()) + sc_biguint<4>(tmp2444_cast_fu_52269_p1.read())); } void Matrix_Vector_Activa::thread_tmp1639_fu_52283_p2() { tmp1639_fu_52283_p2 = (!tmp_23_12_7_i_cast_fu_51801_p1.read().is_01() || !tmp_23_12_8_i_cast_fu_51804_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_7_i_cast_fu_51801_p1.read()) + sc_biguint<2>(tmp_23_12_8_i_cast_fu_51804_p1.read())); } void Matrix_Vector_Activa::thread_tmp163_cast_fu_43431_p1() { tmp163_cast_fu_43431_p1 = esl_zext<5,4>(tmp105_fu_43425_p2.read()); } void Matrix_Vector_Activa::thread_tmp163_fu_3916_p2() { tmp163_fu_3916_p2 = (tmp_6337_fu_2312_p3.read() ^ tmp_6441_fu_3908_p3.read()); } void Matrix_Vector_Activa::thread_tmp1640_fu_52293_p2() { tmp1640_fu_52293_p2 = (!tmp_23_12_9_i_cast_fu_51807_p1.read().is_01() || !tmp_23_12_i_cast_5686_fu_51810_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_9_i_cast_fu_51807_p1.read()) + sc_biguint<2>(tmp_23_12_i_cast_5686_fu_51810_p1.read())); } void Matrix_Vector_Activa::thread_tmp1641_fu_52303_p2() { tmp1641_fu_52303_p2 = (!tmp2449_cast_fu_52289_p1.read().is_01() || !tmp2450_cast_fu_52299_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2449_cast_fu_52289_p1.read()) + sc_biguint<3>(tmp2450_cast_fu_52299_p1.read())); } void Matrix_Vector_Activa::thread_tmp1642_fu_52313_p2() { tmp1642_fu_52313_p2 = (!tmp_23_12_10_i_cast_fu_51813_p1.read().is_01() || !tmp_23_12_11_i_cast_fu_51816_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_10_i_cast_fu_51813_p1.read()) + sc_biguint<2>(tmp_23_12_11_i_cast_fu_51816_p1.read())); } void Matrix_Vector_Activa::thread_tmp1643_fu_52323_p2() { tmp1643_fu_52323_p2 = (!tmp_23_12_12_i_cast_fu_51819_p1.read().is_01() || !tmp_23_12_13_i_cast_fu_51822_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_12_i_cast_fu_51819_p1.read()) + sc_biguint<2>(tmp_23_12_13_i_cast_fu_51822_p1.read())); } void Matrix_Vector_Activa::thread_tmp1644_fu_52333_p2() { tmp1644_fu_52333_p2 = (!tmp2452_cast_fu_52319_p1.read().is_01() || !tmp2453_cast_fu_52329_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2452_cast_fu_52319_p1.read()) + sc_biguint<3>(tmp2453_cast_fu_52329_p1.read())); } void Matrix_Vector_Activa::thread_tmp1645_fu_52343_p2() { tmp1645_fu_52343_p2 = (!tmp2448_cast_fu_52309_p1.read().is_01() || !tmp2451_cast_fu_52339_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2448_cast_fu_52309_p1.read()) + sc_biguint<4>(tmp2451_cast_fu_52339_p1.read())); } void Matrix_Vector_Activa::thread_tmp1646_fu_52353_p2() { tmp1646_fu_52353_p2 = (!tmp2440_cast_fu_52279_p1.read().is_01() || !tmp2447_cast_fu_52349_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2440_cast_fu_52279_p1.read()) + sc_biguint<5>(tmp2447_cast_fu_52349_p1.read())); } void Matrix_Vector_Activa::thread_tmp1647_fu_52359_p2() { tmp1647_fu_52359_p2 = (!tmp_23_12_14_i_cast_fu_51825_p1.read().is_01() || !tmp_23_12_15_i_cast_fu_51828_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_14_i_cast_fu_51825_p1.read()) + sc_biguint<2>(tmp_23_12_15_i_cast_fu_51828_p1.read())); } void Matrix_Vector_Activa::thread_tmp1648_fu_52369_p2() { tmp1648_fu_52369_p2 = (!tmp_23_12_16_i_cast_fu_51831_p1.read().is_01() || !tmp_23_12_17_i_cast_fu_51834_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_16_i_cast_fu_51831_p1.read()) + sc_biguint<2>(tmp_23_12_17_i_cast_fu_51834_p1.read())); } void Matrix_Vector_Activa::thread_tmp1649_fu_52379_p2() { tmp1649_fu_52379_p2 = (!tmp2457_cast_fu_52365_p1.read().is_01() || !tmp2458_cast_fu_52375_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2457_cast_fu_52365_p1.read()) + sc_biguint<3>(tmp2458_cast_fu_52375_p1.read())); } void Matrix_Vector_Activa::thread_tmp164_cast_fu_43391_p1() { tmp164_cast_fu_43391_p1 = esl_zext<4,3>(tmp101_fu_43385_p2.read()); } void Matrix_Vector_Activa::thread_tmp164_fu_3936_p2() { tmp164_fu_3936_p2 = (tmp_6339_fu_2340_p3.read() ^ tmp_6442_fu_3928_p3.read()); } void Matrix_Vector_Activa::thread_tmp1650_fu_52389_p2() { tmp1650_fu_52389_p2 = (!tmp_23_12_18_i_cast_fu_51837_p1.read().is_01() || !tmp_23_12_19_i_cast_fu_51840_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_18_i_cast_fu_51837_p1.read()) + sc_biguint<2>(tmp_23_12_19_i_cast_fu_51840_p1.read())); } void Matrix_Vector_Activa::thread_tmp1651_fu_52399_p2() { tmp1651_fu_52399_p2 = (!tmp_23_12_20_i_cast_fu_51843_p1.read().is_01() || !tmp_23_12_21_i_cast_fu_51846_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_20_i_cast_fu_51843_p1.read()) + sc_biguint<2>(tmp_23_12_21_i_cast_fu_51846_p1.read())); } void Matrix_Vector_Activa::thread_tmp1652_fu_52409_p2() { tmp1652_fu_52409_p2 = (!tmp2460_cast_fu_52395_p1.read().is_01() || !tmp2461_cast_fu_52405_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2460_cast_fu_52395_p1.read()) + sc_biguint<3>(tmp2461_cast_fu_52405_p1.read())); } void Matrix_Vector_Activa::thread_tmp1653_fu_52419_p2() { tmp1653_fu_52419_p2 = (!tmp2456_cast_fu_52385_p1.read().is_01() || !tmp2459_cast_fu_52415_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2456_cast_fu_52385_p1.read()) + sc_biguint<4>(tmp2459_cast_fu_52415_p1.read())); } void Matrix_Vector_Activa::thread_tmp1654_fu_52429_p2() { tmp1654_fu_52429_p2 = (!tmp_23_12_22_i_cast_fu_51849_p1.read().is_01() || !tmp_23_12_23_i_cast_fu_51852_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_22_i_cast_fu_51849_p1.read()) + sc_biguint<2>(tmp_23_12_23_i_cast_fu_51852_p1.read())); } void Matrix_Vector_Activa::thread_tmp1655_fu_52439_p2() { tmp1655_fu_52439_p2 = (!tmp_23_12_24_i_cast_fu_51855_p1.read().is_01() || !tmp_23_12_25_i_cast_fu_51858_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_24_i_cast_fu_51855_p1.read()) + sc_biguint<2>(tmp_23_12_25_i_cast_fu_51858_p1.read())); } void Matrix_Vector_Activa::thread_tmp1656_cast_fu_67300_p1() { tmp1656_cast_fu_67300_p1 = esl_zext<16,2>(tmp1094_reg_80294.read()); } void Matrix_Vector_Activa::thread_tmp1656_fu_52449_p2() { tmp1656_fu_52449_p2 = (!tmp2464_cast_fu_52435_p1.read().is_01() || !tmp2465_cast_fu_52445_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2464_cast_fu_52435_p1.read()) + sc_biguint<3>(tmp2465_cast_fu_52445_p1.read())); } void Matrix_Vector_Activa::thread_tmp1657_cast_fu_67309_p1() { tmp1657_cast_fu_67309_p1 = esl_zext<16,3>(tmp1098_reg_80299.read()); } void Matrix_Vector_Activa::thread_tmp1657_fu_52459_p2() { tmp1657_fu_52459_p2 = (!tmp_23_12_26_i_cast_fu_51861_p1.read().is_01() || !tmp_23_12_27_i_cast_fu_51864_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_26_i_cast_fu_51861_p1.read()) + sc_biguint<2>(tmp_23_12_27_i_cast_fu_51864_p1.read())); } void Matrix_Vector_Activa::thread_tmp1658_cast_fu_49057_p1() { tmp1658_cast_fu_49057_p1 = esl_zext<3,2>(tmp1096_fu_49051_p2.read()); } void Matrix_Vector_Activa::thread_tmp1658_fu_52469_p2() { tmp1658_fu_52469_p2 = (!tmp_23_12_62_i_cast_fu_51966_p1.read().is_01() || !tmp_23_12_28_i_cast_fu_51867_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_62_i_cast_fu_51966_p1.read()) + sc_biguint<2>(tmp_23_12_28_i_cast_fu_51867_p1.read())); } void Matrix_Vector_Activa::thread_tmp1659_cast_fu_49067_p1() { tmp1659_cast_fu_49067_p1 = esl_zext<3,2>(tmp1097_fu_49061_p2.read()); } void Matrix_Vector_Activa::thread_tmp1659_fu_52475_p2() { tmp1659_fu_52475_p2 = (!tmp_23_12_29_i_cast_fu_51870_p1.read().is_01() || !tmp1658_fu_52469_p2.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_12_29_i_cast_fu_51870_p1.read()) + sc_biguint<2>(tmp1658_fu_52469_p2.read())); } void Matrix_Vector_Activa::thread_tmp165_cast_fu_43371_p1() { tmp165_cast_fu_43371_p1 = esl_zext<3,2>(tmp99_fu_43365_p2.read()); } void Matrix_Vector_Activa::thread_tmp165_fu_3956_p2() { tmp165_fu_3956_p2 = (tmp_6341_fu_2368_p3.read() ^ tmp_6443_fu_3948_p3.read()); } void Matrix_Vector_Activa::thread_tmp1660_cast_fu_67318_p1() { tmp1660_cast_fu_67318_p1 = esl_zext<16,4>(tmp1106_reg_80304.read()); } void Matrix_Vector_Activa::thread_tmp1660_fu_52485_p2() { tmp1660_fu_52485_p2 = (!tmp2467_cast_fu_52465_p1.read().is_01() || !tmp2468_cast_fu_52481_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2467_cast_fu_52465_p1.read()) + sc_biguint<3>(tmp2468_cast_fu_52481_p1.read())); } void Matrix_Vector_Activa::thread_tmp1661_cast_fu_49103_p1() { tmp1661_cast_fu_49103_p1 = esl_zext<4,3>(tmp1102_fu_49097_p2.read()); } void Matrix_Vector_Activa::thread_tmp1661_fu_52495_p2() { tmp1661_fu_52495_p2 = (!tmp2463_cast_fu_52455_p1.read().is_01() || !tmp2466_cast_fu_52491_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2463_cast_fu_52455_p1.read()) + sc_biguint<4>(tmp2466_cast_fu_52491_p1.read())); } void Matrix_Vector_Activa::thread_tmp1662_cast_fu_49083_p1() { tmp1662_cast_fu_49083_p1 = esl_zext<3,2>(tmp1100_fu_49077_p2.read()); } void Matrix_Vector_Activa::thread_tmp1662_fu_52505_p2() { tmp1662_fu_52505_p2 = (!tmp2455_cast_fu_52425_p1.read().is_01() || !tmp2462_cast_fu_52501_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2455_cast_fu_52425_p1.read()) + sc_biguint<5>(tmp2462_cast_fu_52501_p1.read())); } void Matrix_Vector_Activa::thread_tmp1663_cast_fu_49093_p1() { tmp1663_cast_fu_49093_p1 = esl_zext<3,2>(tmp1101_fu_49087_p2.read()); } void Matrix_Vector_Activa::thread_tmp1663_fu_67610_p2() { tmp1663_fu_67610_p2 = (!tmp2439_cast_fu_67604_p1.read().is_01() || !tmp2454_cast_fu_67607_p1.read().is_01())? sc_lv<6>(): (sc_biguint<6>(tmp2439_cast_fu_67604_p1.read()) + sc_biguint<6>(tmp2454_cast_fu_67607_p1.read())); } void Matrix_Vector_Activa::thread_tmp1664_cast_fu_49133_p1() { tmp1664_cast_fu_49133_p1 = esl_zext<4,3>(tmp1105_fu_49127_p2.read()); } void Matrix_Vector_Activa::thread_tmp1664_fu_18768_p2() { tmp1664_fu_18768_p2 = (tmp_6291_fu_1672_p1.read() ^ tmp_7186_fu_18764_p1.read()); } void Matrix_Vector_Activa::thread_tmp1665_cast_fu_49113_p1() { tmp1665_cast_fu_49113_p1 = esl_zext<3,2>(tmp1103_fu_49107_p2.read()); } void Matrix_Vector_Activa::thread_tmp1665_fu_18788_p2() { tmp1665_fu_18788_p2 = (tmp_6293_fu_1696_p3.read() ^ tmp_7187_fu_18780_p3.read()); } void Matrix_Vector_Activa::thread_tmp1666_cast_fu_49123_p1() { tmp1666_cast_fu_49123_p1 = esl_zext<3,2>(tmp1104_fu_49117_p2.read()); } void Matrix_Vector_Activa::thread_tmp1666_fu_18808_p2() { tmp1666_fu_18808_p2 = (tmp_6295_fu_1724_p3.read() ^ tmp_7188_fu_18800_p3.read()); } void Matrix_Vector_Activa::thread_tmp1667_cast_fu_67327_p1() { tmp1667_cast_fu_67327_p1 = esl_zext<16,5>(tmp1122_reg_80309.read()); } void Matrix_Vector_Activa::thread_tmp1667_fu_18828_p2() { tmp1667_fu_18828_p2 = (tmp_6297_fu_1752_p3.read() ^ tmp_7189_fu_18820_p3.read()); } void Matrix_Vector_Activa::thread_tmp1668_cast_fu_49209_p1() { tmp1668_cast_fu_49209_p1 = esl_zext<5,4>(tmp1114_fu_49203_p2.read()); } void Matrix_Vector_Activa::thread_tmp1668_fu_18848_p2() { tmp1668_fu_18848_p2 = (tmp_6299_fu_1780_p3.read() ^ tmp_7190_fu_18840_p3.read()); } void Matrix_Vector_Activa::thread_tmp1669_cast_fu_49169_p1() { tmp1669_cast_fu_49169_p1 = esl_zext<4,3>(tmp1110_fu_49163_p2.read()); } void Matrix_Vector_Activa::thread_tmp1669_fu_18868_p2() { tmp1669_fu_18868_p2 = (tmp_6301_fu_1808_p3.read() ^ tmp_7191_fu_18860_p3.read()); } void Matrix_Vector_Activa::thread_tmp166_cast_fu_43381_p1() { tmp166_cast_fu_43381_p1 = esl_zext<3,2>(tmp100_fu_43375_p2.read()); } void Matrix_Vector_Activa::thread_tmp166_fu_3976_p2() { tmp166_fu_3976_p2 = (tmp_6343_fu_2396_p3.read() ^ tmp_6444_fu_3968_p3.read()); } void Matrix_Vector_Activa::thread_tmp1670_cast_fu_49149_p1() { tmp1670_cast_fu_49149_p1 = esl_zext<3,2>(tmp1108_fu_49143_p2.read()); } void Matrix_Vector_Activa::thread_tmp1670_fu_18888_p2() { tmp1670_fu_18888_p2 = (tmp_6303_fu_1836_p3.read() ^ tmp_7192_fu_18880_p3.read()); } void Matrix_Vector_Activa::thread_tmp1671_cast_fu_49159_p1() { tmp1671_cast_fu_49159_p1 = esl_zext<3,2>(tmp1109_fu_49153_p2.read()); } void Matrix_Vector_Activa::thread_tmp1671_fu_18908_p2() { tmp1671_fu_18908_p2 = (tmp_6305_fu_1864_p3.read() ^ tmp_7193_fu_18900_p3.read()); } void Matrix_Vector_Activa::thread_tmp1672_cast_fu_49199_p1() { tmp1672_cast_fu_49199_p1 = esl_zext<4,3>(tmp1113_fu_49193_p2.read()); } void Matrix_Vector_Activa::thread_tmp1672_fu_18928_p2() { tmp1672_fu_18928_p2 = (tmp_6307_fu_1892_p3.read() ^ tmp_7194_fu_18920_p3.read()); } void Matrix_Vector_Activa::thread_tmp1673_cast_fu_49179_p1() { tmp1673_cast_fu_49179_p1 = esl_zext<3,2>(tmp1111_fu_49173_p2.read()); } void Matrix_Vector_Activa::thread_tmp1673_fu_18948_p2() { tmp1673_fu_18948_p2 = (tmp_6309_fu_1920_p3.read() ^ tmp_7195_fu_18940_p3.read()); } void Matrix_Vector_Activa::thread_tmp1674_cast_fu_49189_p1() { tmp1674_cast_fu_49189_p1 = esl_zext<3,2>(tmp1112_fu_49183_p2.read()); } void Matrix_Vector_Activa::thread_tmp1674_fu_18968_p2() { tmp1674_fu_18968_p2 = (tmp_6311_fu_1948_p3.read() ^ tmp_7196_fu_18960_p3.read()); } void Matrix_Vector_Activa::thread_tmp1675_cast_fu_49279_p1() { tmp1675_cast_fu_49279_p1 = esl_zext<5,4>(tmp1121_fu_49273_p2.read()); } void Matrix_Vector_Activa::thread_tmp1675_fu_18988_p2() { tmp1675_fu_18988_p2 = (tmp_6313_fu_1976_p3.read() ^ tmp_7197_fu_18980_p3.read()); } void Matrix_Vector_Activa::thread_tmp1676_cast_fu_49239_p1() { tmp1676_cast_fu_49239_p1 = esl_zext<4,3>(tmp1117_fu_49233_p2.read()); } void Matrix_Vector_Activa::thread_tmp1676_fu_19008_p2() { tmp1676_fu_19008_p2 = (tmp_6315_fu_2004_p3.read() ^ tmp_7198_fu_19000_p3.read()); } void Matrix_Vector_Activa::thread_tmp1677_cast_fu_49219_p1() { tmp1677_cast_fu_49219_p1 = esl_zext<3,2>(tmp1115_fu_49213_p2.read()); } void Matrix_Vector_Activa::thread_tmp1677_fu_19028_p2() { tmp1677_fu_19028_p2 = (tmp_6317_fu_2032_p3.read() ^ tmp_7199_fu_19020_p3.read()); } void Matrix_Vector_Activa::thread_tmp1678_cast_fu_49229_p1() { tmp1678_cast_fu_49229_p1 = esl_zext<3,2>(tmp1116_fu_49223_p2.read()); } void Matrix_Vector_Activa::thread_tmp1678_fu_19048_p2() { tmp1678_fu_19048_p2 = (tmp_6319_fu_2060_p3.read() ^ tmp_7200_fu_19040_p3.read()); } void Matrix_Vector_Activa::thread_tmp1679_cast_fu_49269_p1() { tmp1679_cast_fu_49269_p1 = esl_zext<4,3>(tmp1120_fu_49263_p2.read()); } void Matrix_Vector_Activa::thread_tmp1679_fu_19068_p2() { tmp1679_fu_19068_p2 = (tmp_6321_fu_2088_p3.read() ^ tmp_7201_fu_19060_p3.read()); } void Matrix_Vector_Activa::thread_tmp167_cast_fu_43421_p1() { tmp167_cast_fu_43421_p1 = esl_zext<4,3>(tmp104_fu_43415_p2.read()); } void Matrix_Vector_Activa::thread_tmp167_fu_3996_p2() { tmp167_fu_3996_p2 = (tmp_6345_fu_2424_p3.read() ^ tmp_6445_fu_3988_p3.read()); } void Matrix_Vector_Activa::thread_tmp1680_cast_fu_49249_p1() { tmp1680_cast_fu_49249_p1 = esl_zext<3,2>(tmp1118_fu_49243_p2.read()); } void Matrix_Vector_Activa::thread_tmp1680_fu_19088_p2() { tmp1680_fu_19088_p2 = (tmp_6323_fu_2116_p3.read() ^ tmp_7202_fu_19080_p3.read()); } void Matrix_Vector_Activa::thread_tmp1681_cast_fu_49259_p1() { tmp1681_cast_fu_49259_p1 = esl_zext<3,2>(tmp1119_fu_49253_p2.read()); } void Matrix_Vector_Activa::thread_tmp1681_fu_19108_p2() { tmp1681_fu_19108_p2 = (tmp_6325_fu_2144_p3.read() ^ tmp_7203_fu_19100_p3.read()); } void Matrix_Vector_Activa::thread_tmp1682_cast_fu_67348_p1() { tmp1682_cast_fu_67348_p1 = esl_zext<16,6>(tmp1155_fu_67342_p2.read()); } void Matrix_Vector_Activa::thread_tmp1682_fu_19128_p2() { tmp1682_fu_19128_p2 = (tmp_6327_fu_2172_p3.read() ^ tmp_7204_fu_19120_p3.read()); } void Matrix_Vector_Activa::thread_tmp1683_cast_fu_67336_p1() { tmp1683_cast_fu_67336_p1 = esl_zext<6,5>(tmp1138_reg_80314.read()); } void Matrix_Vector_Activa::thread_tmp1683_fu_19148_p2() { tmp1683_fu_19148_p2 = (tmp_6329_fu_2200_p3.read() ^ tmp_7205_fu_19140_p3.read()); } void Matrix_Vector_Activa::thread_tmp1684_cast_fu_49355_p1() { tmp1684_cast_fu_49355_p1 = esl_zext<5,4>(tmp1130_fu_49349_p2.read()); } void Matrix_Vector_Activa::thread_tmp1684_fu_19168_p2() { tmp1684_fu_19168_p2 = (tmp_6331_fu_2228_p3.read() ^ tmp_7206_fu_19160_p3.read()); } void Matrix_Vector_Activa::thread_tmp1685_cast_fu_49315_p1() { tmp1685_cast_fu_49315_p1 = esl_zext<4,3>(tmp1126_fu_49309_p2.read()); } void Matrix_Vector_Activa::thread_tmp1685_fu_19188_p2() { tmp1685_fu_19188_p2 = (tmp_6333_fu_2256_p3.read() ^ tmp_7207_fu_19180_p3.read()); } void Matrix_Vector_Activa::thread_tmp1686_cast_fu_49295_p1() { tmp1686_cast_fu_49295_p1 = esl_zext<3,2>(tmp1124_fu_49289_p2.read()); } void Matrix_Vector_Activa::thread_tmp1686_fu_19208_p2() { tmp1686_fu_19208_p2 = (tmp_6335_fu_2284_p3.read() ^ tmp_7208_fu_19200_p3.read()); } void Matrix_Vector_Activa::thread_tmp1687_cast_fu_49305_p1() { tmp1687_cast_fu_49305_p1 = esl_zext<3,2>(tmp1125_fu_49299_p2.read()); } void Matrix_Vector_Activa::thread_tmp1687_fu_19228_p2() { tmp1687_fu_19228_p2 = (tmp_6337_fu_2312_p3.read() ^ tmp_7209_fu_19220_p3.read()); } void Matrix_Vector_Activa::thread_tmp1688_cast_fu_49345_p1() { tmp1688_cast_fu_49345_p1 = esl_zext<4,3>(tmp1129_fu_49339_p2.read()); } void Matrix_Vector_Activa::thread_tmp1688_fu_19248_p2() { tmp1688_fu_19248_p2 = (tmp_6339_fu_2340_p3.read() ^ tmp_7210_fu_19240_p3.read()); } void Matrix_Vector_Activa::thread_tmp1689_cast_fu_49325_p1() { tmp1689_cast_fu_49325_p1 = esl_zext<3,2>(tmp1127_fu_49319_p2.read()); } void Matrix_Vector_Activa::thread_tmp1689_fu_19268_p2() { tmp1689_fu_19268_p2 = (tmp_6341_fu_2368_p3.read() ^ tmp_7211_fu_19260_p3.read()); } void Matrix_Vector_Activa::thread_tmp168_cast_fu_43401_p1() { tmp168_cast_fu_43401_p1 = esl_zext<3,2>(tmp102_fu_43395_p2.read()); } void Matrix_Vector_Activa::thread_tmp168_fu_4016_p2() { tmp168_fu_4016_p2 = (tmp_6347_fu_2452_p3.read() ^ tmp_6446_fu_4008_p3.read()); } void Matrix_Vector_Activa::thread_tmp1690_cast_fu_49335_p1() { tmp1690_cast_fu_49335_p1 = esl_zext<3,2>(tmp1128_fu_49329_p2.read()); } void Matrix_Vector_Activa::thread_tmp1690_fu_19288_p2() { tmp1690_fu_19288_p2 = (tmp_6343_fu_2396_p3.read() ^ tmp_7212_fu_19280_p3.read()); } void Matrix_Vector_Activa::thread_tmp1691_cast_fu_49425_p1() { tmp1691_cast_fu_49425_p1 = esl_zext<5,4>(tmp1137_fu_49419_p2.read()); } void Matrix_Vector_Activa::thread_tmp1691_fu_19308_p2() { tmp1691_fu_19308_p2 = (tmp_6345_fu_2424_p3.read() ^ tmp_7213_fu_19300_p3.read()); } void Matrix_Vector_Activa::thread_tmp1692_cast_fu_49385_p1() { tmp1692_cast_fu_49385_p1 = esl_zext<4,3>(tmp1133_fu_49379_p2.read()); } void Matrix_Vector_Activa::thread_tmp1692_fu_19328_p2() { tmp1692_fu_19328_p2 = (tmp_6347_fu_2452_p3.read() ^ tmp_7214_fu_19320_p3.read()); } void Matrix_Vector_Activa::thread_tmp1693_cast_fu_49365_p1() { tmp1693_cast_fu_49365_p1 = esl_zext<3,2>(tmp1131_fu_49359_p2.read()); } void Matrix_Vector_Activa::thread_tmp1693_fu_19348_p2() { tmp1693_fu_19348_p2 = (tmp_6349_fu_2480_p3.read() ^ tmp_7215_fu_19340_p3.read()); } void Matrix_Vector_Activa::thread_tmp1694_cast_fu_49375_p1() { tmp1694_cast_fu_49375_p1 = esl_zext<3,2>(tmp1132_fu_49369_p2.read()); } void Matrix_Vector_Activa::thread_tmp1694_fu_19368_p2() { tmp1694_fu_19368_p2 = (tmp_6351_fu_2508_p3.read() ^ tmp_7216_fu_19360_p3.read()); } void Matrix_Vector_Activa::thread_tmp1695_cast_fu_49415_p1() { tmp1695_cast_fu_49415_p1 = esl_zext<4,3>(tmp1136_fu_49409_p2.read()); } void Matrix_Vector_Activa::thread_tmp1695_fu_19388_p2() { tmp1695_fu_19388_p2 = (tmp_6353_fu_2536_p3.read() ^ tmp_7217_fu_19380_p3.read()); } void Matrix_Vector_Activa::thread_tmp1696_cast_fu_49395_p1() { tmp1696_cast_fu_49395_p1 = esl_zext<3,2>(tmp1134_fu_49389_p2.read()); } void Matrix_Vector_Activa::thread_tmp1696_fu_19408_p2() { tmp1696_fu_19408_p2 = (tmp_6355_fu_2564_p3.read() ^ tmp_7218_fu_19400_p3.read()); } void Matrix_Vector_Activa::thread_tmp1697_cast_fu_49405_p1() { tmp1697_cast_fu_49405_p1 = esl_zext<3,2>(tmp1135_fu_49399_p2.read()); } void Matrix_Vector_Activa::thread_tmp1697_fu_19428_p2() { tmp1697_fu_19428_p2 = (tmp_6357_fu_2592_p3.read() ^ tmp_7219_fu_19420_p3.read()); } void Matrix_Vector_Activa::thread_tmp1698_cast_fu_67339_p1() { tmp1698_cast_fu_67339_p1 = esl_zext<6,5>(tmp1154_reg_80319.read()); } void Matrix_Vector_Activa::thread_tmp1698_fu_19448_p2() { tmp1698_fu_19448_p2 = (tmp_6359_fu_2620_p3.read() ^ tmp_7220_fu_19440_p3.read()); } void Matrix_Vector_Activa::thread_tmp1699_cast_fu_49501_p1() { tmp1699_cast_fu_49501_p1 = esl_zext<5,4>(tmp1145_fu_49495_p2.read()); } void Matrix_Vector_Activa::thread_tmp1699_fu_19468_p2() { tmp1699_fu_19468_p2 = (tmp_6361_fu_2648_p3.read() ^ tmp_7221_fu_19460_p3.read()); } void Matrix_Vector_Activa::thread_tmp169_cast_fu_43411_p1() { tmp169_cast_fu_43411_p1 = esl_zext<3,2>(tmp103_fu_43405_p2.read()); } void Matrix_Vector_Activa::thread_tmp169_fu_4036_p2() { tmp169_fu_4036_p2 = (tmp_6349_fu_2480_p3.read() ^ tmp_6447_fu_4028_p3.read()); } void Matrix_Vector_Activa::thread_tmp16_fu_1760_p2() { tmp16_fu_1760_p2 = (tmp_6297_fu_1752_p3.read() ^ tmp_6296_fu_1744_p3.read()); } void Matrix_Vector_Activa::thread_tmp1700_cast_fu_49461_p1() { tmp1700_cast_fu_49461_p1 = esl_zext<4,3>(tmp1141_fu_49455_p2.read()); } void Matrix_Vector_Activa::thread_tmp1700_fu_19488_p2() { tmp1700_fu_19488_p2 = (tmp_6363_fu_2676_p3.read() ^ tmp_7222_fu_19480_p3.read()); } void Matrix_Vector_Activa::thread_tmp1701_cast_fu_49441_p1() { tmp1701_cast_fu_49441_p1 = esl_zext<3,2>(tmp1139_fu_49435_p2.read()); } void Matrix_Vector_Activa::thread_tmp1701_fu_19508_p2() { tmp1701_fu_19508_p2 = (tmp_6365_fu_2704_p3.read() ^ tmp_7223_fu_19500_p3.read()); } void Matrix_Vector_Activa::thread_tmp1702_cast_fu_49451_p1() { tmp1702_cast_fu_49451_p1 = esl_zext<3,2>(tmp1140_fu_49445_p2.read()); } void Matrix_Vector_Activa::thread_tmp1702_fu_19528_p2() { tmp1702_fu_19528_p2 = (tmp_6367_fu_2732_p3.read() ^ tmp_7224_fu_19520_p3.read()); } void Matrix_Vector_Activa::thread_tmp1703_cast_fu_49491_p1() { tmp1703_cast_fu_49491_p1 = esl_zext<4,3>(tmp1144_fu_49485_p2.read()); } void Matrix_Vector_Activa::thread_tmp1703_fu_19548_p2() { tmp1703_fu_19548_p2 = (tmp_6369_fu_2760_p3.read() ^ tmp_7225_fu_19540_p3.read()); } void Matrix_Vector_Activa::thread_tmp1704_cast_fu_49471_p1() { tmp1704_cast_fu_49471_p1 = esl_zext<3,2>(tmp1142_fu_49465_p2.read()); } void Matrix_Vector_Activa::thread_tmp1704_fu_19568_p2() { tmp1704_fu_19568_p2 = (tmp_6371_fu_2788_p3.read() ^ tmp_7226_fu_19560_p3.read()); } void Matrix_Vector_Activa::thread_tmp1705_cast_fu_49481_p1() { tmp1705_cast_fu_49481_p1 = esl_zext<3,2>(tmp1143_fu_49475_p2.read()); } void Matrix_Vector_Activa::thread_tmp1705_fu_19588_p2() { tmp1705_fu_19588_p2 = (tmp_6373_fu_2816_p3.read() ^ tmp_7227_fu_19580_p3.read()); } void Matrix_Vector_Activa::thread_tmp1706_cast_fu_49577_p1() { tmp1706_cast_fu_49577_p1 = esl_zext<5,4>(tmp1153_fu_49571_p2.read()); } void Matrix_Vector_Activa::thread_tmp1706_fu_19608_p2() { tmp1706_fu_19608_p2 = (tmp_6375_fu_2844_p3.read() ^ tmp_7228_fu_19600_p3.read()); } void Matrix_Vector_Activa::thread_tmp1707_cast_fu_49531_p1() { tmp1707_cast_fu_49531_p1 = esl_zext<4,3>(tmp1148_fu_49525_p2.read()); } void Matrix_Vector_Activa::thread_tmp1707_fu_19628_p2() { tmp1707_fu_19628_p2 = (tmp_6377_fu_2872_p3.read() ^ tmp_7229_fu_19620_p3.read()); } void Matrix_Vector_Activa::thread_tmp1708_cast_fu_49511_p1() { tmp1708_cast_fu_49511_p1 = esl_zext<3,2>(tmp1146_fu_49505_p2.read()); } void Matrix_Vector_Activa::thread_tmp1708_fu_19648_p2() { tmp1708_fu_19648_p2 = (tmp_6379_fu_2900_p3.read() ^ tmp_7230_fu_19640_p3.read()); } void Matrix_Vector_Activa::thread_tmp1709_cast_fu_49521_p1() { tmp1709_cast_fu_49521_p1 = esl_zext<3,2>(tmp1147_fu_49515_p2.read()); } void Matrix_Vector_Activa::thread_tmp1709_fu_19668_p2() { tmp1709_fu_19668_p2 = (tmp_6381_fu_2928_p3.read() ^ tmp_7231_fu_19660_p3.read()); } void Matrix_Vector_Activa::thread_tmp170_cast_fu_66812_p1() { tmp170_cast_fu_66812_p1 = esl_zext<16,6>(tmp139_fu_66806_p2.read()); } void Matrix_Vector_Activa::thread_tmp170_fu_4056_p2() { tmp170_fu_4056_p2 = (tmp_6351_fu_2508_p3.read() ^ tmp_6448_fu_4048_p3.read()); } void Matrix_Vector_Activa::thread_tmp1710_cast_fu_49567_p1() { tmp1710_cast_fu_49567_p1 = esl_zext<4,3>(tmp1152_fu_49561_p2.read()); } void Matrix_Vector_Activa::thread_tmp1710_fu_19688_p2() { tmp1710_fu_19688_p2 = (tmp_6383_fu_2956_p3.read() ^ tmp_7232_fu_19680_p3.read()); } void Matrix_Vector_Activa::thread_tmp1711_cast_fu_49541_p1() { tmp1711_cast_fu_49541_p1 = esl_zext<3,2>(tmp1149_fu_49535_p2.read()); } void Matrix_Vector_Activa::thread_tmp1711_fu_19708_p2() { tmp1711_fu_19708_p2 = (tmp_6385_fu_2984_p3.read() ^ tmp_7233_fu_19700_p3.read()); } void Matrix_Vector_Activa::thread_tmp1712_cast_fu_49557_p1() { tmp1712_cast_fu_49557_p1 = esl_zext<3,2>(tmp1151_fu_49551_p2.read()); } void Matrix_Vector_Activa::thread_tmp1712_fu_19728_p2() { tmp1712_fu_19728_p2 = (tmp_6387_fu_3012_p3.read() ^ tmp_7234_fu_19720_p3.read()); } void Matrix_Vector_Activa::thread_tmp1713_fu_19748_p2() { tmp1713_fu_19748_p2 = (tmp_6389_fu_3040_p3.read() ^ tmp_7235_fu_19740_p3.read()); } void Matrix_Vector_Activa::thread_tmp1714_fu_19768_p2() { tmp1714_fu_19768_p2 = (tmp_6391_fu_3068_p3.read() ^ tmp_7236_fu_19760_p3.read()); } void Matrix_Vector_Activa::thread_tmp1715_fu_19788_p2() { tmp1715_fu_19788_p2 = (tmp_6393_fu_3096_p3.read() ^ tmp_7237_fu_19780_p3.read()); } void Matrix_Vector_Activa::thread_tmp1716_fu_19808_p2() { tmp1716_fu_19808_p2 = (tmp_6395_fu_3124_p3.read() ^ tmp_7238_fu_19800_p3.read()); } void Matrix_Vector_Activa::thread_tmp1717_fu_19828_p2() { tmp1717_fu_19828_p2 = (tmp_6397_fu_3152_p3.read() ^ tmp_7239_fu_19820_p3.read()); } void Matrix_Vector_Activa::thread_tmp1718_fu_19848_p2() { tmp1718_fu_19848_p2 = (tmp_6399_fu_3180_p3.read() ^ tmp_7240_fu_19840_p3.read()); } void Matrix_Vector_Activa::thread_tmp1719_fu_19868_p2() { tmp1719_fu_19868_p2 = (tmp_6401_fu_3208_p3.read() ^ tmp_7241_fu_19860_p3.read()); } void Matrix_Vector_Activa::thread_tmp171_cast_fu_66800_p1() { tmp171_cast_fu_66800_p1 = esl_zext<6,5>(tmp122_reg_80074.read()); } void Matrix_Vector_Activa::thread_tmp171_fu_4076_p2() { tmp171_fu_4076_p2 = (tmp_6353_fu_2536_p3.read() ^ tmp_6449_fu_4068_p3.read()); } void Matrix_Vector_Activa::thread_tmp1720_fu_19888_p2() { tmp1720_fu_19888_p2 = (tmp_6403_fu_3236_p3.read() ^ tmp_7242_fu_19880_p3.read()); } void Matrix_Vector_Activa::thread_tmp1721_fu_19908_p2() { tmp1721_fu_19908_p2 = (tmp_6405_fu_3264_p3.read() ^ tmp_7243_fu_19900_p3.read()); } void Matrix_Vector_Activa::thread_tmp1722_fu_19928_p2() { tmp1722_fu_19928_p2 = (tmp_6407_fu_3292_p3.read() ^ tmp_7244_fu_19920_p3.read()); } void Matrix_Vector_Activa::thread_tmp1723_fu_19948_p2() { tmp1723_fu_19948_p2 = (tmp_6409_fu_3320_p3.read() ^ tmp_7245_fu_19940_p3.read()); } void Matrix_Vector_Activa::thread_tmp1724_fu_19968_p2() { tmp1724_fu_19968_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_7246_fu_19960_p3.read()); } void Matrix_Vector_Activa::thread_tmp1725_fu_19988_p2() { tmp1725_fu_19988_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_7247_fu_19980_p3.read()); } void Matrix_Vector_Activa::thread_tmp1726_fu_20008_p2() { tmp1726_fu_20008_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_7248_fu_20000_p3.read()); } void Matrix_Vector_Activa::thread_tmp1727_fu_20028_p2() { tmp1727_fu_20028_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_7249_fu_20020_p3.read()); } void Matrix_Vector_Activa::thread_tmp1728_fu_67629_p2() { tmp1728_fu_67629_p2 = (!tmp_23_13_60_i_fu_67626_p1.read().is_01() || !p_accu_V_0_13_i_fu_66657_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_13_60_i_fu_67626_p1.read()) + sc_biguint<16>(p_accu_V_0_13_i_fu_66657_p3.read())); } void Matrix_Vector_Activa::thread_tmp1729_fu_52700_p2() { tmp1729_fu_52700_p2 = (!tmp_23_13_59_i_cast_fu_52691_p1.read().is_01() || !tmp_23_13_61_i_cast_fu_52694_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_59_i_cast_fu_52691_p1.read()) + sc_biguint<2>(tmp_23_13_61_i_cast_fu_52694_p1.read())); } void Matrix_Vector_Activa::thread_tmp172_cast_fu_43507_p1() { tmp172_cast_fu_43507_p1 = esl_zext<5,4>(tmp114_fu_43501_p2.read()); } void Matrix_Vector_Activa::thread_tmp172_fu_4096_p2() { tmp172_fu_4096_p2 = (tmp_6355_fu_2564_p3.read() ^ tmp_6450_fu_4088_p3.read()); } void Matrix_Vector_Activa::thread_tmp1730_fu_67638_p2() { tmp1730_fu_67638_p2 = (!tmp1728_fu_67629_p2.read().is_01() || !tmp2601_cast_fu_67635_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1728_fu_67629_p2.read()) + sc_biguint<16>(tmp2601_cast_fu_67635_p1.read())); } void Matrix_Vector_Activa::thread_tmp1731_fu_52706_p2() { tmp1731_fu_52706_p2 = (!tmp_23_13_55_i_cast_fu_52679_p1.read().is_01() || !tmp_23_13_58_i_cast_fu_52688_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_55_i_cast_fu_52679_p1.read()) + sc_biguint<2>(tmp_23_13_58_i_cast_fu_52688_p1.read())); } void Matrix_Vector_Activa::thread_tmp1732_fu_52716_p2() { tmp1732_fu_52716_p2 = (!tmp_23_13_57_i_cast_fu_52685_p1.read().is_01() || !tmp_23_13_54_i_cast_fu_52676_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_57_i_cast_fu_52685_p1.read()) + sc_biguint<2>(tmp_23_13_54_i_cast_fu_52676_p1.read())); } void Matrix_Vector_Activa::thread_tmp1733_fu_52726_p2() { tmp1733_fu_52726_p2 = (!tmp2603_cast_fu_52712_p1.read().is_01() || !tmp2604_cast_fu_52722_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2603_cast_fu_52712_p1.read()) + sc_biguint<3>(tmp2604_cast_fu_52722_p1.read())); } void Matrix_Vector_Activa::thread_tmp1734_fu_67647_p2() { tmp1734_fu_67647_p2 = (!tmp1730_fu_67638_p2.read().is_01() || !tmp2602_cast_fu_67644_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1730_fu_67638_p2.read()) + sc_biguint<16>(tmp2602_cast_fu_67644_p1.read())); } void Matrix_Vector_Activa::thread_tmp1735_fu_52732_p2() { tmp1735_fu_52732_p2 = (!tmp_23_13_47_i_cast_fu_52655_p1.read().is_01() || !tmp_23_13_56_i_cast_fu_52682_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_47_i_cast_fu_52655_p1.read()) + sc_biguint<2>(tmp_23_13_56_i_cast_fu_52682_p1.read())); } void Matrix_Vector_Activa::thread_tmp1736_fu_52742_p2() { tmp1736_fu_52742_p2 = (!tmp_23_13_49_i_cast_fu_52661_p1.read().is_01() || !tmp_23_13_46_i_cast_fu_52652_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_49_i_cast_fu_52661_p1.read()) + sc_biguint<2>(tmp_23_13_46_i_cast_fu_52652_p1.read())); } void Matrix_Vector_Activa::thread_tmp1737_fu_52752_p2() { tmp1737_fu_52752_p2 = (!tmp2607_cast_fu_52738_p1.read().is_01() || !tmp2608_cast_fu_52748_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2607_cast_fu_52738_p1.read()) + sc_biguint<3>(tmp2608_cast_fu_52748_p1.read())); } void Matrix_Vector_Activa::thread_tmp1738_fu_52762_p2() { tmp1738_fu_52762_p2 = (!tmp_23_13_51_i_cast_fu_52667_p1.read().is_01() || !tmp_23_13_48_i_cast_fu_52658_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_51_i_cast_fu_52667_p1.read()) + sc_biguint<2>(tmp_23_13_48_i_cast_fu_52658_p1.read())); } void Matrix_Vector_Activa::thread_tmp1739_fu_52772_p2() { tmp1739_fu_52772_p2 = (!tmp_23_13_53_i_cast_fu_52673_p1.read().is_01() || !tmp_23_13_50_i_cast_fu_52664_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_53_i_cast_fu_52673_p1.read()) + sc_biguint<2>(tmp_23_13_50_i_cast_fu_52664_p1.read())); } void Matrix_Vector_Activa::thread_tmp173_cast_fu_43467_p1() { tmp173_cast_fu_43467_p1 = esl_zext<4,3>(tmp110_fu_43461_p2.read()); } void Matrix_Vector_Activa::thread_tmp173_fu_4116_p2() { tmp173_fu_4116_p2 = (tmp_6357_fu_2592_p3.read() ^ tmp_6451_fu_4108_p3.read()); } void Matrix_Vector_Activa::thread_tmp1740_fu_52782_p2() { tmp1740_fu_52782_p2 = (!tmp2610_cast_fu_52768_p1.read().is_01() || !tmp2611_cast_fu_52778_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2610_cast_fu_52768_p1.read()) + sc_biguint<3>(tmp2611_cast_fu_52778_p1.read())); } void Matrix_Vector_Activa::thread_tmp1741_fu_52792_p2() { tmp1741_fu_52792_p2 = (!tmp2606_cast_fu_52758_p1.read().is_01() || !tmp2609_cast_fu_52788_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2606_cast_fu_52758_p1.read()) + sc_biguint<4>(tmp2609_cast_fu_52788_p1.read())); } void Matrix_Vector_Activa::thread_tmp1742_fu_67656_p2() { tmp1742_fu_67656_p2 = (!tmp1734_fu_67647_p2.read().is_01() || !tmp2605_cast_fu_67653_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1734_fu_67647_p2.read()) + sc_biguint<16>(tmp2605_cast_fu_67653_p1.read())); } void Matrix_Vector_Activa::thread_tmp1743_fu_52798_p2() { tmp1743_fu_52798_p2 = (!tmp_23_13_31_i_cast_fu_52607_p1.read().is_01() || !tmp_23_13_52_i_cast_fu_52670_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_31_i_cast_fu_52607_p1.read()) + sc_biguint<2>(tmp_23_13_52_i_cast_fu_52670_p1.read())); } void Matrix_Vector_Activa::thread_tmp1744_fu_52808_p2() { tmp1744_fu_52808_p2 = (!tmp_23_13_33_i_cast_fu_52613_p1.read().is_01() || !tmp_23_13_30_i_cast_fu_52604_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_33_i_cast_fu_52613_p1.read()) + sc_biguint<2>(tmp_23_13_30_i_cast_fu_52604_p1.read())); } void Matrix_Vector_Activa::thread_tmp1745_fu_52818_p2() { tmp1745_fu_52818_p2 = (!tmp2615_cast_fu_52804_p1.read().is_01() || !tmp2616_cast_fu_52814_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2615_cast_fu_52804_p1.read()) + sc_biguint<3>(tmp2616_cast_fu_52814_p1.read())); } void Matrix_Vector_Activa::thread_tmp1746_fu_52828_p2() { tmp1746_fu_52828_p2 = (!tmp_23_13_35_i_cast_fu_52619_p1.read().is_01() || !tmp_23_13_32_i_cast_fu_52610_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_35_i_cast_fu_52619_p1.read()) + sc_biguint<2>(tmp_23_13_32_i_cast_fu_52610_p1.read())); } void Matrix_Vector_Activa::thread_tmp1747_fu_52838_p2() { tmp1747_fu_52838_p2 = (!tmp_23_13_37_i_cast_fu_52625_p1.read().is_01() || !tmp_23_13_34_i_cast_fu_52616_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_37_i_cast_fu_52625_p1.read()) + sc_biguint<2>(tmp_23_13_34_i_cast_fu_52616_p1.read())); } void Matrix_Vector_Activa::thread_tmp1748_fu_52848_p2() { tmp1748_fu_52848_p2 = (!tmp2618_cast_fu_52834_p1.read().is_01() || !tmp2619_cast_fu_52844_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2618_cast_fu_52834_p1.read()) + sc_biguint<3>(tmp2619_cast_fu_52844_p1.read())); } void Matrix_Vector_Activa::thread_tmp1749_fu_52858_p2() { tmp1749_fu_52858_p2 = (!tmp2614_cast_fu_52824_p1.read().is_01() || !tmp2617_cast_fu_52854_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2614_cast_fu_52824_p1.read()) + sc_biguint<4>(tmp2617_cast_fu_52854_p1.read())); } void Matrix_Vector_Activa::thread_tmp174_cast_fu_43447_p1() { tmp174_cast_fu_43447_p1 = esl_zext<3,2>(tmp108_fu_43441_p2.read()); } void Matrix_Vector_Activa::thread_tmp174_fu_4136_p2() { tmp174_fu_4136_p2 = (tmp_6359_fu_2620_p3.read() ^ tmp_6452_fu_4128_p3.read()); } void Matrix_Vector_Activa::thread_tmp1750_fu_52868_p2() { tmp1750_fu_52868_p2 = (!tmp_23_13_39_i_cast_fu_52631_p1.read().is_01() || !tmp_23_13_36_i_cast_fu_52622_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_39_i_cast_fu_52631_p1.read()) + sc_biguint<2>(tmp_23_13_36_i_cast_fu_52622_p1.read())); } void Matrix_Vector_Activa::thread_tmp1751_fu_52878_p2() { tmp1751_fu_52878_p2 = (!tmp_23_13_41_i_cast_fu_52637_p1.read().is_01() || !tmp_23_13_38_i_cast_fu_52628_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_41_i_cast_fu_52637_p1.read()) + sc_biguint<2>(tmp_23_13_38_i_cast_fu_52628_p1.read())); } void Matrix_Vector_Activa::thread_tmp1752_fu_52888_p2() { tmp1752_fu_52888_p2 = (!tmp2622_cast_fu_52874_p1.read().is_01() || !tmp2623_cast_fu_52884_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2622_cast_fu_52874_p1.read()) + sc_biguint<3>(tmp2623_cast_fu_52884_p1.read())); } void Matrix_Vector_Activa::thread_tmp1753_fu_52898_p2() { tmp1753_fu_52898_p2 = (!tmp_23_13_43_i_cast_fu_52643_p1.read().is_01() || !tmp_23_13_40_i_cast_fu_52634_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_43_i_cast_fu_52643_p1.read()) + sc_biguint<2>(tmp_23_13_40_i_cast_fu_52634_p1.read())); } void Matrix_Vector_Activa::thread_tmp1754_fu_52908_p2() { tmp1754_fu_52908_p2 = (!tmp_23_13_45_i_cast_fu_52649_p1.read().is_01() || !tmp_23_13_42_i_cast_fu_52640_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_45_i_cast_fu_52649_p1.read()) + sc_biguint<2>(tmp_23_13_42_i_cast_fu_52640_p1.read())); } void Matrix_Vector_Activa::thread_tmp1755_fu_52918_p2() { tmp1755_fu_52918_p2 = (!tmp2625_cast_fu_52904_p1.read().is_01() || !tmp2626_cast_fu_52914_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2625_cast_fu_52904_p1.read()) + sc_biguint<3>(tmp2626_cast_fu_52914_p1.read())); } void Matrix_Vector_Activa::thread_tmp1756_fu_52928_p2() { tmp1756_fu_52928_p2 = (!tmp2621_cast_fu_52894_p1.read().is_01() || !tmp2624_cast_fu_52924_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2621_cast_fu_52894_p1.read()) + sc_biguint<4>(tmp2624_cast_fu_52924_p1.read())); } void Matrix_Vector_Activa::thread_tmp1757_fu_52938_p2() { tmp1757_fu_52938_p2 = (!tmp2613_cast_fu_52864_p1.read().is_01() || !tmp2620_cast_fu_52934_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2613_cast_fu_52864_p1.read()) + sc_biguint<5>(tmp2620_cast_fu_52934_p1.read())); } void Matrix_Vector_Activa::thread_tmp1758_fu_67665_p2() { tmp1758_fu_67665_p2 = (!tmp1742_fu_67656_p2.read().is_01() || !tmp2612_cast_fu_67662_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1742_fu_67656_p2.read()) + sc_biguint<16>(tmp2612_cast_fu_67662_p1.read())); } void Matrix_Vector_Activa::thread_tmp1759_fu_52944_p2() { tmp1759_fu_52944_p2 = (!tmp_23_13_i_cast_fu_52511_p1.read().is_01() || !tmp_23_13_44_i_cast_fu_52646_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_i_cast_fu_52511_p1.read()) + sc_biguint<2>(tmp_23_13_44_i_cast_fu_52646_p1.read())); } void Matrix_Vector_Activa::thread_tmp175_cast_fu_43457_p1() { tmp175_cast_fu_43457_p1 = esl_zext<3,2>(tmp109_fu_43451_p2.read()); } void Matrix_Vector_Activa::thread_tmp175_fu_4156_p2() { tmp175_fu_4156_p2 = (tmp_6361_fu_2648_p3.read() ^ tmp_6453_fu_4148_p3.read()); } void Matrix_Vector_Activa::thread_tmp1760_fu_52954_p2() { tmp1760_fu_52954_p2 = (!tmp_23_13_1_i_cast_fu_52514_p1.read().is_01() || !tmp_23_13_2_i_cast_fu_52517_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_1_i_cast_fu_52514_p1.read()) + sc_biguint<2>(tmp_23_13_2_i_cast_fu_52517_p1.read())); } void Matrix_Vector_Activa::thread_tmp1761_fu_52964_p2() { tmp1761_fu_52964_p2 = (!tmp2631_cast_fu_52950_p1.read().is_01() || !tmp2632_cast_fu_52960_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2631_cast_fu_52950_p1.read()) + sc_biguint<3>(tmp2632_cast_fu_52960_p1.read())); } void Matrix_Vector_Activa::thread_tmp1762_fu_52974_p2() { tmp1762_fu_52974_p2 = (!tmp_23_13_3_i_cast_fu_52520_p1.read().is_01() || !tmp_23_13_4_i_cast_fu_52523_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_3_i_cast_fu_52520_p1.read()) + sc_biguint<2>(tmp_23_13_4_i_cast_fu_52523_p1.read())); } void Matrix_Vector_Activa::thread_tmp1763_fu_52984_p2() { tmp1763_fu_52984_p2 = (!tmp_23_13_5_i_cast_fu_52526_p1.read().is_01() || !tmp_23_13_6_i_cast_fu_52529_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_5_i_cast_fu_52526_p1.read()) + sc_biguint<2>(tmp_23_13_6_i_cast_fu_52529_p1.read())); } void Matrix_Vector_Activa::thread_tmp1764_fu_52994_p2() { tmp1764_fu_52994_p2 = (!tmp2634_cast_fu_52980_p1.read().is_01() || !tmp2635_cast_fu_52990_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2634_cast_fu_52980_p1.read()) + sc_biguint<3>(tmp2635_cast_fu_52990_p1.read())); } void Matrix_Vector_Activa::thread_tmp1765_fu_53004_p2() { tmp1765_fu_53004_p2 = (!tmp2630_cast_fu_52970_p1.read().is_01() || !tmp2633_cast_fu_53000_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2630_cast_fu_52970_p1.read()) + sc_biguint<4>(tmp2633_cast_fu_53000_p1.read())); } void Matrix_Vector_Activa::thread_tmp1766_fu_53014_p2() { tmp1766_fu_53014_p2 = (!tmp_23_13_7_i_cast_fu_52532_p1.read().is_01() || !tmp_23_13_8_i_cast_fu_52535_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_7_i_cast_fu_52532_p1.read()) + sc_biguint<2>(tmp_23_13_8_i_cast_fu_52535_p1.read())); } void Matrix_Vector_Activa::thread_tmp1767_fu_53024_p2() { tmp1767_fu_53024_p2 = (!tmp_23_13_9_i_cast_fu_52538_p1.read().is_01() || !tmp_23_13_i_cast_5752_fu_52541_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_9_i_cast_fu_52538_p1.read()) + sc_biguint<2>(tmp_23_13_i_cast_5752_fu_52541_p1.read())); } void Matrix_Vector_Activa::thread_tmp1768_fu_53034_p2() { tmp1768_fu_53034_p2 = (!tmp2638_cast_fu_53020_p1.read().is_01() || !tmp2639_cast_fu_53030_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2638_cast_fu_53020_p1.read()) + sc_biguint<3>(tmp2639_cast_fu_53030_p1.read())); } void Matrix_Vector_Activa::thread_tmp1769_fu_53044_p2() { tmp1769_fu_53044_p2 = (!tmp_23_13_10_i_cast_fu_52544_p1.read().is_01() || !tmp_23_13_11_i_cast_fu_52547_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_10_i_cast_fu_52544_p1.read()) + sc_biguint<2>(tmp_23_13_11_i_cast_fu_52547_p1.read())); } void Matrix_Vector_Activa::thread_tmp176_cast_fu_43497_p1() { tmp176_cast_fu_43497_p1 = esl_zext<4,3>(tmp113_fu_43491_p2.read()); } void Matrix_Vector_Activa::thread_tmp176_fu_4176_p2() { tmp176_fu_4176_p2 = (tmp_6363_fu_2676_p3.read() ^ tmp_6454_fu_4168_p3.read()); } void Matrix_Vector_Activa::thread_tmp1770_fu_53054_p2() { tmp1770_fu_53054_p2 = (!tmp_23_13_12_i_cast_fu_52550_p1.read().is_01() || !tmp_23_13_13_i_cast_fu_52553_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_12_i_cast_fu_52550_p1.read()) + sc_biguint<2>(tmp_23_13_13_i_cast_fu_52553_p1.read())); } void Matrix_Vector_Activa::thread_tmp1771_fu_53064_p2() { tmp1771_fu_53064_p2 = (!tmp2641_cast_fu_53050_p1.read().is_01() || !tmp2642_cast_fu_53060_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2641_cast_fu_53050_p1.read()) + sc_biguint<3>(tmp2642_cast_fu_53060_p1.read())); } void Matrix_Vector_Activa::thread_tmp1772_fu_53074_p2() { tmp1772_fu_53074_p2 = (!tmp2637_cast_fu_53040_p1.read().is_01() || !tmp2640_cast_fu_53070_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2637_cast_fu_53040_p1.read()) + sc_biguint<4>(tmp2640_cast_fu_53070_p1.read())); } void Matrix_Vector_Activa::thread_tmp1773_fu_53084_p2() { tmp1773_fu_53084_p2 = (!tmp2629_cast_fu_53010_p1.read().is_01() || !tmp2636_cast_fu_53080_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2629_cast_fu_53010_p1.read()) + sc_biguint<5>(tmp2636_cast_fu_53080_p1.read())); } void Matrix_Vector_Activa::thread_tmp1774_fu_53090_p2() { tmp1774_fu_53090_p2 = (!tmp_23_13_14_i_cast_fu_52556_p1.read().is_01() || !tmp_23_13_15_i_cast_fu_52559_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_14_i_cast_fu_52556_p1.read()) + sc_biguint<2>(tmp_23_13_15_i_cast_fu_52559_p1.read())); } void Matrix_Vector_Activa::thread_tmp1775_fu_53100_p2() { tmp1775_fu_53100_p2 = (!tmp_23_13_16_i_cast_fu_52562_p1.read().is_01() || !tmp_23_13_17_i_cast_fu_52565_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_16_i_cast_fu_52562_p1.read()) + sc_biguint<2>(tmp_23_13_17_i_cast_fu_52565_p1.read())); } void Matrix_Vector_Activa::thread_tmp1776_fu_53110_p2() { tmp1776_fu_53110_p2 = (!tmp2646_cast_fu_53096_p1.read().is_01() || !tmp2647_cast_fu_53106_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2646_cast_fu_53096_p1.read()) + sc_biguint<3>(tmp2647_cast_fu_53106_p1.read())); } void Matrix_Vector_Activa::thread_tmp1777_fu_53120_p2() { tmp1777_fu_53120_p2 = (!tmp_23_13_18_i_cast_fu_52568_p1.read().is_01() || !tmp_23_13_19_i_cast_fu_52571_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_18_i_cast_fu_52568_p1.read()) + sc_biguint<2>(tmp_23_13_19_i_cast_fu_52571_p1.read())); } void Matrix_Vector_Activa::thread_tmp1778_fu_53130_p2() { tmp1778_fu_53130_p2 = (!tmp_23_13_20_i_cast_fu_52574_p1.read().is_01() || !tmp_23_13_21_i_cast_fu_52577_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_20_i_cast_fu_52574_p1.read()) + sc_biguint<2>(tmp_23_13_21_i_cast_fu_52577_p1.read())); } void Matrix_Vector_Activa::thread_tmp1779_fu_53140_p2() { tmp1779_fu_53140_p2 = (!tmp2649_cast_fu_53126_p1.read().is_01() || !tmp2650_cast_fu_53136_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2649_cast_fu_53126_p1.read()) + sc_biguint<3>(tmp2650_cast_fu_53136_p1.read())); } void Matrix_Vector_Activa::thread_tmp177_cast_fu_43477_p1() { tmp177_cast_fu_43477_p1 = esl_zext<3,2>(tmp111_fu_43471_p2.read()); } void Matrix_Vector_Activa::thread_tmp177_fu_4196_p2() { tmp177_fu_4196_p2 = (tmp_6365_fu_2704_p3.read() ^ tmp_6455_fu_4188_p3.read()); } void Matrix_Vector_Activa::thread_tmp1780_fu_53150_p2() { tmp1780_fu_53150_p2 = (!tmp2645_cast_fu_53116_p1.read().is_01() || !tmp2648_cast_fu_53146_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2645_cast_fu_53116_p1.read()) + sc_biguint<4>(tmp2648_cast_fu_53146_p1.read())); } void Matrix_Vector_Activa::thread_tmp1781_fu_53160_p2() { tmp1781_fu_53160_p2 = (!tmp_23_13_22_i_cast_fu_52580_p1.read().is_01() || !tmp_23_13_23_i_cast_fu_52583_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_22_i_cast_fu_52580_p1.read()) + sc_biguint<2>(tmp_23_13_23_i_cast_fu_52583_p1.read())); } void Matrix_Vector_Activa::thread_tmp1782_fu_53170_p2() { tmp1782_fu_53170_p2 = (!tmp_23_13_24_i_cast_fu_52586_p1.read().is_01() || !tmp_23_13_25_i_cast_fu_52589_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_24_i_cast_fu_52586_p1.read()) + sc_biguint<2>(tmp_23_13_25_i_cast_fu_52589_p1.read())); } void Matrix_Vector_Activa::thread_tmp1783_fu_53180_p2() { tmp1783_fu_53180_p2 = (!tmp2653_cast_fu_53166_p1.read().is_01() || !tmp2654_cast_fu_53176_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2653_cast_fu_53166_p1.read()) + sc_biguint<3>(tmp2654_cast_fu_53176_p1.read())); } void Matrix_Vector_Activa::thread_tmp1784_fu_53190_p2() { tmp1784_fu_53190_p2 = (!tmp_23_13_26_i_cast_fu_52592_p1.read().is_01() || !tmp_23_13_27_i_cast_fu_52595_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_26_i_cast_fu_52592_p1.read()) + sc_biguint<2>(tmp_23_13_27_i_cast_fu_52595_p1.read())); } void Matrix_Vector_Activa::thread_tmp1785_fu_53200_p2() { tmp1785_fu_53200_p2 = (!tmp_23_13_62_i_cast_fu_52697_p1.read().is_01() || !tmp_23_13_28_i_cast_fu_52598_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_62_i_cast_fu_52697_p1.read()) + sc_biguint<2>(tmp_23_13_28_i_cast_fu_52598_p1.read())); } void Matrix_Vector_Activa::thread_tmp1786_fu_53206_p2() { tmp1786_fu_53206_p2 = (!tmp_23_13_29_i_cast_fu_52601_p1.read().is_01() || !tmp1785_fu_53200_p2.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_13_29_i_cast_fu_52601_p1.read()) + sc_biguint<2>(tmp1785_fu_53200_p2.read())); } void Matrix_Vector_Activa::thread_tmp1787_fu_53216_p2() { tmp1787_fu_53216_p2 = (!tmp2656_cast_fu_53196_p1.read().is_01() || !tmp2657_cast_fu_53212_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2656_cast_fu_53196_p1.read()) + sc_biguint<3>(tmp2657_cast_fu_53212_p1.read())); } void Matrix_Vector_Activa::thread_tmp1788_fu_53226_p2() { tmp1788_fu_53226_p2 = (!tmp2652_cast_fu_53186_p1.read().is_01() || !tmp2655_cast_fu_53222_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2652_cast_fu_53186_p1.read()) + sc_biguint<4>(tmp2655_cast_fu_53222_p1.read())); } void Matrix_Vector_Activa::thread_tmp1789_fu_53236_p2() { tmp1789_fu_53236_p2 = (!tmp2644_cast_fu_53156_p1.read().is_01() || !tmp2651_cast_fu_53232_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2644_cast_fu_53156_p1.read()) + sc_biguint<5>(tmp2651_cast_fu_53232_p1.read())); } void Matrix_Vector_Activa::thread_tmp178_cast_fu_43487_p1() { tmp178_cast_fu_43487_p1 = esl_zext<3,2>(tmp112_fu_43481_p2.read()); } void Matrix_Vector_Activa::thread_tmp178_fu_4216_p2() { tmp178_fu_4216_p2 = (tmp_6367_fu_2732_p3.read() ^ tmp_6456_fu_4208_p3.read()); } void Matrix_Vector_Activa::thread_tmp1790_fu_67677_p2() { tmp1790_fu_67677_p2 = (!tmp2628_cast_fu_67671_p1.read().is_01() || !tmp2643_cast_fu_67674_p1.read().is_01())? sc_lv<6>(): (sc_biguint<6>(tmp2628_cast_fu_67671_p1.read()) + sc_biguint<6>(tmp2643_cast_fu_67674_p1.read())); } void Matrix_Vector_Activa::thread_tmp1791_fu_20044_p2() { tmp1791_fu_20044_p2 = (tmp_6291_fu_1672_p1.read() ^ tmp_7250_fu_20040_p1.read()); } void Matrix_Vector_Activa::thread_tmp1792_fu_20064_p2() { tmp1792_fu_20064_p2 = (tmp_6293_fu_1696_p3.read() ^ tmp_7251_fu_20056_p3.read()); } void Matrix_Vector_Activa::thread_tmp1793_fu_20084_p2() { tmp1793_fu_20084_p2 = (tmp_6295_fu_1724_p3.read() ^ tmp_7252_fu_20076_p3.read()); } void Matrix_Vector_Activa::thread_tmp1794_fu_20104_p2() { tmp1794_fu_20104_p2 = (tmp_6297_fu_1752_p3.read() ^ tmp_7253_fu_20096_p3.read()); } void Matrix_Vector_Activa::thread_tmp1795_fu_20124_p2() { tmp1795_fu_20124_p2 = (tmp_6299_fu_1780_p3.read() ^ tmp_7254_fu_20116_p3.read()); } void Matrix_Vector_Activa::thread_tmp1796_fu_20144_p2() { tmp1796_fu_20144_p2 = (tmp_6301_fu_1808_p3.read() ^ tmp_7255_fu_20136_p3.read()); } void Matrix_Vector_Activa::thread_tmp1797_fu_20164_p2() { tmp1797_fu_20164_p2 = (tmp_6303_fu_1836_p3.read() ^ tmp_7256_fu_20156_p3.read()); } void Matrix_Vector_Activa::thread_tmp1798_fu_20184_p2() { tmp1798_fu_20184_p2 = (tmp_6305_fu_1864_p3.read() ^ tmp_7257_fu_20176_p3.read()); } void Matrix_Vector_Activa::thread_tmp1799_fu_20204_p2() { tmp1799_fu_20204_p2 = (tmp_6307_fu_1892_p3.read() ^ tmp_7258_fu_20196_p3.read()); } void Matrix_Vector_Activa::thread_tmp179_cast_fu_43577_p1() { tmp179_cast_fu_43577_p1 = esl_zext<5,4>(tmp121_fu_43571_p2.read()); } void Matrix_Vector_Activa::thread_tmp179_fu_4236_p2() { tmp179_fu_4236_p2 = (tmp_6369_fu_2760_p3.read() ^ tmp_6457_fu_4228_p3.read()); } void Matrix_Vector_Activa::thread_tmp17_fu_1788_p2() { tmp17_fu_1788_p2 = (tmp_6299_fu_1780_p3.read() ^ tmp_6298_fu_1772_p3.read()); } void Matrix_Vector_Activa::thread_tmp1800_fu_20224_p2() { tmp1800_fu_20224_p2 = (tmp_6309_fu_1920_p3.read() ^ tmp_7259_fu_20216_p3.read()); } void Matrix_Vector_Activa::thread_tmp1801_fu_20244_p2() { tmp1801_fu_20244_p2 = (tmp_6311_fu_1948_p3.read() ^ tmp_7260_fu_20236_p3.read()); } void Matrix_Vector_Activa::thread_tmp1802_fu_20264_p2() { tmp1802_fu_20264_p2 = (tmp_6313_fu_1976_p3.read() ^ tmp_7261_fu_20256_p3.read()); } void Matrix_Vector_Activa::thread_tmp1803_fu_20284_p2() { tmp1803_fu_20284_p2 = (tmp_6315_fu_2004_p3.read() ^ tmp_7262_fu_20276_p3.read()); } void Matrix_Vector_Activa::thread_tmp1804_fu_20304_p2() { tmp1804_fu_20304_p2 = (tmp_6317_fu_2032_p3.read() ^ tmp_7263_fu_20296_p3.read()); } void Matrix_Vector_Activa::thread_tmp1805_fu_20324_p2() { tmp1805_fu_20324_p2 = (tmp_6319_fu_2060_p3.read() ^ tmp_7264_fu_20316_p3.read()); } void Matrix_Vector_Activa::thread_tmp1806_fu_20344_p2() { tmp1806_fu_20344_p2 = (tmp_6321_fu_2088_p3.read() ^ tmp_7265_fu_20336_p3.read()); } void Matrix_Vector_Activa::thread_tmp1807_fu_20364_p2() { tmp1807_fu_20364_p2 = (tmp_6323_fu_2116_p3.read() ^ tmp_7266_fu_20356_p3.read()); } void Matrix_Vector_Activa::thread_tmp1808_fu_20384_p2() { tmp1808_fu_20384_p2 = (tmp_6325_fu_2144_p3.read() ^ tmp_7267_fu_20376_p3.read()); } void Matrix_Vector_Activa::thread_tmp1809_fu_20404_p2() { tmp1809_fu_20404_p2 = (tmp_6327_fu_2172_p3.read() ^ tmp_7268_fu_20396_p3.read()); } void Matrix_Vector_Activa::thread_tmp180_cast_fu_43537_p1() { tmp180_cast_fu_43537_p1 = esl_zext<4,3>(tmp117_fu_43531_p2.read()); } void Matrix_Vector_Activa::thread_tmp180_fu_4256_p2() { tmp180_fu_4256_p2 = (tmp_6371_fu_2788_p3.read() ^ tmp_6458_fu_4248_p3.read()); } void Matrix_Vector_Activa::thread_tmp1810_fu_20424_p2() { tmp1810_fu_20424_p2 = (tmp_6329_fu_2200_p3.read() ^ tmp_7269_fu_20416_p3.read()); } void Matrix_Vector_Activa::thread_tmp1811_fu_20444_p2() { tmp1811_fu_20444_p2 = (tmp_6331_fu_2228_p3.read() ^ tmp_7270_fu_20436_p3.read()); } void Matrix_Vector_Activa::thread_tmp1812_fu_20464_p2() { tmp1812_fu_20464_p2 = (tmp_6333_fu_2256_p3.read() ^ tmp_7271_fu_20456_p3.read()); } void Matrix_Vector_Activa::thread_tmp1813_fu_20484_p2() { tmp1813_fu_20484_p2 = (tmp_6335_fu_2284_p3.read() ^ tmp_7272_fu_20476_p3.read()); } void Matrix_Vector_Activa::thread_tmp1814_fu_20504_p2() { tmp1814_fu_20504_p2 = (tmp_6337_fu_2312_p3.read() ^ tmp_7273_fu_20496_p3.read()); } void Matrix_Vector_Activa::thread_tmp1815_fu_20524_p2() { tmp1815_fu_20524_p2 = (tmp_6339_fu_2340_p3.read() ^ tmp_7274_fu_20516_p3.read()); } void Matrix_Vector_Activa::thread_tmp1816_fu_20544_p2() { tmp1816_fu_20544_p2 = (tmp_6341_fu_2368_p3.read() ^ tmp_7275_fu_20536_p3.read()); } void Matrix_Vector_Activa::thread_tmp1817_fu_20564_p2() { tmp1817_fu_20564_p2 = (tmp_6343_fu_2396_p3.read() ^ tmp_7276_fu_20556_p3.read()); } void Matrix_Vector_Activa::thread_tmp1818_fu_20584_p2() { tmp1818_fu_20584_p2 = (tmp_6345_fu_2424_p3.read() ^ tmp_7277_fu_20576_p3.read()); } void Matrix_Vector_Activa::thread_tmp1819_fu_20604_p2() { tmp1819_fu_20604_p2 = (tmp_6347_fu_2452_p3.read() ^ tmp_7278_fu_20596_p3.read()); } void Matrix_Vector_Activa::thread_tmp181_cast_fu_43517_p1() { tmp181_cast_fu_43517_p1 = esl_zext<3,2>(tmp115_fu_43511_p2.read()); } void Matrix_Vector_Activa::thread_tmp181_fu_4276_p2() { tmp181_fu_4276_p2 = (tmp_6373_fu_2816_p3.read() ^ tmp_6459_fu_4268_p3.read()); } void Matrix_Vector_Activa::thread_tmp1820_fu_20624_p2() { tmp1820_fu_20624_p2 = (tmp_6349_fu_2480_p3.read() ^ tmp_7279_fu_20616_p3.read()); } void Matrix_Vector_Activa::thread_tmp1821_fu_20644_p2() { tmp1821_fu_20644_p2 = (tmp_6351_fu_2508_p3.read() ^ tmp_7280_fu_20636_p3.read()); } void Matrix_Vector_Activa::thread_tmp1822_fu_20664_p2() { tmp1822_fu_20664_p2 = (tmp_6353_fu_2536_p3.read() ^ tmp_7281_fu_20656_p3.read()); } void Matrix_Vector_Activa::thread_tmp1823_fu_20684_p2() { tmp1823_fu_20684_p2 = (tmp_6355_fu_2564_p3.read() ^ tmp_7282_fu_20676_p3.read()); } void Matrix_Vector_Activa::thread_tmp1824_fu_20704_p2() { tmp1824_fu_20704_p2 = (tmp_6357_fu_2592_p3.read() ^ tmp_7283_fu_20696_p3.read()); } void Matrix_Vector_Activa::thread_tmp1825_fu_20724_p2() { tmp1825_fu_20724_p2 = (tmp_6359_fu_2620_p3.read() ^ tmp_7284_fu_20716_p3.read()); } void Matrix_Vector_Activa::thread_tmp1826_fu_20744_p2() { tmp1826_fu_20744_p2 = (tmp_6361_fu_2648_p3.read() ^ tmp_7285_fu_20736_p3.read()); } void Matrix_Vector_Activa::thread_tmp1827_fu_20764_p2() { tmp1827_fu_20764_p2 = (tmp_6363_fu_2676_p3.read() ^ tmp_7286_fu_20756_p3.read()); } void Matrix_Vector_Activa::thread_tmp1828_fu_20784_p2() { tmp1828_fu_20784_p2 = (tmp_6365_fu_2704_p3.read() ^ tmp_7287_fu_20776_p3.read()); } void Matrix_Vector_Activa::thread_tmp1829_fu_20804_p2() { tmp1829_fu_20804_p2 = (tmp_6367_fu_2732_p3.read() ^ tmp_7288_fu_20796_p3.read()); } void Matrix_Vector_Activa::thread_tmp182_cast_fu_43527_p1() { tmp182_cast_fu_43527_p1 = esl_zext<3,2>(tmp116_fu_43521_p2.read()); } void Matrix_Vector_Activa::thread_tmp182_fu_4296_p2() { tmp182_fu_4296_p2 = (tmp_6375_fu_2844_p3.read() ^ tmp_6460_fu_4288_p3.read()); } void Matrix_Vector_Activa::thread_tmp1830_fu_20824_p2() { tmp1830_fu_20824_p2 = (tmp_6369_fu_2760_p3.read() ^ tmp_7289_fu_20816_p3.read()); } void Matrix_Vector_Activa::thread_tmp1831_fu_20844_p2() { tmp1831_fu_20844_p2 = (tmp_6371_fu_2788_p3.read() ^ tmp_7290_fu_20836_p3.read()); } void Matrix_Vector_Activa::thread_tmp1832_fu_20864_p2() { tmp1832_fu_20864_p2 = (tmp_6373_fu_2816_p3.read() ^ tmp_7291_fu_20856_p3.read()); } void Matrix_Vector_Activa::thread_tmp1833_fu_20884_p2() { tmp1833_fu_20884_p2 = (tmp_6375_fu_2844_p3.read() ^ tmp_7292_fu_20876_p3.read()); } void Matrix_Vector_Activa::thread_tmp1834_fu_20904_p2() { tmp1834_fu_20904_p2 = (tmp_6377_fu_2872_p3.read() ^ tmp_7293_fu_20896_p3.read()); } void Matrix_Vector_Activa::thread_tmp1835_fu_20924_p2() { tmp1835_fu_20924_p2 = (tmp_6379_fu_2900_p3.read() ^ tmp_7294_fu_20916_p3.read()); } void Matrix_Vector_Activa::thread_tmp1836_fu_20944_p2() { tmp1836_fu_20944_p2 = (tmp_6381_fu_2928_p3.read() ^ tmp_7295_fu_20936_p3.read()); } void Matrix_Vector_Activa::thread_tmp1837_fu_20964_p2() { tmp1837_fu_20964_p2 = (tmp_6383_fu_2956_p3.read() ^ tmp_7296_fu_20956_p3.read()); } void Matrix_Vector_Activa::thread_tmp1838_fu_20984_p2() { tmp1838_fu_20984_p2 = (tmp_6385_fu_2984_p3.read() ^ tmp_7297_fu_20976_p3.read()); } void Matrix_Vector_Activa::thread_tmp1839_fu_21004_p2() { tmp1839_fu_21004_p2 = (tmp_6387_fu_3012_p3.read() ^ tmp_7298_fu_20996_p3.read()); } void Matrix_Vector_Activa::thread_tmp183_cast_fu_43567_p1() { tmp183_cast_fu_43567_p1 = esl_zext<4,3>(tmp120_fu_43561_p2.read()); } void Matrix_Vector_Activa::thread_tmp183_fu_4316_p2() { tmp183_fu_4316_p2 = (tmp_6377_fu_2872_p3.read() ^ tmp_6461_fu_4308_p3.read()); } void Matrix_Vector_Activa::thread_tmp1840_fu_21024_p2() { tmp1840_fu_21024_p2 = (tmp_6389_fu_3040_p3.read() ^ tmp_7299_fu_21016_p3.read()); } void Matrix_Vector_Activa::thread_tmp1841_fu_21044_p2() { tmp1841_fu_21044_p2 = (tmp_6391_fu_3068_p3.read() ^ tmp_7300_fu_21036_p3.read()); } void Matrix_Vector_Activa::thread_tmp1842_fu_21064_p2() { tmp1842_fu_21064_p2 = (tmp_6393_fu_3096_p3.read() ^ tmp_7301_fu_21056_p3.read()); } void Matrix_Vector_Activa::thread_tmp1843_fu_21084_p2() { tmp1843_fu_21084_p2 = (tmp_6395_fu_3124_p3.read() ^ tmp_7302_fu_21076_p3.read()); } void Matrix_Vector_Activa::thread_tmp1844_fu_21104_p2() { tmp1844_fu_21104_p2 = (tmp_6397_fu_3152_p3.read() ^ tmp_7303_fu_21096_p3.read()); } void Matrix_Vector_Activa::thread_tmp1845_cast_fu_67367_p1() { tmp1845_cast_fu_67367_p1 = esl_zext<16,2>(tmp1221_reg_80324.read()); } void Matrix_Vector_Activa::thread_tmp1845_fu_21124_p2() { tmp1845_fu_21124_p2 = (tmp_6399_fu_3180_p3.read() ^ tmp_7304_fu_21116_p3.read()); } void Matrix_Vector_Activa::thread_tmp1846_cast_fu_67376_p1() { tmp1846_cast_fu_67376_p1 = esl_zext<16,3>(tmp1225_reg_80329.read()); } void Matrix_Vector_Activa::thread_tmp1846_fu_21144_p2() { tmp1846_fu_21144_p2 = (tmp_6401_fu_3208_p3.read() ^ tmp_7305_fu_21136_p3.read()); } void Matrix_Vector_Activa::thread_tmp1847_cast_fu_49788_p1() { tmp1847_cast_fu_49788_p1 = esl_zext<3,2>(tmp1223_fu_49782_p2.read()); } void Matrix_Vector_Activa::thread_tmp1847_fu_21164_p2() { tmp1847_fu_21164_p2 = (tmp_6403_fu_3236_p3.read() ^ tmp_7306_fu_21156_p3.read()); } void Matrix_Vector_Activa::thread_tmp1848_cast_fu_49798_p1() { tmp1848_cast_fu_49798_p1 = esl_zext<3,2>(tmp1224_fu_49792_p2.read()); } void Matrix_Vector_Activa::thread_tmp1848_fu_21184_p2() { tmp1848_fu_21184_p2 = (tmp_6405_fu_3264_p3.read() ^ tmp_7307_fu_21176_p3.read()); } void Matrix_Vector_Activa::thread_tmp1849_cast_fu_67385_p1() { tmp1849_cast_fu_67385_p1 = esl_zext<16,4>(tmp1233_reg_80334.read()); } void Matrix_Vector_Activa::thread_tmp1849_fu_21204_p2() { tmp1849_fu_21204_p2 = (tmp_6407_fu_3292_p3.read() ^ tmp_7308_fu_21196_p3.read()); } void Matrix_Vector_Activa::thread_tmp184_cast_fu_43547_p1() { tmp184_cast_fu_43547_p1 = esl_zext<3,2>(tmp118_fu_43541_p2.read()); } void Matrix_Vector_Activa::thread_tmp184_fu_4336_p2() { tmp184_fu_4336_p2 = (tmp_6379_fu_2900_p3.read() ^ tmp_6462_fu_4328_p3.read()); } void Matrix_Vector_Activa::thread_tmp1850_cast_fu_49834_p1() { tmp1850_cast_fu_49834_p1 = esl_zext<4,3>(tmp1229_fu_49828_p2.read()); } void Matrix_Vector_Activa::thread_tmp1850_fu_21224_p2() { tmp1850_fu_21224_p2 = (tmp_6409_fu_3320_p3.read() ^ tmp_7309_fu_21216_p3.read()); } void Matrix_Vector_Activa::thread_tmp1851_cast_fu_49814_p1() { tmp1851_cast_fu_49814_p1 = esl_zext<3,2>(tmp1227_fu_49808_p2.read()); } void Matrix_Vector_Activa::thread_tmp1851_fu_21244_p2() { tmp1851_fu_21244_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_7310_fu_21236_p3.read()); } void Matrix_Vector_Activa::thread_tmp1852_cast_fu_49824_p1() { tmp1852_cast_fu_49824_p1 = esl_zext<3,2>(tmp1228_fu_49818_p2.read()); } void Matrix_Vector_Activa::thread_tmp1852_fu_21264_p2() { tmp1852_fu_21264_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_7311_fu_21256_p3.read()); } void Matrix_Vector_Activa::thread_tmp1853_cast_fu_49864_p1() { tmp1853_cast_fu_49864_p1 = esl_zext<4,3>(tmp1232_fu_49858_p2.read()); } void Matrix_Vector_Activa::thread_tmp1853_fu_21284_p2() { tmp1853_fu_21284_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_7312_fu_21276_p3.read()); } void Matrix_Vector_Activa::thread_tmp1854_cast_fu_49844_p1() { tmp1854_cast_fu_49844_p1 = esl_zext<3,2>(tmp1230_fu_49838_p2.read()); } void Matrix_Vector_Activa::thread_tmp1854_fu_21304_p2() { tmp1854_fu_21304_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_7313_fu_21296_p3.read()); } void Matrix_Vector_Activa::thread_tmp1855_cast_fu_49854_p1() { tmp1855_cast_fu_49854_p1 = esl_zext<3,2>(tmp1231_fu_49848_p2.read()); } void Matrix_Vector_Activa::thread_tmp1855_fu_67696_p2() { tmp1855_fu_67696_p2 = (!tmp_23_14_60_i_fu_67693_p1.read().is_01() || !p_accu_V_0_14_i_fu_66650_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_14_60_i_fu_67693_p1.read()) + sc_biguint<16>(p_accu_V_0_14_i_fu_66650_p3.read())); } void Matrix_Vector_Activa::thread_tmp1856_cast_fu_67394_p1() { tmp1856_cast_fu_67394_p1 = esl_zext<16,5>(tmp1249_reg_80339.read()); } void Matrix_Vector_Activa::thread_tmp1856_fu_53431_p2() { tmp1856_fu_53431_p2 = (!tmp_23_14_59_i_cast_fu_53422_p1.read().is_01() || !tmp_23_14_61_i_cast_fu_53425_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_59_i_cast_fu_53422_p1.read()) + sc_biguint<2>(tmp_23_14_61_i_cast_fu_53425_p1.read())); } void Matrix_Vector_Activa::thread_tmp1857_cast_fu_49940_p1() { tmp1857_cast_fu_49940_p1 = esl_zext<5,4>(tmp1241_fu_49934_p2.read()); } void Matrix_Vector_Activa::thread_tmp1857_fu_67705_p2() { tmp1857_fu_67705_p2 = (!tmp1855_fu_67696_p2.read().is_01() || !tmp2790_cast_fu_67702_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1855_fu_67696_p2.read()) + sc_biguint<16>(tmp2790_cast_fu_67702_p1.read())); } void Matrix_Vector_Activa::thread_tmp1858_cast_fu_49900_p1() { tmp1858_cast_fu_49900_p1 = esl_zext<4,3>(tmp1237_fu_49894_p2.read()); } void Matrix_Vector_Activa::thread_tmp1858_fu_53437_p2() { tmp1858_fu_53437_p2 = (!tmp_23_14_55_i_cast_fu_53410_p1.read().is_01() || !tmp_23_14_58_i_cast_fu_53419_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_55_i_cast_fu_53410_p1.read()) + sc_biguint<2>(tmp_23_14_58_i_cast_fu_53419_p1.read())); } void Matrix_Vector_Activa::thread_tmp1859_cast_fu_49880_p1() { tmp1859_cast_fu_49880_p1 = esl_zext<3,2>(tmp1235_fu_49874_p2.read()); } void Matrix_Vector_Activa::thread_tmp1859_fu_53447_p2() { tmp1859_fu_53447_p2 = (!tmp_23_14_57_i_cast_fu_53416_p1.read().is_01() || !tmp_23_14_54_i_cast_fu_53407_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_57_i_cast_fu_53416_p1.read()) + sc_biguint<2>(tmp_23_14_54_i_cast_fu_53407_p1.read())); } void Matrix_Vector_Activa::thread_tmp185_cast_fu_43557_p1() { tmp185_cast_fu_43557_p1 = esl_zext<3,2>(tmp119_fu_43551_p2.read()); } void Matrix_Vector_Activa::thread_tmp185_fu_4356_p2() { tmp185_fu_4356_p2 = (tmp_6381_fu_2928_p3.read() ^ tmp_6463_fu_4348_p3.read()); } void Matrix_Vector_Activa::thread_tmp1860_cast_fu_49890_p1() { tmp1860_cast_fu_49890_p1 = esl_zext<3,2>(tmp1236_fu_49884_p2.read()); } void Matrix_Vector_Activa::thread_tmp1860_fu_53457_p2() { tmp1860_fu_53457_p2 = (!tmp2792_cast_fu_53443_p1.read().is_01() || !tmp2793_cast_fu_53453_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2792_cast_fu_53443_p1.read()) + sc_biguint<3>(tmp2793_cast_fu_53453_p1.read())); } void Matrix_Vector_Activa::thread_tmp1861_cast_fu_49930_p1() { tmp1861_cast_fu_49930_p1 = esl_zext<4,3>(tmp1240_fu_49924_p2.read()); } void Matrix_Vector_Activa::thread_tmp1861_fu_67714_p2() { tmp1861_fu_67714_p2 = (!tmp1857_fu_67705_p2.read().is_01() || !tmp2791_cast_fu_67711_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1857_fu_67705_p2.read()) + sc_biguint<16>(tmp2791_cast_fu_67711_p1.read())); } void Matrix_Vector_Activa::thread_tmp1862_cast_fu_49910_p1() { tmp1862_cast_fu_49910_p1 = esl_zext<3,2>(tmp1238_fu_49904_p2.read()); } void Matrix_Vector_Activa::thread_tmp1862_fu_53463_p2() { tmp1862_fu_53463_p2 = (!tmp_23_14_47_i_cast_fu_53386_p1.read().is_01() || !tmp_23_14_56_i_cast_fu_53413_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_47_i_cast_fu_53386_p1.read()) + sc_biguint<2>(tmp_23_14_56_i_cast_fu_53413_p1.read())); } void Matrix_Vector_Activa::thread_tmp1863_cast_fu_49920_p1() { tmp1863_cast_fu_49920_p1 = esl_zext<3,2>(tmp1239_fu_49914_p2.read()); } void Matrix_Vector_Activa::thread_tmp1863_fu_53473_p2() { tmp1863_fu_53473_p2 = (!tmp_23_14_49_i_cast_fu_53392_p1.read().is_01() || !tmp_23_14_46_i_cast_fu_53383_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_49_i_cast_fu_53392_p1.read()) + sc_biguint<2>(tmp_23_14_46_i_cast_fu_53383_p1.read())); } void Matrix_Vector_Activa::thread_tmp1864_cast_fu_50010_p1() { tmp1864_cast_fu_50010_p1 = esl_zext<5,4>(tmp1248_fu_50004_p2.read()); } void Matrix_Vector_Activa::thread_tmp1864_fu_53483_p2() { tmp1864_fu_53483_p2 = (!tmp2796_cast_fu_53469_p1.read().is_01() || !tmp2797_cast_fu_53479_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2796_cast_fu_53469_p1.read()) + sc_biguint<3>(tmp2797_cast_fu_53479_p1.read())); } void Matrix_Vector_Activa::thread_tmp1865_cast_fu_49970_p1() { tmp1865_cast_fu_49970_p1 = esl_zext<4,3>(tmp1244_fu_49964_p2.read()); } void Matrix_Vector_Activa::thread_tmp1865_fu_53493_p2() { tmp1865_fu_53493_p2 = (!tmp_23_14_51_i_cast_fu_53398_p1.read().is_01() || !tmp_23_14_48_i_cast_fu_53389_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_51_i_cast_fu_53398_p1.read()) + sc_biguint<2>(tmp_23_14_48_i_cast_fu_53389_p1.read())); } void Matrix_Vector_Activa::thread_tmp1866_cast_fu_49950_p1() { tmp1866_cast_fu_49950_p1 = esl_zext<3,2>(tmp1242_fu_49944_p2.read()); } void Matrix_Vector_Activa::thread_tmp1866_fu_53503_p2() { tmp1866_fu_53503_p2 = (!tmp_23_14_53_i_cast_fu_53404_p1.read().is_01() || !tmp_23_14_50_i_cast_fu_53395_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_53_i_cast_fu_53404_p1.read()) + sc_biguint<2>(tmp_23_14_50_i_cast_fu_53395_p1.read())); } void Matrix_Vector_Activa::thread_tmp1867_cast_fu_49960_p1() { tmp1867_cast_fu_49960_p1 = esl_zext<3,2>(tmp1243_fu_49954_p2.read()); } void Matrix_Vector_Activa::thread_tmp1867_fu_53513_p2() { tmp1867_fu_53513_p2 = (!tmp2799_cast_fu_53499_p1.read().is_01() || !tmp2800_cast_fu_53509_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2799_cast_fu_53499_p1.read()) + sc_biguint<3>(tmp2800_cast_fu_53509_p1.read())); } void Matrix_Vector_Activa::thread_tmp1868_cast_fu_50000_p1() { tmp1868_cast_fu_50000_p1 = esl_zext<4,3>(tmp1247_fu_49994_p2.read()); } void Matrix_Vector_Activa::thread_tmp1868_fu_53523_p2() { tmp1868_fu_53523_p2 = (!tmp2795_cast_fu_53489_p1.read().is_01() || !tmp2798_cast_fu_53519_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2795_cast_fu_53489_p1.read()) + sc_biguint<4>(tmp2798_cast_fu_53519_p1.read())); } void Matrix_Vector_Activa::thread_tmp1869_cast_fu_49980_p1() { tmp1869_cast_fu_49980_p1 = esl_zext<3,2>(tmp1245_fu_49974_p2.read()); } void Matrix_Vector_Activa::thread_tmp1869_fu_67723_p2() { tmp1869_fu_67723_p2 = (!tmp1861_fu_67714_p2.read().is_01() || !tmp2794_cast_fu_67720_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1861_fu_67714_p2.read()) + sc_biguint<16>(tmp2794_cast_fu_67720_p1.read())); } void Matrix_Vector_Activa::thread_tmp186_cast_fu_66803_p1() { tmp186_cast_fu_66803_p1 = esl_zext<6,5>(tmp138_reg_80079.read()); } void Matrix_Vector_Activa::thread_tmp186_fu_4376_p2() { tmp186_fu_4376_p2 = (tmp_6383_fu_2956_p3.read() ^ tmp_6464_fu_4368_p3.read()); } void Matrix_Vector_Activa::thread_tmp1870_cast_fu_49990_p1() { tmp1870_cast_fu_49990_p1 = esl_zext<3,2>(tmp1246_fu_49984_p2.read()); } void Matrix_Vector_Activa::thread_tmp1870_fu_53529_p2() { tmp1870_fu_53529_p2 = (!tmp_23_14_31_i_cast_fu_53338_p1.read().is_01() || !tmp_23_14_52_i_cast_fu_53401_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_31_i_cast_fu_53338_p1.read()) + sc_biguint<2>(tmp_23_14_52_i_cast_fu_53401_p1.read())); } void Matrix_Vector_Activa::thread_tmp1871_cast_fu_67415_p1() { tmp1871_cast_fu_67415_p1 = esl_zext<16,6>(tmp1282_fu_67409_p2.read()); } void Matrix_Vector_Activa::thread_tmp1871_fu_53539_p2() { tmp1871_fu_53539_p2 = (!tmp_23_14_33_i_cast_fu_53344_p1.read().is_01() || !tmp_23_14_30_i_cast_fu_53335_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_33_i_cast_fu_53344_p1.read()) + sc_biguint<2>(tmp_23_14_30_i_cast_fu_53335_p1.read())); } void Matrix_Vector_Activa::thread_tmp1872_cast_fu_67403_p1() { tmp1872_cast_fu_67403_p1 = esl_zext<6,5>(tmp1265_reg_80344.read()); } void Matrix_Vector_Activa::thread_tmp1872_fu_53549_p2() { tmp1872_fu_53549_p2 = (!tmp2804_cast_fu_53535_p1.read().is_01() || !tmp2805_cast_fu_53545_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2804_cast_fu_53535_p1.read()) + sc_biguint<3>(tmp2805_cast_fu_53545_p1.read())); } void Matrix_Vector_Activa::thread_tmp1873_cast_fu_50086_p1() { tmp1873_cast_fu_50086_p1 = esl_zext<5,4>(tmp1257_fu_50080_p2.read()); } void Matrix_Vector_Activa::thread_tmp1873_fu_53559_p2() { tmp1873_fu_53559_p2 = (!tmp_23_14_35_i_cast_fu_53350_p1.read().is_01() || !tmp_23_14_32_i_cast_fu_53341_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_35_i_cast_fu_53350_p1.read()) + sc_biguint<2>(tmp_23_14_32_i_cast_fu_53341_p1.read())); } void Matrix_Vector_Activa::thread_tmp1874_cast_fu_50046_p1() { tmp1874_cast_fu_50046_p1 = esl_zext<4,3>(tmp1253_fu_50040_p2.read()); } void Matrix_Vector_Activa::thread_tmp1874_fu_53569_p2() { tmp1874_fu_53569_p2 = (!tmp_23_14_37_i_cast_fu_53356_p1.read().is_01() || !tmp_23_14_34_i_cast_fu_53347_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_37_i_cast_fu_53356_p1.read()) + sc_biguint<2>(tmp_23_14_34_i_cast_fu_53347_p1.read())); } void Matrix_Vector_Activa::thread_tmp1875_cast_fu_50026_p1() { tmp1875_cast_fu_50026_p1 = esl_zext<3,2>(tmp1251_fu_50020_p2.read()); } void Matrix_Vector_Activa::thread_tmp1875_fu_53579_p2() { tmp1875_fu_53579_p2 = (!tmp2807_cast_fu_53565_p1.read().is_01() || !tmp2808_cast_fu_53575_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2807_cast_fu_53565_p1.read()) + sc_biguint<3>(tmp2808_cast_fu_53575_p1.read())); } void Matrix_Vector_Activa::thread_tmp1876_cast_fu_50036_p1() { tmp1876_cast_fu_50036_p1 = esl_zext<3,2>(tmp1252_fu_50030_p2.read()); } void Matrix_Vector_Activa::thread_tmp1876_fu_53589_p2() { tmp1876_fu_53589_p2 = (!tmp2803_cast_fu_53555_p1.read().is_01() || !tmp2806_cast_fu_53585_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2803_cast_fu_53555_p1.read()) + sc_biguint<4>(tmp2806_cast_fu_53585_p1.read())); } void Matrix_Vector_Activa::thread_tmp1877_cast_fu_50076_p1() { tmp1877_cast_fu_50076_p1 = esl_zext<4,3>(tmp1256_fu_50070_p2.read()); } void Matrix_Vector_Activa::thread_tmp1877_fu_53599_p2() { tmp1877_fu_53599_p2 = (!tmp_23_14_39_i_cast_fu_53362_p1.read().is_01() || !tmp_23_14_36_i_cast_fu_53353_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_39_i_cast_fu_53362_p1.read()) + sc_biguint<2>(tmp_23_14_36_i_cast_fu_53353_p1.read())); } void Matrix_Vector_Activa::thread_tmp1878_cast_fu_50056_p1() { tmp1878_cast_fu_50056_p1 = esl_zext<3,2>(tmp1254_fu_50050_p2.read()); } void Matrix_Vector_Activa::thread_tmp1878_fu_53609_p2() { tmp1878_fu_53609_p2 = (!tmp_23_14_41_i_cast_fu_53368_p1.read().is_01() || !tmp_23_14_38_i_cast_fu_53359_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_41_i_cast_fu_53368_p1.read()) + sc_biguint<2>(tmp_23_14_38_i_cast_fu_53359_p1.read())); } void Matrix_Vector_Activa::thread_tmp1879_cast_fu_50066_p1() { tmp1879_cast_fu_50066_p1 = esl_zext<3,2>(tmp1255_fu_50060_p2.read()); } void Matrix_Vector_Activa::thread_tmp1879_fu_53619_p2() { tmp1879_fu_53619_p2 = (!tmp2811_cast_fu_53605_p1.read().is_01() || !tmp2812_cast_fu_53615_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2811_cast_fu_53605_p1.read()) + sc_biguint<3>(tmp2812_cast_fu_53615_p1.read())); } void Matrix_Vector_Activa::thread_tmp187_cast_fu_43653_p1() { tmp187_cast_fu_43653_p1 = esl_zext<5,4>(tmp129_fu_43647_p2.read()); } void Matrix_Vector_Activa::thread_tmp187_fu_4396_p2() { tmp187_fu_4396_p2 = (tmp_6385_fu_2984_p3.read() ^ tmp_6465_fu_4388_p3.read()); } void Matrix_Vector_Activa::thread_tmp1880_cast_fu_50156_p1() { tmp1880_cast_fu_50156_p1 = esl_zext<5,4>(tmp1264_fu_50150_p2.read()); } void Matrix_Vector_Activa::thread_tmp1880_fu_53629_p2() { tmp1880_fu_53629_p2 = (!tmp_23_14_43_i_cast_fu_53374_p1.read().is_01() || !tmp_23_14_40_i_cast_fu_53365_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_43_i_cast_fu_53374_p1.read()) + sc_biguint<2>(tmp_23_14_40_i_cast_fu_53365_p1.read())); } void Matrix_Vector_Activa::thread_tmp1881_cast_fu_50116_p1() { tmp1881_cast_fu_50116_p1 = esl_zext<4,3>(tmp1260_fu_50110_p2.read()); } void Matrix_Vector_Activa::thread_tmp1881_fu_53639_p2() { tmp1881_fu_53639_p2 = (!tmp_23_14_45_i_cast_fu_53380_p1.read().is_01() || !tmp_23_14_42_i_cast_fu_53371_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_45_i_cast_fu_53380_p1.read()) + sc_biguint<2>(tmp_23_14_42_i_cast_fu_53371_p1.read())); } void Matrix_Vector_Activa::thread_tmp1882_cast_fu_50096_p1() { tmp1882_cast_fu_50096_p1 = esl_zext<3,2>(tmp1258_fu_50090_p2.read()); } void Matrix_Vector_Activa::thread_tmp1882_fu_53649_p2() { tmp1882_fu_53649_p2 = (!tmp2814_cast_fu_53635_p1.read().is_01() || !tmp2815_cast_fu_53645_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2814_cast_fu_53635_p1.read()) + sc_biguint<3>(tmp2815_cast_fu_53645_p1.read())); } void Matrix_Vector_Activa::thread_tmp1883_cast_fu_50106_p1() { tmp1883_cast_fu_50106_p1 = esl_zext<3,2>(tmp1259_fu_50100_p2.read()); } void Matrix_Vector_Activa::thread_tmp1883_fu_53659_p2() { tmp1883_fu_53659_p2 = (!tmp2810_cast_fu_53625_p1.read().is_01() || !tmp2813_cast_fu_53655_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2810_cast_fu_53625_p1.read()) + sc_biguint<4>(tmp2813_cast_fu_53655_p1.read())); } void Matrix_Vector_Activa::thread_tmp1884_cast_fu_50146_p1() { tmp1884_cast_fu_50146_p1 = esl_zext<4,3>(tmp1263_fu_50140_p2.read()); } void Matrix_Vector_Activa::thread_tmp1884_fu_53669_p2() { tmp1884_fu_53669_p2 = (!tmp2802_cast_fu_53595_p1.read().is_01() || !tmp2809_cast_fu_53665_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2802_cast_fu_53595_p1.read()) + sc_biguint<5>(tmp2809_cast_fu_53665_p1.read())); } void Matrix_Vector_Activa::thread_tmp1885_cast_fu_50126_p1() { tmp1885_cast_fu_50126_p1 = esl_zext<3,2>(tmp1261_fu_50120_p2.read()); } void Matrix_Vector_Activa::thread_tmp1885_fu_67732_p2() { tmp1885_fu_67732_p2 = (!tmp1869_fu_67723_p2.read().is_01() || !tmp2801_cast_fu_67729_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1869_fu_67723_p2.read()) + sc_biguint<16>(tmp2801_cast_fu_67729_p1.read())); } void Matrix_Vector_Activa::thread_tmp1886_cast_fu_50136_p1() { tmp1886_cast_fu_50136_p1 = esl_zext<3,2>(tmp1262_fu_50130_p2.read()); } void Matrix_Vector_Activa::thread_tmp1886_fu_53675_p2() { tmp1886_fu_53675_p2 = (!tmp_23_14_i_cast_fu_53242_p1.read().is_01() || !tmp_23_14_44_i_cast_fu_53377_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_i_cast_fu_53242_p1.read()) + sc_biguint<2>(tmp_23_14_44_i_cast_fu_53377_p1.read())); } void Matrix_Vector_Activa::thread_tmp1887_cast_fu_67406_p1() { tmp1887_cast_fu_67406_p1 = esl_zext<6,5>(tmp1281_reg_80349.read()); } void Matrix_Vector_Activa::thread_tmp1887_fu_53685_p2() { tmp1887_fu_53685_p2 = (!tmp_23_14_1_i_cast_fu_53245_p1.read().is_01() || !tmp_23_14_2_i_cast_fu_53248_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_1_i_cast_fu_53245_p1.read()) + sc_biguint<2>(tmp_23_14_2_i_cast_fu_53248_p1.read())); } void Matrix_Vector_Activa::thread_tmp1888_cast_fu_50232_p1() { tmp1888_cast_fu_50232_p1 = esl_zext<5,4>(tmp1272_fu_50226_p2.read()); } void Matrix_Vector_Activa::thread_tmp1888_fu_53695_p2() { tmp1888_fu_53695_p2 = (!tmp2820_cast_fu_53681_p1.read().is_01() || !tmp2821_cast_fu_53691_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2820_cast_fu_53681_p1.read()) + sc_biguint<3>(tmp2821_cast_fu_53691_p1.read())); } void Matrix_Vector_Activa::thread_tmp1889_cast_fu_50192_p1() { tmp1889_cast_fu_50192_p1 = esl_zext<4,3>(tmp1268_fu_50186_p2.read()); } void Matrix_Vector_Activa::thread_tmp1889_fu_53705_p2() { tmp1889_fu_53705_p2 = (!tmp_23_14_3_i_cast_fu_53251_p1.read().is_01() || !tmp_23_14_4_i_cast_fu_53254_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_3_i_cast_fu_53251_p1.read()) + sc_biguint<2>(tmp_23_14_4_i_cast_fu_53254_p1.read())); } void Matrix_Vector_Activa::thread_tmp188_cast_fu_43613_p1() { tmp188_cast_fu_43613_p1 = esl_zext<4,3>(tmp125_fu_43607_p2.read()); } void Matrix_Vector_Activa::thread_tmp188_fu_4416_p2() { tmp188_fu_4416_p2 = (tmp_6387_fu_3012_p3.read() ^ tmp_6466_fu_4408_p3.read()); } void Matrix_Vector_Activa::thread_tmp1890_cast_fu_50172_p1() { tmp1890_cast_fu_50172_p1 = esl_zext<3,2>(tmp1266_fu_50166_p2.read()); } void Matrix_Vector_Activa::thread_tmp1890_fu_53715_p2() { tmp1890_fu_53715_p2 = (!tmp_23_14_5_i_cast_fu_53257_p1.read().is_01() || !tmp_23_14_6_i_cast_fu_53260_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_5_i_cast_fu_53257_p1.read()) + sc_biguint<2>(tmp_23_14_6_i_cast_fu_53260_p1.read())); } void Matrix_Vector_Activa::thread_tmp1891_cast_fu_50182_p1() { tmp1891_cast_fu_50182_p1 = esl_zext<3,2>(tmp1267_fu_50176_p2.read()); } void Matrix_Vector_Activa::thread_tmp1891_fu_53725_p2() { tmp1891_fu_53725_p2 = (!tmp2823_cast_fu_53711_p1.read().is_01() || !tmp2824_cast_fu_53721_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2823_cast_fu_53711_p1.read()) + sc_biguint<3>(tmp2824_cast_fu_53721_p1.read())); } void Matrix_Vector_Activa::thread_tmp1892_cast_fu_50222_p1() { tmp1892_cast_fu_50222_p1 = esl_zext<4,3>(tmp1271_fu_50216_p2.read()); } void Matrix_Vector_Activa::thread_tmp1892_fu_53735_p2() { tmp1892_fu_53735_p2 = (!tmp2819_cast_fu_53701_p1.read().is_01() || !tmp2822_cast_fu_53731_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2819_cast_fu_53701_p1.read()) + sc_biguint<4>(tmp2822_cast_fu_53731_p1.read())); } void Matrix_Vector_Activa::thread_tmp1893_cast_fu_50202_p1() { tmp1893_cast_fu_50202_p1 = esl_zext<3,2>(tmp1269_fu_50196_p2.read()); } void Matrix_Vector_Activa::thread_tmp1893_fu_53745_p2() { tmp1893_fu_53745_p2 = (!tmp_23_14_7_i_cast_fu_53263_p1.read().is_01() || !tmp_23_14_8_i_cast_fu_53266_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_7_i_cast_fu_53263_p1.read()) + sc_biguint<2>(tmp_23_14_8_i_cast_fu_53266_p1.read())); } void Matrix_Vector_Activa::thread_tmp1894_cast_fu_50212_p1() { tmp1894_cast_fu_50212_p1 = esl_zext<3,2>(tmp1270_fu_50206_p2.read()); } void Matrix_Vector_Activa::thread_tmp1894_fu_53755_p2() { tmp1894_fu_53755_p2 = (!tmp_23_14_9_i_cast_fu_53269_p1.read().is_01() || !tmp_23_14_i_cast_5818_fu_53272_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_9_i_cast_fu_53269_p1.read()) + sc_biguint<2>(tmp_23_14_i_cast_5818_fu_53272_p1.read())); } void Matrix_Vector_Activa::thread_tmp1895_cast_fu_50308_p1() { tmp1895_cast_fu_50308_p1 = esl_zext<5,4>(tmp1280_fu_50302_p2.read()); } void Matrix_Vector_Activa::thread_tmp1895_fu_53765_p2() { tmp1895_fu_53765_p2 = (!tmp2827_cast_fu_53751_p1.read().is_01() || !tmp2828_cast_fu_53761_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2827_cast_fu_53751_p1.read()) + sc_biguint<3>(tmp2828_cast_fu_53761_p1.read())); } void Matrix_Vector_Activa::thread_tmp1896_cast_fu_50262_p1() { tmp1896_cast_fu_50262_p1 = esl_zext<4,3>(tmp1275_fu_50256_p2.read()); } void Matrix_Vector_Activa::thread_tmp1896_fu_53775_p2() { tmp1896_fu_53775_p2 = (!tmp_23_14_10_i_cast_fu_53275_p1.read().is_01() || !tmp_23_14_11_i_cast_fu_53278_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_10_i_cast_fu_53275_p1.read()) + sc_biguint<2>(tmp_23_14_11_i_cast_fu_53278_p1.read())); } void Matrix_Vector_Activa::thread_tmp1897_cast_fu_50242_p1() { tmp1897_cast_fu_50242_p1 = esl_zext<3,2>(tmp1273_fu_50236_p2.read()); } void Matrix_Vector_Activa::thread_tmp1897_fu_53785_p2() { tmp1897_fu_53785_p2 = (!tmp_23_14_12_i_cast_fu_53281_p1.read().is_01() || !tmp_23_14_13_i_cast_fu_53284_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_12_i_cast_fu_53281_p1.read()) + sc_biguint<2>(tmp_23_14_13_i_cast_fu_53284_p1.read())); } void Matrix_Vector_Activa::thread_tmp1898_cast_fu_50252_p1() { tmp1898_cast_fu_50252_p1 = esl_zext<3,2>(tmp1274_fu_50246_p2.read()); } void Matrix_Vector_Activa::thread_tmp1898_fu_53795_p2() { tmp1898_fu_53795_p2 = (!tmp2830_cast_fu_53781_p1.read().is_01() || !tmp2831_cast_fu_53791_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2830_cast_fu_53781_p1.read()) + sc_biguint<3>(tmp2831_cast_fu_53791_p1.read())); } void Matrix_Vector_Activa::thread_tmp1899_cast_fu_50298_p1() { tmp1899_cast_fu_50298_p1 = esl_zext<4,3>(tmp1279_fu_50292_p2.read()); } void Matrix_Vector_Activa::thread_tmp1899_fu_53805_p2() { tmp1899_fu_53805_p2 = (!tmp2826_cast_fu_53771_p1.read().is_01() || !tmp2829_cast_fu_53801_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2826_cast_fu_53771_p1.read()) + sc_biguint<4>(tmp2829_cast_fu_53801_p1.read())); } void Matrix_Vector_Activa::thread_tmp189_cast_fu_43593_p1() { tmp189_cast_fu_43593_p1 = esl_zext<3,2>(tmp123_fu_43587_p2.read()); } void Matrix_Vector_Activa::thread_tmp189_fu_4436_p2() { tmp189_fu_4436_p2 = (tmp_6389_fu_3040_p3.read() ^ tmp_6467_fu_4428_p3.read()); } void Matrix_Vector_Activa::thread_tmp18_fu_1816_p2() { tmp18_fu_1816_p2 = (tmp_6301_fu_1808_p3.read() ^ tmp_6300_fu_1800_p3.read()); } void Matrix_Vector_Activa::thread_tmp1900_cast_fu_50272_p1() { tmp1900_cast_fu_50272_p1 = esl_zext<3,2>(tmp1276_fu_50266_p2.read()); } void Matrix_Vector_Activa::thread_tmp1900_fu_53815_p2() { tmp1900_fu_53815_p2 = (!tmp2818_cast_fu_53741_p1.read().is_01() || !tmp2825_cast_fu_53811_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2818_cast_fu_53741_p1.read()) + sc_biguint<5>(tmp2825_cast_fu_53811_p1.read())); } void Matrix_Vector_Activa::thread_tmp1901_cast_fu_50288_p1() { tmp1901_cast_fu_50288_p1 = esl_zext<3,2>(tmp1278_fu_50282_p2.read()); } void Matrix_Vector_Activa::thread_tmp1901_fu_53821_p2() { tmp1901_fu_53821_p2 = (!tmp_23_14_14_i_cast_fu_53287_p1.read().is_01() || !tmp_23_14_15_i_cast_fu_53290_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_14_i_cast_fu_53287_p1.read()) + sc_biguint<2>(tmp_23_14_15_i_cast_fu_53290_p1.read())); } void Matrix_Vector_Activa::thread_tmp1902_fu_53831_p2() { tmp1902_fu_53831_p2 = (!tmp_23_14_16_i_cast_fu_53293_p1.read().is_01() || !tmp_23_14_17_i_cast_fu_53296_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_16_i_cast_fu_53293_p1.read()) + sc_biguint<2>(tmp_23_14_17_i_cast_fu_53296_p1.read())); } void Matrix_Vector_Activa::thread_tmp1903_fu_53841_p2() { tmp1903_fu_53841_p2 = (!tmp2835_cast_fu_53827_p1.read().is_01() || !tmp2836_cast_fu_53837_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2835_cast_fu_53827_p1.read()) + sc_biguint<3>(tmp2836_cast_fu_53837_p1.read())); } void Matrix_Vector_Activa::thread_tmp1904_fu_53851_p2() { tmp1904_fu_53851_p2 = (!tmp_23_14_18_i_cast_fu_53299_p1.read().is_01() || !tmp_23_14_19_i_cast_fu_53302_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_18_i_cast_fu_53299_p1.read()) + sc_biguint<2>(tmp_23_14_19_i_cast_fu_53302_p1.read())); } void Matrix_Vector_Activa::thread_tmp1905_fu_53861_p2() { tmp1905_fu_53861_p2 = (!tmp_23_14_20_i_cast_fu_53305_p1.read().is_01() || !tmp_23_14_21_i_cast_fu_53308_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_20_i_cast_fu_53305_p1.read()) + sc_biguint<2>(tmp_23_14_21_i_cast_fu_53308_p1.read())); } void Matrix_Vector_Activa::thread_tmp1906_fu_53871_p2() { tmp1906_fu_53871_p2 = (!tmp2838_cast_fu_53857_p1.read().is_01() || !tmp2839_cast_fu_53867_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2838_cast_fu_53857_p1.read()) + sc_biguint<3>(tmp2839_cast_fu_53867_p1.read())); } void Matrix_Vector_Activa::thread_tmp1907_fu_53881_p2() { tmp1907_fu_53881_p2 = (!tmp2834_cast_fu_53847_p1.read().is_01() || !tmp2837_cast_fu_53877_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2834_cast_fu_53847_p1.read()) + sc_biguint<4>(tmp2837_cast_fu_53877_p1.read())); } void Matrix_Vector_Activa::thread_tmp1908_fu_53891_p2() { tmp1908_fu_53891_p2 = (!tmp_23_14_22_i_cast_fu_53311_p1.read().is_01() || !tmp_23_14_23_i_cast_fu_53314_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_22_i_cast_fu_53311_p1.read()) + sc_biguint<2>(tmp_23_14_23_i_cast_fu_53314_p1.read())); } void Matrix_Vector_Activa::thread_tmp1909_fu_53901_p2() { tmp1909_fu_53901_p2 = (!tmp_23_14_24_i_cast_fu_53317_p1.read().is_01() || !tmp_23_14_25_i_cast_fu_53320_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_24_i_cast_fu_53317_p1.read()) + sc_biguint<2>(tmp_23_14_25_i_cast_fu_53320_p1.read())); } void Matrix_Vector_Activa::thread_tmp190_cast_fu_43603_p1() { tmp190_cast_fu_43603_p1 = esl_zext<3,2>(tmp124_fu_43597_p2.read()); } void Matrix_Vector_Activa::thread_tmp190_fu_4456_p2() { tmp190_fu_4456_p2 = (tmp_6391_fu_3068_p3.read() ^ tmp_6468_fu_4448_p3.read()); } void Matrix_Vector_Activa::thread_tmp1910_fu_53911_p2() { tmp1910_fu_53911_p2 = (!tmp2842_cast_fu_53897_p1.read().is_01() || !tmp2843_cast_fu_53907_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2842_cast_fu_53897_p1.read()) + sc_biguint<3>(tmp2843_cast_fu_53907_p1.read())); } void Matrix_Vector_Activa::thread_tmp1911_fu_53921_p2() { tmp1911_fu_53921_p2 = (!tmp_23_14_26_i_cast_fu_53323_p1.read().is_01() || !tmp_23_14_27_i_cast_fu_53326_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_26_i_cast_fu_53323_p1.read()) + sc_biguint<2>(tmp_23_14_27_i_cast_fu_53326_p1.read())); } void Matrix_Vector_Activa::thread_tmp1912_fu_53931_p2() { tmp1912_fu_53931_p2 = (!tmp_23_14_62_i_cast_fu_53428_p1.read().is_01() || !tmp_23_14_28_i_cast_fu_53329_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_62_i_cast_fu_53428_p1.read()) + sc_biguint<2>(tmp_23_14_28_i_cast_fu_53329_p1.read())); } void Matrix_Vector_Activa::thread_tmp1913_fu_53937_p2() { tmp1913_fu_53937_p2 = (!tmp_23_14_29_i_cast_fu_53332_p1.read().is_01() || !tmp1912_fu_53931_p2.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_14_29_i_cast_fu_53332_p1.read()) + sc_biguint<2>(tmp1912_fu_53931_p2.read())); } void Matrix_Vector_Activa::thread_tmp1914_fu_53947_p2() { tmp1914_fu_53947_p2 = (!tmp2845_cast_fu_53927_p1.read().is_01() || !tmp2846_cast_fu_53943_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2845_cast_fu_53927_p1.read()) + sc_biguint<3>(tmp2846_cast_fu_53943_p1.read())); } void Matrix_Vector_Activa::thread_tmp1915_fu_53957_p2() { tmp1915_fu_53957_p2 = (!tmp2841_cast_fu_53917_p1.read().is_01() || !tmp2844_cast_fu_53953_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2841_cast_fu_53917_p1.read()) + sc_biguint<4>(tmp2844_cast_fu_53953_p1.read())); } void Matrix_Vector_Activa::thread_tmp1916_fu_53967_p2() { tmp1916_fu_53967_p2 = (!tmp2833_cast_fu_53887_p1.read().is_01() || !tmp2840_cast_fu_53963_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2833_cast_fu_53887_p1.read()) + sc_biguint<5>(tmp2840_cast_fu_53963_p1.read())); } void Matrix_Vector_Activa::thread_tmp1917_fu_67744_p2() { tmp1917_fu_67744_p2 = (!tmp2817_cast_fu_67738_p1.read().is_01() || !tmp2832_cast_fu_67741_p1.read().is_01())? sc_lv<6>(): (sc_biguint<6>(tmp2817_cast_fu_67738_p1.read()) + sc_biguint<6>(tmp2832_cast_fu_67741_p1.read())); } void Matrix_Vector_Activa::thread_tmp1918_fu_21320_p2() { tmp1918_fu_21320_p2 = (tmp_6291_fu_1672_p1.read() ^ tmp_7314_fu_21316_p1.read()); } void Matrix_Vector_Activa::thread_tmp1919_fu_21340_p2() { tmp1919_fu_21340_p2 = (tmp_6293_fu_1696_p3.read() ^ tmp_7315_fu_21332_p3.read()); } void Matrix_Vector_Activa::thread_tmp191_cast_fu_43643_p1() { tmp191_cast_fu_43643_p1 = esl_zext<4,3>(tmp128_fu_43637_p2.read()); } void Matrix_Vector_Activa::thread_tmp191_fu_4476_p2() { tmp191_fu_4476_p2 = (tmp_6393_fu_3096_p3.read() ^ tmp_6469_fu_4468_p3.read()); } void Matrix_Vector_Activa::thread_tmp1920_fu_21360_p2() { tmp1920_fu_21360_p2 = (tmp_6295_fu_1724_p3.read() ^ tmp_7316_fu_21352_p3.read()); } void Matrix_Vector_Activa::thread_tmp1921_fu_21380_p2() { tmp1921_fu_21380_p2 = (tmp_6297_fu_1752_p3.read() ^ tmp_7317_fu_21372_p3.read()); } void Matrix_Vector_Activa::thread_tmp1922_fu_21400_p2() { tmp1922_fu_21400_p2 = (tmp_6299_fu_1780_p3.read() ^ tmp_7318_fu_21392_p3.read()); } void Matrix_Vector_Activa::thread_tmp1923_fu_21420_p2() { tmp1923_fu_21420_p2 = (tmp_6301_fu_1808_p3.read() ^ tmp_7319_fu_21412_p3.read()); } void Matrix_Vector_Activa::thread_tmp1924_fu_21440_p2() { tmp1924_fu_21440_p2 = (tmp_6303_fu_1836_p3.read() ^ tmp_7320_fu_21432_p3.read()); } void Matrix_Vector_Activa::thread_tmp1925_fu_21460_p2() { tmp1925_fu_21460_p2 = (tmp_6305_fu_1864_p3.read() ^ tmp_7321_fu_21452_p3.read()); } void Matrix_Vector_Activa::thread_tmp1926_fu_21480_p2() { tmp1926_fu_21480_p2 = (tmp_6307_fu_1892_p3.read() ^ tmp_7322_fu_21472_p3.read()); } void Matrix_Vector_Activa::thread_tmp1927_fu_21500_p2() { tmp1927_fu_21500_p2 = (tmp_6309_fu_1920_p3.read() ^ tmp_7323_fu_21492_p3.read()); } void Matrix_Vector_Activa::thread_tmp1928_fu_21520_p2() { tmp1928_fu_21520_p2 = (tmp_6311_fu_1948_p3.read() ^ tmp_7324_fu_21512_p3.read()); } void Matrix_Vector_Activa::thread_tmp1929_fu_21540_p2() { tmp1929_fu_21540_p2 = (tmp_6313_fu_1976_p3.read() ^ tmp_7325_fu_21532_p3.read()); } void Matrix_Vector_Activa::thread_tmp192_cast_fu_43623_p1() { tmp192_cast_fu_43623_p1 = esl_zext<3,2>(tmp126_fu_43617_p2.read()); } void Matrix_Vector_Activa::thread_tmp192_fu_4496_p2() { tmp192_fu_4496_p2 = (tmp_6395_fu_3124_p3.read() ^ tmp_6470_fu_4488_p3.read()); } void Matrix_Vector_Activa::thread_tmp1930_fu_21560_p2() { tmp1930_fu_21560_p2 = (tmp_6315_fu_2004_p3.read() ^ tmp_7326_fu_21552_p3.read()); } void Matrix_Vector_Activa::thread_tmp1931_fu_21580_p2() { tmp1931_fu_21580_p2 = (tmp_6317_fu_2032_p3.read() ^ tmp_7327_fu_21572_p3.read()); } void Matrix_Vector_Activa::thread_tmp1932_fu_21600_p2() { tmp1932_fu_21600_p2 = (tmp_6319_fu_2060_p3.read() ^ tmp_7328_fu_21592_p3.read()); } void Matrix_Vector_Activa::thread_tmp1933_fu_21620_p2() { tmp1933_fu_21620_p2 = (tmp_6321_fu_2088_p3.read() ^ tmp_7329_fu_21612_p3.read()); } void Matrix_Vector_Activa::thread_tmp1934_fu_21640_p2() { tmp1934_fu_21640_p2 = (tmp_6323_fu_2116_p3.read() ^ tmp_7330_fu_21632_p3.read()); } void Matrix_Vector_Activa::thread_tmp1935_fu_21660_p2() { tmp1935_fu_21660_p2 = (tmp_6325_fu_2144_p3.read() ^ tmp_7331_fu_21652_p3.read()); } void Matrix_Vector_Activa::thread_tmp1936_fu_21680_p2() { tmp1936_fu_21680_p2 = (tmp_6327_fu_2172_p3.read() ^ tmp_7332_fu_21672_p3.read()); } void Matrix_Vector_Activa::thread_tmp1937_fu_21700_p2() { tmp1937_fu_21700_p2 = (tmp_6329_fu_2200_p3.read() ^ tmp_7333_fu_21692_p3.read()); } void Matrix_Vector_Activa::thread_tmp1938_fu_21720_p2() { tmp1938_fu_21720_p2 = (tmp_6331_fu_2228_p3.read() ^ tmp_7334_fu_21712_p3.read()); } void Matrix_Vector_Activa::thread_tmp1939_fu_21740_p2() { tmp1939_fu_21740_p2 = (tmp_6333_fu_2256_p3.read() ^ tmp_7335_fu_21732_p3.read()); } void Matrix_Vector_Activa::thread_tmp193_cast_fu_43633_p1() { tmp193_cast_fu_43633_p1 = esl_zext<3,2>(tmp127_fu_43627_p2.read()); } void Matrix_Vector_Activa::thread_tmp193_fu_4516_p2() { tmp193_fu_4516_p2 = (tmp_6397_fu_3152_p3.read() ^ tmp_6471_fu_4508_p3.read()); } void Matrix_Vector_Activa::thread_tmp1940_fu_21760_p2() { tmp1940_fu_21760_p2 = (tmp_6335_fu_2284_p3.read() ^ tmp_7336_fu_21752_p3.read()); } void Matrix_Vector_Activa::thread_tmp1941_fu_21780_p2() { tmp1941_fu_21780_p2 = (tmp_6337_fu_2312_p3.read() ^ tmp_7337_fu_21772_p3.read()); } void Matrix_Vector_Activa::thread_tmp1942_fu_21800_p2() { tmp1942_fu_21800_p2 = (tmp_6339_fu_2340_p3.read() ^ tmp_7338_fu_21792_p3.read()); } void Matrix_Vector_Activa::thread_tmp1943_fu_21820_p2() { tmp1943_fu_21820_p2 = (tmp_6341_fu_2368_p3.read() ^ tmp_7339_fu_21812_p3.read()); } void Matrix_Vector_Activa::thread_tmp1944_fu_21840_p2() { tmp1944_fu_21840_p2 = (tmp_6343_fu_2396_p3.read() ^ tmp_7340_fu_21832_p3.read()); } void Matrix_Vector_Activa::thread_tmp1945_fu_21860_p2() { tmp1945_fu_21860_p2 = (tmp_6345_fu_2424_p3.read() ^ tmp_7341_fu_21852_p3.read()); } void Matrix_Vector_Activa::thread_tmp1946_fu_21880_p2() { tmp1946_fu_21880_p2 = (tmp_6347_fu_2452_p3.read() ^ tmp_7342_fu_21872_p3.read()); } void Matrix_Vector_Activa::thread_tmp1947_fu_21900_p2() { tmp1947_fu_21900_p2 = (tmp_6349_fu_2480_p3.read() ^ tmp_7343_fu_21892_p3.read()); } void Matrix_Vector_Activa::thread_tmp1948_fu_21920_p2() { tmp1948_fu_21920_p2 = (tmp_6351_fu_2508_p3.read() ^ tmp_7344_fu_21912_p3.read()); } void Matrix_Vector_Activa::thread_tmp1949_fu_21940_p2() { tmp1949_fu_21940_p2 = (tmp_6353_fu_2536_p3.read() ^ tmp_7345_fu_21932_p3.read()); } void Matrix_Vector_Activa::thread_tmp194_cast_fu_43729_p1() { tmp194_cast_fu_43729_p1 = esl_zext<5,4>(tmp137_fu_43723_p2.read()); } void Matrix_Vector_Activa::thread_tmp194_fu_4536_p2() { tmp194_fu_4536_p2 = (tmp_6399_fu_3180_p3.read() ^ tmp_6472_fu_4528_p3.read()); } void Matrix_Vector_Activa::thread_tmp1950_fu_21960_p2() { tmp1950_fu_21960_p2 = (tmp_6355_fu_2564_p3.read() ^ tmp_7346_fu_21952_p3.read()); } void Matrix_Vector_Activa::thread_tmp1951_fu_21980_p2() { tmp1951_fu_21980_p2 = (tmp_6357_fu_2592_p3.read() ^ tmp_7347_fu_21972_p3.read()); } void Matrix_Vector_Activa::thread_tmp1952_fu_22000_p2() { tmp1952_fu_22000_p2 = (tmp_6359_fu_2620_p3.read() ^ tmp_7348_fu_21992_p3.read()); } void Matrix_Vector_Activa::thread_tmp1953_fu_22020_p2() { tmp1953_fu_22020_p2 = (tmp_6361_fu_2648_p3.read() ^ tmp_7349_fu_22012_p3.read()); } void Matrix_Vector_Activa::thread_tmp1954_fu_22040_p2() { tmp1954_fu_22040_p2 = (tmp_6363_fu_2676_p3.read() ^ tmp_7350_fu_22032_p3.read()); } void Matrix_Vector_Activa::thread_tmp1955_fu_22060_p2() { tmp1955_fu_22060_p2 = (tmp_6365_fu_2704_p3.read() ^ tmp_7351_fu_22052_p3.read()); } void Matrix_Vector_Activa::thread_tmp1956_fu_22080_p2() { tmp1956_fu_22080_p2 = (tmp_6367_fu_2732_p3.read() ^ tmp_7352_fu_22072_p3.read()); } void Matrix_Vector_Activa::thread_tmp1957_fu_22100_p2() { tmp1957_fu_22100_p2 = (tmp_6369_fu_2760_p3.read() ^ tmp_7353_fu_22092_p3.read()); } void Matrix_Vector_Activa::thread_tmp1958_fu_22120_p2() { tmp1958_fu_22120_p2 = (tmp_6371_fu_2788_p3.read() ^ tmp_7354_fu_22112_p3.read()); } void Matrix_Vector_Activa::thread_tmp1959_fu_22140_p2() { tmp1959_fu_22140_p2 = (tmp_6373_fu_2816_p3.read() ^ tmp_7355_fu_22132_p3.read()); } void Matrix_Vector_Activa::thread_tmp195_cast_fu_43683_p1() { tmp195_cast_fu_43683_p1 = esl_zext<4,3>(tmp132_fu_43677_p2.read()); } void Matrix_Vector_Activa::thread_tmp195_fu_4556_p2() { tmp195_fu_4556_p2 = (tmp_6401_fu_3208_p3.read() ^ tmp_6473_fu_4548_p3.read()); } void Matrix_Vector_Activa::thread_tmp1960_fu_22160_p2() { tmp1960_fu_22160_p2 = (tmp_6375_fu_2844_p3.read() ^ tmp_7356_fu_22152_p3.read()); } void Matrix_Vector_Activa::thread_tmp1961_fu_22180_p2() { tmp1961_fu_22180_p2 = (tmp_6377_fu_2872_p3.read() ^ tmp_7357_fu_22172_p3.read()); } void Matrix_Vector_Activa::thread_tmp1962_fu_22200_p2() { tmp1962_fu_22200_p2 = (tmp_6379_fu_2900_p3.read() ^ tmp_7358_fu_22192_p3.read()); } void Matrix_Vector_Activa::thread_tmp1963_fu_22220_p2() { tmp1963_fu_22220_p2 = (tmp_6381_fu_2928_p3.read() ^ tmp_7359_fu_22212_p3.read()); } void Matrix_Vector_Activa::thread_tmp1964_fu_22240_p2() { tmp1964_fu_22240_p2 = (tmp_6383_fu_2956_p3.read() ^ tmp_7360_fu_22232_p3.read()); } void Matrix_Vector_Activa::thread_tmp1965_fu_22260_p2() { tmp1965_fu_22260_p2 = (tmp_6385_fu_2984_p3.read() ^ tmp_7361_fu_22252_p3.read()); } void Matrix_Vector_Activa::thread_tmp1966_fu_22280_p2() { tmp1966_fu_22280_p2 = (tmp_6387_fu_3012_p3.read() ^ tmp_7362_fu_22272_p3.read()); } void Matrix_Vector_Activa::thread_tmp1967_fu_22300_p2() { tmp1967_fu_22300_p2 = (tmp_6389_fu_3040_p3.read() ^ tmp_7363_fu_22292_p3.read()); } void Matrix_Vector_Activa::thread_tmp1968_fu_22320_p2() { tmp1968_fu_22320_p2 = (tmp_6391_fu_3068_p3.read() ^ tmp_7364_fu_22312_p3.read()); } void Matrix_Vector_Activa::thread_tmp1969_fu_22340_p2() { tmp1969_fu_22340_p2 = (tmp_6393_fu_3096_p3.read() ^ tmp_7365_fu_22332_p3.read()); } void Matrix_Vector_Activa::thread_tmp196_cast_fu_43663_p1() { tmp196_cast_fu_43663_p1 = esl_zext<3,2>(tmp130_fu_43657_p2.read()); } void Matrix_Vector_Activa::thread_tmp196_fu_4576_p2() { tmp196_fu_4576_p2 = (tmp_6403_fu_3236_p3.read() ^ tmp_6474_fu_4568_p3.read()); } void Matrix_Vector_Activa::thread_tmp1970_fu_22360_p2() { tmp1970_fu_22360_p2 = (tmp_6395_fu_3124_p3.read() ^ tmp_7366_fu_22352_p3.read()); } void Matrix_Vector_Activa::thread_tmp1971_fu_22380_p2() { tmp1971_fu_22380_p2 = (tmp_6397_fu_3152_p3.read() ^ tmp_7367_fu_22372_p3.read()); } void Matrix_Vector_Activa::thread_tmp1972_fu_22400_p2() { tmp1972_fu_22400_p2 = (tmp_6399_fu_3180_p3.read() ^ tmp_7368_fu_22392_p3.read()); } void Matrix_Vector_Activa::thread_tmp1973_fu_22420_p2() { tmp1973_fu_22420_p2 = (tmp_6401_fu_3208_p3.read() ^ tmp_7369_fu_22412_p3.read()); } void Matrix_Vector_Activa::thread_tmp1974_fu_22440_p2() { tmp1974_fu_22440_p2 = (tmp_6403_fu_3236_p3.read() ^ tmp_7370_fu_22432_p3.read()); } void Matrix_Vector_Activa::thread_tmp1975_fu_22460_p2() { tmp1975_fu_22460_p2 = (tmp_6405_fu_3264_p3.read() ^ tmp_7371_fu_22452_p3.read()); } void Matrix_Vector_Activa::thread_tmp1976_fu_22480_p2() { tmp1976_fu_22480_p2 = (tmp_6407_fu_3292_p3.read() ^ tmp_7372_fu_22472_p3.read()); } void Matrix_Vector_Activa::thread_tmp1977_fu_22500_p2() { tmp1977_fu_22500_p2 = (tmp_6409_fu_3320_p3.read() ^ tmp_7373_fu_22492_p3.read()); } void Matrix_Vector_Activa::thread_tmp1978_fu_22520_p2() { tmp1978_fu_22520_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_7374_fu_22512_p3.read()); } void Matrix_Vector_Activa::thread_tmp1979_fu_22540_p2() { tmp1979_fu_22540_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_7375_fu_22532_p3.read()); } void Matrix_Vector_Activa::thread_tmp197_cast_fu_43673_p1() { tmp197_cast_fu_43673_p1 = esl_zext<3,2>(tmp131_fu_43667_p2.read()); } void Matrix_Vector_Activa::thread_tmp197_fu_4596_p2() { tmp197_fu_4596_p2 = (tmp_6405_fu_3264_p3.read() ^ tmp_6475_fu_4588_p3.read()); } void Matrix_Vector_Activa::thread_tmp1980_fu_22560_p2() { tmp1980_fu_22560_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_7376_fu_22552_p3.read()); } void Matrix_Vector_Activa::thread_tmp1981_fu_22580_p2() { tmp1981_fu_22580_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_7377_fu_22572_p3.read()); } void Matrix_Vector_Activa::thread_tmp1982_fu_67763_p2() { tmp1982_fu_67763_p2 = (!tmp_23_15_60_i_fu_67760_p1.read().is_01() || !p_accu_V_0_15_i_fu_66643_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_15_60_i_fu_67760_p1.read()) + sc_biguint<16>(p_accu_V_0_15_i_fu_66643_p3.read())); } void Matrix_Vector_Activa::thread_tmp1983_fu_54162_p2() { tmp1983_fu_54162_p2 = (!tmp_23_15_59_i_cast_fu_54153_p1.read().is_01() || !tmp_23_15_61_i_cast_fu_54156_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_59_i_cast_fu_54153_p1.read()) + sc_biguint<2>(tmp_23_15_61_i_cast_fu_54156_p1.read())); } void Matrix_Vector_Activa::thread_tmp1984_fu_67772_p2() { tmp1984_fu_67772_p2 = (!tmp1982_fu_67763_p2.read().is_01() || !tmp2979_cast_fu_67769_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1982_fu_67763_p2.read()) + sc_biguint<16>(tmp2979_cast_fu_67769_p1.read())); } void Matrix_Vector_Activa::thread_tmp1985_fu_54168_p2() { tmp1985_fu_54168_p2 = (!tmp_23_15_55_i_cast_fu_54141_p1.read().is_01() || !tmp_23_15_58_i_cast_fu_54150_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_55_i_cast_fu_54141_p1.read()) + sc_biguint<2>(tmp_23_15_58_i_cast_fu_54150_p1.read())); } void Matrix_Vector_Activa::thread_tmp1986_fu_54178_p2() { tmp1986_fu_54178_p2 = (!tmp_23_15_57_i_cast_fu_54147_p1.read().is_01() || !tmp_23_15_54_i_cast_fu_54138_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_57_i_cast_fu_54147_p1.read()) + sc_biguint<2>(tmp_23_15_54_i_cast_fu_54138_p1.read())); } void Matrix_Vector_Activa::thread_tmp1987_fu_54188_p2() { tmp1987_fu_54188_p2 = (!tmp2981_cast_fu_54174_p1.read().is_01() || !tmp2982_cast_fu_54184_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2981_cast_fu_54174_p1.read()) + sc_biguint<3>(tmp2982_cast_fu_54184_p1.read())); } void Matrix_Vector_Activa::thread_tmp1988_fu_67781_p2() { tmp1988_fu_67781_p2 = (!tmp1984_fu_67772_p2.read().is_01() || !tmp2980_cast_fu_67778_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1984_fu_67772_p2.read()) + sc_biguint<16>(tmp2980_cast_fu_67778_p1.read())); } void Matrix_Vector_Activa::thread_tmp1989_fu_54194_p2() { tmp1989_fu_54194_p2 = (!tmp_23_15_47_i_cast_fu_54117_p1.read().is_01() || !tmp_23_15_56_i_cast_fu_54144_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_47_i_cast_fu_54117_p1.read()) + sc_biguint<2>(tmp_23_15_56_i_cast_fu_54144_p1.read())); } void Matrix_Vector_Activa::thread_tmp198_cast_fu_43719_p1() { tmp198_cast_fu_43719_p1 = esl_zext<4,3>(tmp136_fu_43713_p2.read()); } void Matrix_Vector_Activa::thread_tmp198_fu_4616_p2() { tmp198_fu_4616_p2 = (tmp_6407_fu_3292_p3.read() ^ tmp_6476_fu_4608_p3.read()); } void Matrix_Vector_Activa::thread_tmp1990_fu_54204_p2() { tmp1990_fu_54204_p2 = (!tmp_23_15_49_i_cast_fu_54123_p1.read().is_01() || !tmp_23_15_46_i_cast_fu_54114_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_49_i_cast_fu_54123_p1.read()) + sc_biguint<2>(tmp_23_15_46_i_cast_fu_54114_p1.read())); } void Matrix_Vector_Activa::thread_tmp1991_fu_54214_p2() { tmp1991_fu_54214_p2 = (!tmp2985_cast_fu_54200_p1.read().is_01() || !tmp2986_cast_fu_54210_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2985_cast_fu_54200_p1.read()) + sc_biguint<3>(tmp2986_cast_fu_54210_p1.read())); } void Matrix_Vector_Activa::thread_tmp1992_fu_54224_p2() { tmp1992_fu_54224_p2 = (!tmp_23_15_51_i_cast_fu_54129_p1.read().is_01() || !tmp_23_15_48_i_cast_fu_54120_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_51_i_cast_fu_54129_p1.read()) + sc_biguint<2>(tmp_23_15_48_i_cast_fu_54120_p1.read())); } void Matrix_Vector_Activa::thread_tmp1993_fu_54234_p2() { tmp1993_fu_54234_p2 = (!tmp_23_15_53_i_cast_fu_54135_p1.read().is_01() || !tmp_23_15_50_i_cast_fu_54126_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_53_i_cast_fu_54135_p1.read()) + sc_biguint<2>(tmp_23_15_50_i_cast_fu_54126_p1.read())); } void Matrix_Vector_Activa::thread_tmp1994_fu_54244_p2() { tmp1994_fu_54244_p2 = (!tmp2988_cast_fu_54230_p1.read().is_01() || !tmp2989_cast_fu_54240_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2988_cast_fu_54230_p1.read()) + sc_biguint<3>(tmp2989_cast_fu_54240_p1.read())); } void Matrix_Vector_Activa::thread_tmp1995_fu_54254_p2() { tmp1995_fu_54254_p2 = (!tmp2984_cast_fu_54220_p1.read().is_01() || !tmp2987_cast_fu_54250_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2984_cast_fu_54220_p1.read()) + sc_biguint<4>(tmp2987_cast_fu_54250_p1.read())); } void Matrix_Vector_Activa::thread_tmp1996_fu_67790_p2() { tmp1996_fu_67790_p2 = (!tmp1988_fu_67781_p2.read().is_01() || !tmp2983_cast_fu_67787_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1988_fu_67781_p2.read()) + sc_biguint<16>(tmp2983_cast_fu_67787_p1.read())); } void Matrix_Vector_Activa::thread_tmp1997_fu_54260_p2() { tmp1997_fu_54260_p2 = (!tmp_23_15_31_i_cast_fu_54069_p1.read().is_01() || !tmp_23_15_52_i_cast_fu_54132_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_31_i_cast_fu_54069_p1.read()) + sc_biguint<2>(tmp_23_15_52_i_cast_fu_54132_p1.read())); } void Matrix_Vector_Activa::thread_tmp1998_fu_54270_p2() { tmp1998_fu_54270_p2 = (!tmp_23_15_33_i_cast_fu_54075_p1.read().is_01() || !tmp_23_15_30_i_cast_fu_54066_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_33_i_cast_fu_54075_p1.read()) + sc_biguint<2>(tmp_23_15_30_i_cast_fu_54066_p1.read())); } void Matrix_Vector_Activa::thread_tmp1999_fu_54280_p2() { tmp1999_fu_54280_p2 = (!tmp2993_cast_fu_54266_p1.read().is_01() || !tmp2994_cast_fu_54276_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2993_cast_fu_54266_p1.read()) + sc_biguint<3>(tmp2994_cast_fu_54276_p1.read())); } void Matrix_Vector_Activa::thread_tmp199_cast_fu_43693_p1() { tmp199_cast_fu_43693_p1 = esl_zext<3,2>(tmp133_fu_43687_p2.read()); } void Matrix_Vector_Activa::thread_tmp199_fu_4636_p2() { tmp199_fu_4636_p2 = (tmp_6409_fu_3320_p3.read() ^ tmp_6477_fu_4628_p3.read()); } void Matrix_Vector_Activa::thread_tmp19_fu_1844_p2() { tmp19_fu_1844_p2 = (tmp_6303_fu_1836_p3.read() ^ tmp_6302_fu_1828_p3.read()); } void Matrix_Vector_Activa::thread_tmp2000_fu_54290_p2() { tmp2000_fu_54290_p2 = (!tmp_23_15_35_i_cast_fu_54081_p1.read().is_01() || !tmp_23_15_32_i_cast_fu_54072_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_35_i_cast_fu_54081_p1.read()) + sc_biguint<2>(tmp_23_15_32_i_cast_fu_54072_p1.read())); } void Matrix_Vector_Activa::thread_tmp2001_fu_54300_p2() { tmp2001_fu_54300_p2 = (!tmp_23_15_37_i_cast_fu_54087_p1.read().is_01() || !tmp_23_15_34_i_cast_fu_54078_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_37_i_cast_fu_54087_p1.read()) + sc_biguint<2>(tmp_23_15_34_i_cast_fu_54078_p1.read())); } void Matrix_Vector_Activa::thread_tmp2002_fu_54310_p2() { tmp2002_fu_54310_p2 = (!tmp2996_cast_fu_54296_p1.read().is_01() || !tmp2997_cast_fu_54306_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp2996_cast_fu_54296_p1.read()) + sc_biguint<3>(tmp2997_cast_fu_54306_p1.read())); } void Matrix_Vector_Activa::thread_tmp2003_fu_54320_p2() { tmp2003_fu_54320_p2 = (!tmp2992_cast_fu_54286_p1.read().is_01() || !tmp2995_cast_fu_54316_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2992_cast_fu_54286_p1.read()) + sc_biguint<4>(tmp2995_cast_fu_54316_p1.read())); } void Matrix_Vector_Activa::thread_tmp2004_fu_54330_p2() { tmp2004_fu_54330_p2 = (!tmp_23_15_39_i_cast_fu_54093_p1.read().is_01() || !tmp_23_15_36_i_cast_fu_54084_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_39_i_cast_fu_54093_p1.read()) + sc_biguint<2>(tmp_23_15_36_i_cast_fu_54084_p1.read())); } void Matrix_Vector_Activa::thread_tmp2005_fu_54340_p2() { tmp2005_fu_54340_p2 = (!tmp_23_15_41_i_cast_fu_54099_p1.read().is_01() || !tmp_23_15_38_i_cast_fu_54090_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_41_i_cast_fu_54099_p1.read()) + sc_biguint<2>(tmp_23_15_38_i_cast_fu_54090_p1.read())); } void Matrix_Vector_Activa::thread_tmp2006_fu_54350_p2() { tmp2006_fu_54350_p2 = (!tmp3000_cast_fu_54336_p1.read().is_01() || !tmp3001_cast_fu_54346_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3000_cast_fu_54336_p1.read()) + sc_biguint<3>(tmp3001_cast_fu_54346_p1.read())); } void Matrix_Vector_Activa::thread_tmp2007_fu_54360_p2() { tmp2007_fu_54360_p2 = (!tmp_23_15_43_i_cast_fu_54105_p1.read().is_01() || !tmp_23_15_40_i_cast_fu_54096_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_43_i_cast_fu_54105_p1.read()) + sc_biguint<2>(tmp_23_15_40_i_cast_fu_54096_p1.read())); } void Matrix_Vector_Activa::thread_tmp2008_fu_54370_p2() { tmp2008_fu_54370_p2 = (!tmp_23_15_45_i_cast_fu_54111_p1.read().is_01() || !tmp_23_15_42_i_cast_fu_54102_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_45_i_cast_fu_54111_p1.read()) + sc_biguint<2>(tmp_23_15_42_i_cast_fu_54102_p1.read())); } void Matrix_Vector_Activa::thread_tmp2009_fu_54380_p2() { tmp2009_fu_54380_p2 = (!tmp3003_cast_fu_54366_p1.read().is_01() || !tmp3004_cast_fu_54376_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3003_cast_fu_54366_p1.read()) + sc_biguint<3>(tmp3004_cast_fu_54376_p1.read())); } void Matrix_Vector_Activa::thread_tmp200_cast_fu_43709_p1() { tmp200_cast_fu_43709_p1 = esl_zext<3,2>(tmp135_fu_43703_p2.read()); } void Matrix_Vector_Activa::thread_tmp200_fu_4656_p2() { tmp200_fu_4656_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_6478_fu_4648_p3.read()); } void Matrix_Vector_Activa::thread_tmp2010_fu_54390_p2() { tmp2010_fu_54390_p2 = (!tmp2999_cast_fu_54356_p1.read().is_01() || !tmp3002_cast_fu_54386_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp2999_cast_fu_54356_p1.read()) + sc_biguint<4>(tmp3002_cast_fu_54386_p1.read())); } void Matrix_Vector_Activa::thread_tmp2011_fu_54400_p2() { tmp2011_fu_54400_p2 = (!tmp2991_cast_fu_54326_p1.read().is_01() || !tmp2998_cast_fu_54396_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp2991_cast_fu_54326_p1.read()) + sc_biguint<5>(tmp2998_cast_fu_54396_p1.read())); } void Matrix_Vector_Activa::thread_tmp2012_fu_67799_p2() { tmp2012_fu_67799_p2 = (!tmp1996_fu_67790_p2.read().is_01() || !tmp2990_cast_fu_67796_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp1996_fu_67790_p2.read()) + sc_biguint<16>(tmp2990_cast_fu_67796_p1.read())); } void Matrix_Vector_Activa::thread_tmp2013_fu_54406_p2() { tmp2013_fu_54406_p2 = (!tmp_23_15_i_cast_fu_53973_p1.read().is_01() || !tmp_23_15_44_i_cast_fu_54108_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_i_cast_fu_53973_p1.read()) + sc_biguint<2>(tmp_23_15_44_i_cast_fu_54108_p1.read())); } void Matrix_Vector_Activa::thread_tmp2014_fu_54416_p2() { tmp2014_fu_54416_p2 = (!tmp_23_15_1_i_cast_fu_53976_p1.read().is_01() || !tmp_23_15_2_i_cast_fu_53979_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_1_i_cast_fu_53976_p1.read()) + sc_biguint<2>(tmp_23_15_2_i_cast_fu_53979_p1.read())); } void Matrix_Vector_Activa::thread_tmp2015_fu_54426_p2() { tmp2015_fu_54426_p2 = (!tmp3009_cast_fu_54412_p1.read().is_01() || !tmp3010_cast_fu_54422_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3009_cast_fu_54412_p1.read()) + sc_biguint<3>(tmp3010_cast_fu_54422_p1.read())); } void Matrix_Vector_Activa::thread_tmp2016_fu_54436_p2() { tmp2016_fu_54436_p2 = (!tmp_23_15_3_i_cast_fu_53982_p1.read().is_01() || !tmp_23_15_4_i_cast_fu_53985_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_3_i_cast_fu_53982_p1.read()) + sc_biguint<2>(tmp_23_15_4_i_cast_fu_53985_p1.read())); } void Matrix_Vector_Activa::thread_tmp2017_fu_54446_p2() { tmp2017_fu_54446_p2 = (!tmp_23_15_5_i_cast_fu_53988_p1.read().is_01() || !tmp_23_15_6_i_cast_fu_53991_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_5_i_cast_fu_53988_p1.read()) + sc_biguint<2>(tmp_23_15_6_i_cast_fu_53991_p1.read())); } void Matrix_Vector_Activa::thread_tmp2018_fu_54456_p2() { tmp2018_fu_54456_p2 = (!tmp3012_cast_fu_54442_p1.read().is_01() || !tmp3013_cast_fu_54452_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3012_cast_fu_54442_p1.read()) + sc_biguint<3>(tmp3013_cast_fu_54452_p1.read())); } void Matrix_Vector_Activa::thread_tmp2019_fu_54466_p2() { tmp2019_fu_54466_p2 = (!tmp3008_cast_fu_54432_p1.read().is_01() || !tmp3011_cast_fu_54462_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3008_cast_fu_54432_p1.read()) + sc_biguint<4>(tmp3011_cast_fu_54462_p1.read())); } void Matrix_Vector_Activa::thread_tmp201_fu_4676_p2() { tmp201_fu_4676_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_6479_fu_4668_p3.read()); } void Matrix_Vector_Activa::thread_tmp2020_fu_54476_p2() { tmp2020_fu_54476_p2 = (!tmp_23_15_7_i_cast_fu_53994_p1.read().is_01() || !tmp_23_15_8_i_cast_fu_53997_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_7_i_cast_fu_53994_p1.read()) + sc_biguint<2>(tmp_23_15_8_i_cast_fu_53997_p1.read())); } void Matrix_Vector_Activa::thread_tmp2021_fu_54486_p2() { tmp2021_fu_54486_p2 = (!tmp_23_15_9_i_cast_fu_54000_p1.read().is_01() || !tmp_23_15_i_cast_5884_fu_54003_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_9_i_cast_fu_54000_p1.read()) + sc_biguint<2>(tmp_23_15_i_cast_5884_fu_54003_p1.read())); } void Matrix_Vector_Activa::thread_tmp2022_fu_54496_p2() { tmp2022_fu_54496_p2 = (!tmp3016_cast_fu_54482_p1.read().is_01() || !tmp3017_cast_fu_54492_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3016_cast_fu_54482_p1.read()) + sc_biguint<3>(tmp3017_cast_fu_54492_p1.read())); } void Matrix_Vector_Activa::thread_tmp2023_fu_54506_p2() { tmp2023_fu_54506_p2 = (!tmp_23_15_10_i_cast_fu_54006_p1.read().is_01() || !tmp_23_15_11_i_cast_fu_54009_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_10_i_cast_fu_54006_p1.read()) + sc_biguint<2>(tmp_23_15_11_i_cast_fu_54009_p1.read())); } void Matrix_Vector_Activa::thread_tmp2024_fu_54516_p2() { tmp2024_fu_54516_p2 = (!tmp_23_15_12_i_cast_fu_54012_p1.read().is_01() || !tmp_23_15_13_i_cast_fu_54015_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_12_i_cast_fu_54012_p1.read()) + sc_biguint<2>(tmp_23_15_13_i_cast_fu_54015_p1.read())); } void Matrix_Vector_Activa::thread_tmp2025_fu_54526_p2() { tmp2025_fu_54526_p2 = (!tmp3019_cast_fu_54512_p1.read().is_01() || !tmp3020_cast_fu_54522_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3019_cast_fu_54512_p1.read()) + sc_biguint<3>(tmp3020_cast_fu_54522_p1.read())); } void Matrix_Vector_Activa::thread_tmp2026_fu_54536_p2() { tmp2026_fu_54536_p2 = (!tmp3015_cast_fu_54502_p1.read().is_01() || !tmp3018_cast_fu_54532_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3015_cast_fu_54502_p1.read()) + sc_biguint<4>(tmp3018_cast_fu_54532_p1.read())); } void Matrix_Vector_Activa::thread_tmp2027_fu_54546_p2() { tmp2027_fu_54546_p2 = (!tmp3007_cast_fu_54472_p1.read().is_01() || !tmp3014_cast_fu_54542_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp3007_cast_fu_54472_p1.read()) + sc_biguint<5>(tmp3014_cast_fu_54542_p1.read())); } void Matrix_Vector_Activa::thread_tmp2028_fu_54552_p2() { tmp2028_fu_54552_p2 = (!tmp_23_15_14_i_cast_fu_54018_p1.read().is_01() || !tmp_23_15_15_i_cast_fu_54021_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_14_i_cast_fu_54018_p1.read()) + sc_biguint<2>(tmp_23_15_15_i_cast_fu_54021_p1.read())); } void Matrix_Vector_Activa::thread_tmp2029_fu_54562_p2() { tmp2029_fu_54562_p2 = (!tmp_23_15_16_i_cast_fu_54024_p1.read().is_01() || !tmp_23_15_17_i_cast_fu_54027_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_16_i_cast_fu_54024_p1.read()) + sc_biguint<2>(tmp_23_15_17_i_cast_fu_54027_p1.read())); } void Matrix_Vector_Activa::thread_tmp202_fu_4696_p2() { tmp202_fu_4696_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_6480_fu_4688_p3.read()); } void Matrix_Vector_Activa::thread_tmp2030_fu_54572_p2() { tmp2030_fu_54572_p2 = (!tmp3024_cast_fu_54558_p1.read().is_01() || !tmp3025_cast_fu_54568_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3024_cast_fu_54558_p1.read()) + sc_biguint<3>(tmp3025_cast_fu_54568_p1.read())); } void Matrix_Vector_Activa::thread_tmp2031_fu_54582_p2() { tmp2031_fu_54582_p2 = (!tmp_23_15_18_i_cast_fu_54030_p1.read().is_01() || !tmp_23_15_19_i_cast_fu_54033_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_18_i_cast_fu_54030_p1.read()) + sc_biguint<2>(tmp_23_15_19_i_cast_fu_54033_p1.read())); } void Matrix_Vector_Activa::thread_tmp2032_fu_54592_p2() { tmp2032_fu_54592_p2 = (!tmp_23_15_20_i_cast_fu_54036_p1.read().is_01() || !tmp_23_15_21_i_cast_fu_54039_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_20_i_cast_fu_54036_p1.read()) + sc_biguint<2>(tmp_23_15_21_i_cast_fu_54039_p1.read())); } void Matrix_Vector_Activa::thread_tmp2033_fu_54602_p2() { tmp2033_fu_54602_p2 = (!tmp3027_cast_fu_54588_p1.read().is_01() || !tmp3028_cast_fu_54598_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3027_cast_fu_54588_p1.read()) + sc_biguint<3>(tmp3028_cast_fu_54598_p1.read())); } void Matrix_Vector_Activa::thread_tmp2034_cast_fu_67434_p1() { tmp2034_cast_fu_67434_p1 = esl_zext<16,2>(tmp1348_reg_80354.read()); } void Matrix_Vector_Activa::thread_tmp2034_fu_54612_p2() { tmp2034_fu_54612_p2 = (!tmp3023_cast_fu_54578_p1.read().is_01() || !tmp3026_cast_fu_54608_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3023_cast_fu_54578_p1.read()) + sc_biguint<4>(tmp3026_cast_fu_54608_p1.read())); } void Matrix_Vector_Activa::thread_tmp2035_cast_fu_67443_p1() { tmp2035_cast_fu_67443_p1 = esl_zext<16,3>(tmp1352_reg_80359.read()); } void Matrix_Vector_Activa::thread_tmp2035_fu_54622_p2() { tmp2035_fu_54622_p2 = (!tmp_23_15_22_i_cast_fu_54042_p1.read().is_01() || !tmp_23_15_23_i_cast_fu_54045_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_22_i_cast_fu_54042_p1.read()) + sc_biguint<2>(tmp_23_15_23_i_cast_fu_54045_p1.read())); } void Matrix_Vector_Activa::thread_tmp2036_cast_fu_50519_p1() { tmp2036_cast_fu_50519_p1 = esl_zext<3,2>(tmp1350_fu_50513_p2.read()); } void Matrix_Vector_Activa::thread_tmp2036_fu_54632_p2() { tmp2036_fu_54632_p2 = (!tmp_23_15_24_i_cast_fu_54048_p1.read().is_01() || !tmp_23_15_25_i_cast_fu_54051_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_24_i_cast_fu_54048_p1.read()) + sc_biguint<2>(tmp_23_15_25_i_cast_fu_54051_p1.read())); } void Matrix_Vector_Activa::thread_tmp2037_cast_fu_50529_p1() { tmp2037_cast_fu_50529_p1 = esl_zext<3,2>(tmp1351_fu_50523_p2.read()); } void Matrix_Vector_Activa::thread_tmp2037_fu_54642_p2() { tmp2037_fu_54642_p2 = (!tmp3031_cast_fu_54628_p1.read().is_01() || !tmp3032_cast_fu_54638_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3031_cast_fu_54628_p1.read()) + sc_biguint<3>(tmp3032_cast_fu_54638_p1.read())); } void Matrix_Vector_Activa::thread_tmp2038_cast_fu_67452_p1() { tmp2038_cast_fu_67452_p1 = esl_zext<16,4>(tmp1360_reg_80364.read()); } void Matrix_Vector_Activa::thread_tmp2038_fu_54652_p2() { tmp2038_fu_54652_p2 = (!tmp_23_15_26_i_cast_fu_54054_p1.read().is_01() || !tmp_23_15_27_i_cast_fu_54057_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_26_i_cast_fu_54054_p1.read()) + sc_biguint<2>(tmp_23_15_27_i_cast_fu_54057_p1.read())); } void Matrix_Vector_Activa::thread_tmp2039_cast_fu_50565_p1() { tmp2039_cast_fu_50565_p1 = esl_zext<4,3>(tmp1356_fu_50559_p2.read()); } void Matrix_Vector_Activa::thread_tmp2039_fu_54662_p2() { tmp2039_fu_54662_p2 = (!tmp_23_15_62_i_cast_fu_54159_p1.read().is_01() || !tmp_23_15_28_i_cast_fu_54060_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_62_i_cast_fu_54159_p1.read()) + sc_biguint<2>(tmp_23_15_28_i_cast_fu_54060_p1.read())); } void Matrix_Vector_Activa::thread_tmp203_fu_4716_p2() { tmp203_fu_4716_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_6481_fu_4708_p3.read()); } void Matrix_Vector_Activa::thread_tmp2040_cast_fu_50545_p1() { tmp2040_cast_fu_50545_p1 = esl_zext<3,2>(tmp1354_fu_50539_p2.read()); } void Matrix_Vector_Activa::thread_tmp2040_fu_54668_p2() { tmp2040_fu_54668_p2 = (!tmp_23_15_29_i_cast_fu_54063_p1.read().is_01() || !tmp2039_fu_54662_p2.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_15_29_i_cast_fu_54063_p1.read()) + sc_biguint<2>(tmp2039_fu_54662_p2.read())); } void Matrix_Vector_Activa::thread_tmp2041_cast_fu_50555_p1() { tmp2041_cast_fu_50555_p1 = esl_zext<3,2>(tmp1355_fu_50549_p2.read()); } void Matrix_Vector_Activa::thread_tmp2041_fu_54678_p2() { tmp2041_fu_54678_p2 = (!tmp3034_cast_fu_54658_p1.read().is_01() || !tmp3035_cast_fu_54674_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3034_cast_fu_54658_p1.read()) + sc_biguint<3>(tmp3035_cast_fu_54674_p1.read())); } void Matrix_Vector_Activa::thread_tmp2042_cast_fu_50595_p1() { tmp2042_cast_fu_50595_p1 = esl_zext<4,3>(tmp1359_fu_50589_p2.read()); } void Matrix_Vector_Activa::thread_tmp2042_fu_54688_p2() { tmp2042_fu_54688_p2 = (!tmp3030_cast_fu_54648_p1.read().is_01() || !tmp3033_cast_fu_54684_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3030_cast_fu_54648_p1.read()) + sc_biguint<4>(tmp3033_cast_fu_54684_p1.read())); } void Matrix_Vector_Activa::thread_tmp2043_cast_fu_50575_p1() { tmp2043_cast_fu_50575_p1 = esl_zext<3,2>(tmp1357_fu_50569_p2.read()); } void Matrix_Vector_Activa::thread_tmp2043_fu_54698_p2() { tmp2043_fu_54698_p2 = (!tmp3022_cast_fu_54618_p1.read().is_01() || !tmp3029_cast_fu_54694_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp3022_cast_fu_54618_p1.read()) + sc_biguint<5>(tmp3029_cast_fu_54694_p1.read())); } void Matrix_Vector_Activa::thread_tmp2044_cast_fu_50585_p1() { tmp2044_cast_fu_50585_p1 = esl_zext<3,2>(tmp1358_fu_50579_p2.read()); } void Matrix_Vector_Activa::thread_tmp2044_fu_67811_p2() { tmp2044_fu_67811_p2 = (!tmp3006_cast_fu_67805_p1.read().is_01() || !tmp3021_cast_fu_67808_p1.read().is_01())? sc_lv<6>(): (sc_biguint<6>(tmp3006_cast_fu_67805_p1.read()) + sc_biguint<6>(tmp3021_cast_fu_67808_p1.read())); } void Matrix_Vector_Activa::thread_tmp2045_cast_fu_67461_p1() { tmp2045_cast_fu_67461_p1 = esl_zext<16,5>(tmp1376_reg_80369.read()); } void Matrix_Vector_Activa::thread_tmp2045_fu_22596_p2() { tmp2045_fu_22596_p2 = (tmp_6291_fu_1672_p1.read() ^ tmp_7378_fu_22592_p1.read()); } void Matrix_Vector_Activa::thread_tmp2046_cast_fu_50671_p1() { tmp2046_cast_fu_50671_p1 = esl_zext<5,4>(tmp1368_fu_50665_p2.read()); } void Matrix_Vector_Activa::thread_tmp2046_fu_22616_p2() { tmp2046_fu_22616_p2 = (tmp_6293_fu_1696_p3.read() ^ tmp_7379_fu_22608_p3.read()); } void Matrix_Vector_Activa::thread_tmp2047_cast_fu_50631_p1() { tmp2047_cast_fu_50631_p1 = esl_zext<4,3>(tmp1364_fu_50625_p2.read()); } void Matrix_Vector_Activa::thread_tmp2047_fu_22636_p2() { tmp2047_fu_22636_p2 = (tmp_6295_fu_1724_p3.read() ^ tmp_7380_fu_22628_p3.read()); } void Matrix_Vector_Activa::thread_tmp2048_cast_fu_50611_p1() { tmp2048_cast_fu_50611_p1 = esl_zext<3,2>(tmp1362_fu_50605_p2.read()); } void Matrix_Vector_Activa::thread_tmp2048_fu_22656_p2() { tmp2048_fu_22656_p2 = (tmp_6297_fu_1752_p3.read() ^ tmp_7381_fu_22648_p3.read()); } void Matrix_Vector_Activa::thread_tmp2049_cast_fu_50621_p1() { tmp2049_cast_fu_50621_p1 = esl_zext<3,2>(tmp1363_fu_50615_p2.read()); } void Matrix_Vector_Activa::thread_tmp2049_fu_22676_p2() { tmp2049_fu_22676_p2 = (tmp_6299_fu_1780_p3.read() ^ tmp_7382_fu_22668_p3.read()); } void Matrix_Vector_Activa::thread_tmp204_fu_66825_p2() { tmp204_fu_66825_p2 = (!tmp_23_1_60_i_fu_66822_p1.read().is_01() || !p_accu_V_0_1_i_fu_66741_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_1_60_i_fu_66822_p1.read()) + sc_biguint<16>(p_accu_V_0_1_i_fu_66741_p3.read())); } void Matrix_Vector_Activa::thread_tmp2050_cast_fu_50661_p1() { tmp2050_cast_fu_50661_p1 = esl_zext<4,3>(tmp1367_fu_50655_p2.read()); } void Matrix_Vector_Activa::thread_tmp2050_fu_22696_p2() { tmp2050_fu_22696_p2 = (tmp_6301_fu_1808_p3.read() ^ tmp_7383_fu_22688_p3.read()); } void Matrix_Vector_Activa::thread_tmp2051_cast_fu_50641_p1() { tmp2051_cast_fu_50641_p1 = esl_zext<3,2>(tmp1365_fu_50635_p2.read()); } void Matrix_Vector_Activa::thread_tmp2051_fu_22716_p2() { tmp2051_fu_22716_p2 = (tmp_6303_fu_1836_p3.read() ^ tmp_7384_fu_22708_p3.read()); } void Matrix_Vector_Activa::thread_tmp2052_cast_fu_50651_p1() { tmp2052_cast_fu_50651_p1 = esl_zext<3,2>(tmp1366_fu_50645_p2.read()); } void Matrix_Vector_Activa::thread_tmp2052_fu_22736_p2() { tmp2052_fu_22736_p2 = (tmp_6305_fu_1864_p3.read() ^ tmp_7385_fu_22728_p3.read()); } void Matrix_Vector_Activa::thread_tmp2053_cast_fu_50741_p1() { tmp2053_cast_fu_50741_p1 = esl_zext<5,4>(tmp1375_fu_50735_p2.read()); } void Matrix_Vector_Activa::thread_tmp2053_fu_22756_p2() { tmp2053_fu_22756_p2 = (tmp_6307_fu_1892_p3.read() ^ tmp_7386_fu_22748_p3.read()); } void Matrix_Vector_Activa::thread_tmp2054_cast_fu_50701_p1() { tmp2054_cast_fu_50701_p1 = esl_zext<4,3>(tmp1371_fu_50695_p2.read()); } void Matrix_Vector_Activa::thread_tmp2054_fu_22776_p2() { tmp2054_fu_22776_p2 = (tmp_6309_fu_1920_p3.read() ^ tmp_7387_fu_22768_p3.read()); } void Matrix_Vector_Activa::thread_tmp2055_cast_fu_50681_p1() { tmp2055_cast_fu_50681_p1 = esl_zext<3,2>(tmp1369_fu_50675_p2.read()); } void Matrix_Vector_Activa::thread_tmp2055_fu_22796_p2() { tmp2055_fu_22796_p2 = (tmp_6311_fu_1948_p3.read() ^ tmp_7388_fu_22788_p3.read()); } void Matrix_Vector_Activa::thread_tmp2056_cast_fu_50691_p1() { tmp2056_cast_fu_50691_p1 = esl_zext<3,2>(tmp1370_fu_50685_p2.read()); } void Matrix_Vector_Activa::thread_tmp2056_fu_22816_p2() { tmp2056_fu_22816_p2 = (tmp_6313_fu_1976_p3.read() ^ tmp_7389_fu_22808_p3.read()); } void Matrix_Vector_Activa::thread_tmp2057_cast_fu_50731_p1() { tmp2057_cast_fu_50731_p1 = esl_zext<4,3>(tmp1374_fu_50725_p2.read()); } void Matrix_Vector_Activa::thread_tmp2057_fu_22836_p2() { tmp2057_fu_22836_p2 = (tmp_6315_fu_2004_p3.read() ^ tmp_7390_fu_22828_p3.read()); } void Matrix_Vector_Activa::thread_tmp2058_cast_fu_50711_p1() { tmp2058_cast_fu_50711_p1 = esl_zext<3,2>(tmp1372_fu_50705_p2.read()); } void Matrix_Vector_Activa::thread_tmp2058_fu_22856_p2() { tmp2058_fu_22856_p2 = (tmp_6317_fu_2032_p3.read() ^ tmp_7391_fu_22848_p3.read()); } void Matrix_Vector_Activa::thread_tmp2059_cast_fu_50721_p1() { tmp2059_cast_fu_50721_p1 = esl_zext<3,2>(tmp1373_fu_50715_p2.read()); } void Matrix_Vector_Activa::thread_tmp2059_fu_22876_p2() { tmp2059_fu_22876_p2 = (tmp_6319_fu_2060_p3.read() ^ tmp_7392_fu_22868_p3.read()); } void Matrix_Vector_Activa::thread_tmp205_fu_43928_p2() { tmp205_fu_43928_p2 = (!tmp_23_1_59_i_cast_fu_43919_p1.read().is_01() || !tmp_23_1_61_i_cast_fu_43922_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_59_i_cast_fu_43919_p1.read()) + sc_biguint<2>(tmp_23_1_61_i_cast_fu_43922_p1.read())); } void Matrix_Vector_Activa::thread_tmp2060_cast_fu_67482_p1() { tmp2060_cast_fu_67482_p1 = esl_zext<16,6>(tmp1409_fu_67476_p2.read()); } void Matrix_Vector_Activa::thread_tmp2060_fu_22896_p2() { tmp2060_fu_22896_p2 = (tmp_6321_fu_2088_p3.read() ^ tmp_7393_fu_22888_p3.read()); } void Matrix_Vector_Activa::thread_tmp2061_cast_fu_67470_p1() { tmp2061_cast_fu_67470_p1 = esl_zext<6,5>(tmp1392_reg_80374.read()); } void Matrix_Vector_Activa::thread_tmp2061_fu_22916_p2() { tmp2061_fu_22916_p2 = (tmp_6323_fu_2116_p3.read() ^ tmp_7394_fu_22908_p3.read()); } void Matrix_Vector_Activa::thread_tmp2062_cast_fu_50817_p1() { tmp2062_cast_fu_50817_p1 = esl_zext<5,4>(tmp1384_fu_50811_p2.read()); } void Matrix_Vector_Activa::thread_tmp2062_fu_22936_p2() { tmp2062_fu_22936_p2 = (tmp_6325_fu_2144_p3.read() ^ tmp_7395_fu_22928_p3.read()); } void Matrix_Vector_Activa::thread_tmp2063_cast_fu_50777_p1() { tmp2063_cast_fu_50777_p1 = esl_zext<4,3>(tmp1380_fu_50771_p2.read()); } void Matrix_Vector_Activa::thread_tmp2063_fu_22956_p2() { tmp2063_fu_22956_p2 = (tmp_6327_fu_2172_p3.read() ^ tmp_7396_fu_22948_p3.read()); } void Matrix_Vector_Activa::thread_tmp2064_cast_fu_50757_p1() { tmp2064_cast_fu_50757_p1 = esl_zext<3,2>(tmp1378_fu_50751_p2.read()); } void Matrix_Vector_Activa::thread_tmp2064_fu_22976_p2() { tmp2064_fu_22976_p2 = (tmp_6329_fu_2200_p3.read() ^ tmp_7397_fu_22968_p3.read()); } void Matrix_Vector_Activa::thread_tmp2065_cast_fu_50767_p1() { tmp2065_cast_fu_50767_p1 = esl_zext<3,2>(tmp1379_fu_50761_p2.read()); } void Matrix_Vector_Activa::thread_tmp2065_fu_22996_p2() { tmp2065_fu_22996_p2 = (tmp_6331_fu_2228_p3.read() ^ tmp_7398_fu_22988_p3.read()); } void Matrix_Vector_Activa::thread_tmp2066_cast_fu_50807_p1() { tmp2066_cast_fu_50807_p1 = esl_zext<4,3>(tmp1383_fu_50801_p2.read()); } void Matrix_Vector_Activa::thread_tmp2066_fu_23016_p2() { tmp2066_fu_23016_p2 = (tmp_6333_fu_2256_p3.read() ^ tmp_7399_fu_23008_p3.read()); } void Matrix_Vector_Activa::thread_tmp2067_cast_fu_50787_p1() { tmp2067_cast_fu_50787_p1 = esl_zext<3,2>(tmp1381_fu_50781_p2.read()); } void Matrix_Vector_Activa::thread_tmp2067_fu_23036_p2() { tmp2067_fu_23036_p2 = (tmp_6335_fu_2284_p3.read() ^ tmp_7400_fu_23028_p3.read()); } void Matrix_Vector_Activa::thread_tmp2068_cast_fu_50797_p1() { tmp2068_cast_fu_50797_p1 = esl_zext<3,2>(tmp1382_fu_50791_p2.read()); } void Matrix_Vector_Activa::thread_tmp2068_fu_23056_p2() { tmp2068_fu_23056_p2 = (tmp_6337_fu_2312_p3.read() ^ tmp_7401_fu_23048_p3.read()); } void Matrix_Vector_Activa::thread_tmp2069_cast_fu_50887_p1() { tmp2069_cast_fu_50887_p1 = esl_zext<5,4>(tmp1391_fu_50881_p2.read()); } void Matrix_Vector_Activa::thread_tmp2069_fu_23076_p2() { tmp2069_fu_23076_p2 = (tmp_6339_fu_2340_p3.read() ^ tmp_7402_fu_23068_p3.read()); } void Matrix_Vector_Activa::thread_tmp206_fu_66834_p2() { tmp206_fu_66834_p2 = (!tmp204_fu_66825_p2.read().is_01() || !tmp333_cast_fu_66831_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp204_fu_66825_p2.read()) + sc_biguint<16>(tmp333_cast_fu_66831_p1.read())); } void Matrix_Vector_Activa::thread_tmp2070_cast_fu_50847_p1() { tmp2070_cast_fu_50847_p1 = esl_zext<4,3>(tmp1387_fu_50841_p2.read()); } void Matrix_Vector_Activa::thread_tmp2070_fu_23096_p2() { tmp2070_fu_23096_p2 = (tmp_6341_fu_2368_p3.read() ^ tmp_7403_fu_23088_p3.read()); } void Matrix_Vector_Activa::thread_tmp2071_cast_fu_50827_p1() { tmp2071_cast_fu_50827_p1 = esl_zext<3,2>(tmp1385_fu_50821_p2.read()); } void Matrix_Vector_Activa::thread_tmp2071_fu_23116_p2() { tmp2071_fu_23116_p2 = (tmp_6343_fu_2396_p3.read() ^ tmp_7404_fu_23108_p3.read()); } void Matrix_Vector_Activa::thread_tmp2072_cast_fu_50837_p1() { tmp2072_cast_fu_50837_p1 = esl_zext<3,2>(tmp1386_fu_50831_p2.read()); } void Matrix_Vector_Activa::thread_tmp2072_fu_23136_p2() { tmp2072_fu_23136_p2 = (tmp_6345_fu_2424_p3.read() ^ tmp_7405_fu_23128_p3.read()); } void Matrix_Vector_Activa::thread_tmp2073_cast_fu_50877_p1() { tmp2073_cast_fu_50877_p1 = esl_zext<4,3>(tmp1390_fu_50871_p2.read()); } void Matrix_Vector_Activa::thread_tmp2073_fu_23156_p2() { tmp2073_fu_23156_p2 = (tmp_6347_fu_2452_p3.read() ^ tmp_7406_fu_23148_p3.read()); } void Matrix_Vector_Activa::thread_tmp2074_cast_fu_50857_p1() { tmp2074_cast_fu_50857_p1 = esl_zext<3,2>(tmp1388_fu_50851_p2.read()); } void Matrix_Vector_Activa::thread_tmp2074_fu_23176_p2() { tmp2074_fu_23176_p2 = (tmp_6349_fu_2480_p3.read() ^ tmp_7407_fu_23168_p3.read()); } void Matrix_Vector_Activa::thread_tmp2075_cast_fu_50867_p1() { tmp2075_cast_fu_50867_p1 = esl_zext<3,2>(tmp1389_fu_50861_p2.read()); } void Matrix_Vector_Activa::thread_tmp2075_fu_23196_p2() { tmp2075_fu_23196_p2 = (tmp_6351_fu_2508_p3.read() ^ tmp_7408_fu_23188_p3.read()); } void Matrix_Vector_Activa::thread_tmp2076_cast_fu_67473_p1() { tmp2076_cast_fu_67473_p1 = esl_zext<6,5>(tmp1408_reg_80379.read()); } void Matrix_Vector_Activa::thread_tmp2076_fu_23216_p2() { tmp2076_fu_23216_p2 = (tmp_6353_fu_2536_p3.read() ^ tmp_7409_fu_23208_p3.read()); } void Matrix_Vector_Activa::thread_tmp2077_cast_fu_50963_p1() { tmp2077_cast_fu_50963_p1 = esl_zext<5,4>(tmp1399_fu_50957_p2.read()); } void Matrix_Vector_Activa::thread_tmp2077_fu_23236_p2() { tmp2077_fu_23236_p2 = (tmp_6355_fu_2564_p3.read() ^ tmp_7410_fu_23228_p3.read()); } void Matrix_Vector_Activa::thread_tmp2078_cast_fu_50923_p1() { tmp2078_cast_fu_50923_p1 = esl_zext<4,3>(tmp1395_fu_50917_p2.read()); } void Matrix_Vector_Activa::thread_tmp2078_fu_23256_p2() { tmp2078_fu_23256_p2 = (tmp_6357_fu_2592_p3.read() ^ tmp_7411_fu_23248_p3.read()); } void Matrix_Vector_Activa::thread_tmp2079_cast_fu_50903_p1() { tmp2079_cast_fu_50903_p1 = esl_zext<3,2>(tmp1393_fu_50897_p2.read()); } void Matrix_Vector_Activa::thread_tmp2079_fu_23276_p2() { tmp2079_fu_23276_p2 = (tmp_6359_fu_2620_p3.read() ^ tmp_7412_fu_23268_p3.read()); } void Matrix_Vector_Activa::thread_tmp207_fu_43934_p2() { tmp207_fu_43934_p2 = (!tmp_23_1_55_i_cast_fu_43907_p1.read().is_01() || !tmp_23_1_58_i_cast_fu_43916_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_55_i_cast_fu_43907_p1.read()) + sc_biguint<2>(tmp_23_1_58_i_cast_fu_43916_p1.read())); } void Matrix_Vector_Activa::thread_tmp2080_cast_fu_50913_p1() { tmp2080_cast_fu_50913_p1 = esl_zext<3,2>(tmp1394_fu_50907_p2.read()); } void Matrix_Vector_Activa::thread_tmp2080_fu_23296_p2() { tmp2080_fu_23296_p2 = (tmp_6361_fu_2648_p3.read() ^ tmp_7413_fu_23288_p3.read()); } void Matrix_Vector_Activa::thread_tmp2081_cast_fu_50953_p1() { tmp2081_cast_fu_50953_p1 = esl_zext<4,3>(tmp1398_fu_50947_p2.read()); } void Matrix_Vector_Activa::thread_tmp2081_fu_23316_p2() { tmp2081_fu_23316_p2 = (tmp_6363_fu_2676_p3.read() ^ tmp_7414_fu_23308_p3.read()); } void Matrix_Vector_Activa::thread_tmp2082_cast_fu_50933_p1() { tmp2082_cast_fu_50933_p1 = esl_zext<3,2>(tmp1396_fu_50927_p2.read()); } void Matrix_Vector_Activa::thread_tmp2082_fu_23336_p2() { tmp2082_fu_23336_p2 = (tmp_6365_fu_2704_p3.read() ^ tmp_7415_fu_23328_p3.read()); } void Matrix_Vector_Activa::thread_tmp2083_cast_fu_50943_p1() { tmp2083_cast_fu_50943_p1 = esl_zext<3,2>(tmp1397_fu_50937_p2.read()); } void Matrix_Vector_Activa::thread_tmp2083_fu_23356_p2() { tmp2083_fu_23356_p2 = (tmp_6367_fu_2732_p3.read() ^ tmp_7416_fu_23348_p3.read()); } void Matrix_Vector_Activa::thread_tmp2084_cast_fu_51039_p1() { tmp2084_cast_fu_51039_p1 = esl_zext<5,4>(tmp1407_fu_51033_p2.read()); } void Matrix_Vector_Activa::thread_tmp2084_fu_23376_p2() { tmp2084_fu_23376_p2 = (tmp_6369_fu_2760_p3.read() ^ tmp_7417_fu_23368_p3.read()); } void Matrix_Vector_Activa::thread_tmp2085_cast_fu_50993_p1() { tmp2085_cast_fu_50993_p1 = esl_zext<4,3>(tmp1402_fu_50987_p2.read()); } void Matrix_Vector_Activa::thread_tmp2085_fu_23396_p2() { tmp2085_fu_23396_p2 = (tmp_6371_fu_2788_p3.read() ^ tmp_7418_fu_23388_p3.read()); } void Matrix_Vector_Activa::thread_tmp2086_cast_fu_50973_p1() { tmp2086_cast_fu_50973_p1 = esl_zext<3,2>(tmp1400_fu_50967_p2.read()); } void Matrix_Vector_Activa::thread_tmp2086_fu_23416_p2() { tmp2086_fu_23416_p2 = (tmp_6373_fu_2816_p3.read() ^ tmp_7419_fu_23408_p3.read()); } void Matrix_Vector_Activa::thread_tmp2087_cast_fu_50983_p1() { tmp2087_cast_fu_50983_p1 = esl_zext<3,2>(tmp1401_fu_50977_p2.read()); } void Matrix_Vector_Activa::thread_tmp2087_fu_23436_p2() { tmp2087_fu_23436_p2 = (tmp_6375_fu_2844_p3.read() ^ tmp_7420_fu_23428_p3.read()); } void Matrix_Vector_Activa::thread_tmp2088_cast_fu_51029_p1() { tmp2088_cast_fu_51029_p1 = esl_zext<4,3>(tmp1406_fu_51023_p2.read()); } void Matrix_Vector_Activa::thread_tmp2088_fu_23456_p2() { tmp2088_fu_23456_p2 = (tmp_6377_fu_2872_p3.read() ^ tmp_7421_fu_23448_p3.read()); } void Matrix_Vector_Activa::thread_tmp2089_cast_fu_51003_p1() { tmp2089_cast_fu_51003_p1 = esl_zext<3,2>(tmp1403_fu_50997_p2.read()); } void Matrix_Vector_Activa::thread_tmp2089_fu_23476_p2() { tmp2089_fu_23476_p2 = (tmp_6379_fu_2900_p3.read() ^ tmp_7422_fu_23468_p3.read()); } void Matrix_Vector_Activa::thread_tmp208_fu_43944_p2() { tmp208_fu_43944_p2 = (!tmp_23_1_57_i_cast_fu_43913_p1.read().is_01() || !tmp_23_1_54_i_cast_fu_43904_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_57_i_cast_fu_43913_p1.read()) + sc_biguint<2>(tmp_23_1_54_i_cast_fu_43904_p1.read())); } void Matrix_Vector_Activa::thread_tmp2090_cast_fu_51019_p1() { tmp2090_cast_fu_51019_p1 = esl_zext<3,2>(tmp1405_fu_51013_p2.read()); } void Matrix_Vector_Activa::thread_tmp2090_fu_23496_p2() { tmp2090_fu_23496_p2 = (tmp_6381_fu_2928_p3.read() ^ tmp_7423_fu_23488_p3.read()); } void Matrix_Vector_Activa::thread_tmp2091_fu_23516_p2() { tmp2091_fu_23516_p2 = (tmp_6383_fu_2956_p3.read() ^ tmp_7424_fu_23508_p3.read()); } void Matrix_Vector_Activa::thread_tmp2092_fu_23536_p2() { tmp2092_fu_23536_p2 = (tmp_6385_fu_2984_p3.read() ^ tmp_7425_fu_23528_p3.read()); } void Matrix_Vector_Activa::thread_tmp2093_fu_23556_p2() { tmp2093_fu_23556_p2 = (tmp_6387_fu_3012_p3.read() ^ tmp_7426_fu_23548_p3.read()); } void Matrix_Vector_Activa::thread_tmp2094_fu_23576_p2() { tmp2094_fu_23576_p2 = (tmp_6389_fu_3040_p3.read() ^ tmp_7427_fu_23568_p3.read()); } void Matrix_Vector_Activa::thread_tmp2095_fu_23596_p2() { tmp2095_fu_23596_p2 = (tmp_6391_fu_3068_p3.read() ^ tmp_7428_fu_23588_p3.read()); } void Matrix_Vector_Activa::thread_tmp2096_fu_23616_p2() { tmp2096_fu_23616_p2 = (tmp_6393_fu_3096_p3.read() ^ tmp_7429_fu_23608_p3.read()); } void Matrix_Vector_Activa::thread_tmp2097_fu_23636_p2() { tmp2097_fu_23636_p2 = (tmp_6395_fu_3124_p3.read() ^ tmp_7430_fu_23628_p3.read()); } void Matrix_Vector_Activa::thread_tmp2098_fu_23656_p2() { tmp2098_fu_23656_p2 = (tmp_6397_fu_3152_p3.read() ^ tmp_7431_fu_23648_p3.read()); } void Matrix_Vector_Activa::thread_tmp2099_fu_23676_p2() { tmp2099_fu_23676_p2 = (tmp_6399_fu_3180_p3.read() ^ tmp_7432_fu_23668_p3.read()); } void Matrix_Vector_Activa::thread_tmp209_fu_43954_p2() { tmp209_fu_43954_p2 = (!tmp335_cast_fu_43940_p1.read().is_01() || !tmp336_cast_fu_43950_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp335_cast_fu_43940_p1.read()) + sc_biguint<3>(tmp336_cast_fu_43950_p1.read())); } void Matrix_Vector_Activa::thread_tmp20_fu_1872_p2() { tmp20_fu_1872_p2 = (tmp_6305_fu_1864_p3.read() ^ tmp_6304_fu_1856_p3.read()); } void Matrix_Vector_Activa::thread_tmp2100_fu_23696_p2() { tmp2100_fu_23696_p2 = (tmp_6401_fu_3208_p3.read() ^ tmp_7433_fu_23688_p3.read()); } void Matrix_Vector_Activa::thread_tmp2101_fu_23716_p2() { tmp2101_fu_23716_p2 = (tmp_6403_fu_3236_p3.read() ^ tmp_7434_fu_23708_p3.read()); } void Matrix_Vector_Activa::thread_tmp2102_fu_23736_p2() { tmp2102_fu_23736_p2 = (tmp_6405_fu_3264_p3.read() ^ tmp_7435_fu_23728_p3.read()); } void Matrix_Vector_Activa::thread_tmp2103_fu_23756_p2() { tmp2103_fu_23756_p2 = (tmp_6407_fu_3292_p3.read() ^ tmp_7436_fu_23748_p3.read()); } void Matrix_Vector_Activa::thread_tmp2104_fu_23776_p2() { tmp2104_fu_23776_p2 = (tmp_6409_fu_3320_p3.read() ^ tmp_7437_fu_23768_p3.read()); } void Matrix_Vector_Activa::thread_tmp2105_fu_23796_p2() { tmp2105_fu_23796_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_7438_fu_23788_p3.read()); } void Matrix_Vector_Activa::thread_tmp2106_fu_23816_p2() { tmp2106_fu_23816_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_7439_fu_23808_p3.read()); } void Matrix_Vector_Activa::thread_tmp2107_fu_23836_p2() { tmp2107_fu_23836_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_7440_fu_23828_p3.read()); } void Matrix_Vector_Activa::thread_tmp2108_fu_23856_p2() { tmp2108_fu_23856_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_7441_fu_23848_p3.read()); } void Matrix_Vector_Activa::thread_tmp2109_fu_67830_p2() { tmp2109_fu_67830_p2 = (!tmp_23_16_60_i_fu_67827_p1.read().is_01() || !p_accu_V_0_16_i_fu_66636_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_16_60_i_fu_67827_p1.read()) + sc_biguint<16>(p_accu_V_0_16_i_fu_66636_p3.read())); } void Matrix_Vector_Activa::thread_tmp210_fu_66843_p2() { tmp210_fu_66843_p2 = (!tmp206_fu_66834_p2.read().is_01() || !tmp334_cast_fu_66840_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp206_fu_66834_p2.read()) + sc_biguint<16>(tmp334_cast_fu_66840_p1.read())); } void Matrix_Vector_Activa::thread_tmp2110_fu_54893_p2() { tmp2110_fu_54893_p2 = (!tmp_23_16_59_i_cast_fu_54884_p1.read().is_01() || !tmp_23_16_61_i_cast_fu_54887_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_59_i_cast_fu_54884_p1.read()) + sc_biguint<2>(tmp_23_16_61_i_cast_fu_54887_p1.read())); } void Matrix_Vector_Activa::thread_tmp2111_fu_67839_p2() { tmp2111_fu_67839_p2 = (!tmp2109_fu_67830_p2.read().is_01() || !tmp3168_cast_fu_67836_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2109_fu_67830_p2.read()) + sc_biguint<16>(tmp3168_cast_fu_67836_p1.read())); } void Matrix_Vector_Activa::thread_tmp2112_fu_54899_p2() { tmp2112_fu_54899_p2 = (!tmp_23_16_55_i_cast_fu_54872_p1.read().is_01() || !tmp_23_16_58_i_cast_fu_54881_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_55_i_cast_fu_54872_p1.read()) + sc_biguint<2>(tmp_23_16_58_i_cast_fu_54881_p1.read())); } void Matrix_Vector_Activa::thread_tmp2113_fu_54909_p2() { tmp2113_fu_54909_p2 = (!tmp_23_16_57_i_cast_fu_54878_p1.read().is_01() || !tmp_23_16_54_i_cast_fu_54869_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_57_i_cast_fu_54878_p1.read()) + sc_biguint<2>(tmp_23_16_54_i_cast_fu_54869_p1.read())); } void Matrix_Vector_Activa::thread_tmp2114_fu_54919_p2() { tmp2114_fu_54919_p2 = (!tmp3170_cast_fu_54905_p1.read().is_01() || !tmp3171_cast_fu_54915_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3170_cast_fu_54905_p1.read()) + sc_biguint<3>(tmp3171_cast_fu_54915_p1.read())); } void Matrix_Vector_Activa::thread_tmp2115_fu_67848_p2() { tmp2115_fu_67848_p2 = (!tmp2111_fu_67839_p2.read().is_01() || !tmp3169_cast_fu_67845_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2111_fu_67839_p2.read()) + sc_biguint<16>(tmp3169_cast_fu_67845_p1.read())); } void Matrix_Vector_Activa::thread_tmp2116_fu_54925_p2() { tmp2116_fu_54925_p2 = (!tmp_23_16_47_i_cast_fu_54848_p1.read().is_01() || !tmp_23_16_56_i_cast_fu_54875_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_47_i_cast_fu_54848_p1.read()) + sc_biguint<2>(tmp_23_16_56_i_cast_fu_54875_p1.read())); } void Matrix_Vector_Activa::thread_tmp2117_fu_54935_p2() { tmp2117_fu_54935_p2 = (!tmp_23_16_49_i_cast_fu_54854_p1.read().is_01() || !tmp_23_16_46_i_cast_fu_54845_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_49_i_cast_fu_54854_p1.read()) + sc_biguint<2>(tmp_23_16_46_i_cast_fu_54845_p1.read())); } void Matrix_Vector_Activa::thread_tmp2118_fu_54945_p2() { tmp2118_fu_54945_p2 = (!tmp3174_cast_fu_54931_p1.read().is_01() || !tmp3175_cast_fu_54941_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3174_cast_fu_54931_p1.read()) + sc_biguint<3>(tmp3175_cast_fu_54941_p1.read())); } void Matrix_Vector_Activa::thread_tmp2119_fu_54955_p2() { tmp2119_fu_54955_p2 = (!tmp_23_16_51_i_cast_fu_54860_p1.read().is_01() || !tmp_23_16_48_i_cast_fu_54851_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_51_i_cast_fu_54860_p1.read()) + sc_biguint<2>(tmp_23_16_48_i_cast_fu_54851_p1.read())); } void Matrix_Vector_Activa::thread_tmp211_fu_43960_p2() { tmp211_fu_43960_p2 = (!tmp_23_1_47_i_cast_fu_43883_p1.read().is_01() || !tmp_23_1_56_i_cast_fu_43910_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_47_i_cast_fu_43883_p1.read()) + sc_biguint<2>(tmp_23_1_56_i_cast_fu_43910_p1.read())); } void Matrix_Vector_Activa::thread_tmp2120_fu_54965_p2() { tmp2120_fu_54965_p2 = (!tmp_23_16_53_i_cast_fu_54866_p1.read().is_01() || !tmp_23_16_50_i_cast_fu_54857_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_53_i_cast_fu_54866_p1.read()) + sc_biguint<2>(tmp_23_16_50_i_cast_fu_54857_p1.read())); } void Matrix_Vector_Activa::thread_tmp2121_fu_54975_p2() { tmp2121_fu_54975_p2 = (!tmp3177_cast_fu_54961_p1.read().is_01() || !tmp3178_cast_fu_54971_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3177_cast_fu_54961_p1.read()) + sc_biguint<3>(tmp3178_cast_fu_54971_p1.read())); } void Matrix_Vector_Activa::thread_tmp2122_fu_54985_p2() { tmp2122_fu_54985_p2 = (!tmp3173_cast_fu_54951_p1.read().is_01() || !tmp3176_cast_fu_54981_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3173_cast_fu_54951_p1.read()) + sc_biguint<4>(tmp3176_cast_fu_54981_p1.read())); } void Matrix_Vector_Activa::thread_tmp2123_fu_67857_p2() { tmp2123_fu_67857_p2 = (!tmp2115_fu_67848_p2.read().is_01() || !tmp3172_cast_fu_67854_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2115_fu_67848_p2.read()) + sc_biguint<16>(tmp3172_cast_fu_67854_p1.read())); } void Matrix_Vector_Activa::thread_tmp2124_fu_54991_p2() { tmp2124_fu_54991_p2 = (!tmp_23_16_31_i_cast_fu_54800_p1.read().is_01() || !tmp_23_16_52_i_cast_fu_54863_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_31_i_cast_fu_54800_p1.read()) + sc_biguint<2>(tmp_23_16_52_i_cast_fu_54863_p1.read())); } void Matrix_Vector_Activa::thread_tmp2125_fu_55001_p2() { tmp2125_fu_55001_p2 = (!tmp_23_16_33_i_cast_fu_54806_p1.read().is_01() || !tmp_23_16_30_i_cast_fu_54797_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_33_i_cast_fu_54806_p1.read()) + sc_biguint<2>(tmp_23_16_30_i_cast_fu_54797_p1.read())); } void Matrix_Vector_Activa::thread_tmp2126_fu_55011_p2() { tmp2126_fu_55011_p2 = (!tmp3182_cast_fu_54997_p1.read().is_01() || !tmp3183_cast_fu_55007_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3182_cast_fu_54997_p1.read()) + sc_biguint<3>(tmp3183_cast_fu_55007_p1.read())); } void Matrix_Vector_Activa::thread_tmp2127_fu_55021_p2() { tmp2127_fu_55021_p2 = (!tmp_23_16_35_i_cast_fu_54812_p1.read().is_01() || !tmp_23_16_32_i_cast_fu_54803_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_35_i_cast_fu_54812_p1.read()) + sc_biguint<2>(tmp_23_16_32_i_cast_fu_54803_p1.read())); } void Matrix_Vector_Activa::thread_tmp2128_fu_55031_p2() { tmp2128_fu_55031_p2 = (!tmp_23_16_37_i_cast_fu_54818_p1.read().is_01() || !tmp_23_16_34_i_cast_fu_54809_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_37_i_cast_fu_54818_p1.read()) + sc_biguint<2>(tmp_23_16_34_i_cast_fu_54809_p1.read())); } void Matrix_Vector_Activa::thread_tmp2129_fu_55041_p2() { tmp2129_fu_55041_p2 = (!tmp3185_cast_fu_55027_p1.read().is_01() || !tmp3186_cast_fu_55037_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3185_cast_fu_55027_p1.read()) + sc_biguint<3>(tmp3186_cast_fu_55037_p1.read())); } void Matrix_Vector_Activa::thread_tmp212_fu_43970_p2() { tmp212_fu_43970_p2 = (!tmp_23_1_49_i_cast_fu_43889_p1.read().is_01() || !tmp_23_1_46_i_cast_fu_43880_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_49_i_cast_fu_43889_p1.read()) + sc_biguint<2>(tmp_23_1_46_i_cast_fu_43880_p1.read())); } void Matrix_Vector_Activa::thread_tmp2130_fu_55051_p2() { tmp2130_fu_55051_p2 = (!tmp3181_cast_fu_55017_p1.read().is_01() || !tmp3184_cast_fu_55047_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3181_cast_fu_55017_p1.read()) + sc_biguint<4>(tmp3184_cast_fu_55047_p1.read())); } void Matrix_Vector_Activa::thread_tmp2131_fu_55061_p2() { tmp2131_fu_55061_p2 = (!tmp_23_16_39_i_cast_fu_54824_p1.read().is_01() || !tmp_23_16_36_i_cast_fu_54815_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_39_i_cast_fu_54824_p1.read()) + sc_biguint<2>(tmp_23_16_36_i_cast_fu_54815_p1.read())); } void Matrix_Vector_Activa::thread_tmp2132_fu_55071_p2() { tmp2132_fu_55071_p2 = (!tmp_23_16_41_i_cast_fu_54830_p1.read().is_01() || !tmp_23_16_38_i_cast_fu_54821_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_41_i_cast_fu_54830_p1.read()) + sc_biguint<2>(tmp_23_16_38_i_cast_fu_54821_p1.read())); } void Matrix_Vector_Activa::thread_tmp2133_fu_55081_p2() { tmp2133_fu_55081_p2 = (!tmp3189_cast_fu_55067_p1.read().is_01() || !tmp3190_cast_fu_55077_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3189_cast_fu_55067_p1.read()) + sc_biguint<3>(tmp3190_cast_fu_55077_p1.read())); } void Matrix_Vector_Activa::thread_tmp2134_fu_55091_p2() { tmp2134_fu_55091_p2 = (!tmp_23_16_43_i_cast_fu_54836_p1.read().is_01() || !tmp_23_16_40_i_cast_fu_54827_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_43_i_cast_fu_54836_p1.read()) + sc_biguint<2>(tmp_23_16_40_i_cast_fu_54827_p1.read())); } void Matrix_Vector_Activa::thread_tmp2135_fu_55101_p2() { tmp2135_fu_55101_p2 = (!tmp_23_16_45_i_cast_fu_54842_p1.read().is_01() || !tmp_23_16_42_i_cast_fu_54833_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_45_i_cast_fu_54842_p1.read()) + sc_biguint<2>(tmp_23_16_42_i_cast_fu_54833_p1.read())); } void Matrix_Vector_Activa::thread_tmp2136_fu_55111_p2() { tmp2136_fu_55111_p2 = (!tmp3192_cast_fu_55097_p1.read().is_01() || !tmp3193_cast_fu_55107_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3192_cast_fu_55097_p1.read()) + sc_biguint<3>(tmp3193_cast_fu_55107_p1.read())); } void Matrix_Vector_Activa::thread_tmp2137_fu_55121_p2() { tmp2137_fu_55121_p2 = (!tmp3188_cast_fu_55087_p1.read().is_01() || !tmp3191_cast_fu_55117_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3188_cast_fu_55087_p1.read()) + sc_biguint<4>(tmp3191_cast_fu_55117_p1.read())); } void Matrix_Vector_Activa::thread_tmp2138_fu_55131_p2() { tmp2138_fu_55131_p2 = (!tmp3180_cast_fu_55057_p1.read().is_01() || !tmp3187_cast_fu_55127_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp3180_cast_fu_55057_p1.read()) + sc_biguint<5>(tmp3187_cast_fu_55127_p1.read())); } void Matrix_Vector_Activa::thread_tmp2139_fu_67866_p2() { tmp2139_fu_67866_p2 = (!tmp2123_fu_67857_p2.read().is_01() || !tmp3179_cast_fu_67863_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2123_fu_67857_p2.read()) + sc_biguint<16>(tmp3179_cast_fu_67863_p1.read())); } void Matrix_Vector_Activa::thread_tmp213_fu_43980_p2() { tmp213_fu_43980_p2 = (!tmp339_cast_fu_43966_p1.read().is_01() || !tmp340_cast_fu_43976_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp339_cast_fu_43966_p1.read()) + sc_biguint<3>(tmp340_cast_fu_43976_p1.read())); } void Matrix_Vector_Activa::thread_tmp2140_fu_55137_p2() { tmp2140_fu_55137_p2 = (!tmp_23_16_i_cast_fu_54704_p1.read().is_01() || !tmp_23_16_44_i_cast_fu_54839_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_i_cast_fu_54704_p1.read()) + sc_biguint<2>(tmp_23_16_44_i_cast_fu_54839_p1.read())); } void Matrix_Vector_Activa::thread_tmp2141_fu_55147_p2() { tmp2141_fu_55147_p2 = (!tmp_23_16_1_i_cast_fu_54707_p1.read().is_01() || !tmp_23_16_2_i_cast_fu_54710_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_1_i_cast_fu_54707_p1.read()) + sc_biguint<2>(tmp_23_16_2_i_cast_fu_54710_p1.read())); } void Matrix_Vector_Activa::thread_tmp2142_fu_55157_p2() { tmp2142_fu_55157_p2 = (!tmp3198_cast_fu_55143_p1.read().is_01() || !tmp3199_cast_fu_55153_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3198_cast_fu_55143_p1.read()) + sc_biguint<3>(tmp3199_cast_fu_55153_p1.read())); } void Matrix_Vector_Activa::thread_tmp2143_fu_55167_p2() { tmp2143_fu_55167_p2 = (!tmp_23_16_3_i_cast_fu_54713_p1.read().is_01() || !tmp_23_16_4_i_cast_fu_54716_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_3_i_cast_fu_54713_p1.read()) + sc_biguint<2>(tmp_23_16_4_i_cast_fu_54716_p1.read())); } void Matrix_Vector_Activa::thread_tmp2144_fu_55177_p2() { tmp2144_fu_55177_p2 = (!tmp_23_16_5_i_cast_fu_54719_p1.read().is_01() || !tmp_23_16_6_i_cast_fu_54722_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_5_i_cast_fu_54719_p1.read()) + sc_biguint<2>(tmp_23_16_6_i_cast_fu_54722_p1.read())); } void Matrix_Vector_Activa::thread_tmp2145_fu_55187_p2() { tmp2145_fu_55187_p2 = (!tmp3201_cast_fu_55173_p1.read().is_01() || !tmp3202_cast_fu_55183_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3201_cast_fu_55173_p1.read()) + sc_biguint<3>(tmp3202_cast_fu_55183_p1.read())); } void Matrix_Vector_Activa::thread_tmp2146_fu_55197_p2() { tmp2146_fu_55197_p2 = (!tmp3197_cast_fu_55163_p1.read().is_01() || !tmp3200_cast_fu_55193_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3197_cast_fu_55163_p1.read()) + sc_biguint<4>(tmp3200_cast_fu_55193_p1.read())); } void Matrix_Vector_Activa::thread_tmp2147_fu_55207_p2() { tmp2147_fu_55207_p2 = (!tmp_23_16_7_i_cast_fu_54725_p1.read().is_01() || !tmp_23_16_8_i_cast_fu_54728_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_7_i_cast_fu_54725_p1.read()) + sc_biguint<2>(tmp_23_16_8_i_cast_fu_54728_p1.read())); } void Matrix_Vector_Activa::thread_tmp2148_fu_55217_p2() { tmp2148_fu_55217_p2 = (!tmp_23_16_9_i_cast_fu_54731_p1.read().is_01() || !tmp_23_16_i_cast_5950_fu_54734_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_9_i_cast_fu_54731_p1.read()) + sc_biguint<2>(tmp_23_16_i_cast_5950_fu_54734_p1.read())); } void Matrix_Vector_Activa::thread_tmp2149_fu_55227_p2() { tmp2149_fu_55227_p2 = (!tmp3205_cast_fu_55213_p1.read().is_01() || !tmp3206_cast_fu_55223_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3205_cast_fu_55213_p1.read()) + sc_biguint<3>(tmp3206_cast_fu_55223_p1.read())); } void Matrix_Vector_Activa::thread_tmp214_fu_43990_p2() { tmp214_fu_43990_p2 = (!tmp_23_1_51_i_cast_fu_43895_p1.read().is_01() || !tmp_23_1_48_i_cast_fu_43886_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_51_i_cast_fu_43895_p1.read()) + sc_biguint<2>(tmp_23_1_48_i_cast_fu_43886_p1.read())); } void Matrix_Vector_Activa::thread_tmp2150_fu_55237_p2() { tmp2150_fu_55237_p2 = (!tmp_23_16_10_i_cast_fu_54737_p1.read().is_01() || !tmp_23_16_11_i_cast_fu_54740_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_10_i_cast_fu_54737_p1.read()) + sc_biguint<2>(tmp_23_16_11_i_cast_fu_54740_p1.read())); } void Matrix_Vector_Activa::thread_tmp2151_fu_55247_p2() { tmp2151_fu_55247_p2 = (!tmp_23_16_12_i_cast_fu_54743_p1.read().is_01() || !tmp_23_16_13_i_cast_fu_54746_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_12_i_cast_fu_54743_p1.read()) + sc_biguint<2>(tmp_23_16_13_i_cast_fu_54746_p1.read())); } void Matrix_Vector_Activa::thread_tmp2152_fu_55257_p2() { tmp2152_fu_55257_p2 = (!tmp3208_cast_fu_55243_p1.read().is_01() || !tmp3209_cast_fu_55253_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3208_cast_fu_55243_p1.read()) + sc_biguint<3>(tmp3209_cast_fu_55253_p1.read())); } void Matrix_Vector_Activa::thread_tmp2153_fu_55267_p2() { tmp2153_fu_55267_p2 = (!tmp3204_cast_fu_55233_p1.read().is_01() || !tmp3207_cast_fu_55263_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3204_cast_fu_55233_p1.read()) + sc_biguint<4>(tmp3207_cast_fu_55263_p1.read())); } void Matrix_Vector_Activa::thread_tmp2154_fu_55277_p2() { tmp2154_fu_55277_p2 = (!tmp3196_cast_fu_55203_p1.read().is_01() || !tmp3203_cast_fu_55273_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp3196_cast_fu_55203_p1.read()) + sc_biguint<5>(tmp3203_cast_fu_55273_p1.read())); } void Matrix_Vector_Activa::thread_tmp2155_fu_55283_p2() { tmp2155_fu_55283_p2 = (!tmp_23_16_14_i_cast_fu_54749_p1.read().is_01() || !tmp_23_16_15_i_cast_fu_54752_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_14_i_cast_fu_54749_p1.read()) + sc_biguint<2>(tmp_23_16_15_i_cast_fu_54752_p1.read())); } void Matrix_Vector_Activa::thread_tmp2156_fu_55293_p2() { tmp2156_fu_55293_p2 = (!tmp_23_16_16_i_cast_fu_54755_p1.read().is_01() || !tmp_23_16_17_i_cast_fu_54758_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_16_i_cast_fu_54755_p1.read()) + sc_biguint<2>(tmp_23_16_17_i_cast_fu_54758_p1.read())); } void Matrix_Vector_Activa::thread_tmp2157_fu_55303_p2() { tmp2157_fu_55303_p2 = (!tmp3213_cast_fu_55289_p1.read().is_01() || !tmp3214_cast_fu_55299_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3213_cast_fu_55289_p1.read()) + sc_biguint<3>(tmp3214_cast_fu_55299_p1.read())); } void Matrix_Vector_Activa::thread_tmp2158_fu_55313_p2() { tmp2158_fu_55313_p2 = (!tmp_23_16_18_i_cast_fu_54761_p1.read().is_01() || !tmp_23_16_19_i_cast_fu_54764_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_18_i_cast_fu_54761_p1.read()) + sc_biguint<2>(tmp_23_16_19_i_cast_fu_54764_p1.read())); } void Matrix_Vector_Activa::thread_tmp2159_fu_55323_p2() { tmp2159_fu_55323_p2 = (!tmp_23_16_20_i_cast_fu_54767_p1.read().is_01() || !tmp_23_16_21_i_cast_fu_54770_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_20_i_cast_fu_54767_p1.read()) + sc_biguint<2>(tmp_23_16_21_i_cast_fu_54770_p1.read())); } void Matrix_Vector_Activa::thread_tmp215_fu_44000_p2() { tmp215_fu_44000_p2 = (!tmp_23_1_53_i_cast_fu_43901_p1.read().is_01() || !tmp_23_1_50_i_cast_fu_43892_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_53_i_cast_fu_43901_p1.read()) + sc_biguint<2>(tmp_23_1_50_i_cast_fu_43892_p1.read())); } void Matrix_Vector_Activa::thread_tmp2160_fu_55333_p2() { tmp2160_fu_55333_p2 = (!tmp3216_cast_fu_55319_p1.read().is_01() || !tmp3217_cast_fu_55329_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3216_cast_fu_55319_p1.read()) + sc_biguint<3>(tmp3217_cast_fu_55329_p1.read())); } void Matrix_Vector_Activa::thread_tmp2161_fu_55343_p2() { tmp2161_fu_55343_p2 = (!tmp3212_cast_fu_55309_p1.read().is_01() || !tmp3215_cast_fu_55339_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3212_cast_fu_55309_p1.read()) + sc_biguint<4>(tmp3215_cast_fu_55339_p1.read())); } void Matrix_Vector_Activa::thread_tmp2162_fu_55353_p2() { tmp2162_fu_55353_p2 = (!tmp_23_16_22_i_cast_fu_54773_p1.read().is_01() || !tmp_23_16_23_i_cast_fu_54776_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_22_i_cast_fu_54773_p1.read()) + sc_biguint<2>(tmp_23_16_23_i_cast_fu_54776_p1.read())); } void Matrix_Vector_Activa::thread_tmp2163_fu_55363_p2() { tmp2163_fu_55363_p2 = (!tmp_23_16_24_i_cast_fu_54779_p1.read().is_01() || !tmp_23_16_25_i_cast_fu_54782_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_24_i_cast_fu_54779_p1.read()) + sc_biguint<2>(tmp_23_16_25_i_cast_fu_54782_p1.read())); } void Matrix_Vector_Activa::thread_tmp2164_fu_55373_p2() { tmp2164_fu_55373_p2 = (!tmp3220_cast_fu_55359_p1.read().is_01() || !tmp3221_cast_fu_55369_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3220_cast_fu_55359_p1.read()) + sc_biguint<3>(tmp3221_cast_fu_55369_p1.read())); } void Matrix_Vector_Activa::thread_tmp2165_fu_55383_p2() { tmp2165_fu_55383_p2 = (!tmp_23_16_26_i_cast_fu_54785_p1.read().is_01() || !tmp_23_16_27_i_cast_fu_54788_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_26_i_cast_fu_54785_p1.read()) + sc_biguint<2>(tmp_23_16_27_i_cast_fu_54788_p1.read())); } void Matrix_Vector_Activa::thread_tmp2166_fu_55393_p2() { tmp2166_fu_55393_p2 = (!tmp_23_16_62_i_cast_fu_54890_p1.read().is_01() || !tmp_23_16_28_i_cast_fu_54791_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_62_i_cast_fu_54890_p1.read()) + sc_biguint<2>(tmp_23_16_28_i_cast_fu_54791_p1.read())); } void Matrix_Vector_Activa::thread_tmp2167_fu_55399_p2() { tmp2167_fu_55399_p2 = (!tmp_23_16_29_i_cast_fu_54794_p1.read().is_01() || !tmp2166_fu_55393_p2.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_16_29_i_cast_fu_54794_p1.read()) + sc_biguint<2>(tmp2166_fu_55393_p2.read())); } void Matrix_Vector_Activa::thread_tmp2168_fu_55409_p2() { tmp2168_fu_55409_p2 = (!tmp3223_cast_fu_55389_p1.read().is_01() || !tmp3224_cast_fu_55405_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3223_cast_fu_55389_p1.read()) + sc_biguint<3>(tmp3224_cast_fu_55405_p1.read())); } void Matrix_Vector_Activa::thread_tmp2169_fu_55419_p2() { tmp2169_fu_55419_p2 = (!tmp3219_cast_fu_55379_p1.read().is_01() || !tmp3222_cast_fu_55415_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3219_cast_fu_55379_p1.read()) + sc_biguint<4>(tmp3222_cast_fu_55415_p1.read())); } void Matrix_Vector_Activa::thread_tmp216_fu_44010_p2() { tmp216_fu_44010_p2 = (!tmp342_cast_fu_43996_p1.read().is_01() || !tmp343_cast_fu_44006_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp342_cast_fu_43996_p1.read()) + sc_biguint<3>(tmp343_cast_fu_44006_p1.read())); } void Matrix_Vector_Activa::thread_tmp2170_fu_55429_p2() { tmp2170_fu_55429_p2 = (!tmp3211_cast_fu_55349_p1.read().is_01() || !tmp3218_cast_fu_55425_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp3211_cast_fu_55349_p1.read()) + sc_biguint<5>(tmp3218_cast_fu_55425_p1.read())); } void Matrix_Vector_Activa::thread_tmp2171_fu_67878_p2() { tmp2171_fu_67878_p2 = (!tmp3195_cast_fu_67872_p1.read().is_01() || !tmp3210_cast_fu_67875_p1.read().is_01())? sc_lv<6>(): (sc_biguint<6>(tmp3195_cast_fu_67872_p1.read()) + sc_biguint<6>(tmp3210_cast_fu_67875_p1.read())); } void Matrix_Vector_Activa::thread_tmp2172_fu_23872_p2() { tmp2172_fu_23872_p2 = (tmp_6291_fu_1672_p1.read() ^ tmp_7442_fu_23868_p1.read()); } void Matrix_Vector_Activa::thread_tmp2173_fu_23892_p2() { tmp2173_fu_23892_p2 = (tmp_6293_fu_1696_p3.read() ^ tmp_7443_fu_23884_p3.read()); } void Matrix_Vector_Activa::thread_tmp2174_fu_23912_p2() { tmp2174_fu_23912_p2 = (tmp_6295_fu_1724_p3.read() ^ tmp_7444_fu_23904_p3.read()); } void Matrix_Vector_Activa::thread_tmp2175_fu_23932_p2() { tmp2175_fu_23932_p2 = (tmp_6297_fu_1752_p3.read() ^ tmp_7445_fu_23924_p3.read()); } void Matrix_Vector_Activa::thread_tmp2176_fu_23952_p2() { tmp2176_fu_23952_p2 = (tmp_6299_fu_1780_p3.read() ^ tmp_7446_fu_23944_p3.read()); } void Matrix_Vector_Activa::thread_tmp2177_fu_23972_p2() { tmp2177_fu_23972_p2 = (tmp_6301_fu_1808_p3.read() ^ tmp_7447_fu_23964_p3.read()); } void Matrix_Vector_Activa::thread_tmp2178_fu_23992_p2() { tmp2178_fu_23992_p2 = (tmp_6303_fu_1836_p3.read() ^ tmp_7448_fu_23984_p3.read()); } void Matrix_Vector_Activa::thread_tmp2179_fu_24012_p2() { tmp2179_fu_24012_p2 = (tmp_6305_fu_1864_p3.read() ^ tmp_7449_fu_24004_p3.read()); } void Matrix_Vector_Activa::thread_tmp217_fu_44020_p2() { tmp217_fu_44020_p2 = (!tmp338_cast_fu_43986_p1.read().is_01() || !tmp341_cast_fu_44016_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp338_cast_fu_43986_p1.read()) + sc_biguint<4>(tmp341_cast_fu_44016_p1.read())); } void Matrix_Vector_Activa::thread_tmp2180_fu_24032_p2() { tmp2180_fu_24032_p2 = (tmp_6307_fu_1892_p3.read() ^ tmp_7450_fu_24024_p3.read()); } void Matrix_Vector_Activa::thread_tmp2181_fu_24052_p2() { tmp2181_fu_24052_p2 = (tmp_6309_fu_1920_p3.read() ^ tmp_7451_fu_24044_p3.read()); } void Matrix_Vector_Activa::thread_tmp2182_fu_24072_p2() { tmp2182_fu_24072_p2 = (tmp_6311_fu_1948_p3.read() ^ tmp_7452_fu_24064_p3.read()); } void Matrix_Vector_Activa::thread_tmp2183_fu_24092_p2() { tmp2183_fu_24092_p2 = (tmp_6313_fu_1976_p3.read() ^ tmp_7453_fu_24084_p3.read()); } void Matrix_Vector_Activa::thread_tmp2184_fu_24112_p2() { tmp2184_fu_24112_p2 = (tmp_6315_fu_2004_p3.read() ^ tmp_7454_fu_24104_p3.read()); } void Matrix_Vector_Activa::thread_tmp2185_fu_24132_p2() { tmp2185_fu_24132_p2 = (tmp_6317_fu_2032_p3.read() ^ tmp_7455_fu_24124_p3.read()); } void Matrix_Vector_Activa::thread_tmp2186_fu_24152_p2() { tmp2186_fu_24152_p2 = (tmp_6319_fu_2060_p3.read() ^ tmp_7456_fu_24144_p3.read()); } void Matrix_Vector_Activa::thread_tmp2187_fu_24172_p2() { tmp2187_fu_24172_p2 = (tmp_6321_fu_2088_p3.read() ^ tmp_7457_fu_24164_p3.read()); } void Matrix_Vector_Activa::thread_tmp2188_fu_24192_p2() { tmp2188_fu_24192_p2 = (tmp_6323_fu_2116_p3.read() ^ tmp_7458_fu_24184_p3.read()); } void Matrix_Vector_Activa::thread_tmp2189_fu_24212_p2() { tmp2189_fu_24212_p2 = (tmp_6325_fu_2144_p3.read() ^ tmp_7459_fu_24204_p3.read()); } void Matrix_Vector_Activa::thread_tmp218_fu_66852_p2() { tmp218_fu_66852_p2 = (!tmp210_fu_66843_p2.read().is_01() || !tmp337_cast_fu_66849_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp210_fu_66843_p2.read()) + sc_biguint<16>(tmp337_cast_fu_66849_p1.read())); } void Matrix_Vector_Activa::thread_tmp2190_fu_24232_p2() { tmp2190_fu_24232_p2 = (tmp_6327_fu_2172_p3.read() ^ tmp_7460_fu_24224_p3.read()); } void Matrix_Vector_Activa::thread_tmp2191_fu_24252_p2() { tmp2191_fu_24252_p2 = (tmp_6329_fu_2200_p3.read() ^ tmp_7461_fu_24244_p3.read()); } void Matrix_Vector_Activa::thread_tmp2192_fu_24272_p2() { tmp2192_fu_24272_p2 = (tmp_6331_fu_2228_p3.read() ^ tmp_7462_fu_24264_p3.read()); } void Matrix_Vector_Activa::thread_tmp2193_fu_24292_p2() { tmp2193_fu_24292_p2 = (tmp_6333_fu_2256_p3.read() ^ tmp_7463_fu_24284_p3.read()); } void Matrix_Vector_Activa::thread_tmp2194_fu_24312_p2() { tmp2194_fu_24312_p2 = (tmp_6335_fu_2284_p3.read() ^ tmp_7464_fu_24304_p3.read()); } void Matrix_Vector_Activa::thread_tmp2195_fu_24332_p2() { tmp2195_fu_24332_p2 = (tmp_6337_fu_2312_p3.read() ^ tmp_7465_fu_24324_p3.read()); } void Matrix_Vector_Activa::thread_tmp2196_fu_24352_p2() { tmp2196_fu_24352_p2 = (tmp_6339_fu_2340_p3.read() ^ tmp_7466_fu_24344_p3.read()); } void Matrix_Vector_Activa::thread_tmp2197_fu_24372_p2() { tmp2197_fu_24372_p2 = (tmp_6341_fu_2368_p3.read() ^ tmp_7467_fu_24364_p3.read()); } void Matrix_Vector_Activa::thread_tmp2198_fu_24392_p2() { tmp2198_fu_24392_p2 = (tmp_6343_fu_2396_p3.read() ^ tmp_7468_fu_24384_p3.read()); } void Matrix_Vector_Activa::thread_tmp2199_fu_24412_p2() { tmp2199_fu_24412_p2 = (tmp_6345_fu_2424_p3.read() ^ tmp_7469_fu_24404_p3.read()); } void Matrix_Vector_Activa::thread_tmp219_fu_44026_p2() { tmp219_fu_44026_p2 = (!tmp_23_1_31_i_cast_fu_43835_p1.read().is_01() || !tmp_23_1_52_i_cast_fu_43898_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_31_i_cast_fu_43835_p1.read()) + sc_biguint<2>(tmp_23_1_52_i_cast_fu_43898_p1.read())); } void Matrix_Vector_Activa::thread_tmp21_fu_1900_p2() { tmp21_fu_1900_p2 = (tmp_6307_fu_1892_p3.read() ^ tmp_6306_fu_1884_p3.read()); } void Matrix_Vector_Activa::thread_tmp2200_fu_24432_p2() { tmp2200_fu_24432_p2 = (tmp_6347_fu_2452_p3.read() ^ tmp_7470_fu_24424_p3.read()); } void Matrix_Vector_Activa::thread_tmp2201_fu_24452_p2() { tmp2201_fu_24452_p2 = (tmp_6349_fu_2480_p3.read() ^ tmp_7471_fu_24444_p3.read()); } void Matrix_Vector_Activa::thread_tmp2202_fu_24472_p2() { tmp2202_fu_24472_p2 = (tmp_6351_fu_2508_p3.read() ^ tmp_7472_fu_24464_p3.read()); } void Matrix_Vector_Activa::thread_tmp2203_fu_24492_p2() { tmp2203_fu_24492_p2 = (tmp_6353_fu_2536_p3.read() ^ tmp_7473_fu_24484_p3.read()); } void Matrix_Vector_Activa::thread_tmp2204_fu_24512_p2() { tmp2204_fu_24512_p2 = (tmp_6355_fu_2564_p3.read() ^ tmp_7474_fu_24504_p3.read()); } void Matrix_Vector_Activa::thread_tmp2205_fu_24532_p2() { tmp2205_fu_24532_p2 = (tmp_6357_fu_2592_p3.read() ^ tmp_7475_fu_24524_p3.read()); } void Matrix_Vector_Activa::thread_tmp2206_fu_24552_p2() { tmp2206_fu_24552_p2 = (tmp_6359_fu_2620_p3.read() ^ tmp_7476_fu_24544_p3.read()); } void Matrix_Vector_Activa::thread_tmp2207_fu_24572_p2() { tmp2207_fu_24572_p2 = (tmp_6361_fu_2648_p3.read() ^ tmp_7477_fu_24564_p3.read()); } void Matrix_Vector_Activa::thread_tmp2208_fu_24592_p2() { tmp2208_fu_24592_p2 = (tmp_6363_fu_2676_p3.read() ^ tmp_7478_fu_24584_p3.read()); } void Matrix_Vector_Activa::thread_tmp2209_fu_24612_p2() { tmp2209_fu_24612_p2 = (tmp_6365_fu_2704_p3.read() ^ tmp_7479_fu_24604_p3.read()); } void Matrix_Vector_Activa::thread_tmp220_fu_44036_p2() { tmp220_fu_44036_p2 = (!tmp_23_1_33_i_cast_fu_43841_p1.read().is_01() || !tmp_23_1_30_i_cast_fu_43832_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_33_i_cast_fu_43841_p1.read()) + sc_biguint<2>(tmp_23_1_30_i_cast_fu_43832_p1.read())); } void Matrix_Vector_Activa::thread_tmp2210_fu_24632_p2() { tmp2210_fu_24632_p2 = (tmp_6367_fu_2732_p3.read() ^ tmp_7480_fu_24624_p3.read()); } void Matrix_Vector_Activa::thread_tmp2211_fu_24652_p2() { tmp2211_fu_24652_p2 = (tmp_6369_fu_2760_p3.read() ^ tmp_7481_fu_24644_p3.read()); } void Matrix_Vector_Activa::thread_tmp2212_fu_24672_p2() { tmp2212_fu_24672_p2 = (tmp_6371_fu_2788_p3.read() ^ tmp_7482_fu_24664_p3.read()); } void Matrix_Vector_Activa::thread_tmp2213_fu_24692_p2() { tmp2213_fu_24692_p2 = (tmp_6373_fu_2816_p3.read() ^ tmp_7483_fu_24684_p3.read()); } void Matrix_Vector_Activa::thread_tmp2214_fu_24712_p2() { tmp2214_fu_24712_p2 = (tmp_6375_fu_2844_p3.read() ^ tmp_7484_fu_24704_p3.read()); } void Matrix_Vector_Activa::thread_tmp2215_fu_24732_p2() { tmp2215_fu_24732_p2 = (tmp_6377_fu_2872_p3.read() ^ tmp_7485_fu_24724_p3.read()); } void Matrix_Vector_Activa::thread_tmp2216_fu_24752_p2() { tmp2216_fu_24752_p2 = (tmp_6379_fu_2900_p3.read() ^ tmp_7486_fu_24744_p3.read()); } void Matrix_Vector_Activa::thread_tmp2217_fu_24772_p2() { tmp2217_fu_24772_p2 = (tmp_6381_fu_2928_p3.read() ^ tmp_7487_fu_24764_p3.read()); } void Matrix_Vector_Activa::thread_tmp2218_fu_24792_p2() { tmp2218_fu_24792_p2 = (tmp_6383_fu_2956_p3.read() ^ tmp_7488_fu_24784_p3.read()); } void Matrix_Vector_Activa::thread_tmp2219_fu_24812_p2() { tmp2219_fu_24812_p2 = (tmp_6385_fu_2984_p3.read() ^ tmp_7489_fu_24804_p3.read()); } void Matrix_Vector_Activa::thread_tmp221_fu_44046_p2() { tmp221_fu_44046_p2 = (!tmp347_cast_fu_44032_p1.read().is_01() || !tmp348_cast_fu_44042_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp347_cast_fu_44032_p1.read()) + sc_biguint<3>(tmp348_cast_fu_44042_p1.read())); } void Matrix_Vector_Activa::thread_tmp2220_fu_24832_p2() { tmp2220_fu_24832_p2 = (tmp_6387_fu_3012_p3.read() ^ tmp_7490_fu_24824_p3.read()); } void Matrix_Vector_Activa::thread_tmp2221_fu_24852_p2() { tmp2221_fu_24852_p2 = (tmp_6389_fu_3040_p3.read() ^ tmp_7491_fu_24844_p3.read()); } void Matrix_Vector_Activa::thread_tmp2222_fu_24872_p2() { tmp2222_fu_24872_p2 = (tmp_6391_fu_3068_p3.read() ^ tmp_7492_fu_24864_p3.read()); } void Matrix_Vector_Activa::thread_tmp2223_cast_fu_67501_p1() { tmp2223_cast_fu_67501_p1 = esl_zext<16,2>(tmp1475_reg_80384.read()); } void Matrix_Vector_Activa::thread_tmp2223_fu_24892_p2() { tmp2223_fu_24892_p2 = (tmp_6393_fu_3096_p3.read() ^ tmp_7493_fu_24884_p3.read()); } void Matrix_Vector_Activa::thread_tmp2224_cast_fu_67510_p1() { tmp2224_cast_fu_67510_p1 = esl_zext<16,3>(tmp1479_reg_80389.read()); } void Matrix_Vector_Activa::thread_tmp2224_fu_24912_p2() { tmp2224_fu_24912_p2 = (tmp_6395_fu_3124_p3.read() ^ tmp_7494_fu_24904_p3.read()); } void Matrix_Vector_Activa::thread_tmp2225_cast_fu_51250_p1() { tmp2225_cast_fu_51250_p1 = esl_zext<3,2>(tmp1477_fu_51244_p2.read()); } void Matrix_Vector_Activa::thread_tmp2225_fu_24932_p2() { tmp2225_fu_24932_p2 = (tmp_6397_fu_3152_p3.read() ^ tmp_7495_fu_24924_p3.read()); } void Matrix_Vector_Activa::thread_tmp2226_cast_fu_51260_p1() { tmp2226_cast_fu_51260_p1 = esl_zext<3,2>(tmp1478_fu_51254_p2.read()); } void Matrix_Vector_Activa::thread_tmp2226_fu_24952_p2() { tmp2226_fu_24952_p2 = (tmp_6399_fu_3180_p3.read() ^ tmp_7496_fu_24944_p3.read()); } void Matrix_Vector_Activa::thread_tmp2227_cast_fu_67519_p1() { tmp2227_cast_fu_67519_p1 = esl_zext<16,4>(tmp1487_reg_80394.read()); } void Matrix_Vector_Activa::thread_tmp2227_fu_24972_p2() { tmp2227_fu_24972_p2 = (tmp_6401_fu_3208_p3.read() ^ tmp_7497_fu_24964_p3.read()); } void Matrix_Vector_Activa::thread_tmp2228_cast_fu_51296_p1() { tmp2228_cast_fu_51296_p1 = esl_zext<4,3>(tmp1483_fu_51290_p2.read()); } void Matrix_Vector_Activa::thread_tmp2228_fu_24992_p2() { tmp2228_fu_24992_p2 = (tmp_6403_fu_3236_p3.read() ^ tmp_7498_fu_24984_p3.read()); } void Matrix_Vector_Activa::thread_tmp2229_cast_fu_51276_p1() { tmp2229_cast_fu_51276_p1 = esl_zext<3,2>(tmp1481_fu_51270_p2.read()); } void Matrix_Vector_Activa::thread_tmp2229_fu_25012_p2() { tmp2229_fu_25012_p2 = (tmp_6405_fu_3264_p3.read() ^ tmp_7499_fu_25004_p3.read()); } void Matrix_Vector_Activa::thread_tmp222_fu_44056_p2() { tmp222_fu_44056_p2 = (!tmp_23_1_35_i_cast_fu_43847_p1.read().is_01() || !tmp_23_1_32_i_cast_fu_43838_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_35_i_cast_fu_43847_p1.read()) + sc_biguint<2>(tmp_23_1_32_i_cast_fu_43838_p1.read())); } void Matrix_Vector_Activa::thread_tmp2230_cast_fu_51286_p1() { tmp2230_cast_fu_51286_p1 = esl_zext<3,2>(tmp1482_fu_51280_p2.read()); } void Matrix_Vector_Activa::thread_tmp2230_fu_25032_p2() { tmp2230_fu_25032_p2 = (tmp_6407_fu_3292_p3.read() ^ tmp_7500_fu_25024_p3.read()); } void Matrix_Vector_Activa::thread_tmp2231_cast_fu_51326_p1() { tmp2231_cast_fu_51326_p1 = esl_zext<4,3>(tmp1486_fu_51320_p2.read()); } void Matrix_Vector_Activa::thread_tmp2231_fu_25052_p2() { tmp2231_fu_25052_p2 = (tmp_6409_fu_3320_p3.read() ^ tmp_7501_fu_25044_p3.read()); } void Matrix_Vector_Activa::thread_tmp2232_cast_fu_51306_p1() { tmp2232_cast_fu_51306_p1 = esl_zext<3,2>(tmp1484_fu_51300_p2.read()); } void Matrix_Vector_Activa::thread_tmp2232_fu_25072_p2() { tmp2232_fu_25072_p2 = (tmp_6411_fu_3348_p3.read() ^ tmp_7502_fu_25064_p3.read()); } void Matrix_Vector_Activa::thread_tmp2233_cast_fu_51316_p1() { tmp2233_cast_fu_51316_p1 = esl_zext<3,2>(tmp1485_fu_51310_p2.read()); } void Matrix_Vector_Activa::thread_tmp2233_fu_25092_p2() { tmp2233_fu_25092_p2 = (tmp_6413_fu_3376_p3.read() ^ tmp_7503_fu_25084_p3.read()); } void Matrix_Vector_Activa::thread_tmp2234_cast_fu_67528_p1() { tmp2234_cast_fu_67528_p1 = esl_zext<16,5>(tmp1503_reg_80399.read()); } void Matrix_Vector_Activa::thread_tmp2234_fu_25112_p2() { tmp2234_fu_25112_p2 = (tmp_6415_fu_3404_p3.read() ^ tmp_7504_fu_25104_p3.read()); } void Matrix_Vector_Activa::thread_tmp2235_cast_fu_51402_p1() { tmp2235_cast_fu_51402_p1 = esl_zext<5,4>(tmp1495_fu_51396_p2.read()); } void Matrix_Vector_Activa::thread_tmp2235_fu_25132_p2() { tmp2235_fu_25132_p2 = (tmp_6417_fu_3432_p3.read() ^ tmp_7505_fu_25124_p3.read()); } void Matrix_Vector_Activa::thread_tmp2236_cast_fu_51362_p1() { tmp2236_cast_fu_51362_p1 = esl_zext<4,3>(tmp1491_fu_51356_p2.read()); } void Matrix_Vector_Activa::thread_tmp2236_fu_67897_p2() { tmp2236_fu_67897_p2 = (!tmp_23_17_60_i_fu_67894_p1.read().is_01() || !p_accu_V_0_17_i_fu_66629_p3.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp_23_17_60_i_fu_67894_p1.read()) + sc_biguint<16>(p_accu_V_0_17_i_fu_66629_p3.read())); } void Matrix_Vector_Activa::thread_tmp2237_cast_fu_51342_p1() { tmp2237_cast_fu_51342_p1 = esl_zext<3,2>(tmp1489_fu_51336_p2.read()); } void Matrix_Vector_Activa::thread_tmp2237_fu_55624_p2() { tmp2237_fu_55624_p2 = (!tmp_23_17_59_i_cast_fu_55615_p1.read().is_01() || !tmp_23_17_61_i_cast_fu_55618_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_59_i_cast_fu_55615_p1.read()) + sc_biguint<2>(tmp_23_17_61_i_cast_fu_55618_p1.read())); } void Matrix_Vector_Activa::thread_tmp2238_cast_fu_51352_p1() { tmp2238_cast_fu_51352_p1 = esl_zext<3,2>(tmp1490_fu_51346_p2.read()); } void Matrix_Vector_Activa::thread_tmp2238_fu_67906_p2() { tmp2238_fu_67906_p2 = (!tmp2236_fu_67897_p2.read().is_01() || !tmp3357_cast_fu_67903_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2236_fu_67897_p2.read()) + sc_biguint<16>(tmp3357_cast_fu_67903_p1.read())); } void Matrix_Vector_Activa::thread_tmp2239_cast_fu_51392_p1() { tmp2239_cast_fu_51392_p1 = esl_zext<4,3>(tmp1494_fu_51386_p2.read()); } void Matrix_Vector_Activa::thread_tmp2239_fu_55630_p2() { tmp2239_fu_55630_p2 = (!tmp_23_17_55_i_cast_fu_55603_p1.read().is_01() || !tmp_23_17_58_i_cast_fu_55612_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_55_i_cast_fu_55603_p1.read()) + sc_biguint<2>(tmp_23_17_58_i_cast_fu_55612_p1.read())); } void Matrix_Vector_Activa::thread_tmp223_fu_44066_p2() { tmp223_fu_44066_p2 = (!tmp_23_1_37_i_cast_fu_43853_p1.read().is_01() || !tmp_23_1_34_i_cast_fu_43844_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_1_37_i_cast_fu_43853_p1.read()) + sc_biguint<2>(tmp_23_1_34_i_cast_fu_43844_p1.read())); } void Matrix_Vector_Activa::thread_tmp2240_cast_fu_51372_p1() { tmp2240_cast_fu_51372_p1 = esl_zext<3,2>(tmp1492_fu_51366_p2.read()); } void Matrix_Vector_Activa::thread_tmp2240_fu_55640_p2() { tmp2240_fu_55640_p2 = (!tmp_23_17_57_i_cast_fu_55609_p1.read().is_01() || !tmp_23_17_54_i_cast_fu_55600_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_57_i_cast_fu_55609_p1.read()) + sc_biguint<2>(tmp_23_17_54_i_cast_fu_55600_p1.read())); } void Matrix_Vector_Activa::thread_tmp2241_cast_fu_51382_p1() { tmp2241_cast_fu_51382_p1 = esl_zext<3,2>(tmp1493_fu_51376_p2.read()); } void Matrix_Vector_Activa::thread_tmp2241_fu_55650_p2() { tmp2241_fu_55650_p2 = (!tmp3359_cast_fu_55636_p1.read().is_01() || !tmp3360_cast_fu_55646_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3359_cast_fu_55636_p1.read()) + sc_biguint<3>(tmp3360_cast_fu_55646_p1.read())); } void Matrix_Vector_Activa::thread_tmp2242_cast_fu_51472_p1() { tmp2242_cast_fu_51472_p1 = esl_zext<5,4>(tmp1502_fu_51466_p2.read()); } void Matrix_Vector_Activa::thread_tmp2242_fu_67915_p2() { tmp2242_fu_67915_p2 = (!tmp2238_fu_67906_p2.read().is_01() || !tmp3358_cast_fu_67912_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2238_fu_67906_p2.read()) + sc_biguint<16>(tmp3358_cast_fu_67912_p1.read())); } void Matrix_Vector_Activa::thread_tmp2243_cast_fu_51432_p1() { tmp2243_cast_fu_51432_p1 = esl_zext<4,3>(tmp1498_fu_51426_p2.read()); } void Matrix_Vector_Activa::thread_tmp2243_fu_55656_p2() { tmp2243_fu_55656_p2 = (!tmp_23_17_47_i_cast_fu_55579_p1.read().is_01() || !tmp_23_17_56_i_cast_fu_55606_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_47_i_cast_fu_55579_p1.read()) + sc_biguint<2>(tmp_23_17_56_i_cast_fu_55606_p1.read())); } void Matrix_Vector_Activa::thread_tmp2244_cast_fu_51412_p1() { tmp2244_cast_fu_51412_p1 = esl_zext<3,2>(tmp1496_fu_51406_p2.read()); } void Matrix_Vector_Activa::thread_tmp2244_fu_55666_p2() { tmp2244_fu_55666_p2 = (!tmp_23_17_49_i_cast_fu_55585_p1.read().is_01() || !tmp_23_17_46_i_cast_fu_55576_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_49_i_cast_fu_55585_p1.read()) + sc_biguint<2>(tmp_23_17_46_i_cast_fu_55576_p1.read())); } void Matrix_Vector_Activa::thread_tmp2245_cast_fu_51422_p1() { tmp2245_cast_fu_51422_p1 = esl_zext<3,2>(tmp1497_fu_51416_p2.read()); } void Matrix_Vector_Activa::thread_tmp2245_fu_55676_p2() { tmp2245_fu_55676_p2 = (!tmp3363_cast_fu_55662_p1.read().is_01() || !tmp3364_cast_fu_55672_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3363_cast_fu_55662_p1.read()) + sc_biguint<3>(tmp3364_cast_fu_55672_p1.read())); } void Matrix_Vector_Activa::thread_tmp2246_cast_fu_51462_p1() { tmp2246_cast_fu_51462_p1 = esl_zext<4,3>(tmp1501_fu_51456_p2.read()); } void Matrix_Vector_Activa::thread_tmp2246_fu_55686_p2() { tmp2246_fu_55686_p2 = (!tmp_23_17_51_i_cast_fu_55591_p1.read().is_01() || !tmp_23_17_48_i_cast_fu_55582_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_51_i_cast_fu_55591_p1.read()) + sc_biguint<2>(tmp_23_17_48_i_cast_fu_55582_p1.read())); } void Matrix_Vector_Activa::thread_tmp2247_cast_fu_51442_p1() { tmp2247_cast_fu_51442_p1 = esl_zext<3,2>(tmp1499_fu_51436_p2.read()); } void Matrix_Vector_Activa::thread_tmp2247_fu_55696_p2() { tmp2247_fu_55696_p2 = (!tmp_23_17_53_i_cast_fu_55597_p1.read().is_01() || !tmp_23_17_50_i_cast_fu_55588_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_53_i_cast_fu_55597_p1.read()) + sc_biguint<2>(tmp_23_17_50_i_cast_fu_55588_p1.read())); } void Matrix_Vector_Activa::thread_tmp2248_cast_fu_51452_p1() { tmp2248_cast_fu_51452_p1 = esl_zext<3,2>(tmp1500_fu_51446_p2.read()); } void Matrix_Vector_Activa::thread_tmp2248_fu_55706_p2() { tmp2248_fu_55706_p2 = (!tmp3366_cast_fu_55692_p1.read().is_01() || !tmp3367_cast_fu_55702_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3366_cast_fu_55692_p1.read()) + sc_biguint<3>(tmp3367_cast_fu_55702_p1.read())); } void Matrix_Vector_Activa::thread_tmp2249_cast_fu_67549_p1() { tmp2249_cast_fu_67549_p1 = esl_zext<16,6>(tmp1536_fu_67543_p2.read()); } void Matrix_Vector_Activa::thread_tmp2249_fu_55716_p2() { tmp2249_fu_55716_p2 = (!tmp3362_cast_fu_55682_p1.read().is_01() || !tmp3365_cast_fu_55712_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3362_cast_fu_55682_p1.read()) + sc_biguint<4>(tmp3365_cast_fu_55712_p1.read())); } void Matrix_Vector_Activa::thread_tmp224_fu_44076_p2() { tmp224_fu_44076_p2 = (!tmp350_cast_fu_44062_p1.read().is_01() || !tmp351_cast_fu_44072_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp350_cast_fu_44062_p1.read()) + sc_biguint<3>(tmp351_cast_fu_44072_p1.read())); } void Matrix_Vector_Activa::thread_tmp2250_cast_fu_67537_p1() { tmp2250_cast_fu_67537_p1 = esl_zext<6,5>(tmp1519_reg_80404.read()); } void Matrix_Vector_Activa::thread_tmp2250_fu_67924_p2() { tmp2250_fu_67924_p2 = (!tmp2242_fu_67915_p2.read().is_01() || !tmp3361_cast_fu_67921_p1.read().is_01())? sc_lv<16>(): (sc_biguint<16>(tmp2242_fu_67915_p2.read()) + sc_biguint<16>(tmp3361_cast_fu_67921_p1.read())); } void Matrix_Vector_Activa::thread_tmp2251_cast_fu_51548_p1() { tmp2251_cast_fu_51548_p1 = esl_zext<5,4>(tmp1511_fu_51542_p2.read()); } void Matrix_Vector_Activa::thread_tmp2251_fu_55722_p2() { tmp2251_fu_55722_p2 = (!tmp_23_17_31_i_cast_fu_55531_p1.read().is_01() || !tmp_23_17_52_i_cast_fu_55594_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_31_i_cast_fu_55531_p1.read()) + sc_biguint<2>(tmp_23_17_52_i_cast_fu_55594_p1.read())); } void Matrix_Vector_Activa::thread_tmp2252_cast_fu_51508_p1() { tmp2252_cast_fu_51508_p1 = esl_zext<4,3>(tmp1507_fu_51502_p2.read()); } void Matrix_Vector_Activa::thread_tmp2252_fu_55732_p2() { tmp2252_fu_55732_p2 = (!tmp_23_17_33_i_cast_fu_55537_p1.read().is_01() || !tmp_23_17_30_i_cast_fu_55528_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_33_i_cast_fu_55537_p1.read()) + sc_biguint<2>(tmp_23_17_30_i_cast_fu_55528_p1.read())); } void Matrix_Vector_Activa::thread_tmp2253_cast_fu_51488_p1() { tmp2253_cast_fu_51488_p1 = esl_zext<3,2>(tmp1505_fu_51482_p2.read()); } void Matrix_Vector_Activa::thread_tmp2253_fu_55742_p2() { tmp2253_fu_55742_p2 = (!tmp3371_cast_fu_55728_p1.read().is_01() || !tmp3372_cast_fu_55738_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3371_cast_fu_55728_p1.read()) + sc_biguint<3>(tmp3372_cast_fu_55738_p1.read())); } void Matrix_Vector_Activa::thread_tmp2254_cast_fu_51498_p1() { tmp2254_cast_fu_51498_p1 = esl_zext<3,2>(tmp1506_fu_51492_p2.read()); } void Matrix_Vector_Activa::thread_tmp2254_fu_55752_p2() { tmp2254_fu_55752_p2 = (!tmp_23_17_35_i_cast_fu_55543_p1.read().is_01() || !tmp_23_17_32_i_cast_fu_55534_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_35_i_cast_fu_55543_p1.read()) + sc_biguint<2>(tmp_23_17_32_i_cast_fu_55534_p1.read())); } void Matrix_Vector_Activa::thread_tmp2255_cast_fu_51538_p1() { tmp2255_cast_fu_51538_p1 = esl_zext<4,3>(tmp1510_fu_51532_p2.read()); } void Matrix_Vector_Activa::thread_tmp2255_fu_55762_p2() { tmp2255_fu_55762_p2 = (!tmp_23_17_37_i_cast_fu_55549_p1.read().is_01() || !tmp_23_17_34_i_cast_fu_55540_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_37_i_cast_fu_55549_p1.read()) + sc_biguint<2>(tmp_23_17_34_i_cast_fu_55540_p1.read())); } void Matrix_Vector_Activa::thread_tmp2256_cast_fu_51518_p1() { tmp2256_cast_fu_51518_p1 = esl_zext<3,2>(tmp1508_fu_51512_p2.read()); } void Matrix_Vector_Activa::thread_tmp2256_fu_55772_p2() { tmp2256_fu_55772_p2 = (!tmp3374_cast_fu_55758_p1.read().is_01() || !tmp3375_cast_fu_55768_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3374_cast_fu_55758_p1.read()) + sc_biguint<3>(tmp3375_cast_fu_55768_p1.read())); } void Matrix_Vector_Activa::thread_tmp2257_cast_fu_51528_p1() { tmp2257_cast_fu_51528_p1 = esl_zext<3,2>(tmp1509_fu_51522_p2.read()); } void Matrix_Vector_Activa::thread_tmp2257_fu_55782_p2() { tmp2257_fu_55782_p2 = (!tmp3370_cast_fu_55748_p1.read().is_01() || !tmp3373_cast_fu_55778_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3370_cast_fu_55748_p1.read()) + sc_biguint<4>(tmp3373_cast_fu_55778_p1.read())); } void Matrix_Vector_Activa::thread_tmp2258_cast_fu_51618_p1() { tmp2258_cast_fu_51618_p1 = esl_zext<5,4>(tmp1518_fu_51612_p2.read()); } void Matrix_Vector_Activa::thread_tmp2258_fu_55792_p2() { tmp2258_fu_55792_p2 = (!tmp_23_17_39_i_cast_fu_55555_p1.read().is_01() || !tmp_23_17_36_i_cast_fu_55546_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_39_i_cast_fu_55555_p1.read()) + sc_biguint<2>(tmp_23_17_36_i_cast_fu_55546_p1.read())); } void Matrix_Vector_Activa::thread_tmp2259_cast_fu_51578_p1() { tmp2259_cast_fu_51578_p1 = esl_zext<4,3>(tmp1514_fu_51572_p2.read()); } void Matrix_Vector_Activa::thread_tmp2259_fu_55802_p2() { tmp2259_fu_55802_p2 = (!tmp_23_17_41_i_cast_fu_55561_p1.read().is_01() || !tmp_23_17_38_i_cast_fu_55552_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_41_i_cast_fu_55561_p1.read()) + sc_biguint<2>(tmp_23_17_38_i_cast_fu_55552_p1.read())); } void Matrix_Vector_Activa::thread_tmp225_fu_44086_p2() { tmp225_fu_44086_p2 = (!tmp346_cast_fu_44052_p1.read().is_01() || !tmp349_cast_fu_44082_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp346_cast_fu_44052_p1.read()) + sc_biguint<4>(tmp349_cast_fu_44082_p1.read())); } void Matrix_Vector_Activa::thread_tmp2260_cast_fu_51558_p1() { tmp2260_cast_fu_51558_p1 = esl_zext<3,2>(tmp1512_fu_51552_p2.read()); } void Matrix_Vector_Activa::thread_tmp2260_fu_55812_p2() { tmp2260_fu_55812_p2 = (!tmp3378_cast_fu_55798_p1.read().is_01() || !tmp3379_cast_fu_55808_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3378_cast_fu_55798_p1.read()) + sc_biguint<3>(tmp3379_cast_fu_55808_p1.read())); } void Matrix_Vector_Activa::thread_tmp2261_cast_fu_51568_p1() { tmp2261_cast_fu_51568_p1 = esl_zext<3,2>(tmp1513_fu_51562_p2.read()); } void Matrix_Vector_Activa::thread_tmp2261_fu_55822_p2() { tmp2261_fu_55822_p2 = (!tmp_23_17_43_i_cast_fu_55567_p1.read().is_01() || !tmp_23_17_40_i_cast_fu_55558_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_43_i_cast_fu_55567_p1.read()) + sc_biguint<2>(tmp_23_17_40_i_cast_fu_55558_p1.read())); } void Matrix_Vector_Activa::thread_tmp2262_cast_fu_51608_p1() { tmp2262_cast_fu_51608_p1 = esl_zext<4,3>(tmp1517_fu_51602_p2.read()); } void Matrix_Vector_Activa::thread_tmp2262_fu_55832_p2() { tmp2262_fu_55832_p2 = (!tmp_23_17_45_i_cast_fu_55573_p1.read().is_01() || !tmp_23_17_42_i_cast_fu_55564_p1.read().is_01())? sc_lv<2>(): (sc_biguint<2>(tmp_23_17_45_i_cast_fu_55573_p1.read()) + sc_biguint<2>(tmp_23_17_42_i_cast_fu_55564_p1.read())); } void Matrix_Vector_Activa::thread_tmp2263_cast_fu_51588_p1() { tmp2263_cast_fu_51588_p1 = esl_zext<3,2>(tmp1515_fu_51582_p2.read()); } void Matrix_Vector_Activa::thread_tmp2263_fu_55842_p2() { tmp2263_fu_55842_p2 = (!tmp3381_cast_fu_55828_p1.read().is_01() || !tmp3382_cast_fu_55838_p1.read().is_01())? sc_lv<3>(): (sc_biguint<3>(tmp3381_cast_fu_55828_p1.read()) + sc_biguint<3>(tmp3382_cast_fu_55838_p1.read())); } void Matrix_Vector_Activa::thread_tmp2264_cast_fu_51598_p1() { tmp2264_cast_fu_51598_p1 = esl_zext<3,2>(tmp1516_fu_51592_p2.read()); } void Matrix_Vector_Activa::thread_tmp2264_fu_55852_p2() { tmp2264_fu_55852_p2 = (!tmp3377_cast_fu_55818_p1.read().is_01() || !tmp3380_cast_fu_55848_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(tmp3377_cast_fu_55818_p1.read()) + sc_biguint<4>(tmp3380_cast_fu_55848_p1.read())); } void Matrix_Vector_Activa::thread_tmp2265_cast_fu_67540_p1() { tmp2265_cast_fu_67540_p1 = esl_zext<6,5>(tmp1535_reg_80409.read()); } void Matrix_Vector_Activa::thread_tmp2265_fu_55862_p2() { tmp2265_fu_55862_p2 = (!tmp3369_cast_fu_55788_p1.read().is_01() || !tmp3376_cast_fu_55858_p1.read().is_01())? sc_lv<5>(): (sc_biguint<5>(tmp3369_cast_fu_55788_p1.read()) + sc_biguint<5>(tmp3376_cast_fu_55858_p1.read())); } void Matrix_Vector_Activa::thread_tmp2266_cast_fu_51694_p1() { tmp2266_cast_fu_51694_p1 = esl_zext<5,4>(tmp1526_fu_51688_p2.read()); } }
50.03616
254
0.783364
IceyFong
f74bf139df8988d53b6c9f952a1e74c614374ac9
5,145
cpp
C++
es-core/src/RHGamestationConf.cpp
pmoran13800/rhgamestation-emulationstation2
18cc2fde1acbac8cc4e3e8af8adeca10f2554bdd
[ "MIT" ]
null
null
null
es-core/src/RHGamestationConf.cpp
pmoran13800/rhgamestation-emulationstation2
18cc2fde1acbac8cc4e3e8af8adeca10f2554bdd
[ "MIT" ]
null
null
null
es-core/src/RHGamestationConf.cpp
pmoran13800/rhgamestation-emulationstation2
18cc2fde1acbac8cc4e3e8af8adeca10f2554bdd
[ "MIT" ]
null
null
null
#include "RHGamestationConf.h" #include <iostream> #include <fstream> #include <boost/regex.hpp> #include "Log.h" #include <boost/algorithm/string/predicate.hpp> RHGamestationConf *RHGamestationConf::sInstance = NULL; boost::regex validLine("^(?<key>[^;|#].*?)=(?<val>.*?)$"); boost::regex commentLine("^;(?<key>.*?)=(?<val>.*?)$"); std::string rhgamestationConfFile = "/rhgamestation/share/system/rhgamestation.conf"; std::string rhgamestationConfFileInit = "/rhgamestation/share_init/system/rhgamestation.conf"; std::string rhgamestationConfFileTmp = "/rhgamestation/share/system/rhgamestation.conf.tmp"; RHGamestationConf::RHGamestationConf(bool mainFile) { loadRHGamestationConf(mainFile); } RHGamestationConf::~RHGamestationConf() { if (sInstance && sInstance == this) delete sInstance; } RHGamestationConf *RHGamestationConf::getInstance() { if (sInstance == NULL) sInstance = new RHGamestationConf(); return sInstance; } bool RHGamestationConf::loadRHGamestationConf(bool mainFile) { std::string line; std::string filePath = mainFile ? rhgamestationConfFile : rhgamestationConfFileInit; std::ifstream rhgamestationConf(filePath); if (rhgamestationConf && rhgamestationConf.is_open()) { while (std::getline(rhgamestationConf, line)) { boost::smatch lineInfo; if (boost::regex_match(line, lineInfo, validLine)) { confMap[std::string(lineInfo["key"])] = std::string(lineInfo["val"]); } } rhgamestationConf.close(); } else { LOG(LogError) << "Unable to open " << filePath; return false; } return true; } bool RHGamestationConf::saveRHGamestationConf() { std::ifstream filein(rhgamestationConfFile); //File to read from if (!filein) { LOG(LogError) << "Unable to open for saving : " << rhgamestationConfFile << "\n"; return false; } /* Read all lines in a vector */ std::vector<std::string> fileLines; std::string line; while (std::getline(filein, line)) { fileLines.push_back(line); } filein.close(); /* Save new value if exists */ for (std::map<std::string, std::string>::iterator it = confMap.begin(); it != confMap.end(); ++it) { std::string key = it->first; std::string val = it->second; bool lineFound = false; for (int i = 0; i < fileLines.size(); i++) { std::string currentLine = fileLines[i]; if (boost::starts_with(currentLine, key+"=") || boost::starts_with(currentLine, ";"+key+"=")){ fileLines[i] = key + "=" + val; lineFound = true; } } if(!lineFound){ fileLines.push_back(key + "=" + val); } } std::ofstream fileout(rhgamestationConfFileTmp); //Temporary file if (!fileout) { LOG(LogError) << "Unable to open for saving : " << rhgamestationConfFileTmp << "\n"; return false; } for (int i = 0; i < fileLines.size(); i++) { fileout << fileLines[i] << "\n"; } fileout.close(); /* Copy back the tmp to rhgamestation.conf */ std::ifstream src(rhgamestationConfFileTmp, std::ios::binary); std::ofstream dst(rhgamestationConfFile, std::ios::binary); dst << src.rdbuf(); remove(rhgamestationConfFileTmp.c_str()); return true; } std::string RHGamestationConf::get(const std::string &name) { if (confMap.count(name)) { return confMap[name]; } return ""; } std::string RHGamestationConf::get(const std::string &name, const std::string &defaultValue) { if (confMap.count(name)) { return confMap[name]; } return defaultValue; } bool RHGamestationConf::getBool(const std::string &name, bool defaultValue) { if (confMap.count(name)) { return confMap[name] == "1"; } return defaultValue; } unsigned int RHGamestationConf::getUInt(const std::string &name, unsigned int defaultValue) { try { if (confMap.count(name)) { int value = std::stoi(confMap[name]); return value > 0 ? (unsigned int) value : 0; } } catch(std::invalid_argument&) {} return defaultValue; } void RHGamestationConf::set(const std::string &name, const std::string &value) { confMap[name] = value; } void RHGamestationConf::setBool(const std::string &name, bool value) { confMap[name] = value ? "1" : "0"; } void RHGamestationConf::setUInt(const std::string &name, unsigned int value) { confMap[name] = std::to_string(value).c_str(); } bool RHGamestationConf::isInList(const std::string &name, const std::string &value) { bool result = false; if (confMap.count(name)) { std::string s = confMap[name]; std::string delimiter = ","; size_t pos = 0; std::string token; while (((pos = s.find(delimiter)) != std::string::npos) ) { token = s.substr(0, pos); if (token == value) result = true; s.erase(0, pos + delimiter.length()); } if (s == value) result = true; } return result; }
30.808383
106
0.61691
pmoran13800
f7505429f2ab2bdb1f126548368bf57b2de0852b
8,210
cpp
C++
threadpool11_demo/src/main.cpp
tghosgor/threadpool11
8998e5ca2fd2ea43bd5e74ef1deb3f0e906c3b3f
[ "MIT" ]
283
2015-01-06T18:02:29.000Z
2022-03-29T00:40:55.000Z
threadpool11_demo/src/main.cpp
tghosgor/threadpool11
8998e5ca2fd2ea43bd5e74ef1deb3f0e906c3b3f
[ "MIT" ]
11
2015-01-08T01:04:18.000Z
2021-05-08T09:08:37.000Z
threadpool11_demo/src/main.cpp
tghosgor/threadpool11
8998e5ca2fd2ea43bd5e74ef1deb3f0e906c3b3f
[ "MIT" ]
82
2015-03-23T12:22:58.000Z
2021-12-18T15:32:26.000Z
#include "threadpool11/threadpool11.hpp" #include <algorithm> #include <array> #include <cstdio> #include <cmath> #include <future> #include <iostream> #include <mutex> #include <thread> #include <vector> namespace { std::mutex coutMutex; void test1Func() { coutMutex.lock(); // heavy job that takes 1 second std::cout << "Waiting thread id: " << std::this_thread::get_id() << std::endl; coutMutex.unlock(); std::this_thread::sleep_for(std::chrono::seconds(1)); } void test2Func() { volatile int i = std::min(5, rand()); } std::atomic<uint64_t> test3Var(0); void test3Func() { volatile uint16_t var = 0; while (++var < (std::numeric_limits<uint16_t>::max())) ; ++test3Var; } std::size_t factorial(std::size_t i) { i = std::max(1ul, i); std::size_t res = i; while (i > 2) { res *= --i; } return res; } } // NS int main(int argc, char* argv[]) { threadpool11::pool pool; std::cout << "Your machine's hardware concurrency is " << std::thread::hardware_concurrency() << std::endl << std::endl; /* * Demo #1. */ { std::cout << "This demo is about showing how parallelization increases the performance. " << "In this test case, work is simulated by making the threads inactive by sleeping for 1 second. " << "It will seem like all jobs complete in ~1 second even in a single core machine. " << "However, in real life cases, work would keep CPU busy so you would not get any real benefit " "using " << "thread numbers that are higher than your machine's hardware concurrency (threads that are " "executed " << "concurrently) except in some cases like doing file IO." << std::endl << std::endl; { std::cout << "Demo 1\n"; std::cout << "Executing 5 test1Func() WITHOUT posting to thread pool:\n"; auto begin = std::chrono::high_resolution_clock::now(); /*test1Func(); test1Func(); test1Func(); test1Func(); test1Func();*/ auto end = std::chrono::high_resolution_clock::now(); std::cout << "\texecution took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " milliseconds.\n\n"; } { std::cout << "Executing 5 test1Func() WITH posting to thread pool:" << std::endl; std::vector<std::future<void>> futures; auto begin = std::chrono::high_resolution_clock::now(); futures.emplace_back(pool.post_work<void>(test1Func)); futures.emplace_back(pool.post_work<void>(test1Func)); futures.emplace_back(pool.post_work<void>(test1Func)); futures.emplace_back(pool.post_work<void>(test1Func)); futures.emplace_back(pool.post_work<void>(test1Func)); for (auto& it : futures) it.get(); auto end = std::chrono::high_resolution_clock::now(); std::cout << "\tDemo 1 took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " milliseconds." << std::endl << std::endl; } } /* Helper function tests */ { std::cout << "Increasing worker count by 5." << std::endl; pool.increase_worker_count(5); std::cout << "Current worker count is " << pool.get_worker_count() << ". Async setting worker count to " << std::thread::hardware_concurrency() << "... " << std::flush; pool.set_worker_count(std::thread::hardware_concurrency()); std::cout << "The new worker count is (may still be 13) " << pool.get_worker_count() << "." << std::endl; std::cout << "Waiting 1 second..." << std::endl; std::this_thread::sleep_for(std::chrono::seconds(1)); std::cout << "The new worker count is " << pool.get_worker_count() << "." << std::endl; std::cout << "Increasing worker count by 5." << std::endl; pool.increase_worker_count(5); std::cout << "Current worker count is " << pool.get_worker_count() << ". Sync setting worker count to " << std::thread::hardware_concurrency() << "... " << std::flush; pool.set_worker_count(std::thread::hardware_concurrency(), threadpool11::pool::method_t::SYNC); std::cout << "The new worker count is " << pool.get_worker_count() << "." << std::endl << std::endl; } /* * Demo #2 */ { std::cout << "Demo 2" << std::endl; std::cout << "Posting 1.000.000 jobs." << std::endl; std::vector<std::future<void>> futures; auto begin = std::chrono::high_resolution_clock::now(); for (int i = 0; i < 1000000; ++i) { futures.emplace_back(pool.post_work<void>(test2Func)); } auto end = std::chrono::high_resolution_clock::now(); for (auto& it : futures) it.get(); auto end2 = std::chrono::high_resolution_clock::now(); std::cout << "Demo 2 took " << std::chrono::duration_cast<std::chrono::milliseconds>(end2 - begin).count() << " milliseconds. (Posting: " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " ms, getting: " << std::chrono::duration_cast<std::chrono::milliseconds>(end2 - end).count() << " ms)" << std::endl << std::endl; } /* * Demo #3 * You should always capture by value or use appropriate mutexes for reference access. */ { std::cout << "Demo 3" << std::endl; std::cout << "Testing work queue flow." << std::endl; #define th11_demo_iterations 30000 // pool.increaseWorkerCountBy(th11_demo_iterations - 2); std::array<std::future<void>, th11_demo_iterations> futures; auto begin = std::chrono::high_resolution_clock::now(); for (int i = 0; i < th11_demo_iterations; ++i) futures[i] = pool.post_work<void>([=]() { test3Func(); }); for (int i = 0; i < th11_demo_iterations; ++i) futures[i].get(); auto end = std::chrono::high_resolution_clock::now(); std::cout << "Variable is: " << test3Var << ", expected: " << th11_demo_iterations << std::endl; std::cout << "Demo 3 took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " milliseconds." << std::endl << std::endl; } /* * Demo #4 * Using futures. */ { std::cout << "Demo 4\n"; std::cout << "WARNING: This test's output may be distorted because no synchronization on std::cout is done.\n"; std::array<std::future<float>, 20> futures; auto begin = std::chrono::high_resolution_clock::now(); for (int i = 0; i < 20; i++) { futures[i] = pool.post_work<float>([=]() { std::cout << "\tExecuted pow(" << i << ", 2) by thread id " << std::this_thread::get_id() << std::endl; return std::pow(i, 2); }); } for (int i = 0; i < 20; i++) { std::cout << "\tfuture[" << i << "] value: " << futures[i].get() << std::endl; } auto end = std::chrono::high_resolution_clock::now(); std::cout << "Demo 4 took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " milliseconds." << std::endl << std::endl; } /* * Demo #5 * For performance test purposes. */ const constexpr auto iter = 300000ul; std::array<std::size_t, iter> a; { pool.set_worker_count(std::thread::hardware_concurrency()); std::array<std::future<std::size_t>, iter> futures; const auto begin = std::chrono::high_resolution_clock::now(); for (auto i = 0u; i < iter; ++i) { futures[i] = pool.post_work<std::size_t>([i]() { return factorial(i); }); } for (auto i = 0u; i < iter; ++i) { a[i] = futures[i].get(); } const auto end = std::chrono::high_resolution_clock::now(); std::cout << "Demo 5 took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " milliseconds." << std::endl << std::endl; } std::cout << std::endl << std::endl; std::cout << "Demos completed." << std::endl; // std::cin.get(); return 0; }
35.695652
111
0.578563
tghosgor
f75207f9159d49c65ba39318c924ad78ea53bbab
82,546
cpp
C++
Tests/UnitTests/Tests/Services/SocialManagerTests.cpp
natiskan/xbox-live-api
9e7e51e0863b5983c2aa334a7b0db579b3bdf1de
[ "MIT" ]
118
2019-05-13T22:56:02.000Z
2022-03-16T06:12:39.000Z
Tests/UnitTests/Tests/Services/SocialManagerTests.cpp
aspavlov/xbox-live-api
4bec6f92347d0ad6c85463b601821333de631e3a
[ "MIT" ]
31
2019-05-07T13:09:28.000Z
2022-01-26T10:02:59.000Z
Tests/UnitTests/Tests/Services/SocialManagerTests.cpp
aspavlov/xbox-live-api
4bec6f92347d0ad6c85463b601821333de631e3a
[ "MIT" ]
48
2019-05-28T23:55:31.000Z
2021-12-22T03:47:56.000Z
// Copyright (c) Microsoft Corporation // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include "pch.h" #include "UnitTestIncludes.h" #include "xsapi-c/social_manager_c.h" #include "xsapi-cpp/social_manager.h" #include "social_manager_internal.h" using namespace xbox::services::presence; using namespace xbox::services::real_time_activity; using namespace xbox::services::social::manager; NAMESPACE_MICROSOFT_XBOX_SERVICES_SYSTEM_CPP_BEGIN const char defaultPeoplehubTemplate[] = R"( { "xuid": "1", "isFavorite": false, "isFollowingCaller": true, "isFollowedByCaller": true, "isIdentityShared": false, "displayName": "TestGamerTag", "realName": "", "displayPicRaw": "http://images-eds.xboxlive.com/image?url=mHGRD8KXEf2sp2LC58XhBQKNl2IWRp.J.q8mSURKUUeiPPf0Y7Kl7zLN7rafayiPptVaX_XIUmNOPotNmNubbx4bHmf6It7Oj1ChU5UAo9k-&background=0xababab&mode=Padding&format=png", "useAvatar": false, "gamertag": "TestGamerTag", "modernGamertag": "TestGamerTag", "modernGamertagSuffix": "", "uniqueModernGamertag": "TestGamerTag", "gamerScore": "9001", "presenceState": "Online", "presenceDevices": null, "isBroadcasting": false, "titleHistory": { "TitleName": "Forza Horizon 2", "TitleId": "1234", "LastTimePlayed": "2015-01-26T22:54:54.6630000Z" }, "suggestion": null, "multiplayerSummary": { "InMultiplayerSession": 0, "InParty": 0 }, "recentPlayer": null, "follower": null, "preferredColor": { "primaryColor": "193e91", "secondaryColor": "2458cf", "tertiaryColor": "122e6b" }, "titlePresence": null, "titleSummaries": null, "presenceDetails": [{ "IsBroadcasting": false, "Device": "PC", "State": "Active", "TitleId": "1234", "PresenceText": "Home" }] } )"; const char onlinePresenceResponseTemplate[] = R"( { "xuid": "1", "state": "Online", "devices": [ { "type": "PC", "titles": [ { "id": "1234", "name": "awesomeGame", "lastModified": "2013-02-01T00:00:00Z", "state": "active", "placement": "Full", "activity": { "richPresence": "Home" } } ] } ] })"; const char offlinePresenceResponseTemplate[] = R"( { "xuid": "1", "state": "Offline", "devices": [] } )"; const char* presenceOnlineRtaMessageSubscribeComplete = R"({"xuid":"2814613569642996","state":"Online","devices":[{"type":"MCapensis","titles":[{"id":"1234","name":"Default Title","placement":"Full","state":"Active", "activity": {"richPresence":"Home"}, "lastModified":"2016-09-30T00:15:35.5994615Z"}]}]})"; const char* presenceOfflineRtaMessageSubscribeComplete = R"({"xuid":"2814613569642996","state":"Offline"})"; #define NUM_USERS 100 DEFINE_TEST_CLASS(SocialManagerTests) { public: DEFINE_TEST_CLASS_PROPS(SocialManagerTests); private: // RAII class for basic SocialManager Test Setup/teardown including relevant mocks class SMTestEnvironment : public TestEnvironment { public: SMTestEnvironment() noexcept { FollowedXuids.reserve(NUM_USERS); for (uint64_t i = 0; i < NUM_USERS; ++i) { FollowedXuids.push_back(i + 1); } MockRtaService().SetSubscribeHandler(RTASubscribeHandler); // Setup default presence and peoplehub mocks SetPeoplehubMock(); SetPresenceMock(); } ~SMTestEnvironment() noexcept { // Remove all local users size_t userCount = XblSocialManagerGetLocalUserCount(); auto users{ new XblUserHandle[userCount] }; VERIFY_SUCCEEDED(XblSocialManagerGetLocalUsers(userCount, users)); for (size_t i = 0; i < userCount; ++i) { VERIFY_SUCCEEDED(XblSocialManagerRemoveLocalUser(users[i])); } #if ENABLE_PERF_PROFILING TEST_LOG(Utils::StringTFromUtf8(detail::PerfTester::Instance().FormatStats().data()).data()); #endif } // CPP helpers wrapping SocialManager APIs // Add local user and validate the expected events are received void AddLocalUser(const User& user) const noexcept { LOGS_DEBUG << "Adding User to SocialManager and awaiting LocalUserAdded and RTA subscriptions"; // As a testing convenience, await sub handshakes to complete so that tests can fire // RTA events and be sure that the social graph is prepared to respond to them struct RTASubResponder { RTASubResponder(size_t followeeCount) { auto& rtaService{ system::MockRealTimeActivityService::Instance() }; rtaService.SetSubscribeHandler([=](uint32_t n, xsapi_internal_string uri) { SMTestEnvironment::RTASubscribeHandler(n, uri); if (uri.find("https://userpresence.xboxlive.com") != xsapi_internal_string::npos) { ++presenceSubsComplete; } else if (uri.find("http://social.xboxlive.com") != xsapi_internal_string::npos) { socialRelationshipSubComplete = true; } // Graph will create two presence subscriptions for each followed User (Device & title presence) if (presenceSubsComplete >= followeeCount * 2 && socialRelationshipSubComplete) { complete.Set(); } }); } ~RTASubResponder() { // Reset to default handler system::MockRealTimeActivityService::Instance().SetSubscribeHandler(SMTestEnvironment::RTASubscribeHandler); } size_t presenceSubsComplete{ 0 }; bool socialRelationshipSubComplete{ false }; Event complete{}; } rtaResponder{ FollowedXuids.size() }; VERIFY_SUCCEEDED(XblSocialManagerAddLocalUser(user.Handle(), XblSocialManagerExtraDetailLevel::NoExtraDetail, nullptr)); AwaitEvents({ {XblSocialManagerEventType::LocalUserAdded, 1} }); rtaResponder.complete.Wait(); } std::vector<const XblSocialManagerEvent*> DoWork() const noexcept { const XblSocialManagerEvent* events{ nullptr }; size_t eventCount{ 0 }; HRESULT hr = XblSocialManagerDoWork(&events, &eventCount); if (FAILED(hr)) { VERIFY_FAIL(); // avoiding log spam } auto eventsVector = Utils::Transform<const XblSocialManagerEvent*>(events, eventCount, [](const XblSocialManagerEvent& e) { return &e; }); LogEvents(eventsVector); return eventsVector; } // DoWork until the specified events happen. void AwaitEvents(std::map<XblSocialManagerEventType, size_t> expectedEvents) const noexcept { while (!expectedEvents.empty()) { auto events{ DoWork() }; for (auto event : events) { auto iter{ expectedEvents.find(event->eventType) }; if (iter == expectedEvents.end()) { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } else if(--iter->second == 0) { expectedEvents.erase(iter); } } } } std::vector<const XblSocialManagerUser*> GetUsers( XblSocialManagerUserGroupHandle group ) const noexcept { const XblSocialManagerUser* const* users{ nullptr }; size_t userCount{ 0 }; VERIFY_SUCCEEDED(XblSocialManagerUserGroupGetUsers(group, &users, &userCount)); return std::vector<const XblSocialManagerUser*>(users, users + userCount); } size_t GetUsersCount( XblSocialManagerUserGroupHandle group ) const noexcept { const XblSocialManagerUser* const* users{ nullptr }; size_t userCount{ 0 }; VERIFY_SUCCEEDED(XblSocialManagerUserGroupGetUsers(group, &users, &userCount)); return userCount; } size_t GetTrackedUsersCount( XblSocialManagerUserGroupHandle group ) const noexcept { const uint64_t* trackedUsers{ nullptr }; size_t userCount{ 0 }; VERIFY_SUCCEEDED(XblSocialManagerUserGroupGetUsersTrackedByGroup(group, &trackedUsers, &userCount)); return userCount; } // Configure Mocks used by SocialManager void SetPeoplehubMock( bool online = true, bool isFavorite = false, bool isFollowedByCaller = true ) noexcept { // No HTTP method so it matches both batch and get friends calls m_peoplehubMock = std::make_shared<HttpMock>("", "https://peoplehub.xboxlive.com"); m_peoplehubMock->SetMockMatchedCallback( [ this, online, isFavorite, isFollowedByCaller ] (HttpMock* mock, xsapi_internal_string requestUrl, xsapi_internal_string requestBody) { std::vector<uint64_t> xuids; auto jsonRequest = Utils::ParseJson(requestBody.data()); if (jsonRequest.is_null()) { xuids = this->FollowedXuids; } else { auto xuidArray = jsonRequest[L"xuids"]; for (size_t i = 0; i < xuidArray.size(); ++i) { xuids.push_back(Utils::Uint64FromStringT(xuidArray[i].as_string())); } } JsonDocument responseBody(rapidjson::kObjectType); JsonDocument::AllocatorType& allocator = responseBody.GetAllocator(); JsonValue peopleArray(rapidjson::kArrayType); for (auto& xuid : xuids) { JsonDocument jsonBlob(&allocator); jsonBlob.Parse(defaultPeoplehubTemplate); JsonUtils::SetMember(jsonBlob, "xuid", JsonValue(utils::uint64_to_internal_string(xuid).c_str(), allocator)); JsonUtils::SetMember(jsonBlob, "presenceState", JsonValue((online ? "Online" : "Offline"), allocator)); JsonUtils::SetMember(jsonBlob, "isFavorite", JsonValue(isFavorite)); JsonUtils::SetMember(jsonBlob, "isFollowedByCaller", JsonValue(isFollowedByCaller)); peopleArray.PushBack(jsonBlob, allocator); } responseBody.AddMember("people", peopleArray, allocator); mock->SetResponseBody(responseBody); }); } // Presence service will respond that all users are online except for those specified in offlineXuids void SetPresenceMock( const std::vector<uint64_t>& offlineXuids = {}, uint32_t titleId = MOCK_TITLEID ) noexcept { m_presenceMock = std::make_shared<HttpMock>("GET", "https://userpresence.xboxlive.com"); m_presenceMock->SetMockMatchedCallback( [ offlineXuids = std::unordered_set<uint64_t>{ offlineXuids.begin(), offlineXuids.end() }, titleId ] (HttpMock* mock, xsapi_internal_string requestUrl, xsapi_internal_string requestBody) mutable { SetPresenceResponse(mock, requestUrl, requestBody, std::move(offlineXuids), titleId); }); } void FireDevicePresenceChangeRtaEvent( const std::vector<uint64_t>& userList, bool online = false ) const noexcept { for (auto xuid : userList) { xsapi_internal_stringstream uri; uri << "https://userpresence.xboxlive.com/users/xuid(" << xuid << ")/devices"; MockRealTimeActivityService::Instance().RaiseEvent(uri.str(), online ? R"("PC:true")" : R"("PC:false")"); } } void FireTitlePresenceChangeRtaEvent( const std::vector<uint64_t>& userList, bool ended = true ) const noexcept { for (auto xuid : userList) { xsapi_internal_stringstream uri; uri << "https://userpresence.xboxlive.com/users/xuid(" << xuid << ")/titles/1234"; MockRealTimeActivityService::Instance().RaiseEvent(uri.str(), ended ? R"("ended")" : R"("started")"); } } void FireSocialGraphChangedRtaEvent( const User& localUser, XblSocialNotificationType notificationType, uint64_t affectedXuid ) const noexcept { xsapi_internal_stringstream uri; uri << "http://social.xboxlive.com/users/xuid(" << localUser.Xuid() << ")/friends"; rapidjson::Document eventData{ rapidjson::kObjectType }; auto& a{ eventData.GetAllocator() }; eventData.AddMember("NotificationType", rapidjson::Value{ EnumName(notificationType).data(), a }, a); rapidjson::Value eventDataXuids{ rapidjson::kArrayType }; eventDataXuids.PushBack(rapidjson::Value{ Utils::StringFromUint64(affectedXuid).c_str(), a }.Move(), a); eventData.AddMember("Xuids", eventDataXuids.Move(), a); MockRealTimeActivityService::Instance().RaiseEvent(uri.str(), eventData); } // Xuids Local Users follow std::vector<uint64_t> FollowedXuids; private: static void RTASubscribeHandler(uint32_t n, xsapi_internal_string uri) { auto& rtaService{ system::MockRealTimeActivityService::Instance() }; if (uri.find("https://userpresence.xboxlive.com") != xsapi_internal_string::npos) { rtaService.CompleteSubscribeHandshake(n, presenceOnlineRtaMessageSubscribeComplete); } else if (uri.find("http://social.xboxlive.com") != xsapi_internal_string::npos) { rtaService.CompleteSubscribeHandshake(n); } } static size_t SetPresenceResponse( HttpMock* mock, const xsapi_internal_string& requestUrl, const xsapi_internal_string& requestBody, std::unordered_set<uint64_t>&& offlineXuids = {}, uint32_t titleId = MOCK_TITLEID ) { JsonDocument userArr{}; if (requestUrl.find("batch") != xsapi_internal_string::npos) { // for batch requests the user list is in the request body JsonDocument jsonRequest{ rapidjson::kObjectType }; jsonRequest.Parse(requestBody.data()); userArr.CopyFrom(jsonRequest["users"], userArr.GetAllocator()); assert(userArr.IsArray()); } else { assert(requestBody.empty()); userArr.SetArray(); auto beginIndex{ requestUrl.find("(") }; auto endIndex{ requestUrl.find(")") }; userArr.PushBack(JsonValue{ requestUrl.substr(beginIndex + 1, endIndex - beginIndex - 1).data(), userArr.GetAllocator() }, userArr.GetAllocator()); } JsonDocument response(rapidjson::kArrayType); JsonDocument::AllocatorType& allocator = response.GetAllocator(); for (uint32_t i = 0; i < userArr.Size(); ++i) { if (offlineXuids.find(utils::internal_string_to_uint64(userArr[i].GetString())) == offlineXuids.end()) { JsonDocument onlinePresenceResponseTemplateJson(&allocator); onlinePresenceResponseTemplateJson.Parse(onlinePresenceResponseTemplate); response.PushBack(onlinePresenceResponseTemplateJson, allocator); JsonUtils::SetMember(response[i]["devices"][0]["titles"][0], allocator, "id", JsonValue(utils::uint32_to_internal_string(titleId).c_str(), allocator)); } else { JsonDocument offlinePresenceResponseTemplateJson(&allocator); offlinePresenceResponseTemplateJson.Parse(offlinePresenceResponseTemplate); response.PushBack(offlinePresenceResponseTemplateJson, allocator); } JsonUtils::SetMember(response[i], allocator, "xuid", userArr[i]); } mock->SetResponseBody(response); return userArr.Size(); } void LogEvents( const std::vector<const XblSocialManagerEvent*>& events ) const noexcept { static std::unordered_map<XblSocialManagerEventType, xsapi_internal_string> eventTypesMap { { XblSocialManagerEventType::UsersAddedToSocialGraph, "UsersAddedToSocialGraph" }, { XblSocialManagerEventType::UsersRemovedFromSocialGraph, "UsersRemovedFromSocialGraph" }, { XblSocialManagerEventType::PresenceChanged, "PresenceChanged" }, { XblSocialManagerEventType::ProfilesChanged, "ProfilesChanged" }, { XblSocialManagerEventType::SocialRelationshipsChanged, "SocialRelationshipsChanged" }, { XblSocialManagerEventType::LocalUserAdded, "LocalUserAdded" }, { XblSocialManagerEventType::SocialUserGroupLoaded, "SocialUserGroupLoaded" }, { XblSocialManagerEventType::SocialUserGroupUpdated, "SocialUserGroupUpdated" }, { XblSocialManagerEventType::UnknownEvent, "UnknownEvent" } }; for (auto& event : events) { xsapi_internal_stringstream ss; ss << "SocialManager Event: " << eventTypesMap[event->eventType] << std::endl; for (uint32_t i = 0; i < XBL_SOCIAL_MANAGER_MAX_AFFECTED_USERS_PER_EVENT; i++) { if (event->usersAffected[i] != nullptr) { if (i == 0) { ss << "Users affected: " << std::endl; } ss << "\t" << event->usersAffected[i]->xboxUserId << std::endl; } } LOGS_DEBUG << ss.str(); } } // Default mocks used by SocialManager std::shared_ptr<HttpMock> m_peoplehubMock; std::shared_ptr<HttpMock> m_presenceMock; }; public: DEFINE_TEST_CASE(TestAddLocalUser) { SMTestEnvironment env{}; auto xboxLiveContext{ env.CreateMockXboxLiveContext() }; env.AddLocalUser(xboxLiveContext->User()); } DEFINE_TEST_CASE(TestBasicCreateFilterGroup) { SMTestEnvironment env{}; auto xboxLiveContext{ env.CreateMockXboxLiveContext() }; env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle filterGroup{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &filterGroup )); bool groupLoaded{ false }; while (!groupLoaded) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == filterGroup); groupLoaded = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } auto users{ env.GetUsers(filterGroup) }; VERIFY_ARE_EQUAL(env.GetTrackedUsersCount(filterGroup), users.size()); for (auto user : users) { // profile tests LOGS_DEBUG << "Validating user " << user->xboxUserId; VERIFY_ARE_EQUAL_STR("TestGamerTag", user->displayName); VERIFY_ARE_EQUAL_STR("http://images-eds.xboxlive.com/image?url=mHGRD8KXEf2sp2LC58XhBQKNl2IWRp.J.q8mSURKUUeiPPf0Y7Kl7zLN7rafayiPptVaX_XIUmNOPotNmNubbx4bHmf6It7Oj1ChU5UAo9k-&background=0xababab&mode=Padding&format=png", user->displayPicUrlRaw); VERIFY_IS_TRUE(user->isFollowedByCaller); VERIFY_IS_TRUE(user->isFollowingUser); VERIFY_ARE_EQUAL_STR("9001", user->gamerscore); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->gamertag); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->modernGamertag); VERIFY_ARE_EQUAL_STR("", user->modernGamertagSuffix); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->uniqueModernGamertag); VERIFY_IS_FALSE(user->isFavorite); VERIFY_IS_FALSE(user->useAvatar); // preferred color tests VERIFY_ARE_EQUAL_STR("193e91", user->preferredColor.primaryColor); VERIFY_ARE_EQUAL_STR("2458cf", user->preferredColor.secondaryColor); VERIFY_ARE_EQUAL_STR("122e6b", user->preferredColor.tertiaryColor); // presence record tests VERIFY_IS_TRUE(user->presenceRecord.presenceTitleRecordCount == 1); VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Online); VERIFY_IS_TRUE(XblSocialManagerPresenceRecordIsUserPlayingTitle(&user->presenceRecord, 1234)); VERIFY_IS_TRUE(user->presenceRecord.presenceTitleRecords[0].isTitleActive); VERIFY_IS_TRUE(!user->presenceRecord.presenceTitleRecords[0].isBroadcasting); VERIFY_IS_TRUE(user->presenceRecord.presenceTitleRecords[0].deviceType == XblPresenceDeviceType::PC); VERIFY_ARE_EQUAL_STR("Home", user->presenceRecord.presenceTitleRecords[0].presenceText); // title history tests VERIFY_IS_TRUE(user->titleHistory.hasUserPlayed); VERIFY_IS_TRUE(VerifyTime(user->titleHistory.lastTimeUserPlayed, "2015-01-26T22:54:54.6630Z")); } VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(filterGroup)); } DEFINE_TEST_CASE(TestPresenceRtaUpdates) { SMTestEnvironment env{}; auto xboxLiveContext{ env.CreateMockXboxLiveContext() }; env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &group )); env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 1} }); auto users{ env.GetUsers(group) }; VERIFY_ARE_EQUAL_INT(users.size(), env.FollowedXuids.size()); // Verify initial presence for (auto user : users) { VERIFY_IS_TRUE(XblSocialManagerPresenceRecordIsUserPlayingTitle(&user->presenceRecord, 1234)); VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Online); } // Test title presence changed event auto presenceChangeXuids{ env.FollowedXuids }; env.SetPresenceMock({}, 4321); env.FireTitlePresenceChangeRtaEvent(presenceChangeXuids); size_t presenceChangedEvents{ 0 }; while (presenceChangedEvents < presenceChangeXuids.size()) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_FALSE(XblSocialManagerPresenceRecordIsUserPlayingTitle(&affectedUser->presenceRecord, 1234)); presenceChangedEvents++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(presenceChangedEvents, presenceChangeXuids.size()); // Verify the group view is updated as well for (auto user : env.GetUsers(group)) { VERIFY_IS_FALSE(XblSocialManagerPresenceRecordIsUserPlayingTitle(&user->presenceRecord, 1234)); } // Test device presence changed event env.SetPresenceMock(presenceChangeXuids); env.FireDevicePresenceChangeRtaEvent(presenceChangeXuids); presenceChangedEvents = 0; while (presenceChangedEvents < presenceChangeXuids.size()) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(affectedUser->presenceRecord.userState == XblPresenceUserState::Offline); presenceChangedEvents++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(presenceChangedEvents, presenceChangeXuids.size()); // Verify the group view is updated as well for (auto user : env.GetUsers(group)) { VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Offline); } VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group)); } DEFINE_TEST_CASE(TestMultipleLocalUsers) { SMTestEnvironment env{}; auto xboxLiveContext1 = env.CreateMockXboxLiveContext(); auto xboxLiveContext2 = env.CreateMockXboxLiveContext(202020202020, "MockLocalUser2"); env.AddLocalUser(xboxLiveContext1->User()); VERIFY_IS_TRUE(XblSocialManagerGetLocalUserCount() == 1); env.AddLocalUser(xboxLiveContext2->User()); VERIFY_IS_TRUE(XblSocialManagerGetLocalUserCount() == 2); XblSocialManagerUserGroupHandle user1Group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext1->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &user1Group )); // Create a list group that is a subset of user1Group std::vector<uint64_t> group2TrackedUsers{ 1, 2, 3, 4, 5 }; XblSocialManagerUserGroupHandle user2Group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromList( xboxLiveContext2->User().Handle(), group2TrackedUsers.data(), group2TrackedUsers.size(), &user2Group )); size_t groupsLoaded{ 0 }; while (groupsLoaded < 2) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == user1Group || event->groupAffected == user2Group); groupsLoaded++; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_IS_TRUE(groupsLoaded == 2); auto group1Users{ env.GetUsers(user1Group) }; auto group2Users{ env.GetUsers(user2Group) }; VERIFY_ARE_EQUAL(group1Users.size(), env.FollowedXuids.size()); VERIFY_ARE_EQUAL(group2Users.size(), group2TrackedUsers.size()); // Verify initial presence for (auto& user : group1Users) { VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Online); } for (auto& user : group2Users) { VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Online); } // Validate presence change propogates to both user's groups and make sure we get presence // changed events for each local user env.SetPresenceMock(group2TrackedUsers); env.FireDevicePresenceChangeRtaEvent(group2TrackedUsers); size_t presenceChangedEvents{ 0 }; size_t expectedEvents{ group2TrackedUsers.size() * 2 }; while (presenceChangedEvents < expectedEvents) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { LOGS_DEBUG << affectedUser->xboxUserId; VERIFY_IS_TRUE(affectedUser->presenceRecord.userState == XblPresenceUserState::Offline); presenceChangedEvents++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(presenceChangedEvents, expectedEvents); std::set<uint64_t> updatedXuids{ group2TrackedUsers.begin(), group2TrackedUsers.end() }; // Verify both group views are updated as well for (auto& user : env.GetUsers(user1Group)) { if (updatedXuids.find(user->xboxUserId) == updatedXuids.end()) { VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Online); } else { VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Offline); } } for (auto& user : env.GetUsers(user2Group)) { VERIFY_IS_TRUE(user->presenceRecord.userState == XblPresenceUserState::Offline); } VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(user1Group)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(user2Group)); } DEFINE_TEST_CASE(TestAddRemoveLocalUser) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); // Tests race condition in adding then removing a local user before adding is complete VERIFY_SUCCEEDED(XblSocialManagerAddLocalUser(xboxLiveContext->User().Handle(), XblSocialManagerExtraDetailLevel::NoExtraDetail, nullptr)); VERIFY_SUCCEEDED(XblSocialManagerRemoveLocalUser(xboxLiveContext->User().Handle())); VERIFY_ARE_EQUAL(XblSocialManagerGetLocalUserCount(), 0u); env.AddLocalUser(xboxLiveContext->User()); VERIFY_ARE_EQUAL(XblSocialManagerGetLocalUserCount(), 1u); } DEFINE_TEST_CASE(TestSocialRelationshipChangedRtaUpdate) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &group )); size_t expectedGroupSize{ env.FollowedXuids.size() }; env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 1} }); VERIFY_ARE_EQUAL_INT(expectedGroupSize, env.GetUsersCount(group)); // Fire social relationship added event. Expected group size should grow by 1. uint64_t addedXuid{ 101 }; env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Added, addedXuid); expectedGroupSize++; bool userAddedToGraph{ false }; while (!userAddedToGraph) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::UsersAddedToSocialGraph: { VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, addedXuid); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); userAddedToGraph = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(expectedGroupSize, env.GetUsersCount(group)); uint64_t changedXuid{ 1 }; env.SetPeoplehubMock(true, true); env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Changed, changedXuid); auto relationshipChangedEventFound{ false }; while (!relationshipChangedEventFound) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialRelationshipsChanged: { VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, changedXuid); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); relationshipChangedEventFound = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(expectedGroupSize, env.GetUsersCount(group)); // Fire social relationship removed event. Expected group size should decrease by 1. uint64_t removedXuid{ 2 }; env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Removed, removedXuid); expectedGroupSize--; bool userRemovedFromGraph{ false }; // Since the user is being removed from the graph, there will never be social relationship changed event in this case. // If the user was removed as a friend but was remaining in the graph (i.e. they are tracked by a list group), we would // receive the social relationship changed event instead. while (!userRemovedFromGraph) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::UsersRemovedFromSocialGraph: { // User should be removed from graph if they are removed as a friend VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, removedXuid); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); userRemovedFromGraph = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(expectedGroupSize, env.GetUsersCount(group)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group)); } DEFINE_TEST_CASE(TestListGroupWithSocialRelationshipChanged) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle friendsGroup{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &friendsGroup )); // Create a list group with a user who we aren't friends with uint64_t listXuid{ 101 }; env.SetPeoplehubMock(true, false, false); XblSocialManagerUserGroupHandle listGroup{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromList( xboxLiveContext->User().Handle(), &listXuid, 1, &listGroup )); size_t groupsLoaded{ 0 }; while (groupsLoaded < 2) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == friendsGroup || event->groupAffected == listGroup); groupsLoaded++; break; } case XblSocialManagerEventType::UsersAddedToSocialGraph: { VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, listXuid); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } auto expectedFriendsSize{ env.FollowedXuids.size() }; VERIFY_ARE_EQUAL(2u, groupsLoaded); VERIFY_ARE_EQUAL(1u, env.GetUsersCount(listGroup)); VERIFY_ARE_EQUAL(expectedFriendsSize, env.GetUsersCount(friendsGroup)); // Fire social relationship added event. Friends group size should grow by 1. env.SetPeoplehubMock(true, false, true); env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Added, listXuid); expectedFriendsSize++; bool relationshipChanged{ false }; while (!relationshipChanged) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialRelationshipsChanged: { VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, listXuid); VERIFY_IS_TRUE(event->usersAffected[0]->isFollowedByCaller == true); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); relationshipChanged = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(expectedFriendsSize, env.GetUsersCount(friendsGroup)); // Fire social relationship removed event. Expected group size should decrease by 1. env.SetPeoplehubMock(true, false, false); env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Removed, listXuid); expectedFriendsSize--; relationshipChanged = false; while (!relationshipChanged) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialRelationshipsChanged: { VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, listXuid); VERIFY_IS_TRUE(event->usersAffected[0]->isFollowedByCaller == false); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); relationshipChanged = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(expectedFriendsSize, env.GetUsersCount(friendsGroup)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(friendsGroup)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(listGroup)); } DEFINE_TEST_CASE(TestFilterGroupChanges) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::TitleOnline, XblRelationshipFilter::Friends, &group )); env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 1} }); auto expectedGroupSize{ env.FollowedXuids.size() }; VERIFY_ARE_EQUAL_INT(expectedGroupSize, env.GetUsersCount(group)); // Make half the users go offline std::vector<uint64_t> usersToGoOffline{ env.FollowedXuids.begin(), env.FollowedXuids.begin() + env.FollowedXuids.size() / 2 }; env.SetPresenceMock(usersToGoOffline); env.FireDevicePresenceChangeRtaEvent(usersToGoOffline); expectedGroupSize -= usersToGoOffline.size(); size_t presenceChangedEvents{ 0 }; size_t expectedEvents{ usersToGoOffline.size() }; while (presenceChangedEvents < expectedEvents) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(affectedUser->presenceRecord.userState == XblPresenceUserState::Offline); presenceChangedEvents++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(expectedEvents, presenceChangedEvents); VERIFY_ARE_EQUAL(expectedGroupSize, env.GetUsersCount(group)); VERIFY_ARE_EQUAL(expectedGroupSize, env.GetTrackedUsersCount(group)); } DEFINE_TEST_CASE(TestMultipleListGroups) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); // Set mock for non-friends env.SetPeoplehubMock(true, false, false); // Create a list group that doesn't overlap with our friends at all. Five new users should be added to the graph std::set<uint64_t> trackedXuids1{ 101, 102, 103, 104, 105 }; XblSocialManagerUserGroupHandle group1{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromList( xboxLiveContext->User().Handle(), std::vector<uint64_t>{ trackedXuids1.begin(), trackedXuids1.end() }.data(), trackedXuids1.size(), &group1 )); VERIFY_ARE_EQUAL(trackedXuids1.size(), env.GetTrackedUsersCount(group1)); auto groupLoaded{ false }; size_t usersAddedToGraph{ 0 }; while (!groupLoaded || usersAddedToGraph < trackedXuids1.size()) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == group1); groupLoaded = true; break; } case XblSocialManagerEventType::UsersAddedToSocialGraph: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(trackedXuids1.find(affectedUser->xboxUserId) != trackedXuids1.end()); VERIFY_IS_TRUE(affectedUser->isFollowedByCaller == false); usersAddedToGraph++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(trackedXuids1.size(), env.GetUsersCount(group1)); // Create a second group with partial graph overlap. No new users should be added to graph. std::vector<uint64_t> trackedXuids2{ 1, 2, 3, 4, 5, 101, 102, 103, 104, 105 }; XblSocialManagerUserGroupHandle group2{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromList( xboxLiveContext->User().Handle(), trackedXuids2.data(), trackedXuids2.size(), &group2 )); groupLoaded = false; while (!groupLoaded) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == group2); groupLoaded = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(trackedXuids2.size(), env.GetUsersCount(group2)); // Validate that users remain in graph after their social status changes, until the list group is also // destroyed (they are also part of list group1). // Fire social relationship removed event. uint64_t removedXuid{ 1 }; env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Removed, removedXuid); bool socialRelationshipChanged{ false }; while (!socialRelationshipChanged) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialRelationshipsChanged: { VERIFY_IS_TRUE(event->usersAffected[0]->xboxUserId == removedXuid); VERIFY_IS_TRUE(event->usersAffected[0]->isFollowedByCaller == false); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); socialRelationshipChanged = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } // Destroying group2 should cause 1 user to new be removed from the graph (the remainder are either // friends or part of group1 as well) VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group2)); size_t usersRemoved{ 0 }; while (usersRemoved < 1) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::UsersRemovedFromSocialGraph: { // User should be removed from graph if they are removed as a friend VERIFY_ARE_EQUAL_INT(event->usersAffected[0]->xboxUserId, removedXuid); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); usersRemoved++; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } // Test updating group1. This should cause the previous tracked users to be removed from the graph and the new ones to be added. std::set<uint64_t> newTrackedXuids1{ 106, 107 }; VERIFY_SUCCEEDED(XblSocialManagerUpdateSocialUserGroup( group1, std::vector<uint64_t>{ newTrackedXuids1.begin(), newTrackedXuids1.end() }.data(), newTrackedXuids1.size() )); VERIFY_ARE_EQUAL(newTrackedXuids1.size(), env.GetTrackedUsersCount(group1)); auto groupUpdated{ false }; size_t usersRemovedFromGraph{ 0 }; usersAddedToGraph = 0; while (!groupUpdated || usersAddedToGraph < newTrackedXuids1.size() || usersRemovedFromGraph < trackedXuids1.size()) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupUpdated: { VERIFY_IS_TRUE(event->groupAffected == group1); groupUpdated = true; break; } case XblSocialManagerEventType::UsersAddedToSocialGraph: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(newTrackedXuids1.find(affectedUser->xboxUserId) != newTrackedXuids1.end()); usersAddedToGraph++; } } break; } case XblSocialManagerEventType::UsersRemovedFromSocialGraph: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(trackedXuids1.find(affectedUser->xboxUserId) != trackedXuids1.end()); usersRemovedFromGraph++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(newTrackedXuids1.size(), env.GetUsersCount(group1)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group1)); } DEFINE_TEST_CASE(TestSocialUserGroupFromListLarge) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); std::vector<uint64_t> trackedXuids; for (uint64_t xuid = 0; xuid < XBL_SOCIAL_MANAGER_MAX_USERS_FROM_LIST; ++xuid) { trackedXuids.push_back(xuid + 101); // Offset to make unique from our friends } XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromList( xboxLiveContext->User().Handle(), trackedXuids.data(), trackedXuids.size(), &group )); VERIFY_ARE_EQUAL(trackedXuids.size(), env.GetTrackedUsersCount(group)); std::set<uint64_t> trackedXuidsSet{ trackedXuids.begin(), trackedXuids.end() }; auto groupLoaded{ false }; size_t usersAddedToGraph{ 0 }; while (!groupLoaded || usersAddedToGraph < trackedXuids.size()) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == group); groupLoaded = true; break; } case XblSocialManagerEventType::UsersAddedToSocialGraph: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(trackedXuidsSet.find(affectedUser->xboxUserId) != trackedXuidsSet.end()); usersAddedToGraph++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL(trackedXuids.size(), env.GetUsersCount(group)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group)); } // Tests refresh for RTA resync DEFINE_TEST_CASE(TestRtaResync) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &group )); env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 1} }); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(group)); // Make a slight change so we know that the users were refreshed env.SetPeoplehubMock(true, true); MockRealTimeActivityService::Instance().RaiseResync(); size_t profileChangesEvents{ 0 }; while (profileChangesEvents < env.FollowedXuids.size()) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialRelationshipsChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_ARE_EQUAL(affectedUser->isFavorite, true); profileChangesEvents++; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group)); } DEFINE_TEST_CASE(TestInvalidArgs) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); XblUserHandle dummyHandle{ (XblUserHandle)0xFFFFFFFFFFFFFFFF }; XblSocialManagerUserGroupHandle groupHandle{ nullptr }; #pragma warning( push ) #pragma warning( disable : 6387 ) VERIFY_FAILED(XblSocialManagerAddLocalUser(nullptr, XblSocialManagerExtraDetailLevel::NoExtraDetail, nullptr)); VERIFY_FAILED(XblSocialManagerRemoveLocalUser(nullptr)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromFilters(nullptr, XblPresenceFilter::All, XblRelationshipFilter::Friends, &groupHandle)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromFilters(dummyHandle, XblPresenceFilter::All, XblRelationshipFilter::Friends, nullptr)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromList(nullptr, std::vector<uint64_t>{ 0, 1, 2 }.data(), 3, & groupHandle)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromList(dummyHandle, nullptr, 0, &groupHandle)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromList(dummyHandle, std::vector<uint64_t>{ 0, 1, 2 }.data(), 3, nullptr)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromList(dummyHandle, std::vector<uint64_t>(XBL_SOCIAL_MANAGER_MAX_USERS_FROM_LIST + 1, 0).data(), XBL_SOCIAL_MANAGER_MAX_USERS_FROM_LIST + 1, &groupHandle)); VERIFY_FAILED(XblSocialManagerDestroySocialUserGroup(nullptr)); VERIFY_FAILED(XblSocialManagerDoWork(nullptr, nullptr)); #pragma warning( pop ) XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &group )); env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 1} }); VERIFY_FAILED(XblSocialManagerUpdateSocialUserGroup(group, std::vector<uint64_t>{ 0, 1, 2 }.data(), 3)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group)); } #if 0 DEFINE_TEST_CASE(TestImproperCallingPattern) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromFilters(xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &group)); VERIFY_FAILED(XblSocialManagerCreateSocialUserGroupFromList(xboxLiveContext->User().Handle(), std::vector<uint64_t>{ 0, 1, 2 }.data(), 3, & group)); VERIFY_SUCCEEDED(XblSocialManagerAddLocalUser(xboxLiveContext->User().Handle(), XblSocialManagerExtraDetailLevel::All, nullptr)); VERIFY_FAILED(XblSocialManagerAddLocalUser(xboxLiveContext->User().Handle(), XblSocialManagerExtraDetailLevel::All, nullptr)); VERIFY_SUCCEEDED(XblSocialManagerRemoveLocalUser(xboxLiveContext->User().Handle())); VERIFY_FAILED(XblSocialManagerRemoveLocalUser(xboxLiveContext->User().Handle())); } #endif DEFINE_TEST_CASE(TestCreateGroupBeforeUserAddedCompletes) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); // Add user, and before local user is added, create and destroy a group VERIFY_SUCCEEDED(XblSocialManagerAddLocalUser(xboxLiveContext->User().Handle(), XblSocialManagerExtraDetailLevel::NoExtraDetail, nullptr)); XblSocialManagerUserGroupHandle group{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromList(xboxLiveContext->User().Handle(), std::vector<uint64_t>{ 101, 102 }.data(), 2, & group)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(group)); bool localUserAdded{ false }; while (!localUserAdded) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::LocalUserAdded: { localUserAdded = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_SUCCEEDED(XblSocialManagerRemoveLocalUser(xboxLiveContext->User().Handle())); } DEFINE_TEST_CASE(TestSocialRelationshipChangedDuringInitialization) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); // Add user, and before local user is added, receive a social relationship changed notification uint64_t xuidAdded{ 101 }; env.FollowedXuids.push_back(xuidAdded); VERIFY_SUCCEEDED(XblSocialManagerAddLocalUser(xboxLiveContext->User().Handle(), XblSocialManagerExtraDetailLevel::NoExtraDetail, nullptr)); XblSocialManagerUserGroupHandle friendsGroup{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(xboxLiveContext->User().Handle(), XblPresenceFilter::All, XblRelationshipFilter::Friends, &friendsGroup)); env.FireSocialGraphChangedRtaEvent(xboxLiveContext->User(), XblSocialNotificationType::Added, xuidAdded); bool localUserAdded{ false }; bool userAddedToGraph{ false }; while (!localUserAdded || !userAddedToGraph) { auto events{ env.DoWork() }; for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::LocalUserAdded: { localUserAdded = true; break; } // There are two possible orderings in this scenario: if the rta event is processed before the // graph initialization completes, by design, we won't get a UsersAddedToSocialGraph event. However, // in that case, the new user should already be in the friends group when it is loaded. case XblSocialManagerEventType::UsersAddedToSocialGraph: { VERIFY_IS_TRUE(event->usersAffected[0]->xboxUserId == xuidAdded); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); userAddedToGraph = true; break; } case XblSocialManagerEventType::SocialUserGroupLoaded: { VERIFY_IS_TRUE(event->groupAffected == friendsGroup); if (env.GetUsersCount(friendsGroup) == env.FollowedXuids.size()) { userAddedToGraph = true; } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(friendsGroup)); } DEFINE_TEST_CASE(TestFilters) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); auto user{ xboxLiveContext->User().Handle() }; XblSocialManagerUserGroupHandle allFriends, titleOnlineFriends, allFavorites, allOfflineFriends, titleOfflineFriends, allOnlineFriends, allTitleFriends; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::All, XblRelationshipFilter::Friends, &allFriends)); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::TitleOnline, XblRelationshipFilter::Friends, &titleOnlineFriends)); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::All, XblRelationshipFilter::Favorite, &allFavorites)); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::AllOffline, XblRelationshipFilter::Friends, &allOfflineFriends)); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::TitleOffline, XblRelationshipFilter::Friends, &titleOfflineFriends)); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::AllOnline, XblRelationshipFilter::Friends, &allOnlineFriends)); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters(user, XblPresenceFilter::AllTitle, XblRelationshipFilter::Friends, &allTitleFriends)); env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 7} }); // Verify initial user sizes VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(titleOnlineFriends)); VERIFY_ARE_EQUAL_INT(0, env.GetUsersCount(allFavorites)); VERIFY_ARE_EQUAL_INT(0, env.GetUsersCount(allOfflineFriends)); VERIFY_ARE_EQUAL_INT(0, env.GetUsersCount(titleOfflineFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allOnlineFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allTitleFriends)); // Setup a mock that will affect multiple groups: Online->Offline && Followed->Favorite env.SetPeoplehubMock(false, true); uint64_t changedXuid{ 1 }; auto userResult = User::WrapHandle(user); env.FireSocialGraphChangedRtaEvent(userResult.ExtractPayload(), XblSocialNotificationType::Changed, changedXuid); bool profileChanged{ false }; bool presenceChanged{ false }; while (!profileChanged || !presenceChanged) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialRelationshipsChanged: { VERIFY_IS_TRUE(event->usersAffected[0]->xboxUserId == changedXuid); VERIFY_IS_TRUE(event->usersAffected[0]->isFavorite == true); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); profileChanged = true; break; } case XblSocialManagerEventType::PresenceChanged: { VERIFY_IS_TRUE(event->usersAffected[0]->xboxUserId == changedXuid); VERIFY_IS_TRUE(event->usersAffected[0]->presenceRecord.userState == XblPresenceUserState::Offline); VERIFY_IS_TRUE(event->usersAffected[1] == nullptr); presenceChanged = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } // verify groups are affected as expected VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size() - 1, env.GetUsersCount(titleOnlineFriends)); VERIFY_ARE_EQUAL_INT(1, env.GetUsersCount(allFavorites)); VERIFY_ARE_EQUAL_INT(1, env.GetUsersCount(allOfflineFriends)); VERIFY_ARE_EQUAL_INT(1, env.GetUsersCount(titleOfflineFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size() - 1, env.GetUsersCount(allOnlineFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allTitleFriends)); std::vector<uint64_t> offlineXuids{ 1, 2, 3, 4, 5 }; env.SetPresenceMock(offlineXuids); env.FireDevicePresenceChangeRtaEvent(offlineXuids); size_t presenceChangedEvents{ 0 }; while (presenceChangedEvents < offlineXuids.size()) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { VERIFY_IS_TRUE(affectedUser->xboxUserId > 0 && affectedUser->xboxUserId < 6); ++presenceChangedEvents; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size() - offlineXuids.size(), env.GetUsersCount(titleOnlineFriends)); VERIFY_ARE_EQUAL_INT(1, env.GetUsersCount(allFavorites)); VERIFY_ARE_EQUAL_INT(offlineXuids.size(), env.GetUsersCount(allOfflineFriends)); VERIFY_ARE_EQUAL_INT(offlineXuids.size(), env.GetUsersCount(titleOfflineFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size() - offlineXuids.size(), env.GetUsersCount(allOnlineFriends)); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(allTitleFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(allFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(titleOnlineFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(allFavorites)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(allOfflineFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(titleOfflineFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(allOnlineFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(allTitleFriends)); } DEFINE_TEST_CASE(TestRichPresencePolling) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateMockXboxLiveContext(); env.AddLocalUser(xboxLiveContext->User()); XblSocialManagerUserGroupHandle onlineFriends{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( xboxLiveContext->User().Handle(), XblPresenceFilter::AllOnline, XblRelationshipFilter::Friends, &onlineFriends )); env.AwaitEvents({ {XblSocialManagerEventType::SocialUserGroupLoaded, 1} }); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size(), env.GetUsersCount(onlineFriends)); // Change presence mock so we get a PresenceChanged event when it is polled std::vector<uint64_t> offlineUsers{ 1, 2, 3 }; env.SetPresenceMock(offlineUsers); VERIFY_SUCCEEDED(XblSocialManagerSetRichPresencePollingStatus(xboxLiveContext->User().Handle(), true)); size_t presenceChangedEvents{ 0 }; while (presenceChangedEvents < offlineUsers.size()) { auto events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { for (auto affectedUser : event->usersAffected) { if (affectedUser) { ++presenceChangedEvents; } } break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_ARE_EQUAL_INT(offlineUsers.size(), presenceChangedEvents); VERIFY_ARE_EQUAL_INT(env.FollowedXuids.size() - offlineUsers.size(), env.GetUsersCount(onlineFriends)); VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(onlineFriends)); } DEFINE_TEST_CASE(TestEventUserHandleLifetime) { SMTestEnvironment env{}; uint64_t const presenceChangedXuid{ 1 }; std::vector<const XblSocialManagerEvent*> events{}; XblSocialManagerUserGroupHandle groupHandle{ nullptr }; { // Add a user to SocialManager and create a user group but don't hang on to the user handle. // Ensure the user handles returned in all SM events remain valid until the next DoWork call User user{ CreateMockUser(MOCK_XUID) }; env.AddLocalUser(user); VERIFY_SUCCEEDED(XblSocialManagerCreateSocialUserGroupFromFilters( user.Handle(), XblPresenceFilter::AllOnline, XblRelationshipFilter::Friends, &groupHandle )); } bool groupLoaded{ false }; while (!groupLoaded) { events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::SocialUserGroupLoaded: { groupLoaded = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } VERIFY_SUCCEEDED(XblSocialManagerDestroySocialUserGroup(groupHandle)); { // Ensure the user in the event is valid even after destroying the group auto userFromEventResult = User::WrapHandle(events[0]->user); VERIFY_ARE_EQUAL_UINT(MOCK_XUID, userFromEventResult.ExtractPayload().Xuid()); } // Make a user go offline to trigger event env.SetPresenceMock({ presenceChangedXuid }); env.FireDevicePresenceChangeRtaEvent({ presenceChangedXuid }, false); bool presenceChanged{ false }; while (!presenceChanged) { events = env.DoWork(); for (auto event : events) { switch (event->eventType) { case XblSocialManagerEventType::PresenceChanged: { VERIFY_ARE_EQUAL_UINT(presenceChangedXuid, event->usersAffected[0]->xboxUserId); presenceChanged = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } XblUserHandle userHandle{ nullptr }; VERIFY_SUCCEEDED(XblSocialManagerGetLocalUsers(1, &userHandle)); VERIFY_SUCCEEDED(XblSocialManagerRemoveLocalUser(userHandle)); { // Ensure the user handle from the event is still valid after removing the user auto userFromEventResult = User::WrapHandle(events[0]->user); VERIFY_ARE_EQUAL_UINT(MOCK_XUID, userFromEventResult.ExtractPayload().Xuid()); } } DEFINE_TEST_CASE(CppTestBasicCreateFilterGroup) { SMTestEnvironment env{}; auto xboxLiveContext = env.CreateLegacyMockXboxLiveContext(); xbox_live_user_t userHandle = xboxLiveContext->user(); auto socialManager{ social_manager::get_singleton_instance() }; auto addUserResult = socialManager->add_local_user( userHandle, social_manager_extra_detail_level::no_extra_detail ); VERIFY_IS_TRUE(!addUserResult.err()); { // Wait until we get the local_user_added event bool localUserAdded{ false }; while (!localUserAdded) { auto events{ socialManager->do_work() }; for (auto event : events) { switch (event.event_type()) { case social_event_type::local_user_added: { localUserAdded = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } } auto createGroupResult = socialManager->create_social_user_group_from_filters( userHandle, presence_filter::all, relationship_filter::friends ); VERIFY_IS_TRUE(!createGroupResult.err()); auto group = createGroupResult.payload(); bool groupLoaded{ false }; while (!groupLoaded) { auto events{ socialManager->do_work() }; for (auto event : events) { switch (event.event_type()) { case social_event_type::social_user_group_loaded: { auto groupLoadedArgs = static_cast<social_user_group_loaded_event_args*>(event.event_args().get()); VERIFY_IS_TRUE(group == groupLoadedArgs->social_user_group()); groupLoaded = true; break; } default: { LOGS_DEBUG << "Unexpected SocialManager Event"; VERIFY_FAIL(); } } } } auto users{ group->users() }; VERIFY_ARE_EQUAL(group->users_tracked_by_social_user_group().size(), users.size()); for (auto user : users) { // profile tests LOGS_DEBUG << "Validating user " << user->xbox_user_id(); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->display_name()); VERIFY_ARE_EQUAL_STR("http://images-eds.xboxlive.com/image?url=mHGRD8KXEf2sp2LC58XhBQKNl2IWRp.J.q8mSURKUUeiPPf0Y7Kl7zLN7rafayiPptVaX_XIUmNOPotNmNubbx4bHmf6It7Oj1ChU5UAo9k-&background=0xababab&mode=Padding&format=png", user->display_pic_url_raw()); VERIFY_IS_TRUE(user->is_followed_by_caller()); VERIFY_IS_TRUE(user->is_following_user()); VERIFY_ARE_EQUAL_STR("9001", user->gamerscore()); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->gamertag()); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->modern_gamertag()); VERIFY_ARE_EQUAL_STR("", user->modern_gamertag_suffix()); VERIFY_ARE_EQUAL_STR("TestGamerTag", user->unique_modern_gamertag()); VERIFY_IS_FALSE(user->is_favorite()); VERIFY_IS_FALSE(user->use_avatar()); // preferred color tests VERIFY_ARE_EQUAL_STR("193e91", user->preferred_color().primary_color()); VERIFY_ARE_EQUAL_STR("2458cf", user->preferred_color().secondary_color()); VERIFY_ARE_EQUAL_STR("122e6b", user->preferred_color().tertiary_color()); // presence record tests VERIFY_IS_TRUE(user->presence_record().presence_title_records().size()); VERIFY_IS_TRUE(user->presence_record().user_state() == user_presence_state::online); VERIFY_IS_TRUE(user->presence_record().is_user_playing_title(1234)); VERIFY_IS_TRUE(user->presence_record().presence_title_records()[0].is_title_active()); VERIFY_IS_TRUE(!user->presence_record().presence_title_records()[0].is_broadcasting()); VERIFY_IS_TRUE(user->presence_record().presence_title_records()[0].device_type() == presence_device_type::pc); VERIFY_ARE_EQUAL_STR("Home", user->presence_record().presence_title_records()[0].presence_text()); // title history tests VERIFY_IS_TRUE(user->title_history().has_user_played()); VERIFY_IS_TRUE(Utils::TimeTFromDatetime(user->title_history().last_time_user_played()) == utils::TimeTFromDatetime(xbox::services::datetime::from_string("2015-01-26T22:54:54.6630Z", xbox::services::datetime::date_format::ISO_8601))); } auto destroyGroupResult = socialManager->destroy_social_user_group(group); VERIFY_IS_TRUE(!destroyGroupResult.err()); auto removeUserResult = socialManager->remove_local_user(userHandle); VERIFY_IS_TRUE(!removeUserResult.err()); auto events{ socialManager->do_work() }; VERIFY_ARE_EQUAL_INT(events.size(), 1); VERIFY_IS_TRUE(events[0].event_type() == social_event_type::local_user_removed); } }; NAMESPACE_MICROSOFT_XBOX_SERVICES_SYSTEM_CPP_END
40.643033
307
0.576915
natiskan
f75e063d58ff13e699d1a8fdefe505a703811afd
16,165
cpp
C++
archive/stan/src/test/unit/lang/parser/reserved_words_test.cpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
1
2019-09-06T15:53:17.000Z
2019-09-06T15:53:17.000Z
archive/stan/src/test/unit/lang/parser/reserved_words_test.cpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
8
2019-01-17T18:51:16.000Z
2019-01-17T18:51:39.000Z
archive/stan/src/test/unit/lang/parser/reserved_words_test.cpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
null
null
null
#include <gtest/gtest.h> #include <test/unit/lang/utility.hpp> TEST(parserReservedWords, for) { test_throws("reserved/for", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, in) { test_throws("reserved/in", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, while) { test_throws("reserved/while", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, repeat) { test_throws("reserved/repeat", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, until) { test_throws("reserved/until", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, if) { test_throws("reserved/if", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, then) { test_throws("reserved/then", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, else) { test_throws("reserved/else", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, true) { test_throws("reserved/true", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, false) { test_throws("reserved/false", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, int) { test_throws("reserved/int", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, real) { test_throws("reserved/real", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, vector) { test_throws("reserved/vector", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, simplex) { test_throws("reserved/simplex", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, unit_vector) { test_throws("reserved/unit_vector", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, ordered) { test_throws("reserved/ordered", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, positive_ordered) { test_throws("reserved/positive_ordered", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, row_vector) { test_throws("reserved/row_vector", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, matrix) { test_throws("reserved/matrix", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, cholesky_factor_corr) { test_throws("reserved/cholesky_factor_corr", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, cholesky_factor_cov) { test_throws("reserved/cholesky_factor_cov", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, corr_matrix) { test_throws("reserved/corr_matrix", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, cov_matrix) { test_throws("reserved/cov_matrix", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, var) { test_throws("reserved/var", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, fvar) { test_throws("reserved/fvar", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, macro_STAN_MAJOR) { test_throws("reserved/STAN_MAJOR", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, macro_STAN_MINOR) { test_throws("reserved/STAN_MINOR", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, macro_STAN_PATCH) { test_throws("reserved/STAN_PATCH", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, macro_STAN_MATH_MAJOR) { test_throws("reserved/STAN_MATH_MAJOR", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, macro_STAN_MATH_MINOR) { test_throws("reserved/STAN_MATH_MINOR", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, macro_STAN_MATH_PATCH) { test_throws("reserved/STAN_MATH_PATCH", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, alignas) { test_throws("reserved/alignas", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, alignof) { test_throws("reserved/alignof", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, and) { test_throws("reserved/and", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, and_eq) { test_throws("reserved/and_eq", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, asm) { test_throws("reserved/asm", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, auto) { test_throws("reserved/auto", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, bitand) { test_throws("reserved/bitand", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, bitor) { test_throws("reserved/bitor", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, bool) { test_throws("reserved/bool", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, break) { test_throws("reserved/break", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, case) { test_throws("reserved/case", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, catch) { test_throws("reserved/catch", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, char) { test_throws("reserved/char", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, char16_t) { test_throws("reserved/char16_t", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, char32_t) { test_throws("reserved/char32_t", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, class) { test_throws("reserved/class", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, compl) { test_throws("reserved/compl", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, const) { test_throws("reserved/const", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, constexpr) { test_throws("reserved/constexpr", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, const_cast) { test_throws("reserved/const_cast", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, continue) { test_throws("reserved/continue", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, decltype) { test_throws("reserved/decltype", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, default) { test_throws("reserved/default", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, delete) { test_throws("reserved/delete", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, do) { test_throws("reserved/do", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, double) { test_throws("reserved/double", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, dynamic_cast) { test_throws("reserved/dynamic_cast", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, enum) { test_throws("reserved/enum", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, explicit) { test_throws("reserved/explicit", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, export) { test_throws("reserved/export", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, extern) { test_throws("reserved/extern", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, float) { test_throws("reserved/float", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, friend) { test_throws("reserved/friend", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, goto) { test_throws("reserved/goto", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, inline) { test_throws("reserved/inline", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, long) { test_throws("reserved/long", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, mutable) { test_throws("reserved/mutable", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, namespace) { test_throws("reserved/namespace", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, new) { test_throws("reserved/new", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, noexcept) { test_throws("reserved/noexcept", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, not) { test_throws("reserved/not", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, not_eq) { test_throws("reserved/not_eq", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, keyword_nullptr) { test_throws("reserved/nullptr", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, operator) { test_throws("reserved/operator", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, or) { test_throws("reserved/or", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, or_eq) { test_throws("reserved/or_eq", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, private) { test_throws("reserved/private", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, protected) { test_throws("reserved/protected", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, public) { test_throws("reserved/public", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, register) { test_throws("reserved/register", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, reinterpret_cast) { test_throws("reserved/reinterpret_cast", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, return) { test_throws("reserved/return", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, short) { test_throws("reserved/short", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, signed) { test_throws("reserved/signed", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, sizeof) { test_throws("reserved/sizeof", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, static) { test_throws("reserved/static", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, static_assert) { test_throws("reserved/static_assert", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, static_cast) { test_throws("reserved/static_cast", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, struct) { test_throws("reserved/struct", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, switch) { test_throws("reserved/switch", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, template) { test_throws("reserved/template", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, this) { test_throws("reserved/this", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, thread_local) { test_throws("reserved/thread_local", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, throw) { test_throws("reserved/throw", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, try) { test_throws("reserved/try", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, typedef) { test_throws("reserved/typedef", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, typeid) { test_throws("reserved/typeid", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, typename) { test_throws("reserved/typename", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, union) { test_throws("reserved/union", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, unsigned) { test_throws("reserved/unsigned", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, using) { test_throws("reserved/using", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, virtual) { test_throws("reserved/virtual", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, void) { test_throws("reserved/void", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, volatile) { test_throws("reserved/volatile", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, wchar_t) { test_throws("reserved/wchar_t", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, xor) { test_throws("reserved/xor", "Variable identifier (name) may not be reserved word"); } TEST(parserReservedWords, xor_eq) { test_throws("reserved/xor_eq", "Variable identifier (name) may not be reserved word"); }
29.769797
70
0.65815
alashworth
f763f1bf521dac5175d9ae2d4db88093ec0bc8a0
1,357
cc
C++
src/WorkUnits/source/PrintWorkUnitImp.cc
nishantmehta/mainGrokit
eda13cd32d523bfc2af660c34c93a38eceaccc4a
[ "Apache-2.0" ]
null
null
null
src/WorkUnits/source/PrintWorkUnitImp.cc
nishantmehta/mainGrokit
eda13cd32d523bfc2af660c34c93a38eceaccc4a
[ "Apache-2.0" ]
null
null
null
src/WorkUnits/source/PrintWorkUnitImp.cc
nishantmehta/mainGrokit
eda13cd32d523bfc2af660c34c93a38eceaccc4a
[ "Apache-2.0" ]
null
null
null
// // Copyright 2012 Alin Dobra and Christopher Jermaine // // 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 "PrintWorkUnitImp.h" PrintWorkUnitImp :: PrintWorkUnitImp () { data.numTuplesInChunk = -1; data.processChunk = NULL; } PrintWorkUnitImp :: ~PrintWorkUnitImp () { } void PrintWorkUnitImp :: LoadPrintJob (int (*PrintChunk) (Chunk &), Chunk &processMe) { processMe.swap (data.chunkToProcess); data.processChunk = PrintChunk; } int PrintWorkUnitImp :: GetOutput (Chunk &output) { if (data.numTuplesInChunk == -1) { cerr << "You are trying to unload a workunit that has not actually been run.\n"; exit (1); } output.swap (data.chunkToProcess); return data.numTuplesInChunk; } void PrintWorkUnitImp :: Run () { description = "Print"; data.numTuplesInChunk = (*data.processChunk) (data.chunkToProcess); }
29.5
87
0.724392
nishantmehta
f7699a92b2842a5939c50353858f71caf33c71aa
21,800
hpp
C++
include/geometricks/memory/allocator.hpp
mitthy/TCC
4c48eb11cafd50334c5faef93edc5f03bc7fc171
[ "MIT" ]
null
null
null
include/geometricks/memory/allocator.hpp
mitthy/TCC
4c48eb11cafd50334c5faef93edc5f03bc7fc171
[ "MIT" ]
null
null
null
include/geometricks/memory/allocator.hpp
mitthy/TCC
4c48eb11cafd50334c5faef93edc5f03bc7fc171
[ "MIT" ]
null
null
null
#ifndef GEOMETRICKS_MEMORY_ALLOCATOR_HPP #define GEOMETRICKS_MEMORY_ALLOCATOR_HPP #include <type_traits> #include <cstddef> #include "allocator/malloc_allocator.hpp" #include "geometricks/meta/detect.hpp" #include "geometricks/meta/utils.hpp" /** * @file * @brief Implements the allocator concepts used for the data structures of this project. */ namespace geometricks { struct allocator; namespace memory { namespace allocator_customization { /** * @brief Adaptor struct that should be specialized for types that can allocate and deallocate memory but don't conform to the interface of the library. * @tparam T Template parameter that should be specialized. * @details The specialization of this struct should contain at least 1 function to allocate memory and 1 function to deallocate memory. * It can also optionally contain a function to reallocate memory. * Functions to allocate memory should comform to the following interface * @code{.cpp} struct my_allocator_t { ... }; namespace geometricks::memory::allocator_customization { struct allocator<my_allocator_t> { //Can be either this function in case of aligned memory. static void* allocate( my_alloc_t&, size_t, size_t ); //Or this function in case of unaligned memory. static void* allocate( my_alloc_t&, size_t ); ... }; } * @endcode * Functions to deallocate memory should comform to the following interface * @code{.cpp} struct my_allocator_t { ... }; namespace geometricks::memory::allocator_customization { struct allocator<my_allocator_t> { //Can be either this function in case there is a need to know the size of the element. void* deallocate( my_alloc_t&, void*, size_t ); //Or this function otherwise. void deallocate( my_alloc_t&, void* ); ... }; } * @endcode */ template< typename T > struct allocator; } /** * @cond EXCLUDE_DOXYGEN * * Internal not to be documented */ namespace __detail__ { template< typename Allocator > auto __do_allocate_unaligned__( Allocator& allocator, size_t sz, geometricks::meta::priority_tag<0> ) -> decltype( alloc( allocator, sz ) ) { return alloc( allocator, sz ); } template< typename Allocator > auto __do_allocate_unaligned__( Allocator& alloc, size_t sz, geometricks::meta::priority_tag<1> ) -> decltype( allocate( alloc, sz ) ) { return allocate( alloc, sz ); } template< typename Allocator > auto __do_allocate_unaligned__( Allocator& alloc, size_t sz, geometricks::meta::priority_tag<2> ) -> decltype( alloc.alloc( sz ) ) { return alloc.alloc( sz ); } template< typename Allocator > auto __do_allocate_unaligned__( Allocator& alloc, size_t sz, geometricks::meta::priority_tag<3> ) -> decltype( alloc.allocate( sz ) ) { return alloc.allocate( sz ); } template< typename Allocator > auto __do_allocate_unaligned__( Allocator& alloc, size_t sz, geometricks::meta::priority_tag<4> ) -> decltype( allocator_customization::allocator<Allocator>::allocate( alloc, sz ) ) { return allocator_customization::allocator<Allocator>::allocate( alloc, sz ); } template< typename T > using __try_allocate_unalign__ = decltype( __do_allocate_unaligned__( std::declval<T&>(), std::declval<size_t>(), std::declval<meta::priority_tag<4>>() ) ); template< typename T > constexpr bool __can_allocate_unalign__ = meta::is_valid_expression_v<__try_allocate_unalign__, T>; struct __test_allocate_unalign__ { void* alloc( size_t ); }; static_assert( __can_allocate_unalign__<__test_allocate_unalign__> ); static_assert( !__can_allocate_unalign__<int> ); template< typename Allocator > auto __do_allocate_aligned__( Allocator& allocator, size_t sz, size_t align, meta::priority_tag<0> ) -> decltype( alloc( allocator, sz, align ) ) { return alloc( allocator, sz, align ); } template< typename Allocator > auto __do_allocate_aligned__( Allocator& alloc, size_t sz, size_t align, meta::priority_tag<1> ) -> decltype( allocate( alloc, sz, align ) ) { return allocate( alloc, sz, align ); } template< typename Allocator > auto __do_allocate_aligned__( Allocator& alloc, size_t sz, size_t align, meta::priority_tag<2> ) -> decltype( alloc.alloc( sz, align ) ) { return alloc.alloc( sz, align ); } template< typename Allocator > auto __do_allocate_aligned__( Allocator& alloc, size_t sz, size_t align, meta::priority_tag<3> ) -> decltype( alloc.allocate( sz, align ) ) { return alloc.allocate( sz, align ); } template< typename Allocator > auto __do_allocate_aligned__( Allocator& alloc, size_t sz, size_t align, meta::priority_tag<4> ) -> decltype( allocator_customization::allocator<Allocator>::allocate( alloc, sz, align ) ) { return allocator_customization::allocator<Allocator>::allocate( alloc, sz, align ); } template< typename T > using __try_allocate_align__ = decltype( __do_allocate_aligned__( std::declval<T&>(), std::declval<size_t>(), std::declval<size_t>(), std::declval<meta::priority_tag<4>>() ) ); template< typename T > constexpr bool __can_allocate_align__ = meta::is_valid_expression_v<__try_allocate_align__, T>; struct __test_allocate_align__ { void* alloc( size_t, size_t ); }; static_assert( __can_allocate_align__<__test_allocate_align__> ); static_assert( !__can_allocate_align__<__test_allocate_unalign__> ); template< typename Allocator > auto __do_deallocate_unaligned__( Allocator& allocator, void* ptr, meta::priority_tag<0> ) -> decltype( dealloc( allocator, ptr ) ) { return dealloc( allocator, ptr ); } template< typename Allocator > auto __do_deallocate_unaligned__( Allocator& allocator, void* ptr, meta::priority_tag<1> ) -> decltype( deallocate( allocator, ptr ) ) { return deallocate( allocator, ptr ); } template< typename Allocator > auto __do_deallocate_unaligned__( Allocator& allocator, void* ptr, meta::priority_tag<2> ) -> decltype( allocator.dealloc( ptr ) ) { return allocator.dealloc( ptr ); } template< typename Allocator > auto __do_deallocate_unaligned__( Allocator& allocator, void* ptr, meta::priority_tag<3> ) -> decltype( allocator.deallocate( ptr ) ) { return allocator.deallocate( ptr ); } template< typename Allocator > auto __do_deallocate_unaligned__( Allocator& allocator, void* ptr, meta::priority_tag<4> ) -> decltype( allocator_customization::allocator<Allocator>::deallocate( allocator, ptr ) ) { return allocator_customization::allocator<Allocator>::deallocate( allocator, ptr ); } template< typename T > using __try_deallocate_unalign__ = decltype( __do_deallocate_unaligned__( std::declval<T&>(), std::declval<void*>(), std::declval<meta::priority_tag<4>>() ) ); template< typename T > constexpr bool __can_deallocate_unalign__ = meta::is_valid_expression_v<__try_deallocate_unalign__, T>; struct __test_deallocate_unalign__ { void dealloc( void* ); }; static_assert( __can_deallocate_unalign__<__test_deallocate_unalign__> ); static_assert( !__can_deallocate_unalign__<int> ); template< typename Allocator > auto __do_deallocate_size__( Allocator& allocator, void* ptr, size_t size, meta::priority_tag<0> ) -> decltype( dealloc( allocator, ptr, size ) ) { return dealloc( allocator, ptr, size ); } template< typename Allocator > auto __do_deallocate_size__( Allocator& allocator, void* ptr, size_t size, meta::priority_tag<1> ) -> decltype( deallocate( allocator, ptr, size ) ) { return deallocate( allocator, ptr, size ); } template< typename Allocator > auto __do_deallocate_size__( Allocator& allocator, void* ptr, size_t size, meta::priority_tag<2> ) -> decltype( allocator.dealloc( ptr, size ) ) { return allocator.dealloc( ptr, size ); } template< typename Allocator > auto __do_deallocate_size__( Allocator& allocator, void* ptr, size_t size, meta::priority_tag<3> ) -> decltype( allocator.deallocate( ptr, size ) ) { return allocator.deallocate( ptr, size ); } template< typename Allocator > auto __do_deallocate_size__( Allocator& allocator, void* ptr, size_t size, meta::priority_tag<4> ) -> decltype( allocator_customization::allocator<Allocator>::deallocate( allocator, ptr, size ) ) { return allocator_customization::allocator<Allocator>::deallocate( allocator, ptr, size ); } template< typename T > using __try_deallocate_align__ = decltype( __do_deallocate_size__( std::declval<T&>(), std::declval<void*>(), std::declval<size_t>(), std::declval<meta::priority_tag<4>>() ) ); template< typename T > constexpr bool __can_deallocate_size__ = meta::is_valid_expression_v<__try_deallocate_align__, T>; struct __test_deallocate_align__ { void dealloc( void*, size_t ); }; static_assert( __can_deallocate_size__<__test_deallocate_align__> ); static_assert( !__can_deallocate_size__<__test_deallocate_unalign__> ); template< typename T > constexpr bool __can_allocate__ = __can_allocate_align__<T> || __can_allocate_unalign__<T>; template< typename T > constexpr bool __can_deallocate__ = __can_deallocate_size__<T> || __can_deallocate_unalign__<T>; static_assert( __can_allocate__<malloc_allocator_t> ); static_assert( __can_deallocate__<malloc_allocator_t> ); constexpr auto __allocate__ = []( auto& alloc, size_t sz, size_t align ) { using alloc_t = std::decay_t<decltype(alloc)>; if constexpr( __can_allocate_align__<alloc_t> ) { return __do_allocate_aligned__( alloc, sz, align, meta::priority_tag<4>{} ); } else { static_assert( __can_allocate_unalign__<alloc_t> ); ( void ) align; return __do_allocate_unaligned__( alloc, sz, meta::priority_tag<4>{} ); } }; constexpr auto __deallocate__ = []( auto& alloc, void* ptr, size_t size ) { using alloc_t = std::decay_t<decltype(alloc)>; if constexpr( __can_deallocate_size__<alloc_t> ) { __do_deallocate_size__( alloc, ptr, size, meta::priority_tag<4>{} ); } else { static_assert( __can_deallocate_unalign__<alloc_t> ); ( void ) size; __do_deallocate_unaligned__( alloc, ptr, meta::priority_tag<4>{} ); } }; } /** * @endcond * */ /** * @brief A variable that indicates whenever a type is an allocator or not. * @tparam T The type to query. * @details A type is considered an allocator if it can both allocate and deallocate memory. * For the memory allocation part, a type must either have a member allocate or alloc function or it must have non members allocate or alloc functions. * Those functions should allocate either with 2 parameters, the size and alignment of the allocation or just the size of the allocation. * In case no such functions exist, see geometricks::memory::allocator_customization::alocator. * * For the memory deallocation part, a type must either have a member deallocate or dealloc function or it must have non members deallocate or dealloc functions. * Those functions should deallocate either with 2 parameters, the pointer and size of the deallocation or just the pointer to deallocate. * In case no such functions exist, see geometricks::memory::allocator_customization::alocator. */ template< typename T > constexpr bool is_allocator = __detail__::__can_allocate__<T> && __detail__::__can_deallocate__<T>; /** * @cond EXCLUDE_DOXYGEN * * Internal not to be documented */ namespace __detail__ { struct __v_table_for_allocator__ final { using __allocate_t__ = void*( void*, size_t, size_t ); using __deallocate_t__ = void( void*, void*, size_t ); __allocate_t__* __allocate__; __deallocate_t__* __deallocate__; }; template< typename T > __v_table_for_allocator__* __make_v_table__() noexcept { static __v_table_for_allocator__ table = { []( void* ptr, size_t sz, size_t align ) { return __detail__::__allocate__( *static_cast<T*>( ptr ), sz, align ); }, []( void* ptr, void* obj, size_t size ) { __detail__::__deallocate__( *static_cast<T*>( ptr ), obj, size ); } }; return &table; } static void* __default_allocator__ = &malloc_allocator; static __v_table_for_allocator__* __default_v_table__ = __make_v_table__<malloc_allocator_t>(); } /** * @endcond */ allocator get_default_allocator(); /** * @brief Sets the default allocator type. * @tparam T A type that must conform to the allocator interface. See @ref is_allocator. * @param alloc The allocator we want to set as the default allocator. * @details Sets the default allocator to be used by all default constructed geometricks::allocator. * Since all allocators are implemented as views, be extra careful not to make the default allocator end its lifetime prematurely * or terrible things could happen. This function can also be used to temporarely change the default allocator back and forth. * Example: * @code{.cpp} struct stack_allocator_t { ... }; //Allocates objects on the stack auto current_default = geometricks::memory::get_default_allocator(); stack_allocator_t stack_alloc{}; geometricks::memory::set_default_allocator( stack_alloc ); //DANGER! MAKE SURE TO SET THE DEFAULT ALLOCATOR BACK OR FACE THE CONSEQUENCES!!!! std::vector<std::tuple<float,int,double>> input_vector; ... geometricks::kd_tree<std::tuple<float,int,double>> tree( input_vector.begin(), input_vector.end() ); //KD Tree memory is entirely on the stack now. //Note the same effect could be used just passing the stack allocator to the tree constructor in this case. ... geometricks::memory::set_default_allocator( current_default ); //WE'RE SAVED! * @endcode * @note The default allocator on startup is set to @ref geometricks::memory::malloc_allocator_t "malloc_allocator". */ template< typename T > void set_default_allocator( T& alloc ); void set_default_allocator( allocator& allocator ); } /** * @brief Type erased view to an external allocator. * @details This class doesn't own the actual allocator. Instead, it is used as a view to an external allocator and stored in the data structures of this project. * This way, the allocator should ALWAYS have at least the same object lifetime as the data structure. Not doing so results in undefined behavior. * An allocator is defined as anything that can allocate raw bytes of memory with either of 2 signatures: it either allocates a size of memory or a size of aligned memory. * Example: * @code{.cpp} struct my_aligned_alloc { void* allocate( size_t size, size_t align ); }; struct my_alloc { void* allocate( size_t size ); }; * @endcode * In case both functions are supported, it always picks the aligned one. * For that, the type must either supply an allocate function or an alloc function or an allocate free function that takes a reference to the type as the first parameter * or an alloc free function that takes a reference to the type as the first parameter. If none are supplied, see geometricks::memory::allocator_customization::allocator. * Optionally, it is also possible the same way to supply a reallocate function, for the cases it is prefered to reallocate memory. * Note that supplying an allocate function is not enough, as the type must also know how to deallocate memory for it to work. * For the deallocate functions, you can either supply a deallocate function taking a void* or a deallocate function taking a void* and a size_t. * Example: * @code{.cpp} struct my_complete_alloc { void* allocate( size_t size ); void deallocate( void* ); }; struct my_complete_aligned_alloc_with_size { void* allocate( size_t size, size_t align ); void deallocate( void* ptr, size_t size ); }; * @endcode * In case both functions are supported, it picks the size one. * The type must either supply a deallocate function or a dealloc function. If it doesn't, it can also work with deallocate or dealloc free functions taking a reference to * the type as the first parameter. If none are supplied, see geometricks::memory::allocator_customization::allocator. * @todo Work on realloc documentation. */ struct allocator final { /** * @brief Default constructs an allocator view, using the default allocator as the allocator. * @see @ref geometricks::memory::set_default_allocator(). * @see @ref geometricks::memory::get_default_allocator(). */ allocator(): m_allocator( memory::__detail__::__default_allocator__ ), m_table( memory::__detail__::__default_v_table__ ) { } /** * @brief Constructs a view to an allocator. * @tparam Allocator A type that conforms to the allocator interface. * @param alloc The allocator itself. * @note This is not the copy constructor. */ template< typename Allocator, typename Void = std::enable_if_t< !std::is_same_v< std::decay_t<Allocator>, allocator > > > allocator( Allocator& alloc ): m_allocator( ( void* ) &alloc ), m_table( memory::__detail__::__make_v_table__<Allocator>() ) { static_assert( memory::is_allocator<Allocator> ); } /** * @brief Constructs a view from another view, with both of them pointing to the same allocator. */ allocator( const allocator& other ): m_allocator( other.m_allocator ), m_table( other.m_table ) { } friend allocator memory::get_default_allocator(); friend void memory::set_default_allocator( allocator& allocator ); /** * @brief Allocates aligned memory. * @param sz The size of the allocation. * @param align The alignment of the allocation. * @returns Aligned raw bytes of memory of size sz. */ void* allocate( size_t sz, size_t align = alignof( std::max_align_t ) ) { return m_table->__allocate__( m_allocator, sz, align ); } /** * @brief Deallocates memory. * @param ptr Pointer to memory we want to deallocate. * @param size Size of the allocation. Useful for allocators like multipool allocators. */ void deallocate( void* ptr, size_t size = 0 ) { m_table->__deallocate__( m_allocator, ptr, size ); } /** * @brief Compares the view to an allocator. * @tparam Allocator A type that conforms to the allocator interface. * @param alloc The allocator. * @returns true if the view points to the allocator. false otherwise. */ template< typename Allocator > bool operator==( const Allocator& alloc ) const { static_assert( memory::is_allocator<Allocator> ); //TODO: pass it to the correct type, maybe? return m_allocator == ( void* )( &alloc ); } /** * @brief Compares 2 views to allocators. * @param other The other allocator. * @returns true if both views point to the same allocator. false otherwise. */ bool operator==( const allocator& other ) const { return m_allocator == other.m_allocator; } private: allocator( void* ptr, memory::__detail__::__v_table_for_allocator__* table ): m_allocator( ptr ), m_table( table ) { } void* m_allocator; memory::__detail__::__v_table_for_allocator__* m_table; }; /** * @brief Free function for allocate. * @see geometricks::memory::allocate( size_t, size_t ). */ void* allocate( allocator& alloc, size_t sz, size_t align = alignof( std::max_align_t ) ) { return alloc.allocate( sz, align ); } /** * @brief Free function for deallocate. * @see geometricks::memory::deallocate( void*, size_t ). */ void deallocate( allocator& alloc, void* ptr, size_t size = 0 ) { alloc.deallocate( ptr, size ); } namespace memory { /** * @brief Returns the default allocator. * @returns A view to the default allocator set by @ref set_default_allocator(). If none was set, returns the operator new allocator. * @details After a call to @ref set_default_allocator(), returns a geometricks::allocator view to the default allocator. * @note The default allocator at program startup is always set to operator new. * @see geometricks::memory::malloc_allocator_t. */ allocator get_default_allocator() { return allocator{ __detail__::__default_allocator__, __detail__::__default_v_table__ }; } template< typename T > void set_default_allocator( T& allocator ) { static_assert( is_allocator<T> ); __detail__::__default_allocator__ = ( void* ) &allocator; __detail__::__default_v_table__ = __detail__::__make_v_table__<T>(); } void set_default_allocator( allocator& allocator ) { __detail__::__default_allocator__ = allocator.m_allocator; __detail__::__default_v_table__ = allocator.m_table; } } } #endif //GEOMETRICKS_MEMORY_ALLOCATOR_HPP
41.287879
203
0.683945
mitthy
f76e76ddcdddd4bb79a06fa86ec1653b751b9a49
343
hpp
C++
TFHE/include/keyswitch.hpp
dikosec/seccamp
53956752e19d24f5cd80a12f3d9aa4a6675849ad
[ "MIT" ]
2
2020-10-28T08:40:40.000Z
2021-03-04T12:51:57.000Z
TFHE/include/keyswitch.hpp
dikosec/seccamp
53956752e19d24f5cd80a12f3d9aa4a6675849ad
[ "MIT" ]
null
null
null
TFHE/include/keyswitch.hpp
dikosec/seccamp
53956752e19d24f5cd80a12f3d9aa4a6675849ad
[ "MIT" ]
null
null
null
#pragma onece #include<array> #include<random> #include<vector> #include<../include/params.hpp> #include<../include/tfhe++.hpp> namespace myTFHE{ //void gen_Key_Switching_Key(KeySwitchingKey &ksk,const lwekeylvl1 &keylvl1, const lwekeylvl0 &keylvl0); void Id_Key_Switch(TLWElvl0 &res_tlwe0,const TLWElvl1 tlwe1,const GateKey &gk); }
26.384615
108
0.760933
dikosec
f76f268cfb8af70590ee8bb288449133668df1da
1,084
hh
C++
psdaq/psdaq/hsd/PV64Ctrls.hh
AntoineDujardin/lcls2
8b9d2815497fbbabb4d37800fd86a7be1728b552
[ "BSD-3-Clause-LBNL" ]
null
null
null
psdaq/psdaq/hsd/PV64Ctrls.hh
AntoineDujardin/lcls2
8b9d2815497fbbabb4d37800fd86a7be1728b552
[ "BSD-3-Clause-LBNL" ]
null
null
null
psdaq/psdaq/hsd/PV64Ctrls.hh
AntoineDujardin/lcls2
8b9d2815497fbbabb4d37800fd86a7be1728b552
[ "BSD-3-Clause-LBNL" ]
null
null
null
#ifndef Hsd_PV64Ctrls_hh #define Hsd_PV64Ctrls_hh #include <string> #include <vector> namespace Pds_Epics { class EpicsPVA; }; namespace Pds { class Task; namespace HSD { class Module64; enum Action { Configure, Unconfigure, Reset, ConfigureA, ConfigureB }; enum State { InTransition=0, Configured=1, Unconfigured=2 }; class PV64Ctrls { public: PV64Ctrls(Module64&, Pds::Task&); ~PV64Ctrls(); public: void allocate(const std::string& title); void update(); void call (Action); public: Module64& module(); public: void configure (); void configure (unsigned); void enable (); void disable (); void reset (); void loopback (bool); public: static void interleave(bool); private: void _setState(State); private: std::vector<Pds_Epics::EpicsPVA*> _pv; Pds_Epics::EpicsPVA* _state_pv; Pds_Epics::EpicsPVA* _readyA; Pds_Epics::EpicsPVA* _readyB; Module64& _m; Pds::Task& _task; }; }; }; #endif
20.846154
74
0.608856
AntoineDujardin
f76f381d9e8a0fd65e1fbb8ac24360a888f53a1b
259
cpp
C++
atcoder/abc040/a.cpp
L3Sota/atcoder
7d9444e03837b537ebc6f4f917b9567af6cf5483
[ "MIT" ]
null
null
null
atcoder/abc040/a.cpp
L3Sota/atcoder
7d9444e03837b537ebc6f4f917b9567af6cf5483
[ "MIT" ]
null
null
null
atcoder/abc040/a.cpp
L3Sota/atcoder
7d9444e03837b537ebc6f4f917b9567af6cf5483
[ "MIT" ]
null
null
null
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific using namespace std; int main(void) { int n, x; cin >> n >> x; int front = x - 1; int back = n - x; cout << (front < back ? front : back) << endl; return 0; }
19.923077
89
0.625483
L3Sota
f770e75b722942ceb765d53012a452b8f6490db6
26,065
cpp
C++
tests/unittests/ClassTests.cpp
lijinpei/slang
6871972976e099f5a43d5e49139e06d5f485fe2f
[ "MIT" ]
null
null
null
tests/unittests/ClassTests.cpp
lijinpei/slang
6871972976e099f5a43d5e49139e06d5f485fe2f
[ "MIT" ]
null
null
null
tests/unittests/ClassTests.cpp
lijinpei/slang
6871972976e099f5a43d5e49139e06d5f485fe2f
[ "MIT" ]
null
null
null
#include "Test.h" #include "slang/symbols/ClassSymbols.h" static constexpr const char* PacketClass = R"( class Packet; bit [3:0] command; bit [40:0] address; bit [4:0] master_id; integer time_requested; integer time_issued; integer status; typedef enum { ERR_OVERFLOW = 10, ERR_UNDERFLOW = 1123} PCKT_TYPE; const integer buffer_size = 100; parameter int bar = 99; function new(); command = 4'd0; address = 41'b0; master_id = 5'bx; endfunction : new task clean(); command = 0; address = 0; master_id = 5'bx; endtask task issue_request( integer status ); this.status = status; endtask function integer current_status(); current_status = status; endfunction endclass : Packet )"; TEST_CASE("Basic class") { auto tree = SyntaxTree::fromText(PacketClass); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Class handle expressions") { Compilation compilation; auto& scope = compilation.createScriptScope(); auto declare = [&](const std::string& source) { auto tree = SyntaxTree::fromText(string_view(source)); scope.getCompilation().addSyntaxTree(tree); scope.addMembers(tree->root()); }; auto typeof = [&](const std::string& source) { auto tree = SyntaxTree::fromText(string_view(source)); BindContext context(scope, LookupLocation::max, BindFlags::ProceduralStatement); return Expression::bind(tree->root().as<ExpressionSyntax>(), context).type->toString(); }; declare(PacketClass + "\nPacket p;"s); CHECK(typeof("p") == "Packet"); CHECK(typeof("p == p") == "bit"); CHECK(typeof("p !== p") == "bit"); CHECK(typeof("(p = null)") == "Packet"); CHECK(typeof("(p = p)") == "Packet"); CHECK(typeof("1 ? p : p") == "Packet"); CHECK(typeof("p.buffer_size") == "integer"); CHECK(typeof("p.current_status()") == "integer"); CHECK(typeof("p.clean") == "void"); CHECK(typeof("p.ERR_OVERFLOW") == "enum{ERR_OVERFLOW=32'sd10,ERR_UNDERFLOW=32'sd1123}Packet::e$1"); CHECK(typeof("p.bar") == "int"); NO_COMPILATION_ERRORS; } TEST_CASE("Class qualifier error checking") { auto tree = SyntaxTree::fromText(R"( class C; const static const int i = 4; protected local int j; const randc int l = 6; virtual pure function foo1; local extern function foo2; pure function foo3; pure local function foo4; virtual static function foo5; endfunction virtual int m; static automatic int n; static var static int o; const function foo5; endfunction static task static foo6; endtask static parameter int x = 4; import p::*; // This should be fine pure virtual protected function func1; // Invalid qualifiers for constructors static function new(); endfunction virtual function new(); endfunction // Qualifiers on out-of-block decl static function foo::bar(); endfunction // Scoped name for prototype. extern function foo::baz(); protected parameter int z = 4; pure virtual function new(); endclass static function C::bar(); endfunction )"); auto& diags = tree->diagnostics(); REQUIRE(diags.size() == 22); CHECK(diags[0].code == diag::DuplicateQualifier); CHECK(diags[1].code == diag::QualifierConflict); CHECK(diags[2].code == diag::QualifierConflict); CHECK(diags[3].code == diag::QualifierNotFirst); CHECK(diags[4].code == diag::QualifierNotFirst); CHECK(diags[5].code == diag::PureRequiresVirtual); CHECK(diags[6].code == diag::PureRequiresVirtual); CHECK(diags[7].code == diag::QualifierConflict); CHECK(diags[8].code == diag::InvalidPropertyQualifier); CHECK(diags[9].code == diag::QualifierConflict); CHECK(diags[10].code == diag::DuplicateQualifier); CHECK(diags[11].code == diag::InvalidMethodQualifier); CHECK(diags[12].code == diag::MethodStaticLifetime); CHECK(diags[13].code == diag::InvalidQualifierForMember); CHECK(diags[14].code == diag::NotAllowedInClass); CHECK(diags[15].code == diag::InvalidQualifierForConstructor); CHECK(diags[16].code == diag::InvalidQualifierForConstructor); CHECK(diags[17].code == diag::QualifiersOnOutOfBlock); CHECK(diags[18].code == diag::MethodPrototypeScoped); CHECK(diags[19].code == diag::InvalidQualifierForMember); CHECK(diags[20].code == diag::InvalidQualifierForConstructor); CHECK(diags[21].code == diag::QualifiersOnOutOfBlock); } TEST_CASE("Class typedefs") { auto tree = SyntaxTree::fromText(R"( typedef class C; module m; C c; initial c.baz = 1; endmodule class C; int baz; local typedef foo; protected typedef bar; typedef int foo; // error, visibility must match protected typedef int bar; endclass class D; endclass typedef class D; typedef class D; )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 1); CHECK(diags[0].code == diag::ForwardTypedefVisibility); } TEST_CASE("Class instances") { auto tree = SyntaxTree::fromText(R"( class C; int foo = 4; function void frob(int i); foo += i; endfunction endclass module m; initial begin automatic C c = new; c.foo = 5; c.frob(3); c = new; end endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Classes disallowed in constant contexts") { auto tree = SyntaxTree::fromText(R"( class C; int foo = 4; function int frob(int i); return i + foo; endfunction parameter int p = 4; enum { ASDF = 5 } asdf; endclass module m; localparam C c1 = new; localparam int i = c1.foo; localparam int j = c1.frob(3); localparam int k = c1.p; localparam int l = c1.ASDF; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 5); for (int i = 0; i < 5; i++) { CHECK(diags[i].code == diag::ConstEvalClassType); } } TEST_CASE("Class constructor calls") { auto tree = SyntaxTree::fromText(R"( class C; function new(int i, real j); endfunction endclass class D; endclass module m; C c1 = new (3, 4.2); C c2 = new; D d1 = new (1); D d2 = D::new; C c3 = C::new(3, 0.42); typedef int I; D d3 = E::new(); C c4 = c1::new(); C c5 = I::new(); int i = new; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 6); CHECK(diags[0].code == diag::TooFewArguments); CHECK(diags[1].code == diag::TooManyArguments); CHECK(diags[2].code == diag::UndeclaredIdentifier); CHECK(diags[3].code == diag::NotAClass); CHECK(diags[4].code == diag::NotAClass); CHECK(diags[5].code == diag::NewClassTarget); } TEST_CASE("Copy class expressions") { auto tree = SyntaxTree::fromText(R"( class C; endclass module m; C c1 = new; C c2 = new c1; C c3 = new 1; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 1); CHECK(diags[0].code == diag::CopyClassTarget); } TEST_CASE("Generic class names") { auto tree = SyntaxTree::fromText(R"( class C #(int p = 1); function void foo(); int k = C::p; endfunction endclass class D #(int q = 2, int r); int asdf; function void bar(); D::asdf = r; endfunction endclass class E #(int s); int asdf = foo; endclass class F #(int t); int asdf = foo; function void baz(); this.asdf = 1; endfunction endclass module m; C c1 = new; // default specialization C #(4) c2 = new; D d1 = new; // error, no default typedef int Int; Int #(4) i1; // error, not a class localparam int p1 = C::p; // error localparam int p2 = C#()::p; localparam int p3 = D#(.r(5))::r; E #(5) e1; E #(6) e2; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& m = compilation.getRoot().lookupName<InstanceSymbol>("m").body; CHECK(m.find<ParameterSymbol>("p2").getValue().integer() == 1); CHECK(m.find<ParameterSymbol>("p3").getValue().integer() == 5); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 5); CHECK(diags[0].code == diag::UndeclaredIdentifier); CHECK(diags[1].code == diag::UndeclaredIdentifier); CHECK(diags[2].code == diag::NoDefaultSpecialization); CHECK(diags[3].code == diag::NotAGenericClass); CHECK(diags[4].code == diag::GenericClassScopeResolution); } TEST_CASE("Generic class typedefs") { auto tree = SyntaxTree::fromText(R"( typedef class C; module m; typedef C TC; localparam type TD = C; TC c1 = new; TD d1 = new; localparam int p1 = TC::p; localparam int p2 = TD::p; endmodule class C #(int p = 1); endclass class D #(int p = 1); endclass typedef class D; typedef class D; )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Nested classes") { auto tree = SyntaxTree::fromText(R"( class C; static int asdf; static function void bar; endfunction class N; localparam int foo = 4; static int baz = asdf + 1; function void func; if (1) begin : block bar(); end endfunction endclass endclass localparam int j = C::N::foo; module m; C::N n = new; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Static class lookups") { auto tree = SyntaxTree::fromText(R"( class C; int asdf; function void bar; endfunction static int foo = asdf; static function void baz; if (1) begin : block bar(); end endfunction class N; static int baz = asdf + 1; function void func; if (1) begin : block bar(); end endfunction endclass endclass )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 4); CHECK(diags[0].code == diag::NonStaticClassProperty); CHECK(diags[1].code == diag::NonStaticClassMethod); CHECK(diags[2].code == diag::NestedNonStaticClassProperty); CHECK(diags[3].code == diag::NestedNonStaticClassMethod); } TEST_CASE("Out-of-block declarations") { auto tree = SyntaxTree::fromText(R"( class C; int i; static int j; extern function int foo(int bar, int baz = 1); endclass class D; extern static function real foo; endclass localparam int k = 5; function int C::foo(int bar, int baz = 1); i = j + k + bar + baz; endfunction function real D::foo; endfunction class G #(type T); extern function T foo; endclass function G::T G::foo; return 0; endfunction class H #(int p); extern function int foo; endclass function int H::foo; endfunction module m; G #(real) g1; G #(int) g2; int i = g2.foo(); real r = D::foo(); endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Out-of-block error cases") { auto tree = SyntaxTree::fromText(R"( class C; extern function int f1(int bar, int baz); extern function int f2(int bar, int baz); extern function int f3(int bar, int baz); extern function int f4(int bar, int baz); extern function int f5(int bar); extern function int f6(int bar = 1 + 1); extern function int f7(int bar = 1 + 1 + 2); endclass function real C::f1; endfunction function int C::f2; endfunction function int C::f3(int bar, int boz); endfunction function int C::f4(int bar, real baz); endfunction function int C::f5(int bar = 1); endfunction function int C::f6(int bar = 2); endfunction function int C::f7(int bar = 1 + 1 + 3); endfunction typedef int T; class D; extern function void f(T x); typedef real T; endclass function void D::f(T x); endfunction function int E::f; endfunction class E; extern function int f; endclass class F; localparam type T = real; extern function T f; endclass function T F::f; endfunction function int asdf::foo; endfunction function int T::foo; endfunction function int F::baz; endfunction )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 13); CHECK(diags[0].code == diag::MethodReturnMismatch); CHECK(diags[1].code == diag::MethodArgCountMismatch); CHECK(diags[2].code == diag::MethodArgNameMismatch); CHECK(diags[3].code == diag::MethodArgTypeMismatch); CHECK(diags[4].code == diag::MethodArgNoDefault); CHECK(diags[5].code == diag::MethodArgDefaultMismatch); CHECK(diags[6].code == diag::MethodArgDefaultMismatch); CHECK(diags[7].code == diag::MethodArgTypeMismatch); CHECK(diags[8].code == diag::MethodDefinitionBeforeClass); CHECK(diags[9].code == diag::MethodReturnTypeScoped); CHECK(diags[10].code == diag::UndeclaredIdentifier); CHECK(diags[11].code == diag::NotAClass); CHECK(diags[12].code == diag::NoMethodInClass); } TEST_CASE("Out-of-block default value") { auto tree = SyntaxTree::fromText(R"( localparam int k = 1; class C; extern function int f1(int bar = k); localparam int k = 2; endclass function int C::f1(int bar); return bar; endfunction )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; auto& C = compilation.getRoot().compilationUnits[0]->lookupName<ClassType>("C"); auto& f1 = C.find<SubroutineSymbol>("f1"); auto init = f1.arguments[0]->getInitializer(); REQUIRE(init); EvalContext ctx(compilation); CHECK(init->eval(ctx).integer() == 1); } TEST_CASE("This handle errors") { auto tree = SyntaxTree::fromText(R"( class C; int asdf; static function f; this.asdf = 1; endfunction function int g; this = new; endfunction endclass module m; initial this.foo = 1; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 3); CHECK(diags[0].code == diag::InvalidThisHandle); CHECK(diags[1].code == diag::AssignmentToConst); CHECK(diags[2].code == diag::InvalidThisHandle); } TEST_CASE("Super handle errors") { auto tree = SyntaxTree::fromText(R"( class A; function new(int i); endfunction endclass class B extends A; function int g; super = new; return super.foo; endfunction function new; super.new(4); endfunction endclass class C; function void g; super.bar = 1; this.super.new(); endfunction endclass module m; initial super.foo = 1; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 6); CHECK(diags[0].code == diag::ExpectedToken); CHECK(diags[1].code == diag::UnknownClassMember); CHECK(diags[2].code == diag::SuperNoBase); CHECK(diags[3].code == diag::SuperNoBase); CHECK(diags[4].code == diag::InvalidSuperNew); CHECK(diags[5].code == diag::SuperOutsideClass); } TEST_CASE("super.new error checking") { auto tree = SyntaxTree::fromText(R"( class A; function new(int i); endfunction endclass class B extends A; endclass class C extends A(5); // ok endclass class D extends A(5); function new; super.new(5); endfunction endclass class E extends C(5); endclass class F extends A; function new; int i = 4; super.new(i); i++; endfunction endclass class G extends C(); function new(int i = 4); endfunction endclass class H extends G; endclass module m; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 3); CHECK(diags[0].code == diag::BaseConstructorNotCalled); CHECK(diags[1].code == diag::BaseConstructorDuplicate); CHECK(diags[2].code == diag::TooManyArguments); } TEST_CASE("Inheritance") { auto tree = SyntaxTree::fromText(R"( class A; integer i = 1; integer j = 2; function integer f(); f = i; endfunction endclass class B extends A; integer i = 2; function void f(); i = j; super.i = super.j; j = super.f(); j = this.super.f(); endfunction endclass class C extends B; function void g(); f(); i = j + C::j + A::f(); endfunction endclass module m; A a = new; A b1 = B::new; B b2 = new; C c = new; integer i = b1.f(); initial begin b2.f(); a = b2; c.i = c.j; end endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Access visibility") { auto tree = SyntaxTree::fromText(R"( class A; local int i; protected int j; local function void bar; endfunction class P; static int pub; endclass protected typedef P PT; endclass class B extends A; static local function void frob; endfunction extern function foo; class N; function baz(B b); b.i = 1; b.j = 2; frob(); bor(); // should not typo correct to an inaccessible function endfunction endclass endclass function B::foo; i = 1; j = 2; bar(); endfunction module m; B b; initial b.bar(); initial b.j = 2; int x = A::P::pub; // ok int y = A::PT::pub; // local typedef endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 7); CHECK(diags[0].code == diag::LocalMemberAccess); CHECK(diags[1].code == diag::UndeclaredIdentifier); CHECK(diags[2].code == diag::LocalMemberAccess); CHECK(diags[3].code == diag::LocalMemberAccess); CHECK(diags[4].code == diag::LocalMemberAccess); CHECK(diags[5].code == diag::ProtectedMemberAccess); CHECK(diags[6].code == diag::ProtectedMemberAccess); } TEST_CASE("Constructor access visibility") { auto tree = SyntaxTree::fromText(R"( class A; local function new; endfunction class P; function bar; A a = new; endfunction endclass endclass class B extends A; function new; endfunction endclass class C extends A; endclass class D extends A; function new; super.new(); endfunction endclass class E extends A(); endclass class F; protected function new; endfunction endclass module m; A a = A::new; F f = new; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 6); CHECK(diags[0].code == diag::InvalidConstructorAccess); CHECK(diags[1].code == diag::InvalidConstructorAccess); CHECK(diags[2].code == diag::InvalidConstructorAccess); CHECK(diags[3].code == diag::InvalidConstructorAccess); CHECK(diags[4].code == diag::InvalidConstructorAccess); CHECK(diags[5].code == diag::InvalidConstructorAccess); } TEST_CASE("Constant class properties") { auto tree = SyntaxTree::fromText(R"( class A; static const int i; // initializer required const int j = 1; // ok const int k; // ok function new; j = 2; // bad k = 2; // ok endfunction function void bar; k = 3; //bad endfunction endclass )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 3); CHECK(diags[0].code == diag::StaticConstNoInitializer); CHECK(diags[1].code == diag::AssignmentToConst); CHECK(diags[2].code == diag::AssignmentToConst); } TEST_CASE("Virtual method checking") { auto tree = SyntaxTree::fromText(R"( class A; virtual function int foo(int a, int b = 1); endfunction virtual function void bar(int a); endfunction endclass class B extends A; endclass class C extends B; function real foo(int a, int b); endfunction endclass class D extends B; function int foo(int b, int c); endfunction endclass class E extends B; function int foo(int a, int b, int c); endfunction endclass class F extends B; function int foo(int a, int b); endfunction endclass class G extends A; function void bar(int a = 1); endfunction endclass class H extends A; function void bar(real a); endfunction endclass )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 6); CHECK(diags[0].code == diag::VirtualReturnMismatch); CHECK(diags[1].code == diag::VirtualArgNameMismatch); CHECK(diags[2].code == diag::VirtualArgCountMismatch); CHECK(diags[3].code == diag::VirtualArgNoDerivedDefault); CHECK(diags[4].code == diag::VirtualArgNoParentDefault); CHECK(diags[5].code == diag::VirtualArgTypeMismatch); } TEST_CASE("Virtual method with derived return type") { auto tree = SyntaxTree::fromText(R"( typedef int T; class C; virtual function C some_method(int a); endfunction endclass class D extends C; virtual function D some_method(T a); endfunction endclass class E #(type Y = logic) extends C; virtual function D some_method(Y a); endfunction endclass module m; E #() v1; E #(int) v2; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 1); CHECK(diags[0].code == diag::VirtualArgTypeMismatch); } TEST_CASE("Virtual class errors") { auto tree = SyntaxTree::fromText(R"( virtual class C; endclass module m; C c1; C c2 = new; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 1); CHECK(diags[0].code == diag::NewVirtualClass); } TEST_CASE("Pure virtual methods") { auto tree = SyntaxTree::fromText(R"( virtual class C; pure virtual function int foo(int a, real b = 1.1); endclass module m; C c1; initial begin automatic int i = c1.foo(3); end endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Pure virtual method errors") { auto tree = SyntaxTree::fromText(R"( class A; pure virtual function int foo(); endclass virtual class C; pure virtual function int foo(int a, real b = 1.1); endclass function int C::foo(int a, real b = 1.1); endfunction virtual class D extends C; endclass class E extends D; function int foo(int a, real b = 1.1); endfunction endclass class F extends D; endclass module m; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); auto& diags = compilation.getAllDiagnostics(); REQUIRE(diags.size() == 3); CHECK(diags[0].code == diag::PureInAbstract); CHECK(diags[1].code == diag::BodyForPure); CHECK(diags[2].code == diag::InheritFromAbstract); } TEST_CASE("Polymorphism example") { auto tree = SyntaxTree::fromText(R"( class A; virtual function void foo(); endfunction endclass class B extends A; function void foo(); endfunction endclass class C extends A; function void foo(); endfunction endclass module m; initial begin automatic A a[10]; automatic B b = new; automatic C c = new; a[0] = b; a[1] = c; a[0].foo(); a[1].foo(); end endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Uninstantiated generic class error") { auto tree = SyntaxTree::fromText(R"( class A; endclass class B #(type DT=int) extends A; localparam Max_int = {$bits(DT) - 1{1'b1}}; localparam Min_int = {$bits(int) - $bits(DT){1'b1}}; endclass )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Protected member access") { auto tree = SyntaxTree::fromText(R"( module top(); class A; local int a_loc = 21; protected int a_prot = 22; int a = 23; endclass class B extends A; local int b_loc = 31; protected int b_prot = 32; int b = 33; function void fun(); $display(b_prot); endfunction endclass B b; initial begin b = new; $display(b.b); b.fun(); end endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Interface class qualifier error checking") { auto tree = SyntaxTree::fromText(R"( interface class C; const int i = 4; class D; endclass interface class E; endclass local typedef int int_t; pure virtual protected function foo; function int bar(); endfunction endclass )"); auto& diags = tree->diagnostics(); REQUIRE(diags.size() == 6); CHECK(diags[0].code == diag::NotAllowedInIfaceClass); CHECK(diags[1].code == diag::NotAllowedInIfaceClass); CHECK(diags[2].code == diag::NestedIface); CHECK(diags[3].code == diag::InvalidQualifierForIfaceMember); CHECK(diags[4].code == diag::InvalidQualifierForIfaceMember); CHECK(diags[5].code == diag::IfaceMethodPure); }
22.126486
95
0.644082
lijinpei
f77bc08d660a70fd52f679c1a259499ed812cf60
2,826
cc
C++
src/Source/Controller/PolicyHandler.cc
0KABE/Owl
e9d5981e5d41f6d327ef84cb0c3a66f41d68b91b
[ "MIT" ]
2
2021-09-11T07:35:06.000Z
2022-03-05T09:52:00.000Z
src/Source/Controller/PolicyHandler.cc
0KABE/Owl
e9d5981e5d41f6d327ef84cb0c3a66f41d68b91b
[ "MIT" ]
null
null
null
src/Source/Controller/PolicyHandler.cc
0KABE/Owl
e9d5981e5d41f6d327ef84cb0c3a66f41d68b91b
[ "MIT" ]
null
null
null
#include <rapidjson/document.h> #include <rapidjson/stringbuffer.h> #include <rapidjson/writer.h> #include "Controller.hpp" #include "Controller/PolicyHandler.hpp" #include "Proxy/ProxyNodeManager.hpp" Owl::Awaitable<void> Owl::PolicyHandler::Handle(const Owl::Request &request, Owl::Socket socket, const Owl::Connection::Status &status) const { using namespace rapidjson; using namespace boost::beast; ProxyNodeManager &proxyNodeManager = ProxyNodeManager::GetInstance(); const ProxyNodeManager::Policies &policies = proxyNodeManager.GetPolicies(); Document document(kObjectType); Value policiesJSON(kArrayType); for (const auto &policyPair: policies) { Value policy(kObjectType); Value name; name.SetString(policyPair.first.data(), policyPair.first.size(), document.GetAllocator()); policy.AddMember("name", name, document.GetAllocator()); Value selected; selected.SetString(policyPair.second->GetSelectedProxy()->GetName().data(), policyPair.second->GetSelectedProxy()->GetName().size(), document.GetAllocator()); policy.AddMember("selected", selected, document.GetAllocator()); Value type; type.SetString(policyPair.second->GetPolicyType().data(), policyPair.second->GetPolicyType().length(), document.GetAllocator()); policy.AddMember("type", type, document.GetAllocator()); Value proxies(kArrayType); for (auto &proxy : policyPair.second->GetProxies()) { Value value; value.SetString(proxy->GetName().data(), proxy->GetName().length(), document.GetAllocator()); proxies.PushBack(value, document.GetAllocator()); } policy.AddMember("proxies", proxies, document.GetAllocator()); policiesJSON.PushBack(policy, document.GetAllocator()); } document.AddMember("policies", policiesJSON, document.GetAllocator()); StringBuffer stringBuffer; Writer writer(stringBuffer); document.Accept(writer); http::response<http::string_body> response; response.set(http::field::content_type, "application/json"); response.set(http::field::content_length, std::to_string(stringBuffer.GetLength())); if (request.count(http::field::origin)) response.set(http::field::access_control_allow_origin, "*"); response.body() = stringBuffer.GetString(); co_await async_write(socket, response, use_awaitable); } bool Owl::PolicyHandler::Match(const Owl::Request &request) const { return request.target() == TARGET; } [[maybe_unused]] static auto reg = Owl::Controller::Register(std::make_unique<Owl::PolicyHandler>());
42.179104
98
0.659943
0KABE
f77e596068fa8b5807441d1a2c0cec0096f9fdbc
240,926
hpp
C++
color-tests/color-palletes.hpp
Biyorne/learningcpp
bcf963990800ed939fa4cc1b30fadccaf098155b
[ "MIT" ]
null
null
null
color-tests/color-palletes.hpp
Biyorne/learningcpp
bcf963990800ed939fa4cc1b30fadccaf098155b
[ "MIT" ]
null
null
null
color-tests/color-palletes.hpp
Biyorne/learningcpp
bcf963990800ed939fa4cc1b30fadccaf098155b
[ "MIT" ]
null
null
null
#ifndef SFUTIL_COLOR_NAMES_HPP_INCLUDED #define SFUTIL_COLOR_NAMES_HPP_INCLUDED // // color-palletes.hpp // #include <string> #include <vector> #include <SFML/Graphics/Color.hpp> // // TODO // add a self test to see if any pallets have duplicates values or names namespace color { namespace pallete { // All of these pallets start with black and end with white. // All 8 Primary and Secondary RGB colors including black and white. // (all combinations of 0 and 255 values) struct rgb_8 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, red = 0xff0000ff, green = 0x00ff00ff, blue = 0x0000ffff, cyan = 0x00ffffff, magenta = 0xff00ffff, yellow = 0xffff00ff, white = 0xffffffff, Count = 8 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(red), sf::Color(green), sf::Color(blue), sf::Color(cyan), sf::Color(magenta), sf::Color(yellow), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "rgb_8" }; }; // A muted pallet used by the classic home computer from 1982. struct commodore_16 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, red = 0x880000ff, cyan = 0xaaffeeff, purple = 0xcc44ccff, green = 0x00cc55ff, blue = 0x0000aaff, yellow = 0xeeee77ff, orange = 0xdd8855ff, // brown = 0x664400ff, lightred = 0xff7777ff, darkgrey = 0x333333ff, grey = 0x777777ff, lightgreen = 0xaaff66ff, lightblue = 0x0088ffff, lightgrey = 0xbbbbbbff, white = 0xffffffff, Count = 16 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(red), sf::Color(cyan), sf::Color(purple), sf::Color(green), sf::Color(blue), sf::Color(yellow), sf::Color(orange), sf::Color(brown), sf::Color(lightred), sf::Color(darkgrey), sf::Color(grey), sf::Color(lightgreen), sf::Color(lightblue), sf::Color(lightgrey), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "commodore_16" }; }; // The awkward but instantly recognizable pallet of the Apple IIgs from 1997. // Note that some of these colors are out of the RGB model so they look weird on modern // displays. For example, the brown here is not brown at all on modern RGB displays. struct appleiigs_16 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, magenta = 0x7c3f51ff, darkblue = 0x4e4985ff, purple = 0xd96ae9ff, darkgreen = 0x246653ff, grey1 = 0x929292ff, medblue = 0x37a6eaff, lightblue = 0xc8c4f4ff, // brown = 0x535b1fff, orange = 0xdd833cff, grey2 = 0x929292ff, pink = 0xedbccaff, green = 0x4fc546ff, yellow = 0xccd2a1ff, aqua = 0xa8dacbff, white = 0xffffffff, Count = 16 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(magenta), sf::Color(darkblue), sf::Color(purple), sf::Color(darkgreen), sf::Color(grey1), sf::Color(medblue), sf::Color(lightblue), sf::Color(brown), sf::Color(orange), sf::Color(grey2), sf::Color(pink), sf::Color(green), sf::Color(yellow), sf::Color(aqua), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "appleiigs_16" }; }; // 16 eye-bleeding colors from good old windows 3.1. struct windows_16 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, maroon = 0x7e0000ff, green = 0x047e00ff, olive = 0x7e7e00ff, navy = 0x00007eff, purple = 0x7e007eff, teal = 0x047e7eff, silver = 0xbebebeff, // grey = 0x7e7e7eff, red = 0xfe0000ff, lime = 0x06ff04ff, yellow = 0xffff04ff, blue = 0x0000ffff, fuchsia = 0xfe00ffff, aqua = 0x06ffffff, white = 0xffffffff, Count = 16 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(maroon), sf::Color(green), sf::Color(olive), sf::Color(navy), sf::Color(purple), sf::Color(teal), sf::Color(silver), sf::Color(grey), sf::Color(red), sf::Color(lime), sf::Color(yellow), sf::Color(blue), sf::Color(fuchsia), sf::Color(aqua), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "windows_16" }; }; // The original Color-Graphics-Adapter pallet from 1982. // This is NOT the cga pallet that became the standard adopted by EGA/VGA/ struct cga_orig_16 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, blue = 0x0000aaff, green = 0x00aa00ff, cyan = 0x00aaaaff, red = 0xaa0000ff, magenta = 0xaa00aaff, darkyellow = 0xaaaa00ff, lightgrey = 0xaaaaaaff, darkgrey = 0x555555ff, lightblue = 0x5555ffff, lightgreen = 0x55ff55ff, lightcyan = 0x55ffffff, lightred = 0xff5555ff, lightmagenta = 0xff55ffff, yellow = 0xffff55ff, white = 0xffffffff, Count = 16 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(blue), sf::Color(green), sf::Color(cyan), sf::Color(red), sf::Color(magenta), sf::Color(darkyellow), sf::Color(lightgrey), sf::Color(darkgrey), sf::Color(lightblue), sf::Color(lightgreen), sf::Color(lightcyan), sf::Color(lightred), sf::Color(lightmagenta), sf::Color(yellow), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "cga_orig_16" }; }; // The "RGBI with tweaked brown" version of the Color-Graphics-Adapter pallet // The only difference from cga_orig_16 is color #6 darkyellow, which was changed to // "brown" with special circuitry in RGBI monitors (i.e. IBM 5153) to half the analogue // green signal's amplitude. This version of the CGA pallet became the default used by // the standards that came after, such as EGA/VGA/etc. struct cga_16 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, blue = 0x0000aaff, green = 0x00aa00ff, cyan = 0x00aaaaff, red = 0xaa0000ff, magenta = 0xaa00aaff, brown = 0xaa5500ff, lightgrey = 0xaaaaaaff, darkgrey = 0x555555ff, lightblue = 0x5555ffff, lightgreen = 0x55ff55ff, lightcyan = 0x55ffffff, lightred = 0xff5555ff, lightmagenta = 0xff55ffff, yellow = 0xffff55ff, white = 0xffffffff, Count = 16 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(blue), sf::Color(green), sf::Color(cyan), sf::Color(red), sf::Color(magenta), sf::Color(brown), sf::Color(lightgrey), sf::Color(darkgrey), sf::Color(lightblue), sf::Color(lightgreen), sf::Color(lightcyan), sf::Color(lightred), sf::Color(lightmagenta), sf::Color(yellow), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "cga_16" }; }; // Enhanced Graphics Adapter from 1984. // EGA could only use 16 colors at once, but those colors could be selected from a pallet // of 64. I didn't bother making the default 16 color EGA pallet because it's the same as // the "brown tweaked" CGA pallet above. struct ega_64 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, ega_00 = black, ega_01 = 0x0000aaff, ega_02 = 0x00aa00ff, ega_03 = 0x00aaaaff, ega_04 = 0xaa0000ff, ega_05 = 0xaa00aaff, ega_06 = 0xaaaa00ff, ega_07 = 0xaaaaaaff, ega_08 = 0x000055ff, ega_09 = 0x0000ffff, ega_10 = 0x00aa55ff, ega_11 = 0x00aaffff, ega_12 = 0xaa0055ff, ega_13 = 0xaa00ffff, ega_14 = 0xaaaa55ff, ega_15 = 0xaaaaffff, ega_16 = 0x005500ff, ega_17 = 0x0055aaff, ega_18 = 0x00ff00ff, ega_19 = 0x00ffaaff, ega_20 = 0xaa5500ff, ega_21 = 0xaa55aaff, ega_22 = 0xaaff00ff, ega_23 = 0xaaffaaff, ega_24 = 0x005555ff, ega_25 = 0x0055ffff, ega_26 = 0x00ff55ff, ega_27 = 0x00ffffff, ega_28 = 0xaa5555ff, ega_29 = 0xaa55ffff, ega_30 = 0xaaff55ff, ega_31 = 0xaaffffff, ega_32 = 0x550000ff, ega_33 = 0x5500aaff, ega_34 = 0x55aa00ff, ega_35 = 0x55aaaaff, ega_36 = 0xff0000ff, ega_37 = 0xff00aaff, ega_38 = 0xffaa00ff, ega_39 = 0xffaaaaff, ega_40 = 0x550055ff, ega_41 = 0x5500ffff, ega_42 = 0x55aa55ff, ega_43 = 0x55aaffff, ega_44 = 0xff0055ff, ega_45 = 0xff00ffff, ega_46 = 0xffaa55ff, ega_47 = 0xffaaffff, ega_48 = 0x555500ff, ega_49 = 0x5555aaff, ega_50 = 0x55ff00ff, ega_51 = 0x55ffaaff, ega_52 = 0xff5500ff, ega_53 = 0xff55aaff, ega_54 = 0xffff00ff, ega_55 = 0xffffaaff, ega_56 = 0x555555ff, ega_57 = 0x5555ffff, ega_58 = 0x55ff55ff, ega_59 = 0x55ffffff, ega_60 = 0xff5555ff, ega_61 = 0xff55ffff, ega_62 = 0xffff55ff, ega_63 = 0xffffffff, white = ega_63, Count = 64 }; static inline const std::vector<sf::Color> Colors{ sf::Color(ega_00), sf::Color(ega_01), sf::Color(ega_02), sf::Color(ega_03), sf::Color(ega_04), sf::Color(ega_05), sf::Color(ega_06), sf::Color(ega_07), sf::Color(ega_08), sf::Color(ega_09), sf::Color(ega_10), sf::Color(ega_11), sf::Color(ega_12), sf::Color(ega_13), sf::Color(ega_14), sf::Color(ega_15), sf::Color(ega_16), sf::Color(ega_17), sf::Color(ega_18), sf::Color(ega_19), sf::Color(ega_20), sf::Color(ega_21), sf::Color(ega_22), sf::Color(ega_23), sf::Color(ega_24), sf::Color(ega_25), sf::Color(ega_26), sf::Color(ega_27), sf::Color(ega_28), sf::Color(ega_29), sf::Color(ega_30), sf::Color(ega_31), sf::Color(ega_32), sf::Color(ega_33), sf::Color(ega_34), sf::Color(ega_35), sf::Color(ega_36), sf::Color(ega_37), sf::Color(ega_38), sf::Color(ega_39), sf::Color(ega_40), sf::Color(ega_41), sf::Color(ega_42), sf::Color(ega_43), sf::Color(ega_44), sf::Color(ega_45), sf::Color(ega_46), sf::Color(ega_47), sf::Color(ega_48), sf::Color(ega_49), sf::Color(ega_50), sf::Color(ega_51), sf::Color(ega_52), sf::Color(ega_53), sf::Color(ega_54), sf::Color(ega_55), sf::Color(ega_56), sf::Color(ega_57), sf::Color(ega_58), sf::Color(ega_59), sf::Color(ega_60), sf::Color(ega_61), sf::Color(ega_62), sf::Color(ega_63) }; // clang-format on static inline const std::string palleteName { "ega_64" }; }; // The Video Graphics Array from 1987. // VGA could only use 256 colors at once, but those colors could be selected from a pallet // of 262,144. Again, I didn't bother making the default 16 color EGA pallet because it's // the same as the "brown tweaked" CGA pallet above. Note that the repeats of black at // the end were intentional. You will have to dig into the history to understand why... // I changed the last duplicate black into white so that all the pallets in this file start // with black and end with white. struct vga_256 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, vga_000 = black, vga_001 = 0x0000aaff, vga_002 = 0x00aa00ff, vga_003 = 0x00aaaaff, vga_004 = 0xaa0000ff, vga_005 = 0xaa00aaff, vga_006 = 0xaa5500ff, vga_007 = 0xaaaaaaff, vga_008 = 0x555555ff, vga_009 = 0x5555ffff, vga_010 = 0x55ff55ff, vga_011 = 0x55ffffff, vga_012 = 0xff5555ff, vga_013 = 0xff55ffff, vga_014 = 0xffff55ff, vga_015 = 0xffffffff, vga_016 = 0x000000ff, vga_017 = 0x101010ff, vga_018 = 0x202020ff, vga_019 = 0x353535ff, vga_020 = 0x454545ff, vga_021 = 0x555555ff, vga_022 = 0x656565ff, vga_023 = 0x757575ff, vga_024 = 0x8a8a8aff, vga_025 = 0x9a9a9aff, vga_026 = 0xaaaaaaff, vga_027 = 0xbababaff, vga_028 = 0xcacacaff, vga_029 = 0xdfdfdfff, vga_030 = 0xefefefff, vga_031 = 0xffffffff, vga_032 = 0x0000ffff, vga_033 = 0x4100ffff, vga_034 = 0x8200ffff, vga_035 = 0xbe00ffff, vga_036 = 0xff00ffff, vga_037 = 0xff00beff, vga_038 = 0xff0082ff, vga_039 = 0xff0041ff, vga_040 = 0xff0000ff, vga_041 = 0xff4100ff, vga_042 = 0xff8200ff, vga_043 = 0xffbe00ff, vga_044 = 0xffff00ff, vga_045 = 0xbeff00ff, vga_046 = 0x82ff00ff, vga_047 = 0x41ff00ff, vga_048 = 0x00ff00ff, vga_049 = 0x00ff41ff, vga_050 = 0x00ff82ff, vga_051 = 0x00ffbeff, vga_052 = 0x00ffffff, vga_053 = 0x00beffff, vga_054 = 0x0082ffff, vga_055 = 0x0041ffff, vga_056 = 0x8282ffff, vga_057 = 0x9e82ffff, vga_058 = 0xbe82ffff, vga_059 = 0xdf82ffff, vga_060 = 0xff82ffff, vga_061 = 0xff82dfff, vga_062 = 0xff82beff, vga_063 = 0xff829eff, vga_064 = 0xff8282ff, vga_065 = 0xff9e82ff, vga_066 = 0xffbe82ff, vga_067 = 0xffdf82ff, vga_068 = 0xffff82ff, vga_069 = 0xdfff82ff, vga_070 = 0xbeff82ff, vga_071 = 0x9eff82ff, vga_072 = 0x82ff82ff, vga_073 = 0x82ff9eff, vga_074 = 0x82ffbeff, vga_075 = 0x82ffdfff, vga_076 = 0x82ffffff, vga_077 = 0x82dfffff, vga_078 = 0x82beffff, vga_079 = 0x829effff, vga_080 = 0xbabaffff, vga_081 = 0xcabaffff, vga_082 = 0xdfbaffff, vga_083 = 0xefbaffff, vga_084 = 0xffbaffff, vga_085 = 0xffbaefff, vga_086 = 0xffbadfff, vga_087 = 0xffbacaff, vga_088 = 0xffbabaff, vga_089 = 0xffcabaff, vga_090 = 0xffdfbaff, vga_091 = 0xffefbaff, vga_092 = 0xffffbaff, vga_093 = 0xefffbaff, vga_094 = 0xdfffbaff, vga_095 = 0xcaffbaff, vga_096 = 0xbaffbaff, vga_097 = 0xbaffcaff, vga_098 = 0xbaffdfff, vga_099 = 0xbaffefff, vga_100 = 0xbaffffff, vga_101 = 0xbaefffff, vga_102 = 0xbadfffff, vga_103 = 0xbacaffff, vga_104 = 0x000071ff, vga_105 = 0x1c0071ff, vga_106 = 0x390071ff, vga_107 = 0x550071ff, vga_108 = 0x710071ff, vga_109 = 0x710055ff, vga_110 = 0x710039ff, vga_111 = 0x71001cff, vga_112 = 0x710000ff, vga_113 = 0x711c00ff, vga_114 = 0x713900ff, vga_115 = 0x715500ff, vga_116 = 0x717100ff, vga_117 = 0x557100ff, vga_118 = 0x397100ff, vga_119 = 0x1c7100ff, vga_120 = 0x007100ff, vga_121 = 0x00711cff, vga_122 = 0x007139ff, vga_123 = 0x007155ff, vga_124 = 0x007171ff, vga_125 = 0x005571ff, vga_126 = 0x003971ff, vga_127 = 0x001c71ff, vga_128 = 0x393971ff, vga_129 = 0x453971ff, vga_130 = 0x553971ff, vga_131 = 0x613971ff, vga_132 = 0x713971ff, vga_133 = 0x713961ff, vga_134 = 0x713955ff, vga_135 = 0x713945ff, vga_136 = 0x713939ff, vga_137 = 0x714539ff, vga_138 = 0x715539ff, vga_139 = 0x716139ff, vga_140 = 0x717139ff, vga_141 = 0x617139ff, vga_142 = 0x557139ff, vga_143 = 0x457139ff, vga_144 = 0x397139ff, vga_145 = 0x397145ff, vga_146 = 0x397155ff, vga_147 = 0x397161ff, vga_148 = 0x397171ff, vga_149 = 0x396171ff, vga_150 = 0x395571ff, vga_151 = 0x394571ff, vga_152 = 0x515171ff, vga_153 = 0x595171ff, vga_154 = 0x615171ff, vga_155 = 0x695171ff, vga_156 = 0x715171ff, vga_157 = 0x715169ff, vga_158 = 0x715161ff, vga_159 = 0x715159ff, vga_160 = 0x715151ff, vga_161 = 0x715951ff, vga_162 = 0x716151ff, vga_163 = 0x716951ff, vga_164 = 0x717151ff, vga_165 = 0x697151ff, vga_166 = 0x617151ff, vga_167 = 0x597151ff, vga_168 = 0x517151ff, vga_169 = 0x517159ff, vga_170 = 0x517161ff, vga_171 = 0x517169ff, vga_172 = 0x517171ff, vga_173 = 0x516971ff, vga_174 = 0x516171ff, vga_175 = 0x515971ff, vga_176 = 0x000041ff, vga_177 = 0x100041ff, vga_178 = 0x200041ff, vga_179 = 0x310041ff, vga_180 = 0x410041ff, vga_181 = 0x410031ff, vga_182 = 0x410020ff, vga_183 = 0x410010ff, vga_184 = 0x410000ff, vga_185 = 0x411000ff, vga_186 = 0x412000ff, vga_187 = 0x413100ff, vga_188 = 0x414100ff, vga_189 = 0x314100ff, vga_190 = 0x204100ff, vga_191 = 0x104100ff, vga_192 = 0x004100ff, vga_193 = 0x004110ff, vga_194 = 0x004120ff, vga_195 = 0x004131ff, vga_196 = 0x004141ff, vga_197 = 0x003141ff, vga_198 = 0x002041ff, vga_199 = 0x001041ff, vga_200 = 0x202041ff, vga_201 = 0x282041ff, vga_202 = 0x312041ff, vga_203 = 0x392041ff, vga_204 = 0x412041ff, vga_205 = 0x412039ff, vga_206 = 0x412031ff, vga_207 = 0x412028ff, vga_208 = 0x412020ff, vga_209 = 0x412820ff, vga_210 = 0x413120ff, vga_211 = 0x413920ff, vga_212 = 0x414120ff, vga_213 = 0x394120ff, vga_214 = 0x314120ff, vga_215 = 0x284120ff, vga_216 = 0x204120ff, vga_217 = 0x204128ff, vga_218 = 0x204131ff, vga_219 = 0x204139ff, vga_220 = 0x204141ff, vga_221 = 0x203941ff, vga_222 = 0x203141ff, vga_223 = 0x202841ff, vga_224 = 0x2d2d41ff, vga_225 = 0x312d41ff, vga_226 = 0x352d41ff, vga_227 = 0x3d2d41ff, vga_228 = 0x412d41ff, vga_229 = 0x412d3dff, vga_230 = 0x412d35ff, vga_231 = 0x412d31ff, vga_232 = 0x412d2dff, vga_233 = 0x41312dff, vga_234 = 0x41352dff, vga_235 = 0x413d2dff, vga_236 = 0x41412dff, vga_237 = 0x3d412dff, vga_238 = 0x35412dff, vga_239 = 0x31412dff, vga_240 = 0x2d412dff, vga_241 = 0x2d4131ff, vga_242 = 0x2d4135ff, vga_243 = 0x2d413dff, vga_244 = 0x2d4141ff, vga_245 = 0x2d3d41ff, vga_246 = 0x2d3541ff, vga_247 = 0x2d3141ff, vga_248 = 0x000000ff, vga_249 = 0x000000ff, vga_250 = 0x000000ff, vga_251 = 0x000000ff, vga_252 = 0x000000ff, vga_253 = 0x000000ff, vga_254 = 0x000000ff, vga_255 = 0xffffffff, white = vga_255, Count = 256 }; static inline const std::vector<sf::Color> Colors{ sf::Color(vga_000), sf::Color(vga_001), sf::Color(vga_002), sf::Color(vga_003), sf::Color(vga_004), sf::Color(vga_005), sf::Color(vga_006), sf::Color(vga_007), sf::Color(vga_008), sf::Color(vga_009), sf::Color(vga_010), sf::Color(vga_011), sf::Color(vga_012), sf::Color(vga_013), sf::Color(vga_014), sf::Color(vga_015), sf::Color(vga_016), sf::Color(vga_017), sf::Color(vga_018), sf::Color(vga_019), sf::Color(vga_020), sf::Color(vga_021), sf::Color(vga_022), sf::Color(vga_023), sf::Color(vga_024), sf::Color(vga_025), sf::Color(vga_026), sf::Color(vga_027), sf::Color(vga_028), sf::Color(vga_029), sf::Color(vga_030), sf::Color(vga_031), sf::Color(vga_032), sf::Color(vga_033), sf::Color(vga_034), sf::Color(vga_035), sf::Color(vga_036), sf::Color(vga_037), sf::Color(vga_038), sf::Color(vga_039), sf::Color(vga_040), sf::Color(vga_041), sf::Color(vga_042), sf::Color(vga_043), sf::Color(vga_044), sf::Color(vga_045), sf::Color(vga_046), sf::Color(vga_047), sf::Color(vga_048), sf::Color(vga_049), sf::Color(vga_050), sf::Color(vga_051), sf::Color(vga_052), sf::Color(vga_053), sf::Color(vga_054), sf::Color(vga_055), sf::Color(vga_056), sf::Color(vga_057), sf::Color(vga_058), sf::Color(vga_059), sf::Color(vga_060), sf::Color(vga_061), sf::Color(vga_062), sf::Color(vga_063), sf::Color(vga_064), sf::Color(vga_065), sf::Color(vga_066), sf::Color(vga_067), sf::Color(vga_068), sf::Color(vga_069), sf::Color(vga_070), sf::Color(vga_071), sf::Color(vga_072), sf::Color(vga_073), sf::Color(vga_074), sf::Color(vga_075), sf::Color(vga_076), sf::Color(vga_077), sf::Color(vga_078), sf::Color(vga_079), sf::Color(vga_080), sf::Color(vga_081), sf::Color(vga_082), sf::Color(vga_083), sf::Color(vga_084), sf::Color(vga_085), sf::Color(vga_086), sf::Color(vga_087), sf::Color(vga_088), sf::Color(vga_089), sf::Color(vga_090), sf::Color(vga_091), sf::Color(vga_092), sf::Color(vga_093), sf::Color(vga_094), sf::Color(vga_095), sf::Color(vga_096), sf::Color(vga_097), sf::Color(vga_098), sf::Color(vga_099), sf::Color(vga_100), sf::Color(vga_101), sf::Color(vga_102), sf::Color(vga_103), sf::Color(vga_104), sf::Color(vga_105), sf::Color(vga_106), sf::Color(vga_107), sf::Color(vga_108), sf::Color(vga_109), sf::Color(vga_110), sf::Color(vga_111), sf::Color(vga_112), sf::Color(vga_113), sf::Color(vga_114), sf::Color(vga_115), sf::Color(vga_116), sf::Color(vga_117), sf::Color(vga_118), sf::Color(vga_119), sf::Color(vga_120), sf::Color(vga_121), sf::Color(vga_122), sf::Color(vga_123), sf::Color(vga_124), sf::Color(vga_125), sf::Color(vga_126), sf::Color(vga_127), sf::Color(vga_128), sf::Color(vga_129), sf::Color(vga_130), sf::Color(vga_131), sf::Color(vga_132), sf::Color(vga_133), sf::Color(vga_134), sf::Color(vga_135), sf::Color(vga_136), sf::Color(vga_137), sf::Color(vga_138), sf::Color(vga_139), sf::Color(vga_140), sf::Color(vga_141), sf::Color(vga_142), sf::Color(vga_143), sf::Color(vga_144), sf::Color(vga_145), sf::Color(vga_146), sf::Color(vga_147), sf::Color(vga_148), sf::Color(vga_149), sf::Color(vga_150), sf::Color(vga_151), sf::Color(vga_152), sf::Color(vga_153), sf::Color(vga_154), sf::Color(vga_155), sf::Color(vga_156), sf::Color(vga_157), sf::Color(vga_158), sf::Color(vga_159), sf::Color(vga_160), sf::Color(vga_161), sf::Color(vga_162), sf::Color(vga_163), sf::Color(vga_164), sf::Color(vga_165), sf::Color(vga_166), sf::Color(vga_167), sf::Color(vga_168), sf::Color(vga_169), sf::Color(vga_170), sf::Color(vga_171), sf::Color(vga_172), sf::Color(vga_173), sf::Color(vga_174), sf::Color(vga_175), sf::Color(vga_176), sf::Color(vga_177), sf::Color(vga_178), sf::Color(vga_179), sf::Color(vga_180), sf::Color(vga_181), sf::Color(vga_182), sf::Color(vga_183), sf::Color(vga_184), sf::Color(vga_185), sf::Color(vga_186), sf::Color(vga_187), sf::Color(vga_188), sf::Color(vga_189), sf::Color(vga_190), sf::Color(vga_191), sf::Color(vga_192), sf::Color(vga_193), sf::Color(vga_194), sf::Color(vga_195), sf::Color(vga_196), sf::Color(vga_197), sf::Color(vga_198), sf::Color(vga_199), sf::Color(vga_200), sf::Color(vga_201), sf::Color(vga_202), sf::Color(vga_203), sf::Color(vga_204), sf::Color(vga_205), sf::Color(vga_206), sf::Color(vga_207), sf::Color(vga_208), sf::Color(vga_209), sf::Color(vga_210), sf::Color(vga_211), sf::Color(vga_212), sf::Color(vga_213), sf::Color(vga_214), sf::Color(vga_215), sf::Color(vga_216), sf::Color(vga_217), sf::Color(vga_218), sf::Color(vga_219), sf::Color(vga_220), sf::Color(vga_221), sf::Color(vga_222), sf::Color(vga_223), sf::Color(vga_224), sf::Color(vga_225), sf::Color(vga_226), sf::Color(vga_227), sf::Color(vga_228), sf::Color(vga_229), sf::Color(vga_230), sf::Color(vga_231), sf::Color(vga_232), sf::Color(vga_233), sf::Color(vga_234), sf::Color(vga_235), sf::Color(vga_236), sf::Color(vga_237), sf::Color(vga_238), sf::Color(vga_239), sf::Color(vga_240), sf::Color(vga_241), sf::Color(vga_242), sf::Color(vga_243), sf::Color(vga_244), sf::Color(vga_245), sf::Color(vga_246), sf::Color(vga_247), sf::Color(vga_248), sf::Color(vga_249), sf::Color(vga_250), sf::Color(vga_251), sf::Color(vga_252), sf::Color(vga_253), sf::Color(vga_254), sf::Color(vga_255) }; // clang-format on static inline const std::string palleteName { "vga_256" }; }; // 16 colors from HTML3 (1986) -the only truly "web-safe" colors. struct websafe_16 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, maroon = 0x800000ff, green = 0x008000ff, navy = 0x000080ff, olive = 0x808000ff, purple = 0x800080ff, teal = 0x008080ff, gray = 0x808080ff, silver = 0xc0c0c0ff, red = 0xff0000ff, lime = 0x00ff00ff, blue = 0x0000ffff, aqua = 0x00ffffff, yellow = 0xffff00ff, fuchsia = 0xff00ffff, white = 0xffffffff, Count = 16 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(maroon), sf::Color(green), sf::Color(navy), sf::Color(olive), sf::Color(purple), sf::Color(teal), sf::Color(gray), sf::Color(silver), sf::Color(red), sf::Color(lime), sf::Color(blue), sf::Color(aqua), sf::Color(yellow), sf::Color(fuchsia), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "websafe_16" }; }; // 216 (unnamed) colors that tried to be "web-safe" in the mid 1990's but failed miserably. // (all combinations of the 6x6x6 RGB triplet) struct websafe_216 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, ws_000 = black, // (0,0,0) ws_001 = 0x000033ff, // (0,0,51) ws_002 = 0x000066ff, // (0,0,102) ws_003 = 0x000099ff, // (0,0,153) ws_004 = 0x0000ccff, // (0,0,204) ws_005 = 0x0000ffff, // (0,0,255) ws_006 = 0x003300ff, // (0,51,0) ws_007 = 0x003333ff, // (0,51,51) ws_008 = 0x003366ff, // (0,51,102) ws_009 = 0x003399ff, // (0,51,153) ws_010 = 0x0033ccff, // (0,51,204) ws_011 = 0x0033ffff, // (0,51,255) ws_012 = 0x006600ff, // (0,102,0) ws_013 = 0x006633ff, // (0,102,51) ws_014 = 0x006666ff, // (0,102,102) ws_015 = 0x006699ff, // (0,102,153) ws_016 = 0x0066ccff, // (0,102,204) ws_017 = 0x0066ffff, // (0,102,255) ws_018 = 0x009900ff, // (0,153,0) ws_019 = 0x009933ff, // (0,153,51) ws_020 = 0x009966ff, // (0,153,102) ws_021 = 0x009999ff, // (0,153,153) ws_022 = 0x0099ccff, // (0,153,204) ws_023 = 0x0099ffff, // (0,153,255) ws_024 = 0x00cc00ff, // (0,204,0) ws_025 = 0x00cc33ff, // (0,204,51) ws_026 = 0x00cc66ff, // (0,204,102) ws_027 = 0x00cc99ff, // (0,204,153) ws_028 = 0x00ccccff, // (0,204,204) ws_029 = 0x00ccffff, // (0,204,255) ws_030 = 0x00ff00ff, // (0,255,0) ws_031 = 0x00ff33ff, // (0,255,51) ws_032 = 0x00ff66ff, // (0,255,102) ws_033 = 0x00ff99ff, // (0,255,153) ws_034 = 0x00ffccff, // (0,255,204) ws_035 = 0x00ffffff, // (0,255,255) ws_036 = 0x330000ff, // (51,0,0) ws_037 = 0x330033ff, // (51,0,51) ws_038 = 0x330066ff, // (51,0,102) ws_039 = 0x330099ff, // (51,0,153) ws_040 = 0x3300ccff, // (51,0,204) ws_041 = 0x3300ffff, // (51,0,255) ws_042 = 0x333300ff, // (51,51,0) ws_043 = 0x333333ff, // (51,51,51) ws_044 = 0x333366ff, // (51,51,102) ws_045 = 0x333399ff, // (51,51,153) ws_046 = 0x3333ccff, // (51,51,204) ws_047 = 0x3333ffff, // (51,51,255) ws_048 = 0x336600ff, // (51,102,0) ws_049 = 0x336633ff, // (51,102,51) ws_050 = 0x336666ff, // (51,102,102) ws_051 = 0x336699ff, // (51,102,153) ws_052 = 0x3366ccff, // (51,102,204) ws_053 = 0x3366ffff, // (51,102,255) ws_054 = 0x339900ff, // (51,153,0) ws_055 = 0x339933ff, // (51,153,51) ws_056 = 0x339966ff, // (51,153,102) ws_057 = 0x339999ff, // (51,153,153) ws_058 = 0x3399ccff, // (51,153,204) ws_059 = 0x3399ffff, // (51,153,255) ws_060 = 0x33cc00ff, // (51,204,0) ws_061 = 0x33cc33ff, // (51,204,51) ws_062 = 0x33cc66ff, // (51,204,102) ws_063 = 0x33cc99ff, // (51,204,153) ws_064 = 0x33ccccff, // (51,204,204) ws_065 = 0x33ccffff, // (51,204,255) ws_066 = 0x33ff00ff, // (51,255,0) ws_067 = 0x33ff33ff, // (51,255,51) ws_068 = 0x33ff66ff, // (51,255,102) ws_069 = 0x33ff99ff, // (51,255,153) ws_070 = 0x33ffccff, // (51,255,204) ws_071 = 0x33ffffff, // (51,255,255) ws_072 = 0x660000ff, // (102,0,0) ws_073 = 0x660033ff, // (102,0,51) ws_074 = 0x660066ff, // (102,0,102) ws_075 = 0x660099ff, // (102,0,153) ws_076 = 0x6600ccff, // (102,0,204) ws_077 = 0x6600ffff, // (102,0,255) ws_078 = 0x663300ff, // (102,51,0) ws_079 = 0x663333ff, // (102,51,51) ws_080 = 0x663366ff, // (102,51,102) ws_081 = 0x663399ff, // (102,51,153) ws_082 = 0x6633ccff, // (102,51,204) ws_083 = 0x6633ffff, // (102,51,255) ws_084 = 0x666600ff, // (102,102,0) ws_085 = 0x666633ff, // (102,102,51) ws_086 = 0x666666ff, // (102,102,102) ws_087 = 0x666699ff, // (102,102,153) ws_088 = 0x6666ccff, // (102,102,204) ws_089 = 0x6666ffff, // (102,102,255) ws_090 = 0x669900ff, // (102,153,0) ws_091 = 0x669933ff, // (102,153,51) ws_092 = 0x669966ff, // (102,153,102) ws_093 = 0x669999ff, // (102,153,153) ws_094 = 0x6699ccff, // (102,153,204) ws_095 = 0x6699ffff, // (102,153,255) ws_096 = 0x66cc00ff, // (102,204,0) ws_097 = 0x66cc33ff, // (102,204,51) ws_098 = 0x66cc66ff, // (102,204,102) ws_099 = 0x66cc99ff, // (102,204,153) ws_100 = 0x66ccccff, // (102,204,204) ws_101 = 0x66ccffff, // (102,204,255) ws_102 = 0x66ff00ff, // (102,255,0) ws_103 = 0x66ff33ff, // (102,255,51) ws_104 = 0x66ff66ff, // (102,255,102) ws_105 = 0x66ff99ff, // (102,255,153) ws_106 = 0x66ffccff, // (102,255,204) ws_107 = 0x66ffffff, // (102,255,255) ws_108 = 0x990000ff, // (153,0,0) ws_109 = 0x990033ff, // (153,0,51) ws_110 = 0x990066ff, // (153,0,102) ws_111 = 0x990099ff, // (153,0,153) ws_112 = 0x9900ccff, // (153,0,204) ws_113 = 0x9900ffff, // (153,0,255) ws_114 = 0x993300ff, // (153,51,0) ws_115 = 0x993333ff, // (153,51,51) ws_116 = 0x993366ff, // (153,51,102) ws_117 = 0x993399ff, // (153,51,153) ws_118 = 0x9933ccff, // (153,51,204) ws_119 = 0x9933ffff, // (153,51,255) ws_120 = 0x996600ff, // (153,102,0) ws_121 = 0x996633ff, // (153,102,51) ws_122 = 0x996666ff, // (153,102,102) ws_123 = 0x996699ff, // (153,102,153) ws_124 = 0x9966ccff, // (153,102,204) ws_125 = 0x9966ffff, // (153,102,255) ws_126 = 0x999900ff, // (153,153,0) ws_127 = 0x999933ff, // (153,153,51) ws_128 = 0x999966ff, // (153,153,102) ws_129 = 0x999999ff, // (153,153,153) ws_130 = 0x9999ccff, // (153,153,204) ws_131 = 0x9999ffff, // (153,153,255) ws_132 = 0x99cc00ff, // (153,204,0) ws_133 = 0x99cc33ff, // (153,204,51) ws_134 = 0x99cc66ff, // (153,204,102) ws_135 = 0x99cc99ff, // (153,204,153) ws_136 = 0x99ccccff, // (153,204,204) ws_137 = 0x99ccffff, // (153,204,255) ws_138 = 0x99ff00ff, // (153,255,0) ws_139 = 0x99ff33ff, // (153,255,51) ws_140 = 0x99ff66ff, // (153,255,102) ws_141 = 0x99ff99ff, // (153,255,153) ws_142 = 0x99ffccff, // (153,255,204) ws_143 = 0x99ffffff, // (153,255,255) ws_144 = 0xcc0000ff, // (204,0,0) ws_145 = 0xcc0033ff, // (204,0,51) ws_146 = 0xcc0066ff, // (204,0,102) ws_147 = 0xcc0099ff, // (204,0,153) ws_148 = 0xcc00ccff, // (204,0,204) ws_149 = 0xcc00ffff, // (204,0,255) ws_150 = 0xcc3300ff, // (204,51,0) ws_151 = 0xcc3333ff, // (204,51,51) ws_152 = 0xcc3366ff, // (204,51,102) ws_153 = 0xcc3399ff, // (204,51,153) ws_154 = 0xcc33ccff, // (204,51,204) ws_155 = 0xcc33ffff, // (204,51,255) ws_156 = 0xcc6600ff, // (204,102,0) ws_157 = 0xcc6633ff, // (204,102,51) ws_158 = 0xcc6666ff, // (204,102,102) ws_159 = 0xcc6699ff, // (204,102,153) ws_160 = 0xcc66ccff, // (204,102,204) ws_161 = 0xcc66ffff, // (204,102,255) ws_162 = 0xcc9900ff, // (204,153,0) ws_163 = 0xcc9933ff, // (204,153,51) ws_164 = 0xcc9966ff, // (204,153,102) ws_165 = 0xcc9999ff, // (204,153,153) ws_166 = 0xcc99ccff, // (204,153,204) ws_167 = 0xcc99ffff, // (204,153,255) ws_168 = 0xcccc00ff, // (204,204,0) ws_169 = 0xcccc33ff, // (204,204,51) ws_170 = 0xcccc66ff, // (204,204,102) ws_171 = 0xcccc99ff, // (204,204,153) ws_172 = 0xccccccff, // (204,204,204) ws_173 = 0xccccffff, // (204,204,255) ws_174 = 0xccff00ff, // (204,255,0) ws_175 = 0xccff33ff, // (204,255,51) ws_176 = 0xccff66ff, // (204,255,102) ws_177 = 0xccff99ff, // (204,255,153) ws_178 = 0xccffccff, // (204,255,204) ws_179 = 0xccffffff, // (204,255,255) ws_180 = 0xff0000ff, // (255,0,0) ws_181 = 0xff0033ff, // (255,0,51) ws_182 = 0xff0066ff, // (255,0,102) ws_183 = 0xff0099ff, // (255,0,153) ws_184 = 0xff00ccff, // (255,0,204) ws_185 = 0xff00ffff, // (255,0,255) ws_186 = 0xff3300ff, // (255,51,0) ws_187 = 0xff3333ff, // (255,51,51) ws_188 = 0xff3366ff, // (255,51,102) ws_189 = 0xff3399ff, // (255,51,153) ws_190 = 0xff33ccff, // (255,51,204) ws_191 = 0xff33ffff, // (255,51,255) ws_192 = 0xff6600ff, // (255,102,0) ws_193 = 0xff6633ff, // (255,102,51) ws_194 = 0xff6666ff, // (255,102,102) ws_195 = 0xff6699ff, // (255,102,153) ws_196 = 0xff66ccff, // (255,102,204) ws_197 = 0xff66ffff, // (255,102,255) ws_198 = 0xff9900ff, // (255,153,0) ws_199 = 0xff9933ff, // (255,153,51) ws_200 = 0xff9966ff, // (255,153,102) ws_201 = 0xff9999ff, // (255,153,153) ws_202 = 0xff99ccff, // (255,153,204) ws_203 = 0xff99ffff, // (255,153,255) ws_204 = 0xffcc00ff, // (255,204,0) ws_205 = 0xffcc33ff, // (255,204,51) ws_206 = 0xffcc66ff, // (255,204,102) ws_207 = 0xffcc99ff, // (255,204,153) ws_208 = 0xffccccff, // (255,204,204) ws_209 = 0xffccffff, // (255,204,255) ws_210 = 0xffff00ff, // (255,255,0) ws_211 = 0xffff33ff, // (255,255,51) ws_212 = 0xffff66ff, // (255,255,102) ws_213 = 0xffff99ff, // (255,255,153) ws_214 = 0xffffccff, // (255,255,204) ws_215 = 0xffffffff, // (255,255,255) white = ws_215, Count = 216 }; static inline const std::vector<sf::Color> Colors{ sf::Color(ws_000), sf::Color(ws_001), sf::Color(ws_002), sf::Color(ws_003), sf::Color(ws_004), sf::Color(ws_005), sf::Color(ws_006), sf::Color(ws_007), sf::Color(ws_008), sf::Color(ws_009), sf::Color(ws_010), sf::Color(ws_011), sf::Color(ws_012), sf::Color(ws_013), sf::Color(ws_014), sf::Color(ws_015), sf::Color(ws_016), sf::Color(ws_017), sf::Color(ws_018), sf::Color(ws_019), sf::Color(ws_020), sf::Color(ws_021), sf::Color(ws_022), sf::Color(ws_023), sf::Color(ws_024), sf::Color(ws_025), sf::Color(ws_026), sf::Color(ws_027), sf::Color(ws_028), sf::Color(ws_029), sf::Color(ws_030), sf::Color(ws_031), sf::Color(ws_032), sf::Color(ws_033), sf::Color(ws_034), sf::Color(ws_035), sf::Color(ws_036), sf::Color(ws_037), sf::Color(ws_038), sf::Color(ws_039), sf::Color(ws_040), sf::Color(ws_041), sf::Color(ws_042), sf::Color(ws_043), sf::Color(ws_044), sf::Color(ws_045), sf::Color(ws_046), sf::Color(ws_047), sf::Color(ws_048), sf::Color(ws_049), sf::Color(ws_050), sf::Color(ws_051), sf::Color(ws_052), sf::Color(ws_053), sf::Color(ws_054), sf::Color(ws_055), sf::Color(ws_056), sf::Color(ws_057), sf::Color(ws_058), sf::Color(ws_059), sf::Color(ws_060), sf::Color(ws_061), sf::Color(ws_062), sf::Color(ws_063), sf::Color(ws_064), sf::Color(ws_065), sf::Color(ws_066), sf::Color(ws_067), sf::Color(ws_068), sf::Color(ws_069), sf::Color(ws_070), sf::Color(ws_071), sf::Color(ws_072), sf::Color(ws_073), sf::Color(ws_074), sf::Color(ws_075), sf::Color(ws_076), sf::Color(ws_077), sf::Color(ws_078), sf::Color(ws_079), sf::Color(ws_080), sf::Color(ws_081), sf::Color(ws_082), sf::Color(ws_083), sf::Color(ws_084), sf::Color(ws_085), sf::Color(ws_086), sf::Color(ws_087), sf::Color(ws_088), sf::Color(ws_089), sf::Color(ws_090), sf::Color(ws_091), sf::Color(ws_092), sf::Color(ws_093), sf::Color(ws_094), sf::Color(ws_095), sf::Color(ws_096), sf::Color(ws_097), sf::Color(ws_098), sf::Color(ws_099), sf::Color(ws_100), sf::Color(ws_101), sf::Color(ws_102), sf::Color(ws_103), sf::Color(ws_104), sf::Color(ws_105), sf::Color(ws_106), sf::Color(ws_107), sf::Color(ws_108), sf::Color(ws_109), sf::Color(ws_110), sf::Color(ws_111), sf::Color(ws_112), sf::Color(ws_113), sf::Color(ws_114), sf::Color(ws_115), sf::Color(ws_116), sf::Color(ws_117), sf::Color(ws_118), sf::Color(ws_119), sf::Color(ws_120), sf::Color(ws_121), sf::Color(ws_122), sf::Color(ws_123), sf::Color(ws_124), sf::Color(ws_125), sf::Color(ws_126), sf::Color(ws_127), sf::Color(ws_128), sf::Color(ws_129), sf::Color(ws_130), sf::Color(ws_131), sf::Color(ws_132), sf::Color(ws_133), sf::Color(ws_134), sf::Color(ws_135), sf::Color(ws_136), sf::Color(ws_137), sf::Color(ws_138), sf::Color(ws_139), sf::Color(ws_140), sf::Color(ws_141), sf::Color(ws_142), sf::Color(ws_143), sf::Color(ws_144), sf::Color(ws_145), sf::Color(ws_146), sf::Color(ws_147), sf::Color(ws_148), sf::Color(ws_149), sf::Color(ws_150), sf::Color(ws_151), sf::Color(ws_152), sf::Color(ws_153), sf::Color(ws_154), sf::Color(ws_155), sf::Color(ws_156), sf::Color(ws_157), sf::Color(ws_158), sf::Color(ws_159), sf::Color(ws_160), sf::Color(ws_161), sf::Color(ws_162), sf::Color(ws_163), sf::Color(ws_164), sf::Color(ws_165), sf::Color(ws_166), sf::Color(ws_167), sf::Color(ws_168), sf::Color(ws_169), sf::Color(ws_170), sf::Color(ws_171), sf::Color(ws_172), sf::Color(ws_173), sf::Color(ws_174), sf::Color(ws_175), sf::Color(ws_176), sf::Color(ws_177), sf::Color(ws_178), sf::Color(ws_179), sf::Color(ws_180), sf::Color(ws_181), sf::Color(ws_182), sf::Color(ws_183), sf::Color(ws_184), sf::Color(ws_185), sf::Color(ws_186), sf::Color(ws_187), sf::Color(ws_188), sf::Color(ws_189), sf::Color(ws_190), sf::Color(ws_191), sf::Color(ws_192), sf::Color(ws_193), sf::Color(ws_194), sf::Color(ws_195), sf::Color(ws_196), sf::Color(ws_197), sf::Color(ws_198), sf::Color(ws_199), sf::Color(ws_200), sf::Color(ws_201), sf::Color(ws_202), sf::Color(ws_203), sf::Color(ws_204), sf::Color(ws_205), sf::Color(ws_206), sf::Color(ws_207), sf::Color(ws_208), sf::Color(ws_209), sf::Color(ws_210), sf::Color(ws_211), sf::Color(ws_212), sf::Color(ws_213), sf::Color(ws_214), sf::Color(ws_215) }; // clang-format on static inline const std::string palleteName { "websafe_216" }; }; // The W3C "web-safe" colors (flawed and abandoned, but the names stuck...) // This is the most modern of the websafe pallets. struct websafe_139 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, navy = 0x000080ff, darkblue = 0x00008bff, mediumblue = 0x0000cdff, blue = 0x0000ffff, darkgreen = 0x006400ff, green = 0x008000ff, teal = 0x008080ff, darkcyan = 0x008b8bff, deepskyblue = 0x00bfffff, darkturquoise = 0x00ced1ff, mediumspringgreen = 0x00fa9aff, lime = 0x00ff00ff, springgreen = 0x00ff7fff, cyan = 0x00ffffff, midnightblue = 0x191970ff, dodgerblue = 0x1e90ffff, lightseagreen = 0x20b2aaff, forestgreen = 0x228b22ff, seagreen = 0x2e8b57ff, darkslategrey = 0x2f4f4fff, limegreen = 0x32cd32ff, mediumseagreen = 0x3cb371ff, turquoise = 0x40e0d0ff, royalblue = 0x4169e1ff, steelblue = 0x4682b4ff, darkslateblue = 0x483d8bff, mediumturquoise = 0x48d1ccff, indigo = 0x4b0082ff, darkolivegreen = 0x556b2fff, cadetblue = 0x5f9ea0ff, cornflowerblue = 0x6495edff, rebeccapurple = 0x663399ff, mediumaquamarine = 0x66cdaaff, dimgrey = 0x696969ff, slateblue = 0x6a5acdff, olivedrab = 0x6b8e23ff, slategrey = 0x708090ff, lightslategrey = 0x778899ff, mediumslateblue = 0x7b68eeff, lawngreen = 0x7cfc00ff, chartreuse = 0x7fff00ff, aquamarine = 0x7fffd4ff, maroon = 0x800000ff, purple = 0x800080ff, olive = 0x808000ff, grey = 0x808080ff, skyblue = 0x87ceebff, lightskyblue = 0x87cefaff, blueviolet = 0x8a2be2ff, darkred = 0x8b0000ff, darkmagenta = 0x8b008bff, saddlebrown = 0x8b4513ff, darkseagreen = 0x8fbc8fff, lightgreen = 0x90ee90ff, mediumpurple = 0x9370dbff, darkviolet = 0x9400d3ff, palegreen = 0x98fb98ff, darkorchid = 0x9932ccff, yellowgreen = 0x9acd32ff, sienna = 0xa0522dff, brown = 0xa52a2aff, darkgrey = 0xa9a9a9ff, lightblue = 0xadd8e6ff, greenyellow = 0xadff2fff, paleturquoise = 0xafeeeeff, lightsteelblue = 0xb0c4deff, powderblue = 0xb0e0e6ff, firebrick = 0xb22222ff, darkgoldenrod = 0xb8860bff, mediumorchid = 0xba55d3ff, rosybrown = 0xbc8f8fff, darkkhaki = 0xbdb76bff, silver = 0xc0c0c0ff, mediumvioletred = 0xc71585ff, indianred = 0xcd5c5cff, peru = 0xcd853fff, chocolate = 0xd2691eff, tan = 0xd2b48cff, lightgrey = 0xd3d3d3ff, thistle = 0xd8bfd8ff, orchid = 0xda70d6ff, goldenrod = 0xdaa520ff, palevioletred = 0xdb7093ff, crimson = 0xdc143cff, gainsboro = 0xdcdcdcff, plum = 0xdda0ddff, burlywood = 0xdeb887ff, lightcyan = 0xe0ffffff, lavender = 0xe6e6faff, darksalmon = 0xe9967aff, violet = 0xee82eeff, palegoldenrod = 0xeee8aaff, lightcoral = 0xf08080ff, khaki = 0xf0e68cff, aliceblue = 0xf0f8ffff, honeydew = 0xf0fff0ff, azure = 0xf0ffffff, sandybrown = 0xf4a460ff, wheat = 0xf5deb3ff, beige = 0xf5f5dcff, whitesmoke = 0xf5f5f5ff, mintcream = 0xf5fffaff, ghostwhite = 0xf8f8ffff, salmon = 0xfa8072ff, antiquewhite = 0xfaebd7ff, linen = 0xfaf0e6ff, lightgoldenrodyellow = 0xfafad2ff, oldlace = 0xfdf5e6ff, red = 0xff0000ff, magenta = 0xff00ffff, deeppink = 0xff1493ff, orangered = 0xff4500ff, tomato = 0xff6347ff, hotpink = 0xff69b4ff, coral = 0xff7f50ff, darkorange = 0xff8c00ff, lightsalmon = 0xffa07aff, orange = 0xffa500ff, lightpink = 0xffb6c1ff, pink = 0xffc0cbff, gold = 0xffd700ff, peachpuff = 0xffdab9ff, navajowhite = 0xffdeadff, moccasin = 0xffe4b5ff, bisque = 0xffe4c4ff, mistyrose = 0xffe4e1ff, blanchedalmond = 0xffebcdff, papayawhip = 0xffefd5ff, lavenderblush = 0xfff0f5ff, seashell = 0xfff5eeff, cornsilk = 0xfff8dcff, lemonchiffon = 0xfffacdff, floralwhite = 0xfffaf0ff, snow = 0xfffafaff, yellow = 0xffff00ff, lightyellow = 0xffffe0ff, ivory = 0xfffff0ff, white = 0xffffffff, Count = 139 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(navy), sf::Color(darkblue), sf::Color(mediumblue), sf::Color(blue), sf::Color(darkgreen), sf::Color(green), sf::Color(teal), sf::Color(darkcyan), sf::Color(deepskyblue), sf::Color(darkturquoise), sf::Color(mediumspringgreen), sf::Color(lime), sf::Color(springgreen), sf::Color(cyan), sf::Color(midnightblue), sf::Color(dodgerblue), sf::Color(lightseagreen), sf::Color(forestgreen), sf::Color(seagreen), sf::Color(darkslategrey), sf::Color(limegreen), sf::Color(mediumseagreen), sf::Color(turquoise), sf::Color(royalblue), sf::Color(steelblue), sf::Color(darkslateblue), sf::Color(mediumturquoise), sf::Color(indigo), sf::Color(darkolivegreen), sf::Color(cadetblue), sf::Color(cornflowerblue), sf::Color(rebeccapurple), sf::Color(mediumaquamarine), sf::Color(dimgrey), sf::Color(slateblue), sf::Color(olivedrab), sf::Color(slategrey), sf::Color(lightslategrey), sf::Color(mediumslateblue), sf::Color(lawngreen), sf::Color(chartreuse), sf::Color(aquamarine), sf::Color(maroon), sf::Color(purple), sf::Color(olive), sf::Color(grey), sf::Color(skyblue), sf::Color(lightskyblue), sf::Color(blueviolet), sf::Color(darkred), sf::Color(darkmagenta), sf::Color(saddlebrown), sf::Color(darkseagreen), sf::Color(lightgreen), sf::Color(mediumpurple), sf::Color(darkviolet), sf::Color(palegreen), sf::Color(darkorchid), sf::Color(yellowgreen), sf::Color(sienna), sf::Color(brown), sf::Color(darkgrey), sf::Color(lightblue), sf::Color(greenyellow), sf::Color(paleturquoise), sf::Color(lightsteelblue), sf::Color(powderblue), sf::Color(firebrick), sf::Color(darkgoldenrod), sf::Color(mediumorchid), sf::Color(rosybrown), sf::Color(darkkhaki), sf::Color(silver), sf::Color(mediumvioletred), sf::Color(indianred), sf::Color(peru), sf::Color(chocolate), sf::Color(tan), sf::Color(lightgrey), sf::Color(thistle), sf::Color(orchid), sf::Color(goldenrod), sf::Color(palevioletred), sf::Color(crimson), sf::Color(gainsboro), sf::Color(plum), sf::Color(burlywood), sf::Color(lightcyan), sf::Color(lavender), sf::Color(darksalmon), sf::Color(violet), sf::Color(palegoldenrod), sf::Color(lightcoral), sf::Color(khaki), sf::Color(aliceblue), sf::Color(honeydew), sf::Color(azure), sf::Color(sandybrown), sf::Color(wheat), sf::Color(beige), sf::Color(whitesmoke), sf::Color(mintcream), sf::Color(ghostwhite), sf::Color(salmon), sf::Color(antiquewhite), sf::Color(linen), sf::Color(lightgoldenrodyellow), sf::Color(oldlace), sf::Color(red), sf::Color(magenta), sf::Color(deeppink), sf::Color(orangered), sf::Color(tomato), sf::Color(hotpink), sf::Color(coral), sf::Color(darkorange), sf::Color(lightsalmon), sf::Color(orange), sf::Color(lightpink), sf::Color(pink), sf::Color(gold), sf::Color(peachpuff), sf::Color(navajowhite), sf::Color(moccasin), sf::Color(bisque), sf::Color(mistyrose), sf::Color(blanchedalmond), sf::Color(papayawhip), sf::Color(lavenderblush), sf::Color(seashell), sf::Color(cornsilk), sf::Color(lemonchiffon), sf::Color(floralwhite), sf::Color(snow), sf::Color(yellow), sf::Color(lightyellow), sf::Color(ivory), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "websafe_139" }; }; // The X11 colors are a constant changing mess, but you can find the current set here: // gitlab.freedesktop.org/xorg/app/rgb/raw/master/rgb.txt // Instead of using the list of the day, or some custom minimal list, I opted to create // a set that included every color from every version I could find. struct x11_543 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, // ( 0, 0, 0) grey0 = 0x000000ff, // ( 0, 0, 0) navy = 0x000080ff, // ( 0, 0,128) blue4 = 0x00008bff, // ( 0, 0,139) darkblue = 0x00008bff, // ( 0, 0,139) blue3 = 0x0000cdff, // ( 0, 0,205) mediumblue = 0x0000cdff, // ( 0, 0,205) blue2 = 0x0000eeff, // ( 0, 0,238) blue = 0x0000ffff, // ( 0, 0,255) darkgreen = 0x005300ff, // ( 0, 83, 0) darkgreen1 = 0x006400ff, // ( 0,100, 0) deepskyblue4 = 0x00688bff, // ( 0,104,139) turquoise4 = 0x00868bff, // ( 0,134,139) green4 = 0x008b00ff, // ( 0,139, 0) springgreen4 = 0x008b45ff, // ( 0,139, 69) cyan4 = 0x008b8bff, // ( 0,139,139) darkcyan = 0x008b8bff, // ( 0,139,139) deepskyblue3 = 0x009acdff, // ( 0,154,205) deepskyblue2 = 0x00b2eeff, // ( 0,178,238) deepskyblue = 0x00bfffff, // ( 0,191,255) darkturquoise1 = 0x00c3cdff, // ( 0,195,205) turquoise3 = 0x00c5cdff, // ( 0,197,205) green3 = 0x00cd00ff, // ( 0,205, 0) springgreen3 = 0x00cd66ff, // ( 0,205,102) cyan3 = 0x00cdcdff, // ( 0,205,205) darkturquoise = 0x00ced1ff, // ( 0,206,209) mediumturquoise2 = 0x00e3eeff, // ( 0,227,238) turquoise2 = 0x00e5eeff, // ( 0,229,238) green2 = 0x00ee00ff, // ( 0,238, 0) springgreen2 = 0x00ee76ff, // ( 0,238,118) cyan2 = 0x00eeeeff, // ( 0,238,238) turquoise1 = 0x00f5ffff, // ( 0,245,255) mediumspringgreen = 0x00fa9aff, // ( 0,250,154) green = 0x00ff00ff, // ( 0,255, 0) springgreen = 0x00ff7fff, // ( 0,255,127) cyan = 0x00ffffff, // ( 0,255,255) grey1 = 0x030303ff, // ( 3, 3, 3) grey2 = 0x050505ff, // ( 5, 5, 5) grey3 = 0x080808ff, // ( 8, 8, 8) grey4 = 0x0a0a0aff, // ( 10, 10, 10) grey5 = 0x0d0d0dff, // ( 13, 13, 13) grey6 = 0x0f0f0fff, // ( 15, 15, 15) dodgerblue4 = 0x104e8bff, // ( 16, 78,139) grey7 = 0x121212ff, // ( 18, 18, 18) grey8 = 0x141414ff, // ( 20, 20, 20) grey9 = 0x171717ff, // ( 23, 23, 23) dodgerblue3 = 0x1874cdff, // ( 24,116,205) midnightblue1 = 0x191964ff, // ( 25, 25,100) midnightblue = 0x191970ff, // ( 25, 25,112) grey10 = 0x1a1a1aff, // ( 26, 26, 26) grey11 = 0x1c1c1cff, // ( 28, 28, 28) dodgerblue2 = 0x1c86eeff, // ( 28,134,238) dodgerblue = 0x1e90ffff, // ( 30,144,255) grey12 = 0x1f1f1fff, // ( 31, 31, 31) lightseagreen = 0x20b2aaff, // ( 32,178,170) grey13 = 0x212121ff, // ( 33, 33, 33) cornflowerblue = 0x222298ff, // ( 34, 34,152) forestgreen = 0x228b22ff, // ( 34,139, 34) grey14 = 0x242424ff, // ( 36, 36, 36) grey15 = 0x262626ff, // ( 38, 38, 38) royalblue4 = 0x27408bff, // ( 39, 64,139) grey16 = 0x292929ff, // ( 41, 41, 41) grey17 = 0x2b2b2bff, // ( 43, 43, 43) grey18 = 0x2e2e2eff, // ( 46, 46, 46) seagreen = 0x2e8b57ff, // ( 46,139, 87) darkslategrey = 0x2f4f4fff, // ( 47, 79, 79) grey19 = 0x303030ff, // ( 48, 48, 48) limegreen = 0x32cd32ff, // ( 50,205, 50) grey20 = 0x333333ff, // ( 51, 51, 51) grey21 = 0x363636ff, // ( 54, 54, 54) steelblue4 = 0x36648bff, // ( 54,100,139) grey22 = 0x383838ff, // ( 56, 56, 56) royalblue3 = 0x3a5fcdff, // ( 58, 95,205) grey23 = 0x3b3b3bff, // ( 59, 59, 59) mediumseagreen = 0x3cb371ff, // ( 60,179,113) grey24 = 0x3d3d3dff, // ( 61, 61, 61) grey25 = 0x404040ff, // ( 64, 64, 64) turquoise = 0x40e0d0ff, // ( 64,224,208) royalblue = 0x4169e1ff, // ( 65,105,225) grey26 = 0x424242ff, // ( 66, 66, 66) royalblue2 = 0x436eeeff, // ( 67,110,238) seagreen3 = 0x43cd80ff, // ( 67,205,128) grey27 = 0x454545ff, // ( 69, 69, 69) chartreuse4 = 0x458b00ff, // ( 69,139, 0) aquamarine4 = 0x458b74ff, // ( 69,139,116) steelblue = 0x4682b4ff, // ( 70,130,180) slateblue4 = 0x473c8bff, // ( 71, 60,139) grey28 = 0x474747ff, // ( 71, 71, 71) darkslateblue = 0x483d8bff, // ( 72, 61,139) royalblue1 = 0x4876ffff, // ( 72,118,255) mediumturquoise = 0x48d1ccff, // ( 72,209,204) grey29 = 0x4a4a4aff, // ( 74, 74, 74) skyblue4 = 0x4a708bff, // ( 74,112,139) grey30 = 0x4d4d4dff, // ( 77, 77, 77) seagreen2 = 0x4eee94ff, // ( 78,238,148) grey31 = 0x4f4f4fff, // ( 79, 79, 79) steelblue3 = 0x4f94cdff, // ( 79,148,205) grey32 = 0x525252ff, // ( 82, 82, 82) darkslategrey4 = 0x528b8bff, // ( 82,139,139) cadetblue4 = 0x53868bff, // ( 83,134,139) grey33 = 0x545454ff, // ( 84, 84, 84) palegreen4 = 0x548b54ff, // ( 84,139, 84) seagreen1 = 0x54ff9fff, // ( 84,255,159) purple4 = 0x551a8bff, // ( 85, 26,139) darkolivegreen = 0x556b2fff, // ( 85,107, 47) grey34 = 0x575757ff, // ( 87, 87, 87) grey35 = 0x595959ff, // ( 89, 89, 89) grey36 = 0x5c5c5cff, // ( 92, 92, 92) steelblue2 = 0x5caceeff, // ( 92,172,238) mediumpurple4 = 0x5d478bff, // ( 93, 71,139) grey37 = 0x5e5e5eff, // ( 94, 94, 94) cadetblue = 0x5f9ea0ff, // ( 95,158,160) lightskyblue4 = 0x607b8bff, // ( 96,123,139) grey38 = 0x616161ff, // ( 97, 97, 97) grey39 = 0x636363ff, // ( 99, 99, 99) steelblue1 = 0x63b8ffff, // ( 99,184,255) cornflowerblue1 = 0x6495edff, // (100,149,237) grey40 = 0x666666ff, // (102,102,102) paleturquoise4 = 0x668b8bff, // (102,139,139) chartreuse3 = 0x66cd00ff, // (102,205, 0) aquamarine3 = 0x66cdaaff, // (102,205,170) mediumaquamarine = 0x66cdaaff, // (102,205,170) darkorchid4 = 0x68228bff, // (104, 34,139) lightblue4 = 0x68838bff, // (104,131,139) slateblue3 = 0x6959cdff, // (105, 89,205) dimgrey = 0x696969ff, // (105,105,105) grey41 = 0x696969ff, // (105,105,105) olivedrab4 = 0x698b22ff, // (105,139, 34) darkseagreen4 = 0x698b69ff, // (105,139,105) slateblue = 0x6a5acdff, // (106, 90,205) grey42 = 0x6b6b6bff, // (107,107,107) mediumforestgreen = 0x6b8e23ff, // (107,142, 35) olivedrab = 0x6b8e23ff, // (107,142, 35) slategrey4 = 0x6c7b8bff, // (108,123,139) skyblue3 = 0x6ca6cdff, // (108,166,205) grey43 = 0x6e6e6eff, // (110,110,110) lightsteelblue4 = 0x6e7b8bff, // (110,123,139) darkolivegreen4 = 0x6e8b3dff, // (110,139, 61) grey44 = 0x707070ff, // (112,112,112) slategrey = 0x708090ff, // (112,128,144) grey45 = 0x737373ff, // (115,115,115) grey46 = 0x757575ff, // (117,117,117) chartreuse2 = 0x76ee00ff, // (118,238, 0) aquamarine2 = 0x76eec6ff, // (118,238,198) lightslategrey = 0x778899ff, // (119,136,153) grey47 = 0x787878ff, // (120,120,120) darkslategrey3 = 0x79cdcdff, // (121,205,205) mediumorchid4 = 0x7a378bff, // (122, 55,139) slateblue2 = 0x7a67eeff, // (122,103,238) grey48 = 0x7a7a7aff, // (122,122,122) lightcyan4 = 0x7a8b8bff, // (122,139,139) cadetblue3 = 0x7ac5cdff, // (122,197,205) mediumslateblue = 0x7b68eeff, // (123,104,238) palegreen3 = 0x7ccd7cff, // (124,205,124) lawngreen = 0x7cfc00ff, // (124,252, 0) purple3 = 0x7d26cdff, // (125, 38,205) grey49 = 0x7d7d7dff, // (125,125,125) skyblue2 = 0x7ec0eeff, // (126,192,238) grey50 = 0x7f7f7fff, // (127,127,127) chartreuse = 0x7fff00ff, // (127,255, 0) mediumspringgreen2 = 0x7fff00ff, // (127,255, 0) aquamarine = 0x7fffd4ff, // (127,255,212) grey51 = 0x828282ff, // (130,130,130) slateblue1 = 0x836fffff, // (131,111,255) honeydew4 = 0x838b83ff, // (131,139,131) azure4 = 0x838b8bff, // (131,139,139) lightslateblue = 0x8470ffff, // (132,112,255) grey52 = 0x858585ff, // (133,133,133) grey53 = 0x878787ff, // (135,135,135) skyblue = 0x87ceebff, // (135,206,235) lightskyblue = 0x87cefaff, // (135,206,250) skyblue1 = 0x87ceffff, // (135,206,255) mediumpurple3 = 0x8968cdff, // (137,104,205) blueviolet = 0x8a2be2ff, // (138, 43,226) purple5 = 0x8a2be2ff, // (138, 43,226) grey54 = 0x8a8a8aff, // (138,138,138) darkred = 0x8b0000ff, // (139, 0, 0) red4 = 0x8b0000ff, // (139, 0, 0) darkmagenta = 0x8b008bff, // (139, 0,139) magenta4 = 0x8b008bff, // (139, 0,139) deeppink4 = 0x8b0a50ff, // (139, 10, 80) firebrick4 = 0x8b1a1aff, // (139, 26, 26) maroon4 = 0x8b1c62ff, // (139, 28, 98) violetred4 = 0x8b2252ff, // (139, 34, 82) brown4 = 0x8b2323ff, // (139, 35, 35) orangered4 = 0x8b2500ff, // (139, 37, 0) tomato4 = 0x8b3626ff, // (139, 54, 38) hotpink4 = 0x8b3a62ff, // (139, 58, 98) coral4 = 0x8b3e2fff, // (139, 62, 47) mediumpink4 = 0x8b4462ff, // (139, 68, 98) darkorange4 = 0x8b4500ff, // (139, 69, 0) chocolate4 = 0x8b4513ff, // (139, 69, 19) saddlebrown = 0x8b4513ff, // (139, 69, 19) sienna4 = 0x8b4726ff, // (139, 71, 38) palevioletred4 = 0x8b475dff, // (139, 71, 93) orchid4 = 0x8b4789ff, // (139, 71,137) salmon4 = 0x8b4c39ff, // (139, 76, 57) lightsalmon4 = 0x8b5742ff, // (139, 87, 66) orange4 = 0x8b5a00ff, // (139, 90, 0) tan4 = 0x8b5a2bff, // (139, 90, 43) lightpink4 = 0x8b5f65ff, // (139, 95,101) pink4 = 0x8b636cff, // (139, 99,108) darkgoldenrod4 = 0x8b6508ff, // (139,101, 8) mediumgoldenrod4 = 0x8b6508ff, // (139,101, 8) plum4 = 0x8b668bff, // (139,102,139) goldenrod4 = 0x8b6914ff, // (139,105, 20) rosybrown4 = 0x8b6969ff, // (139,105,105) burlywood4 = 0x8b7355ff, // (139,115, 85) gold4 = 0x8b7500ff, // (139,117, 0) peachpuff4 = 0x8b7765ff, // (139,119,101) navajowhite4 = 0x8b795eff, // (139,121, 94) thistle4 = 0x8b7b8bff, // (139,123,139) bisque4 = 0x8b7d6bff, // (139,125,107) mistyrose4 = 0x8b7d7bff, // (139,125,123) wheat4 = 0x8b7e66ff, // (139,126,102) lightgoldenrod4 = 0x8b814cff, // (139,129, 76) oldgoldenrod4 = 0x8b814cff, // (139,129, 76) antiquewhite4 = 0x8b8378ff, // (139,131,120) lavenderblush4 = 0x8b8386ff, // (139,131,134) khaki4 = 0x8b864eff, // (139,134, 78) seashell4 = 0x8b8682ff, // (139,134,130) cornsilk4 = 0x8b8878ff, // (139,136,120) lemonchiffon4 = 0x8b8970ff, // (139,137,112) snow4 = 0x8b8989ff, // (139,137,137) yellow4 = 0x8b8b00ff, // (139,139, 0) oldmediumgoldenrod4 = 0x8b8b66ff, // (139,139,102) lightyellow4 = 0x8b8b7aff, // (139,139,122) ivory4 = 0x8b8b83ff, // (139,139,131) grey55 = 0x8c8c8cff, // (140,140,140) lightskyblue3 = 0x8db6cdff, // (141,182,205) darkslategrey2 = 0x8deeeeff, // (141,238,238) cadetblue2 = 0x8ee5eeff, // (142,229,238) grey56 = 0x8f8f8fff, // (143,143,143) darkseagreen = 0x8fbc8fff, // (143,188,143) lightgreen = 0x90ee90ff, // (144,238,144) palegreen2 = 0x90ee90ff, // (144,238,144) purple2 = 0x912ceeff, // (145, 44,238) grey57 = 0x919191ff, // (145,145,145) mediumpurple = 0x9370dbff, // (147,112,219) darkviolet = 0x9400d3ff, // (148, 0,211) grey58 = 0x949494ff, // (148,148,148) grey59 = 0x969696ff, // (150,150,150) paleturquoise3 = 0x96cdcdff, // (150,205,205) darkslategrey1 = 0x97ffffff, // (151,255,255) cadetblue1 = 0x98f5ffff, // (152,245,255) palegreen = 0x98fb98ff, // (152,251,152) darkorchid = 0x9932ccff, // (153, 50,204) grey60 = 0x999999ff, // (153,153,153) darkorchid3 = 0x9a32cdff, // (154, 50,205) lightblue3 = 0x9ac0cdff, // (154,192,205) olivedrab3 = 0x9acd32ff, // (154,205, 50) yellowgreen = 0x9acd32ff, // (154,205, 50) palegreen1 = 0x9aff9aff, // (154,255,154) purple1 = 0x9b30ffff, // (155, 48,255) darkseagreen3 = 0x9bcd9bff, // (155,205,155) grey61 = 0x9c9c9cff, // (156,156,156) grey62 = 0x9e9e9eff, // (158,158,158) mediumpurple2 = 0x9f79eeff, // (159,121,238) slategrey3 = 0x9fb6cdff, // (159,182,205) purple = 0xa020f0ff, // (160, 32,240) sienna = 0xa0522dff, // (160, 82, 45) grey63 = 0xa1a1a1ff, // (161,161,161) lightsteelblue3 = 0xa2b5cdff, // (162,181,205) darkolivegreen3 = 0xa2cd5aff, // (162,205, 90) grey64 = 0xa3a3a3ff, // (163,163,163) lightskyblue2 = 0xa4d3eeff, // (164,211,238) brown = 0xa52a2aff, // (165, 42, 42) grey65 = 0xa6a6a6ff, // (166,166,166) grey66 = 0xa8a8a8ff, // (168,168,168) darkgrey = 0xa9a9a9ff, // (169,169,169) mediumpurple1 = 0xab82ffff, // (171,130,255) grey67 = 0xabababff, // (171,171,171) grey68 = 0xadadadff, // (173,173,173) lightblue = 0xadd8e6ff, // (173,216,230) greenyellow = 0xadff2fff, // (173,255, 47) paleturquoise2 = 0xaeeeeeff, // (174,238,238) paleturquoise = 0xafeeeeff, // (175,238,238) maroon = 0xb03060ff, // (176, 48, 96) grey69 = 0xb0b0b0ff, // (176,176,176) lightsteelblue = 0xb0c4deff, // (176,196,222) powderblue = 0xb0e0e6ff, // (176,224,230) lightskyblue1 = 0xb0e2ffff, // (176,226,255) firebrick = 0xb22222ff, // (178, 34, 34) darkorchid2 = 0xb23aeeff, // (178, 58,238) lightblue2 = 0xb2dfeeff, // (178,223,238) grey70 = 0xb3b3b3ff, // (179,179,179) olivedrab2 = 0xb3ee3aff, // (179,238, 58) mediumorchid3 = 0xb452cdff, // (180, 82,205) lightcyan3 = 0xb4cdcdff, // (180,205,205) darkseagreen2 = 0xb4eeb4ff, // (180,238,180) grey71 = 0xb5b5b5ff, // (181,181,181) darkgoldenrod = 0xb8860bff, // (184,134, 11) mediumgoldenrod = 0xb8860bff, // (184,134, 11) grey72 = 0xb8b8b8ff, // (184,184,184) slategrey2 = 0xb9d3eeff, // (185,211,238) mediumorchid = 0xba55d3ff, // (186, 85,211) grey73 = 0xbababaff, // (186,186,186) paleturquoise1 = 0xbbffffff, // (187,255,255) rosybrown = 0xbc8f8fff, // (188,143,143) lightsteelblue2 = 0xbcd2eeff, // (188,210,238) darkolivegreen2 = 0xbcee68ff, // (188,238,104) darkkhaki = 0xbdb76bff, // (189,183,107) grey74 = 0xbdbdbdff, // (189,189,189) grey = 0xbebebeff, // (190,190,190) darkorchid1 = 0xbf3effff, // (191, 62,255) grey75 = 0xbfbfbfff, // (191,191,191) lightblue1 = 0xbfefffff, // (191,239,255) olivedrab1 = 0xc0ff3eff, // (192,255, 62) honeydew3 = 0xc1cdc1ff, // (193,205,193) azure3 = 0xc1cdcdff, // (193,205,205) darkseagreen1 = 0xc1ffc1ff, // (193,255,193) grey76 = 0xc2c2c2ff, // (194,194,194) grey77 = 0xc4c4c4ff, // (196,196,196) slategrey1 = 0xc6e2ffff, // (198,226,255) mediumvioletred = 0xc71585ff, // (199, 21,133) grey78 = 0xc7c7c7ff, // (199,199,199) grey79 = 0xc9c9c9ff, // (201,201,201) lightsteelblue1 = 0xcae1ffff, // (202,225,255) darkolivegreen1 = 0xcaff70ff, // (202,255,112) grey80 = 0xccccccff, // (204,204,204) red3 = 0xcd0000ff, // (205, 0, 0) magenta3 = 0xcd00cdff, // (205, 0,205) deeppink3 = 0xcd1076ff, // (205, 16,118) firebrick3 = 0xcd2626ff, // (205, 38, 38) maroon3 = 0xcd2990ff, // (205, 41,144) violetred3 = 0xcd3278ff, // (205, 50,120) brown3 = 0xcd3333ff, // (205, 51, 51) orangered3 = 0xcd3700ff, // (205, 55, 0) tomato3 = 0xcd4f39ff, // (205, 79, 57) indianred3 = 0xcd5555ff, // (205, 85, 85) coral3 = 0xcd5b45ff, // (205, 91, 69) indianred = 0xcd5c5cff, // (205, 92, 92) hotpink3 = 0xcd6090ff, // (205, 96,144) mediumpink3 = 0xcd6490ff, // (205,100,144) darkorange3 = 0xcd6600ff, // (205,102, 0) chocolate3 = 0xcd661dff, // (205,102, 29) sienna3 = 0xcd6839ff, // (205,104, 57) palevioletred3 = 0xcd6889ff, // (205,104,137) orchid3 = 0xcd69c9ff, // (205,105,201) salmon3 = 0xcd7054ff, // (205,112, 84) lightsalmon3 = 0xcd8162ff, // (205,129, 98) orange3 = 0xcd8500ff, // (205,133, 0) peru = 0xcd853fff, // (205,133, 63) tan3 = 0xcd853fff, // (205,133, 63) lightpink3 = 0xcd8c95ff, // (205,140,149) pink3 = 0xcd919eff, // (205,145,158) darkgoldenrod3 = 0xcd950cff, // (205,149, 12) mediumgoldenrod3 = 0xcd950cff, // (205,149, 12) plum3 = 0xcd96cdff, // (205,150,205) goldenrod3 = 0xcd9b1dff, // (205,155, 29) rosybrown3 = 0xcd9b9bff, // (205,155,155) burlywood3 = 0xcdaa7dff, // (205,170,125) gold3 = 0xcdad00ff, // (205,173, 0) peachpuff3 = 0xcdaf95ff, // (205,175,149) navajowhite3 = 0xcdb38bff, // (205,179,139) thistle3 = 0xcdb5cdff, // (205,181,205) bisque3 = 0xcdb79eff, // (205,183,158) mistyrose3 = 0xcdb7b5ff, // (205,183,181) wheat3 = 0xcdba96ff, // (205,186,150) lightgoldenrod3 = 0xcdbe70ff, // (205,190,112) oldgoldenrod3 = 0xcdbe70ff, // (205,190,112) antiquewhite3 = 0xcdc0b0ff, // (205,192,176) lavenderblush3 = 0xcdc1c5ff, // (205,193,197) seashell3 = 0xcdc5bfff, // (205,197,191) khaki3 = 0xcdc673ff, // (205,198,115) cornsilk3 = 0xcdc8b1ff, // (205,200,177) lemonchiffon3 = 0xcdc9a5ff, // (205,201,165) snow3 = 0xcdc9c9ff, // (205,201,201) yellow3 = 0xcdcd00ff, // (205,205, 0) oldmediumgoldenrod3 = 0xcdcd96ff, // (205,205,150) lightyellow3 = 0xcdcdb4ff, // (205,205,180) ivory3 = 0xcdcdc1ff, // (205,205,193) grey81 = 0xcfcfcfff, // (207,207,207) violetred = 0xd02090ff, // (208, 32,144) mediumorchid2 = 0xd15feeff, // (209, 95,238) grey82 = 0xd1d1d1ff, // (209,209,209) lightcyan2 = 0xd1eeeeff, // (209,238,238) chocolate = 0xd2691eff, // (210,105, 30) tan = 0xd2b48cff, // (210,180,140) lightgrey = 0xd3d3d3ff, // (211,211,211) grey83 = 0xd4d4d4ff, // (212,212,212) grey84 = 0xd6d6d6ff, // (214,214,214) thistle = 0xd8bfd8ff, // (216,191,216) grey85 = 0xd9d9d9ff, // (217,217,217) orchid = 0xda70d6ff, // (218,112,214) goldenrod = 0xdaa520ff, // (218,165, 32) palevioletred = 0xdb7093ff, // (219,112,147) grey86 = 0xdbdbdbff, // (219,219,219) gainsboro = 0xdcdcdcff, // (220,220,220) plum = 0xdda0ddff, // (221,160,221) burlywood = 0xdeb887ff, // (222,184,135) grey87 = 0xdededeff, // (222,222,222) mediumorchid1 = 0xe066ffff, // (224,102,255) grey88 = 0xe0e0e0ff, // (224,224,224) honeydew2 = 0xe0eee0ff, // (224,238,224) azure2 = 0xe0eeeeff, // (224,238,238) lightcyan = 0xe0ffffff, // (224,255,255) grey89 = 0xe3e3e3ff, // (227,227,227) grey90 = 0xe5e5e5ff, // (229,229,229) lavender = 0xe6e6faff, // (230,230,250) grey91 = 0xe8e8e8ff, // (232,232,232) darksalmon = 0xe9967aff, // (233,150,122) grey92 = 0xebebebff, // (235,235,235) grey93 = 0xedededff, // (237,237,237) red2 = 0xee0000ff, // (238, 0, 0) magenta2 = 0xee00eeff, // (238, 0,238) deeppink2 = 0xee1289ff, // (238, 18,137) firebrick2 = 0xee2c2cff, // (238, 44, 44) maroon2 = 0xee30a7ff, // (238, 48,167) violetred2 = 0xee3a8cff, // (238, 58,140) brown2 = 0xee3b3bff, // (238, 59, 59) orangered2 = 0xee4000ff, // (238, 64, 0) tomato2 = 0xee5c42ff, // (238, 92, 66) indianred2 = 0xee6363ff, // (238, 99, 99) coral2 = 0xee6a50ff, // (238,106, 80) hotpink2 = 0xee6aa7ff, // (238,106,167) mediumpink2 = 0xee74a7ff, // (238,116,167) darkorange2 = 0xee7600ff, // (238,118, 0) chocolate2 = 0xee7621ff, // (238,118, 33) sienna2 = 0xee7942ff, // (238,121, 66) palevioletred2 = 0xee799fff, // (238,121,159) orchid2 = 0xee7ae9ff, // (238,122,233) salmon2 = 0xee8262ff, // (238,130, 98) violet = 0xee82eeff, // (238,130,238) lightsalmon2 = 0xee9572ff, // (238,149,114) orange2 = 0xee9a00ff, // (238,154, 0) tan2 = 0xee9a49ff, // (238,154, 73) lightpink2 = 0xeea2adff, // (238,162,173) pink2 = 0xeea9b8ff, // (238,169,184) darkgoldenrod2 = 0xeead0eff, // (238,173, 14) mediumgoldenrod2 = 0xeead0eff, // (238,173, 14) plum2 = 0xeeaeeeff, // (238,174,238) goldenrod2 = 0xeeb422ff, // (238,180, 34) rosybrown2 = 0xeeb4b4ff, // (238,180,180) burlywood2 = 0xeec591ff, // (238,197,145) gold2 = 0xeec900ff, // (238,201, 0) peachpuff2 = 0xeecbadff, // (238,203,173) navajowhite2 = 0xeecfa1ff, // (238,207,161) thistle2 = 0xeed2eeff, // (238,210,238) bisque2 = 0xeed5b7ff, // (238,213,183) mistyrose2 = 0xeed5d2ff, // (238,213,210) wheat2 = 0xeed8aeff, // (238,216,174) lightgoldenrod2 = 0xeedc82ff, // (238,220,130) oldgoldenrod2 = 0xeedc82ff, // (238,220,130) lightgoldenrod = 0xeedd82ff, // (238,221,130) oldgoldenrod = 0xeedd82ff, // (238,221,130) antiquewhite2 = 0xeedfccff, // (238,223,204) lavenderblush2 = 0xeee0e5ff, // (238,224,229) seashell2 = 0xeee5deff, // (238,229,222) khaki2 = 0xeee685ff, // (238,230,133) palegoldenrod = 0xeee8aaff, // (238,232,170) cornsilk2 = 0xeee8cdff, // (238,232,205) lemonchiffon2 = 0xeee9bfff, // (238,233,191) snow2 = 0xeee9e9ff, // (238,233,233) yellow2 = 0xeeee00ff, // (238,238, 0) oldmediumgoldenrod2 = 0xeeeeaeff, // (238,238,174) oldmediumgoldenrod = 0xeeeeafff, // (238,238,175) lightyellow2 = 0xeeeed1ff, // (238,238,209) ivory2 = 0xeeeee0ff, // (238,238,224) lightcoral = 0xf08080ff, // (240,128,128) khaki = 0xf0e68cff, // (240,230,140) grey94 = 0xf0f0f0ff, // (240,240,240) aliceblue = 0xf0f8ffff, // (240,248,255) honeydew = 0xf0fff0ff, // (240,255,240) azure = 0xf0ffffff, // (240,255,255) grey95 = 0xf2f2f2ff, // (242,242,242) sandybrown = 0xf4a460ff, // (244,164, 96) wheat = 0xf5deb3ff, // (245,222,179) beige = 0xf5f5dcff, // (245,245,220) grey96 = 0xf5f5f5ff, // (245,245,245) whitesmoke = 0xf5f5f5ff, // (245,245,245) mintcream = 0xf5fffaff, // (245,255,250) grey97 = 0xf7f7f7ff, // (247,247,247) ghostwhite = 0xf8f8ffff, // (248,248,255) salmon = 0xfa8072ff, // (250,128,114) antiquewhite = 0xfaebd7ff, // (250,235,215) linen = 0xfaf0e6ff, // (250,240,230) lightgoldenrodyellow = 0xfafad2ff, // (250,250,210) grey98 = 0xfafafaff, // (250,250,250) grey99 = 0xfcfcfcff, // (252,252,252) oldlace = 0xfdf5e6ff, // (253,245,230) red = 0xff0000ff, // (255, 0, 0) magenta = 0xff00ffff, // (255, 0,255) deeppink = 0xff1493ff, // (255, 20,147) firebrick1 = 0xff3030ff, // (255, 48, 48) maroon1 = 0xff34b3ff, // (255, 52,179) violetred1 = 0xff3e96ff, // (255, 62,150) brown1 = 0xff4040ff, // (255, 64, 64) orangered = 0xff4500ff, // (255, 69, 0) tomato = 0xff6347ff, // (255, 99, 71) hotpink = 0xff69b4ff, // (255,105,180) indianred1 = 0xff6a6aff, // (255,106,106) hotpink1 = 0xff6eb4ff, // (255,110,180) coral = 0xff7256ff, // (255,114, 86) mediumpink = 0xff7db3ff, // (255,125,179) darkorange = 0xff7f00ff, // (255,127, 0) chocolate1 = 0xff7f24ff, // (255,127, 36) coral1 = 0xff7f50ff, // (255,127, 80) sienna1 = 0xff8247ff, // (255,130, 71) palevioletred1 = 0xff82abff, // (255,130,171) orchid1 = 0xff83faff, // (255,131,250) darkorange1 = 0xff8c00ff, // (255,140, 0) salmon1 = 0xff8c69ff, // (255,140,105) lightsalmon = 0xffa07aff, // (255,160,122) orange = 0xffa500ff, // (255,165, 0) tan1 = 0xffa54fff, // (255,165, 79) palepink = 0xffaac8ff, // (255,170,200) lightpink1 = 0xffaeb9ff, // (255,174,185) pink1 = 0xffb5c5ff, // (255,181,197) lightpink = 0xffb6c1ff, // (255,182,193) darkgoldenrod1 = 0xffb90fff, // (255,185, 15) mediumgoldenrod1 = 0xffb90fff, // (255,185, 15) plum1 = 0xffbbffff, // (255,187,255) pink = 0xffc0cbff, // (255,192,203) goldenrod1 = 0xffc125ff, // (255,193, 37) rosybrown1 = 0xffc1c1ff, // (255,193,193) burlywood1 = 0xffd39bff, // (255,211,155) gold = 0xffd700ff, // (255,215, 0) peachpuff = 0xffdab9ff, // (255,218,185) navajowhite = 0xffdeadff, // (255,222,173) thistle1 = 0xffe1ffff, // (255,225,255) moccasin = 0xffe4b5ff, // (255,228,181) bisque = 0xffe4c4ff, // (255,228,196) mistyrose = 0xffe4e1ff, // (255,228,225) wheat1 = 0xffe7baff, // (255,231,186) blanchedalmond = 0xffebcdff, // (255,235,205) lightgoldenrod1 = 0xffec8bff, // (255,236,139) oldgoldenrod1 = 0xffec8bff, // (255,236,139) papayawhip = 0xffefd5ff, // (255,239,213) antiquewhite1 = 0xffefdbff, // (255,239,219) lavenderblush = 0xfff0f5ff, // (255,240,245) seashell = 0xfff5eeff, // (255,245,238) khaki1 = 0xfff68fff, // (255,246,143) cornsilk = 0xfff8dcff, // (255,248,220) lemonchiffon = 0xfffacdff, // (255,250,205) floralwhite = 0xfffaf0ff, // (255,250,240) snow = 0xfffafaff, // (255,250,250) yellow = 0xffff00ff, // (255,255, 0) oldmediumgoldenrod1 = 0xffffbbff, // (255,255,187) lightyellow = 0xffffe0ff, // (255,255,224) ivory = 0xfffff0ff, // (255,255,240) grey100 = 0xffffffff, // (255,255,255) white = 0xffffffff, // (255,255,255) Count = 543 }; static inline const std::vector<sf::Color> Colors{ sf::Color(black), sf::Color(grey0), sf::Color(navy), sf::Color(blue4), sf::Color(darkblue), sf::Color(blue3), sf::Color(mediumblue), sf::Color(blue2), sf::Color(blue), sf::Color(darkgreen), sf::Color(darkgreen1), sf::Color(deepskyblue4), sf::Color(turquoise4), sf::Color(green4), sf::Color(springgreen4), sf::Color(cyan4), sf::Color(darkcyan), sf::Color(deepskyblue3), sf::Color(deepskyblue2), sf::Color(deepskyblue), sf::Color(darkturquoise1), sf::Color(turquoise3), sf::Color(green3), sf::Color(springgreen3), sf::Color(cyan3), sf::Color(darkturquoise), sf::Color(mediumturquoise2), sf::Color(turquoise2), sf::Color(green2), sf::Color(springgreen2), sf::Color(cyan2), sf::Color(turquoise1), sf::Color(mediumspringgreen), sf::Color(green), sf::Color(springgreen), sf::Color(cyan), sf::Color(grey1), sf::Color(grey2), sf::Color(grey3), sf::Color(grey4), sf::Color(grey5), sf::Color(grey6), sf::Color(dodgerblue4), sf::Color(grey7), sf::Color(grey8), sf::Color(grey9), sf::Color(dodgerblue3), sf::Color(midnightblue1), sf::Color(midnightblue), sf::Color(grey10), sf::Color(grey11), sf::Color(dodgerblue2), sf::Color(dodgerblue), sf::Color(grey12), sf::Color(lightseagreen), sf::Color(grey13), sf::Color(cornflowerblue), sf::Color(forestgreen), sf::Color(grey14), sf::Color(grey15), sf::Color(royalblue4), sf::Color(grey16), sf::Color(grey17), sf::Color(grey18), sf::Color(seagreen), sf::Color(darkslategrey), sf::Color(grey19), sf::Color(limegreen), sf::Color(grey20), sf::Color(grey21), sf::Color(steelblue4), sf::Color(grey22), sf::Color(royalblue3), sf::Color(grey23), sf::Color(mediumseagreen), sf::Color(grey24), sf::Color(grey25), sf::Color(turquoise), sf::Color(royalblue), sf::Color(grey26), sf::Color(royalblue2), sf::Color(seagreen3), sf::Color(grey27), sf::Color(chartreuse4), sf::Color(aquamarine4), sf::Color(steelblue), sf::Color(slateblue4), sf::Color(grey28), sf::Color(darkslateblue), sf::Color(royalblue1), sf::Color(mediumturquoise), sf::Color(grey29), sf::Color(skyblue4), sf::Color(grey30), sf::Color(seagreen2), sf::Color(grey31), sf::Color(steelblue3), sf::Color(grey32), sf::Color(darkslategrey4), sf::Color(cadetblue4), sf::Color(grey33), sf::Color(palegreen4), sf::Color(seagreen1), sf::Color(purple4), sf::Color(darkolivegreen), sf::Color(grey34), sf::Color(grey35), sf::Color(grey36), sf::Color(steelblue2), sf::Color(mediumpurple4), sf::Color(grey37), sf::Color(cadetblue), sf::Color(lightskyblue4), sf::Color(grey38), sf::Color(grey39), sf::Color(steelblue1), sf::Color(cornflowerblue1), sf::Color(grey40), sf::Color(paleturquoise4), sf::Color(chartreuse3), sf::Color(aquamarine3), sf::Color(mediumaquamarine), sf::Color(darkorchid4), sf::Color(lightblue4), sf::Color(slateblue3), sf::Color(dimgrey), sf::Color(grey41), sf::Color(olivedrab4), sf::Color(darkseagreen4), sf::Color(slateblue), sf::Color(grey42), sf::Color(mediumforestgreen), sf::Color(olivedrab), sf::Color(slategrey4), sf::Color(skyblue3), sf::Color(grey43), sf::Color(lightsteelblue4), sf::Color(darkolivegreen4), sf::Color(grey44), sf::Color(slategrey), sf::Color(grey45), sf::Color(grey46), sf::Color(chartreuse2), sf::Color(aquamarine2), sf::Color(lightslategrey), sf::Color(grey47), sf::Color(darkslategrey3), sf::Color(mediumorchid4), sf::Color(slateblue2), sf::Color(grey48), sf::Color(lightcyan4), sf::Color(cadetblue3), sf::Color(mediumslateblue), sf::Color(palegreen3), sf::Color(lawngreen), sf::Color(purple3), sf::Color(grey49), sf::Color(skyblue2), sf::Color(grey50), sf::Color(chartreuse), sf::Color(mediumspringgreen2), sf::Color(aquamarine), sf::Color(grey51), sf::Color(slateblue1), sf::Color(honeydew4), sf::Color(azure4), sf::Color(lightslateblue), sf::Color(grey52), sf::Color(grey53), sf::Color(skyblue), sf::Color(lightskyblue), sf::Color(skyblue1), sf::Color(mediumpurple3), sf::Color(blueviolet), sf::Color(purple5), sf::Color(grey54), sf::Color(darkred), sf::Color(red4), sf::Color(darkmagenta), sf::Color(magenta4), sf::Color(deeppink4), sf::Color(firebrick4), sf::Color(maroon4), sf::Color(violetred4), sf::Color(brown4), sf::Color(orangered4), sf::Color(tomato4), sf::Color(hotpink4), sf::Color(coral4), sf::Color(mediumpink4), sf::Color(darkorange4), sf::Color(chocolate4), sf::Color(saddlebrown), sf::Color(sienna4), sf::Color(palevioletred4), sf::Color(orchid4), sf::Color(salmon4), sf::Color(lightsalmon4), sf::Color(orange4), sf::Color(tan4), sf::Color(lightpink4), sf::Color(pink4), sf::Color(darkgoldenrod4), sf::Color(mediumgoldenrod4), sf::Color(plum4), sf::Color(goldenrod4), sf::Color(rosybrown4), sf::Color(burlywood4), sf::Color(gold4), sf::Color(peachpuff4), sf::Color(navajowhite4), sf::Color(thistle4), sf::Color(bisque4), sf::Color(mistyrose4), sf::Color(wheat4), sf::Color(lightgoldenrod4), sf::Color(oldgoldenrod4), sf::Color(antiquewhite4), sf::Color(lavenderblush4), sf::Color(khaki4), sf::Color(seashell4), sf::Color(cornsilk4), sf::Color(lemonchiffon4), sf::Color(snow4), sf::Color(yellow4), sf::Color(oldmediumgoldenrod4), sf::Color(lightyellow4), sf::Color(ivory4), sf::Color(grey55), sf::Color(lightskyblue3), sf::Color(darkslategrey2), sf::Color(cadetblue2), sf::Color(grey56), sf::Color(darkseagreen), sf::Color(lightgreen), sf::Color(palegreen2), sf::Color(purple2), sf::Color(grey57), sf::Color(mediumpurple), sf::Color(darkviolet), sf::Color(grey58), sf::Color(grey59), sf::Color(paleturquoise3), sf::Color(darkslategrey1), sf::Color(cadetblue1), sf::Color(palegreen), sf::Color(darkorchid), sf::Color(grey60), sf::Color(darkorchid3), sf::Color(lightblue3), sf::Color(olivedrab3), sf::Color(yellowgreen), sf::Color(palegreen1), sf::Color(purple1), sf::Color(darkseagreen3), sf::Color(grey61), sf::Color(grey62), sf::Color(mediumpurple2), sf::Color(slategrey3), sf::Color(purple), sf::Color(sienna), sf::Color(grey63), sf::Color(lightsteelblue3), sf::Color(darkolivegreen3), sf::Color(grey64), sf::Color(lightskyblue2), sf::Color(brown), sf::Color(grey65), sf::Color(grey66), sf::Color(darkgrey), sf::Color(mediumpurple1), sf::Color(grey67), sf::Color(grey68), sf::Color(lightblue), sf::Color(greenyellow), sf::Color(paleturquoise2), sf::Color(paleturquoise), sf::Color(maroon), sf::Color(grey69), sf::Color(lightsteelblue), sf::Color(powderblue), sf::Color(lightskyblue1), sf::Color(firebrick), sf::Color(darkorchid2), sf::Color(lightblue2), sf::Color(grey70), sf::Color(olivedrab2), sf::Color(mediumorchid3), sf::Color(lightcyan3), sf::Color(darkseagreen2), sf::Color(grey71), sf::Color(darkgoldenrod), sf::Color(mediumgoldenrod), sf::Color(grey72), sf::Color(slategrey2), sf::Color(mediumorchid), sf::Color(grey73), sf::Color(paleturquoise1), sf::Color(rosybrown), sf::Color(lightsteelblue2), sf::Color(darkolivegreen2), sf::Color(darkkhaki), sf::Color(grey74), sf::Color(grey), sf::Color(darkorchid1), sf::Color(grey75), sf::Color(lightblue1), sf::Color(olivedrab1), sf::Color(honeydew3), sf::Color(azure3), sf::Color(darkseagreen1), sf::Color(grey76), sf::Color(grey77), sf::Color(slategrey1), sf::Color(mediumvioletred), sf::Color(grey78), sf::Color(grey79), sf::Color(lightsteelblue1), sf::Color(darkolivegreen1), sf::Color(grey80), sf::Color(red3), sf::Color(magenta3), sf::Color(deeppink3), sf::Color(firebrick3), sf::Color(maroon3), sf::Color(violetred3), sf::Color(brown3), sf::Color(orangered3), sf::Color(tomato3), sf::Color(indianred3), sf::Color(coral3), sf::Color(indianred), sf::Color(hotpink3), sf::Color(mediumpink3), sf::Color(darkorange3), sf::Color(chocolate3), sf::Color(sienna3), sf::Color(palevioletred3), sf::Color(orchid3), sf::Color(salmon3), sf::Color(lightsalmon3), sf::Color(orange3), sf::Color(peru), sf::Color(tan3), sf::Color(lightpink3), sf::Color(pink3), sf::Color(darkgoldenrod3), sf::Color(mediumgoldenrod3), sf::Color(plum3), sf::Color(goldenrod3), sf::Color(rosybrown3), sf::Color(burlywood3), sf::Color(gold3), sf::Color(peachpuff3), sf::Color(navajowhite3), sf::Color(thistle3), sf::Color(bisque3), sf::Color(mistyrose3), sf::Color(wheat3), sf::Color(lightgoldenrod3), sf::Color(oldgoldenrod3), sf::Color(antiquewhite3), sf::Color(lavenderblush3), sf::Color(seashell3), sf::Color(khaki3), sf::Color(cornsilk3), sf::Color(lemonchiffon3), sf::Color(snow3), sf::Color(yellow3), sf::Color(oldmediumgoldenrod3), sf::Color(lightyellow3), sf::Color(ivory3), sf::Color(grey81), sf::Color(violetred), sf::Color(mediumorchid2), sf::Color(grey82), sf::Color(lightcyan2), sf::Color(chocolate), sf::Color(tan), sf::Color(lightgrey), sf::Color(grey83), sf::Color(grey84), sf::Color(thistle), sf::Color(grey85), sf::Color(orchid), sf::Color(goldenrod), sf::Color(palevioletred), sf::Color(grey86), sf::Color(gainsboro), sf::Color(plum), sf::Color(burlywood), sf::Color(grey87), sf::Color(mediumorchid1), sf::Color(grey88), sf::Color(honeydew2), sf::Color(azure2), sf::Color(lightcyan), sf::Color(grey89), sf::Color(grey90), sf::Color(lavender), sf::Color(grey91), sf::Color(darksalmon), sf::Color(grey92), sf::Color(grey93), sf::Color(red2), sf::Color(magenta2), sf::Color(deeppink2), sf::Color(firebrick2), sf::Color(maroon2), sf::Color(violetred2), sf::Color(brown2), sf::Color(orangered2), sf::Color(tomato2), sf::Color(indianred2), sf::Color(coral2), sf::Color(hotpink2), sf::Color(mediumpink2), sf::Color(darkorange2), sf::Color(chocolate2), sf::Color(sienna2), sf::Color(palevioletred2), sf::Color(orchid2), sf::Color(salmon2), sf::Color(violet), sf::Color(lightsalmon2), sf::Color(orange2), sf::Color(tan2), sf::Color(lightpink2), sf::Color(pink2), sf::Color(darkgoldenrod2), sf::Color(mediumgoldenrod2), sf::Color(plum2), sf::Color(goldenrod2), sf::Color(rosybrown2), sf::Color(burlywood2), sf::Color(gold2), sf::Color(peachpuff2), sf::Color(navajowhite2), sf::Color(thistle2), sf::Color(bisque2), sf::Color(mistyrose2), sf::Color(wheat2), sf::Color(lightgoldenrod2), sf::Color(oldgoldenrod2), sf::Color(lightgoldenrod), sf::Color(oldgoldenrod), sf::Color(antiquewhite2), sf::Color(lavenderblush2), sf::Color(seashell2), sf::Color(khaki2), sf::Color(palegoldenrod), sf::Color(cornsilk2), sf::Color(lemonchiffon2), sf::Color(snow2), sf::Color(yellow2), sf::Color(oldmediumgoldenrod2), sf::Color(oldmediumgoldenrod), sf::Color(lightyellow2), sf::Color(ivory2), sf::Color(lightcoral), sf::Color(khaki), sf::Color(grey94), sf::Color(aliceblue), sf::Color(honeydew), sf::Color(azure), sf::Color(grey95), sf::Color(sandybrown), sf::Color(wheat), sf::Color(beige), sf::Color(grey96), sf::Color(whitesmoke), sf::Color(mintcream), sf::Color(grey97), sf::Color(ghostwhite), sf::Color(salmon), sf::Color(antiquewhite), sf::Color(linen), sf::Color(lightgoldenrodyellow), sf::Color(grey98), sf::Color(grey99), sf::Color(oldlace), sf::Color(red), sf::Color(magenta), sf::Color(deeppink), sf::Color(firebrick1), sf::Color(maroon1), sf::Color(violetred1), sf::Color(brown1), sf::Color(orangered), sf::Color(tomato), sf::Color(hotpink), sf::Color(indianred1), sf::Color(hotpink1), sf::Color(coral), sf::Color(mediumpink), sf::Color(darkorange), sf::Color(chocolate1), sf::Color(coral1), sf::Color(sienna1), sf::Color(palevioletred1), sf::Color(orchid1), sf::Color(darkorange1), sf::Color(salmon1), sf::Color(lightsalmon), sf::Color(orange), sf::Color(tan1), sf::Color(palepink), sf::Color(lightpink1), sf::Color(pink1), sf::Color(lightpink), sf::Color(darkgoldenrod1), sf::Color(mediumgoldenrod1), sf::Color(plum1), sf::Color(pink), sf::Color(goldenrod1), sf::Color(rosybrown1), sf::Color(burlywood1), sf::Color(gold), sf::Color(peachpuff), sf::Color(navajowhite), sf::Color(thistle1), sf::Color(moccasin), sf::Color(bisque), sf::Color(mistyrose), sf::Color(wheat1), sf::Color(blanchedalmond), sf::Color(lightgoldenrod1), sf::Color(oldgoldenrod1), sf::Color(papayawhip), sf::Color(antiquewhite1), sf::Color(lavenderblush), sf::Color(seashell), sf::Color(khaki1), sf::Color(cornsilk), sf::Color(lemonchiffon), sf::Color(floralwhite), sf::Color(snow), sf::Color(yellow), sf::Color(oldmediumgoldenrod1), sf::Color(lightyellow), sf::Color(ivory), sf::Color(grey100), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "x11_543" }; }; // 949 colors from a massive study of NAMES CHOSEN BY PEOPLE (www.xkcd.com/color) struct xkcd_949 { // clang-format off enum Enum : sf::Uint32 { black = 0x000000ff, // (0, 0, 0) verydarkblue = 0x000133ff, // (0, 1, 51) darknavyblue = 0x00022eff, // (0, 2, 46) darkblue1 = 0x00035bff, // (0, 3, 91) darknavy = 0x000435ff, // (0, 4, 53) navyblue = 0x001146ff, // (0, 17, 70) darkforestgreen = 0x002d04ff, // (0, 45, 4) prussianblue = 0x004577ff, // (0, 69, 119) darkbluegreen = 0x005249ff, // (0, 82, 73) deepteal = 0x00555aff, // (0, 85, 90) petrol = 0x005f6aff, // (0, 95, 106) kelleygreen = 0x009337ff, // (0, 147, 55) greenishturquoise = 0x00fbb0ff, // (0, 251, 176) cyan = 0x00ffffff, // (0, 255, 255) trueblue = 0x010fccff, // (1, 15, 204) navy = 0x01153eff, // (1, 21, 62) marineblue = 0x01386aff, // (1, 56, 106) darkishblue = 0x014182ff, // (1, 65, 130) racinggreen = 0x014600ff, // (1, 70, 0) darkteal = 0x014d4eff, // (1, 77, 78) deepseablue = 0x015482ff, // (1, 84, 130) brightblue = 0x0165fcff, // (1, 101, 252) peacockblue = 0x016795ff, // (1, 103, 149) darkaquamarine = 0x017371ff, // (1, 115, 113) deepturquoise = 0x017374ff, // (1, 115, 116) bluegreen1 = 0x017a79ff, // (1, 122, 121) ocean = 0x017b92ff, // (1, 123, 146) tealblue = 0x01889fff, // (1, 136, 159) irishgreen = 0x019529ff, // (1, 149, 41) emerald = 0x01a049ff, // (1, 160, 73) shamrock = 0x01b44cff, // (1, 180, 76) greenblue1 = 0x01c08dff, // (1, 192, 141) brightteal = 0x01f9c6ff, // (1, 249, 198) brightgreen = 0x01ff07ff, // (1, 255, 7) midnightblue = 0x020035ff, // (2, 0, 53) pureblue = 0x0203e2ff, // (2, 3, 226) darkroyalblue = 0x02066fff, // (2, 6, 111) richblue = 0x021bf9ff, // (2, 27, 249) deepgreen = 0x02590fff, // (2, 89, 15) emeraldgreen = 0x028f1eff, // (2, 143, 30) teal = 0x029386ff, // (2, 147, 134) kellygreen = 0x02ab2eff, // (2, 171, 46) shamrockgreen = 0x02c14dff, // (2, 193, 77) brightskyblue = 0x02ccfeff, // (2, 204, 254) aquablue = 0x02d8e9ff, // (2, 216, 233) midnight = 0x03012dff, // (3, 1, 45) darkblue2 = 0x030764ff, // (3, 7, 100) cobaltblue = 0x030aa7ff, // (3, 10, 167) blue = 0x0343dfff, // (3, 67, 223) darkgreen1 = 0x033500ff, // (3, 53, 0) vibrantblue = 0x0339f8ff, // (3, 57, 248) oceanblue = 0x03719cff, // (3, 113, 156) deepblue = 0x040273ff, // (4, 2, 115) nightblue = 0x040348ff, // (4, 3, 72) marine = 0x042e60ff, // (4, 46, 96) bottlegreen = 0x044a05ff, // (4, 74, 5) darkturquoise = 0x045c5aff, // (4, 92, 90) seablue = 0x047495ff, // (4, 116, 149) junglegreen = 0x048243ff, // (4, 130, 67) cerulean = 0x0485d1ff, // (4, 133, 209) aquamarine1 = 0x04d8b2ff, // (4, 216, 178) neonblue = 0x04d9ffff, // (4, 217, 255) turquoisegreen = 0x04f489ff, // (4, 244, 137) royalblue = 0x0504aaff, // (5, 4, 170) evergreen = 0x05472aff, // (5, 71, 42) britishracinggreen = 0x05480dff, // (5, 72, 13) darkgreen2 = 0x054907ff, // (5, 73, 7) darkaqua = 0x05696bff, // (5, 105, 107) ceruleanblue = 0x056eeeff, // (5, 110, 238) brightseagreen = 0x05ffa6ff, // (5, 255, 166) verydarkgreen = 0x062e03ff, // (6, 46, 3) forestgreen = 0x06470cff, // (6, 71, 12) electricblue = 0x0652ffff, // (6, 82, 255) azure = 0x069af3ff, // (6, 154, 243) turquoiseblue = 0x06b1c4ff, // (6, 177, 196) greenblue2 = 0x06b48bff, // (6, 180, 139) turquoise = 0x06c2acff, // (6, 194, 172) almostblack = 0x070d0dff, // (7, 13, 13) primaryblue = 0x0804f9ff, // (8, 4, 249) deepaqua = 0x08787fff, // (8, 120, 127) truegreen = 0x089404ff, // (8, 148, 4) fluorescentgreen = 0x08ff08ff, // (8, 255, 8) twilightblue = 0x0a437aff, // (10, 67, 122) pinegreen = 0x0a481eff, // (10, 72, 30) spruce = 0x0a5f38ff, // (10, 95, 56) darkcyan = 0x0a888aff, // (10, 136, 138) vibrantgreen = 0x0add08ff, // (10, 221, 8) flurogreen = 0x0aff02ff, // (10, 255, 2) huntergreen = 0x0b4008ff, // (11, 64, 8) forest = 0x0b5509ff, // (11, 85, 9) greenishblue = 0x0b8b87ff, // (11, 139, 135) mintygreen = 0x0bf77dff, // (11, 247, 125) brightaqua = 0x0bf9eaff, // (11, 249, 234) strongblue = 0x0c06f7ff, // (12, 6, 247) royal = 0x0c1793ff, // (12, 23, 147) greenteal = 0x0cb577ff, // (12, 181, 119) tealishgreen = 0x0cdc73ff, // (12, 220, 115) neongreen = 0x0cff0cff, // (12, 255, 12) deepskyblue = 0x0d75f8ff, // (13, 117, 248) waterblue = 0x0e87ccff, // (14, 135, 204) bluegreen2 = 0x0f9b8eff, // (15, 155, 142) brightturquoise = 0x0ffef9ff, // (15, 254, 249) niceblue = 0x107ab0ff, // (16, 122, 176) bluishgreen = 0x10a674ff, // (16, 166, 116) darkseagreen = 0x11875dff, // (17, 135, 93) aquagreen = 0x12e193ff, // (18, 225, 147) bluegreen3 = 0x137e6dff, // (19, 126, 109) topaz = 0x13bbafff, // (19, 187, 175) aqua = 0x13eac9ff, // (19, 234, 201) vividblue = 0x152effff, // (21, 46, 255) forrestgreen = 0x154406ff, // (21, 68, 6) lightnavy = 0x155084ff, // (21, 80, 132) green = 0x15b01aff, // (21, 176, 26) ultramarineblue = 0x1805dbff, // (24, 5, 219) seaweed = 0x18d17bff, // (24, 209, 123) dark = 0x1b2431ff, // (27, 36, 49) highlightergreen = 0x1bfc06ff, // (27, 252, 6) verydarkbrown = 0x1d0200ff, // (29, 2, 0) azul = 0x1d5decff, // (29, 93, 236) cobalt = 0x1e488fff, // (30, 72, 143) viridian = 0x1e9167ff, // (30, 145, 103) spearmint = 0x1ef876ff, // (30, 248, 118) darkindigo = 0x1f0954ff, // (31, 9, 84) darkbluegrey = 0x1f3b4dff, // (31, 59, 77) darkgreenblue = 0x1f6357ff, // (31, 99, 87) jade = 0x1fa774ff, // (31, 167, 116) darkseafoam = 0x1fb57aff, // (31, 181, 122) ultramarine = 0x2000b1ff, // (32, 0, 177) darkmintgreen = 0x20c073ff, // (32, 192, 115) wintergreen = 0x20f986ff, // (32, 249, 134) sapphire = 0x2138abff, // (33, 56, 171) darkslateblue = 0x214761ff, // (33, 71, 97) algaegreen = 0x21c36fff, // (33, 195, 111) electricgreen = 0x21fc0dff, // (33, 252, 13) blueblue = 0x2242c7ff, // (34, 66, 199) greenblue3 = 0x23c48bff, // (35, 196, 139) clearblue = 0x247afdff, // (36, 122, 253) tealish = 0x24bca8ff, // (36, 188, 168) tealgreen = 0x25a36fff, // (37, 163, 111) hotgreen = 0x25ff29ff, // (37, 255, 41) duskblue = 0x26538dff, // (38, 83, 141) brightlightblue = 0x26f7fdff, // (38, 247, 253) midblue = 0x276ab3ff, // (39, 106, 179) midnightpurple = 0x280137ff, // (40, 1, 55) darkishgreen = 0x287c37ff, // (40, 124, 55) darkgreyblue = 0x29465bff, // (41, 70, 91) bluish = 0x2976bbff, // (41, 118, 187) verydarkpurple = 0x2a0134ff, // (42, 1, 52) treegreen = 0x2a7e19ff, // (42, 126, 25) greenishcyan = 0x2afeb7ff, // (42, 254, 183) pine = 0x2b5d34ff, // (43, 93, 52) jadegreen = 0x2baf6aff, // (43, 175, 106) blueygreen = 0x2bb179ff, // (43, 177, 121) mediumblue = 0x2c6fbbff, // (44, 111, 187) radioactivegreen = 0x2cfa1fff, // (44, 250, 31) brightlightgreen = 0x2dfe54ff, // (45, 254, 84) lightnavyblue = 0x2e5a88ff, // (46, 90, 136) aquamarine2 = 0x2ee8bbff, // (46, 232, 187) vividgreen = 0x2fef10ff, // (47, 239, 16) uglyblue = 0x31668aff, // (49, 102, 138) greenishteal = 0x32bf84ff, // (50, 191, 132) coolgreen = 0x33b864ff, // (51, 184, 100) darkviolet = 0x34013fff, // (52, 1, 63) darkbrown = 0x341c02ff, // (52, 28, 2) charcoal = 0x343837ff, // (52, 56, 55) darkpurple = 0x35063eff, // (53, 6, 62) navygreen = 0x35530aff, // (53, 83, 10) seaweedgreen = 0x35ad6bff, // (53, 173, 107) deeppurple = 0x36013fff, // (54, 1, 63) darkgrey = 0x363737ff, // (54, 55, 55) darkolive = 0x373e02ff, // (55, 62, 2) windowsblue = 0x3778bfff, // (55, 120, 191) indigo = 0x380282ff, // (56, 2, 130) eggplant = 0x380835ff, // (56, 8, 53) darkgrassgreen = 0x388004ff, // (56, 128, 4) mediumgreen = 0x39ad48ff, // (57, 173, 72) indigoblue = 0x3a18b1ff, // (58, 24, 177) lightroyalblue = 0x3a2efeff, // (58, 46, 254) weirdgreen = 0x3ae57fff, // (58, 229, 127) denimblue = 0x3b5b92ff, // (59, 91, 146) denim = 0x3b638cff, // (59, 99, 140) mutedblue = 0x3b719fff, // (59, 113, 159) darkmaroon = 0x3c0008ff, // (60, 0, 8) charcoalgrey = 0x3c4142ff, // (60, 65, 66) darkolivegreen = 0x3c4d03ff, // (60, 77, 3) flatblue = 0x3c73a8ff, // (60, 115, 168) sea = 0x3c9992ff, // (60, 153, 146) aubergine = 0x3d0734ff, // (61, 7, 52) chocolate = 0x3d1c02ff, // (61, 28, 2) lightishblue = 0x3d7afdff, // (61, 122, 253) oceangreen = 0x3d9973ff, // (61, 153, 115) dodgerblue = 0x3e82fcff, // (62, 130, 252) darkseafoamgreen = 0x3eaf76ff, // (62, 175, 118) darkplum = 0x3f012cff, // (63, 1, 44) dirtyblue = 0x3f829dff, // (63, 130, 157) grassgreen = 0x3f9b0bff, // (63, 155, 11) greenish = 0x40a368ff, // (64, 163, 104) poisongreen = 0x40fd14ff, // (64, 253, 20) deepbrown = 0x410200ff, // (65, 2, 0) chocolatebrown = 0x411900ff, // (65, 25, 0) grassygreen = 0x419c03ff, // (65, 156, 3) brightcyan = 0x41fdfeff, // (65, 253, 254) greenyblue = 0x42b395ff, // (66, 179, 149) eggplantpurple = 0x430541ff, // (67, 5, 65) frenchblue = 0x436badff, // (67, 107, 173) darkskyblue = 0x448ee4ff, // (68, 142, 228) blueberry = 0x464196ff, // (70, 65, 150) duskyblue = 0x475f94ff, // (71, 95, 148) darkmint = 0x48c072ff, // (72, 192, 114) deepviolet = 0x490648ff, // (73, 6, 72) dullblue = 0x49759cff, // (73, 117, 156) coolblue = 0x4984b8ff, // (73, 132, 184) mahogany = 0x4a0100ff, // (74, 1, 0) royalpurple = 0x4b006eff, // (75, 0, 110) driedblood = 0x4b0101ff, // (75, 1, 1) warmblue = 0x4b57dbff, // (75, 87, 219) armygreen = 0x4b5d16ff, // (75, 93, 22) camouflagegreen = 0x4b6113ff, // (75, 97, 19) dustyteal = 0x4c9085ff, // (76, 144, 133) lawngreen = 0x4da409ff, // (77, 164, 9) plumpurple = 0x4e0550ff, // (78, 5, 80) twilight = 0x4e518bff, // (78, 81, 139) dusk = 0x4e5481ff, // (78, 84, 129) cadetblue = 0x4e7496ff, // (78, 116, 150) lightneongreen = 0x4efd54ff, // (78, 253, 84) metallicblue = 0x4f738eff, // (79, 115, 142) lightforestgreen = 0x4f9153ff, // (79, 145, 83) stormyblue = 0x507b9cff, // (80, 123, 156) midgreen = 0x50a747ff, // (80, 167, 71) violetblue = 0x510ac9ff, // (81, 10, 201) slate = 0x516572ff, // (81, 101, 114) cornflowerblue = 0x5170d7ff, // (81, 112, 215) leafygreen = 0x51b73bff, // (81, 183, 59) camogreen = 0x526525ff, // (82, 101, 37) bluewithahintofpurple = 0x533cc6ff, // (83, 60, 198) gunmetal = 0x536267ff, // (83, 98, 103) seagreen = 0x53fca1ff, // (83, 252, 161) lightbrightgreen = 0x53fe5cff, // (83, 254, 92) greenbrown = 0x544e03ff, // (84, 78, 3) ferngreen = 0x548d44ff, // (84, 141, 68) algae = 0x54ac68ff, // (84, 172, 104) blurple = 0x5539ccff, // (85, 57, 204) offblue = 0x5684aeff, // (86, 132, 174) darkpastelgreen = 0x56ae57ff, // (86, 174, 87) lightgreenblue = 0x56fca2ff, // (86, 252, 162) bluepurple1 = 0x5729ceff, // (87, 41, 206) plum = 0x580f41ff, // (88, 15, 65) froggreen = 0x58bc08ff, // (88, 188, 8) slategrey = 0x59656dff, // (89, 101, 109) darksage = 0x598556ff, // (89, 133, 86) bluepurple2 = 0x5a06efff, // (90, 6, 239) steelblue = 0x5a7d9aff, // (90, 125, 154) dustyblue = 0x5a86adff, // (90, 134, 173) slateblue = 0x5b7c99ff, // (91, 124, 153) sapgreen = 0x5c8b15ff, // (92, 139, 21) leafgreen = 0x5ca904ff, // (92, 169, 4) grass = 0x5cac2dff, // (92, 172, 45) kermitgreen = 0x5cb200ff, // (92, 178, 0) blueviolet = 0x5d06e9ff, // (93, 6, 233) grapepurple = 0x5d1451ff, // (93, 20, 81) purpleblue1 = 0x5d21d0ff, // (93, 33, 208) greyishblue = 0x5e819dff, // (94, 129, 157) greyteal = 0x5e9b8aff, // (94, 155, 138) greenapple = 0x5edc1fff, // (94, 220, 31) purpleyblue = 0x5f34e7ff, // (95, 52, 231) dullteal = 0x5f9e8fff, // (95, 158, 143) mutedgreen = 0x5fa052ff, // (95, 160, 82) purplishblue = 0x601ef9ff, // (96, 30, 249) mudbrown = 0x60460fff, // (96, 70, 15) mudgreen = 0x606602ff, // (96, 102, 2) bluegrey4 = 0x607c8eff, // (96, 124, 142) burgundy = 0x610023ff, // (97, 0, 35) purpleishblue = 0x6140efff, // (97, 64, 239) toxicgreen = 0x61de2aff, // (97, 222, 42) lightishgreen = 0x61e160ff, // (97, 225, 96) blueypurple = 0x6241c7ff, // (98, 65, 199) iris = 0x6258c4ff, // (98, 88, 196) purpleblue2 = 0x632de9ff, // (99, 45, 233) mossygreen = 0x638b27ff, // (99, 139, 39) fern = 0x63a950ff, // (99, 169, 80) boringgreen = 0x63b365ff, // (99, 179, 101) lightgreenishblue = 0x63f7b4ff, // (99, 247, 180) olivebrown = 0x645403ff, // (100, 84, 3) greyblue1 = 0x647d8eff, // (100, 125, 142) softblue = 0x6488eaff, // (100, 136, 234) maroon = 0x650021ff, // (101, 0, 33) brown = 0x653700ff, // (101, 55, 0) muddygreen = 0x657432ff, // (101, 116, 50) mossgreen = 0x658b38ff, // (101, 139, 56) fadedblue = 0x658cbbff, // (101, 140, 187) slategreen = 0x658d6dff, // (101, 141, 109) tea = 0x65ab7cff, // (101, 171, 124) brightlimegreen = 0x65fe08ff, // (101, 254, 8) purplyblue = 0x661aeeff, // (102, 26, 238) darkperiwinkle = 0x665fd1ff, // (102, 95, 209) militarygreen = 0x667c3eff, // (102, 124, 62) dirtygreen = 0x667e2cff, // (102, 126, 44) purplebrown = 0x673a3fff, // (103, 58, 63) olivegreen = 0x677a04ff, // (103, 122, 4) claret = 0x680018ff, // (104, 0, 24) burple = 0x6832e3ff, // (104, 50, 227) greenybrown = 0x696006ff, // (105, 96, 6) greenishbrown = 0x696112ff, // (105, 97, 18) swamp = 0x698339ff, // (105, 131, 57) flatgreen = 0x699d4cff, // (105, 157, 76) freshgreen = 0x69d84fff, // (105, 216, 79) brownishgreen = 0x6a6e09ff, // (106, 110, 9) cornflower = 0x6a79f7ff, // (106, 121, 247) purplishbrown = 0x6b4247ff, // (107, 66, 71) battleshipgrey = 0x6b7c85ff, // (107, 124, 133) greyblue2 = 0x6b8ba4ff, // (107, 139, 164) offgreen = 0x6ba353ff, // (107, 163, 83) grape = 0x6c3461ff, // (108, 52, 97) murkygreen = 0x6c7a0eff, // (108, 122, 14) lightindigo = 0x6d5acfff, // (109, 90, 207) robinsegg = 0x6dedfdff, // (109, 237, 253) reddybrown = 0x6e1005ff, // (110, 16, 5) olive = 0x6e750eff, // (110, 117, 14) apple = 0x6ecb3cff, // (110, 203, 60) brownygreen = 0x6f6c0aff, // (111, 108, 10) olivedrab = 0x6f7632ff, // (111, 118, 50) poopgreen = 0x6f7c00ff, // (111, 124, 0) steelgrey = 0x6f828aff, // (111, 130, 138) softgreen = 0x6fc276ff, // (111, 194, 118) bluishpurple = 0x703be7ff, // (112, 59, 231) browngreen = 0x706c11ff, // (112, 108, 17) nastygreen = 0x70b23fff, // (112, 178, 63) greyishteal = 0x719f91ff, // (113, 159, 145) leaf = 0x71aa34ff, // (113, 170, 52) richpurple = 0x720058ff, // (114, 0, 88) khakigreen = 0x728639ff, // (114, 134, 57) darkyellowgreen = 0x728f02ff, // (114, 143, 2) merlot = 0x730039ff, // (115, 0, 57) dirtypurple = 0x734a65ff, // (115, 74, 101) mud = 0x735c12ff, // (115, 92, 18) steel = 0x738595ff, // (115, 133, 149) chestnut = 0x742802ff, // (116, 40, 2) swampgreen = 0x748500ff, // (116, 133, 0) bluishgrey = 0x748b97ff, // (116, 139, 151) drabgreen = 0x749551ff, // (116, 149, 81) dullgreen = 0x74a662ff, // (116, 166, 98) velvet = 0x750851ff, // (117, 8, 81) darkishpurple = 0x751973ff, // (117, 25, 115) shitgreen = 0x758000ff, // (117, 128, 0) bluegrey1 = 0x758da3ff, // (117, 141, 163) turtlegreen = 0x75b84fff, // (117, 184, 79) skyblue = 0x75bbfdff, // (117, 187, 253) lightergreen = 0x75fd63ff, // (117, 253, 99) brownishpurple = 0x76424eff, // (118, 66, 78) moss = 0x769958ff, // (118, 153, 88) dustygreen = 0x76a973ff, // (118, 169, 115) applegreen = 0x76cd26ff, // (118, 205, 38) lightbluishgreen = 0x76fda8ff, // (118, 253, 168) lightgreen1 = 0x76ff7bff, // (118, 255, 123) blood = 0x770001ff, // (119, 0, 1) greengrey = 0x77926fff, // (119, 146, 111) greyblue3 = 0x77a1b5ff, // (119, 161, 181) asparagus = 0x77ab56ff, // (119, 171, 86) greygreen1 = 0x789b73ff, // (120, 155, 115) seafoamblue = 0x78d1b6ff, // (120, 209, 182) poopbrown = 0x7a5901ff, // (122, 89, 1) purplishgrey = 0x7a687fff, // (122, 104, 127) greyishbrown = 0x7a6a4fff, // (122, 106, 79) uglygreen = 0x7a9703ff, // (122, 151, 3) seafoamgreen = 0x7af9abff, // (122, 249, 171) bordeaux = 0x7b002cff, // (123, 0, 44) winered = 0x7b0323ff, // (123, 3, 35) shitbrown = 0x7b5804ff, // (123, 88, 4) fadedgreen = 0x7bb274ff, // (123, 178, 116) lightblue1 = 0x7bc8f6ff, // (123, 200, 246) tiffanyblue = 0x7bf2daff, // (123, 242, 218) lightaquamarine = 0x7bfdc7ff, // (123, 253, 199) uglybrown = 0x7d7103ff, // (125, 113, 3) mediumgrey = 0x7d7f7cff, // (125, 127, 124) purple = 0x7e1e9cff, // (126, 30, 156) bruise = 0x7e4071ff, // (126, 64, 113) greenygrey = 0x7ea07aff, // (126, 160, 122) darklimegreen = 0x7ebd01ff, // (126, 189, 1) lightturquoise = 0x7ef4ccff, // (126, 244, 204) lightbluegreen = 0x7efbb3ff, // (126, 251, 179) reddishbrown = 0x7f2b0aff, // (127, 43, 10) milkchocolate = 0x7f4e1eff, // (127, 78, 30) mediumbrown = 0x7f5112ff, // (127, 81, 18) poop = 0x7f5e00ff, // (127, 94, 0) shit = 0x7f5f00ff, // (127, 95, 0) darktaupe = 0x7f684eff, // (127, 104, 78) greybrown = 0x7f7053ff, // (127, 112, 83) camo = 0x7f8f4eff, // (127, 143, 78) wine = 0x80013fff, // (128, 1, 63) mutedpurple = 0x805b87ff, // (128, 91, 135) seafoam = 0x80f9adff, // (128, 249, 173) redpurple = 0x820747ff, // (130, 7, 71) dustypurple = 0x825f87ff, // (130, 95, 135) greypurple = 0x826d8cff, // (130, 109, 140) drab = 0x828344ff, // (130, 131, 68) greyishgreen = 0x82a67dff, // (130, 166, 125) sky = 0x82cafcff, // (130, 202, 252) paleteal = 0x82cbb2ff, // (130, 203, 178) dirtbrown = 0x836539ff, // (131, 101, 57) darkred = 0x840000ff, // (132, 0, 0) dullpurple = 0x84597eff, // (132, 89, 126) darklime = 0x84b701ff, // (132, 183, 1) indianred = 0x850e04ff, // (133, 14, 4) darklavender = 0x856798ff, // (133, 103, 152) bluegrey2 = 0x85a3b2ff, // (133, 163, 178) purplegrey = 0x866f85ff, // (134, 111, 133) brownishgrey = 0x86775fff, // (134, 119, 95) greygreen2 = 0x86a17dff, // (134, 161, 125) darkmauve = 0x874c62ff, // (135, 76, 98) purpley = 0x8756e4ff, // (135, 86, 228) cocoa = 0x875f42ff, // (135, 95, 66) dullbrown = 0x876e4bff, // (135, 110, 75) avocadogreen = 0x87a922ff, // (135, 169, 34) sage = 0x87ae73ff, // (135, 174, 115) brightlime = 0x87fd05ff, // (135, 253, 5) poobrown = 0x885f01ff, // (136, 95, 1) muddybrown = 0x886806ff, // (136, 104, 6) greyishpurple = 0x887191ff, // (136, 113, 145) babyshitgreen = 0x889717ff, // (136, 151, 23) sagegreen = 0x88b378ff, // (136, 179, 120) lighteggplant = 0x894585ff, // (137, 69, 133) duskypurple = 0x895b7bff, // (137, 91, 123) blueygrey = 0x89a0b0ff, // (137, 160, 176) vomitgreen = 0x89a203ff, // (137, 162, 3) limegreen = 0x89fe05ff, // (137, 254, 5) dirt = 0x8a6e45ff, // (138, 110, 69) carolinablue = 0x8ab8feff, // (138, 184, 254) robineggblue = 0x8af1feff, // (138, 241, 254) redbrown = 0x8b2e16ff, // (139, 46, 22) rustbrown = 0x8b3103ff, // (139, 49, 3) lavenderblue = 0x8b88f8ff, // (139, 136, 248) crimson = 0x8c000fff, // (140, 0, 15) redwine = 0x8c0034ff, // (140, 0, 52) eastergreen = 0x8cfd7eff, // (140, 253, 126) babygreen = 0x8cff9eff, // (140, 255, 158) lightaqua = 0x8cffdbff, // (140, 255, 219) deeplavender = 0x8d5eb7ff, // (141, 94, 183) browngrey = 0x8d8468ff, // (141, 132, 104) hazel = 0x8e7618ff, // (142, 118, 24) periwinkle = 0x8e82feff, // (142, 130, 254) peagreen = 0x8eab12ff, // (142, 171, 18) kiwigreen = 0x8ee53fff, // (142, 229, 63) brickred = 0x8f1402ff, // (143, 20, 2) poo = 0x8f7303ff, // (143, 115, 3) perrywinkle = 0x8f8ce7ff, // (143, 140, 231) babypoopgreen = 0x8f9805ff, // (143, 152, 5) periwinkleblue = 0x8f99fbff, // (143, 153, 251) ickygreen = 0x8fae22ff, // (143, 174, 34) lichen = 0x8fb67bff, // (143, 182, 123) acidgreen = 0x8ffe09ff, // (143, 254, 9) mintgreen = 0x8fff9fff, // (143, 255, 159) avocado = 0x90b134ff, // (144, 177, 52) lightteal = 0x90e4c1ff, // (144, 228, 193) foamgreen = 0x90fda9ff, // (144, 253, 169) reddishpurple = 0x910951ff, // (145, 9, 81) fadedpurple = 0x916e99ff, // (145, 110, 153) mulberry = 0x920a4eff, // (146, 10, 78) brownred = 0x922b05ff, // (146, 43, 5) grey = 0x929591ff, // (146, 149, 145) peasoup = 0x929901ff, // (146, 153, 1) babypoop = 0x937c00ff, // (147, 124, 0) purplish = 0x94568cff, // (148, 86, 140) pukebrown = 0x947706ff, // (148, 119, 6) purpleygrey = 0x947e94ff, // (148, 126, 148) peasoupgreen = 0x94a617ff, // (148, 166, 23) barfgreen = 0x94ac02ff, // (148, 172, 2) sicklygreen = 0x94b21cff, // (148, 178, 28) warmpurple = 0x952e8fff, // (149, 46, 143) coolgrey = 0x95a3a6ff, // (149, 163, 166) lightblue2 = 0x95d0fcff, // (149, 208, 252) darkmagenta = 0x960056ff, // (150, 0, 86) warmbrown = 0x964e02ff, // (150, 78, 2) deeplilac = 0x966ebdff, // (150, 110, 189) greenishgrey = 0x96ae8dff, // (150, 174, 141) boogergreen = 0x96b403ff, // (150, 180, 3) lightgreen2 = 0x96f97bff, // (150, 249, 123) warmgrey = 0x978a84ff, // (151, 138, 132) bloodred = 0x980002ff, // (152, 0, 2) purply = 0x983fb2ff, // (152, 63, 178) purpleish = 0x98568dff, // (152, 86, 141) sepia = 0x985e2bff, // (152, 94, 43) robinseggblue = 0x98eff9ff, // (152, 239, 249) lightseagreen = 0x98f6b0ff, // (152, 246, 176) vividpurple = 0x9900faff, // (153, 0, 250) purplered = 0x990147ff, // (153, 1, 71) berry = 0x990f4bff, // (153, 15, 75) reddishgrey = 0x997570ff, // (153, 117, 112) slimegreen = 0x99cc04ff, // (153, 204, 4) deepred = 0x9a0200ff, // (154, 2, 0) violet = 0x9a0eeaff, // (154, 14, 234) auburn = 0x9a3001ff, // (154, 48, 1) rawsienna = 0x9a6200ff, // (154, 98, 0) pukegreen = 0x9aae07ff, // (154, 174, 7) lightgrassgreen = 0x9af764ff, // (154, 247, 100) amethyst = 0x9b5fc0ff, // (155, 95, 192) yellowishbrown = 0x9b7a01ff, // (155, 122, 1) darkkhaki = 0x9b8f55ff, // (155, 143, 85) booger = 0x9bb53cff, // (155, 181, 60) hospitalgreen = 0x9be5aaff, // (155, 229, 170) brownish = 0x9c6d57ff, // (156, 109, 87) darklilac = 0x9c6da5ff, // (156, 109, 165) brightolive = 0x9cbb04ff, // (156, 187, 4) kiwi = 0x9cef43ff, // (156, 239, 67) carmine = 0x9d0216ff, // (157, 2, 22) darkfuchsia = 0x9d0759ff, // (157, 7, 89) lightplum = 0x9d5783ff, // (157, 87, 131) mocha = 0x9d7651ff, // (157, 118, 81) sickgreen = 0x9db92cff, // (157, 185, 44) lightgreyblue = 0x9dbcd4ff, // (157, 188, 212) snotgreen = 0x9dc100ff, // (157, 193, 0) brightyellowgreen = 0x9dff00ff, // (157, 255, 0) cranberry = 0x9e003aff, // (158, 0, 58) redviolet = 0x9e0168ff, // (158, 1, 104) brownishred = 0x9e3623ff, // (158, 54, 35) mediumpurple = 0x9e43a2ff, // (158, 67, 162) burntred = 0x9f2305ff, // (159, 35, 5) diarrhea = 0x9f8303ff, // (159, 131, 3) mint = 0x9ffeb0ff, // (159, 254, 176) deepmagenta = 0xa0025cff, // (160, 2, 92) barneypurple = 0xa00498ff, // (160, 4, 152) brick = 0xa03623ff, // (160, 54, 35) burntumber = 0xa0450eff, // (160, 69, 14) grossgreen = 0xa0bf16ff, // (160, 191, 22) lightseafoam = 0xa0febfff, // (160, 254, 191) russet = 0xa13905ff, // (161, 57, 5) lightmaroon = 0xa24857ff, // (162, 72, 87) earth = 0xa2653eff, // (162, 101, 62) vomit = 0xa2a415ff, // (162, 164, 21) pastelblue = 0xa2bffeff, // (162, 191, 254) babyblue = 0xa2cffeff, // (162, 207, 254) uglypurple = 0xa442a0ff, // (164, 66, 160) heather = 0xa484acff, // (164, 132, 172) lightolivegreen = 0xa4be5cff, // (164, 190, 92) pea = 0xa4bf20ff, // (164, 191, 32) violetred = 0xa50055ff, // (165, 0, 85) lightishpurple = 0xa552e6ff, // (165, 82, 230) lighterpurple = 0xa55af4ff, // (165, 90, 244) puce = 0xa57e52ff, // (165, 126, 82) cement = 0xa5a391ff, // (165, 163, 145) puke = 0xa5a502ff, // (165, 165, 2) paleturquoise = 0xa5fbd5ff, // (165, 251, 213) softpurple = 0xa66fb5ff, // (166, 111, 181) coffee = 0xa6814cff, // (166, 129, 76) lightmossgreen = 0xa6c875ff, // (166, 200, 117) lightmintgreen = 0xa6fbb2ff, // (166, 251, 178) rawumber = 0xa75e09ff, // (167, 94, 9) lightseafoamgreen = 0xa7ffb5ff, // (167, 255, 181) rust = 0xa83c09ff, // (168, 60, 9) lightburgundy = 0xa8415bff, // (168, 65, 91) bronze = 0xa87900ff, // (168, 121, 0) wisteria = 0xa87dc2ff, // (168, 125, 194) darkmustard = 0xa88905ff, // (168, 137, 5) darksand = 0xa88f59ff, // (168, 143, 89) greyish = 0xa8a495ff, // (168, 164, 149) mustardgreen = 0xa8b504ff, // (168, 181, 4) electriclime = 0xa8ff04ff, // (168, 255, 4) darkishred = 0xa90308ff, // (169, 3, 8) sienna = 0xa9561eff, // (169, 86, 30) tangreen = 0xa9be70ff, // (169, 190, 112) springgreen = 0xa9f971ff, // (169, 249, 113) electricpurple = 0xaa23ffff, // (170, 35, 255) rustred = 0xaa2704ff, // (170, 39, 4) khaki = 0xaaa662ff, // (170, 166, 98) lime = 0xaaff32ff, // (170, 255, 50) rouge = 0xab1239ff, // (171, 18, 57) tanbrown = 0xab7e4cff, // (171, 126, 76) babypoo = 0xab9004ff, // (171, 144, 4) barney = 0xac1db8ff, // (172, 29, 184) cinnamon = 0xac4f06ff, // (172, 79, 6) leather = 0xac7434ff, // (172, 116, 52) mustardbrown = 0xac7e04ff, // (172, 126, 4) dustylavender = 0xac86a8ff, // (172, 134, 168) darkbeige = 0xac9362ff, // (172, 147, 98) snot = 0xacbb0dff, // (172, 187, 13) lightolive = 0xacbf69ff, // (172, 191, 105) cloudyblue = 0xacc2d9ff, // (172, 194, 217) lightcyan = 0xacfffcff, // (172, 255, 252) vibrantpurple = 0xad03deff, // (173, 3, 222) brightviolet = 0xad0afdff, // (173, 10, 253) lightbrown = 0xad8150ff, // (173, 129, 80) babyshitbrown = 0xad900dff, // (173, 144, 13) stone = 0xada587ff, // (173, 165, 135) lemongreen = 0xadf802ff, // (173, 248, 2) mauve = 0xae7181ff, // (174, 113, 129) yellowybrown = 0xae8b0cff, // (174, 139, 12) lightlime = 0xaefd6cff, // (174, 253, 108) keylime = 0xaeff6eff, // (174, 255, 110) rustyred = 0xaf2f0dff, // (175, 47, 13) caramel = 0xaf6f09ff, // (175, 111, 9) darktan = 0xaf884aff, // (175, 136, 74) bland = 0xafa88bff, // (175, 168, 139) raspberry = 0xb00149ff, // (176, 1, 73) purplishred = 0xb0054bff, // (176, 5, 75) burntsienna = 0xb04e0fff, // (176, 78, 15) yellowishgreen = 0xb0dd16ff, // (176, 221, 22) pastelgreen = 0xb0ff9dff, // (176, 255, 157) orangeybrown = 0xb16002ff, // (177, 96, 2) pinkishbrown = 0xb17261ff, // (177, 114, 97) palebrown = 0xb1916eff, // (177, 145, 110) powderblue = 0xb1d1fcff, // (177, 209, 252) paleolivegreen = 0xb1d27bff, // (177, 210, 123) palelightgreen = 0xb1fc99ff, // (177, 252, 153) palelimegreen = 0xb1ff65ff, // (177, 255, 101) orangishbrown = 0xb25f03ff, // (178, 95, 3) umber = 0xb26400ff, // (178, 100, 0) claybrown = 0xb2713dff, // (178, 113, 61) goldenbrown = 0xb27a01ff, // (178, 122, 1) brownyellow = 0xb29705ff, // (178, 151, 5) dust = 0xb2996eff, // (178, 153, 110) lightpastelgreen = 0xb2fba5ff, // (178, 251, 165) lighturple = 0xb36ff6ff, // (179, 111, 246) darkrose = 0xb5485dff, // (181, 72, 93) darkgold = 0xb59410ff, // (181, 148, 16) bile = 0xb5c306ff, // (181, 195, 6) greenyellow1 = 0xb5ce08ff, // (181, 206, 8) copper = 0xb66325ff, // (182, 99, 37) clay = 0xb66a50ff, // (182, 106, 80) babypukegreen = 0xb6c406ff, // (182, 196, 6) lightmint = 0xb6ffbbff, // (182, 255, 187) burntsiena = 0xb75203ff, // (183, 82, 3) palepurple = 0xb790d4ff, // (183, 144, 212) yellowbrown = 0xb79400ff, // (183, 148, 0) lightbluegrey = 0xb7c9e2ff, // (183, 201, 226) lightgreygreen = 0xb7e1a1ff, // (183, 225, 161) palecyan = 0xb7fffaff, // (183, 255, 250) paleaqua = 0xb8ffebff, // (184, 255, 235) dustyred = 0xb9484eff, // (185, 72, 78) brownorange = 0xb96902ff, // (185, 105, 2) taupe = 0xb9a281ff, // (185, 162, 129) paleolive = 0xb9cc81ff, // (185, 204, 129) lightlimegreen = 0xb9ff66ff, // (185, 255, 102) duskyrose = 0xba6873ff, // (186, 104, 115) mushroom = 0xba9e88ff, // (186, 158, 136) dullred = 0xbb3f3fff, // (187, 63, 63) yellowgreen1 = 0xbbf90fff, // (187, 249, 15) neonpurple = 0xbc13feff, // (188, 19, 254) greenishtan = 0xbccb7aff, // (188, 203, 122) lightsage = 0xbcecacff, // (188, 236, 172) washedoutgreen = 0xbcf5a6ff, // (188, 245, 166) adobe = 0xbd6c48ff, // (189, 108, 72) paleskyblue = 0xbdf6feff, // (189, 246, 254) teagreen = 0xbdf8a3ff, // (189, 248, 163) scarlet = 0xbe0119ff, // (190, 1, 25) rosered = 0xbe013cff, // (190, 1, 60) brightpurple = 0xbe03fdff, // (190, 3, 253) orangebrown = 0xbe6400ff, // (190, 100, 0) putty = 0xbeae8aff, // (190, 174, 138) palelime = 0xbefd73ff, // (190, 253, 115) celadon = 0xbefdb7ff, // (190, 253, 183) lightpurple = 0xbf77f6ff, // (191, 119, 246) ochre = 0xbf9005ff, // (191, 144, 5) ocher = 0xbf9b0cff, // (191, 155, 12) muddyyellow = 0xbfac05ff, // (191, 172, 5) yellowygreen = 0xbff128ff, // (191, 241, 40) lemonlime = 0xbffe28ff, // (191, 254, 40) lipstickred = 0xc0022fff, // (192, 2, 47) burntorange = 0xc04e01ff, // (192, 78, 1) easterpurple = 0xc071feff, // (192, 113, 254) dustyrose = 0xc0737aff, // (192, 115, 122) pistachio = 0xc0fa8bff, // (192, 250, 139) yellowgreen2 = 0xc0fb2dff, // (192, 251, 45) brickorange = 0xc14a09ff, // (193, 74, 9) lightperiwinkle = 0xc1c6fcff, // (193, 198, 252) chartreuse = 0xc1f80aff, // (193, 248, 10) celery = 0xc1fd95ff, // (193, 253, 149) magenta = 0xc20078ff, // (194, 0, 120) brownishpink = 0xc27e79ff, // (194, 126, 121) lightmauve = 0xc292a1ff, // (194, 146, 161) oliveyellow = 0xc2b709ff, // (194, 183, 9) pukeyellow = 0xc2be0eff, // (194, 190, 14) lightyellowishgreen = 0xc2ff89ff, // (194, 255, 137) greypink = 0xc3909bff, // (195, 144, 155) duckeggblue = 0xc3fbf4ff, // (195, 251, 244) reddish = 0xc44240ff, // (196, 66, 64) rustorange = 0xc45508ff, // (196, 85, 8) liliac = 0xc48efdff, // (196, 142, 253) sandybrown = 0xc4a661ff, // (196, 166, 97) lightpeagreen = 0xc4fe82ff, // (196, 254, 130) eggshellblue = 0xc4fff7ff, // (196, 255, 247) silver = 0xc5c9c7ff, // (197, 201, 199) darkorange = 0xc65102ff, // (198, 81, 2) ocre = 0xc69c04ff, // (198, 156, 4) camel = 0xc69f59ff, // (198, 159, 89) greenyyellow = 0xc6f808ff, // (198, 248, 8) lightskyblue = 0xc6fcffff, // (198, 252, 255) deeprose = 0xc74767ff, // (199, 71, 103) brightlavender = 0xc760ffff, // (199, 96, 255) oldpink = 0xc77986ff, // (199, 121, 134) lavender = 0xc79fefff, // (199, 159, 239) toupe = 0xc7ac7dff, // (199, 172, 125) vomityellow = 0xc7c10cff, // (199, 193, 12) palegreen = 0xc7fdb5ff, // (199, 253, 181) purpleypink = 0xc83cb9ff, // (200, 60, 185) darksalmon = 0xc85a53ff, // (200, 90, 83) orchid = 0xc875c4ff, // (200, 117, 196) dirtyorange = 0xc87606ff, // (200, 118, 6) oldrose = 0xc87f89ff, // (200, 127, 137) greyishpink = 0xc88d94ff, // (200, 141, 148) pinkishgrey = 0xc8aca9ff, // (200, 172, 169) yellowgreen3 = 0xc8fd3dff, // (200, 253, 61) lightlightgreen = 0xc8ffb0ff, // (200, 255, 176) pinkypurple = 0xc94cbeff, // (201, 76, 190) brightlilac = 0xc95efbff, // (201, 94, 251) terracotta1 = 0xc9643bff, // (201, 100, 59) sandstone = 0xc9ae74ff, // (201, 174, 116) brownishyellow = 0xc9b003ff, // (201, 176, 3) greenishbeige = 0xc9d179ff, // (201, 209, 121) greenyellow2 = 0xc9ff27ff, // (201, 255, 39) ruby = 0xca0147ff, // (202, 1, 71) terracotta2 = 0xca6641ff, // (202, 102, 65) brownyorange = 0xca6b02ff, // (202, 107, 2) dirtypink = 0xca7b80ff, // (202, 123, 128) babypurple = 0xca9bf7ff, // (202, 155, 247) pastelpurple = 0xcaa0ffff, // (202, 160, 255) lightlightblue = 0xcafffbff, // (202, 255, 251) hotpurple = 0xcb00f5ff, // (203, 0, 245) deeppink = 0xcb0162ff, // (203, 1, 98) darkpink = 0xcb416bff, // (203, 65, 107) terracota = 0xcb6843ff, // (203, 104, 67) brownishorange = 0xcb7723ff, // (203, 119, 35) yellowochre = 0xcb9d06ff, // (203, 157, 6) sandbrown = 0xcba560ff, // (203, 165, 96) pear = 0xcbf85fff, // (203, 248, 95) duskypink = 0xcc7a8bff, // (204, 122, 139) desert = 0xccad60ff, // (204, 173, 96) lightyellowgreen = 0xccfd7fff, // (204, 253, 127) rustyorange = 0xcd5909ff, // (205, 89, 9) uglypink = 0xcd7584ff, // (205, 117, 132) dirtyyellow = 0xcdc50aff, // (205, 197, 10) greenishyellow = 0xcdfd02ff, // (205, 253, 2) purplishpink = 0xce5daeff, // (206, 93, 174) lilac = 0xcea2fdff, // (206, 162, 253) paleviolet = 0xceaefaff, // (206, 174, 250) mustard = 0xceb301ff, // (206, 179, 1) cherry = 0xcf0234ff, // (207, 2, 52) darkcoral = 0xcf524eff, // (207, 82, 78) rose = 0xcf6275ff, // (207, 98, 117) fawn = 0xcfaf7bff, // (207, 175, 123) verypalegreen = 0xcffdbcff, // (207, 253, 188) neonyellow = 0xcfff04ff, // (207, 255, 4) uglyyellow = 0xd0c101ff, // (208, 193, 1) sicklyyellow = 0xd0e429ff, // (208, 228, 41) limeyellow = 0xd0fe1dff, // (208, 254, 29) paleblue = 0xd0fefeff, // (208, 254, 254) mutedpink = 0xd1768fff, // (209, 118, 143) tan = 0xd1b26fff, // (209, 178, 111) verylightgreen = 0xd1ffbdff, // (209, 255, 189) mustardyellow = 0xd2bd0aff, // (210, 189, 10) fadedred = 0xd3494eff, // (211, 73, 78) verylightbrown = 0xd3b683ff, // (211, 182, 131) pinkish = 0xd46a7eff, // (212, 106, 126) reallylightblue = 0xd4ffffff, // (212, 255, 255) lipstick = 0xd5174eff, // (213, 23, 78) dullpink = 0xd5869dff, // (213, 134, 157) dustypink = 0xd58a94ff, // (213, 138, 148) burntyellow = 0xd5ab09ff, // (213, 171, 9) darkyellow = 0xd5b60aff, // (213, 182, 10) verylightblue = 0xd5ffffff, // (213, 255, 255) pinkishpurple = 0xd648d7ff, // (214, 72, 215) lightviolet = 0xd6b4fcff, // (214, 180, 252) ice = 0xd6fffaff, // (214, 255, 250) verypaleblue = 0xd6fffeff, // (214, 255, 254) purplepink1 = 0xd725deff, // (215, 37, 222) palemagenta = 0xd767adff, // (215, 103, 173) iceblue = 0xd7fffeff, // (215, 255, 254) dullorange = 0xd8863bff, // (216, 134, 59) lightgrey = 0xd8dcd6ff, // (216, 220, 214) darkhotpink = 0xd90166ff, // (217, 1, 102) heliotrope = 0xd94ff5ff, // (217, 79, 245) palered = 0xd9544dff, // (217, 84, 77) pinkishtan = 0xd99b82ff, // (217, 155, 130) darkishpink = 0xda467dff, // (218, 70, 125) pinkpurple1 = 0xdb4bdaff, // (219, 75, 218) pastelred = 0xdb5856ff, // (219, 88, 86) gold = 0xdbb40cff, // (219, 180, 12) deeporange = 0xdc4d01ff, // (220, 77, 1) lavenderpink = 0xdd85d7ff, // (221, 133, 215) pissyellow = 0xddd618ff, // (221, 214, 24) cerise = 0xde0c62ff, // (222, 12, 98) darkpeach = 0xde7e5dff, // (222, 126, 93) fadedpink = 0xde9dacff, // (222, 157, 172) purpleishpink = 0xdf4ec8ff, // (223, 78, 200) lightlavender = 0xdfc5feff, // (223, 197, 254) purplepink2 = 0xe03fd8ff, // (224, 63, 216) pumpkin = 0xe17701ff, // (225, 119, 1) sand = 0xe2ca76ff, // (226, 202, 118) palelilac = 0xe4cbffff, // (228, 203, 255) red = 0xe50000ff, // (229, 0, 0) beige = 0xe6daa6ff, // (230, 218, 166) lightkhaki = 0xe6f2a2ff, // (230, 242, 162) pigpink = 0xe78ea5ff, // (231, 142, 165) tomatored = 0xec2d01ff, // (236, 45, 1) fuchsia = 0xed0dd9ff, // (237, 13, 217) lightlilac = 0xedc8ffff, // (237, 200, 255) palelavender = 0xeecffeff, // (238, 207, 254) dullyellow = 0xeedc5bff, // (238, 220, 91) pinkpurple2 = 0xef1de7ff, // (239, 29, 231) tomato = 0xef4026ff, // (239, 64, 38) macaroniandcheese = 0xefb435ff, // (239, 180, 53) lightlavendar = 0xefc0feff, // (239, 192, 254) purplypink = 0xf075e6ff, // (240, 117, 230) dustyorange = 0xf0833aff, // (240, 131, 58) fadedorange = 0xf0944dff, // (240, 148, 77) pinkishred = 0xf10c45ff, // (241, 12, 69) sandy = 0xf1da7aff, // (241, 218, 122) offyellow = 0xf1f33fff, // (241, 243, 63) blush = 0xf29e8eff, // (242, 158, 142) squash = 0xf2ab15ff, // (242, 171, 21) mediumpink = 0xf36196ff, // (243, 97, 150) vermillion = 0xf4320cff, // (244, 50, 12) orangishred = 0xf43605ff, // (244, 54, 5) maize = 0xf4d054ff, // (244, 208, 84) hotmagenta = 0xf504c9ff, // (245, 4, 201) pinkred = 0xf5054fff, // (245, 5, 79) golden = 0xf5bf03ff, // (245, 191, 3) rosypink = 0xf6688eff, // (246, 104, 142) verylightpurple = 0xf6cefcff, // (246, 206, 252) cherryred = 0xf7022aff, // (247, 2, 42) rosepink = 0xf7879aff, // (247, 135, 154) lightmustard = 0xf7d560ff, // (247, 213, 96) reddishorange = 0xf8481cff, // (248, 72, 28) orange = 0xf97306ff, // (249, 115, 6) goldenrod1 = 0xf9bc08ff, // (249, 188, 8) redpink = 0xfa2a55ff, // (250, 42, 85) orangeyred = 0xfa4224ff, // (250, 66, 36) lightmagenta = 0xfa5ff7ff, // (250, 95, 247) goldenrod2 = 0xfac205ff, // (250, 194, 5) yellowish = 0xfaee66ff, // (250, 238, 102) bananayellow = 0xfafe4bff, // (250, 254, 75) strawberry = 0xfb2943ff, // (251, 41, 67) warmpink = 0xfb5581ff, // (251, 85, 129) violetpink = 0xfb5ffcff, // (251, 95, 252) pumpkinorange = 0xfb7d07ff, // (251, 125, 7) wheat = 0xfbdd7eff, // (251, 221, 126) lighttan = 0xfbeeacff, // (251, 238, 172) pinkyred = 0xfc2647ff, // (252, 38, 71) coral = 0xfc5a50ff, // (252, 90, 80) orangish = 0xfc824aff, // (252, 130, 74) pinky = 0xfc86aaff, // (252, 134, 170) yelloworange = 0xfcb001ff, // (252, 176, 1) marigold = 0xfcc006ff, // (252, 192, 6) sandyellow = 0xfce166ff, // (252, 225, 102) straw = 0xfcf679ff, // (252, 246, 121) yellowishtan = 0xfcfc81ff, // (252, 252, 129) redorange = 0xfd3c06ff, // (253, 60, 6) orangered1 = 0xfd411eff, // (253, 65, 30) watermelon = 0xfd4659ff, // (253, 70, 89) grapefruit = 0xfd5956ff, // (253, 89, 86) carnation = 0xfd798fff, // (253, 121, 143) orangeish = 0xfd8d49ff, // (253, 141, 73) lightorange = 0xfdaa48ff, // (253, 170, 72) softpink = 0xfdb0c0ff, // (253, 176, 192) butterscotch = 0xfdb147ff, // (253, 177, 71) orangeyyellow = 0xfdb915ff, // (253, 185, 21) palerose = 0xfdc1c5ff, // (253, 193, 197) lightgold = 0xfddc5cff, // (253, 220, 92) palegold = 0xfdde6cff, // (253, 222, 108) sandyyellow = 0xfdee73ff, // (253, 238, 115) palegrey = 0xfdfdfeff, // (253, 253, 254) lemonyellow = 0xfdff38ff, // (253, 255, 56) lemon = 0xfdff52ff, // (253, 255, 82) canary = 0xfdff63ff, // (253, 255, 99) fireenginered = 0xfe0002ff, // (254, 0, 2) neonpink = 0xfe019aff, // (254, 1, 154) brightpink = 0xfe01b1ff, // (254, 1, 177) shockingpink = 0xfe02a2ff, // (254, 2, 162) reddishpink = 0xfe2c54ff, // (254, 44, 84) lightishred = 0xfe2f4aff, // (254, 47, 74) orangered2 = 0xfe420fff, // (254, 66, 15) barbiepink = 0xfe46a5ff, // (254, 70, 165) bloodorange = 0xfe4b03ff, // (254, 75, 3) salmonpink = 0xfe7b7cff, // (254, 123, 124) blushpink = 0xfe828cff, // (254, 130, 140) bubblegumpink1 = 0xfe83ccff, // (254, 131, 204) rosa = 0xfe86a4ff, // (254, 134, 164) lightsalmon = 0xfea993ff, // (254, 169, 147) saffron = 0xfeb209ff, // (254, 178, 9) amber = 0xfeb308ff, // (254, 179, 8) goldenyellow = 0xfec615ff, // (254, 198, 21) palemauve = 0xfed0fcff, // (254, 208, 252) dandelion = 0xfedf08ff, // (254, 223, 8) buff = 0xfef69eff, // (254, 246, 158) parchment = 0xfefcafff, // (254, 252, 175) fadedyellow = 0xfeff7fff, // (254, 255, 127) ecru = 0xfeffcaff, // (254, 255, 202) brightred = 0xff000dff, // (255, 0, 13) hotpink = 0xff028dff, // (255, 2, 141) electricpink = 0xff0490ff, // (255, 4, 144) neonred = 0xff073aff, // (255, 7, 58) strongpink = 0xff0789ff, // (255, 7, 137) brightmagenta = 0xff08e8ff, // (255, 8, 232) lightred = 0xff474cff, // (255, 71, 76) brightorange = 0xff5b00ff, // (255, 91, 0) coralpink = 0xff6163ff, // (255, 97, 99) candypink = 0xff63e9ff, // (255, 99, 233) bubblegumpink2 = 0xff69afff, // (255, 105, 175) bubblegum = 0xff6cb5ff, // (255, 108, 181) orangepink = 0xff6f52ff, // (255, 111, 82) pinkishorange = 0xff724cff, // (255, 114, 76) melon = 0xff7855ff, // (255, 120, 85) salmon = 0xff796cff, // (255, 121, 108) carnationpink = 0xff7fa7ff, // (255, 127, 167) pink = 0xff81c0ff, // (255, 129, 192) tangerine = 0xff9408ff, // (255, 148, 8) pastelorange = 0xff964fff, // (255, 150, 79) peachypink = 0xff9a8aff, // (255, 154, 138) mango = 0xffa62bff, // (255, 166, 43) paleorange = 0xffa756ff, // (255, 167, 86) yellowishorange = 0xffab0fff, // (255, 171, 15) orangeyellow = 0xffad01ff, // (255, 173, 1) peach = 0xffb07cff, // (255, 176, 124) apricot = 0xffb16dff, // (255, 177, 109) palesalmon = 0xffb19aff, // (255, 177, 154) powderpink = 0xffb2d0ff, // (255, 178, 208) babypink = 0xffb7ceff, // (255, 183, 206) pastelpink = 0xffbacdff, // (255, 186, 205) sunflower = 0xffc512ff, // (255, 197, 18) lightrose = 0xffc5cbff, // (255, 197, 203) palepink = 0xffcfdcff, // (255, 207, 220) lightpink = 0xffd1dfff, // (255, 209, 223) lightpeach = 0xffd8b1ff, // (255, 216, 177) sunfloweryellow = 0xffda03ff, // (255, 218, 3) sunyellow = 0xffdf22ff, // (255, 223, 34) yellowtan = 0xffe36eff, // (255, 227, 110) palepeach = 0xffe5adff, // (255, 229, 173) darkcream = 0xfff39aff, // (255, 243, 154) verylightpink = 0xfff4f2ff, // (255, 244, 242) sunnyyellow = 0xfff917ff, // (255, 249, 23) pale = 0xfff9d0ff, // (255, 249, 208) manilla = 0xfffa86ff, // (255, 250, 134) eggshell1 = 0xfffcc4ff, // (255, 252, 196) brightyellow = 0xfffd01ff, // (255, 253, 1) sunshineyellow = 0xfffd37ff, // (255, 253, 55) butteryellow = 0xfffd74ff, // (255, 253, 116) custard = 0xfffd78ff, // (255, 253, 120) canaryyellow = 0xfffe40ff, // (255, 254, 64) pastelyellow = 0xfffe71ff, // (255, 254, 113) lightyellow = 0xfffe7aff, // (255, 254, 122) lightbeige = 0xfffeb6ff, // (255, 254, 182) yellow = 0xffff14ff, // (255, 255, 20) banana = 0xffff7eff, // (255, 255, 126) butter = 0xffff81ff, // (255, 255, 129) paleyellow = 0xffff84ff, // (255, 255, 132) creme = 0xffffb6ff, // (255, 255, 182) cream = 0xffffc2ff, // (255, 255, 194) ivory = 0xffffcbff, // (255, 255, 203) eggshell2 = 0xffffd4ff, // (255, 255, 212) offwhite = 0xffffe4ff, // (255, 255, 228) white = 0xffffffff, // (255, 255, 255) Count = 949 }; static inline const std::vector<sf::Color> Colors { sf::Color(black), sf::Color(verydarkblue), sf::Color(darknavyblue), sf::Color(darkblue1), sf::Color(darknavy), sf::Color(navyblue), sf::Color(darkforestgreen), sf::Color(prussianblue), sf::Color(darkbluegreen), sf::Color(deepteal), sf::Color(petrol), sf::Color(kelleygreen), sf::Color(greenishturquoise), sf::Color(cyan), sf::Color(trueblue), sf::Color(navy), sf::Color(marineblue), sf::Color(darkishblue), sf::Color(racinggreen), sf::Color(darkteal), sf::Color(deepseablue), sf::Color(brightblue), sf::Color(peacockblue), sf::Color(darkaquamarine), sf::Color(deepturquoise), sf::Color(bluegreen1), sf::Color(ocean), sf::Color(tealblue), sf::Color(irishgreen), sf::Color(emerald), sf::Color(shamrock), sf::Color(greenblue1), sf::Color(brightteal), sf::Color(brightgreen), sf::Color(midnightblue), sf::Color(pureblue), sf::Color(darkroyalblue), sf::Color(richblue), sf::Color(deepgreen), sf::Color(emeraldgreen), sf::Color(teal), sf::Color(kellygreen), sf::Color(shamrockgreen), sf::Color(brightskyblue), sf::Color(aquablue), sf::Color(midnight), sf::Color(darkblue2), sf::Color(cobaltblue), sf::Color(blue), sf::Color(darkgreen1), sf::Color(vibrantblue), sf::Color(oceanblue), sf::Color(deepblue), sf::Color(nightblue), sf::Color(marine), sf::Color(bottlegreen), sf::Color(darkturquoise), sf::Color(seablue), sf::Color(junglegreen), sf::Color(cerulean), sf::Color(aquamarine1), sf::Color(neonblue), sf::Color(turquoisegreen), sf::Color(royalblue), sf::Color(evergreen), sf::Color(britishracinggreen), sf::Color(darkgreen2), sf::Color(darkaqua), sf::Color(ceruleanblue), sf::Color(brightseagreen), sf::Color(verydarkgreen), sf::Color(forestgreen), sf::Color(electricblue), sf::Color(azure), sf::Color(turquoiseblue), sf::Color(greenblue2), sf::Color(turquoise), sf::Color(almostblack), sf::Color(primaryblue), sf::Color(deepaqua), sf::Color(truegreen), sf::Color(fluorescentgreen), sf::Color(twilightblue), sf::Color(pinegreen), sf::Color(spruce), sf::Color(darkcyan), sf::Color(vibrantgreen), sf::Color(flurogreen), sf::Color(huntergreen), sf::Color(forest), sf::Color(greenishblue), sf::Color(mintygreen), sf::Color(brightaqua), sf::Color(strongblue), sf::Color(royal), sf::Color(greenteal), sf::Color(tealishgreen), sf::Color(neongreen), sf::Color(deepskyblue), sf::Color(waterblue), sf::Color(bluegreen2), sf::Color(brightturquoise), sf::Color(niceblue), sf::Color(bluishgreen), sf::Color(darkseagreen), sf::Color(aquagreen), sf::Color(bluegreen3), sf::Color(topaz), sf::Color(aqua), sf::Color(vividblue), sf::Color(forrestgreen), sf::Color(lightnavy), sf::Color(green), sf::Color(ultramarineblue), sf::Color(seaweed), sf::Color(dark), sf::Color(highlightergreen), sf::Color(verydarkbrown), sf::Color(azul), sf::Color(cobalt), sf::Color(viridian), sf::Color(spearmint), sf::Color(darkindigo), sf::Color(darkbluegrey), sf::Color(darkgreenblue), sf::Color(jade), sf::Color(darkseafoam), sf::Color(ultramarine), sf::Color(darkmintgreen), sf::Color(wintergreen), sf::Color(sapphire), sf::Color(darkslateblue), sf::Color(algaegreen), sf::Color(electricgreen), sf::Color(blueblue), sf::Color(greenblue3), sf::Color(clearblue), sf::Color(tealish), sf::Color(tealgreen), sf::Color(hotgreen), sf::Color(duskblue), sf::Color(brightlightblue), sf::Color(midblue), sf::Color(midnightpurple), sf::Color(darkishgreen), sf::Color(darkgreyblue), sf::Color(bluish), sf::Color(verydarkpurple), sf::Color(treegreen), sf::Color(greenishcyan), sf::Color(pine), sf::Color(jadegreen), sf::Color(blueygreen), sf::Color(mediumblue), sf::Color(radioactivegreen), sf::Color(brightlightgreen), sf::Color(lightnavyblue), sf::Color(aquamarine2), sf::Color(vividgreen), sf::Color(uglyblue), sf::Color(greenishteal), sf::Color(coolgreen), sf::Color(darkviolet), sf::Color(darkbrown), sf::Color(charcoal), sf::Color(darkpurple), sf::Color(navygreen), sf::Color(seaweedgreen), sf::Color(deeppurple), sf::Color(darkgrey), sf::Color(darkolive), sf::Color(windowsblue), sf::Color(indigo), sf::Color(eggplant), sf::Color(darkgrassgreen), sf::Color(mediumgreen), sf::Color(indigoblue), sf::Color(lightroyalblue), sf::Color(weirdgreen), sf::Color(denimblue), sf::Color(denim), sf::Color(mutedblue), sf::Color(darkmaroon), sf::Color(charcoalgrey), sf::Color(darkolivegreen), sf::Color(flatblue), sf::Color(sea), sf::Color(aubergine), sf::Color(chocolate), sf::Color(lightishblue), sf::Color(oceangreen), sf::Color(dodgerblue), sf::Color(darkseafoamgreen), sf::Color(darkplum), sf::Color(dirtyblue), sf::Color(grassgreen), sf::Color(greenish), sf::Color(poisongreen), sf::Color(deepbrown), sf::Color(chocolatebrown), sf::Color(grassygreen), sf::Color(brightcyan), sf::Color(greenyblue), sf::Color(eggplantpurple), sf::Color(frenchblue), sf::Color(darkskyblue), sf::Color(blueberry), sf::Color(duskyblue), sf::Color(darkmint), sf::Color(deepviolet), sf::Color(dullblue), sf::Color(coolblue), sf::Color(mahogany), sf::Color(royalpurple), sf::Color(driedblood), sf::Color(warmblue), sf::Color(armygreen), sf::Color(camouflagegreen), sf::Color(dustyteal), sf::Color(lawngreen), sf::Color(plumpurple), sf::Color(twilight), sf::Color(dusk), sf::Color(cadetblue), sf::Color(lightneongreen), sf::Color(metallicblue), sf::Color(lightforestgreen), sf::Color(stormyblue), sf::Color(midgreen), sf::Color(violetblue), sf::Color(slate), sf::Color(cornflowerblue), sf::Color(leafygreen), sf::Color(camogreen), sf::Color(bluewithahintofpurple), sf::Color(gunmetal), sf::Color(seagreen), sf::Color(lightbrightgreen), sf::Color(greenbrown), sf::Color(ferngreen), sf::Color(algae), sf::Color(blurple), sf::Color(offblue), sf::Color(darkpastelgreen), sf::Color(lightgreenblue), sf::Color(bluepurple1), sf::Color(plum), sf::Color(froggreen), sf::Color(slategrey), sf::Color(darksage), sf::Color(bluepurple2), sf::Color(steelblue), sf::Color(dustyblue), sf::Color(slateblue), sf::Color(sapgreen), sf::Color(leafgreen), sf::Color(grass), sf::Color(kermitgreen), sf::Color(blueviolet), sf::Color(grapepurple), sf::Color(purpleblue1), sf::Color(greyishblue), sf::Color(greyteal), sf::Color(greenapple), sf::Color(purpleyblue), sf::Color(dullteal), sf::Color(mutedgreen), sf::Color(purplishblue), sf::Color(mudbrown), sf::Color(mudgreen), sf::Color(bluegrey4), sf::Color(burgundy), sf::Color(purpleishblue), sf::Color(toxicgreen), sf::Color(lightishgreen), sf::Color(blueypurple), sf::Color(iris), sf::Color(purpleblue2), sf::Color(mossygreen), sf::Color(fern), sf::Color(boringgreen), sf::Color(lightgreenishblue), sf::Color(olivebrown), sf::Color(greyblue1), sf::Color(softblue), sf::Color(maroon), sf::Color(brown), sf::Color(muddygreen), sf::Color(mossgreen), sf::Color(fadedblue), sf::Color(slategreen), sf::Color(tea), sf::Color(brightlimegreen), sf::Color(purplyblue), sf::Color(darkperiwinkle), sf::Color(militarygreen), sf::Color(dirtygreen), sf::Color(purplebrown), sf::Color(olivegreen), sf::Color(claret), sf::Color(burple), sf::Color(greenybrown), sf::Color(greenishbrown), sf::Color(swamp), sf::Color(flatgreen), sf::Color(freshgreen), sf::Color(brownishgreen), sf::Color(cornflower), sf::Color(purplishbrown), sf::Color(battleshipgrey), sf::Color(greyblue2), sf::Color(offgreen), sf::Color(grape), sf::Color(murkygreen), sf::Color(lightindigo), sf::Color(robinsegg), sf::Color(reddybrown), sf::Color(olive), sf::Color(apple), sf::Color(brownygreen), sf::Color(olivedrab), sf::Color(poopgreen), sf::Color(steelgrey), sf::Color(softgreen), sf::Color(bluishpurple), sf::Color(browngreen), sf::Color(nastygreen), sf::Color(greyishteal), sf::Color(leaf), sf::Color(richpurple), sf::Color(khakigreen), sf::Color(darkyellowgreen), sf::Color(merlot), sf::Color(dirtypurple), sf::Color(mud), sf::Color(steel), sf::Color(chestnut), sf::Color(swampgreen), sf::Color(bluishgrey), sf::Color(drabgreen), sf::Color(dullgreen), sf::Color(velvet), sf::Color(darkishpurple), sf::Color(shitgreen), sf::Color(bluegrey1), sf::Color(turtlegreen), sf::Color(skyblue), sf::Color(lightergreen), sf::Color(brownishpurple), sf::Color(moss), sf::Color(dustygreen), sf::Color(applegreen), sf::Color(lightbluishgreen), sf::Color(lightgreen1), sf::Color(blood), sf::Color(greengrey), sf::Color(greyblue3), sf::Color(asparagus), sf::Color(greygreen1), sf::Color(seafoamblue), sf::Color(poopbrown), sf::Color(purplishgrey), sf::Color(greyishbrown), sf::Color(uglygreen), sf::Color(seafoamgreen), sf::Color(bordeaux), sf::Color(winered), sf::Color(shitbrown), sf::Color(fadedgreen), sf::Color(lightblue1), sf::Color(tiffanyblue), sf::Color(lightaquamarine), sf::Color(uglybrown), sf::Color(mediumgrey), sf::Color(purple), sf::Color(bruise), sf::Color(greenygrey), sf::Color(darklimegreen), sf::Color(lightturquoise), sf::Color(lightbluegreen), sf::Color(reddishbrown), sf::Color(milkchocolate), sf::Color(mediumbrown), sf::Color(poop), sf::Color(shit), sf::Color(darktaupe), sf::Color(greybrown), sf::Color(camo), sf::Color(wine), sf::Color(mutedpurple), sf::Color(seafoam), sf::Color(redpurple), sf::Color(dustypurple), sf::Color(greypurple), sf::Color(drab), sf::Color(greyishgreen), sf::Color(sky), sf::Color(paleteal), sf::Color(dirtbrown), sf::Color(darkred), sf::Color(dullpurple), sf::Color(darklime), sf::Color(indianred), sf::Color(darklavender), sf::Color(bluegrey2), sf::Color(purplegrey), sf::Color(brownishgrey), sf::Color(greygreen2), sf::Color(darkmauve), sf::Color(purpley), sf::Color(cocoa), sf::Color(dullbrown), sf::Color(avocadogreen), sf::Color(sage), sf::Color(brightlime), sf::Color(poobrown), sf::Color(muddybrown), sf::Color(greyishpurple), sf::Color(babyshitgreen), sf::Color(sagegreen), sf::Color(lighteggplant), sf::Color(duskypurple), sf::Color(blueygrey), sf::Color(vomitgreen), sf::Color(limegreen), sf::Color(dirt), sf::Color(carolinablue), sf::Color(robineggblue), sf::Color(redbrown), sf::Color(rustbrown), sf::Color(lavenderblue), sf::Color(crimson), sf::Color(redwine), sf::Color(eastergreen), sf::Color(babygreen), sf::Color(lightaqua), sf::Color(deeplavender), sf::Color(browngrey), sf::Color(hazel), sf::Color(periwinkle), sf::Color(peagreen), sf::Color(kiwigreen), sf::Color(brickred), sf::Color(poo), sf::Color(perrywinkle), sf::Color(babypoopgreen), sf::Color(periwinkleblue), sf::Color(ickygreen), sf::Color(lichen), sf::Color(acidgreen), sf::Color(mintgreen), sf::Color(avocado), sf::Color(lightteal), sf::Color(foamgreen), sf::Color(reddishpurple), sf::Color(fadedpurple), sf::Color(mulberry), sf::Color(brownred), sf::Color(grey), sf::Color(peasoup), sf::Color(babypoop), sf::Color(purplish), sf::Color(pukebrown), sf::Color(purpleygrey), sf::Color(peasoupgreen), sf::Color(barfgreen), sf::Color(sicklygreen), sf::Color(warmpurple), sf::Color(coolgrey), sf::Color(lightblue2), sf::Color(darkmagenta), sf::Color(warmbrown), sf::Color(deeplilac), sf::Color(greenishgrey), sf::Color(boogergreen), sf::Color(lightgreen2), sf::Color(warmgrey), sf::Color(bloodred), sf::Color(purply), sf::Color(purpleish), sf::Color(sepia), sf::Color(robinseggblue), sf::Color(lightseagreen), sf::Color(vividpurple), sf::Color(purplered), sf::Color(berry), sf::Color(reddishgrey), sf::Color(slimegreen), sf::Color(deepred), sf::Color(violet), sf::Color(auburn), sf::Color(rawsienna), sf::Color(pukegreen), sf::Color(lightgrassgreen), sf::Color(amethyst), sf::Color(yellowishbrown), sf::Color(darkkhaki), sf::Color(booger), sf::Color(hospitalgreen), sf::Color(brownish), sf::Color(darklilac), sf::Color(brightolive), sf::Color(kiwi), sf::Color(carmine), sf::Color(darkfuchsia), sf::Color(lightplum), sf::Color(mocha), sf::Color(sickgreen), sf::Color(lightgreyblue), sf::Color(snotgreen), sf::Color(brightyellowgreen), sf::Color(cranberry), sf::Color(redviolet), sf::Color(brownishred), sf::Color(mediumpurple), sf::Color(burntred), sf::Color(diarrhea), sf::Color(mint), sf::Color(deepmagenta), sf::Color(barneypurple), sf::Color(brick), sf::Color(burntumber), sf::Color(grossgreen), sf::Color(lightseafoam), sf::Color(russet), sf::Color(lightmaroon), sf::Color(earth), sf::Color(vomit), sf::Color(pastelblue), sf::Color(babyblue), sf::Color(uglypurple), sf::Color(heather), sf::Color(lightolivegreen), sf::Color(pea), sf::Color(violetred), sf::Color(lightishpurple), sf::Color(lighterpurple), sf::Color(puce), sf::Color(cement), sf::Color(puke), sf::Color(paleturquoise), sf::Color(softpurple), sf::Color(coffee), sf::Color(lightmossgreen), sf::Color(lightmintgreen), sf::Color(rawumber), sf::Color(lightseafoamgreen), sf::Color(rust), sf::Color(lightburgundy), sf::Color(bronze), sf::Color(wisteria), sf::Color(darkmustard), sf::Color(darksand), sf::Color(greyish), sf::Color(mustardgreen), sf::Color(electriclime), sf::Color(darkishred), sf::Color(sienna), sf::Color(tangreen), sf::Color(springgreen), sf::Color(electricpurple), sf::Color(rustred), sf::Color(khaki), sf::Color(lime), sf::Color(rouge), sf::Color(tanbrown), sf::Color(babypoo), sf::Color(barney), sf::Color(cinnamon), sf::Color(leather), sf::Color(mustardbrown), sf::Color(dustylavender), sf::Color(darkbeige), sf::Color(snot), sf::Color(lightolive), sf::Color(cloudyblue), sf::Color(lightcyan), sf::Color(vibrantpurple), sf::Color(brightviolet), sf::Color(lightbrown), sf::Color(babyshitbrown), sf::Color(stone), sf::Color(lemongreen), sf::Color(mauve), sf::Color(yellowybrown), sf::Color(lightlime), sf::Color(keylime), sf::Color(rustyred), sf::Color(caramel), sf::Color(darktan), sf::Color(bland), sf::Color(raspberry), sf::Color(purplishred), sf::Color(burntsienna), sf::Color(yellowishgreen), sf::Color(pastelgreen), sf::Color(orangeybrown), sf::Color(pinkishbrown), sf::Color(palebrown), sf::Color(powderblue), sf::Color(paleolivegreen), sf::Color(palelightgreen), sf::Color(palelimegreen), sf::Color(orangishbrown), sf::Color(umber), sf::Color(claybrown), sf::Color(goldenbrown), sf::Color(brownyellow), sf::Color(dust), sf::Color(lightpastelgreen), sf::Color(lighturple), sf::Color(darkrose), sf::Color(darkgold), sf::Color(bile), sf::Color(greenyellow1), sf::Color(copper), sf::Color(clay), sf::Color(babypukegreen), sf::Color(lightmint), sf::Color(burntsiena), sf::Color(palepurple), sf::Color(yellowbrown), sf::Color(lightbluegrey), sf::Color(lightgreygreen), sf::Color(palecyan), sf::Color(paleaqua), sf::Color(dustyred), sf::Color(brownorange), sf::Color(taupe), sf::Color(paleolive), sf::Color(lightlimegreen), sf::Color(duskyrose), sf::Color(mushroom), sf::Color(dullred), sf::Color(yellowgreen1), sf::Color(neonpurple), sf::Color(greenishtan), sf::Color(lightsage), sf::Color(washedoutgreen), sf::Color(adobe), sf::Color(paleskyblue), sf::Color(teagreen), sf::Color(scarlet), sf::Color(rosered), sf::Color(brightpurple), sf::Color(orangebrown), sf::Color(putty), sf::Color(palelime), sf::Color(celadon), sf::Color(lightpurple), sf::Color(ochre), sf::Color(ocher), sf::Color(muddyyellow), sf::Color(yellowygreen), sf::Color(lemonlime), sf::Color(lipstickred), sf::Color(burntorange), sf::Color(easterpurple), sf::Color(dustyrose), sf::Color(pistachio), sf::Color(yellowgreen2), sf::Color(brickorange), sf::Color(lightperiwinkle), sf::Color(chartreuse), sf::Color(celery), sf::Color(magenta), sf::Color(brownishpink), sf::Color(lightmauve), sf::Color(oliveyellow), sf::Color(pukeyellow), sf::Color(lightyellowishgreen), sf::Color(greypink), sf::Color(duckeggblue), sf::Color(reddish), sf::Color(rustorange), sf::Color(liliac), sf::Color(sandybrown), sf::Color(lightpeagreen), sf::Color(eggshellblue), sf::Color(silver), sf::Color(darkorange), sf::Color(ocre), sf::Color(camel), sf::Color(greenyyellow), sf::Color(lightskyblue), sf::Color(deeprose), sf::Color(brightlavender), sf::Color(oldpink), sf::Color(lavender), sf::Color(toupe), sf::Color(vomityellow), sf::Color(palegreen), sf::Color(purpleypink), sf::Color(darksalmon), sf::Color(orchid), sf::Color(dirtyorange), sf::Color(oldrose), sf::Color(greyishpink), sf::Color(pinkishgrey), sf::Color(yellowgreen3), sf::Color(lightlightgreen), sf::Color(pinkypurple), sf::Color(brightlilac), sf::Color(terracotta1), sf::Color(sandstone), sf::Color(brownishyellow), sf::Color(greenishbeige), sf::Color(greenyellow2), sf::Color(ruby), sf::Color(terracotta2), sf::Color(brownyorange), sf::Color(dirtypink), sf::Color(babypurple), sf::Color(pastelpurple), sf::Color(lightlightblue), sf::Color(hotpurple), sf::Color(deeppink), sf::Color(darkpink), sf::Color(terracota), sf::Color(brownishorange), sf::Color(yellowochre), sf::Color(sandbrown), sf::Color(pear), sf::Color(duskypink), sf::Color(desert), sf::Color(lightyellowgreen), sf::Color(rustyorange), sf::Color(uglypink), sf::Color(dirtyyellow), sf::Color(greenishyellow), sf::Color(purplishpink), sf::Color(lilac), sf::Color(paleviolet), sf::Color(mustard), sf::Color(cherry), sf::Color(darkcoral), sf::Color(rose), sf::Color(fawn), sf::Color(verypalegreen), sf::Color(neonyellow), sf::Color(uglyyellow), sf::Color(sicklyyellow), sf::Color(limeyellow), sf::Color(paleblue), sf::Color(mutedpink), sf::Color(tan), sf::Color(verylightgreen), sf::Color(mustardyellow), sf::Color(fadedred), sf::Color(verylightbrown), sf::Color(pinkish), sf::Color(reallylightblue), sf::Color(lipstick), sf::Color(dullpink), sf::Color(dustypink), sf::Color(burntyellow), sf::Color(darkyellow), sf::Color(verylightblue), sf::Color(pinkishpurple), sf::Color(lightviolet), sf::Color(ice), sf::Color(verypaleblue), sf::Color(purplepink1), sf::Color(palemagenta), sf::Color(iceblue), sf::Color(dullorange), sf::Color(lightgrey), sf::Color(darkhotpink), sf::Color(heliotrope), sf::Color(palered), sf::Color(pinkishtan), sf::Color(darkishpink), sf::Color(pinkpurple1), sf::Color(pastelred), sf::Color(gold), sf::Color(deeporange), sf::Color(lavenderpink), sf::Color(pissyellow), sf::Color(cerise), sf::Color(darkpeach), sf::Color(fadedpink), sf::Color(purpleishpink), sf::Color(lightlavender), sf::Color(purplepink2), sf::Color(pumpkin), sf::Color(sand), sf::Color(palelilac), sf::Color(red), sf::Color(beige), sf::Color(lightkhaki), sf::Color(pigpink), sf::Color(tomatored), sf::Color(fuchsia), sf::Color(lightlilac), sf::Color(palelavender), sf::Color(dullyellow), sf::Color(pinkpurple2), sf::Color(tomato), sf::Color(macaroniandcheese), sf::Color(lightlavendar), sf::Color(purplypink), sf::Color(dustyorange), sf::Color(fadedorange), sf::Color(pinkishred), sf::Color(sandy), sf::Color(offyellow), sf::Color(blush), sf::Color(squash), sf::Color(mediumpink), sf::Color(vermillion), sf::Color(orangishred), sf::Color(maize), sf::Color(hotmagenta), sf::Color(pinkred), sf::Color(golden), sf::Color(rosypink), sf::Color(verylightpurple), sf::Color(cherryred), sf::Color(rosepink), sf::Color(lightmustard), sf::Color(reddishorange), sf::Color(orange), sf::Color(goldenrod1), sf::Color(redpink), sf::Color(orangeyred), sf::Color(lightmagenta), sf::Color(goldenrod2), sf::Color(yellowish), sf::Color(bananayellow), sf::Color(strawberry), sf::Color(warmpink), sf::Color(violetpink), sf::Color(pumpkinorange), sf::Color(wheat), sf::Color(lighttan), sf::Color(pinkyred), sf::Color(coral), sf::Color(orangish), sf::Color(pinky), sf::Color(yelloworange), sf::Color(marigold), sf::Color(sandyellow), sf::Color(straw), sf::Color(yellowishtan), sf::Color(redorange), sf::Color(orangered1), sf::Color(watermelon), sf::Color(grapefruit), sf::Color(carnation), sf::Color(orangeish), sf::Color(lightorange), sf::Color(softpink), sf::Color(butterscotch), sf::Color(orangeyyellow), sf::Color(palerose), sf::Color(lightgold), sf::Color(palegold), sf::Color(sandyyellow), sf::Color(palegrey), sf::Color(lemonyellow), sf::Color(lemon), sf::Color(canary), sf::Color(fireenginered), sf::Color(neonpink), sf::Color(brightpink), sf::Color(shockingpink), sf::Color(reddishpink), sf::Color(lightishred), sf::Color(orangered2), sf::Color(barbiepink), sf::Color(bloodorange), sf::Color(salmonpink), sf::Color(blushpink), sf::Color(bubblegumpink1), sf::Color(rosa), sf::Color(lightsalmon), sf::Color(saffron), sf::Color(amber), sf::Color(goldenyellow), sf::Color(palemauve), sf::Color(dandelion), sf::Color(buff), sf::Color(parchment), sf::Color(fadedyellow), sf::Color(ecru), sf::Color(brightred), sf::Color(hotpink), sf::Color(electricpink), sf::Color(neonred), sf::Color(strongpink), sf::Color(brightmagenta), sf::Color(lightred), sf::Color(brightorange), sf::Color(coralpink), sf::Color(candypink), sf::Color(bubblegumpink2), sf::Color(bubblegum), sf::Color(orangepink), sf::Color(pinkishorange), sf::Color(melon), sf::Color(salmon), sf::Color(carnationpink), sf::Color(pink), sf::Color(tangerine), sf::Color(pastelorange), sf::Color(peachypink), sf::Color(mango), sf::Color(paleorange), sf::Color(yellowishorange), sf::Color(orangeyellow), sf::Color(peach), sf::Color(apricot), sf::Color(palesalmon), sf::Color(powderpink), sf::Color(babypink), sf::Color(pastelpink), sf::Color(sunflower), sf::Color(lightrose), sf::Color(palepink), sf::Color(lightpink), sf::Color(lightpeach), sf::Color(sunfloweryellow), sf::Color(sunyellow), sf::Color(yellowtan), sf::Color(palepeach), sf::Color(darkcream), sf::Color(verylightpink), sf::Color(sunnyyellow), sf::Color(pale), sf::Color(manilla), sf::Color(eggshell1), sf::Color(brightyellow), sf::Color(sunshineyellow), sf::Color(butteryellow), sf::Color(custard), sf::Color(canaryyellow), sf::Color(pastelyellow), sf::Color(lightyellow), sf::Color(lightbeige), sf::Color(yellow), sf::Color(banana), sf::Color(butter), sf::Color(paleyellow), sf::Color(creme), sf::Color(cream), sf::Color(ivory), sf::Color(eggshell2), sf::Color(offwhite), sf::Color(white) }; // clang-format on static inline const std::string palleteName { "xkcd_949" }; }; } // namespace pallete } // namespace color #endif // SFUTIL_COLOR_NAMES_HPP_INCLUDED
50.151124
101
0.392058
Biyorne
f785377c186bc7f9a5ab4e90b36bd2caad3a35ae
522
cpp
C++
RayTracer/RayTracer/CheckerTexture.cpp
chunkyguy/SimpleRayTracer
ef03cb8a68339b66a70c6ae1b35a664ee20a8e4b
[ "MIT" ]
1
2019-02-26T13:41:29.000Z
2019-02-26T13:41:29.000Z
RayTracer/RayTracer/CheckerTexture.cpp
chunkyguy/SimpleRayTracer
ef03cb8a68339b66a70c6ae1b35a664ee20a8e4b
[ "MIT" ]
null
null
null
RayTracer/RayTracer/CheckerTexture.cpp
chunkyguy/SimpleRayTracer
ef03cb8a68339b66a70c6ae1b35a664ee20a8e4b
[ "MIT" ]
null
null
null
#include "CheckerTexture.h" #include <cmath> CheckerTexture::CheckerTexture(const Texture * first, const Texture * second) : first_(first), second_(second) {} CheckerTexture::~CheckerTexture() {} glm::vec3 CheckerTexture::color(const glm::vec2 & uv, const glm::vec3 & location) const { float s = std::sinf(10.0f * location.x) * sinf(10.0f * location.y) * sinf(10.0f * location.z); if (s < 0.0f) { return first_->color(uv, location); } else { return second_->color(uv, location); } }
26.1
98
0.649425
chunkyguy
f78e4a58edec13f36f30638aedb4112f66eb0d41
435
cpp
C++
demo/demo-openssl/main.cpp
wjx0912/cmake_modules
1599f7247cf970146d0ff28688e5f2c22c4297d2
[ "MIT" ]
null
null
null
demo/demo-openssl/main.cpp
wjx0912/cmake_modules
1599f7247cf970146d0ff28688e5f2c22c4297d2
[ "MIT" ]
null
null
null
demo/demo-openssl/main.cpp
wjx0912/cmake_modules
1599f7247cf970146d0ff28688e5f2c22c4297d2
[ "MIT" ]
null
null
null
#include <iostream> #include <openssl/md5.h> using namespace std; int main() { const char *data = "hello world"; // 原始数据 unsigned char md[16] = {0}; MD5_CTX ctx; MD5_Init(&ctx); MD5_Update(&ctx, data, strlen(data)); MD5_Final(md, &ctx); int i = 0; char buf[33] = {0}; char tmp[3] = {0}; for(i = 0; i < 16; i++ ) { sprintf(tmp,"%02X", md[i]); strcat(buf, tmp); } cout << buf << endl; // data的md5值 return 0; }
15.535714
44
0.577011
wjx0912
f7942cb45c608a66b5e80d7a1c19fe588083f11c
542
cpp
C++
Exercises/Single observer to counter/OverflowCounter.cpp
kinhtr/Cplusplus-Programming-in-IoT-Devices
0c9a40a549f1ec1797c67e1b35dde9e36a6a7e3f
[ "Apache-2.0" ]
null
null
null
Exercises/Single observer to counter/OverflowCounter.cpp
kinhtr/Cplusplus-Programming-in-IoT-Devices
0c9a40a549f1ec1797c67e1b35dde9e36a6a7e3f
[ "Apache-2.0" ]
null
null
null
Exercises/Single observer to counter/OverflowCounter.cpp
kinhtr/Cplusplus-Programming-in-IoT-Devices
0c9a40a549f1ec1797c67e1b35dde9e36a6a7e3f
[ "Apache-2.0" ]
null
null
null
#include "OverflowCounter.h" #include <iostream> void OverflowCounter::inc() { if (initial == limit) { initial = 0; Notify(); } else { initial++; } } void OverflowCounter::dec() { if (initial == 0) { initial = limit; //Notify(); } else { initial--; } } OverflowCounter::operator int() { return initial; } void OverflowCounter::SetObserver(Observer* o) { obs = o; } void OverflowCounter::Notify() { obs->HandleLimitReached(); } void OverflowCounter::test() { std::cout << "s"; }
14.648649
49
0.588561
kinhtr
f7969bb39de7b0e4246576891f9fb2dd3a3b3f17
2,344
hpp
C++
interface/Pointer.hpp
szk/reprize
a827aa0247f7954f9f36ae573f97db1397645bf5
[ "BSD-2-Clause" ]
null
null
null
interface/Pointer.hpp
szk/reprize
a827aa0247f7954f9f36ae573f97db1397645bf5
[ "BSD-2-Clause" ]
null
null
null
interface/Pointer.hpp
szk/reprize
a827aa0247f7954f9f36ae573f97db1397645bf5
[ "BSD-2-Clause" ]
1
2019-03-11T20:58:41.000Z
2019-03-11T20:58:41.000Z
#ifndef POINTER_HPP_ #define POINTER_HPP_ #include "input/InputBase.hpp" #include "input/InputBuffer.hpp" namespace reprize { namespace inf { enum GESTURE { GESTURE_MOVE_X, GESTURE_MOVE_Y, GESTURE_MOVE_Z, GESTURE_CLICK, GESTURE_TAP, GESTURE_PINCH, GESTURE_ZOOM, GESTURE_NUM, }; class Pointer : public res::Node { public: Pointer(void) : Node("Pointer") { RE_ZERO(begin_cmd, GESTURE_NUM); RE_ZERO(finish_cmd, GESTURE_NUM); } virtual ~Pointer(void) { DEL(entry); } virtual const bool init(inp::Input* input_) { input = input_; return true; } virtual res::Props* gen_props(void) { RE_PROPS_START(Pointer); RE_PROP_STR(Pointer, sensitivity); RE_PROP_STR(Pointer, pitch); RE_PROP_STR(Pointer, yaw); RE_PROP_STR(Pointer, invert); return RE_PROPS_FINISH; } const bool set_prop(res::Props* pr_) { pr = pr_; return false; } const bool gesture(GESTURE ges_, const bool begin_) { if (ges_ == GESTURE_NUM) { return false; } if (begin_ && begin_cmd[ges_] != NULL) { begin_cmd[ges_]->Apply(RE_SUCCESS); } if (!begin_ && finish_cmd[ges_] != NULL) { finish_cmd[ges_]->Apply(RE_SUCCESS); } return true; } private: const Str& prop_gesture(const Str& arg_) { } const Str& prop_sensitivity(const Str& arg_) { if (!arg_.empty()) { ISStrm ss(arg_); ss >> sensitivity; RE_DBG("changed: %f", sensitivity); } return RE_SUCCESS; } const Str& prop_yaw(const Str& arg_) { return RE_FAILURE; } const Str& prop_pitch(const Str& arg_) { return RE_FAILURE; } const Str& prop_invert(const Str& arg_) { return RE_FAILURE; } inp::Input* input; res::Props* pr; res::Property* begin_cmd[GESTURE_NUM],* finish_cmd[GESTURE_NUM]; Unit sensitivity; }; } } #endif
21.906542
69
0.511519
szk
f799da6643af3051d6bde680b42200d63f2b82a5
10,666
hpp
C++
InstEntry.hpp
antoniocgj/SweRV-ISS-1
bc32016a0b92d6240b5963457c4403b498200403
[ "Apache-2.0" ]
49
2020-05-27T10:14:02.000Z
2022-03-30T15:49:31.000Z
InstEntry.hpp
antoniocgj/SweRV-ISS-1
bc32016a0b92d6240b5963457c4403b498200403
[ "Apache-2.0" ]
19
2020-06-30T08:26:02.000Z
2022-03-22T05:18:14.000Z
InstEntry.hpp
antoniocgj/SweRV-ISS-1
bc32016a0b92d6240b5963457c4403b498200403
[ "Apache-2.0" ]
18
2020-08-30T02:55:25.000Z
2022-03-30T13:58:15.000Z
// Copyright 2020 Western Digital Corporation or its affiliates. // // 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. #pragma once #include <vector> #include <string> #include <unordered_map> #include "InstId.hpp" namespace WdRiscv { enum class OperandType { IntReg, FpReg, CsReg, VecReg, Imm, None }; enum class OperandMode { Read, Write, ReadWrite, None }; enum class InstType { Load, Store, Multiply, Divide, Branch, Int, Fp, Csr, Atomic, Vector, Zba, Zbb, Zbc, Zbe, Zbf, Zbm, Zbp, Zbr, Zbs, Zbt }; /// Return true if given instruction is a 4-byte instruction. inline bool isFullSizeInst(uint32_t inst) { return (inst & 3) == 3; } /// Return true if given instruction is a compressed instruction. inline bool isCompressedInst(uint32_t inst) { return (inst & 3) != 3; } /// Return the size of the given instruction (2 or 4) based on its /// opcode. inline unsigned instructionSize(uint32_t inst) { return (inst & 3) == 3 ? 4 : 2; } /// /// Generic information about an instruction including, opcode, /// type (integer, floatin-pointg, etc...), operand count, operand type, /// and operand direction (source versus destination). This is used to /// represent an entry in the instruction table defining the RISCV /// instruction set arcitecture. /// /// An instruction may have up to 4 operands: op0, op1, op2, op3: /// - For instructions of the form "inst rd, rs1, rs2", rd, rs1 and /// rs2 correspond to op0, op1 and op2 respectively. /// - For instructions of the form "inst rd, rs1, immediate", rd, /// rs1 and immediate correspond to op0, op1 and op2 respectively. /// - For load instructions (e.g. load rd, offset(rs1)), rd, rs1 and /// offset correspond to op0, op1, and op2 respectively. /// - For store instructions (e.g. store rs2, offset(rs1)), rs2, rs1 /// and offset correspond to op0, op1, and op2 respectively. /// class InstEntry { public: friend class InstTable; // Constructor. InstEntry(std::string name = "", InstId id = InstId::illegal, uint32_t code = 0, uint32_t mask = ~0, InstType type = InstType::Int, OperandType op0Type = OperandType::None, OperandMode op0Mode = OperandMode::None, uint32_t op0Mask = 0, OperandType op1Type = OperandType::None, OperandMode op1Mode = OperandMode::None, uint32_t op1Mask = 0, OperandType op2Type = OperandType::None, OperandMode op2Mode = OperandMode::None, uint32_t op2Mask = 0, OperandType op3Type = OperandType::None, OperandMode op3Mode = OperandMode::None, uint32_t op3Mask = 0); /// Return the name of the instruction. const std::string& name() const { return name_; } /// Return the id of the instruction (an integer between 0 and n /// where n is the number of defined instructions). Note that it is /// possible for two instructions with the same code to have /// different ids. This is because RISCV has instruction alias: /// same code corresponds to different instruction depending on the /// feature set and mode of the processor. InstId instId() const { return id_; } /// Return the instruction bits with all the operand specifiers set /// to zero. uint32_t code() const { return code_; } /// Return the mask corresponding to the code bis: Returned value /// has a 1 for each non-operand-specifier bit. uint32_t codeMask() const { return codeMask_; } /// Return valid operand count unsigned operandCount() const { return opCount_; } // Return the type of the ith operand or None if no such operand. // First operand corresponds to an index of zero. OperandType ithOperandType(unsigned i) const { if (i == 0) return op0Type_; if (i == 1) return op1Type_; if (i == 2) return op2Type_; if (i == 3) return op3Type_; return OperandType::None; } // Return the mode of the ith operand of None if no such operand. // First operand corresponds to an index of zero. OperandMode ithOperandMode(unsigned i) const { if (i == 0) return op0Mode_; if (i == 1) return op1Mode_; if (i == 2) return op2Mode_; if (i == 3) return op3Mode_; return OperandMode::None; } /// Return true if the ith operand is a write operand. bool isIthOperandWrite(unsigned i) const { OperandMode mode = ithOperandMode(i); return mode == OperandMode::Write or mode == OperandMode::ReadWrite; } /// Return true if the ith operand is a read operand. bool isIthOperandRead(unsigned i) const { OperandMode mode = ithOperandMode(i); return mode == OperandMode::Read or mode == OperandMode::ReadWrite; } /// Return the mask corresponding to the bits of the specifier of the /// ith operand. Return 0 if no such operand. uint32_t ithOperandMask(unsigned i) const { if (i == 0) return op0Mask_; if (i == 1) return op1Mask_; if (i == 2) return op2Mask_; if (i == 3) return op3Mask_; return 0; } /// Return true if ith operand is an integer register and is a source. bool isIthOperandIntRegSource(unsigned i) const { if (ithOperandType(i) != OperandType::IntReg) return false; return ithOperandMode(i) == OperandMode::Read; } /// Return true if ith operand is a floating point register and is /// a source. bool isIthOperandFpRegSource(unsigned i) const { if (ithOperandType(i) != OperandType::FpReg) return false; return ithOperandMode(i) == OperandMode::Read; } /// Return the instruction type. InstType type() const { return type_; } /// Return true if this is a load instruction (lb, lh, ...) bool isLoad() const { return type_ == InstType::Load; } /// Return true if this is a store instruction (sb, sh, ...) bool isStore() const { return type_ == InstType::Store; } /// Return true if this is a branch instruction (beq, jal, ...) bool isBranch() const { return type_ == InstType::Branch; } /// Return true if this is a multiply instruction (mul, mulh, ...) bool isMultiply() const { return type_ == InstType::Multiply; } /// Return true if this is a divide instruction (div, rem, ...) bool isDivide() const { return type_ == InstType::Divide; } /// Return true if this is a CSR instruction. bool isCsr() const { return type_ == InstType::Csr; } /// Return true if this is an atomic instruction. bool isAtomic() const { return type_ == InstType::Atomic; } /// Return true if this is an vector instruction. bool isVector() const { return type_ == InstType::Vector; } /// Return true if source operands have unsigned integer values. bool isUnsigned() const { return isUns_; } /// Return true if this is a branch instruction where the target /// address is in a register. bool isBranchToRegister() const { return isRegBranch_; } /// Return true if this is a conditional branch instruction. bool isConditionalBranch() const { return isCond_; } /// Return true if this is a bit manipulation instruction. bool isBitManipulation() const { return isBitManip_; } /// Return the data size in bytes of a load instruction. Return /// zero for a non-load instruction. unsigned loadSize() const { return ldSize_; } /// Return the data size in bytes of a store instruction. Return /// zero for a non-store instruction. unsigned storeSize() const { return stSize_; } protected: /// Mark instruction as having unsigned source operands. void setIsUnsigned(bool flag) { isUns_ = flag; } /// Set the size of load instructions. void setLoadSize(unsigned size) { ldSize_ = size; } /// Set the size of store instructions. void setStoreSize(unsigned size) { stSize_ = size; } /// Mark as a conditional branch instruction. void setConditionalBranch(bool flag) { isCond_ = flag; } /// Mark as a branch to register instruction. void setBranchToRegister(bool flag) { isRegBranch_ = flag; } private: std::string name_; InstId id_; uint32_t code_; // Code with all operand bits set to zero. uint32_t codeMask_; // Bit corresponding to code bits are 1. Bits InstType type_ = InstType::Int; uint32_t op0Mask_; uint32_t op1Mask_; uint32_t op2Mask_; uint32_t op3Mask_; OperandType op0Type_; OperandType op1Type_; OperandType op2Type_; OperandType op3Type_; OperandMode op0Mode_; OperandMode op1Mode_; OperandMode op2Mode_; OperandMode op3Mode_; unsigned opCount_; unsigned ldSize_ = 0; // Load size: Zero for non-load. unsigned stSize_ = 0; // Store size: Zero for non-store. bool isUns_ = false; // True if source operands are unsigned. bool isCond_ = false; // True if conditional branch. bool isRegBranch_ = false; // True if branch to register. bool isBitManip_ = false; // True if bit manipulation instruction. }; // Instruction table: Map an instruction id or an instruction name to // the opcode/operand information corresponding to that instruction. class InstTable { public: InstTable(); // Return the info corresponding to the given id or the info of the // illegal instruction if no such id. const InstEntry& getEntry(InstId) const; // Return the info corresponding to the given name or the info of // the illegal instruction if no such instruction. const InstEntry& getEntry(const std::string& name) const; // Return true if given id is present in the table. bool hasInfo(InstId) const; // Return true if given instance name is present in the table. bool hasInfo(const std::string& name) const; private: // Helper to the constructor. void setupInstVec(); private: std::vector<InstEntry> instVec_; std::unordered_map<std::string, InstId> instMap_; }; }
32.03003
79
0.66126
antoniocgj
f79a2f497a2a0b397b68fc0f6bcd4de8a94355c9
908
cpp
C++
src/resource_manager/resource_manager_templates.cpp
tuket/OWMAN
d1b3502c3f8e72e4442cc7b52ad32ca191ab8a11
[ "MIT" ]
6
2018-04-26T16:12:56.000Z
2021-08-06T05:20:01.000Z
src/resource_manager/resource_manager_templates.cpp
ArnCarveris/OWMAN
d1b3502c3f8e72e4442cc7b52ad32ca191ab8a11
[ "MIT" ]
13
2015-11-17T10:18:45.000Z
2018-06-08T21:02:29.000Z
src/resource_manager/resource_manager_templates.cpp
ArnCarveris/OWMAN
d1b3502c3f8e72e4442cc7b52ad32ca191ab8a11
[ "MIT" ]
2
2018-04-26T19:43:33.000Z
2019-07-03T12:27:31.000Z
#ifndef RESOURCE_MANAGER_TEMPLATES #define RESOURCE_MANAGER_TEMPLATES template <typename T> T* ResourceManager::obtainCell(std::string name) { pthread_mutex_lock(&mutexTable); unsigned int count = resourceTable.getCount( name ); pthread_mutex_unlock(&mutexTable); // not loaded if( count == 0 ) { T* resource = new T(name); pthread_mutex_lock(&mutexTable); resourceTable.addEntry(name, resource); pthread_mutex_unlock(&mutexTable); workQueue.push( ResourceRequest( ResourceRequest::Type::OBTAIN, name ) ); return resource; } // loaded else { pthread_mutex_lock(&mutexTable); resourceTable.incEntry(name); pthread_mutex_unlock(&mutexTable); pthread_mutex_lock(&mutexTable); T* res = (T*)resourceTable.getResource(name); pthread_mutex_unlock(&mutexTable); return res; } } #endif // RESOURCE_MANAGER_TEMPLATES
22.146341
75
0.703744
tuket
f79cdb988d48f847cc43589b5c61afdabbbcb357
1,399
cc
C++
algos/binary_search.cc
fcarreiro/crashingthecode
5a76be0aecfdbe4e913c2d790023c24fbabf80a1
[ "MIT" ]
1
2020-03-07T14:35:16.000Z
2020-03-07T14:35:16.000Z
algos/binary_search.cc
fcarreiro/crashingthecode
5a76be0aecfdbe4e913c2d790023c24fbabf80a1
[ "MIT" ]
null
null
null
algos/binary_search.cc
fcarreiro/crashingthecode
5a76be0aecfdbe4e913c2d790023c24fbabf80a1
[ "MIT" ]
null
null
null
#include <cmath> #include <cstddef> #include <iostream> #include <vector> #include <algorithm> #include "../test_helpers.h" template<class T, class ArrayLike> std::size_t binary_search(const T& value, const ArrayLike& v) { if(v.empty()) { return 0; } std::size_t min = 0; std::size_t max = v.size() - 1; std::size_t mid; while(min < max) { mid = (std::size_t)std::ceil((min + max + 1) / 2); if(v[mid] == value) { return mid; } else if(v[mid] < value) { min = mid + 1; } else if(v[mid] > value) { max = mid - 1; } } // min == max return (v[min] == value) ? min : v.size(); } int main(int argc, char const *argv[]) { TestHelper th; std::srand((unsigned int)std::time(0)); std::cout << "\n[[ Binary Search ]]" << std::endl << std::endl; th.message("Testing on random vectors"); for(auto i = 0; i < 500; ++i) { std::vector<int> v(std::rand() % 1000); std::generate(v.begin(), v.end(), std::rand); std::sort(v.begin(), v.end()); for(auto j = 0; j < 200; ++j) { auto n = std::rand(); auto bsindex = binary_search(n, v); auto stdbs = std::binary_search(v.begin(), v.end(), n); th.tassert(stdbs, bsindex != v.size(), "Found?", true); if(bsindex != v.size()) { th.tassert(v[bsindex], n, "Correct index", true); } } } th.tassert(); th.summary(); return 0; }
23.316667
65
0.546819
fcarreiro