hexsha
stringlengths
40
40
size
int64
22
2.4M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
260
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
260
max_issues_repo_name
stringlengths
5
109
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
260
max_forks_repo_name
stringlengths
5
109
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
22
2.4M
avg_line_length
float64
5
169k
max_line_length
int64
5
786k
alphanum_fraction
float64
0.06
0.95
matches
listlengths
1
11
13e0a849068bc5db9e06a38e14a33cfbdc9b1749
3,253
h
C
third_party/duktape/duk_internal.h
waldyrious/cosmopolitan
3e17c7b20f9c6e8695f9a12ef67e42f98cec7cca
[ "0BSD" ]
2
2021-02-13T19:26:06.000Z
2021-03-03T12:28:34.000Z
third_party/duktape/duk_internal.h
waldyrious/cosmopolitan
3e17c7b20f9c6e8695f9a12ef67e42f98cec7cca
[ "0BSD" ]
null
null
null
third_party/duktape/duk_internal.h
waldyrious/cosmopolitan
3e17c7b20f9c6e8695f9a12ef67e42f98cec7cca
[ "0BSD" ]
null
null
null
/* * Top-level include file to be used for all (internal) source files. * * Source files should not include individual header files, as they * have not been designed to be individually included. */ #if !defined(DUK_INTERNAL_H_INCLUDED) #define DUK_INTERNAL_H_INCLUDED /* * The 'duktape.h' header provides the public API, but also handles all * compiler and platform specific feature detection, Duktape feature * resolution, inclusion of system headers, etc. These have been merged * because the public API is also dependent on e.g. detecting appropriate * C types which is quite platform/compiler specific especially for a non-C99 * build. The public API is also dependent on the resolved feature set. * * Some actions taken by the merged header (such as including system headers) * are not appropriate for building a user application. The define * DUK_COMPILING_DUKTAPE allows the merged header to skip/include some * sections depending on what is being built. */ #define DUK_COMPILING_DUKTAPE #include "third_party/duktape/duktape.h" /* * Duktape includes (other than duk_features.h) * * The header files expect to be included in an order which satisfies header * dependencies correctly (the headers themselves don't include any other * includes). Forward declarations are used to break circular struct/typedef * dependencies. */ #include "third_party/duktape/duk_dblunion.h" #include "third_party/duktape/duk_fltunion.h" #include "third_party/duktape/duk_replacements.h" #include "third_party/duktape/duk_jmpbuf.h" #include "third_party/duktape/duk_exception.h" #include "third_party/duktape/duk_forwdecl.h" #include "third_party/duktape/duk_tval.h" /* builtins need e.g. duk_tval tag definitions */ #include "third_party/duktape/duk_builtins.h" /* autogenerated: strings and built-in object init data */ #include "third_party/duktape/duk_util.h" #include "third_party/duktape/duk_strings.h" #include "third_party/duktape/duk_js_bytecode.h" #include "third_party/duktape/duk_lexer.h" #include "third_party/duktape/duk_js_compiler.h" #include "third_party/duktape/duk_regexp.h" #include "third_party/duktape/duk_heaphdr.h" #include "third_party/duktape/duk_refcount.h" #include "third_party/duktape/duk_api_internal.h" #include "third_party/duktape/duk_hstring.h" #include "third_party/duktape/duk_hobject.h" #include "third_party/duktape/duk_hcompfunc.h" #include "third_party/duktape/duk_hnatfunc.h" #include "third_party/duktape/duk_hboundfunc.h" #include "third_party/duktape/duk_hbufobj.h" #include "third_party/duktape/duk_hthread.h" #include "third_party/duktape/duk_harray.h" #include "third_party/duktape/duk_henv.h" #include "third_party/duktape/duk_hbuffer.h" #include "third_party/duktape/duk_hproxy.h" #include "third_party/duktape/duk_heap.h" #include "third_party/duktape/duk_debugger.h" #include "third_party/duktape/duk_debug.h" #include "third_party/duktape/duk_error.h" #include "third_party/duktape/duk_unicode.h" #include "third_party/duktape/duk_json.h" #include "third_party/duktape/duk_js.h" #include "third_party/duktape/duk_numconv.h" #include "third_party/duktape/duk_bi_protos.h" #include "third_party/duktape/duk_selftest.h" #endif /* DUK_INTERNAL_H_INCLUDED */
41.705128
105
0.790347
[ "object" ]
13eee73497c7b6900521deb41285585160961ad6
540
h
C
src/lumberyard/chunk/model/Node.h
healingbrew/fmt_dragon
7f98860d2081c2bede3315bf114aef3f1da639a7
[ "MIT" ]
1
2021-12-09T05:41:20.000Z
2021-12-09T05:41:20.000Z
src/lumberyard/chunk/model/Node.h
healingbrew/fmt_dragon
7f98860d2081c2bede3315bf114aef3f1da639a7
[ "MIT" ]
null
null
null
src/lumberyard/chunk/model/Node.h
healingbrew/fmt_dragon
7f98860d2081c2bede3315bf114aef3f1da639a7
[ "MIT" ]
1
2021-12-09T05:41:22.000Z
2021-12-09T05:41:22.000Z
// // Created by yretenai on 6/5/2020. // #pragma once #ifndef DRAGON_LUMBERYARD_MODEL_NODE_H #define DRAGON_LUMBERYARD_MODEL_NODE_H #include "AbstractModelChunk.h" namespace dragon::lumberyard::chunk::model { class LUMBERYARD_EXPORT Node : public AbstractModelChunk { public: Node(Array<char>* buffer, CRCH_CHUNK_HEADER chunk_header); std::string Name; std::string Property; NODE_HEADER Header; }; } // namespace dragon::lumberyard::chunk::model #endif // DRAGON_LUMBERYARD_MODEL_NODE_H
22.5
66
0.72037
[ "model" ]
13f7a30265a2878b8baf35d688a690035859f59e
1,398
h
C
src/FiniteDifference.h
ColeDeanShepherd/12-Steps-To-Navier-Stokes
3bb31990457df3c31ab024a84ca521a3dfbf178d
[ "MIT" ]
45
2018-01-14T17:58:51.000Z
2022-03-16T23:47:48.000Z
src/FiniteDifference.h
anthonymorast/12-Steps-To-Navier-Stokes
c6208352d20f8849b536b6a86dce23b8cf0c5f7a
[ "MIT" ]
null
null
null
src/FiniteDifference.h
anthonymorast/12-Steps-To-Navier-Stokes
c6208352d20f8849b536b6a86dce23b8cf0c5f7a
[ "MIT" ]
8
2018-07-02T00:34:48.000Z
2021-05-12T09:33:04.000Z
#pragma once #include <vector> #include "Vector2d.h" double gradient1stOrderBackwardDiff(const std::vector<double>& f, const size_t i, const double dx); double gradient2ndOrderCentralDiff(const std::vector<double>& f, const size_t i, const double dx); Vector2d gradient1stOrderCentralDiff( const std::vector<std::vector<double>>& f, const size_t xIndex, const size_t yIndex, const double dx, const double dy ); double divergence1stOrderBackwardDiff( const std::vector<std::vector<Vector2d>>& v, const size_t xIndex, const size_t yIndex, const double dx, const double dy ); double laplacian2ndOrderCentralDiff( const std::vector<std::vector<double>>& f, const size_t xIndex, const size_t yIndex, const double dx, const double dy ); Vector2d laplacian2ndOrderCentralDiff( const std::vector<std::vector<Vector2d>>& v, const size_t xIndex, const size_t yIndex, const double dx, const double dy ); std::vector<std::vector<double>> iteratePoissonsEquation( const std::vector<std::vector<double>>& p, const std::vector<std::vector<double>>& b, const size_t numX, const size_t numY, const double dx, const double dy); std::vector<std::vector<double>> getBForIncompressibleNavierStokes( const std::vector<std::vector<Vector2d>>& v, const double rho, const size_t numX, const size_t numY, const double dx, const double dy, const double dt);
39.942857
99
0.742489
[ "vector" ]
13fbdeb195c0237982b181f955045ab66e9c96d3
1,001
h
C
Source/RT/Worlds/world.h
afritz1/C_Ray_Tracer
8f05d9ca0a46ddf049077dc6246dcd77954eddf0
[ "MIT" ]
null
null
null
Source/RT/Worlds/world.h
afritz1/C_Ray_Tracer
8f05d9ca0a46ddf049077dc6246dcd77954eddf0
[ "MIT" ]
null
null
null
Source/RT/Worlds/world.h
afritz1/C_Ray_Tracer
8f05d9ca0a46ddf049077dc6246dcd77954eddf0
[ "MIT" ]
null
null
null
#ifndef WORLD_H #define WORLD_H #include "../../c_rt01.h" #include "../Vectors/vector3.h" #define SPHERE_COUNT 4 #define PLANE_COUNT 1 #define CUBOID_COUNT 4 #define POINT_LIGHT_COUNT 0 #define DIST_LIGHT_COUNT 0 #define SPHERE_LIGHT_COUNT 1 #define WORLD_SIZE 16 #define MAX_DEPTH 6 #define LIGHT_SAMPLES 8 struct Shape; struct Light; struct Camera; typedef struct World { struct Shape *shapes; struct Light *lights; struct Camera *camera; struct Vector3 back_color; unsigned short size; unsigned char maxDepth; } World; struct Vector3 colorAt(struct World *this, float x, float y); World makeWorld(float aspect); void addPointLight(struct World *this, unsigned int i); void addDistantLight(struct World *this, unsigned int i); void addSphereLight(struct World *this, unsigned int i); void addSphere(struct World *this, unsigned int i); void addPlane(struct World *this, unsigned int i); void addCuboid(struct World *this, unsigned int i); void destructWorld(struct World *world); #endif
23.833333
61
0.776224
[ "shape" ]
cd0607fcd77a2002dee28a9f2c1d71dec1507360
490
h
C
xbed/PersonalCenter/Invoice/Model/SubmitInvoiceRequest.h
LeoChensj/Demo
03217286dcf843ac96997eed8eb82b219427f47c
[ "MIT" ]
null
null
null
xbed/PersonalCenter/Invoice/Model/SubmitInvoiceRequest.h
LeoChensj/Demo
03217286dcf843ac96997eed8eb82b219427f47c
[ "MIT" ]
null
null
null
xbed/PersonalCenter/Invoice/Model/SubmitInvoiceRequest.h
LeoChensj/Demo
03217286dcf843ac96997eed8eb82b219427f47c
[ "MIT" ]
null
null
null
// // SubmitInvoiceRequest.h // xbed // // Created by Leo.Chen on 16/10/14. // Copyright © 2016年 Leo.Chen. All rights reserved. // 开发票 #import "XbedRequest.h" #import "SubmitInvoiceRequestModel.h" #import "SubmitInvoiceRespModel.h" @interface SubmitInvoiceRequest : XbedRequest @property (nonatomic, strong)SubmitInvoiceRequestModel *requestModel; @property (nonatomic, strong)SubmitInvoiceRespModel *respModel; - (id)initWithRequestModel:(SubmitInvoiceRequestModel *)model; @end
23.333333
69
0.771429
[ "model" ]
fa5d25b3a067aab52e18357307c4768911079397
4,533
h
C
cubey/AutoXmlBase.h
byebyebryan/cubey
5f50c2250db50c293690b449626389d783bb4d4d
[ "MIT" ]
19
2018-04-27T13:32:33.000Z
2022-02-23T12:35:06.000Z
cubey/AutoXmlBase.h
byebyebryan/cubey
5f50c2250db50c293690b449626389d783bb4d4d
[ "MIT" ]
null
null
null
cubey/AutoXmlBase.h
byebyebryan/cubey
5f50c2250db50c293690b449626389d783bb4d4d
[ "MIT" ]
4
2017-04-21T15:52:31.000Z
2020-01-22T03:39:08.000Z
#pragma once #include <iostream> #include <fstream> #include <sstream> #include <unordered_map> #include <vector> #include <functional> #include <assert.h> #include "AutoXmlTypes.h" #include "TwUI.h" #ifndef AUTO_XML_VAR #define AUTO_XML_VAR(var_type, var_name, var_default) \ private: class AutoXml_##var_name { \ public: \ std::string name_; \ var_type value_; \ AutoXml_##var_name () : name_(#var_name) { \ value_ = var_default; \ AutoXmlClass::reading_funcs()[#var_name] = std::bind(&AutoXmlType<var_type>::Read, std::placeholders::_1, &value_); \ AutoXmlClass::writing_funcs().push_back(std::bind(&AutoXmlType<var_type>::Write, std::placeholders::_1, name_.c_str(), &value_)); \ } \ }; \ private: AutoXml_##var_name auto_xml_##var_name##_; \ public: var_type var_name() {return auto_xml_##var_name##_.value_;} \ public: var_type * var_name##_ptr() {return &auto_xml_##var_name##_.value_;} \ public: void set_##var_name(const var_type & value) {auto_xml_##var_name##_.value_ = value;} #endif #ifndef AUTO_XML_VAR_TW #define AUTO_XML_VAR_TW(var_type, var_name, var_default, var_tw_define) \ private: class AutoXml_##var_name { \ public: \ std::string name_; \ var_type value_; \ AutoXml_##var_name () : name_(#var_name) { \ value_ = var_default; \ AutoXmlClass::reading_funcs()[#var_name] = std::bind(&AutoXmlType<var_type>::Read, std::placeholders::_1, &value_); \ AutoXmlClass::writing_funcs().push_back(std::bind(&AutoXmlType<var_type>::Write, std::placeholders::_1, name_.c_str(), &value_)); \ AutoXmlClass::tw_adding_funcs().push_back([this](){TwUI::Get()->AddRW(name_.c_str(), AutoXmlType<var_type>::tw_type(), &value_, var_tw_define); }); \ AutoXmlClass::tw_removing_funcs().push_back([this](){TwUI::Get()->RemoveEntry(name_.c_str()); }); \ } \ }; \ private: AutoXml_##var_name auto_xml_##var_name##_; \ public: var_type var_name() {return auto_xml_##var_name##_.value_;} \ public: var_type * var_name##_ptr() {return &auto_xml_##var_name##_.value_;} \ public: void set_##var_name(const var_type & value) {auto_xml_##var_name##_.value_ = value;} #endif namespace cubey { using namespace tinyxml2; template<typename T> class AutoXmlBase { public: typedef T AutoXmlClass; //stream in from xml void ReadFromFile(const std::string & file_name) { std::ifstream fileStream(file_name); std::stringstream stringBuffer; stringBuffer << fileStream.rdbuf(); ReadFromBuffer(stringBuffer.str()); } void ReadFromBuffer(const std::string & buffer) { XMLDocument * xmlDoc = new XMLDocument(); xmlDoc->Parse(buffer.c_str()); XMLElement * xmlNode = xmlDoc->RootElement()->FirstChildElement(); while (xmlNode) { auto it = reading_funcs().find(xmlNode->Name()); if (it != reading_funcs().end()) { it->second(xmlNode); } else { std::cerr << "*** Poop: Invalid XML Entry: " << xmlNode->Name() << std::endl; assert(false); } xmlNode = xmlNode->NextSiblingElement(); } delete xmlDoc; } //stream out to xml void WriteToBuffer(std::string & buffer) { XMLDocument * xmlDoc = new XMLDocument(); XMLDeclaration * xmlDecl = xmlDoc->NewDeclaration(); xmlDoc->InsertFirstChild(xmlDecl); XMLElement * rootElement = xmlDoc->NewElement("root"); xmlDoc->InsertEndChild(rootElement); for (auto & it : writing_funcs()) { it(rootElement); } XMLPrinter xmlPrinter; xmlDoc->Print(&xmlPrinter); buffer = std::string(xmlPrinter.CStr()); } void WriteToFile(const std::string & file_name) { std::string buffer; WriteToBuffer(buffer); std::ofstream fileStream(file_name); fileStream << buffer; } void TwBarInit() { for (auto & it : tw_adding_funcs()) { it(); } } void TwBarRemove() { for (auto & it : tw_removing_funcs()) { it(); } } protected: //reading/writing function maps static std::unordered_map<std::string, std::function<void(XMLElement *)>> & reading_funcs() { static std::unordered_map<std::string, std::function<void(XMLElement *)>> funcs; return funcs; }; static std::vector<std::function<void(XMLElement *)>> & writing_funcs() { static std::vector<std::function<void(XMLElement *)>> funcs; return funcs; } static std::vector<std::function<void()>> & tw_adding_funcs() { static std::vector<std::function<void()>> funcs; return funcs; } static std::vector<std::function<void()>> & tw_removing_funcs() { static std::vector<std::function<void()>> funcs; return funcs; } }; }
31.479167
152
0.679903
[ "vector" ]
faa9cab302608a41b9b641caab1f34537a3e0825
727
h
C
src/stockKlineView/kvolumegrid.h
SuperEndermanSM/stockball
7f3a0f4ae26cf3c387efd223bc7dd3a470113871
[ "MIT" ]
10
2021-08-19T23:09:52.000Z
2022-03-25T09:20:32.000Z
src/stockKlineView/kvolumegrid.h
SuperEndermanSM/stockball
7f3a0f4ae26cf3c387efd223bc7dd3a470113871
[ "MIT" ]
1
2021-04-08T03:53:04.000Z
2021-04-08T03:53:54.000Z
src/stockKlineView/kvolumegrid.h
SuperEndermanSM/stockball
7f3a0f4ae26cf3c387efd223bc7dd3a470113871
[ "MIT" ]
3
2021-08-19T23:09:59.000Z
2022-03-11T06:49:28.000Z
#ifndef KVOLUMEGRID_H #define KVOLUMEGRID_H #include "autogrid.h" #include "datafile.h" #include <QPoint> class kVolumeGrid : public AutoGrid { public: explicit kVolumeGrid(QWidget* parent); bool readData(QString strFile); void initial(); void drawYtick(); void drawVolume(); void virtual paintEvent(QPaintEvent* event); void getIndicator(); void drawAverageLine(int day); bool readData(std::vector<KLine> datas); private: DataFile mDataFile; //画成交量线的起始日期和终止日期 int beginDay; int endDay; int totalDay; int currentDay; //当前要画的成交量线中的最大成交量 double maxVolume; //鼠标位置 QPoint mousePoint; //线宽 int lineWidth; }; #endif // KVOLUMEGRID_H
14.836735
48
0.674003
[ "vector" ]
faa9f2b792e3c7dd72195e6158e8cba0acc90446
3,203
h
C
graphics-origin/geometry/detail/bvh_customization_points.h
tdelame/Graphics-Origin
27b7d6ac72c4cb1858fc85dc18fe864de1496c6d
[ "MIT" ]
null
null
null
graphics-origin/geometry/detail/bvh_customization_points.h
tdelame/Graphics-Origin
27b7d6ac72c4cb1858fc85dc18fe864de1496c6d
[ "MIT" ]
null
null
null
graphics-origin/geometry/detail/bvh_customization_points.h
tdelame/Graphics-Origin
27b7d6ac72c4cb1858fc85dc18fe864de1496c6d
[ "MIT" ]
null
null
null
# include "../box.h" # include "../ball.h" # include "../triangle.h" namespace graphics_origin { namespace geometry { template<> struct bounding_volume_computer< aabox, triangle > { static void compute( const triangle& element, aabox& volume ) { vec3 lower = min( min( element.get_vertex(triangle::V0), element.get_vertex(triangle::V1) ), element.get_vertex(triangle::V2) ); vec3 upper = max( max( element.get_vertex(triangle::V0), element.get_vertex(triangle::V1) ), element.get_vertex(triangle::V2) ); volume.center = real(0.5) * (lower + upper); volume.hsides = upper - volume.center; } }; template<> struct bounding_volume_computer< aabox, ball > { static void compute( const ball& element, aabox& volume ) { volume.center = vec3{element}; volume.hsides.x = element.w; volume.hsides.y = element.w; volume.hsides.z = element.w; } }; template<> struct bounding_volume_computer< ball, ball > { static void compute( const ball& element, ball& volume ) { volume = element; } }; template<> struct bounding_volume_analyzer<aabox> { static vec3 compute_lower_corner( const aabox& volume ) { return volume.get_min(); } static vec3 compute_upper_corner( const aabox& volume ) { return volume.get_max(); } static vec3 compute_center( const aabox& volume ) { return volume.center; } }; template<> struct bounding_volume_analyzer<ball> { static vec3 compute_lower_corner( const ball& volume ) { return vec3{volume} - volume.w; } static vec3 compute_upper_corner( const ball& volume ) { return vec3{volume} + volume.w; } static vec3 compute_center( const ball& volume ) { return vec3{volume}; } }; template<> struct bounding_volume_merger<ball> { static ball merge( const ball& a, const ball& b ) { /** We need to handle the cases where one of the ball is included into * the other one. To do so, let us first consider the case where there * are no inclusion. In such case, the longest line to include inside * the result is of length D = d + b.w + a.w, * with d = distance( vec3(a), vec3(b) ). * The minimal inclusive ball is then of radii 0.5D and the center * is located at vec3(a) + 0.5D - a.w. * * Now, let's deal with inclusions. * a is included inside b iff d + a.w < b.w <=> D < 2 b.w <=> 0.5D < b.w * b is included inside b iff d + b.w < a.w <=> D < 2 a.w <=> 0.5D < a.w * * Thus, in any case, we can start to compute the value 0.5D = radius. */ real radius = a.w + b.w + distance(vec3(a), vec3(b)); if( radius < a.w ) return a; else if ( radius < b.w ) return b; return ball{ vec3(a) + radius - a.w, radius }; } }; template<> struct bounding_volume_merger<aabox> { static aabox merge( const aabox& a, const aabox& b ) { return aabox{ min( a.get_min(), b.get_min() ), max( a.get_max(), b.get_max() ) }; } }; }}
25.023438
84
0.591633
[ "geometry" ]
fac075acd736708a7d6612cc4e1f2cf4813c99bd
2,196
h
C
JianzhiOffer/BitOperation.h
antFaiz5z/Sword2Offer
600fd70d578cdec0b7ebd88e496667772ebb50af
[ "Apache-2.0" ]
1
2018-12-14T08:45:19.000Z
2018-12-14T08:45:19.000Z
JianzhiOffer/BitOperation.h
antFaiz5z/Sword2Offer
600fd70d578cdec0b7ebd88e496667772ebb50af
[ "Apache-2.0" ]
null
null
null
JianzhiOffer/BitOperation.h
antFaiz5z/Sword2Offer
600fd70d578cdec0b7ebd88e496667772ebb50af
[ "Apache-2.0" ]
null
null
null
// // Created by faiz on 18-10-31. // #ifndef JIANZHIOFFER_BIT_OPERATION_H #define JIANZHIOFFER_BIT_OPERATION_H #include <iostream> #include <vector> using namespace std; class Bit_Operation { public: static Bit_Operation* get_instance() { static Bit_Operation* instance; if(instance == nullptr){ instance = new Bit_Operation(); } return instance; } /* * 15. 二进制中 1 的个数 * 输入一个整数,输出该数二进制表示中 1 的个数。 */ //n&(n-1) //该位运算去除 n 的位级表示中最低的那一位。 int bit1count(int n); static void local_main_bit1count(); /* * 65. 不用加减乘除做加法 * 写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。 */ int add(int num1, int num2); static void local_main_add(); /* * 56. 数组中只出现一次的数字 * 一个整型数组里除了两个数字之外,其他的数字都出现了偶数次。请写程序找出这两个只出现一次的数字。 * * 思路: * 这个题目的突破口在哪里?题目为什么要强调有一个数字出现一次,其他的出现两次? * 我们想到了异或运算的性质:任何一个数字异或它自己都等于0 。也就是说, * 如果我们从头到尾依次异或数组中的每一个数字,那么最终的结果刚好是那个只出现一次的数字, * 因为那些出现两次的数字全部在异或中抵消掉了。 * 有了上面简单问题的解决方案之后,我们回到原始的问题。如果能够把原数组分为两个子数组。 * 在每个子数组中,包含一个只出现一次的数字,而其它数字都出现两次。如果能够这样拆分原数组, * 按照前面的办法就是分别求出这两个只出现一次的数字了。 * 我们还是从头到尾依次异或数组中的每一个数字,那么最终得到的结果就是两个只出现一次的数字的异或结果。 * 因为其它数字都出现了两次,在异或中全部抵消掉了。由于这两个数字肯定不一样, * 那么这个异或结果肯定不为0 ,也就是说在这个结果数字的二进制表示中至少就有一位为1 。 * 我们在结果数字中找到第一个为1 的位的位置,记为第N 位。 * 现在我们以第N 位是不是1 为标准把原数组中的数字分成两个子数组, * 第一个子数组中每个数字的第N 位都为1 ,而第二个子数组的每个数字的第N 位都为0 。 * 现在我们已经把原数组分成了两个子数组,每个子数组都包含一个只出现一次的数字,而其它数字都出现了两次。 * 因此到此为止,所有的问题我们都已经解决 * * 两个不相等的元素在位级表示上必定会有一位存在不同, * 将数组的所有元素异或得到的结果为不存在重复的两个元素异或的结果。 * diff &= -diff 得到出 diff 最右侧不为 0 的位, * 也就是不存在重复的两个元素在位级表示上最右侧不同的那一位,利用这一位就可以将两个元素区分开来。 */ void find_nums_appear_once(vector<int> data, int *num1, int *num2); static void local_main_find_nums_appear_once(); /* a * b可以这样算 * 原理就是,类似快速幂,俗称快速模乘。 * * res = 0 * while(a){ * if(a & 1) res += b; * a >>= 1; * b <<= 1; * } */ private: Bit_Operation() = default; ~Bit_Operation() = default; Bit_Operation(const Bit_Operation&); Bit_Operation& operator=(const Bit_Operation&); }; #endif //JIANZHIOFFER_BIT_OPERATION_H
23.361702
71
0.652095
[ "vector" ]
fad0c6d50e6d4de7fda75ce32ec5a2c6afa6d94b
1,395
c
C
list.c
sirrahd/blasteroids
41629201e2f7797d554729bcbe734107eb4eae6a
[ "MIT" ]
null
null
null
list.c
sirrahd/blasteroids
41629201e2f7797d554729bcbe734107eb4eae6a
[ "MIT" ]
null
null
null
list.c
sirrahd/blasteroids
41629201e2f7797d554729bcbe734107eb4eae6a
[ "MIT" ]
null
null
null
#include <stdlib.h> #include <stdio.h> #include "list.h" // Adds an object to the beginning of the list void list_add(List* list, void* object) { Item* item = malloc(sizeof(Item)); item->object = object; item->next = list->start; if(!list->start) { list->current = item; } list->start = item; } // Removes an object from the list. void list_remove(List* list, void* object) { Item* item = NULL; Item* prevItem = NULL; for(item = list->start; item->object != object && item != NULL; item = item->next) { prevItem = item; } if(!item) { fprintf(stderr, "Tried to remove item that doesn't exist from list\n"); exit(1); } if(prevItem) { prevItem->next = item->next; } else { list->start = item->next; } free(item); } // Returns the next object in the list, or NULL if end of list reached. void* list_next(List* list) { void* object = NULL; if(list->current) { object = list->current->object; list->current = list->current->next; } else { list->current = list->start; object = NULL; } return object; } // Instantiates and returns new list List* list_new() { List* list = malloc(sizeof(List)); list->start = NULL; list->current = NULL; return list; } // Deletes list completely void list_delete(List* list) { if(list->start) { fprintf(stderr, "Attempted list delete before list items were removed\n"); exit(1); } free(list); }
19.109589
85
0.645878
[ "object" ]
fad3b12f4e43d72264b2183dff268245f771113e
740
h
C
src/C++/crypto++/crypto++-5.0/tiger.h
GaloisInc/hacrypto
5c99d7ac73360e9b05452ac9380c1c7dc6784849
[ "BSD-3-Clause" ]
34
2015-02-04T18:03:14.000Z
2020-11-10T06:45:28.000Z
src/C++/crypto++/crypto++-5.0/tiger.h
GaloisInc/hacrypto
5c99d7ac73360e9b05452ac9380c1c7dc6784849
[ "BSD-3-Clause" ]
5
2015-06-30T21:17:00.000Z
2016-06-14T22:31:51.000Z
src/C++/crypto++/crypto++-5.0/tiger.h
GaloisInc/hacrypto
5c99d7ac73360e9b05452ac9380c1c7dc6784849
[ "BSD-3-Clause" ]
15
2015-10-29T14:21:58.000Z
2022-01-19T07:33:14.000Z
#ifndef CRYPTOPP_TIGER_H #define CRYPTOPP_TIGER_H #include "config.h" #ifdef WORD64_AVAILABLE #include "iterhash.h" NAMESPACE_BEGIN(CryptoPP) /// <a href="http://www.weidai.com/scan-mirror/md.html#Tiger">Tiger</a> class Tiger : public IteratedHashWithStaticTransform<word64, LittleEndian, 64, Tiger> { public: enum {DIGESTSIZE = 24}; Tiger() : IteratedHashWithStaticTransform<word64, LittleEndian, 64, Tiger>(DIGESTSIZE) {Init();} static void Transform(word64 *digest, const word64 *data); void TruncatedFinal(byte *hash, unsigned int size); static const char * StaticAlgorithmName() {return "Tiger";} protected: void Init(); static const word64 table[4*256]; }; NAMESPACE_END #endif #endif
22.424242
98
0.72027
[ "transform" ]
fae276af62e03e0b570f8509f764d64fff5da95d
1,258
h
C
tools.h
whoo/rpi-rgb-led-matrix
8a400dd34ec6af5dd30a6540dced3d9f40511b03
[ "BSD-Source-Code" ]
null
null
null
tools.h
whoo/rpi-rgb-led-matrix
8a400dd34ec6af5dd30a6540dced3d9f40511b03
[ "BSD-Source-Code" ]
null
null
null
tools.h
whoo/rpi-rgb-led-matrix
8a400dd34ec6af5dd30a6540dced3d9f40511b03
[ "BSD-Source-Code" ]
null
null
null
#ifndef TOOLS_H #define TOOLS_H #include "thread.h" #include "led-matrix.h" #include <string.h> #include <dirent.h> #include <string> #include <vector> #include <iostream> #define CLEARSCR for (int xe = 0; xe < width; ++xe) for (int ye = 0; ye < height; ++ye) { matrix_->SetPixel(xe,ye, 0,0,0); } class RGBMatrixManipulator : public Thread { public: RGBMatrixManipulator(RGBMatrix *m) : running_(true), matrix_(m) {} virtual ~RGBMatrixManipulator() { running_ = false; } protected: volatile bool running_; // TODO: use mutex, but this is good enough for now. RGBMatrix *const matrix_; }; struct Pixel { uint8_t red; uint8_t green; uint8_t blue; }; void putTxt(RGBMatrix *,int,int,std::string,Pixel); bool *prinTxt(std::string); Pixel *LoadPPM(std::string); char *ReadLine(FILE *, char *, size_t ) ; std::string randomfile(); class ImgPPM { public: ImgPPM(std::string); ~ImgPPM() { delete image;} int width; int height; Pixel *image; }; class DisplayUpdater : public RGBMatrixManipulator { public: DisplayUpdater(RGBMatrix *m) : RGBMatrixManipulator(m) {} void Run() { while (running_) { matrix_->UpdateScreen(); } } }; #endif
22.070175
131
0.63911
[ "vector" ]
fae73413c8c2b23201534121d892a99b88e7f92f
4,845
c
C
www.c
mzucker/st_glfw
a82c8bbc38df3698da50c66cb5d79ff54fc350d6
[ "MIT" ]
4
2018-04-11T21:00:24.000Z
2020-05-31T06:32:50.000Z
www.c
mzucker/st_glfw
a82c8bbc38df3698da50c66cb5d79ff54fc350d6
[ "MIT" ]
1
2020-02-28T17:25:28.000Z
2020-02-28T17:32:24.000Z
www.c
mzucker/st_glfw
a82c8bbc38df3698da50c66cb5d79ff54fc350d6
[ "MIT" ]
null
null
null
#include "www.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef ST_GLFW_USE_CURL #include <curl/curl.h> #endif size_t write_response(void *ptr, size_t size, size_t nmemb, void * b) { buffer_t* buf = (buffer_t*)b; buf_append_mem(buf, ptr, size*nmemb, BUF_RAW_APPEND); return size * nmemb; } ////////////////////////////////////////////////////////////////////// void fetch_url(const char* url, buffer_t* buf) { #ifndef ST_GLFW_USE_CURL fprintf(stderr, "not compiled with curl support, can't fetching URL!"); exit(1); #else curl_global_init(CURL_GLOBAL_ALL); CURL* curl = curl_easy_init(); if (!curl) { fprintf(stderr, "error initting curl!\n"); exit(1); } curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_response); curl_easy_setopt(curl, CURLOPT_WRITEDATA, buf); printf("fetching %s...\n", url); int status = curl_easy_perform(curl); if (status != 0) { fprintf(stderr, "curl error %s\n", curl_easy_strerror(status)); exit(1); } long code; curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); if (code != 200) { fprintf(stderr, "server responded with code %ld\n", code); exit(1); } printf(" ...retrieved data of length %d\n", (int)buf->size); #endif } ////////////////////////////////////////////////////////////////////// json_t* jsobject(const json_t* object, const char* key, int type) { json_t* j = json_object_get(object, key); if (!j) { fprintf(stderr, "JSON error: JSON key not found: %s\n", key); exit(1); } if (json_typeof(j) != type) { fprintf(stderr, "JSON error: incorrect type for %s in JSON\n", key); exit(1); } return j; } ////////////////////////////////////////////////////////////////////// const char* jsobject_string(const json_t* object, const char* key) { json_t* j = jsobject(object, key, JSON_STRING); return json_string_value(j); } ////////////////////////////////////////////////////////////////////// json_t* jsobject_first(const json_t* object, const char** keys, int type, int* idx) { for (int i=0; keys[i]; ++i) { json_t* j = json_object_get(object, keys[i]); if (!j) { continue; } if (json_typeof(j) != type) { fprintf(stderr, "JSON error: incorrect type for %s in JSON\n", keys[i]); exit(1); } if (idx) { *idx = i; } return j; } fprintf(stderr, "JSON error: none of the keys ("); for (int i=0; keys[i]; ++i) { if (i) { fprintf(stderr, ", "); } fprintf(stderr, "%s", keys[i]); } fprintf(stderr, ") was found\n"); exit(1); } ////////////////////////////////////////////////////////////////////// const char* jsobject_first_string(const json_t* object, const char** keys, int* idx) { json_t* j = jsobject_first(object, keys, JSON_STRING, idx); return json_string_value(j); } ////////////////////////////////////////////////////////////////////// int jsobject_integer(const json_t* object, const char* key) { json_t* j = jsobject(object, key, JSON_INTEGER); return json_integer_value(j); } ////////////////////////////////////////////////////////////////////// json_t* jsarray(const json_t* array, int idx, int type) { json_t* j = json_array_get(array, idx); if (!j) { fprintf(stderr, "JSON error: array item %d not found in JSON\n", idx); exit(1); } if (json_typeof(j) != type) { fprintf(stderr, "JSON error: incorrect type for array item %d in JSON\n", idx); exit(1); } return j; } ////////////////////////////////////////////////////////////////////// json_t* jsparse(const buffer_t* buf) { json_error_t error; const char* data = buf->data; size_t size = buf->size; // check for UTF-8 BOM :( if (size > 3 && memcmp("\xef\xbb\xbf", data, 3) == 0) { fprintf(stderr, "JSON has utf-8 BOM!\n"); size -= 3; data += 3; } json_t* json_root = json_loadb(data, size, 0, &error); if (!json_root) { fprintf(stderr, "JSON error: on line %d: %s\n", error.line, error.text); exit(1); } if (!json_is_object(json_root)) { fprintf(stderr, "JSON error: expected JSON root to be object!\n"); exit(1); } return json_root; }
23.071429
87
0.484417
[ "object" ]
faedc7691feaade9de55e810da825e906ec575da
15,710
h
C
examples/FGM/ip_design/src/FPGAclientAPI.h
harshshukla7/LAfF
ab2b2d06816788b2a64973298efbdc4a7f279c0b
[ "BSD-3-Clause" ]
3
2017-12-19T17:09:57.000Z
2018-01-17T19:49:00.000Z
examples/FGM/ip_design/src/FPGAclientAPI.h
harshshukla7/LAfF
ab2b2d06816788b2a64973298efbdc4a7f279c0b
[ "BSD-3-Clause" ]
null
null
null
examples/FGM/ip_design/src/FPGAclientAPI.h
harshshukla7/LAfF
ab2b2d06816788b2a64973298efbdc4a7f279c0b
[ "BSD-3-Clause" ]
1
2018-12-21T14:24:04.000Z
2018-12-21T14:24:04.000Z
/* * icl::protoip * Author: asuardi <https://github.com/asuardi> * Date: November - 2014 */ #include<stdio.h> #include<stdlib.h> #ifdef _WIN32 #include<winsock2.h> #include<time.h> #pragma comment(lib,"ws2_32.lib") #else #include<sys/socket.h> #include<arpa/inet.h> #include<netinet/in.h> #include<netdb.h> #include<sys/select.h> #include<sys/time.h> #include<unistd.h> #endif #include<stdint.h> #include<string.h> #include<fcntl.h> #include <math.h> #include "mex.h" //////////////////////////////////////////////////////////// //Input vectors size: #define LAFF_IN_IN_LENGTH 10 //Output vectors size: #define LAFF_OUT_OUT_LENGTH 10 //////////////////////////////////////////////////////////// //Test configuration: #define TYPE_TEST 0 //////////////////////////////////////////////////////////// //Ethernet interface configuration: #define TYPE_ETH 0 //1 for TCP, 0 for UDP #define FPGA_IP "192.168.1.10" //FPGA IP #define FPGA_NM "255.255.255.0" //Netmask #define FPGA_GW "192.168.1.1" //Gateway #define FPGA_PORT 2007 /////////////////////////////////////////////////////////////// //FPGA interface data specification: #define ETH_PACKET_LENGTH 256+2 //Ethernet packet length in double words (32 bits) (from Matlab to FPGA) #define ETH_PACKET_LENGTH_RECV 64+2 //Ethernet packet length in double words (32 bits) (from FPGA to Matlab) /////////////////////////////////////////////////////////////// int FPGAclient(double input_data[], unsigned packet_input_size, unsigned Packet_type, unsigned packet_internal_ID, unsigned packet_output_size, double output_data[], double *FPGA_time) { double input_data_eth[ETH_PACKET_LENGTH]; double output_data_eth[ETH_PACKET_LENGTH_RECV]; double packet_internal_ID_offset; int float_fix; int fraction_length; unsigned FPGA_port_number; unsigned FPGA_link; char *FPGA_ip_address; unsigned i; unsigned j; int flag=0; int count_send; double flag_IP_running; //FPGA IP address FPGA_ip_address = FPGA_IP; //FPGA port FPGA_port_number=FPGA_PORT; //FPGA link FPGA_link=TYPE_ETH; packet_internal_ID_offset=0; #if (TYPE_TEST==0) //IP design build, IP prototype if (Packet_type==4) //data read { //read the output vector in chunks of ETH_PACKET_LENGTH_RECV-2 elements for (i=0; i<packet_output_size; i=i+ETH_PACKET_LENGTH_RECV-2) // for (i=0; i<1; i++) { //fill in the vector buffer to be sent to Ethernet //vector label input_data_eth[ETH_PACKET_LENGTH-2]=(double)pow(2,16)*packet_internal_ID+Packet_type; input_data_eth[ETH_PACKET_LENGTH-1]=packet_internal_ID_offset; // main call if (FPGA_link==1) //TCP interface { do { flag=TCPclient_wrap(FPGA_ip_address,FPGA_port_number,input_data_eth,Packet_type,output_data_eth,float_fix,fraction_length); }while(flag); } else { do { flag=UDPclient_wrap(FPGA_ip_address,FPGA_port_number,input_data_eth,Packet_type,output_data_eth,float_fix,fraction_length); }while(flag); } *FPGA_time=output_data_eth[ETH_PACKET_LENGTH_RECV-1]; // assemble the read chucks into the output vector for (j=0; ((j<ETH_PACKET_LENGTH_RECV-2) && (packet_internal_ID_offset*(ETH_PACKET_LENGTH_RECV-2)+j<packet_output_size)); j++) { output_data[(unsigned)packet_internal_ID_offset*(ETH_PACKET_LENGTH_RECV-2)+j]=output_data_eth[j]; } packet_internal_ID_offset++; } } else { count_send=0; //split the input vector in chunks of ETH_PACKET_LENGTH-2 elements for (i=0; i<packet_input_size; i=i+ETH_PACKET_LENGTH-2) { //fill in the vector buffer to be sent to Ethernet //vector data for (j=0; (j<(ETH_PACKET_LENGTH-2) && (packet_internal_ID_offset*(ETH_PACKET_LENGTH-2)+j<packet_input_size)); j++) { input_data_eth[j]=input_data[(unsigned)packet_internal_ID_offset*(ETH_PACKET_LENGTH-2)+j]; } //vector label input_data_eth[ETH_PACKET_LENGTH-2]=(double)pow(2,16)*packet_internal_ID+Packet_type; input_data_eth[ETH_PACKET_LENGTH-1]=packet_internal_ID_offset; // main call if (FPGA_link==1) //TCP interface { do { flag=TCPclient_wrap(FPGA_ip_address,FPGA_port_number,input_data_eth,Packet_type,output_data_eth,float_fix,fraction_length); }while(flag); } else { do { flag=UDPclient_wrap(FPGA_ip_address,FPGA_port_number,input_data_eth,Packet_type,output_data_eth,float_fix,fraction_length); }while(flag); } packet_internal_ID_offset++; } } #else // IP design test switch (Packet_type) { case 2: start_simulation(); break; case 3: write_stimuli(input_data, packet_internal_ID); break; case 4: read_results(output_data, packet_internal_ID, packet_output_size); break; default: break; } #endif } int UDPclient_wrap(char ip_address[], unsigned port_number, double din[ETH_PACKET_LENGTH], unsigned Packet_type, double dout[ETH_PACKET_LENGTH_RECV], int float_fix, int fraction_length) { int socket_handle; // Handle for the socket int connect_id; // Connection ID struct sockaddr_in server_address; // Server address struct sockaddr_in client_address; // client address int saddr_len = sizeof(server_address); // Server address length int caddr_len = sizeof(client_address); // Client address length struct hostent *server; // Server host entity struct hostent *client; // Client host entity int n; // Iterator int k; // Iterator int i; struct timeval tv; // Select timeout structure fd_set Reader; // Struct for select function int err; // Error flag for return data int ss; // Return from select function int timeout; //timeout [s] char host_name[256]; // Host name of this computer int32_t tmp_databuffer; float databuffer_float[ETH_PACKET_LENGTH]; // Buffer for outgoing data float incoming_float[ETH_PACKET_LENGTH_RECV]; // Buffer for return data #ifdef _WIN32 WSADATA wsaData; #endif int tmp_time; // Platform specific variables for timing #ifdef _WIN32 LARGE_INTEGER t1; LARGE_INTEGER t2; LARGE_INTEGER freq; #else struct timeval t1; // For timing call length struct timeval t2; // For timing call length #endif #ifdef _WIN32 int iResult; // Open windows connection iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("Could not open Windows connection. WSAStartup failed: %d\n", iResult); return 1; } #endif server = gethostbyname(ip_address); port_number = port_number; timeout=20; //timeout in seconds: 1 day if (server == NULL) { fprintf(stderr,"ERROR, no such host1\n"); #ifdef _WIN32 WSACleanup(); #endif return 1; } // Open a datagram socket. socket_handle = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (socket_handle == 0xFFFF){ printf("Could not create socket.\n"); #ifdef _WIN32 WSACleanup(); #endif return 1; } // Clear out server struct memset( (void *) &server_address, 0, sizeof(server_address)); //Set family and port server_address.sin_family = AF_INET; server_address.sin_port = htons(port_number); //Set server address memcpy((char *)&server_address.sin_addr.s_addr, (char *)server->h_addr, server->h_length); #ifdef _WIN32 QueryPerformanceCounter(&t1); #else gettimeofday(&t1, NULL); #endif // Set timeout values tv.tv_sec = timeout; tv.tv_usec = 0; // Set FDS u/p FD_ZERO(&Reader); FD_SET(socket_handle, &Reader); // Input data cast to float for ( i = 0; i < ETH_PACKET_LENGTH; i++) databuffer_float[i]=(float)din[i]; // Send data to FPGA err = sendto(socket_handle, (void *)databuffer_float, sizeof(databuffer_float), 0,(struct sockaddr *)&server_address, saddr_len); if (!err){ printf("Error transmitting data.\n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } // --------read from DDR-------- if (1) { ss = select(socket_handle+1, &Reader, NULL, NULL, &tv); if (ss) { // receive data from FPGA err = recvfrom(socket_handle, (void *)incoming_float, sizeof(incoming_float), 0,NULL,NULL); if (err < 0) {printf("Error receiving data.\n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } else { //Output data cast to double for ( i = 0; i < ETH_PACKET_LENGTH_RECV; i++) dout[i] = (double)incoming_float[i]; } } else { printf("Time out \n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } } #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 0; } int TCPclient_wrap(char ip_address[], unsigned port_number,double din[ETH_PACKET_LENGTH],unsigned Packet_type, double dout[ETH_PACKET_LENGTH_RECV], int float_fix, int fraction_length) { int socket_handle; // Handle for the socket int connect_id; // Connection ID struct sockaddr_in server_address; // Server address struct sockaddr_in client_address; // client address int saddr_len = sizeof(server_address); // Server address length int caddr_len = sizeof(client_address); // Client address length struct hostent *server; // Server host entity struct hostent *client; // Client host entity int n; // Iterator int k; // Iterator int i; struct timeval tv; // Select timeout structure fd_set Reader; // Struct for select function int err; // Error flag for return data int ss; // Return from select function int timeout; //timeout [s] char host_name[256]; // Host name of this computer int tmp_time; int32_t tmp_databuffer; float databuffer_float[ETH_PACKET_LENGTH]; // Buffer for outgoing data float incoming_float[ETH_PACKET_LENGTH_RECV]; // Buffer for return data #ifdef _WIN32 WSADATA wsaData; #endif // Platform specific variables for timing #ifdef _WIN32 LARGE_INTEGER t1; LARGE_INTEGER t2; LARGE_INTEGER freq; #else struct timeval t1; // For timing call length struct timeval t2; // For timing call length #endif #ifdef _WIN32 int iResult; // Open windows connection iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("Could not open Windows connection. WSAStartup failed: %d\n", iResult); return 1; } #endif server = gethostbyname(ip_address); port_number = port_number; timeout=20; //timeout in seconds: 1 day if (server == NULL) { fprintf(stderr,"ERROR, no such host1\n"); #ifdef _WIN32 WSACleanup(); #endif return 1; } // Open a datagram socket. socket_handle = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (socket_handle == 0xFFFF){ printf("Could not create socket.\n"); #ifdef _WIN32 WSACleanup(); #endif return 1; } // Clear out server struct memset( (void *) &server_address, 0, sizeof(server_address)); //Set family and port server_address.sin_family = AF_INET; server_address.sin_port = htons(port_number); //Set server address memcpy((char *)&server_address.sin_addr.s_addr, (char *)server->h_addr, server->h_length); // Connect to the server if (connect(socket_handle, (struct sockaddr *)&server_address, sizeof(struct sockaddr_in))) { fprintf(stderr, "Cannot bind address to socket.\n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } #ifdef _WIN32 QueryPerformanceCounter(&t1); #else gettimeofday(&t1, NULL); #endif // Set timeout values tv.tv_sec = timeout; tv.tv_usec = 0; // Set FDS u/p FD_ZERO(&Reader); FD_SET(socket_handle, &Reader); // Input data cast to float for ( i = 0; i < ETH_PACKET_LENGTH; i++) { databuffer_float[i]=(float)din[i]; } // Send data to FPGA err = send(socket_handle, (void *)databuffer_float, sizeof(databuffer_float), 0); if (!err){ printf("Error transmitting data.\n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } // --------read from DDR-------- if (1) { ss = select(socket_handle+1, &Reader, NULL, NULL, &tv); if (ss) { // receive data from FPGA err = recv(socket_handle, (void *)incoming_float, sizeof(incoming_float), 0); if (err < 0) {printf("Error receiving data.\n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } else { //Output data cast to double for ( i = 0; i < ETH_PACKET_LENGTH_RECV; i++) dout[i] = (double)incoming_float[i]; } } else { printf("Time out \n"); #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 1; } } #ifdef _WIN32 closesocket(socket_handle); WSACleanup(); #else close(socket_handle); #endif return 0; } int write_stimuli(double input_data[], unsigned packet_internal_ID) { FILE * pFile; int i; switch (packet_internal_ID) { case 0: //laff_in_in // store laff_in_in into ../../ip_design/test/stimuli/laff_project/laff_in_in.dat pFile = fopen ("../../ip_design/test/stimuli/laff_project/laff_in_in.dat","w+"); for (i = 0; i < LAFF_IN_IN_LENGTH; i++) { fprintf(pFile,"%2.18f \n",input_data[i]); } fprintf(pFile,"\n"); fclose (pFile); default: break; } } int start_simulation() { system("vivado_hls -f ../../.metadata/laff_project_ip_design_test.tcl"); } int read_results(double output_data[], unsigned packet_internal_ID, unsigned packet_output_size) { FILE * pFile; int i; double output_data_tmp; switch (packet_internal_ID) { case 0: //laff_out_in // load ../../ip_design/test/results/laff_project/laff_out_out.dat pFile = fopen ("../../ip_design/test/results/laff_project/laff_out_out.dat","r"); for (i = 0; i < packet_output_size; i++) { fscanf(pFile,"%lf",&output_data_tmp); output_data[i]=output_data_tmp; } fclose (pFile); default: break; } }
23.948171
185
0.608657
[ "vector" ]
780072242f0b0e782dfea1ab2ff7adacfd344446
9,345
c
C
test/app_test/mt_listener.c
dkkwon/ric-plt-lib-rmr
d324fe4bfea9daa22aa16c605bd3157a875a8ccd
[ "Apache-2.0", "CC-BY-4.0" ]
null
null
null
test/app_test/mt_listener.c
dkkwon/ric-plt-lib-rmr
d324fe4bfea9daa22aa16c605bd3157a875a8ccd
[ "Apache-2.0", "CC-BY-4.0" ]
null
null
null
test/app_test/mt_listener.c
dkkwon/ric-plt-lib-rmr
d324fe4bfea9daa22aa16c605bd3157a875a8ccd
[ "Apache-2.0", "CC-BY-4.0" ]
3
2020-09-29T09:57:06.000Z
2022-03-21T10:18:43.000Z
// :vim ts=4 sw=4 noet: /* ================================================================================== Copyright (c) 2019 Nokia Copyright (c) 2018-2019 AT&T Intellectual Property. 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. ================================================================================== */ /* Mnemonic: mt_listener.c Abstract: This simple application runs multiple "listener" threads. Each thread receives from a single RMR context to validate the ability spin several listening threads in an application. Message format is: ck1 ck2|<msg-txt> @ tid<nil> Ck1 is the simple check sum of the msg-text (NOT includeing <nil>) Ck2 is the simple check sum of the trace data which is a nil terminated series of bytes. tid is the thread id assigned by the main thread. Parms: argv[1] == number of msgs to send (10) argv[2] == delay (mu-seconds, 1000000 default) argv[3] == number of threads (3) argv[4] == listen port Sender will send for at most 20 seconds, so if nmsgs and delay extend beyond that period the total number of messages sent will be less than n. Date: 18 April 2019 Author: E. Scott Daniels */ #include <unistd.h> #include <errno.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/epoll.h> #include <time.h> #include <pthread.h> #include <rmr/rmr.h> #include "time_tools.c" // our time based test tools #define TRACE_SIZE 40 // bytes in header to provide for trace junk #define WBUF_SIZE 2048 /* Thread data */ typedef struct tdata { int id; // the id we'll pass to RMr mt-call function NOT the thread id int n2get; // number of messages to expect int delay; // max delay waiting for n2get messages void* mrc; // RMr context int state; } tdata_t; // -------------------------------------------------------------------------------- static int sum( char* str ) { int sum = 0; int i = 0; while( *str ) { sum += *(str++) + i++; } return sum % 255; } /* Split the message at the first sep and return a pointer to the first character after. */ static char* split( char* str, char sep ) { char* s; s = strchr( str, sep ); if( s ) { return s+1; } //fprintf( stderr, "<RCVR> no pipe in message: (%s)\n", str ); return NULL; } /* Executed as a thread, this puppy will listen for messages and report what it receives. */ static void* mk_calls( void* data ) { tdata_t* control; rmr_mbuf_t* msg = NULL; // message int* count_bins = NULL; char* wbuf = NULL; char buf2[128]; int i; int state = 0; char* msg_data; // bits after checksum info in payload long good = 0; // counters long bad = 0; long bad_tr = 0; long count = 0; // total msgs received struct timespec start_ts; struct timespec end_ts; int elap; // elapsed time to receive messages time_t timeout; count_bins = (int *) malloc( sizeof( int ) * 11 ); wbuf = (char *) malloc( sizeof( char ) * WBUF_SIZE ); if( (control = (tdata_t *) data) == NULL ) { fprintf( stderr, "thread data was nil; bailing out\n" ); } fprintf( stderr, "<THRD> id=%d thread receiver started expecting=%d messages timeout=%d seconds\n", control->id, control->n2get, control->delay ); timeout = time( NULL ) + control->delay; // max time to wait for a good message while( count < control->n2get ) { // wait for n messages -- no timeout msg = rmr_torcv_msg( control->mrc, msg, 1000 ); // pop after ~1 second if( msg ) { //fprintf( stderr, "<THRD> id=%d got type=%d state=%s msg=(%s)\n", control->id, msg->mtype, msg->state == RMR_OK ? "OK" : "timeout", msg->payload ); if( msg->state == RMR_OK ) { if( good == 0 ) { // mark time of first good message set_time( &start_ts ); } set_time( &end_ts ); // mark the time of last good message if( (msg_data = split( msg->payload, '|' )) != NULL ) { if( sum( msg_data ) == atoi( (char *) msg->payload ) ) { good++; } else { fprintf( stderr, "<RCVR> chk sum bad: computed=%d expected;%d (%s)\n", sum( msg_data ), atoi( msg->payload ), msg_data ); bad++; } if( (msg_data = split( msg->payload, ' ' )) != NULL ) { // data will point to the chksum for the trace data state = rmr_get_trace( msg, wbuf, 1024 ); // should only copy upto the trace size; we'll check that if( state > 128 || state < 0 ) { fprintf( stderr, "trace data size listed unexpectedly long: %d\n", state ); } else { if( state && sum( wbuf ) != atoi( msg_data ) ) { fprintf( stderr, "<RCVR> trace chk sum bad: computed=%d expected;%d len=%d (%s)\n", sum( wbuf ), atoi( msg_data ), state, wbuf ); bad_tr++; } } } } else { good++; // nothing to check, assume good } count++; if( msg->mtype >= 0 && msg->mtype <= 10 ) { count_bins[msg->mtype]++; } } } else { fprintf( stderr, "<THRD> id=%d timeout with nil msg\n", control->id ); } if( time( NULL ) > timeout ) { fprintf( stderr, "<THRD> id=%d timeout before receiving %d messages\n", control->id, control->n2get ); break; } } elap = elapsed( &start_ts, &end_ts, ELAP_MS ); if( elap > 0 ) { fprintf( stderr, "<THRD> id=%d received %ld messages in %d ms rate = %ld msg/sec\n", control->id, count, elap, (count/elap)*1000 ); } else { fprintf( stderr, "<THRD> id=%d runtime too short to compute received rate\n", control->id ); } snprintf( wbuf, WBUF_SIZE, "<THRD> id=%d histogram: ", control->id ); // build histogram so we can write with one fprintf call for( i = 0; i < 11; i++ ) { snprintf( buf2, sizeof( buf2 ), "%5d ", count_bins[i] ); strcat( wbuf, buf2 ); } fprintf( stderr, "%s\n", wbuf ); fprintf( stderr, "<THRD> id=%d %ld messages %ld good %ld bad\n", control->id, count, good, bad ); control->state = bad > 0 ? -1 : 0; // set to indicate done and <0 to indicate some failure control->state += count < control->n2get ? -2 : 0; return NULL; } int main( int argc, char** argv ) { void* mrc; // msg router context rmr_mbuf_t* rbuf = NULL; // received on 'normal' flow struct epoll_event events[1]; // list of events to give to epoll struct epoll_event epe; // event definition for event to listen to int ep_fd = -1; // epoll's file des (given to epoll_wait) char* listen_port = "43086"; long timeout = 0; // time the main thread will pop if listeners have not returned int delay = 30; // max time to wait for n messages int nmsgs = 10; // number of messages to expect int nthreads = 3; // default number of listener threads tdata_t* cvs; // vector of control blocks int i; pthread_t* pt_info; // thread stuff int failures = 0; if( argc > 1 ) { nmsgs = atoi( argv[1] ); } if( argc > 2 ) { delay = atoi( argv[2] ); } if( argc > 3 ) { nthreads = atoi( argv[3] ); } if( argc > 4 ) { listen_port = argv[4]; } fprintf( stderr, "<MTL> listen port: %s; sending %d messages; delay=%d\n", listen_port, nmsgs, delay ); if( (mrc = rmr_init( listen_port, 1400, 0 )) == NULL ) { fprintf( stderr, "<MTL> unable to initialise RMr\n" ); exit( 1 ); } rmr_init_trace( mrc, TRACE_SIZE ); cvs = malloc( sizeof( tdata_t ) * nthreads ); pt_info = malloc( sizeof( pthread_t ) * nthreads ); if( cvs == NULL ) { fprintf( stderr, "<MTL> unable to allocate control vector\n" ); exit( 1 ); } timeout = time( NULL ) + 20; // give rmr 20s to find the route table (shouldn't need that much) while( ! rmr_ready( mrc ) ) { // must have a route table before we can send; wait til RMr says it has one fprintf( stderr, "<MTL> waiting for rmr to show ready\n" ); sleep( 1 ); if( time( NULL ) > timeout ) { fprintf( stderr, "<MTL> giving up\n" ); exit( 1 ); } } fprintf( stderr, "<MTL> rmr is ready; starting threads\n" ); for( i = 0; i < nthreads; i++ ) { cvs[i].mrc = mrc; cvs[i].id = i + 2; // we pass this as the call-id to rmr, so must be >1 cvs[i].delay = delay; cvs[i].n2get = nmsgs; cvs[i].state = 1; fprintf( stderr, "kicking %d i=%d\n", i+2, i ); pthread_create( &pt_info[i], NULL, mk_calls, &cvs[i] ); // kick a thread } timeout = time( NULL ) + 300; // wait up to 5 minutes i = 0; while( nthreads > 0 ) { if( cvs[i].state < 1 ) { // states 0 or below indicate done. 0 == good; <0 is failure nthreads--; if( cvs[i].state < 0 ) { failures++; } i++; } if( time( NULL ) > timeout ) { failures += nthreads; fprintf( stderr, "<MTL> timeout waiting for threads to finish; %d were not finished\n", nthreads ); break; } sleep( 1 ); } fprintf( stderr, "<MTL> [%s] failing threads=%d\n", failures == 0 ? "PASS" : "FAIL", failures ); rmr_close( mrc ); return failures > 0; }
30.539216
151
0.601605
[ "vector" ]
781df212af8459de63ceb4b130be3e4972ea54f5
499
h
C
Project/Dev_class11_handout/Motor2D/O_Fall.h
Guille1406/Project-II
af954426efce06937671f02ac0a5840e5faefb0e
[ "Apache-2.0" ]
null
null
null
Project/Dev_class11_handout/Motor2D/O_Fall.h
Guille1406/Project-II
af954426efce06937671f02ac0a5840e5faefb0e
[ "Apache-2.0" ]
null
null
null
Project/Dev_class11_handout/Motor2D/O_Fall.h
Guille1406/Project-II
af954426efce06937671f02ac0a5840e5faefb0e
[ "Apache-2.0" ]
null
null
null
#ifndef _FALL_ #define _FALL_ #include "j1Object.h" #include"j1Render.h" #include "MainScene.h" #include "j1Scene.h" class Fall : public Object { private: public: Fall() { } Fall(const Fall& obj) { type = obj.type; rect = obj.rect; active = obj.active; name = obj.name; logic_height = obj.logic_height; fallpos = obj.fallpos; texture_rect = { 0,0,0,0 }; //texture_rect = idle_button; } ~Fall() { } void Action() { } public: iPoint fallpos = { 0,0 }; }; #endif
12.170732
34
0.627255
[ "object" ]
78223a29a449a1869dd74a5fd9586b1da1a6a59c
1,652
h
C
public/lib/cloud_provider/validation/launcher/validation_tests_launcher.h
Acidburn0zzz/peridot
9a3b1fb8e834d0315092478d83d0176ef28cb765
[ "BSD-3-Clause" ]
1
2018-02-05T23:33:32.000Z
2018-02-05T23:33:32.000Z
public/lib/cloud_provider/validation/launcher/validation_tests_launcher.h
Acidburn0zzz/peridot
9a3b1fb8e834d0315092478d83d0176ef28cb765
[ "BSD-3-Clause" ]
null
null
null
public/lib/cloud_provider/validation/launcher/validation_tests_launcher.h
Acidburn0zzz/peridot
9a3b1fb8e834d0315092478d83d0176ef28cb765
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2017 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef LIB_CLOUD_PROVIDER_VALIDATION_LAUNCHER_VALIDATION_TESTS_LAUNCHER_H_ #define LIB_CLOUD_PROVIDER_VALIDATION_LAUNCHER_VALIDATION_TESTS_LAUNCHER_H_ #include <functional> #include <string> #include "lib/app/cpp/application_context.h" #include "lib/app/cpp/service_provider_impl.h" #include "lib/app/fidl/application_launcher.fidl.h" #include "lib/cloud_provider/fidl/cloud_provider.fidl.h" namespace cloud_provider { // Helper for building launcher apps for the validation tests. class ValidationTestsLauncher { public: // The constructor. // // |factory| is called to produce instances of the cloud provider under test. ValidationTestsLauncher( app::ApplicationContext* application_context, std::function<void(fidl::InterfaceRequest<CloudProvider>)> factory); // Starts the tests. // // |arguments| are passed to the test binary. // |callback| is called after the tests are finished and passed the exit code // of the test binary. void Run(const std::vector<std::string>& arguments, std::function<void(int32_t)> callback); private: app::ApplicationContext* const application_context_; std::function<void(fidl::InterfaceRequest<CloudProvider>)> factory_; app::ServiceProviderImpl service_provider_impl_; app::ApplicationControllerPtr validation_tests_controller_; std::function<void(int32_t)> callback_; }; } // namespace cloud_provider #endif // LIB_CLOUD_PROVIDER_VALIDATION_LAUNCHER_VALIDATION_TESTS_LAUNCHER_H_
35.148936
79
0.779056
[ "vector" ]
78289618048ed1e1a39f7fb7b046a6baf0cb07f4
4,976
h
C
source/include/gameplay.h
jttuboi/adas
5ee545b4d9c85018d5bcb84286aa00a90e34d377
[ "MIT" ]
null
null
null
source/include/gameplay.h
jttuboi/adas
5ee545b4d9c85018d5bcb84286aa00a90e34d377
[ "MIT" ]
null
null
null
source/include/gameplay.h
jttuboi/adas
5ee545b4d9c85018d5bcb84286aa00a90e34d377
[ "MIT" ]
null
null
null
#ifndef GAMEPLAY_H #define GAMEPLAY_H #include<allegro.h> #include"main.h" #include"wagon.h" #include"player.h" #include"background.h" #include"enemies_mngr.h" #include"sprites.h" #include"collision.h" #include"railway.h" #define STATIONS_MAIN_NUMBER 4 #define LINES_MAIN_NUMBER 3 #define GAMEPLAY_TYPE_NORMAL 1 #define GAMEPLAY_MAX_SPEED 15 #define GAMEPLAY_STATION_STAGE_STOPPING 1 #define GAMEPLAY_STATION_STAGE_DOORS_OPPENING 2 #define GAMEPLAY_STATION_STAGE_DOORS_OPEN 3 #define GAMEPLAY_STATION_STAGE_DOORS_CLOSING 4 #define GAMEPLAY_STATION_STAGE_EXITING 5 #define GAME_ENDED_WRONG_STATION 1 #define GAME_ENDED_LOST_STATION 2 #define GAME_ENDED_PLAYER_DIED 3 #define WARNING_NONE 0 #define WARNING_STATION_CHANGE 1 #define WARNING_STATION_CHANGE_NOW 2 #define WARNING_CORRECT_TRAIN_CHANGE 3 #define GAMEPLAY_STATION_WAIT_TIME 120 #define TYPE_RANDOM 0 #define TYPE_ZOMBIE 1 #define TYPE_POLICE_ZOMBIE 2 #define TYPE_FLIES 3 //How much time before the station will the train slow down? #define GAMEPLAY_TIME_SLOW_DOWN 300 //How much time do the train waits after there are no enemies //in front of the doors? #define GAMEPLAY_TIME_STOPPED 300 //How much time the train keeps at low speed after getting out //of a station? #define GAMEPLAY_TIME_ACCELERATE 180 class GAMEPLAY { public: //The line number (stage) the player actually is int line; //The number of lines the player needs to get through int lines_number; //Vector of the amount of stations the player needs to pass //by in each line int *stations_number; //What station the player actually is in int station; //Size of the subway machine =) (in wagons) int wagons_number; //The wagon data WAGON_DATA wagon_data; //The train WAGON *wagons; //The player PLAYER player; //The gameplay area limit (horizontal). Varies with the number of wagons int area_x_min_limit, area_x_max_limit; //Camera position int camera_x, camera_y; //Camera drawing positions (for zooms) int camera_draw_x, camera_draw_y; //Background handler BACKGROUND background; //Enemies handler ENEMIES_MANAGER enemies_manager; //Game play organizer: railway for line and stations RAILWAY railway; BASE_SPRITE base_rail; //Time organizer, until the next station int time_next_station; int stopped_time; //This is the station that the player must get out bool this_station; //Warning message to be shown int warning; //Flag to say if the train is on wait at soem station bool on_station; //If the player did get off at the right station bool station_ok; //Flag to say what we are doing at the station int station_action; //Position of the station int station_x; //Integer that counts how much time the train will stay at the station int station_wait; //Station image! BITMAP *spr_station; BITMAP *spr_station_half; //Mask for the wagons side doors collision checking BASE_SPRITE base_side_door_mask; //The collision data for it BOX_COLLISION_DATA coll_side_door; //The zoom in or out int zoom; //We need to know if the game has ended bool game_ended; int game_ended_reason; //Gameplay type (makes the game mode) int gameplay_type; int gameplay_stage; //Has post mortem been prepared? bool post_mortem_prepared; //Constructor GAMEPLAY(); //Set a new gameplay void setGame(int wagons_number, int lines_number, int stations_number_max, int stations_number_variance, int gameplay_type); //Set a camera position void setCameraPosition(int camera_x, int camera_y); //Set a area limit (horizontal) void setAreaLimit(int area_x_min_limit, int area_x_max_limit); //Create a enemy (not fat) of a type void createEnemy(int type, int wagon, int delay); //Logic loop for the game void logicLoop(); //Draw everything void draw(BITMAP *buffer); //Destructor ~GAMEPLAY(); }; #endif
21.541126
128
0.598071
[ "vector" ]
783b39c759b38ae05cefa5a1c1822219ccdb6077
5,215
h
C
xarm_controller/include/xarm_controller/xarm_hw.h
Permobil-Senior-Design/xarm_ros
3d82a29e462e0c26598f20222cb5d3d372de02f7
[ "BSD-3-Clause" ]
null
null
null
xarm_controller/include/xarm_controller/xarm_hw.h
Permobil-Senior-Design/xarm_ros
3d82a29e462e0c26598f20222cb5d3d372de02f7
[ "BSD-3-Clause" ]
null
null
null
xarm_controller/include/xarm_controller/xarm_hw.h
Permobil-Senior-Design/xarm_ros
3d82a29e462e0c26598f20222cb5d3d372de02f7
[ "BSD-3-Clause" ]
1
2022-02-11T22:27:35.000Z
2022-02-11T22:27:35.000Z
/* Copyright 2018 UFACTORY Inc. All Rights Reserved. * * Software License Agreement (BSD License) * * Author: Jason Peng <jason@ufactory.cc> ============================================================================*/ #ifndef __XARM_HARDWARE_INTERFACE_H__ #define __XARM_HARDWARE_INTERFACE_H__ // ros_control #include <control_toolbox/pid.h> #include <hardware_interface/joint_state_interface.h> // #include <hardware_interface/force_torque_sensor_interface.h> #include <hardware_interface/joint_command_interface.h> #include <joint_limits_interface/joint_limits.h> #include <joint_limits_interface/joint_limits_interface.h> #include <joint_limits_interface/joint_limits_rosparam.h> #include <joint_limits_interface/joint_limits_urdf.h> #include <urdf_parser/urdf_parser.h> #include <urdf/model.h> #include <hardware_interface/robot_hw.h> #include <controller_manager/controller_manager.h> // ROS #include <ros/ros.h> #include <angles/angles.h> #include <pluginlib/class_list_macros.h> #include <sensor_msgs/JointState.h> // #include <geometry_msgs/WrenchStamped.h> // for mutex #include <mutex> #include <thread> // xarm #include "xarm/core/instruction/uxbus_cmd_config.h" #include "xarm_api/xarm_ros_client.h" namespace xarm_control { const std::string jnt_state_topic = "joint_states"; const std::string xarm_state_topic = "xarm_states"; // const std::string xarm_ftsensor_states_topic = "xarm_ftsensor_states"; class XArmHW : public hardware_interface::RobotHW { public: XArmHW(){}; ~XArmHW(); virtual bool init(ros::NodeHandle& root_nh, ros::NodeHandle &robot_hw_nh); virtual void read(const ros::Time& time, const ros::Duration& period); virtual void write(const ros::Time& time, const ros::Duration& period); /* TODO: virtual bool prepareSwitch(const std::list<ControllerInfo>& start_list, const std::list<ControllerInfo>& stop_list) { return true; } virtual void doSwitch(const std::list<ControllerInfo>& , const std::list<ControllerInfo>& ) {}*/ /* get current arm status: in the order of state, mode and error_code */ void get_status(int state_mode_err[3]); /* check whether the controller needs to be reset due to error or mode change */ bool need_reset(); bool wait_fbk_start(ros::Duration timeout); protected: enum ControlMethod {POSITION, VELOCITY, EFFORT}; private: int curr_state_; int curr_mode_; int curr_err_; int read_code_; int write_code_; unsigned int dof_; std::vector<std::string> jnt_names_; std::vector<float> prev_cmds_float_; std::vector<float> cmds_float_; std::vector<double> position_cmds_; std::vector<double> velocity_cmds_; std::vector<double> effort_cmds_; std::vector<double> position_states_; std::vector<double> velocity_states_; std::vector<double> effort_states_; bool initialized_; bool read_ready_; long int read_cnts_; long int read_failed_cnts_; double read_max_time_; double read_total_time_; std::vector<float> prev_read_angles_; std::vector<float> curr_read_angles_; ros::Duration read_duration_; ros::Duration write_duration_; bool enforce_limits_; // double force_[3]; // double torque_[3]; bool initial_write_; std::mutex mutex_; std::string hw_ns_; bool pos_fdb_called_; bool stat_fdb_called_; // std::string force_torque_sensor_name_; // std::string force_torque_sensor_frame_id_; ros::Time last_joint_state_stamp_; // ros::Time last_ftsensor_stamp_; xarm_api::XArmROSClient xarm; urdf::ModelInterfaceSharedPtr model_ptr_; ControlMethod ctrl_method_; hardware_interface::JointStateInterface js_interface_; hardware_interface::EffortJointInterface ej_interface_; hardware_interface::PositionJointInterface pj_interface_; hardware_interface::VelocityJointInterface vj_interface_; // hardware_interface::ForceTorqueSensorInterface fts_interface_; joint_limits_interface::EffortJointSaturationInterface ej_sat_interface_; joint_limits_interface::EffortJointSoftLimitsInterface ej_limits_interface_; joint_limits_interface::PositionJointSaturationInterface pj_sat_interface_; joint_limits_interface::PositionJointSoftLimitsInterface pj_limits_interface_; joint_limits_interface::VelocityJointSaturationInterface vj_sat_interface_; joint_limits_interface::VelocityJointSoftLimitsInterface vj_limits_interface_; ros::Subscriber pos_sub_, vel_sub_, effort_sub_, state_sub_; // ros::Subscriber wrench_sub_; void clientInit(const std::string& robot_ip, ros::NodeHandle &root_nh); void pos_fb_cb(const sensor_msgs::JointState::ConstPtr& data); void state_fb_cb(const xarm_msgs::RobotMsg::ConstPtr& data); // void ftsensor_fb_cb(const geometry_msgs::WrenchStamped::ConstPtr& data); void _register_joint_limits(ros::NodeHandle &root_nh, std::string joint_name, const ControlMethod ctrl_method); void _reset_limits(void); void _enforce_limits(const ros::Duration& period); bool _check_cmds_is_change(std::vector<float> prev, std::vector<float> cur, double threshold = 0.0001); bool _xarm_is_ready_read(void); bool _xarm_is_ready_write(void); }; } #endif
34.084967
113
0.756088
[ "vector", "model" ]
783d301256192776fcf6e132c5367ac6fa963ab3
289,594
h
C
altv-sdk/thirdparty/altv-capi-server/include/server/altv-capi.h
DimaaIO/altv-rs
f5cf1733493466634793804dfb1ca6d387fbe687
[ "Apache-2.0", "MIT" ]
2
2020-06-18T19:46:20.000Z
2020-07-25T03:17:14.000Z
altv-sdk/thirdparty/altv-capi-server/include/server/altv-capi.h
DimaaIO/altv-rs
f5cf1733493466634793804dfb1ca6d387fbe687
[ "Apache-2.0", "MIT" ]
null
null
null
altv-sdk/thirdparty/altv-capi-server/include/server/altv-capi.h
DimaaIO/altv-rs
f5cf1733493466634793804dfb1ca6d387fbe687
[ "Apache-2.0", "MIT" ]
null
null
null
/** * CAPI API Header for C * THIS HEADER IS AUTOGENERATED * Mon Jun 8 10:59:38 2020 * * Include header for alt:V C API */ #ifndef _CAPI_H_ #define _CAPI_H_ typedef struct alt_VectorLayout_float_3 { float** elements; } alt_VectorLayout_float_3; CAPI void alt_VectorLayout_float_3_CAPI_Free(struct alt_VectorLayout_float_3* ptr); CAPI void alt_VectorLayout_float_3_Create(struct alt_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_3_CAPI_Free() CAPI struct alt_VectorLayout_float_3* alt_VectorLayout_float_3_Create_CAPI_Heap(); CAPI void alt_VectorLayout_float_3_Create_1(float* _elements, struct alt_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_3_CAPI_Free() CAPI struct alt_VectorLayout_float_3* alt_VectorLayout_float_3_Create_1_CAPI_Heap(float* _elements); CAPI void alt_VectorLayout_float_3_Create_2(float* el, struct alt_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_3_CAPI_Free() CAPI struct alt_VectorLayout_float_3* alt_VectorLayout_float_3_Create_2_CAPI_Heap(float* el); CAPI float* alt_VectorLayout_float_3_Access_size_t(struct alt_VectorLayout_float_3* _instance, unsigned long long key); CAPI float* alt_VectorLayout_float_3_Access_size_t_1(struct alt_VectorLayout_float_3* _instance, unsigned long long key); CAPI void alt_VectorLayout_float_3_Create_3(struct alt_VectorLayout_float_3* _p0, struct alt_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_3_CAPI_Free() CAPI struct alt_VectorLayout_float_3* alt_VectorLayout_float_3_Create_3_CAPI_Heap(struct alt_VectorLayout_float_3* _p0); CAPI void alt_VectorLayout_float_3_Create_4(struct alt_VectorLayout_float_3* _p0, struct alt_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_3_CAPI_Free() CAPI struct alt_VectorLayout_float_3* alt_VectorLayout_float_3_Create_4_CAPI_Heap(struct alt_VectorLayout_float_3* _p0); CAPI void alt_VectorLayout_float_3_Assign_constVectorLayout_float_3Ref(struct alt_VectorLayout_float_3* _instance, struct alt_VectorLayout_float_3* _p0); CAPI void alt_VectorLayout_float_3_Assign_VectorLayout_float_3RefRef(struct alt_VectorLayout_float_3* _instance, struct alt_VectorLayout_float_3* _p0); typedef struct alt_VectorLayout_float_4 { float** elements; } alt_VectorLayout_float_4; CAPI void alt_VectorLayout_float_4_CAPI_Free(struct alt_VectorLayout_float_4* ptr); CAPI void alt_VectorLayout_float_4_Create(struct alt_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_4_CAPI_Free() CAPI struct alt_VectorLayout_float_4* alt_VectorLayout_float_4_Create_CAPI_Heap(); CAPI void alt_VectorLayout_float_4_Create_1(float* _elements, struct alt_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_4_CAPI_Free() CAPI struct alt_VectorLayout_float_4* alt_VectorLayout_float_4_Create_1_CAPI_Heap(float* _elements); CAPI void alt_VectorLayout_float_4_Create_2(float* el, struct alt_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_4_CAPI_Free() CAPI struct alt_VectorLayout_float_4* alt_VectorLayout_float_4_Create_2_CAPI_Heap(float* el); CAPI float* alt_VectorLayout_float_4_Access_size_t(struct alt_VectorLayout_float_4* _instance, unsigned long long key); CAPI float* alt_VectorLayout_float_4_Access_size_t_1(struct alt_VectorLayout_float_4* _instance, unsigned long long key); CAPI void alt_VectorLayout_float_4_Create_3(struct alt_VectorLayout_float_4* _p0, struct alt_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_4_CAPI_Free() CAPI struct alt_VectorLayout_float_4* alt_VectorLayout_float_4_Create_3_CAPI_Heap(struct alt_VectorLayout_float_4* _p0); CAPI void alt_VectorLayout_float_4_Create_4(struct alt_VectorLayout_float_4* _p0, struct alt_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_VectorLayout_float_4_CAPI_Free() CAPI struct alt_VectorLayout_float_4* alt_VectorLayout_float_4_Create_4_CAPI_Heap(struct alt_VectorLayout_float_4* _p0); CAPI void alt_VectorLayout_float_4_Assign_constVectorLayout_float_4Ref(struct alt_VectorLayout_float_4* _instance, struct alt_VectorLayout_float_4* _p0); CAPI void alt_VectorLayout_float_4_Assign_VectorLayout_float_4RefRef(struct alt_VectorLayout_float_4* _instance, struct alt_VectorLayout_float_4* _p0); typedef struct alt_Vector_float_3_VectorLayout_float_3 { float** elements; } alt_Vector_float_3_VectorLayout_float_3; CAPI void alt_Vector_float_3_VectorLayout_float_3_CAPI_Free(struct alt_Vector_float_3_VectorLayout_float_3* ptr); CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_VectorLayout_float_3_to_alt_Vector_float_3_VectorLayout_float_3(struct alt_VectorLayout_float_3* from); CAPI struct alt_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_to_alt_VectorLayout_float_3(struct alt_Vector_float_3_VectorLayout_float_3* from); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create(struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_CAPI_Heap(); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_1(float* _elements, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_1_CAPI_Heap(float* _elements); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_2(float* el, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_2_CAPI_Heap(float* el); CAPI float* alt_Vector_float_3_VectorLayout_float_3_Access_size_t(struct alt_Vector_float_3_VectorLayout_float_3* _instance, unsigned long long key); CAPI float* alt_Vector_float_3_VectorLayout_float_3_Access_size_t_1(struct alt_Vector_float_3_VectorLayout_float_3* _instance, unsigned long long key); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_3(struct alt_VectorLayout_float_3* _p0, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_3_CAPI_Heap(struct alt_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_4(struct alt_VectorLayout_float_3* _p0, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_4_CAPI_Heap(struct alt_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Assign_constVectorLayout_float_3Ref(struct alt_Vector_float_3_VectorLayout_float_3* _instance, struct alt_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Assign_VectorLayout_float_3RefRef(struct alt_Vector_float_3_VectorLayout_float_3* _instance, struct alt_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_5(struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_5_CAPI_Heap(); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_6(float* _elements, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_6_CAPI_Heap(float* _elements); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_7(struct alt_VectorLayout_float_3* layout, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_7_CAPI_Heap(struct alt_VectorLayout_float_3* layout); CAPI float alt_Vector_float_3_VectorLayout_float_3_LengthSqr(struct alt_Vector_float_3_VectorLayout_float_3* _instance); CAPI float alt_Vector_float_3_VectorLayout_float_3_Length(struct alt_Vector_float_3_VectorLayout_float_3* _instance); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_8(struct alt_Vector_float_3_VectorLayout_float_3* _p0, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_8_CAPI_Heap(struct alt_Vector_float_3_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Create_9(struct alt_Vector_float_3_VectorLayout_float_3* _p0, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_Vector_float_3_VectorLayout_float_3_Create_9_CAPI_Heap(struct alt_Vector_float_3_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Assign_constVector_float_3_VectorLayout_float_3Ref(struct alt_Vector_float_3_VectorLayout_float_3* _instance, struct alt_Vector_float_3_VectorLayout_float_3* _p0); CAPI void alt_Vector_float_3_VectorLayout_float_3_Assign_Vector_float_3_VectorLayout_float_3RefRef(struct alt_Vector_float_3_VectorLayout_float_3* _instance, struct alt_Vector_float_3_VectorLayout_float_3* _p0); typedef struct alt_Vector_float_4_VectorLayout_float_4 { float** elements; } alt_Vector_float_4_VectorLayout_float_4; CAPI void alt_Vector_float_4_VectorLayout_float_4_CAPI_Free(struct alt_Vector_float_4_VectorLayout_float_4* ptr); CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_VectorLayout_float_4_to_alt_Vector_float_4_VectorLayout_float_4(struct alt_VectorLayout_float_4* from); CAPI struct alt_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_to_alt_VectorLayout_float_4(struct alt_Vector_float_4_VectorLayout_float_4* from); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create(struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_CAPI_Heap(); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_1(float* _elements, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_1_CAPI_Heap(float* _elements); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_2(float* el, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_2_CAPI_Heap(float* el); CAPI float* alt_Vector_float_4_VectorLayout_float_4_Access_size_t(struct alt_Vector_float_4_VectorLayout_float_4* _instance, unsigned long long key); CAPI float* alt_Vector_float_4_VectorLayout_float_4_Access_size_t_1(struct alt_Vector_float_4_VectorLayout_float_4* _instance, unsigned long long key); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_3(struct alt_VectorLayout_float_4* _p0, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_3_CAPI_Heap(struct alt_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_4(struct alt_VectorLayout_float_4* _p0, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_4_CAPI_Heap(struct alt_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Assign_constVectorLayout_float_4Ref(struct alt_Vector_float_4_VectorLayout_float_4* _instance, struct alt_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Assign_VectorLayout_float_4RefRef(struct alt_Vector_float_4_VectorLayout_float_4* _instance, struct alt_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_5(struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_5_CAPI_Heap(); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_6(float* _elements, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_6_CAPI_Heap(float* _elements); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_7(struct alt_VectorLayout_float_4* layout, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_7_CAPI_Heap(struct alt_VectorLayout_float_4* layout); CAPI float alt_Vector_float_4_VectorLayout_float_4_LengthSqr(struct alt_Vector_float_4_VectorLayout_float_4* _instance); CAPI float alt_Vector_float_4_VectorLayout_float_4_Length(struct alt_Vector_float_4_VectorLayout_float_4* _instance); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_8(struct alt_Vector_float_4_VectorLayout_float_4* _p0, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_8_CAPI_Heap(struct alt_Vector_float_4_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Create_9(struct alt_Vector_float_4_VectorLayout_float_4* _p0, struct alt_Vector_float_4_VectorLayout_float_4* _returnValue); // Return ptr must be manually freed with alt_Vector_float_4_VectorLayout_float_4_CAPI_Free() CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_Vector_float_4_VectorLayout_float_4_Create_9_CAPI_Heap(struct alt_Vector_float_4_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Assign_constVector_float_4_VectorLayout_float_4Ref(struct alt_Vector_float_4_VectorLayout_float_4* _instance, struct alt_Vector_float_4_VectorLayout_float_4* _p0); CAPI void alt_Vector_float_4_VectorLayout_float_4_Assign_Vector_float_4_VectorLayout_float_4RefRef(struct alt_Vector_float_4_VectorLayout_float_4* _instance, struct alt_Vector_float_4_VectorLayout_float_4* _p0); typedef struct alt_Vector_float_3_PointLayout { float x; float y; float z; } alt_Vector_float_3_PointLayout; CAPI void alt_Vector_float_3_PointLayout_CAPI_Free(struct alt_Vector_float_3_PointLayout* ptr); CAPI struct alt_Vector_float_3_PointLayout* alt_PointLayout_to_alt_Vector_float_3_PointLayout(struct alt_PointLayout* from); CAPI struct alt_PointLayout* alt_Vector_float_3_PointLayout_to_alt_PointLayout(struct alt_Vector_float_3_PointLayout* from); CAPI void alt_Vector_float_3_PointLayout_Create(struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_CAPI_Heap(); CAPI void alt_Vector_float_3_PointLayout_Create_1(float _x, float _y, float _z, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_1_CAPI_Heap(float _x, float _y, float _z); CAPI void alt_Vector_float_3_PointLayout_Create_2(float* elements, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_2_CAPI_Heap(float* elements); CAPI float* alt_Vector_float_3_PointLayout_Access_size_t(struct alt_Vector_float_3_PointLayout* _instance, unsigned long long key); CAPI float* alt_Vector_float_3_PointLayout_Access_size_t_1(struct alt_Vector_float_3_PointLayout* _instance, unsigned long long key); CAPI void alt_Vector_float_3_PointLayout_Create_3(struct alt_PointLayout* _p0, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_3_CAPI_Heap(struct alt_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Create_4(struct alt_PointLayout* _p0, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_4_CAPI_Heap(struct alt_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Assign_constPointLayoutRef(struct alt_Vector_float_3_PointLayout* _instance, struct alt_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Assign_PointLayoutRefRef(struct alt_Vector_float_3_PointLayout* _instance, struct alt_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Create_5(struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_5_CAPI_Heap(); CAPI void alt_Vector_float_3_PointLayout_Create_6(float* _elements, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_6_CAPI_Heap(float* _elements); CAPI void alt_Vector_float_3_PointLayout_Create_7(struct alt_PointLayout* layout, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_7_CAPI_Heap(struct alt_PointLayout* layout); CAPI float alt_Vector_float_3_PointLayout_LengthSqr(struct alt_Vector_float_3_PointLayout* _instance); CAPI float alt_Vector_float_3_PointLayout_Length(struct alt_Vector_float_3_PointLayout* _instance); CAPI void alt_Vector_float_3_PointLayout_Create_8(struct alt_Vector_float_3_PointLayout* _p0, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_8_CAPI_Heap(struct alt_Vector_float_3_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Create_9(struct alt_Vector_float_3_PointLayout* _p0, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_Vector_float_3_PointLayout_Create_9_CAPI_Heap(struct alt_Vector_float_3_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Assign_constVector_float_3_PointLayoutRef(struct alt_Vector_float_3_PointLayout* _instance, struct alt_Vector_float_3_PointLayout* _p0); CAPI void alt_Vector_float_3_PointLayout_Assign_Vector_float_3_PointLayoutRefRef(struct alt_Vector_float_3_PointLayout* _instance, struct alt_Vector_float_3_PointLayout* _p0); typedef struct alt_PointLayout { float x; float y; float z; } alt_PointLayout; CAPI void alt_PointLayout_CAPI_Free(struct alt_PointLayout* ptr); CAPI void alt_PointLayout_Create(struct alt_PointLayout* _returnValue); // Return ptr must be manually freed with alt_PointLayout_CAPI_Free() CAPI struct alt_PointLayout* alt_PointLayout_Create_CAPI_Heap(); CAPI void alt_PointLayout_Create_1(float _x, float _y, float _z, struct alt_PointLayout* _returnValue); // Return ptr must be manually freed with alt_PointLayout_CAPI_Free() CAPI struct alt_PointLayout* alt_PointLayout_Create_1_CAPI_Heap(float _x, float _y, float _z); CAPI void alt_PointLayout_Create_2(float* elements, struct alt_PointLayout* _returnValue); // Return ptr must be manually freed with alt_PointLayout_CAPI_Free() CAPI struct alt_PointLayout* alt_PointLayout_Create_2_CAPI_Heap(float* elements); CAPI float* alt_PointLayout_Access_size_t(struct alt_PointLayout* _instance, unsigned long long key); CAPI float* alt_PointLayout_Access_size_t_1(struct alt_PointLayout* _instance, unsigned long long key); CAPI void alt_PointLayout_Create_3(struct alt_PointLayout* _p0, struct alt_PointLayout* _returnValue); // Return ptr must be manually freed with alt_PointLayout_CAPI_Free() CAPI struct alt_PointLayout* alt_PointLayout_Create_3_CAPI_Heap(struct alt_PointLayout* _p0); CAPI void alt_PointLayout_Create_4(struct alt_PointLayout* _p0, struct alt_PointLayout* _returnValue); // Return ptr must be manually freed with alt_PointLayout_CAPI_Free() CAPI struct alt_PointLayout* alt_PointLayout_Create_4_CAPI_Heap(struct alt_PointLayout* _p0); CAPI void alt_PointLayout_Assign_constPointLayoutRef(struct alt_PointLayout* _instance, struct alt_PointLayout* _p0); CAPI void alt_PointLayout_Assign_PointLayoutRefRef(struct alt_PointLayout* _instance, struct alt_PointLayout* _p0); typedef struct alt_PointPaddedLayout { float x; float y; float z; float pad; } alt_PointPaddedLayout; CAPI void alt_PointPaddedLayout_CAPI_Free(struct alt_PointPaddedLayout* ptr); CAPI struct alt_PointPaddedLayout* alt_PointLayout_to_alt_PointPaddedLayout(struct alt_PointLayout* from); CAPI struct alt_PointLayout* alt_PointPaddedLayout_to_alt_PointLayout(struct alt_PointPaddedLayout* from); CAPI void alt_PointPaddedLayout_Create(struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_CAPI_Heap(); CAPI void alt_PointPaddedLayout_Create_1(float _x, float _y, float _z, struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_1_CAPI_Heap(float _x, float _y, float _z); CAPI void alt_PointPaddedLayout_Create_2(float* elements, struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_2_CAPI_Heap(float* elements); CAPI float* alt_PointPaddedLayout_Access_size_t(struct alt_PointPaddedLayout* _instance, unsigned long long key); CAPI float* alt_PointPaddedLayout_Access_size_t_1(struct alt_PointPaddedLayout* _instance, unsigned long long key); CAPI void alt_PointPaddedLayout_Create_3(struct alt_PointLayout* _p0, struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_3_CAPI_Heap(struct alt_PointLayout* _p0); CAPI void alt_PointPaddedLayout_Create_4(struct alt_PointLayout* _p0, struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_4_CAPI_Heap(struct alt_PointLayout* _p0); CAPI void alt_PointPaddedLayout_Assign_constPointLayoutRef(struct alt_PointPaddedLayout* _instance, struct alt_PointLayout* _p0); CAPI void alt_PointPaddedLayout_Assign_PointLayoutRefRef(struct alt_PointPaddedLayout* _instance, struct alt_PointLayout* _p0); CAPI void alt_PointPaddedLayout_Create_5(struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_5_CAPI_Heap(); CAPI void alt_PointPaddedLayout_Create_6(float x, float y, float z, struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_6_CAPI_Heap(float x, float y, float z); CAPI void alt_PointPaddedLayout_Create_7(float* elements, struct alt_PointPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_PointPaddedLayout_CAPI_Free() CAPI struct alt_PointPaddedLayout* alt_PointPaddedLayout_Create_7_CAPI_Heap(float* elements); typedef struct alt_RotationLayout { float roll; float pitch; float yaw; } alt_RotationLayout; CAPI void alt_RotationLayout_CAPI_Free(struct alt_RotationLayout* ptr); CAPI void alt_RotationLayout_Create(float _roll, float _pitch, float _yaw, struct alt_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_RotationLayout_CAPI_Free() CAPI struct alt_RotationLayout* alt_RotationLayout_Create_CAPI_Heap(float _roll, float _pitch, float _yaw); CAPI void alt_RotationLayout_Create_1(struct alt_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_RotationLayout_CAPI_Free() CAPI struct alt_RotationLayout* alt_RotationLayout_Create_1_CAPI_Heap(); CAPI void alt_RotationLayout_Create_2(float* elements, struct alt_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_RotationLayout_CAPI_Free() CAPI struct alt_RotationLayout* alt_RotationLayout_Create_2_CAPI_Heap(float* elements); CAPI float* alt_RotationLayout_Access_size_t(struct alt_RotationLayout* _instance, unsigned long long key); CAPI float* alt_RotationLayout_Access_size_t_1(struct alt_RotationLayout* _instance, unsigned long long key); CAPI void alt_RotationLayout_Normalize(struct alt_RotationLayout* _instance); CAPI void alt_RotationLayout_Create_3(struct alt_RotationLayout* _p0, struct alt_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_RotationLayout_CAPI_Free() CAPI struct alt_RotationLayout* alt_RotationLayout_Create_3_CAPI_Heap(struct alt_RotationLayout* _p0); CAPI void alt_RotationLayout_Create_4(struct alt_RotationLayout* _p0, struct alt_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_RotationLayout_CAPI_Free() CAPI struct alt_RotationLayout* alt_RotationLayout_Create_4_CAPI_Heap(struct alt_RotationLayout* _p0); typedef struct alt_RotationPaddedLayout { float roll; float pitch; float yaw; float pad; } alt_RotationPaddedLayout; CAPI void alt_RotationPaddedLayout_CAPI_Free(struct alt_RotationPaddedLayout* ptr); CAPI struct alt_RotationPaddedLayout* alt_RotationLayout_to_alt_RotationPaddedLayout(struct alt_RotationLayout* from); CAPI struct alt_RotationLayout* alt_RotationPaddedLayout_to_alt_RotationLayout(struct alt_RotationPaddedLayout* from); CAPI void alt_RotationPaddedLayout_Create(float _roll, float _pitch, float _yaw, struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_CAPI_Heap(float _roll, float _pitch, float _yaw); CAPI void alt_RotationPaddedLayout_Create_1(struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_1_CAPI_Heap(); CAPI void alt_RotationPaddedLayout_Create_2(float* elements, struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_2_CAPI_Heap(float* elements); CAPI float* alt_RotationPaddedLayout_Access_size_t(struct alt_RotationPaddedLayout* _instance, unsigned long long key); CAPI float* alt_RotationPaddedLayout_Access_size_t_1(struct alt_RotationPaddedLayout* _instance, unsigned long long key); CAPI void alt_RotationPaddedLayout_Normalize(struct alt_RotationPaddedLayout* _instance); CAPI void alt_RotationPaddedLayout_Create_3(struct alt_RotationLayout* _p0, struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_3_CAPI_Heap(struct alt_RotationLayout* _p0); CAPI void alt_RotationPaddedLayout_Create_4(struct alt_RotationLayout* _p0, struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_4_CAPI_Heap(struct alt_RotationLayout* _p0); CAPI void alt_RotationPaddedLayout_Create_5(struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_5_CAPI_Heap(); CAPI void alt_RotationPaddedLayout_Create_6(float roll, float pitch, float yaw, struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_6_CAPI_Heap(float roll, float pitch, float yaw); CAPI void alt_RotationPaddedLayout_Create_7(float* elements, struct alt_RotationPaddedLayout* _returnValue); // Return ptr must be manually freed with alt_RotationPaddedLayout_CAPI_Free() CAPI struct alt_RotationPaddedLayout* alt_RotationPaddedLayout_Create_7_CAPI_Heap(float* elements); typedef struct alt_ViewMatrixLayout { struct alt_Vector_float_4_VectorLayout_float_4 right; struct alt_Vector_float_4_VectorLayout_float_4 up; struct alt_Vector_float_4_VectorLayout_float_4 forward; struct alt_Vector_float_4_VectorLayout_float_4 pos; } alt_ViewMatrixLayout; CAPI void alt_ViewMatrixLayout_CAPI_Free(struct alt_ViewMatrixLayout* ptr); CAPI void alt_ViewMatrixLayout_Create(struct alt_ViewMatrixLayout* _returnValue); // Return ptr must be manually freed with alt_ViewMatrixLayout_CAPI_Free() CAPI struct alt_ViewMatrixLayout* alt_ViewMatrixLayout_Create_CAPI_Heap(); CAPI void alt_ViewMatrixLayout_Create_1(struct alt_Vector_float_4_VectorLayout_float_4* _rows, struct alt_ViewMatrixLayout* _returnValue); // Return ptr must be manually freed with alt_ViewMatrixLayout_CAPI_Free() CAPI struct alt_ViewMatrixLayout* alt_ViewMatrixLayout_Create_1_CAPI_Heap(struct alt_Vector_float_4_VectorLayout_float_4* _rows); CAPI void alt_ViewMatrixLayout_Create_2(struct alt_Vector_float_4_VectorLayout_float_4* row, struct alt_ViewMatrixLayout* _returnValue); // Return ptr must be manually freed with alt_ViewMatrixLayout_CAPI_Free() CAPI struct alt_ViewMatrixLayout* alt_ViewMatrixLayout_Create_2_CAPI_Heap(struct alt_Vector_float_4_VectorLayout_float_4* row); CAPI void alt_ViewMatrixLayout_Create_3(float* elements, struct alt_ViewMatrixLayout* _returnValue); // Return ptr must be manually freed with alt_ViewMatrixLayout_CAPI_Free() CAPI struct alt_ViewMatrixLayout* alt_ViewMatrixLayout_Create_3_CAPI_Heap(float* elements); CAPI void alt_ViewMatrixLayout_Create_4(struct alt_Vector_float_4_VectorLayout_float_4* _right, struct alt_Vector_float_4_VectorLayout_float_4* _up, struct alt_Vector_float_4_VectorLayout_float_4* _forward, struct alt_Vector_float_4_VectorLayout_float_4* _pos, struct alt_ViewMatrixLayout* _returnValue); // Return ptr must be manually freed with alt_ViewMatrixLayout_CAPI_Free() CAPI struct alt_ViewMatrixLayout* alt_ViewMatrixLayout_Create_4_CAPI_Heap(struct alt_Vector_float_4_VectorLayout_float_4* _right, struct alt_Vector_float_4_VectorLayout_float_4* _up, struct alt_Vector_float_4_VectorLayout_float_4* _forward, struct alt_Vector_float_4_VectorLayout_float_4* _pos); CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_ViewMatrixLayout_Access_size_t(struct alt_ViewMatrixLayout* _instance, unsigned long long key); CAPI struct alt_Vector_float_4_VectorLayout_float_4* alt_ViewMatrixLayout_Access_size_t_1(struct alt_ViewMatrixLayout* _instance, unsigned long long key); typedef struct alt_String { char* data; unsigned long long size; } alt_String; CAPI void alt_String_CAPI_Free(struct alt_String* ptr); CAPI void alt_String_Create(unsigned long long _size, char fill, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_String_Create_CAPI_Heap(unsigned long long _size, char fill); CAPI void alt_String_Create_1(char* _data, unsigned long long size, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_String_Create_1_CAPI_Heap(char* _data, unsigned long long size); CAPI void alt_String_Create_2(struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_String_Create_2_CAPI_Heap(); CAPI void alt_String_Create_3(char* _str, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_String_Create_3_CAPI_Heap(char* _str); CAPI void alt_String_Create_5(struct alt_String* that, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_String_Create_5_CAPI_Heap(struct alt_String* that); CAPI void alt_String_Create_6(struct alt_String* that, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_String_Create_6_CAPI_Heap(struct alt_String* that); CAPI char* alt_String_Access_uint64_t(struct alt_String* _instance, unsigned long long key); CAPI char alt_String_Access_uint64_t_1(struct alt_String* _instance, unsigned long long key); CAPI void alt_String_Assign_constStringRef(struct alt_String* _instance, struct alt_String* that); CAPI void alt_String_Assign_StringRefRef(struct alt_String* _instance, struct alt_String* that); CAPI void alt_String_Resize(struct alt_String* _instance, unsigned long long new_size); CAPI _Bool alt_String_IsEmpty(struct alt_String* _instance); CAPI char* alt_String_GetData(struct alt_String* _instance); CAPI char* alt_String_GetData_1(struct alt_String* _instance); CAPI unsigned long long alt_String_GetSize(struct alt_String* _instance); CAPI _Bool alt_String_Equals_String(struct alt_String* _instance, struct alt_String* that); CAPI _Bool alt_String_NotEquals_String(struct alt_String* _instance, struct alt_String* that); CAPI char* alt_String_CStr(struct alt_String* _instance); typedef struct alt_StringView { char* data; unsigned long long size; } alt_StringView; CAPI void alt_StringView_CAPI_Free(struct alt_StringView* ptr); CAPI void alt_StringView_Create(char* _data, unsigned long long _size, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_StringView_Create_CAPI_Heap(char* _data, unsigned long long _size); CAPI void alt_StringView_Create_1(struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_StringView_Create_1_CAPI_Heap(); CAPI void alt_StringView_Create_2(char* _str, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_StringView_Create_2_CAPI_Heap(char* _str); CAPI void alt_StringView_Create_4(struct alt_String* _str, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_StringView_Create_4_CAPI_Heap(struct alt_String* _str); CAPI _Bool alt_StringView_IsEmpty(struct alt_StringView* _instance); CAPI char* alt_StringView_GetData(struct alt_StringView* _instance); CAPI unsigned long long alt_StringView_GetSize(struct alt_StringView* _instance); CAPI char alt_StringView_Access_uint64_t(struct alt_StringView* _instance, unsigned long long key); CAPI _Bool alt_StringView_Equals_StringView(struct alt_StringView* _instance, struct alt_StringView* that); CAPI _Bool alt_StringView_NotEquals_StringView(struct alt_StringView* _instance, struct alt_StringView* that); CAPI void alt_StringView_To_String(struct alt_StringView* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_StringView_To_String_CAPI_Heap(struct alt_StringView* _instance); CAPI char* alt_StringView_CStr(struct alt_StringView* _instance); CAPI void alt_StringView_Create_6(struct alt_StringView* _p0, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_StringView_Create_6_CAPI_Heap(struct alt_StringView* _p0); CAPI void alt_StringView_Create_7(struct alt_StringView* _p0, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_StringView_Create_7_CAPI_Heap(struct alt_StringView* _p0); CAPI void alt_StringView_Assign_constStringViewRef(struct alt_StringView* _instance, struct alt_StringView* _p0); CAPI void alt_StringView_Assign_StringViewRefRef(struct alt_StringView* _instance, struct alt_StringView* _p0); typedef struct alt_RGBA { unsigned char r; unsigned char g; unsigned char b; unsigned char a; } alt_RGBA; CAPI void alt_RGBA_CAPI_Free(struct alt_RGBA* ptr); CAPI void alt_RGBA_Create(struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_RGBA_Create_CAPI_Heap(); CAPI void alt_RGBA_Create_1(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_RGBA_Create_1_CAPI_Heap(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a); typedef struct alt_Array_RefBase_RefStore_constIMValue { struct alt_RefBase_RefStore_constIMValue* data; unsigned long long size; unsigned long long capacity; } alt_Array_RefBase_RefStore_constIMValue; CAPI void alt_Array_RefBase_RefStore_constIMValue_CAPI_Free(struct alt_Array_RefBase_RefStore_constIMValue* ptr); CAPI void alt_Array_RefBase_RefStore_constIMValue_Create(struct alt_Array_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Create_CAPI_Heap(); CAPI void alt_Array_RefBase_RefStore_constIMValue_Create_1(struct alt_RefBase_RefStore_constIMValue* _data, unsigned long long _size, struct alt_Array_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Create_1_CAPI_Heap(struct alt_RefBase_RefStore_constIMValue* _data, unsigned long long _size); CAPI void alt_Array_RefBase_RefStore_constIMValue_Create_2(unsigned long long _size, struct alt_RefBase_RefStore_constIMValue* fill, struct alt_Array_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Create_2_CAPI_Heap(unsigned long long _size, struct alt_RefBase_RefStore_constIMValue* fill); CAPI void alt_Array_RefBase_RefStore_constIMValue_Create_3(struct alt_Array_RefBase_RefStore_constIMValue* that, struct alt_Array_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Create_3_CAPI_Heap(struct alt_Array_RefBase_RefStore_constIMValue* that); CAPI void alt_Array_RefBase_RefStore_constIMValue_Create_4(struct alt_Array_RefBase_RefStore_constIMValue* that, struct alt_Array_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Create_4_CAPI_Heap(struct alt_Array_RefBase_RefStore_constIMValue* that); CAPI void alt_Array_RefBase_RefStore_constIMValue_Assign_constArray_RefBase_RefStore_constIMValueRef(struct alt_Array_RefBase_RefStore_constIMValue* _instance, struct alt_Array_RefBase_RefStore_constIMValue* that); CAPI void alt_Array_RefBase_RefStore_constIMValue_Assign_Array_RefBase_RefStore_constIMValueRefRef(struct alt_Array_RefBase_RefStore_constIMValue* _instance, struct alt_Array_RefBase_RefStore_constIMValue* that); CAPI void alt_Array_RefBase_RefStore_constIMValue_Push(struct alt_Array_RefBase_RefStore_constIMValue* _instance, struct alt_RefBase_RefStore_constIMValue* el); CAPI void alt_Array_RefBase_RefStore_constIMValue_Reserve(struct alt_Array_RefBase_RefStore_constIMValue* _instance, unsigned long long size); CAPI unsigned long long alt_Array_RefBase_RefStore_constIMValue_GetSize(struct alt_Array_RefBase_RefStore_constIMValue* _instance); CAPI unsigned long long alt_Array_RefBase_RefStore_constIMValue_GetCapacity(struct alt_Array_RefBase_RefStore_constIMValue* _instance); CAPI struct alt_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Access_uint64_t(struct alt_Array_RefBase_RefStore_constIMValue* _instance, unsigned long long key); CAPI struct alt_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_Access_uint64_t_1(struct alt_Array_RefBase_RefStore_constIMValue* _instance, unsigned long long key); CAPI struct alt_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_begin(struct alt_Array_RefBase_RefStore_constIMValue* _instance); CAPI struct alt_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_begin_1(struct alt_Array_RefBase_RefStore_constIMValue* _instance); CAPI struct alt_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_end(struct alt_Array_RefBase_RefStore_constIMValue* _instance); CAPI struct alt_RefBase_RefStore_constIMValue* alt_Array_RefBase_RefStore_constIMValue_end_1(struct alt_Array_RefBase_RefStore_constIMValue* _instance); typedef struct alt_Array_StringView { struct alt_StringView* data; unsigned long long size; unsigned long long capacity; } alt_Array_StringView; CAPI void alt_Array_StringView_CAPI_Free(struct alt_Array_StringView* ptr); CAPI void alt_Array_StringView_Create(struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with alt_Array_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_Array_StringView_Create_CAPI_Heap(); CAPI void alt_Array_StringView_Create_1(struct alt_StringView* _data, unsigned long long _size, struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with alt_Array_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_Array_StringView_Create_1_CAPI_Heap(struct alt_StringView* _data, unsigned long long _size); CAPI void alt_Array_StringView_Create_2(unsigned long long _size, struct alt_StringView* fill, struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with alt_Array_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_Array_StringView_Create_2_CAPI_Heap(unsigned long long _size, struct alt_StringView* fill); CAPI void alt_Array_StringView_Create_3(struct alt_Array_StringView* that, struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with alt_Array_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_Array_StringView_Create_3_CAPI_Heap(struct alt_Array_StringView* that); CAPI void alt_Array_StringView_Create_4(struct alt_Array_StringView* that, struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with alt_Array_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_Array_StringView_Create_4_CAPI_Heap(struct alt_Array_StringView* that); CAPI void alt_Array_StringView_Assign_constArray_StringViewRef(struct alt_Array_StringView* _instance, struct alt_Array_StringView* that); CAPI void alt_Array_StringView_Assign_Array_StringViewRefRef(struct alt_Array_StringView* _instance, struct alt_Array_StringView* that); CAPI void alt_Array_StringView_Push(struct alt_Array_StringView* _instance, struct alt_StringView* el); CAPI void alt_Array_StringView_Reserve(struct alt_Array_StringView* _instance, unsigned long long size); CAPI unsigned long long alt_Array_StringView_GetSize(struct alt_Array_StringView* _instance); CAPI unsigned long long alt_Array_StringView_GetCapacity(struct alt_Array_StringView* _instance); CAPI struct alt_StringView* alt_Array_StringView_Access_uint64_t(struct alt_Array_StringView* _instance, unsigned long long key); CAPI struct alt_StringView* alt_Array_StringView_Access_uint64_t_1(struct alt_Array_StringView* _instance, unsigned long long key); CAPI struct alt_StringView* alt_Array_StringView_begin(struct alt_Array_StringView* _instance); CAPI struct alt_StringView* alt_Array_StringView_begin_1(struct alt_Array_StringView* _instance); CAPI struct alt_StringView* alt_Array_StringView_end(struct alt_Array_StringView* _instance); CAPI struct alt_StringView* alt_Array_StringView_end_1(struct alt_Array_StringView* _instance); typedef struct alt_Array_String { struct alt_String* data; unsigned long long size; unsigned long long capacity; } alt_Array_String; CAPI void alt_Array_String_CAPI_Free(struct alt_Array_String* ptr); CAPI void alt_Array_String_Create(struct alt_Array_String* _returnValue); // Return ptr must be manually freed with alt_Array_String_CAPI_Free() CAPI struct alt_Array_String* alt_Array_String_Create_CAPI_Heap(); CAPI void alt_Array_String_Create_1(struct alt_String* _data, unsigned long long _size, struct alt_Array_String* _returnValue); // Return ptr must be manually freed with alt_Array_String_CAPI_Free() CAPI struct alt_Array_String* alt_Array_String_Create_1_CAPI_Heap(struct alt_String* _data, unsigned long long _size); CAPI void alt_Array_String_Create_2(unsigned long long _size, struct alt_String* fill, struct alt_Array_String* _returnValue); // Return ptr must be manually freed with alt_Array_String_CAPI_Free() CAPI struct alt_Array_String* alt_Array_String_Create_2_CAPI_Heap(unsigned long long _size, struct alt_String* fill); CAPI void alt_Array_String_Create_3(struct alt_Array_String* that, struct alt_Array_String* _returnValue); // Return ptr must be manually freed with alt_Array_String_CAPI_Free() CAPI struct alt_Array_String* alt_Array_String_Create_3_CAPI_Heap(struct alt_Array_String* that); CAPI void alt_Array_String_Create_4(struct alt_Array_String* that, struct alt_Array_String* _returnValue); // Return ptr must be manually freed with alt_Array_String_CAPI_Free() CAPI struct alt_Array_String* alt_Array_String_Create_4_CAPI_Heap(struct alt_Array_String* that); CAPI void alt_Array_String_Assign_constArray_StringRef(struct alt_Array_String* _instance, struct alt_Array_String* that); CAPI void alt_Array_String_Assign_Array_StringRefRef(struct alt_Array_String* _instance, struct alt_Array_String* that); CAPI void alt_Array_String_Push(struct alt_Array_String* _instance, struct alt_String* el); CAPI void alt_Array_String_Reserve(struct alt_Array_String* _instance, unsigned long long size); CAPI unsigned long long alt_Array_String_GetSize(struct alt_Array_String* _instance); CAPI unsigned long long alt_Array_String_GetCapacity(struct alt_Array_String* _instance); CAPI struct alt_String* alt_Array_String_Access_uint64_t(struct alt_Array_String* _instance, unsigned long long key); CAPI struct alt_String* alt_Array_String_Access_uint64_t_1(struct alt_Array_String* _instance, unsigned long long key); CAPI struct alt_String* alt_Array_String_begin(struct alt_Array_String* _instance); CAPI struct alt_String* alt_Array_String_begin_1(struct alt_Array_String* _instance); CAPI struct alt_String* alt_Array_String_end(struct alt_Array_String* _instance); CAPI struct alt_String* alt_Array_String_end_1(struct alt_Array_String* _instance); typedef struct alt_IWeakRef { void* vtable; } alt_IWeakRef; CAPI void alt_IWeakRef_CAPI_Free(struct alt_IWeakRef* ptr); CAPI void alt_IWeakRef_OnDestroy(struct alt_IWeakRef* _instance); CAPI void alt_IWeakRef_Assign_constIWeakRefRef(struct alt_IWeakRef* _instance, struct alt_IWeakRef* _p0); CAPI void alt_IWeakRef_Assign_IWeakRefRefRef(struct alt_IWeakRef* _instance, struct alt_IWeakRef* _p0); CAPI unsigned long long alt_CRefCountable_GetRefCount(struct alt_CRefCountable* _instance); CAPI void alt_CRefCountable_AddRef(struct alt_CRefCountable* _instance); CAPI void alt_CRefCountable_RemoveRef(struct alt_CRefCountable* _instance); CAPI void alt_CRefCountable_AddWeakRef(struct alt_CRefCountable* _instance, struct alt_IWeakRef* ref); CAPI void alt_CRefCountable_RemoveWeakRef(struct alt_CRefCountable* _instance, struct alt_IWeakRef* ref); typedef struct alt_RefBase_RefStore_constIMValue { struct alt_IMValue* ptr; } alt_RefBase_RefStore_constIMValue; CAPI void alt_RefBase_RefStore_constIMValue_CAPI_Free(struct alt_RefBase_RefStore_constIMValue* ptr); CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefStore_constIMValue_to_alt_RefBase_RefStore_constIMValue(struct alt_RefStore_constIMValue* from); CAPI struct alt_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_to_alt_RefStore_constIMValue(struct alt_RefBase_RefStore_constIMValue* from); CAPI void alt_RefBase_RefStore_constIMValue_Assign(struct alt_RefBase_RefStore_constIMValue* _instance, struct alt_IMValue* _ptr); CAPI void alt_RefBase_RefStore_constIMValue_Free(struct alt_RefBase_RefStore_constIMValue* _instance); CAPI struct alt_IMValue* alt_RefBase_RefStore_constIMValue_Get(struct alt_RefBase_RefStore_constIMValue* _instance); CAPI void alt_RefBase_RefStore_constIMValue_Create(struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_CAPI_Heap(); CAPI void alt_RefBase_RefStore_constIMValue_Create_1(struct alt_RefStore_constIMValue* _p0, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_1_CAPI_Heap(struct alt_RefStore_constIMValue* _p0); CAPI void alt_RefBase_RefStore_constIMValue_Create_2(struct alt_RefStore_constIMValue* _p0, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_2_CAPI_Heap(struct alt_RefStore_constIMValue* _p0); CAPI void alt_RefBase_RefStore_constIMValue_Create_3(struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_3_CAPI_Heap(); CAPI void alt_RefBase_RefStore_constIMValue_Create_4(struct alt_IMValue* _ptr, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_4_CAPI_Heap(struct alt_IMValue* _ptr); CAPI void alt_RefBase_RefStore_constIMValue_Create_5(struct alt_RefBase_RefStore_constIMValue* other, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_5_CAPI_Heap(struct alt_RefBase_RefStore_constIMValue* other); CAPI void alt_RefBase_RefStore_constIMValue_Create_6(struct alt_RefBase_RefStore_constIMValue* other, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_6_CAPI_Heap(struct alt_RefBase_RefStore_constIMValue* other); CAPI void alt_RefBase_RefStore_constIMValue_Create_7(nullptr_t _p0, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_RefBase_RefStore_constIMValue_Create_7_CAPI_Heap(nullptr_t _p0); CAPI void alt_RefBase_RefStore_constIMValue_Assign_constRefBase_RefStore_constIMValueRef(struct alt_RefBase_RefStore_constIMValue* _instance, struct alt_RefBase_RefStore_constIMValue* that); CAPI _Bool alt_RefBase_RefStore_constIMValue_IsEmpty(struct alt_RefBase_RefStore_constIMValue* _instance); CAPI _Bool alt_RefBase_RefStore_constIMValue_To__Bool(struct alt_RefBase_RefStore_constIMValue* _instance); typedef struct alt_RefBase_RefStore_IBaseObject { struct alt_IBaseObject* ptr; } alt_RefBase_RefStore_IBaseObject; CAPI void alt_RefBase_RefStore_IBaseObject_CAPI_Free(struct alt_RefBase_RefStore_IBaseObject* ptr); CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefStore_IBaseObject_to_alt_RefBase_RefStore_IBaseObject(struct alt_RefStore_IBaseObject* from); CAPI struct alt_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_to_alt_RefStore_IBaseObject(struct alt_RefBase_RefStore_IBaseObject* from); CAPI void alt_RefBase_RefStore_IBaseObject_Assign(struct alt_RefBase_RefStore_IBaseObject* _instance, struct alt_IBaseObject* _ptr); CAPI void alt_RefBase_RefStore_IBaseObject_Free(struct alt_RefBase_RefStore_IBaseObject* _instance); CAPI struct alt_IBaseObject* alt_RefBase_RefStore_IBaseObject_Get(struct alt_RefBase_RefStore_IBaseObject* _instance); CAPI void alt_RefBase_RefStore_IBaseObject_Create(struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_Create_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IBaseObject_Create_1(struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_Create_1_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IBaseObject_Create_2(struct alt_IBaseObject* _ptr, struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_Create_2_CAPI_Heap(struct alt_IBaseObject* _ptr); CAPI void alt_RefBase_RefStore_IBaseObject_Create_3(struct alt_RefBase_RefStore_IBaseObject* other, struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_Create_3_CAPI_Heap(struct alt_RefBase_RefStore_IBaseObject* other); CAPI void alt_RefBase_RefStore_IBaseObject_Create_4(struct alt_RefBase_RefStore_IBaseObject* other, struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_Create_4_CAPI_Heap(struct alt_RefBase_RefStore_IBaseObject* other); CAPI void alt_RefBase_RefStore_IBaseObject_Create_5(nullptr_t _p0, struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_RefBase_RefStore_IBaseObject_Create_5_CAPI_Heap(nullptr_t _p0); CAPI void alt_RefBase_RefStore_IBaseObject_Assign_constRefBase_RefStore_IBaseObjectRef(struct alt_RefBase_RefStore_IBaseObject* _instance, struct alt_RefBase_RefStore_IBaseObject* that); CAPI _Bool alt_RefBase_RefStore_IBaseObject_IsEmpty(struct alt_RefBase_RefStore_IBaseObject* _instance); CAPI _Bool alt_RefBase_RefStore_IBaseObject_To__Bool(struct alt_RefBase_RefStore_IBaseObject* _instance); typedef struct alt_RefBase_RefStore_IPlayer { struct alt_IPlayer* ptr; } alt_RefBase_RefStore_IPlayer; CAPI void alt_RefBase_RefStore_IPlayer_CAPI_Free(struct alt_RefBase_RefStore_IPlayer* ptr); CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefStore_IPlayer_to_alt_RefBase_RefStore_IPlayer(struct alt_RefStore_IPlayer* from); CAPI struct alt_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_to_alt_RefStore_IPlayer(struct alt_RefBase_RefStore_IPlayer* from); CAPI void alt_RefBase_RefStore_IPlayer_Assign(struct alt_RefBase_RefStore_IPlayer* _instance, struct alt_IPlayer* _ptr); CAPI void alt_RefBase_RefStore_IPlayer_Free(struct alt_RefBase_RefStore_IPlayer* _instance); CAPI struct alt_IPlayer* alt_RefBase_RefStore_IPlayer_Get(struct alt_RefBase_RefStore_IPlayer* _instance); CAPI void alt_RefBase_RefStore_IPlayer_Create(struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IPlayer_Create_1(struct alt_RefStore_IPlayer* _p0, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_1_CAPI_Heap(struct alt_RefStore_IPlayer* _p0); CAPI void alt_RefBase_RefStore_IPlayer_Create_2(struct alt_RefStore_IPlayer* _p0, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_2_CAPI_Heap(struct alt_RefStore_IPlayer* _p0); CAPI void alt_RefBase_RefStore_IPlayer_Create_3(struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_3_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IPlayer_Create_4(struct alt_IPlayer* _ptr, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_4_CAPI_Heap(struct alt_IPlayer* _ptr); CAPI void alt_RefBase_RefStore_IPlayer_Create_5(struct alt_RefBase_RefStore_IPlayer* other, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_5_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* other); CAPI void alt_RefBase_RefStore_IPlayer_Create_6(struct alt_RefBase_RefStore_IPlayer* other, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_6_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* other); CAPI void alt_RefBase_RefStore_IPlayer_Create_7(nullptr_t _p0, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_RefBase_RefStore_IPlayer_Create_7_CAPI_Heap(nullptr_t _p0); CAPI void alt_RefBase_RefStore_IPlayer_Assign_constRefBase_RefStore_IPlayerRef(struct alt_RefBase_RefStore_IPlayer* _instance, struct alt_RefBase_RefStore_IPlayer* that); CAPI _Bool alt_RefBase_RefStore_IPlayer_IsEmpty(struct alt_RefBase_RefStore_IPlayer* _instance); CAPI _Bool alt_RefBase_RefStore_IPlayer_To__Bool(struct alt_RefBase_RefStore_IPlayer* _instance); typedef struct alt_RefBase_RefStore_IVehicle { struct alt_IVehicle* ptr; } alt_RefBase_RefStore_IVehicle; CAPI void alt_RefBase_RefStore_IVehicle_CAPI_Free(struct alt_RefBase_RefStore_IVehicle* ptr); CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefStore_IVehicle_to_alt_RefBase_RefStore_IVehicle(struct alt_RefStore_IVehicle* from); CAPI struct alt_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_to_alt_RefStore_IVehicle(struct alt_RefBase_RefStore_IVehicle* from); CAPI void alt_RefBase_RefStore_IVehicle_Assign(struct alt_RefBase_RefStore_IVehicle* _instance, struct alt_IVehicle* _ptr); CAPI void alt_RefBase_RefStore_IVehicle_Free(struct alt_RefBase_RefStore_IVehicle* _instance); CAPI struct alt_IVehicle* alt_RefBase_RefStore_IVehicle_Get(struct alt_RefBase_RefStore_IVehicle* _instance); CAPI void alt_RefBase_RefStore_IVehicle_Create(struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IVehicle_Create_1(struct alt_RefStore_IVehicle* _p0, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_1_CAPI_Heap(struct alt_RefStore_IVehicle* _p0); CAPI void alt_RefBase_RefStore_IVehicle_Create_2(struct alt_RefStore_IVehicle* _p0, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_2_CAPI_Heap(struct alt_RefStore_IVehicle* _p0); CAPI void alt_RefBase_RefStore_IVehicle_Create_3(struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_3_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IVehicle_Create_4(struct alt_IVehicle* _ptr, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_4_CAPI_Heap(struct alt_IVehicle* _ptr); CAPI void alt_RefBase_RefStore_IVehicle_Create_5(struct alt_RefBase_RefStore_IVehicle* other, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_5_CAPI_Heap(struct alt_RefBase_RefStore_IVehicle* other); CAPI void alt_RefBase_RefStore_IVehicle_Create_6(struct alt_RefBase_RefStore_IVehicle* other, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_6_CAPI_Heap(struct alt_RefBase_RefStore_IVehicle* other); CAPI void alt_RefBase_RefStore_IVehicle_Create_7(nullptr_t _p0, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_RefBase_RefStore_IVehicle_Create_7_CAPI_Heap(nullptr_t _p0); CAPI void alt_RefBase_RefStore_IVehicle_Assign_constRefBase_RefStore_IVehicleRef(struct alt_RefBase_RefStore_IVehicle* _instance, struct alt_RefBase_RefStore_IVehicle* that); CAPI _Bool alt_RefBase_RefStore_IVehicle_IsEmpty(struct alt_RefBase_RefStore_IVehicle* _instance); CAPI _Bool alt_RefBase_RefStore_IVehicle_To__Bool(struct alt_RefBase_RefStore_IVehicle* _instance); typedef struct alt_RefBase_RefStore_IEntity { struct alt_IEntity* ptr; } alt_RefBase_RefStore_IEntity; CAPI void alt_RefBase_RefStore_IEntity_CAPI_Free(struct alt_RefBase_RefStore_IEntity* ptr); CAPI struct alt_RefBase_RefStore_IEntity* alt_RefStore_IEntity_to_alt_RefBase_RefStore_IEntity(struct alt_RefStore_IEntity* from); CAPI struct alt_RefStore_IEntity* alt_RefBase_RefStore_IEntity_to_alt_RefStore_IEntity(struct alt_RefBase_RefStore_IEntity* from); CAPI void alt_RefBase_RefStore_IEntity_Assign(struct alt_RefBase_RefStore_IEntity* _instance, struct alt_IEntity* _ptr); CAPI void alt_RefBase_RefStore_IEntity_Free(struct alt_RefBase_RefStore_IEntity* _instance); CAPI struct alt_IEntity* alt_RefBase_RefStore_IEntity_Get(struct alt_RefBase_RefStore_IEntity* _instance); CAPI void alt_RefBase_RefStore_IEntity_Create(struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IEntity_Create_1(struct alt_RefStore_IEntity* _p0, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_1_CAPI_Heap(struct alt_RefStore_IEntity* _p0); CAPI void alt_RefBase_RefStore_IEntity_Create_2(struct alt_RefStore_IEntity* _p0, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_2_CAPI_Heap(struct alt_RefStore_IEntity* _p0); CAPI void alt_RefBase_RefStore_IEntity_Create_3(struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_3_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IEntity_Create_4(struct alt_IEntity* _ptr, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_4_CAPI_Heap(struct alt_IEntity* _ptr); CAPI void alt_RefBase_RefStore_IEntity_Create_5(struct alt_RefBase_RefStore_IEntity* other, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_5_CAPI_Heap(struct alt_RefBase_RefStore_IEntity* other); CAPI void alt_RefBase_RefStore_IEntity_Create_6(struct alt_RefBase_RefStore_IEntity* other, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_6_CAPI_Heap(struct alt_RefBase_RefStore_IEntity* other); CAPI void alt_RefBase_RefStore_IEntity_Create_7(nullptr_t _p0, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_RefBase_RefStore_IEntity_Create_7_CAPI_Heap(nullptr_t _p0); CAPI void alt_RefBase_RefStore_IEntity_Assign_constRefBase_RefStore_IEntityRef(struct alt_RefBase_RefStore_IEntity* _instance, struct alt_RefBase_RefStore_IEntity* that); CAPI _Bool alt_RefBase_RefStore_IEntity_IsEmpty(struct alt_RefBase_RefStore_IEntity* _instance); CAPI _Bool alt_RefBase_RefStore_IEntity_To__Bool(struct alt_RefBase_RefStore_IEntity* _instance); typedef struct alt_RefBase_RefStore_IColShape { struct alt_IColShape* ptr; } alt_RefBase_RefStore_IColShape; CAPI void alt_RefBase_RefStore_IColShape_CAPI_Free(struct alt_RefBase_RefStore_IColShape* ptr); CAPI struct alt_RefBase_RefStore_IColShape* alt_RefStore_IColShape_to_alt_RefBase_RefStore_IColShape(struct alt_RefStore_IColShape* from); CAPI struct alt_RefStore_IColShape* alt_RefBase_RefStore_IColShape_to_alt_RefStore_IColShape(struct alt_RefBase_RefStore_IColShape* from); CAPI void alt_RefBase_RefStore_IColShape_Assign(struct alt_RefBase_RefStore_IColShape* _instance, struct alt_IColShape* _ptr); CAPI void alt_RefBase_RefStore_IColShape_Free(struct alt_RefBase_RefStore_IColShape* _instance); CAPI struct alt_IColShape* alt_RefBase_RefStore_IColShape_Get(struct alt_RefBase_RefStore_IColShape* _instance); CAPI void alt_RefBase_RefStore_IColShape_Create(struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IColShape_Create_1(struct alt_RefStore_IColShape* _p0, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_1_CAPI_Heap(struct alt_RefStore_IColShape* _p0); CAPI void alt_RefBase_RefStore_IColShape_Create_2(struct alt_RefStore_IColShape* _p0, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_2_CAPI_Heap(struct alt_RefStore_IColShape* _p0); CAPI void alt_RefBase_RefStore_IColShape_Create_3(struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_3_CAPI_Heap(); CAPI void alt_RefBase_RefStore_IColShape_Create_4(struct alt_IColShape* _ptr, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_4_CAPI_Heap(struct alt_IColShape* _ptr); CAPI void alt_RefBase_RefStore_IColShape_Create_5(struct alt_RefBase_RefStore_IColShape* other, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_5_CAPI_Heap(struct alt_RefBase_RefStore_IColShape* other); CAPI void alt_RefBase_RefStore_IColShape_Create_6(struct alt_RefBase_RefStore_IColShape* other, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_6_CAPI_Heap(struct alt_RefBase_RefStore_IColShape* other); CAPI void alt_RefBase_RefStore_IColShape_Create_7(nullptr_t _p0, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_RefBase_RefStore_IColShape_Create_7_CAPI_Heap(nullptr_t _p0); CAPI void alt_RefBase_RefStore_IColShape_Assign_constRefBase_RefStore_IColShapeRef(struct alt_RefBase_RefStore_IColShape* _instance, struct alt_RefBase_RefStore_IColShape* that); CAPI _Bool alt_RefBase_RefStore_IColShape_IsEmpty(struct alt_RefBase_RefStore_IColShape* _instance); CAPI _Bool alt_RefBase_RefStore_IColShape_To__Bool(struct alt_RefBase_RefStore_IColShape* _instance); typedef struct alt_RefStore_constIMValue { struct alt_IMValue* ptr; } alt_RefStore_constIMValue; CAPI void alt_RefStore_constIMValue_CAPI_Free(struct alt_RefStore_constIMValue* ptr); CAPI void alt_RefStore_constIMValue_Assign(struct alt_RefStore_constIMValue* _instance, struct alt_IMValue* _ptr); CAPI void alt_RefStore_constIMValue_Free(struct alt_RefStore_constIMValue* _instance); CAPI struct alt_IMValue* alt_RefStore_constIMValue_Get(struct alt_RefStore_constIMValue* _instance); CAPI void alt_RefStore_constIMValue_Create(struct alt_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefStore_constIMValue* alt_RefStore_constIMValue_Create_CAPI_Heap(); CAPI void alt_RefStore_constIMValue_Create_1(struct alt_RefStore_constIMValue* _p0, struct alt_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefStore_constIMValue* alt_RefStore_constIMValue_Create_1_CAPI_Heap(struct alt_RefStore_constIMValue* _p0); CAPI void alt_RefStore_constIMValue_Create_2(struct alt_RefStore_constIMValue* _p0, struct alt_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefStore_constIMValue* alt_RefStore_constIMValue_Create_2_CAPI_Heap(struct alt_RefStore_constIMValue* _p0); typedef struct alt_RefStore_IBaseObject { struct alt_IBaseObject* ptr; } alt_RefStore_IBaseObject; CAPI void alt_RefStore_IBaseObject_CAPI_Free(struct alt_RefStore_IBaseObject* ptr); CAPI void alt_RefStore_IBaseObject_Assign(struct alt_RefStore_IBaseObject* _instance, struct alt_IBaseObject* _ptr); CAPI void alt_RefStore_IBaseObject_Free(struct alt_RefStore_IBaseObject* _instance); CAPI struct alt_IBaseObject* alt_RefStore_IBaseObject_Get(struct alt_RefStore_IBaseObject* _instance); CAPI void alt_RefStore_IBaseObject_Create(struct alt_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefStore_IBaseObject* alt_RefStore_IBaseObject_Create_CAPI_Heap(); typedef struct alt_RefStore_IPlayer { struct alt_IPlayer* ptr; } alt_RefStore_IPlayer; CAPI void alt_RefStore_IPlayer_CAPI_Free(struct alt_RefStore_IPlayer* ptr); CAPI void alt_RefStore_IPlayer_Assign(struct alt_RefStore_IPlayer* _instance, struct alt_IPlayer* _ptr); CAPI void alt_RefStore_IPlayer_Free(struct alt_RefStore_IPlayer* _instance); CAPI struct alt_IPlayer* alt_RefStore_IPlayer_Get(struct alt_RefStore_IPlayer* _instance); CAPI void alt_RefStore_IPlayer_Create(struct alt_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefStore_IPlayer* alt_RefStore_IPlayer_Create_CAPI_Heap(); CAPI void alt_RefStore_IPlayer_Create_1(struct alt_RefStore_IPlayer* _p0, struct alt_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefStore_IPlayer* alt_RefStore_IPlayer_Create_1_CAPI_Heap(struct alt_RefStore_IPlayer* _p0); CAPI void alt_RefStore_IPlayer_Create_2(struct alt_RefStore_IPlayer* _p0, struct alt_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefStore_IPlayer* alt_RefStore_IPlayer_Create_2_CAPI_Heap(struct alt_RefStore_IPlayer* _p0); typedef struct alt_RefStore_IVehicle { struct alt_IVehicle* ptr; } alt_RefStore_IVehicle; CAPI void alt_RefStore_IVehicle_CAPI_Free(struct alt_RefStore_IVehicle* ptr); CAPI void alt_RefStore_IVehicle_Assign(struct alt_RefStore_IVehicle* _instance, struct alt_IVehicle* _ptr); CAPI void alt_RefStore_IVehicle_Free(struct alt_RefStore_IVehicle* _instance); CAPI struct alt_IVehicle* alt_RefStore_IVehicle_Get(struct alt_RefStore_IVehicle* _instance); CAPI void alt_RefStore_IVehicle_Create(struct alt_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefStore_IVehicle* alt_RefStore_IVehicle_Create_CAPI_Heap(); CAPI void alt_RefStore_IVehicle_Create_1(struct alt_RefStore_IVehicle* _p0, struct alt_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefStore_IVehicle* alt_RefStore_IVehicle_Create_1_CAPI_Heap(struct alt_RefStore_IVehicle* _p0); CAPI void alt_RefStore_IVehicle_Create_2(struct alt_RefStore_IVehicle* _p0, struct alt_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefStore_IVehicle* alt_RefStore_IVehicle_Create_2_CAPI_Heap(struct alt_RefStore_IVehicle* _p0); typedef struct alt_RefStore_IEntity { struct alt_IEntity* ptr; } alt_RefStore_IEntity; CAPI void alt_RefStore_IEntity_CAPI_Free(struct alt_RefStore_IEntity* ptr); CAPI void alt_RefStore_IEntity_Assign(struct alt_RefStore_IEntity* _instance, struct alt_IEntity* _ptr); CAPI void alt_RefStore_IEntity_Free(struct alt_RefStore_IEntity* _instance); CAPI struct alt_IEntity* alt_RefStore_IEntity_Get(struct alt_RefStore_IEntity* _instance); CAPI void alt_RefStore_IEntity_Create(struct alt_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefStore_IEntity* alt_RefStore_IEntity_Create_CAPI_Heap(); CAPI void alt_RefStore_IEntity_Create_1(struct alt_RefStore_IEntity* _p0, struct alt_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefStore_IEntity* alt_RefStore_IEntity_Create_1_CAPI_Heap(struct alt_RefStore_IEntity* _p0); CAPI void alt_RefStore_IEntity_Create_2(struct alt_RefStore_IEntity* _p0, struct alt_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefStore_IEntity* alt_RefStore_IEntity_Create_2_CAPI_Heap(struct alt_RefStore_IEntity* _p0); typedef struct alt_RefStore_IColShape { struct alt_IColShape* ptr; } alt_RefStore_IColShape; CAPI void alt_RefStore_IColShape_CAPI_Free(struct alt_RefStore_IColShape* ptr); CAPI void alt_RefStore_IColShape_Assign(struct alt_RefStore_IColShape* _instance, struct alt_IColShape* _ptr); CAPI void alt_RefStore_IColShape_Free(struct alt_RefStore_IColShape* _instance); CAPI struct alt_IColShape* alt_RefStore_IColShape_Get(struct alt_RefStore_IColShape* _instance); CAPI void alt_RefStore_IColShape_Create(struct alt_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefStore_IColShape* alt_RefStore_IColShape_Create_CAPI_Heap(); CAPI void alt_RefStore_IColShape_Create_1(struct alt_RefStore_IColShape* _p0, struct alt_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefStore_IColShape* alt_RefStore_IColShape_Create_1_CAPI_Heap(struct alt_RefStore_IColShape* _p0); CAPI void alt_RefStore_IColShape_Create_2(struct alt_RefStore_IColShape* _p0, struct alt_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefStore_IColShape* alt_RefStore_IColShape_Create_2_CAPI_Heap(struct alt_RefStore_IColShape* _p0); CAPI struct alt_IMValue* alt_CRefCountable_to_alt_IMValue(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValue_to_alt_CRefCountable(struct alt_IMValue* from); CAPI unsigned long long alt_IMValue_GetRefCount(struct alt_IMValue* _instance); CAPI void alt_IMValue_AddRef(struct alt_IMValue* _instance); CAPI void alt_IMValue_RemoveRef(struct alt_IMValue* _instance); CAPI void alt_IMValue_AddWeakRef(struct alt_IMValue* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValue_RemoveWeakRef(struct alt_IMValue* _instance, struct alt_IWeakRef* ref); typedef enum alt_IMValue_Type { ALT_IMVALUE_TYPE_NONE = 0, ALT_IMVALUE_TYPE_NIL = 1, ALT_IMVALUE_TYPE_BOOL = 2, ALT_IMVALUE_TYPE_INT = 3, ALT_IMVALUE_TYPE_UINT = 4, ALT_IMVALUE_TYPE_DOUBLE = 5, ALT_IMVALUE_TYPE_STRING = 6, ALT_IMVALUE_TYPE_LIST = 7, ALT_IMVALUE_TYPE_DICT = 8, ALT_IMVALUE_TYPE_BASE_OBJECT = 9, ALT_IMVALUE_TYPE_FUNCTION = 10, ALT_IMVALUE_TYPE_VECTOR3 = 11, ALT_IMVALUE_TYPE_RGBA = 12, ALT_IMVALUE_TYPE_BYTE_ARRAY = 13 }; CAPI alt_IMValue_Type alt_IMValue_GetType(struct alt_IMValue* _instance); CAPI void alt_IMValue_ToString(struct alt_IMValue* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValue_ToString_CAPI_Heap(struct alt_IMValue* _instance); CAPI double alt_IMValue_ToNumber(struct alt_IMValue* _instance); CAPI void alt_IMValue_Clone(struct alt_IMValue* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValue_Clone_CAPI_Heap(struct alt_IMValue* _instance); CAPI void alt_IMValueNone_CAPI_Free(struct alt_IMValueNone* ptr); CAPI struct alt_IMValueNone* alt_CRefCountable_to_alt_IMValueNone(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueNone_to_alt_CRefCountable(struct alt_IMValueNone* from); CAPI unsigned long long alt_IMValueNone_GetRefCount(struct alt_IMValueNone* _instance); CAPI void alt_IMValueNone_AddRef(struct alt_IMValueNone* _instance); CAPI void alt_IMValueNone_RemoveRef(struct alt_IMValueNone* _instance); CAPI void alt_IMValueNone_AddWeakRef(struct alt_IMValueNone* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueNone_RemoveWeakRef(struct alt_IMValueNone* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueNone* alt_IMValue_to_alt_IMValueNone(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueNone_to_alt_IMValue(struct alt_IMValueNone* from); CAPI alt_IMValue_Type alt_IMValueNone_GetType(struct alt_IMValueNone* _instance); CAPI void alt_IMValueNone_ToString(struct alt_IMValueNone* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueNone_ToString_CAPI_Heap(struct alt_IMValueNone* _instance); CAPI double alt_IMValueNone_ToNumber(struct alt_IMValueNone* _instance); CAPI void alt_IMValueNone_Clone(struct alt_IMValueNone* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueNone_Clone_CAPI_Heap(struct alt_IMValueNone* _instance); CAPI void alt_IMValueNil_CAPI_Free(struct alt_IMValueNil* ptr); CAPI struct alt_IMValueNil* alt_CRefCountable_to_alt_IMValueNil(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueNil_to_alt_CRefCountable(struct alt_IMValueNil* from); CAPI unsigned long long alt_IMValueNil_GetRefCount(struct alt_IMValueNil* _instance); CAPI void alt_IMValueNil_AddRef(struct alt_IMValueNil* _instance); CAPI void alt_IMValueNil_RemoveRef(struct alt_IMValueNil* _instance); CAPI void alt_IMValueNil_AddWeakRef(struct alt_IMValueNil* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueNil_RemoveWeakRef(struct alt_IMValueNil* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueNil* alt_IMValue_to_alt_IMValueNil(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueNil_to_alt_IMValue(struct alt_IMValueNil* from); CAPI alt_IMValue_Type alt_IMValueNil_GetType(struct alt_IMValueNil* _instance); CAPI void alt_IMValueNil_ToString(struct alt_IMValueNil* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueNil_ToString_CAPI_Heap(struct alt_IMValueNil* _instance); CAPI double alt_IMValueNil_ToNumber(struct alt_IMValueNil* _instance); CAPI void alt_IMValueNil_Clone(struct alt_IMValueNil* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueNil_Clone_CAPI_Heap(struct alt_IMValueNil* _instance); CAPI void alt_IMValueBool_CAPI_Free(struct alt_IMValueBool* ptr); CAPI struct alt_IMValueBool* alt_CRefCountable_to_alt_IMValueBool(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueBool_to_alt_CRefCountable(struct alt_IMValueBool* from); CAPI unsigned long long alt_IMValueBool_GetRefCount(struct alt_IMValueBool* _instance); CAPI void alt_IMValueBool_AddRef(struct alt_IMValueBool* _instance); CAPI void alt_IMValueBool_RemoveRef(struct alt_IMValueBool* _instance); CAPI void alt_IMValueBool_AddWeakRef(struct alt_IMValueBool* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueBool_RemoveWeakRef(struct alt_IMValueBool* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueBool* alt_IMValue_to_alt_IMValueBool(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueBool_to_alt_IMValue(struct alt_IMValueBool* from); CAPI alt_IMValue_Type alt_IMValueBool_GetType(struct alt_IMValueBool* _instance); CAPI void alt_IMValueBool_ToString(struct alt_IMValueBool* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueBool_ToString_CAPI_Heap(struct alt_IMValueBool* _instance); CAPI double alt_IMValueBool_ToNumber(struct alt_IMValueBool* _instance); CAPI void alt_IMValueBool_Clone(struct alt_IMValueBool* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueBool_Clone_CAPI_Heap(struct alt_IMValueBool* _instance); CAPI _Bool alt_IMValueBool_Value(struct alt_IMValueBool* _instance); CAPI void alt_IMValueInt_CAPI_Free(struct alt_IMValueInt* ptr); CAPI struct alt_IMValueInt* alt_CRefCountable_to_alt_IMValueInt(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueInt_to_alt_CRefCountable(struct alt_IMValueInt* from); CAPI unsigned long long alt_IMValueInt_GetRefCount(struct alt_IMValueInt* _instance); CAPI void alt_IMValueInt_AddRef(struct alt_IMValueInt* _instance); CAPI void alt_IMValueInt_RemoveRef(struct alt_IMValueInt* _instance); CAPI void alt_IMValueInt_AddWeakRef(struct alt_IMValueInt* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueInt_RemoveWeakRef(struct alt_IMValueInt* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueInt* alt_IMValue_to_alt_IMValueInt(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueInt_to_alt_IMValue(struct alt_IMValueInt* from); CAPI alt_IMValue_Type alt_IMValueInt_GetType(struct alt_IMValueInt* _instance); CAPI void alt_IMValueInt_ToString(struct alt_IMValueInt* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueInt_ToString_CAPI_Heap(struct alt_IMValueInt* _instance); CAPI double alt_IMValueInt_ToNumber(struct alt_IMValueInt* _instance); CAPI void alt_IMValueInt_Clone(struct alt_IMValueInt* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueInt_Clone_CAPI_Heap(struct alt_IMValueInt* _instance); CAPI long long alt_IMValueInt_Value(struct alt_IMValueInt* _instance); CAPI void alt_IMValueUInt_CAPI_Free(struct alt_IMValueUInt* ptr); CAPI struct alt_IMValueUInt* alt_CRefCountable_to_alt_IMValueUInt(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueUInt_to_alt_CRefCountable(struct alt_IMValueUInt* from); CAPI unsigned long long alt_IMValueUInt_GetRefCount(struct alt_IMValueUInt* _instance); CAPI void alt_IMValueUInt_AddRef(struct alt_IMValueUInt* _instance); CAPI void alt_IMValueUInt_RemoveRef(struct alt_IMValueUInt* _instance); CAPI void alt_IMValueUInt_AddWeakRef(struct alt_IMValueUInt* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueUInt_RemoveWeakRef(struct alt_IMValueUInt* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueUInt* alt_IMValue_to_alt_IMValueUInt(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueUInt_to_alt_IMValue(struct alt_IMValueUInt* from); CAPI alt_IMValue_Type alt_IMValueUInt_GetType(struct alt_IMValueUInt* _instance); CAPI void alt_IMValueUInt_ToString(struct alt_IMValueUInt* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueUInt_ToString_CAPI_Heap(struct alt_IMValueUInt* _instance); CAPI double alt_IMValueUInt_ToNumber(struct alt_IMValueUInt* _instance); CAPI void alt_IMValueUInt_Clone(struct alt_IMValueUInt* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueUInt_Clone_CAPI_Heap(struct alt_IMValueUInt* _instance); CAPI unsigned long long alt_IMValueUInt_Value(struct alt_IMValueUInt* _instance); CAPI void alt_IMValueDouble_CAPI_Free(struct alt_IMValueDouble* ptr); CAPI struct alt_IMValueDouble* alt_CRefCountable_to_alt_IMValueDouble(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueDouble_to_alt_CRefCountable(struct alt_IMValueDouble* from); CAPI unsigned long long alt_IMValueDouble_GetRefCount(struct alt_IMValueDouble* _instance); CAPI void alt_IMValueDouble_AddRef(struct alt_IMValueDouble* _instance); CAPI void alt_IMValueDouble_RemoveRef(struct alt_IMValueDouble* _instance); CAPI void alt_IMValueDouble_AddWeakRef(struct alt_IMValueDouble* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueDouble_RemoveWeakRef(struct alt_IMValueDouble* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueDouble* alt_IMValue_to_alt_IMValueDouble(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueDouble_to_alt_IMValue(struct alt_IMValueDouble* from); CAPI alt_IMValue_Type alt_IMValueDouble_GetType(struct alt_IMValueDouble* _instance); CAPI void alt_IMValueDouble_ToString(struct alt_IMValueDouble* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueDouble_ToString_CAPI_Heap(struct alt_IMValueDouble* _instance); CAPI double alt_IMValueDouble_ToNumber(struct alt_IMValueDouble* _instance); CAPI void alt_IMValueDouble_Clone(struct alt_IMValueDouble* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueDouble_Clone_CAPI_Heap(struct alt_IMValueDouble* _instance); CAPI double alt_IMValueDouble_Value(struct alt_IMValueDouble* _instance); CAPI void alt_IMValueString_CAPI_Free(struct alt_IMValueString* ptr); CAPI struct alt_IMValueString* alt_CRefCountable_to_alt_IMValueString(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueString_to_alt_CRefCountable(struct alt_IMValueString* from); CAPI unsigned long long alt_IMValueString_GetRefCount(struct alt_IMValueString* _instance); CAPI void alt_IMValueString_AddRef(struct alt_IMValueString* _instance); CAPI void alt_IMValueString_RemoveRef(struct alt_IMValueString* _instance); CAPI void alt_IMValueString_AddWeakRef(struct alt_IMValueString* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueString_RemoveWeakRef(struct alt_IMValueString* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueString* alt_IMValue_to_alt_IMValueString(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueString_to_alt_IMValue(struct alt_IMValueString* from); CAPI alt_IMValue_Type alt_IMValueString_GetType(struct alt_IMValueString* _instance); CAPI void alt_IMValueString_ToString(struct alt_IMValueString* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueString_ToString_CAPI_Heap(struct alt_IMValueString* _instance); CAPI double alt_IMValueString_ToNumber(struct alt_IMValueString* _instance); CAPI void alt_IMValueString_Clone(struct alt_IMValueString* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueString_Clone_CAPI_Heap(struct alt_IMValueString* _instance); CAPI void alt_IMValueString_Value(struct alt_IMValueString* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IMValueString_Value_CAPI_Heap(struct alt_IMValueString* _instance); CAPI void alt_IMValueList_CAPI_Free(struct alt_IMValueList* ptr); CAPI struct alt_IMValueList* alt_CRefCountable_to_alt_IMValueList(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueList_to_alt_CRefCountable(struct alt_IMValueList* from); CAPI unsigned long long alt_IMValueList_GetRefCount(struct alt_IMValueList* _instance); CAPI void alt_IMValueList_AddRef(struct alt_IMValueList* _instance); CAPI void alt_IMValueList_RemoveRef(struct alt_IMValueList* _instance); CAPI void alt_IMValueList_AddWeakRef(struct alt_IMValueList* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueList_RemoveWeakRef(struct alt_IMValueList* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueList* alt_IMValue_to_alt_IMValueList(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueList_to_alt_IMValue(struct alt_IMValueList* from); CAPI alt_IMValue_Type alt_IMValueList_GetType(struct alt_IMValueList* _instance); CAPI void alt_IMValueList_ToString(struct alt_IMValueList* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueList_ToString_CAPI_Heap(struct alt_IMValueList* _instance); CAPI double alt_IMValueList_ToNumber(struct alt_IMValueList* _instance); CAPI void alt_IMValueList_Clone(struct alt_IMValueList* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueList_Clone_CAPI_Heap(struct alt_IMValueList* _instance); CAPI unsigned long long alt_IMValueList_GetSize(struct alt_IMValueList* _instance); CAPI void alt_IMValueList_Get(struct alt_IMValueList* _instance, unsigned long long i, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueList_Get_CAPI_Heap(struct alt_IMValueList* _instance, unsigned long long i); CAPI void alt_IMValueList_Get_1(struct alt_IMValueList* _instance, unsigned long long i, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IMValueList_Get_1_CAPI_Heap(struct alt_IMValueList* _instance, unsigned long long i); CAPI void alt_IMValueList_Set(struct alt_IMValueList* _instance, unsigned long long i, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IMValueList_Push(struct alt_IMValueList* _instance, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IMValueList_SetConst(struct alt_IMValueList* _instance, unsigned long long i, struct alt_RefBase_RefStore_constIMValue* val); CAPI void alt_IMValueList_PushConst(struct alt_IMValueList* _instance, struct alt_RefBase_RefStore_constIMValue* val); CAPI void alt_IMValueDict_CAPI_Free(struct alt_IMValueDict* ptr); CAPI struct alt_IMValueDict* alt_CRefCountable_to_alt_IMValueDict(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueDict_to_alt_CRefCountable(struct alt_IMValueDict* from); CAPI unsigned long long alt_IMValueDict_GetRefCount(struct alt_IMValueDict* _instance); CAPI void alt_IMValueDict_AddRef(struct alt_IMValueDict* _instance); CAPI void alt_IMValueDict_RemoveRef(struct alt_IMValueDict* _instance); CAPI void alt_IMValueDict_AddWeakRef(struct alt_IMValueDict* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueDict_RemoveWeakRef(struct alt_IMValueDict* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueDict* alt_IMValue_to_alt_IMValueDict(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueDict_to_alt_IMValue(struct alt_IMValueDict* from); CAPI alt_IMValue_Type alt_IMValueDict_GetType(struct alt_IMValueDict* _instance); CAPI void alt_IMValueDict_ToString(struct alt_IMValueDict* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueDict_ToString_CAPI_Heap(struct alt_IMValueDict* _instance); CAPI double alt_IMValueDict_ToNumber(struct alt_IMValueDict* _instance); CAPI void alt_IMValueDict_Clone(struct alt_IMValueDict* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueDict_Clone_CAPI_Heap(struct alt_IMValueDict* _instance); CAPI unsigned long long alt_IMValueDict_GetSize(struct alt_IMValueDict* _instance); CAPI void alt_IMValueDict_Get(struct alt_IMValueDict* _instance, struct alt_String* key, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueDict_Get_CAPI_Heap(struct alt_IMValueDict* _instance, struct alt_String* key); CAPI void alt_IMValueDict_Get_1(struct alt_IMValueDict* _instance, struct alt_String* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IMValueDict_Get_1_CAPI_Heap(struct alt_IMValueDict* _instance, struct alt_String* key); CAPI void alt_IMValueDict_Set(struct alt_IMValueDict* _instance, struct alt_String* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IMValueDict_SetConst(struct alt_IMValueDict* _instance, struct alt_String* key, struct alt_RefBase_RefStore_constIMValue* val); CAPI void alt_IMValueDict_Delete(struct alt_IMValueDict* _instance, struct alt_String* key); CAPI struct alt_IMValueDict_Iterator* alt_IMValueDict_Begin(struct alt_IMValueDict* _instance); CAPI struct alt_IMValueDict_Iterator* alt_IMValueDict_Next(struct alt_IMValueDict* _instance); typedef struct alt_IMValueDict_Iterator { void* vtable; } alt_IMValueDict_Iterator; CAPI void alt_IMValueDict_Iterator_CAPI_Free(struct alt_IMValueDict_Iterator* ptr); CAPI void alt_IMValueDict_Iterator_GetKey(struct alt_IMValueDict_Iterator* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueDict_Iterator_GetKey_CAPI_Heap(struct alt_IMValueDict_Iterator* _instance); CAPI void alt_IMValueDict_Iterator_GetValue(struct alt_IMValueDict_Iterator* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IMValueDict_Iterator_GetValue_CAPI_Heap(struct alt_IMValueDict_Iterator* _instance); CAPI void alt_IMValueDict_Iterator_Assign_constIMValueDict_IteratorRef(struct alt_IMValueDict_Iterator* _instance, struct alt_IMValueDict_Iterator* _p0); CAPI void alt_IMValueDict_Iterator_Assign_IMValueDict_IteratorRefRef(struct alt_IMValueDict_Iterator* _instance, struct alt_IMValueDict_Iterator* _p0); CAPI void alt_IMValueBaseObject_CAPI_Free(struct alt_IMValueBaseObject* ptr); CAPI struct alt_IMValueBaseObject* alt_CRefCountable_to_alt_IMValueBaseObject(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueBaseObject_to_alt_CRefCountable(struct alt_IMValueBaseObject* from); CAPI unsigned long long alt_IMValueBaseObject_GetRefCount(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueBaseObject_AddRef(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueBaseObject_RemoveRef(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueBaseObject_AddWeakRef(struct alt_IMValueBaseObject* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueBaseObject_RemoveWeakRef(struct alt_IMValueBaseObject* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueBaseObject* alt_IMValue_to_alt_IMValueBaseObject(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueBaseObject_to_alt_IMValue(struct alt_IMValueBaseObject* from); CAPI alt_IMValue_Type alt_IMValueBaseObject_GetType(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueBaseObject_ToString(struct alt_IMValueBaseObject* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueBaseObject_ToString_CAPI_Heap(struct alt_IMValueBaseObject* _instance); CAPI double alt_IMValueBaseObject_ToNumber(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueBaseObject_Clone(struct alt_IMValueBaseObject* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueBaseObject_Clone_CAPI_Heap(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueBaseObject_Value(struct alt_IMValueBaseObject* _instance, struct alt_RefBase_RefStore_IBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBaseObject* alt_IMValueBaseObject_Value_CAPI_Heap(struct alt_IMValueBaseObject* _instance); CAPI void alt_IMValueFunction_CAPI_Free(struct alt_IMValueFunction* ptr); CAPI struct alt_IMValueFunction* alt_CRefCountable_to_alt_IMValueFunction(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueFunction_to_alt_CRefCountable(struct alt_IMValueFunction* from); CAPI unsigned long long alt_IMValueFunction_GetRefCount(struct alt_IMValueFunction* _instance); CAPI void alt_IMValueFunction_AddRef(struct alt_IMValueFunction* _instance); CAPI void alt_IMValueFunction_RemoveRef(struct alt_IMValueFunction* _instance); CAPI void alt_IMValueFunction_AddWeakRef(struct alt_IMValueFunction* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueFunction_RemoveWeakRef(struct alt_IMValueFunction* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueFunction* alt_IMValue_to_alt_IMValueFunction(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueFunction_to_alt_IMValue(struct alt_IMValueFunction* from); CAPI alt_IMValue_Type alt_IMValueFunction_GetType(struct alt_IMValueFunction* _instance); CAPI void alt_IMValueFunction_ToString(struct alt_IMValueFunction* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueFunction_ToString_CAPI_Heap(struct alt_IMValueFunction* _instance); CAPI double alt_IMValueFunction_ToNumber(struct alt_IMValueFunction* _instance); CAPI void alt_IMValueFunction_Clone(struct alt_IMValueFunction* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueFunction_Clone_CAPI_Heap(struct alt_IMValueFunction* _instance); CAPI void alt_IMValueFunction_Call(struct alt_IMValueFunction* _instance, struct alt_Array_RefBase_RefStore_constIMValue* args, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueFunction_Call_CAPI_Heap(struct alt_IMValueFunction* _instance, struct alt_Array_RefBase_RefStore_constIMValue* args); typedef struct alt_IMValueFunction_Impl { void* vtable; unsigned long long refCount; } alt_IMValueFunction_Impl; CAPI void alt_IMValueFunction_Impl_Call(struct alt_IMValueFunction_Impl* _instance, struct alt_Array_RefBase_RefStore_constIMValue* args, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueFunction_Impl_Call_CAPI_Heap(struct alt_IMValueFunction_Impl* _instance, struct alt_Array_RefBase_RefStore_constIMValue* args); CAPI void alt_IMValueFunction_Impl_AddRef(struct alt_IMValueFunction_Impl* _instance); CAPI void alt_IMValueFunction_Impl_RemoveRef(struct alt_IMValueFunction_Impl* _instance); CAPI void alt_IMValueFunction_Impl_Assign_constIMValueFunction_ImplRef(struct alt_IMValueFunction_Impl* _instance, struct alt_IMValueFunction_Impl* _p0); CAPI void alt_IMValueVector3_CAPI_Free(struct alt_IMValueVector3* ptr); CAPI struct alt_IMValueVector3* alt_CRefCountable_to_alt_IMValueVector3(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueVector3_to_alt_CRefCountable(struct alt_IMValueVector3* from); CAPI unsigned long long alt_IMValueVector3_GetRefCount(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueVector3_AddRef(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueVector3_RemoveRef(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueVector3_AddWeakRef(struct alt_IMValueVector3* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueVector3_RemoveWeakRef(struct alt_IMValueVector3* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueVector3* alt_IMValue_to_alt_IMValueVector3(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueVector3_to_alt_IMValue(struct alt_IMValueVector3* from); CAPI alt_IMValue_Type alt_IMValueVector3_GetType(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueVector3_ToString(struct alt_IMValueVector3* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueVector3_ToString_CAPI_Heap(struct alt_IMValueVector3* _instance); CAPI double alt_IMValueVector3_ToNumber(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueVector3_Clone(struct alt_IMValueVector3* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueVector3_Clone_CAPI_Heap(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueVector3_Value(struct alt_IMValueVector3* _instance, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_IMValueVector3_Value_CAPI_Heap(struct alt_IMValueVector3* _instance); CAPI void alt_IMValueRGBA_CAPI_Free(struct alt_IMValueRGBA* ptr); CAPI struct alt_IMValueRGBA* alt_CRefCountable_to_alt_IMValueRGBA(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueRGBA_to_alt_CRefCountable(struct alt_IMValueRGBA* from); CAPI unsigned long long alt_IMValueRGBA_GetRefCount(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueRGBA_AddRef(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueRGBA_RemoveRef(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueRGBA_AddWeakRef(struct alt_IMValueRGBA* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueRGBA_RemoveWeakRef(struct alt_IMValueRGBA* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueRGBA* alt_IMValue_to_alt_IMValueRGBA(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueRGBA_to_alt_IMValue(struct alt_IMValueRGBA* from); CAPI alt_IMValue_Type alt_IMValueRGBA_GetType(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueRGBA_ToString(struct alt_IMValueRGBA* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueRGBA_ToString_CAPI_Heap(struct alt_IMValueRGBA* _instance); CAPI double alt_IMValueRGBA_ToNumber(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueRGBA_Clone(struct alt_IMValueRGBA* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueRGBA_Clone_CAPI_Heap(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueRGBA_Value(struct alt_IMValueRGBA* _instance, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_IMValueRGBA_Value_CAPI_Heap(struct alt_IMValueRGBA* _instance); CAPI void alt_IMValueByteArray_CAPI_Free(struct alt_IMValueByteArray* ptr); CAPI struct alt_IMValueByteArray* alt_CRefCountable_to_alt_IMValueByteArray(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IMValueByteArray_to_alt_CRefCountable(struct alt_IMValueByteArray* from); CAPI unsigned long long alt_IMValueByteArray_GetRefCount(struct alt_IMValueByteArray* _instance); CAPI void alt_IMValueByteArray_AddRef(struct alt_IMValueByteArray* _instance); CAPI void alt_IMValueByteArray_RemoveRef(struct alt_IMValueByteArray* _instance); CAPI void alt_IMValueByteArray_AddWeakRef(struct alt_IMValueByteArray* _instance, struct alt_IWeakRef* ref); CAPI void alt_IMValueByteArray_RemoveWeakRef(struct alt_IMValueByteArray* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IMValueByteArray* alt_IMValue_to_alt_IMValueByteArray(struct alt_IMValue* from); CAPI struct alt_IMValue* alt_IMValueByteArray_to_alt_IMValue(struct alt_IMValueByteArray* from); CAPI alt_IMValue_Type alt_IMValueByteArray_GetType(struct alt_IMValueByteArray* _instance); CAPI void alt_IMValueByteArray_ToString(struct alt_IMValueByteArray* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IMValueByteArray_ToString_CAPI_Heap(struct alt_IMValueByteArray* _instance); CAPI double alt_IMValueByteArray_ToNumber(struct alt_IMValueByteArray* _instance); CAPI void alt_IMValueByteArray_Clone(struct alt_IMValueByteArray* _instance, struct alt_RefBase_RefStore_IMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValue* alt_IMValueByteArray_Clone_CAPI_Heap(struct alt_IMValueByteArray* _instance); CAPI unsigned long long alt_IMValueByteArray_GetSize(struct alt_IMValueByteArray* _instance); CAPI unsigned char* alt_IMValueByteArray_GetData(struct alt_IMValueByteArray* _instance); CAPI unsigned char* alt_IMValueByteArray_GetData_1(struct alt_IMValueByteArray* _instance); CAPI struct alt_IBaseObject* alt_CRefCountable_to_alt_IBaseObject(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IBaseObject_to_alt_CRefCountable(struct alt_IBaseObject* from); CAPI unsigned long long alt_IBaseObject_GetRefCount(struct alt_IBaseObject* _instance); CAPI void alt_IBaseObject_AddRef(struct alt_IBaseObject* _instance); CAPI void alt_IBaseObject_RemoveRef(struct alt_IBaseObject* _instance); CAPI void alt_IBaseObject_AddWeakRef(struct alt_IBaseObject* _instance, struct alt_IWeakRef* ref); CAPI void alt_IBaseObject_RemoveWeakRef(struct alt_IBaseObject* _instance, struct alt_IWeakRef* ref); typedef enum alt_IBaseObject_Type { ALT_IBASEOBJECT_TYPE_PLAYER = 0, ALT_IBASEOBJECT_TYPE_VEHICLE = 1, ALT_IBASEOBJECT_TYPE_BLIP = 2, ALT_IBASEOBJECT_TYPE_WEBVIEW = 3, ALT_IBASEOBJECT_TYPE_VOICE_CHANNEL = 4, ALT_IBASEOBJECT_TYPE_COLSHAPE = 5, ALT_IBASEOBJECT_TYPE_CHECKPOINT = 6 }; CAPI alt_IBaseObject_Type alt_IBaseObject_GetType(struct alt_IBaseObject* _instance); CAPI _Bool alt_IBaseObject_HasMetaData(struct alt_IBaseObject* _instance, struct alt_StringView* key); CAPI void alt_IBaseObject_GetMetaData(struct alt_IBaseObject* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IBaseObject_GetMetaData_CAPI_Heap(struct alt_IBaseObject* _instance, struct alt_StringView* key); CAPI void alt_IBaseObject_SetMetaData(struct alt_IBaseObject* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IBaseObject_DeleteMetaData(struct alt_IBaseObject* _instance, struct alt_StringView* key); CAPI struct alt_IWorldObject* alt_CRefCountable_to_alt_IWorldObject(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IWorldObject_to_alt_CRefCountable(struct alt_IWorldObject* from); CAPI unsigned long long alt_IWorldObject_GetRefCount(struct alt_IWorldObject* _instance); CAPI void alt_IWorldObject_AddRef(struct alt_IWorldObject* _instance); CAPI void alt_IWorldObject_RemoveRef(struct alt_IWorldObject* _instance); CAPI void alt_IWorldObject_AddWeakRef(struct alt_IWorldObject* _instance, struct alt_IWeakRef* ref); CAPI void alt_IWorldObject_RemoveWeakRef(struct alt_IWorldObject* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IWorldObject* alt_IBaseObject_to_alt_IWorldObject(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IWorldObject_to_alt_IBaseObject(struct alt_IWorldObject* from); CAPI alt_IBaseObject_Type alt_IWorldObject_GetType(struct alt_IWorldObject* _instance); CAPI _Bool alt_IWorldObject_HasMetaData(struct alt_IWorldObject* _instance, struct alt_StringView* key); CAPI void alt_IWorldObject_GetMetaData(struct alt_IWorldObject* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IWorldObject_GetMetaData_CAPI_Heap(struct alt_IWorldObject* _instance, struct alt_StringView* key); CAPI void alt_IWorldObject_SetMetaData(struct alt_IWorldObject* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IWorldObject_DeleteMetaData(struct alt_IWorldObject* _instance, struct alt_StringView* key); CAPI void alt_IWorldObject_GetPosition(struct alt_IWorldObject* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IWorldObject_GetPosition_CAPI_Heap(struct alt_IWorldObject* _instance); CAPI void alt_IWorldObject_SetPosition(struct alt_IWorldObject* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_IWorldObject_GetDimension(struct alt_IWorldObject* _instance); CAPI void alt_IWorldObject_SetDimension(struct alt_IWorldObject* _instance, int dimension); CAPI struct alt_IEntity* alt_CRefCountable_to_alt_IEntity(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IEntity_to_alt_CRefCountable(struct alt_IEntity* from); CAPI unsigned long long alt_IEntity_GetRefCount(struct alt_IEntity* _instance); CAPI void alt_IEntity_AddRef(struct alt_IEntity* _instance); CAPI void alt_IEntity_RemoveRef(struct alt_IEntity* _instance); CAPI void alt_IEntity_AddWeakRef(struct alt_IEntity* _instance, struct alt_IWeakRef* ref); CAPI void alt_IEntity_RemoveWeakRef(struct alt_IEntity* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IEntity* alt_IBaseObject_to_alt_IEntity(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IEntity_to_alt_IBaseObject(struct alt_IEntity* from); CAPI alt_IBaseObject_Type alt_IEntity_GetType(struct alt_IEntity* _instance); CAPI _Bool alt_IEntity_HasMetaData(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI void alt_IEntity_GetMetaData(struct alt_IEntity* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IEntity_GetMetaData_CAPI_Heap(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI void alt_IEntity_SetMetaData(struct alt_IEntity* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IEntity_DeleteMetaData(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI struct alt_IEntity* alt_IWorldObject_to_alt_IEntity(struct alt_IWorldObject* from); CAPI struct alt_IWorldObject* alt_IEntity_to_alt_IWorldObject(struct alt_IEntity* from); CAPI void alt_IEntity_GetPosition(struct alt_IEntity* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IEntity_GetPosition_CAPI_Heap(struct alt_IEntity* _instance); CAPI void alt_IEntity_SetPosition(struct alt_IEntity* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_IEntity_GetDimension(struct alt_IEntity* _instance); CAPI void alt_IEntity_SetDimension(struct alt_IEntity* _instance, int dimension); CAPI unsigned short alt_IEntity_GetID(struct alt_IEntity* _instance); CAPI void alt_IEntity_GetNetworkOwner(struct alt_IEntity* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_IEntity_GetNetworkOwner_CAPI_Heap(struct alt_IEntity* _instance); CAPI unsigned int alt_IEntity_GetModel(struct alt_IEntity* _instance); CAPI void alt_IEntity_GetRotation(struct alt_IEntity* _instance, struct alt_Vector_float_3_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_RotationLayout_CAPI_Free() CAPI struct alt_Vector_float_3_RotationLayout* alt_IEntity_GetRotation_CAPI_Heap(struct alt_IEntity* _instance); CAPI void alt_IEntity_SetRotation(struct alt_IEntity* _instance, struct alt_Vector_float_3_RotationLayout* rot); CAPI _Bool alt_IEntity_HasSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI void alt_IEntity_GetSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IEntity_GetSyncedMetaData_CAPI_Heap(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI _Bool alt_IEntity_HasStreamSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI void alt_IEntity_GetStreamSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IEntity_GetStreamSyncedMetaData_CAPI_Heap(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI void alt_IEntity_SetSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IEntity_DeleteSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI void alt_IEntity_SetStreamSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IEntity_DeleteStreamSyncedMetaData(struct alt_IEntity* _instance, struct alt_StringView* key); CAPI struct alt_IPlayer* alt_CRefCountable_to_alt_IPlayer(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IPlayer_to_alt_CRefCountable(struct alt_IPlayer* from); CAPI unsigned long long alt_IPlayer_GetRefCount(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_AddRef(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_RemoveRef(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_AddWeakRef(struct alt_IPlayer* _instance, struct alt_IWeakRef* ref); CAPI void alt_IPlayer_RemoveWeakRef(struct alt_IPlayer* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IPlayer* alt_IBaseObject_to_alt_IPlayer(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IPlayer_to_alt_IBaseObject(struct alt_IPlayer* from); CAPI alt_IBaseObject_Type alt_IPlayer_GetType(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_HasMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI void alt_IPlayer_GetMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IPlayer_GetMetaData_CAPI_Heap(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI void alt_IPlayer_SetMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IPlayer_DeleteMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI struct alt_IPlayer* alt_IWorldObject_to_alt_IPlayer(struct alt_IWorldObject* from); CAPI struct alt_IWorldObject* alt_IPlayer_to_alt_IWorldObject(struct alt_IPlayer* from); CAPI void alt_IPlayer_GetPosition(struct alt_IPlayer* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IPlayer_GetPosition_CAPI_Heap(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetPosition(struct alt_IPlayer* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_IPlayer_GetDimension(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetDimension(struct alt_IPlayer* _instance, int dimension); CAPI struct alt_IPlayer* alt_IEntity_to_alt_IPlayer(struct alt_IEntity* from); CAPI struct alt_IEntity* alt_IPlayer_to_alt_IEntity(struct alt_IPlayer* from); CAPI unsigned short alt_IPlayer_GetID(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetNetworkOwner(struct alt_IPlayer* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_IPlayer_GetNetworkOwner_CAPI_Heap(struct alt_IPlayer* _instance); CAPI unsigned int alt_IPlayer_GetModel(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetRotation(struct alt_IPlayer* _instance, struct alt_Vector_float_3_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_RotationLayout_CAPI_Free() CAPI struct alt_Vector_float_3_RotationLayout* alt_IPlayer_GetRotation_CAPI_Heap(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetRotation(struct alt_IPlayer* _instance, struct alt_Vector_float_3_RotationLayout* rot); CAPI _Bool alt_IPlayer_HasSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI void alt_IPlayer_GetSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IPlayer_GetSyncedMetaData_CAPI_Heap(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI _Bool alt_IPlayer_HasStreamSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI void alt_IPlayer_GetStreamSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IPlayer_GetStreamSyncedMetaData_CAPI_Heap(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI void alt_IPlayer_SetSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IPlayer_DeleteSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI void alt_IPlayer_SetStreamSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IPlayer_DeleteStreamSyncedMetaData(struct alt_IPlayer* _instance, struct alt_StringView* key); CAPI _Bool alt_IPlayer_IsConnected(struct alt_IPlayer* _instance); CAPI unsigned int alt_IPlayer_GetPing(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetIP(struct alt_IPlayer* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IPlayer_GetIP_CAPI_Heap(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_Spawn(struct alt_IPlayer* _instance, struct alt_Vector_float_3_PointLayout* pos, unsigned int delayMs); CAPI void alt_IPlayer_Despawn(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetName(struct alt_IPlayer* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IPlayer_GetName_CAPI_Heap(struct alt_IPlayer* _instance); CAPI unsigned long long alt_IPlayer_GetSocialID(struct alt_IPlayer* _instance); CAPI unsigned long long alt_IPlayer_GetHwidHash(struct alt_IPlayer* _instance); CAPI unsigned long long alt_IPlayer_GetHwidExHash(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetAuthToken(struct alt_IPlayer* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IPlayer_GetAuthToken_CAPI_Heap(struct alt_IPlayer* _instance); CAPI unsigned short alt_IPlayer_GetHealth(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetHealth(struct alt_IPlayer* _instance, unsigned short health); CAPI unsigned short alt_IPlayer_GetMaxHealth(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetMaxHealth(struct alt_IPlayer* _instance, unsigned short health); CAPI void alt_IPlayer_SetDateTime(struct alt_IPlayer* _instance, int day, int month, int year, int hour, int minute, int second); CAPI void alt_IPlayer_SetWeather(struct alt_IPlayer* _instance, unsigned int weather); CAPI void alt_IPlayer_GiveWeapon(struct alt_IPlayer* _instance, unsigned int weapon, int ammo, _Bool selectWeapon); CAPI void alt_IPlayer_RemoveWeapon(struct alt_IPlayer* _instance, unsigned int weapon); CAPI void alt_IPlayer_RemoveAllWeapons(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_AddWeaponComponent(struct alt_IPlayer* _instance, unsigned int weapon, unsigned int component); CAPI void alt_IPlayer_RemoveWeaponComponent(struct alt_IPlayer* _instance, unsigned int weapon, unsigned int component); CAPI void alt_IPlayer_GetCurrentWeaponComponents(struct alt_IPlayer* _instance, struct alt_Array_unsignedint* _returnValue); // Return ptr must be manually freed with alt_Array_unsignedint_CAPI_Free() CAPI struct alt_Array_unsignedint* alt_IPlayer_GetCurrentWeaponComponents_CAPI_Heap(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetWeaponTintIndex(struct alt_IPlayer* _instance, unsigned int weapon, unsigned char tintIndex); CAPI unsigned char alt_IPlayer_GetCurrentWeaponTintIndex(struct alt_IPlayer* _instance); CAPI unsigned int alt_IPlayer_GetCurrentWeapon(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetCurrentWeapon(struct alt_IPlayer* _instance, unsigned int weapon); CAPI _Bool alt_IPlayer_IsDead(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsJumping(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsInRagdoll(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsAiming(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsShooting(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsReloading(struct alt_IPlayer* _instance); CAPI unsigned short alt_IPlayer_GetArmour(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetArmour(struct alt_IPlayer* _instance, unsigned short armor); CAPI unsigned short alt_IPlayer_GetMaxArmour(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_SetMaxArmour(struct alt_IPlayer* _instance, unsigned short armor); CAPI float alt_IPlayer_GetMoveSpeed(struct alt_IPlayer* _instance); CAPI unsigned int alt_IPlayer_GetWeapon(struct alt_IPlayer* _instance); CAPI unsigned short alt_IPlayer_GetAmmo(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetAimPos(struct alt_IPlayer* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IPlayer_GetAimPos_CAPI_Heap(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetHeadRotation(struct alt_IPlayer* _instance, struct alt_Vector_float_3_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_RotationLayout_CAPI_Free() CAPI struct alt_Vector_float_3_RotationLayout* alt_IPlayer_GetHeadRotation_CAPI_Heap(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsInVehicle(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetVehicle(struct alt_IPlayer* _instance, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_IPlayer_GetVehicle_CAPI_Heap(struct alt_IPlayer* _instance); CAPI unsigned char alt_IPlayer_GetSeat(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetEntityAimingAt(struct alt_IPlayer* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_IPlayer_GetEntityAimingAt_CAPI_Heap(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_GetEntityAimOffset(struct alt_IPlayer* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IPlayer_GetEntityAimOffset_CAPI_Heap(struct alt_IPlayer* _instance); CAPI _Bool alt_IPlayer_IsFlashlightActive(struct alt_IPlayer* _instance); CAPI void alt_IPlayer_Kick(struct alt_IPlayer* _instance, struct alt_StringView* reason); CAPI void alt_IPlayer_SetModel(struct alt_IPlayer* _instance, unsigned int model); CAPI struct alt_IVehicle* alt_CRefCountable_to_alt_IVehicle(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IVehicle_to_alt_CRefCountable(struct alt_IVehicle* from); CAPI unsigned long long alt_IVehicle_GetRefCount(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_AddRef(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_RemoveRef(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_AddWeakRef(struct alt_IVehicle* _instance, struct alt_IWeakRef* ref); CAPI void alt_IVehicle_RemoveWeakRef(struct alt_IVehicle* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IVehicle* alt_IBaseObject_to_alt_IVehicle(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IVehicle_to_alt_IBaseObject(struct alt_IVehicle* from); CAPI alt_IBaseObject_Type alt_IVehicle_GetType(struct alt_IVehicle* _instance); CAPI _Bool alt_IVehicle_HasMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_GetMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IVehicle_GetMetaData_CAPI_Heap(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_SetMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IVehicle_DeleteMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI struct alt_IVehicle* alt_IWorldObject_to_alt_IVehicle(struct alt_IWorldObject* from); CAPI struct alt_IWorldObject* alt_IVehicle_to_alt_IWorldObject(struct alt_IVehicle* from); CAPI void alt_IVehicle_GetPosition(struct alt_IVehicle* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IVehicle_GetPosition_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetPosition(struct alt_IVehicle* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_IVehicle_GetDimension(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetDimension(struct alt_IVehicle* _instance, int dimension); CAPI struct alt_IVehicle* alt_IEntity_to_alt_IVehicle(struct alt_IEntity* from); CAPI struct alt_IEntity* alt_IVehicle_to_alt_IEntity(struct alt_IVehicle* from); CAPI unsigned short alt_IVehicle_GetID(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetNetworkOwner(struct alt_IVehicle* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_IVehicle_GetNetworkOwner_CAPI_Heap(struct alt_IVehicle* _instance); CAPI unsigned int alt_IVehicle_GetModel(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetRotation(struct alt_IVehicle* _instance, struct alt_Vector_float_3_RotationLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_RotationLayout_CAPI_Free() CAPI struct alt_Vector_float_3_RotationLayout* alt_IVehicle_GetRotation_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetRotation(struct alt_IVehicle* _instance, struct alt_Vector_float_3_RotationLayout* rot); CAPI _Bool alt_IVehicle_HasSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_GetSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IVehicle_GetSyncedMetaData_CAPI_Heap(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI _Bool alt_IVehicle_HasStreamSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_GetStreamSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IVehicle_GetStreamSyncedMetaData_CAPI_Heap(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_SetSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IVehicle_DeleteSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_SetStreamSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IVehicle_DeleteStreamSyncedMetaData(struct alt_IVehicle* _instance, struct alt_StringView* key); CAPI void alt_IVehicle_GetDriver(struct alt_IVehicle* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_IVehicle_GetDriver_CAPI_Heap(struct alt_IVehicle* _instance); CAPI _Bool alt_IVehicle_IsDestroyed(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetMod(struct alt_IVehicle* _instance, unsigned char category); CAPI unsigned char alt_IVehicle_GetModsCount(struct alt_IVehicle* _instance, unsigned char category); CAPI _Bool alt_IVehicle_SetMod(struct alt_IVehicle* _instance, unsigned char category, unsigned char id); CAPI unsigned char alt_IVehicle_GetModKitsCount(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetModKit(struct alt_IVehicle* _instance); CAPI _Bool alt_IVehicle_SetModKit(struct alt_IVehicle* _instance, unsigned char id); CAPI _Bool alt_IVehicle_IsPrimaryColorRGB(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetPrimaryColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetPrimaryColorRGB(struct alt_IVehicle* _instance, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_IVehicle_GetPrimaryColorRGB_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetPrimaryColor(struct alt_IVehicle* _instance, unsigned char color); CAPI void alt_IVehicle_SetPrimaryColorRGB(struct alt_IVehicle* _instance, struct alt_RGBA* color); CAPI _Bool alt_IVehicle_IsSecondaryColorRGB(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetSecondaryColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetSecondaryColorRGB(struct alt_IVehicle* _instance, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_IVehicle_GetSecondaryColorRGB_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetSecondaryColor(struct alt_IVehicle* _instance, unsigned char color); CAPI void alt_IVehicle_SetSecondaryColorRGB(struct alt_IVehicle* _instance, struct alt_RGBA* color); CAPI unsigned char alt_IVehicle_GetPearlColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetPearlColor(struct alt_IVehicle* _instance, unsigned char color); CAPI unsigned char alt_IVehicle_GetWheelColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetWheelColor(struct alt_IVehicle* _instance, unsigned char color); CAPI unsigned char alt_IVehicle_GetInteriorColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetInteriorColor(struct alt_IVehicle* _instance, unsigned char color); CAPI unsigned char alt_IVehicle_GetDashboardColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetDashboardColor(struct alt_IVehicle* _instance, unsigned char color); CAPI _Bool alt_IVehicle_IsTireSmokeColorCustom(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetTireSmokeColor(struct alt_IVehicle* _instance, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_IVehicle_GetTireSmokeColor_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetTireSmokeColor(struct alt_IVehicle* _instance, struct alt_RGBA* color); CAPI unsigned char alt_IVehicle_GetWheelType(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetWheelVariation(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetRearWheelVariation(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetWheels(struct alt_IVehicle* _instance, unsigned char type, unsigned char variation); CAPI void alt_IVehicle_SetRearWheels(struct alt_IVehicle* _instance, unsigned char variation); CAPI _Bool alt_IVehicle_GetCustomTires(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetCustomTires(struct alt_IVehicle* _instance, _Bool state); CAPI unsigned char alt_IVehicle_GetSpecialDarkness(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetSpecialDarkness(struct alt_IVehicle* _instance, unsigned char value); CAPI unsigned int alt_IVehicle_GetNumberplateIndex(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetNumberplateIndex(struct alt_IVehicle* _instance, unsigned int index); CAPI void alt_IVehicle_GetNumberplateText(struct alt_IVehicle* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IVehicle_GetNumberplateText_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetNumberplateText(struct alt_IVehicle* _instance, struct alt_StringView* text); CAPI unsigned char alt_IVehicle_GetWindowTint(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetWindowTint(struct alt_IVehicle* _instance, unsigned char tint); CAPI unsigned char alt_IVehicle_GetDirtLevel(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetDirtLevel(struct alt_IVehicle* _instance, unsigned char level); CAPI _Bool alt_IVehicle_IsExtraOn(struct alt_IVehicle* _instance, unsigned char extraID); CAPI void alt_IVehicle_ToggleExtra(struct alt_IVehicle* _instance, unsigned char extraID, _Bool state); CAPI _Bool alt_IVehicle_IsNeonActive(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetNeonActive(struct alt_IVehicle* _instance, _Bool* left, _Bool* right, _Bool* front, _Bool* back); CAPI void alt_IVehicle_SetNeonActive(struct alt_IVehicle* _instance, _Bool left, _Bool right, _Bool front, _Bool back); CAPI void alt_IVehicle_GetNeonColor(struct alt_IVehicle* _instance, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_IVehicle_GetNeonColor_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetNeonColor(struct alt_IVehicle* _instance, struct alt_RGBA* color); CAPI unsigned char alt_IVehicle_GetLivery(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetLivery(struct alt_IVehicle* _instance, unsigned char livery); CAPI unsigned char alt_IVehicle_GetRoofLivery(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetRoofLivery(struct alt_IVehicle* _instance, unsigned char roofLivery); CAPI void alt_IVehicle_GetAppearanceDataBase64(struct alt_IVehicle* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IVehicle_GetAppearanceDataBase64_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_LoadAppearanceDataFromBase64(struct alt_IVehicle* _instance, struct alt_StringView* base64); CAPI _Bool alt_IVehicle_IsEngineOn(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetEngineOn(struct alt_IVehicle* _instance, _Bool state); CAPI _Bool alt_IVehicle_IsHandbrakeActive(struct alt_IVehicle* _instance); CAPI unsigned char alt_IVehicle_GetHeadlightColor(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetHeadlightColor(struct alt_IVehicle* _instance, unsigned char color); CAPI unsigned int alt_IVehicle_GetRadioStationIndex(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetRadioStationIndex(struct alt_IVehicle* _instance, unsigned int stationIndex); CAPI _Bool alt_IVehicle_IsSirenActive(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetSirenActive(struct alt_IVehicle* _instance, _Bool state); CAPI unsigned char alt_IVehicle_GetLockState(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetLockState(struct alt_IVehicle* _instance, unsigned char state); CAPI unsigned char alt_IVehicle_GetDoorState(struct alt_IVehicle* _instance, unsigned char doorId); CAPI void alt_IVehicle_SetDoorState(struct alt_IVehicle* _instance, unsigned char doorId, unsigned char state); CAPI _Bool alt_IVehicle_IsWindowOpened(struct alt_IVehicle* _instance, unsigned char windowId); CAPI void alt_IVehicle_SetWindowOpened(struct alt_IVehicle* _instance, unsigned char windowId, _Bool state); CAPI _Bool alt_IVehicle_IsDaylightOn(struct alt_IVehicle* _instance); CAPI _Bool alt_IVehicle_IsNightlightOn(struct alt_IVehicle* _instance); CAPI _Bool alt_IVehicle_IsRoofOpened(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetRoofOpened(struct alt_IVehicle* _instance, _Bool state); CAPI _Bool alt_IVehicle_IsFlamethrowerActive(struct alt_IVehicle* _instance); CAPI float alt_IVehicle_GetLightsMultiplier(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetLightsMultiplier(struct alt_IVehicle* _instance, float multiplier); CAPI void alt_IVehicle_GetGameStateBase64(struct alt_IVehicle* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IVehicle_GetGameStateBase64_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_LoadGameStateFromBase64(struct alt_IVehicle* _instance, struct alt_StringView* base64); CAPI int alt_IVehicle_GetEngineHealth(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetEngineHealth(struct alt_IVehicle* _instance, int health); CAPI int alt_IVehicle_GetPetrolTankHealth(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetPetrolTankHealth(struct alt_IVehicle* _instance, int health); CAPI unsigned char alt_IVehicle_GetWheelsCount(struct alt_IVehicle* _instance); CAPI _Bool alt_IVehicle_IsWheelBurst(struct alt_IVehicle* _instance, unsigned char wheelId); CAPI void alt_IVehicle_SetWheelBurst(struct alt_IVehicle* _instance, unsigned char wheelId, _Bool state); CAPI _Bool alt_IVehicle_DoesWheelHasTire(struct alt_IVehicle* _instance, unsigned char wheelId); CAPI void alt_IVehicle_SetWheelHasTire(struct alt_IVehicle* _instance, unsigned char wheelId, _Bool state); CAPI _Bool alt_IVehicle_IsWheelDetached(struct alt_IVehicle* _instance, unsigned char wheelId); CAPI void alt_IVehicle_SetWheelDetached(struct alt_IVehicle* _instance, unsigned char wheelId, _Bool state); CAPI _Bool alt_IVehicle_IsWheelOnFire(struct alt_IVehicle* _instance, unsigned char wheelId); CAPI void alt_IVehicle_SetWheelOnFire(struct alt_IVehicle* _instance, unsigned char wheelId, _Bool state); CAPI float alt_IVehicle_GetWheelHealth(struct alt_IVehicle* _instance, unsigned char wheelId); CAPI void alt_IVehicle_SetWheelHealth(struct alt_IVehicle* _instance, unsigned char wheelId, float health); CAPI unsigned char alt_IVehicle_GetRepairsCount(struct alt_IVehicle* _instance); CAPI unsigned int alt_IVehicle_GetBodyHealth(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetBodyHealth(struct alt_IVehicle* _instance, unsigned int health); CAPI unsigned int alt_IVehicle_GetBodyAdditionalHealth(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_SetBodyAdditionalHealth(struct alt_IVehicle* _instance, unsigned int health); CAPI void alt_IVehicle_GetHealthDataBase64(struct alt_IVehicle* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IVehicle_GetHealthDataBase64_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_LoadHealthDataFromBase64(struct alt_IVehicle* _instance, struct alt_StringView* base64); CAPI unsigned char alt_IVehicle_GetPartDamageLevel(struct alt_IVehicle* _instance, unsigned char partId); CAPI void alt_IVehicle_SetPartDamageLevel(struct alt_IVehicle* _instance, unsigned char partId, unsigned char damage); CAPI unsigned char alt_IVehicle_GetPartBulletHoles(struct alt_IVehicle* _instance, unsigned char partId); CAPI void alt_IVehicle_SetPartBulletHoles(struct alt_IVehicle* _instance, unsigned char partId, unsigned char shootsCount); CAPI _Bool alt_IVehicle_IsLightDamaged(struct alt_IVehicle* _instance, unsigned char lightId); CAPI void alt_IVehicle_SetLightDamaged(struct alt_IVehicle* _instance, unsigned char lightId, _Bool isDamaged); CAPI _Bool alt_IVehicle_IsWindowDamaged(struct alt_IVehicle* _instance, unsigned char windowId); CAPI void alt_IVehicle_SetWindowDamaged(struct alt_IVehicle* _instance, unsigned char windowId, _Bool isDamaged); CAPI _Bool alt_IVehicle_IsSpecialLightDamaged(struct alt_IVehicle* _instance, unsigned char specialLightId); CAPI void alt_IVehicle_SetSpecialLightDamaged(struct alt_IVehicle* _instance, unsigned char specialLightId, _Bool isDamaged); CAPI _Bool alt_IVehicle_HasArmoredWindows(struct alt_IVehicle* _instance); CAPI float alt_IVehicle_GetArmoredWindowHealth(struct alt_IVehicle* _instance, unsigned char windowId); CAPI void alt_IVehicle_SetArmoredWindowHealth(struct alt_IVehicle* _instance, unsigned char windowId, float health); CAPI unsigned char alt_IVehicle_GetArmoredWindowShootCount(struct alt_IVehicle* _instance, unsigned char windowId); CAPI void alt_IVehicle_SetArmoredWindowShootCount(struct alt_IVehicle* _instance, unsigned char windowId, unsigned char count); CAPI unsigned char alt_IVehicle_GetBumperDamageLevel(struct alt_IVehicle* _instance, unsigned char bumperId); CAPI void alt_IVehicle_SetBumperDamageLevel(struct alt_IVehicle* _instance, unsigned char bumperId, unsigned char damageLevel); CAPI void alt_IVehicle_GetDamageDataBase64(struct alt_IVehicle* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IVehicle_GetDamageDataBase64_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_LoadDamageDataFromBase64(struct alt_IVehicle* _instance, struct alt_StringView* base64); CAPI void alt_IVehicle_SetManualEngineControl(struct alt_IVehicle* _instance, _Bool state); CAPI _Bool alt_IVehicle_IsManualEngineControl(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_GetScriptDataBase64(struct alt_IVehicle* _instance, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_IVehicle_GetScriptDataBase64_CAPI_Heap(struct alt_IVehicle* _instance); CAPI void alt_IVehicle_LoadScriptDataFromBase64(struct alt_IVehicle* _instance, struct alt_StringView* base64); CAPI _Bool alt_IVehicle_IsDestroyed_1(struct alt_IVehicle* _instance); CAPI struct alt_IColShape* alt_CRefCountable_to_alt_IColShape(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IColShape_to_alt_CRefCountable(struct alt_IColShape* from); CAPI unsigned long long alt_IColShape_GetRefCount(struct alt_IColShape* _instance); CAPI void alt_IColShape_AddRef(struct alt_IColShape* _instance); CAPI void alt_IColShape_RemoveRef(struct alt_IColShape* _instance); CAPI void alt_IColShape_AddWeakRef(struct alt_IColShape* _instance, struct alt_IWeakRef* ref); CAPI void alt_IColShape_RemoveWeakRef(struct alt_IColShape* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IColShape* alt_IBaseObject_to_alt_IColShape(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IColShape_to_alt_IBaseObject(struct alt_IColShape* from); CAPI alt_IBaseObject_Type alt_IColShape_GetType(struct alt_IColShape* _instance); CAPI _Bool alt_IColShape_HasMetaData(struct alt_IColShape* _instance, struct alt_StringView* key); CAPI void alt_IColShape_GetMetaData(struct alt_IColShape* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IColShape_GetMetaData_CAPI_Heap(struct alt_IColShape* _instance, struct alt_StringView* key); CAPI void alt_IColShape_SetMetaData(struct alt_IColShape* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IColShape_DeleteMetaData(struct alt_IColShape* _instance, struct alt_StringView* key); CAPI struct alt_IColShape* alt_IWorldObject_to_alt_IColShape(struct alt_IWorldObject* from); CAPI struct alt_IWorldObject* alt_IColShape_to_alt_IWorldObject(struct alt_IColShape* from); CAPI void alt_IColShape_GetPosition(struct alt_IColShape* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IColShape_GetPosition_CAPI_Heap(struct alt_IColShape* _instance); CAPI void alt_IColShape_SetPosition(struct alt_IColShape* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_IColShape_GetDimension(struct alt_IColShape* _instance); CAPI void alt_IColShape_SetDimension(struct alt_IColShape* _instance, int dimension); typedef enum alt_IColShape_ColShapeType { ALT_ICOLSHAPE_COLSHAPETYPE_SPHERE = 0, ALT_ICOLSHAPE_COLSHAPETYPE_CYLINDER = 1, ALT_ICOLSHAPE_COLSHAPETYPE_CIRCLE = 2, ALT_ICOLSHAPE_COLSHAPETYPE_CUBOID = 3, ALT_ICOLSHAPE_COLSHAPETYPE_RECT = 4, ALT_ICOLSHAPE_COLSHAPETYPE_CHECKPOINT_CYLINDER = 5 }; CAPI alt_IColShape_ColShapeType alt_IColShape_GetColshapeType(struct alt_IColShape* _instance); CAPI _Bool alt_IColShape_IsEntityIn(struct alt_IColShape* _instance, struct alt_RefBase_RefStore_IEntity* ent); CAPI _Bool alt_IColShape_IsPointIn(struct alt_IColShape* _instance, struct alt_Vector_float_3_PointLayout* p); CAPI struct alt_ICheckpoint* alt_CRefCountable_to_alt_ICheckpoint(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_ICheckpoint_to_alt_CRefCountable(struct alt_ICheckpoint* from); CAPI unsigned long long alt_ICheckpoint_GetRefCount(struct alt_ICheckpoint* _instance); CAPI void alt_ICheckpoint_AddRef(struct alt_ICheckpoint* _instance); CAPI void alt_ICheckpoint_RemoveRef(struct alt_ICheckpoint* _instance); CAPI void alt_ICheckpoint_AddWeakRef(struct alt_ICheckpoint* _instance, struct alt_IWeakRef* ref); CAPI void alt_ICheckpoint_RemoveWeakRef(struct alt_ICheckpoint* _instance, struct alt_IWeakRef* ref); CAPI struct alt_ICheckpoint* alt_IBaseObject_to_alt_ICheckpoint(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_ICheckpoint_to_alt_IBaseObject(struct alt_ICheckpoint* from); CAPI alt_IBaseObject_Type alt_ICheckpoint_GetType(struct alt_ICheckpoint* _instance); CAPI _Bool alt_ICheckpoint_HasMetaData(struct alt_ICheckpoint* _instance, struct alt_StringView* key); CAPI void alt_ICheckpoint_GetMetaData(struct alt_ICheckpoint* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_ICheckpoint_GetMetaData_CAPI_Heap(struct alt_ICheckpoint* _instance, struct alt_StringView* key); CAPI void alt_ICheckpoint_SetMetaData(struct alt_ICheckpoint* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_ICheckpoint_DeleteMetaData(struct alt_ICheckpoint* _instance, struct alt_StringView* key); CAPI struct alt_ICheckpoint* alt_IWorldObject_to_alt_ICheckpoint(struct alt_IWorldObject* from); CAPI struct alt_IWorldObject* alt_ICheckpoint_to_alt_IWorldObject(struct alt_ICheckpoint* from); CAPI void alt_ICheckpoint_GetPosition(struct alt_ICheckpoint* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_ICheckpoint_GetPosition_CAPI_Heap(struct alt_ICheckpoint* _instance); CAPI void alt_ICheckpoint_SetPosition(struct alt_ICheckpoint* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_ICheckpoint_GetDimension(struct alt_ICheckpoint* _instance); CAPI void alt_ICheckpoint_SetDimension(struct alt_ICheckpoint* _instance, int dimension); CAPI struct alt_ICheckpoint* alt_IColShape_to_alt_ICheckpoint(struct alt_IColShape* from); CAPI struct alt_IColShape* alt_ICheckpoint_to_alt_IColShape(struct alt_ICheckpoint* from); CAPI alt_IColShape_ColShapeType alt_ICheckpoint_GetColshapeType(struct alt_ICheckpoint* _instance); CAPI _Bool alt_ICheckpoint_IsEntityIn(struct alt_ICheckpoint* _instance, struct alt_RefBase_RefStore_IEntity* ent); CAPI _Bool alt_ICheckpoint_IsPointIn(struct alt_ICheckpoint* _instance, struct alt_Vector_float_3_PointLayout* p); CAPI unsigned char alt_ICheckpoint_GetCheckpointType(struct alt_ICheckpoint* _instance); CAPI float alt_ICheckpoint_GetHeight(struct alt_ICheckpoint* _instance); CAPI float alt_ICheckpoint_GetRadius(struct alt_ICheckpoint* _instance); CAPI void alt_ICheckpoint_GetColor(struct alt_ICheckpoint* _instance, struct alt_RGBA* _returnValue); // Return ptr must be manually freed with alt_RGBA_CAPI_Free() CAPI struct alt_RGBA* alt_ICheckpoint_GetColor_CAPI_Heap(struct alt_ICheckpoint* _instance); CAPI struct alt_IBlip* alt_CRefCountable_to_alt_IBlip(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IBlip_to_alt_CRefCountable(struct alt_IBlip* from); CAPI unsigned long long alt_IBlip_GetRefCount(struct alt_IBlip* _instance); CAPI void alt_IBlip_AddRef(struct alt_IBlip* _instance); CAPI void alt_IBlip_RemoveRef(struct alt_IBlip* _instance); CAPI void alt_IBlip_AddWeakRef(struct alt_IBlip* _instance, struct alt_IWeakRef* ref); CAPI void alt_IBlip_RemoveWeakRef(struct alt_IBlip* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IBlip* alt_IBaseObject_to_alt_IBlip(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IBlip_to_alt_IBaseObject(struct alt_IBlip* from); CAPI alt_IBaseObject_Type alt_IBlip_GetType(struct alt_IBlip* _instance); CAPI _Bool alt_IBlip_HasMetaData(struct alt_IBlip* _instance, struct alt_StringView* key); CAPI void alt_IBlip_GetMetaData(struct alt_IBlip* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IBlip_GetMetaData_CAPI_Heap(struct alt_IBlip* _instance, struct alt_StringView* key); CAPI void alt_IBlip_SetMetaData(struct alt_IBlip* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IBlip_DeleteMetaData(struct alt_IBlip* _instance, struct alt_StringView* key); CAPI struct alt_IBlip* alt_IWorldObject_to_alt_IBlip(struct alt_IWorldObject* from); CAPI struct alt_IWorldObject* alt_IBlip_to_alt_IWorldObject(struct alt_IBlip* from); CAPI void alt_IBlip_GetPosition(struct alt_IBlip* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_IBlip_GetPosition_CAPI_Heap(struct alt_IBlip* _instance); CAPI void alt_IBlip_SetPosition(struct alt_IBlip* _instance, struct alt_Vector_float_3_PointLayout* pos); CAPI int alt_IBlip_GetDimension(struct alt_IBlip* _instance); CAPI void alt_IBlip_SetDimension(struct alt_IBlip* _instance, int dimension); CAPI _Bool alt_IBlip_IsGlobal(struct alt_IBlip* _instance); CAPI void alt_IBlip_GetTarget(struct alt_IBlip* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_IBlip_GetTarget_CAPI_Heap(struct alt_IBlip* _instance); CAPI _Bool alt_IBlip_IsAttached(struct alt_IBlip* _instance); CAPI void alt_IBlip_AttachedTo(struct alt_IBlip* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_IBlip_AttachedTo_CAPI_Heap(struct alt_IBlip* _instance); typedef enum alt_IBlip_BlipType { ALT_IBLIP_BLIPTYPE_VEHICLE = 1, ALT_IBLIP_BLIPTYPE_PED = 2, ALT_IBLIP_BLIPTYPE_OBJECT = 3, ALT_IBLIP_BLIPTYPE_DESTINATION = 4, ALT_IBLIP_BLIPTYPE_CONT = 5, ALT_IBLIP_BLIPTYPE_PICKUP_UNK = 6, ALT_IBLIP_BLIPTYPE_RADIUS = 7, ALT_IBLIP_BLIPTYPE_PICKUP = 8, ALT_IBLIP_BLIPTYPE_COP = 9, ALT_IBLIP_BLIPTYPE_AREA = 11, ALT_IBLIP_BLIPTYPE_GALLERY = 12, ALT_IBLIP_BLIPTYPE_PICKUP_OBJECT = 13 }; CAPI alt_IBlip_BlipType alt_IBlip_GetBlipType(struct alt_IBlip* _instance); CAPI void alt_IBlip_SetSprite(struct alt_IBlip* _instance, unsigned short sprite); CAPI void alt_IBlip_SetColor(struct alt_IBlip* _instance, unsigned char color); CAPI void alt_IBlip_SetRoute(struct alt_IBlip* _instance, _Bool state); CAPI void alt_IBlip_SetRouteColor(struct alt_IBlip* _instance, unsigned char color); CAPI struct alt_IVoiceChannel* alt_CRefCountable_to_alt_IVoiceChannel(struct alt_CRefCountable* from); CAPI struct alt_CRefCountable* alt_IVoiceChannel_to_alt_CRefCountable(struct alt_IVoiceChannel* from); CAPI unsigned long long alt_IVoiceChannel_GetRefCount(struct alt_IVoiceChannel* _instance); CAPI void alt_IVoiceChannel_AddRef(struct alt_IVoiceChannel* _instance); CAPI void alt_IVoiceChannel_RemoveRef(struct alt_IVoiceChannel* _instance); CAPI void alt_IVoiceChannel_AddWeakRef(struct alt_IVoiceChannel* _instance, struct alt_IWeakRef* ref); CAPI void alt_IVoiceChannel_RemoveWeakRef(struct alt_IVoiceChannel* _instance, struct alt_IWeakRef* ref); CAPI struct alt_IVoiceChannel* alt_IBaseObject_to_alt_IVoiceChannel(struct alt_IBaseObject* from); CAPI struct alt_IBaseObject* alt_IVoiceChannel_to_alt_IBaseObject(struct alt_IVoiceChannel* from); CAPI alt_IBaseObject_Type alt_IVoiceChannel_GetType(struct alt_IVoiceChannel* _instance); CAPI _Bool alt_IVoiceChannel_HasMetaData(struct alt_IVoiceChannel* _instance, struct alt_StringView* key); CAPI void alt_IVoiceChannel_GetMetaData(struct alt_IVoiceChannel* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_IVoiceChannel_GetMetaData_CAPI_Heap(struct alt_IVoiceChannel* _instance, struct alt_StringView* key); CAPI void alt_IVoiceChannel_SetMetaData(struct alt_IVoiceChannel* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_IVoiceChannel_DeleteMetaData(struct alt_IVoiceChannel* _instance, struct alt_StringView* key); CAPI _Bool alt_IVoiceChannel_IsSpatial(struct alt_IVoiceChannel* _instance); CAPI float alt_IVoiceChannel_GetMaxDistance(struct alt_IVoiceChannel* _instance); CAPI _Bool alt_IVoiceChannel_HasPlayer(struct alt_IVoiceChannel* _instance, struct alt_RefBase_RefStore_IPlayer* player); CAPI void alt_IVoiceChannel_AddPlayer(struct alt_IVoiceChannel* _instance, struct alt_RefBase_RefStore_IPlayer* player); CAPI void alt_IVoiceChannel_RemovePlayer(struct alt_IVoiceChannel* _instance, struct alt_RefBase_RefStore_IPlayer* player); CAPI _Bool alt_IVoiceChannel_IsPlayerMuted(struct alt_IVoiceChannel* _instance, struct alt_RefBase_RefStore_IPlayer* player); CAPI void alt_IVoiceChannel_MutePlayer(struct alt_IVoiceChannel* _instance, struct alt_RefBase_RefStore_IPlayer* player); CAPI void alt_IVoiceChannel_UnmutePlayer(struct alt_IVoiceChannel* _instance, struct alt_RefBase_RefStore_IPlayer* player); typedef enum alt_CEvent_Type { ALT_CEVENT_TYPE_NONE = 0, ALT_CEVENT_TYPE_PLAYER_CONNECT = 1, ALT_CEVENT_TYPE_PLAYER_DISCONNECT = 2, ALT_CEVENT_TYPE_RESOURCE_START = 3, ALT_CEVENT_TYPE_RESOURCE_STOP = 4, ALT_CEVENT_TYPE_RESOURCE_ERROR = 5, ALT_CEVENT_TYPE_SERVER_SCRIPT_EVENT = 6, ALT_CEVENT_TYPE_CLIENT_SCRIPT_EVENT = 7, ALT_CEVENT_TYPE_META_CHANGE = 8, ALT_CEVENT_TYPE_SYNCED_META_CHANGE = 9, ALT_CEVENT_TYPE_STREAM_SYNCED_META_CHANGE = 10, ALT_CEVENT_TYPE_GLOBAL_META_CHANGE = 11, ALT_CEVENT_TYPE_GLOBAL_SYNCED_META_CHANGE = 12, ALT_CEVENT_TYPE_PLAYER_DAMAGE = 13, ALT_CEVENT_TYPE_PLAYER_DEATH = 14, ALT_CEVENT_TYPE_FIRE_EVENT = 15, ALT_CEVENT_TYPE_EXPLOSION_EVENT = 16, ALT_CEVENT_TYPE_WEAPON_DAMAGE_EVENT = 17, ALT_CEVENT_TYPE_VEHICLE_DESTROY = 18, ALT_CEVENT_TYPE_CHECKPOINT_EVENT = 19, ALT_CEVENT_TYPE_COLSHAPE_EVENT = 20, ALT_CEVENT_TYPE_PLAYER_ENTER_VEHICLE = 21, ALT_CEVENT_TYPE_PLAYER_LEAVE_VEHICLE = 22, ALT_CEVENT_TYPE_PLAYER_CHANGE_VEHICLE_SEAT = 23, ALT_CEVENT_TYPE_REMOVE_ENTITY_EVENT = 24, ALT_CEVENT_TYPE_DATA_NODE_RECEIVED_EVENT = 25, ALT_CEVENT_TYPE_CONSOLE_COMMAND_EVENT = 26, ALT_CEVENT_TYPE_CONNECTION_COMPLETE = 27, ALT_CEVENT_TYPE_DISCONNECT_EVENT = 28, ALT_CEVENT_TYPE_WEB_VIEW_EVENT = 29, ALT_CEVENT_TYPE_KEYBOARD_EVENT = 30, ALT_CEVENT_TYPE_GAME_ENTITY_CREATE = 31, ALT_CEVENT_TYPE_GAME_ENTITY_DESTROY = 32, ALT_CEVENT_TYPE_ALL = 33, ALT_CEVENT_TYPE_SIZE = 34 }; typedef struct alt_CEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; } alt_CEvent; CAPI void alt_CEvent_CAPI_Free(struct alt_CEvent* ptr); CAPI void alt_CEvent_Create(alt_CEvent_Type _type, struct alt_CEvent* _returnValue); // Return ptr must be manually freed with alt_CEvent_CAPI_Free() CAPI struct alt_CEvent* alt_CEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CEvent_GetType(struct alt_CEvent* _instance); CAPI _Bool alt_CEvent_WasCancelled(struct alt_CEvent* _instance); CAPI void alt_CEvent_Cancel(struct alt_CEvent* _instance); CAPI void alt_CEvent_Create_1(struct alt_CEvent* _p0, struct alt_CEvent* _returnValue); // Return ptr must be manually freed with alt_CEvent_CAPI_Free() CAPI struct alt_CEvent* alt_CEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CEvent_Assign_constCEventRef(struct alt_CEvent* _instance, struct alt_CEvent* _p0); typedef struct alt_CServerScriptEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_String name; struct alt_Array_RefBase_RefStore_constIMValue args; } alt_CServerScriptEvent; CAPI void alt_CServerScriptEvent_CAPI_Free(struct alt_CServerScriptEvent* ptr); CAPI struct alt_CServerScriptEvent* alt_CEvent_to_alt_CServerScriptEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CServerScriptEvent_to_alt_CEvent(struct alt_CServerScriptEvent* from); CAPI void alt_CServerScriptEvent_Create(alt_CEvent_Type _type, struct alt_CServerScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CServerScriptEvent_CAPI_Free() CAPI struct alt_CServerScriptEvent* alt_CServerScriptEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CServerScriptEvent_GetType(struct alt_CServerScriptEvent* _instance); CAPI _Bool alt_CServerScriptEvent_WasCancelled(struct alt_CServerScriptEvent* _instance); CAPI void alt_CServerScriptEvent_Cancel(struct alt_CServerScriptEvent* _instance); CAPI void alt_CServerScriptEvent_Create_1(struct alt_CEvent* _p0, struct alt_CServerScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CServerScriptEvent_CAPI_Free() CAPI struct alt_CServerScriptEvent* alt_CServerScriptEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CServerScriptEvent_Assign_constCEventRef(struct alt_CServerScriptEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CServerScriptEvent_Create_2(struct alt_StringView* _name, struct alt_Array_RefBase_RefStore_constIMValue* _args, struct alt_CServerScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CServerScriptEvent_CAPI_Free() CAPI struct alt_CServerScriptEvent* alt_CServerScriptEvent_Create_2_CAPI_Heap(struct alt_StringView* _name, struct alt_Array_RefBase_RefStore_constIMValue* _args); CAPI void alt_CServerScriptEvent_GetName(struct alt_CServerScriptEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CServerScriptEvent_GetName_CAPI_Heap(struct alt_CServerScriptEvent* _instance); CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_CServerScriptEvent_GetArgs(struct alt_CServerScriptEvent* _instance); CAPI void alt_CServerScriptEvent_Create_3(struct alt_CServerScriptEvent* _p0, struct alt_CServerScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CServerScriptEvent_CAPI_Free() CAPI struct alt_CServerScriptEvent* alt_CServerScriptEvent_Create_3_CAPI_Heap(struct alt_CServerScriptEvent* _p0); CAPI void alt_CServerScriptEvent_Create_4(struct alt_CServerScriptEvent* _p0, struct alt_CServerScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CServerScriptEvent_CAPI_Free() CAPI struct alt_CServerScriptEvent* alt_CServerScriptEvent_Create_4_CAPI_Heap(struct alt_CServerScriptEvent* _p0); CAPI void alt_CServerScriptEvent_Assign_constCServerScriptEventRef(struct alt_CServerScriptEvent* _instance, struct alt_CServerScriptEvent* _p0); CAPI void alt_CServerScriptEvent_Assign_CServerScriptEventRefRef(struct alt_CServerScriptEvent* _instance, struct alt_CServerScriptEvent* _p0); typedef struct alt_CClientScriptEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer target; struct alt_String name; struct alt_Array_RefBase_RefStore_constIMValue args; } alt_CClientScriptEvent; CAPI void alt_CClientScriptEvent_CAPI_Free(struct alt_CClientScriptEvent* ptr); CAPI struct alt_CClientScriptEvent* alt_CEvent_to_alt_CClientScriptEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CClientScriptEvent_to_alt_CEvent(struct alt_CClientScriptEvent* from); CAPI void alt_CClientScriptEvent_Create(alt_CEvent_Type _type, struct alt_CClientScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CClientScriptEvent_CAPI_Free() CAPI struct alt_CClientScriptEvent* alt_CClientScriptEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CClientScriptEvent_GetType(struct alt_CClientScriptEvent* _instance); CAPI _Bool alt_CClientScriptEvent_WasCancelled(struct alt_CClientScriptEvent* _instance); CAPI void alt_CClientScriptEvent_Cancel(struct alt_CClientScriptEvent* _instance); CAPI void alt_CClientScriptEvent_Create_1(struct alt_CEvent* _p0, struct alt_CClientScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CClientScriptEvent_CAPI_Free() CAPI struct alt_CClientScriptEvent* alt_CClientScriptEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CClientScriptEvent_Assign_constCEventRef(struct alt_CClientScriptEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CClientScriptEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_StringView* _name, struct alt_Array_RefBase_RefStore_constIMValue* _args, struct alt_CClientScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CClientScriptEvent_CAPI_Free() CAPI struct alt_CClientScriptEvent* alt_CClientScriptEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_StringView* _name, struct alt_Array_RefBase_RefStore_constIMValue* _args); CAPI void alt_CClientScriptEvent_GetTarget(struct alt_CClientScriptEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CClientScriptEvent_GetTarget_CAPI_Heap(struct alt_CClientScriptEvent* _instance); CAPI void alt_CClientScriptEvent_GetName(struct alt_CClientScriptEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CClientScriptEvent_GetName_CAPI_Heap(struct alt_CClientScriptEvent* _instance); CAPI struct alt_Array_RefBase_RefStore_constIMValue* alt_CClientScriptEvent_GetArgs(struct alt_CClientScriptEvent* _instance); CAPI void alt_CClientScriptEvent_Create_3(struct alt_CClientScriptEvent* _p0, struct alt_CClientScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CClientScriptEvent_CAPI_Free() CAPI struct alt_CClientScriptEvent* alt_CClientScriptEvent_Create_3_CAPI_Heap(struct alt_CClientScriptEvent* _p0); CAPI void alt_CClientScriptEvent_Create_4(struct alt_CClientScriptEvent* _p0, struct alt_CClientScriptEvent* _returnValue); // Return ptr must be manually freed with alt_CClientScriptEvent_CAPI_Free() CAPI struct alt_CClientScriptEvent* alt_CClientScriptEvent_Create_4_CAPI_Heap(struct alt_CClientScriptEvent* _p0); CAPI void alt_CClientScriptEvent_Assign_constCClientScriptEventRef(struct alt_CClientScriptEvent* _instance, struct alt_CClientScriptEvent* _p0); CAPI void alt_CClientScriptEvent_Assign_CClientScriptEventRefRef(struct alt_CClientScriptEvent* _instance, struct alt_CClientScriptEvent* _p0); typedef struct alt_CPlayerConnectEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer target; struct alt_String reason; } alt_CPlayerConnectEvent; CAPI void alt_CPlayerConnectEvent_CAPI_Free(struct alt_CPlayerConnectEvent* ptr); CAPI struct alt_CPlayerConnectEvent* alt_CEvent_to_alt_CPlayerConnectEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerConnectEvent_to_alt_CEvent(struct alt_CPlayerConnectEvent* from); CAPI void alt_CPlayerConnectEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerConnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerConnectEvent_CAPI_Free() CAPI struct alt_CPlayerConnectEvent* alt_CPlayerConnectEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerConnectEvent_GetType(struct alt_CPlayerConnectEvent* _instance); CAPI _Bool alt_CPlayerConnectEvent_WasCancelled(struct alt_CPlayerConnectEvent* _instance); CAPI void alt_CPlayerConnectEvent_Cancel(struct alt_CPlayerConnectEvent* _instance); CAPI void alt_CPlayerConnectEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerConnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerConnectEvent_CAPI_Free() CAPI struct alt_CPlayerConnectEvent* alt_CPlayerConnectEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerConnectEvent_Assign_constCEventRef(struct alt_CPlayerConnectEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerConnectEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_CPlayerConnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerConnectEvent_CAPI_Free() CAPI struct alt_CPlayerConnectEvent* alt_CPlayerConnectEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _target); CAPI void alt_CPlayerConnectEvent_GetTarget(struct alt_CPlayerConnectEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerConnectEvent_GetTarget_CAPI_Heap(struct alt_CPlayerConnectEvent* _instance); CAPI void alt_CPlayerConnectEvent_GetReason(struct alt_CPlayerConnectEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CPlayerConnectEvent_GetReason_CAPI_Heap(struct alt_CPlayerConnectEvent* _instance); CAPI void alt_CPlayerConnectEvent_Cancel_1(struct alt_CPlayerConnectEvent* _instance, struct alt_StringView* _reason); CAPI void alt_CPlayerConnectEvent_Create_3(struct alt_CPlayerConnectEvent* _p0, struct alt_CPlayerConnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerConnectEvent_CAPI_Free() CAPI struct alt_CPlayerConnectEvent* alt_CPlayerConnectEvent_Create_3_CAPI_Heap(struct alt_CPlayerConnectEvent* _p0); CAPI void alt_CPlayerConnectEvent_Create_4(struct alt_CPlayerConnectEvent* _p0, struct alt_CPlayerConnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerConnectEvent_CAPI_Free() CAPI struct alt_CPlayerConnectEvent* alt_CPlayerConnectEvent_Create_4_CAPI_Heap(struct alt_CPlayerConnectEvent* _p0); CAPI void alt_CPlayerConnectEvent_Assign_constCPlayerConnectEventRef(struct alt_CPlayerConnectEvent* _instance, struct alt_CPlayerConnectEvent* _p0); CAPI void alt_CPlayerConnectEvent_Assign_CPlayerConnectEventRefRef(struct alt_CPlayerConnectEvent* _instance, struct alt_CPlayerConnectEvent* _p0); typedef struct alt_CPlayerDisconnectEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer target; struct alt_String reason; } alt_CPlayerDisconnectEvent; CAPI void alt_CPlayerDisconnectEvent_CAPI_Free(struct alt_CPlayerDisconnectEvent* ptr); CAPI struct alt_CPlayerDisconnectEvent* alt_CEvent_to_alt_CPlayerDisconnectEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerDisconnectEvent_to_alt_CEvent(struct alt_CPlayerDisconnectEvent* from); CAPI void alt_CPlayerDisconnectEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerDisconnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDisconnectEvent_CAPI_Free() CAPI struct alt_CPlayerDisconnectEvent* alt_CPlayerDisconnectEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerDisconnectEvent_GetType(struct alt_CPlayerDisconnectEvent* _instance); CAPI _Bool alt_CPlayerDisconnectEvent_WasCancelled(struct alt_CPlayerDisconnectEvent* _instance); CAPI void alt_CPlayerDisconnectEvent_Cancel(struct alt_CPlayerDisconnectEvent* _instance); CAPI void alt_CPlayerDisconnectEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerDisconnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDisconnectEvent_CAPI_Free() CAPI struct alt_CPlayerDisconnectEvent* alt_CPlayerDisconnectEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerDisconnectEvent_Assign_constCEventRef(struct alt_CPlayerDisconnectEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerDisconnectEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_StringView* _reason, struct alt_CPlayerDisconnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDisconnectEvent_CAPI_Free() CAPI struct alt_CPlayerDisconnectEvent* alt_CPlayerDisconnectEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_StringView* _reason); CAPI void alt_CPlayerDisconnectEvent_GetTarget(struct alt_CPlayerDisconnectEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerDisconnectEvent_GetTarget_CAPI_Heap(struct alt_CPlayerDisconnectEvent* _instance); CAPI void alt_CPlayerDisconnectEvent_GetReason(struct alt_CPlayerDisconnectEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CPlayerDisconnectEvent_GetReason_CAPI_Heap(struct alt_CPlayerDisconnectEvent* _instance); CAPI void alt_CPlayerDisconnectEvent_Create_3(struct alt_CPlayerDisconnectEvent* _p0, struct alt_CPlayerDisconnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDisconnectEvent_CAPI_Free() CAPI struct alt_CPlayerDisconnectEvent* alt_CPlayerDisconnectEvent_Create_3_CAPI_Heap(struct alt_CPlayerDisconnectEvent* _p0); CAPI void alt_CPlayerDisconnectEvent_Create_4(struct alt_CPlayerDisconnectEvent* _p0, struct alt_CPlayerDisconnectEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDisconnectEvent_CAPI_Free() CAPI struct alt_CPlayerDisconnectEvent* alt_CPlayerDisconnectEvent_Create_4_CAPI_Heap(struct alt_CPlayerDisconnectEvent* _p0); CAPI void alt_CPlayerDisconnectEvent_Assign_constCPlayerDisconnectEventRef(struct alt_CPlayerDisconnectEvent* _instance, struct alt_CPlayerDisconnectEvent* _p0); CAPI void alt_CPlayerDisconnectEvent_Assign_CPlayerDisconnectEventRefRef(struct alt_CPlayerDisconnectEvent* _instance, struct alt_CPlayerDisconnectEvent* _p0); typedef struct alt_CPlayerDamageEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer target; struct alt_RefBase_RefStore_IEntity attacker; unsigned short damage; unsigned int weapon; } alt_CPlayerDamageEvent; CAPI void alt_CPlayerDamageEvent_CAPI_Free(struct alt_CPlayerDamageEvent* ptr); CAPI struct alt_CPlayerDamageEvent* alt_CEvent_to_alt_CPlayerDamageEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerDamageEvent_to_alt_CEvent(struct alt_CPlayerDamageEvent* from); CAPI void alt_CPlayerDamageEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDamageEvent_CAPI_Free() CAPI struct alt_CPlayerDamageEvent* alt_CPlayerDamageEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerDamageEvent_GetType(struct alt_CPlayerDamageEvent* _instance); CAPI _Bool alt_CPlayerDamageEvent_WasCancelled(struct alt_CPlayerDamageEvent* _instance); CAPI void alt_CPlayerDamageEvent_Cancel(struct alt_CPlayerDamageEvent* _instance); CAPI void alt_CPlayerDamageEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDamageEvent_CAPI_Free() CAPI struct alt_CPlayerDamageEvent* alt_CPlayerDamageEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerDamageEvent_Assign_constCEventRef(struct alt_CPlayerDamageEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerDamageEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_RefBase_RefStore_IEntity* _attacker, unsigned short _damage, unsigned int _weapon, struct alt_CPlayerDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDamageEvent_CAPI_Free() CAPI struct alt_CPlayerDamageEvent* alt_CPlayerDamageEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_RefBase_RefStore_IEntity* _attacker, unsigned short _damage, unsigned int _weapon); CAPI void alt_CPlayerDamageEvent_GetTarget(struct alt_CPlayerDamageEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerDamageEvent_GetTarget_CAPI_Heap(struct alt_CPlayerDamageEvent* _instance); CAPI void alt_CPlayerDamageEvent_GetAttacker(struct alt_CPlayerDamageEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CPlayerDamageEvent_GetAttacker_CAPI_Heap(struct alt_CPlayerDamageEvent* _instance); CAPI unsigned short alt_CPlayerDamageEvent_GetDamage(struct alt_CPlayerDamageEvent* _instance); CAPI unsigned int alt_CPlayerDamageEvent_GetWeapon(struct alt_CPlayerDamageEvent* _instance); CAPI void alt_CPlayerDamageEvent_Create_3(struct alt_CPlayerDamageEvent* _p0, struct alt_CPlayerDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDamageEvent_CAPI_Free() CAPI struct alt_CPlayerDamageEvent* alt_CPlayerDamageEvent_Create_3_CAPI_Heap(struct alt_CPlayerDamageEvent* _p0); CAPI void alt_CPlayerDamageEvent_Create_4(struct alt_CPlayerDamageEvent* _p0, struct alt_CPlayerDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDamageEvent_CAPI_Free() CAPI struct alt_CPlayerDamageEvent* alt_CPlayerDamageEvent_Create_4_CAPI_Heap(struct alt_CPlayerDamageEvent* _p0); CAPI void alt_CPlayerDamageEvent_Assign_constCPlayerDamageEventRef(struct alt_CPlayerDamageEvent* _instance, struct alt_CPlayerDamageEvent* _p0); CAPI void alt_CPlayerDamageEvent_Assign_CPlayerDamageEventRefRef(struct alt_CPlayerDamageEvent* _instance, struct alt_CPlayerDamageEvent* _p0); typedef struct alt_CPlayerDeathEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer target; struct alt_RefBase_RefStore_IEntity killer; unsigned int weapon; } alt_CPlayerDeathEvent; CAPI void alt_CPlayerDeathEvent_CAPI_Free(struct alt_CPlayerDeathEvent* ptr); CAPI struct alt_CPlayerDeathEvent* alt_CEvent_to_alt_CPlayerDeathEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerDeathEvent_to_alt_CEvent(struct alt_CPlayerDeathEvent* from); CAPI void alt_CPlayerDeathEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerDeathEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDeathEvent_CAPI_Free() CAPI struct alt_CPlayerDeathEvent* alt_CPlayerDeathEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerDeathEvent_GetType(struct alt_CPlayerDeathEvent* _instance); CAPI _Bool alt_CPlayerDeathEvent_WasCancelled(struct alt_CPlayerDeathEvent* _instance); CAPI void alt_CPlayerDeathEvent_Cancel(struct alt_CPlayerDeathEvent* _instance); CAPI void alt_CPlayerDeathEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerDeathEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDeathEvent_CAPI_Free() CAPI struct alt_CPlayerDeathEvent* alt_CPlayerDeathEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerDeathEvent_Assign_constCEventRef(struct alt_CPlayerDeathEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerDeathEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_RefBase_RefStore_IEntity* _killer, unsigned int _weapon, struct alt_CPlayerDeathEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDeathEvent_CAPI_Free() CAPI struct alt_CPlayerDeathEvent* alt_CPlayerDeathEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _target, struct alt_RefBase_RefStore_IEntity* _killer, unsigned int _weapon); CAPI void alt_CPlayerDeathEvent_GetTarget(struct alt_CPlayerDeathEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerDeathEvent_GetTarget_CAPI_Heap(struct alt_CPlayerDeathEvent* _instance); CAPI void alt_CPlayerDeathEvent_GetKiller(struct alt_CPlayerDeathEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CPlayerDeathEvent_GetKiller_CAPI_Heap(struct alt_CPlayerDeathEvent* _instance); CAPI unsigned int alt_CPlayerDeathEvent_GetWeapon(struct alt_CPlayerDeathEvent* _instance); CAPI void alt_CPlayerDeathEvent_Create_3(struct alt_CPlayerDeathEvent* _p0, struct alt_CPlayerDeathEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDeathEvent_CAPI_Free() CAPI struct alt_CPlayerDeathEvent* alt_CPlayerDeathEvent_Create_3_CAPI_Heap(struct alt_CPlayerDeathEvent* _p0); CAPI void alt_CPlayerDeathEvent_Create_4(struct alt_CPlayerDeathEvent* _p0, struct alt_CPlayerDeathEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerDeathEvent_CAPI_Free() CAPI struct alt_CPlayerDeathEvent* alt_CPlayerDeathEvent_Create_4_CAPI_Heap(struct alt_CPlayerDeathEvent* _p0); CAPI void alt_CPlayerDeathEvent_Assign_constCPlayerDeathEventRef(struct alt_CPlayerDeathEvent* _instance, struct alt_CPlayerDeathEvent* _p0); CAPI void alt_CPlayerDeathEvent_Assign_CPlayerDeathEventRefRef(struct alt_CPlayerDeathEvent* _instance, struct alt_CPlayerDeathEvent* _p0); typedef struct alt_CColShapeEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IColShape target; struct alt_RefBase_RefStore_IEntity entity; _Bool state; } alt_CColShapeEvent; CAPI void alt_CColShapeEvent_CAPI_Free(struct alt_CColShapeEvent* ptr); CAPI struct alt_CColShapeEvent* alt_CEvent_to_alt_CColShapeEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CColShapeEvent_to_alt_CEvent(struct alt_CColShapeEvent* from); CAPI void alt_CColShapeEvent_Create(alt_CEvent_Type _type, struct alt_CColShapeEvent* _returnValue); // Return ptr must be manually freed with alt_CColShapeEvent_CAPI_Free() CAPI struct alt_CColShapeEvent* alt_CColShapeEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CColShapeEvent_GetType(struct alt_CColShapeEvent* _instance); CAPI _Bool alt_CColShapeEvent_WasCancelled(struct alt_CColShapeEvent* _instance); CAPI void alt_CColShapeEvent_Cancel(struct alt_CColShapeEvent* _instance); CAPI void alt_CColShapeEvent_Create_1(struct alt_CEvent* _p0, struct alt_CColShapeEvent* _returnValue); // Return ptr must be manually freed with alt_CColShapeEvent_CAPI_Free() CAPI struct alt_CColShapeEvent* alt_CColShapeEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CColShapeEvent_Assign_constCEventRef(struct alt_CColShapeEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CColShapeEvent_Create_2(struct alt_RefBase_RefStore_IColShape* _target, struct alt_RefBase_RefStore_IEntity* _entity, _Bool _state, struct alt_CColShapeEvent* _returnValue); // Return ptr must be manually freed with alt_CColShapeEvent_CAPI_Free() CAPI struct alt_CColShapeEvent* alt_CColShapeEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IColShape* _target, struct alt_RefBase_RefStore_IEntity* _entity, _Bool _state); CAPI void alt_CColShapeEvent_GetTarget(struct alt_CColShapeEvent* _instance, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_CColShapeEvent_GetTarget_CAPI_Heap(struct alt_CColShapeEvent* _instance); CAPI void alt_CColShapeEvent_GetEntity(struct alt_CColShapeEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CColShapeEvent_GetEntity_CAPI_Heap(struct alt_CColShapeEvent* _instance); CAPI _Bool alt_CColShapeEvent_GetState(struct alt_CColShapeEvent* _instance); CAPI void alt_CColShapeEvent_Create_3(struct alt_CColShapeEvent* _p0, struct alt_CColShapeEvent* _returnValue); // Return ptr must be manually freed with alt_CColShapeEvent_CAPI_Free() CAPI struct alt_CColShapeEvent* alt_CColShapeEvent_Create_3_CAPI_Heap(struct alt_CColShapeEvent* _p0); CAPI void alt_CColShapeEvent_Create_4(struct alt_CColShapeEvent* _p0, struct alt_CColShapeEvent* _returnValue); // Return ptr must be manually freed with alt_CColShapeEvent_CAPI_Free() CAPI struct alt_CColShapeEvent* alt_CColShapeEvent_Create_4_CAPI_Heap(struct alt_CColShapeEvent* _p0); CAPI void alt_CColShapeEvent_Assign_constCColShapeEventRef(struct alt_CColShapeEvent* _instance, struct alt_CColShapeEvent* _p0); CAPI void alt_CColShapeEvent_Assign_CColShapeEventRefRef(struct alt_CColShapeEvent* _instance, struct alt_CColShapeEvent* _p0); typedef struct alt_CPlayerEnterVehicleEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IVehicle target; struct alt_RefBase_RefStore_IPlayer player; unsigned char seat; } alt_CPlayerEnterVehicleEvent; CAPI void alt_CPlayerEnterVehicleEvent_CAPI_Free(struct alt_CPlayerEnterVehicleEvent* ptr); CAPI struct alt_CPlayerEnterVehicleEvent* alt_CEvent_to_alt_CPlayerEnterVehicleEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerEnterVehicleEvent_to_alt_CEvent(struct alt_CPlayerEnterVehicleEvent* from); CAPI void alt_CPlayerEnterVehicleEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerEnterVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerEnterVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerEnterVehicleEvent* alt_CPlayerEnterVehicleEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerEnterVehicleEvent_GetType(struct alt_CPlayerEnterVehicleEvent* _instance); CAPI _Bool alt_CPlayerEnterVehicleEvent_WasCancelled(struct alt_CPlayerEnterVehicleEvent* _instance); CAPI void alt_CPlayerEnterVehicleEvent_Cancel(struct alt_CPlayerEnterVehicleEvent* _instance); CAPI void alt_CPlayerEnterVehicleEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerEnterVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerEnterVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerEnterVehicleEvent* alt_CPlayerEnterVehicleEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerEnterVehicleEvent_Assign_constCEventRef(struct alt_CPlayerEnterVehicleEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerEnterVehicleEvent_Create_2(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_RefBase_RefStore_IPlayer* _player, unsigned char _seat, struct alt_CPlayerEnterVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerEnterVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerEnterVehicleEvent* alt_CPlayerEnterVehicleEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_RefBase_RefStore_IPlayer* _player, unsigned char _seat); CAPI void alt_CPlayerEnterVehicleEvent_GetTarget(struct alt_CPlayerEnterVehicleEvent* _instance, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_CPlayerEnterVehicleEvent_GetTarget_CAPI_Heap(struct alt_CPlayerEnterVehicleEvent* _instance); CAPI void alt_CPlayerEnterVehicleEvent_GetPlayer(struct alt_CPlayerEnterVehicleEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerEnterVehicleEvent_GetPlayer_CAPI_Heap(struct alt_CPlayerEnterVehicleEvent* _instance); CAPI unsigned char alt_CPlayerEnterVehicleEvent_GetSeat(struct alt_CPlayerEnterVehicleEvent* _instance); CAPI void alt_CPlayerEnterVehicleEvent_Create_3(struct alt_CPlayerEnterVehicleEvent* _p0, struct alt_CPlayerEnterVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerEnterVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerEnterVehicleEvent* alt_CPlayerEnterVehicleEvent_Create_3_CAPI_Heap(struct alt_CPlayerEnterVehicleEvent* _p0); CAPI void alt_CPlayerEnterVehicleEvent_Create_4(struct alt_CPlayerEnterVehicleEvent* _p0, struct alt_CPlayerEnterVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerEnterVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerEnterVehicleEvent* alt_CPlayerEnterVehicleEvent_Create_4_CAPI_Heap(struct alt_CPlayerEnterVehicleEvent* _p0); CAPI void alt_CPlayerEnterVehicleEvent_Assign_constCPlayerEnterVehicleEventRef(struct alt_CPlayerEnterVehicleEvent* _instance, struct alt_CPlayerEnterVehicleEvent* _p0); CAPI void alt_CPlayerEnterVehicleEvent_Assign_CPlayerEnterVehicleEventRefRef(struct alt_CPlayerEnterVehicleEvent* _instance, struct alt_CPlayerEnterVehicleEvent* _p0); typedef struct alt_CPlayerLeaveVehicleEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IVehicle target; struct alt_RefBase_RefStore_IPlayer player; unsigned char seat; } alt_CPlayerLeaveVehicleEvent; CAPI void alt_CPlayerLeaveVehicleEvent_CAPI_Free(struct alt_CPlayerLeaveVehicleEvent* ptr); CAPI struct alt_CPlayerLeaveVehicleEvent* alt_CEvent_to_alt_CPlayerLeaveVehicleEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerLeaveVehicleEvent_to_alt_CEvent(struct alt_CPlayerLeaveVehicleEvent* from); CAPI void alt_CPlayerLeaveVehicleEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerLeaveVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerLeaveVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerLeaveVehicleEvent* alt_CPlayerLeaveVehicleEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerLeaveVehicleEvent_GetType(struct alt_CPlayerLeaveVehicleEvent* _instance); CAPI _Bool alt_CPlayerLeaveVehicleEvent_WasCancelled(struct alt_CPlayerLeaveVehicleEvent* _instance); CAPI void alt_CPlayerLeaveVehicleEvent_Cancel(struct alt_CPlayerLeaveVehicleEvent* _instance); CAPI void alt_CPlayerLeaveVehicleEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerLeaveVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerLeaveVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerLeaveVehicleEvent* alt_CPlayerLeaveVehicleEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerLeaveVehicleEvent_Assign_constCEventRef(struct alt_CPlayerLeaveVehicleEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerLeaveVehicleEvent_Create_2(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_RefBase_RefStore_IPlayer* _player, unsigned char _seat, struct alt_CPlayerLeaveVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerLeaveVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerLeaveVehicleEvent* alt_CPlayerLeaveVehicleEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_RefBase_RefStore_IPlayer* _player, unsigned char _seat); CAPI void alt_CPlayerLeaveVehicleEvent_GetTarget(struct alt_CPlayerLeaveVehicleEvent* _instance, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_CPlayerLeaveVehicleEvent_GetTarget_CAPI_Heap(struct alt_CPlayerLeaveVehicleEvent* _instance); CAPI void alt_CPlayerLeaveVehicleEvent_GetPlayer(struct alt_CPlayerLeaveVehicleEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerLeaveVehicleEvent_GetPlayer_CAPI_Heap(struct alt_CPlayerLeaveVehicleEvent* _instance); CAPI unsigned char alt_CPlayerLeaveVehicleEvent_GetSeat(struct alt_CPlayerLeaveVehicleEvent* _instance); CAPI void alt_CPlayerLeaveVehicleEvent_Create_3(struct alt_CPlayerLeaveVehicleEvent* _p0, struct alt_CPlayerLeaveVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerLeaveVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerLeaveVehicleEvent* alt_CPlayerLeaveVehicleEvent_Create_3_CAPI_Heap(struct alt_CPlayerLeaveVehicleEvent* _p0); CAPI void alt_CPlayerLeaveVehicleEvent_Create_4(struct alt_CPlayerLeaveVehicleEvent* _p0, struct alt_CPlayerLeaveVehicleEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerLeaveVehicleEvent_CAPI_Free() CAPI struct alt_CPlayerLeaveVehicleEvent* alt_CPlayerLeaveVehicleEvent_Create_4_CAPI_Heap(struct alt_CPlayerLeaveVehicleEvent* _p0); CAPI void alt_CPlayerLeaveVehicleEvent_Assign_constCPlayerLeaveVehicleEventRef(struct alt_CPlayerLeaveVehicleEvent* _instance, struct alt_CPlayerLeaveVehicleEvent* _p0); CAPI void alt_CPlayerLeaveVehicleEvent_Assign_CPlayerLeaveVehicleEventRefRef(struct alt_CPlayerLeaveVehicleEvent* _instance, struct alt_CPlayerLeaveVehicleEvent* _p0); typedef struct alt_CPlayerChangeVehicleSeatEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IVehicle target; struct alt_RefBase_RefStore_IPlayer player; unsigned char oldSeat; unsigned char newSeat; } alt_CPlayerChangeVehicleSeatEvent; CAPI void alt_CPlayerChangeVehicleSeatEvent_CAPI_Free(struct alt_CPlayerChangeVehicleSeatEvent* ptr); CAPI struct alt_CPlayerChangeVehicleSeatEvent* alt_CEvent_to_alt_CPlayerChangeVehicleSeatEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CPlayerChangeVehicleSeatEvent_to_alt_CEvent(struct alt_CPlayerChangeVehicleSeatEvent* from); CAPI void alt_CPlayerChangeVehicleSeatEvent_Create(alt_CEvent_Type _type, struct alt_CPlayerChangeVehicleSeatEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerChangeVehicleSeatEvent_CAPI_Free() CAPI struct alt_CPlayerChangeVehicleSeatEvent* alt_CPlayerChangeVehicleSeatEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CPlayerChangeVehicleSeatEvent_GetType(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI _Bool alt_CPlayerChangeVehicleSeatEvent_WasCancelled(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI void alt_CPlayerChangeVehicleSeatEvent_Cancel(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI void alt_CPlayerChangeVehicleSeatEvent_Create_1(struct alt_CEvent* _p0, struct alt_CPlayerChangeVehicleSeatEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerChangeVehicleSeatEvent_CAPI_Free() CAPI struct alt_CPlayerChangeVehicleSeatEvent* alt_CPlayerChangeVehicleSeatEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CPlayerChangeVehicleSeatEvent_Assign_constCEventRef(struct alt_CPlayerChangeVehicleSeatEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CPlayerChangeVehicleSeatEvent_Create_2(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_RefBase_RefStore_IPlayer* _player, unsigned char _oldSeat, unsigned char _newSeat, struct alt_CPlayerChangeVehicleSeatEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerChangeVehicleSeatEvent_CAPI_Free() CAPI struct alt_CPlayerChangeVehicleSeatEvent* alt_CPlayerChangeVehicleSeatEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_RefBase_RefStore_IPlayer* _player, unsigned char _oldSeat, unsigned char _newSeat); CAPI void alt_CPlayerChangeVehicleSeatEvent_GetTarget(struct alt_CPlayerChangeVehicleSeatEvent* _instance, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_CPlayerChangeVehicleSeatEvent_GetTarget_CAPI_Heap(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI void alt_CPlayerChangeVehicleSeatEvent_GetPlayer(struct alt_CPlayerChangeVehicleSeatEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CPlayerChangeVehicleSeatEvent_GetPlayer_CAPI_Heap(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI unsigned char alt_CPlayerChangeVehicleSeatEvent_GetOldSeat(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI unsigned char alt_CPlayerChangeVehicleSeatEvent_GetNewSeat(struct alt_CPlayerChangeVehicleSeatEvent* _instance); CAPI void alt_CPlayerChangeVehicleSeatEvent_Create_3(struct alt_CPlayerChangeVehicleSeatEvent* _p0, struct alt_CPlayerChangeVehicleSeatEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerChangeVehicleSeatEvent_CAPI_Free() CAPI struct alt_CPlayerChangeVehicleSeatEvent* alt_CPlayerChangeVehicleSeatEvent_Create_3_CAPI_Heap(struct alt_CPlayerChangeVehicleSeatEvent* _p0); CAPI void alt_CPlayerChangeVehicleSeatEvent_Create_4(struct alt_CPlayerChangeVehicleSeatEvent* _p0, struct alt_CPlayerChangeVehicleSeatEvent* _returnValue); // Return ptr must be manually freed with alt_CPlayerChangeVehicleSeatEvent_CAPI_Free() CAPI struct alt_CPlayerChangeVehicleSeatEvent* alt_CPlayerChangeVehicleSeatEvent_Create_4_CAPI_Heap(struct alt_CPlayerChangeVehicleSeatEvent* _p0); CAPI void alt_CPlayerChangeVehicleSeatEvent_Assign_constCPlayerChangeVehicleSeatEventRef(struct alt_CPlayerChangeVehicleSeatEvent* _instance, struct alt_CPlayerChangeVehicleSeatEvent* _p0); CAPI void alt_CPlayerChangeVehicleSeatEvent_Assign_CPlayerChangeVehicleSeatEventRefRef(struct alt_CPlayerChangeVehicleSeatEvent* _instance, struct alt_CPlayerChangeVehicleSeatEvent* _p0); typedef struct alt_CDataNodeReceivedEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_String name; struct alt_String json; } alt_CDataNodeReceivedEvent; CAPI void alt_CDataNodeReceivedEvent_CAPI_Free(struct alt_CDataNodeReceivedEvent* ptr); CAPI struct alt_CDataNodeReceivedEvent* alt_CEvent_to_alt_CDataNodeReceivedEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CDataNodeReceivedEvent_to_alt_CEvent(struct alt_CDataNodeReceivedEvent* from); CAPI void alt_CDataNodeReceivedEvent_Create(alt_CEvent_Type _type, struct alt_CDataNodeReceivedEvent* _returnValue); // Return ptr must be manually freed with alt_CDataNodeReceivedEvent_CAPI_Free() CAPI struct alt_CDataNodeReceivedEvent* alt_CDataNodeReceivedEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CDataNodeReceivedEvent_GetType(struct alt_CDataNodeReceivedEvent* _instance); CAPI _Bool alt_CDataNodeReceivedEvent_WasCancelled(struct alt_CDataNodeReceivedEvent* _instance); CAPI void alt_CDataNodeReceivedEvent_Cancel(struct alt_CDataNodeReceivedEvent* _instance); CAPI void alt_CDataNodeReceivedEvent_Create_1(struct alt_CEvent* _p0, struct alt_CDataNodeReceivedEvent* _returnValue); // Return ptr must be manually freed with alt_CDataNodeReceivedEvent_CAPI_Free() CAPI struct alt_CDataNodeReceivedEvent* alt_CDataNodeReceivedEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CDataNodeReceivedEvent_Assign_constCEventRef(struct alt_CDataNodeReceivedEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CDataNodeReceivedEvent_Create_2(struct alt_StringView* _name, struct alt_StringView* _logJson, struct alt_CDataNodeReceivedEvent* _returnValue); // Return ptr must be manually freed with alt_CDataNodeReceivedEvent_CAPI_Free() CAPI struct alt_CDataNodeReceivedEvent* alt_CDataNodeReceivedEvent_Create_2_CAPI_Heap(struct alt_StringView* _name, struct alt_StringView* _logJson); CAPI void alt_CDataNodeReceivedEvent_GetName(struct alt_CDataNodeReceivedEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CDataNodeReceivedEvent_GetName_CAPI_Heap(struct alt_CDataNodeReceivedEvent* _instance); CAPI void alt_CDataNodeReceivedEvent_GetJson(struct alt_CDataNodeReceivedEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CDataNodeReceivedEvent_GetJson_CAPI_Heap(struct alt_CDataNodeReceivedEvent* _instance); CAPI void alt_CDataNodeReceivedEvent_Create_3(struct alt_CDataNodeReceivedEvent* _p0, struct alt_CDataNodeReceivedEvent* _returnValue); // Return ptr must be manually freed with alt_CDataNodeReceivedEvent_CAPI_Free() CAPI struct alt_CDataNodeReceivedEvent* alt_CDataNodeReceivedEvent_Create_3_CAPI_Heap(struct alt_CDataNodeReceivedEvent* _p0); CAPI void alt_CDataNodeReceivedEvent_Create_4(struct alt_CDataNodeReceivedEvent* _p0, struct alt_CDataNodeReceivedEvent* _returnValue); // Return ptr must be manually freed with alt_CDataNodeReceivedEvent_CAPI_Free() CAPI struct alt_CDataNodeReceivedEvent* alt_CDataNodeReceivedEvent_Create_4_CAPI_Heap(struct alt_CDataNodeReceivedEvent* _p0); CAPI void alt_CDataNodeReceivedEvent_Assign_constCDataNodeReceivedEventRef(struct alt_CDataNodeReceivedEvent* _instance, struct alt_CDataNodeReceivedEvent* _p0); CAPI void alt_CDataNodeReceivedEvent_Assign_CDataNodeReceivedEventRefRef(struct alt_CDataNodeReceivedEvent* _instance, struct alt_CDataNodeReceivedEvent* _p0); typedef struct alt_CRemoveEntityEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IEntity target; } alt_CRemoveEntityEvent; CAPI void alt_CRemoveEntityEvent_CAPI_Free(struct alt_CRemoveEntityEvent* ptr); CAPI struct alt_CRemoveEntityEvent* alt_CEvent_to_alt_CRemoveEntityEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CRemoveEntityEvent_to_alt_CEvent(struct alt_CRemoveEntityEvent* from); CAPI void alt_CRemoveEntityEvent_Create(alt_CEvent_Type _type, struct alt_CRemoveEntityEvent* _returnValue); // Return ptr must be manually freed with alt_CRemoveEntityEvent_CAPI_Free() CAPI struct alt_CRemoveEntityEvent* alt_CRemoveEntityEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CRemoveEntityEvent_GetType(struct alt_CRemoveEntityEvent* _instance); CAPI _Bool alt_CRemoveEntityEvent_WasCancelled(struct alt_CRemoveEntityEvent* _instance); CAPI void alt_CRemoveEntityEvent_Cancel(struct alt_CRemoveEntityEvent* _instance); CAPI void alt_CRemoveEntityEvent_Create_1(struct alt_CEvent* _p0, struct alt_CRemoveEntityEvent* _returnValue); // Return ptr must be manually freed with alt_CRemoveEntityEvent_CAPI_Free() CAPI struct alt_CRemoveEntityEvent* alt_CRemoveEntityEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CRemoveEntityEvent_Assign_constCEventRef(struct alt_CRemoveEntityEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CRemoveEntityEvent_Create_2(struct alt_RefBase_RefStore_IEntity* _target, struct alt_CRemoveEntityEvent* _returnValue); // Return ptr must be manually freed with alt_CRemoveEntityEvent_CAPI_Free() CAPI struct alt_CRemoveEntityEvent* alt_CRemoveEntityEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IEntity* _target); CAPI void alt_CRemoveEntityEvent_GetEntity(struct alt_CRemoveEntityEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CRemoveEntityEvent_GetEntity_CAPI_Heap(struct alt_CRemoveEntityEvent* _instance); CAPI void alt_CRemoveEntityEvent_Create_3(struct alt_CRemoveEntityEvent* _p0, struct alt_CRemoveEntityEvent* _returnValue); // Return ptr must be manually freed with alt_CRemoveEntityEvent_CAPI_Free() CAPI struct alt_CRemoveEntityEvent* alt_CRemoveEntityEvent_Create_3_CAPI_Heap(struct alt_CRemoveEntityEvent* _p0); CAPI void alt_CRemoveEntityEvent_Create_4(struct alt_CRemoveEntityEvent* _p0, struct alt_CRemoveEntityEvent* _returnValue); // Return ptr must be manually freed with alt_CRemoveEntityEvent_CAPI_Free() CAPI struct alt_CRemoveEntityEvent* alt_CRemoveEntityEvent_Create_4_CAPI_Heap(struct alt_CRemoveEntityEvent* _p0); CAPI void alt_CRemoveEntityEvent_Assign_constCRemoveEntityEventRef(struct alt_CRemoveEntityEvent* _instance, struct alt_CRemoveEntityEvent* _p0); CAPI void alt_CRemoveEntityEvent_Assign_CRemoveEntityEventRefRef(struct alt_CRemoveEntityEvent* _instance, struct alt_CRemoveEntityEvent* _p0); typedef struct alt_CConsoleCommandEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_StringView name; struct alt_Array_StringView args; } alt_CConsoleCommandEvent; CAPI void alt_CConsoleCommandEvent_CAPI_Free(struct alt_CConsoleCommandEvent* ptr); CAPI struct alt_CConsoleCommandEvent* alt_CEvent_to_alt_CConsoleCommandEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CConsoleCommandEvent_to_alt_CEvent(struct alt_CConsoleCommandEvent* from); CAPI void alt_CConsoleCommandEvent_Create(alt_CEvent_Type _type, struct alt_CConsoleCommandEvent* _returnValue); // Return ptr must be manually freed with alt_CConsoleCommandEvent_CAPI_Free() CAPI struct alt_CConsoleCommandEvent* alt_CConsoleCommandEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CConsoleCommandEvent_GetType(struct alt_CConsoleCommandEvent* _instance); CAPI _Bool alt_CConsoleCommandEvent_WasCancelled(struct alt_CConsoleCommandEvent* _instance); CAPI void alt_CConsoleCommandEvent_Cancel(struct alt_CConsoleCommandEvent* _instance); CAPI void alt_CConsoleCommandEvent_Create_1(struct alt_CEvent* _p0, struct alt_CConsoleCommandEvent* _returnValue); // Return ptr must be manually freed with alt_CConsoleCommandEvent_CAPI_Free() CAPI struct alt_CConsoleCommandEvent* alt_CConsoleCommandEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CConsoleCommandEvent_Assign_constCEventRef(struct alt_CConsoleCommandEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CConsoleCommandEvent_Create_2(struct alt_StringView* _name, struct alt_Array_StringView* _args, struct alt_CConsoleCommandEvent* _returnValue); // Return ptr must be manually freed with alt_CConsoleCommandEvent_CAPI_Free() CAPI struct alt_CConsoleCommandEvent* alt_CConsoleCommandEvent_Create_2_CAPI_Heap(struct alt_StringView* _name, struct alt_Array_StringView* _args); CAPI void alt_CConsoleCommandEvent_GetName(struct alt_CConsoleCommandEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CConsoleCommandEvent_GetName_CAPI_Heap(struct alt_CConsoleCommandEvent* _instance); CAPI struct alt_Array_StringView* alt_CConsoleCommandEvent_GetArgs(struct alt_CConsoleCommandEvent* _instance); CAPI void alt_CConsoleCommandEvent_Create_3(struct alt_CConsoleCommandEvent* _p0, struct alt_CConsoleCommandEvent* _returnValue); // Return ptr must be manually freed with alt_CConsoleCommandEvent_CAPI_Free() CAPI struct alt_CConsoleCommandEvent* alt_CConsoleCommandEvent_Create_3_CAPI_Heap(struct alt_CConsoleCommandEvent* _p0); CAPI void alt_CConsoleCommandEvent_Create_4(struct alt_CConsoleCommandEvent* _p0, struct alt_CConsoleCommandEvent* _returnValue); // Return ptr must be manually freed with alt_CConsoleCommandEvent_CAPI_Free() CAPI struct alt_CConsoleCommandEvent* alt_CConsoleCommandEvent_Create_4_CAPI_Heap(struct alt_CConsoleCommandEvent* _p0); CAPI void alt_CConsoleCommandEvent_Assign_constCConsoleCommandEventRef(struct alt_CConsoleCommandEvent* _instance, struct alt_CConsoleCommandEvent* _p0); CAPI void alt_CConsoleCommandEvent_Assign_CConsoleCommandEventRefRef(struct alt_CConsoleCommandEvent* _instance, struct alt_CConsoleCommandEvent* _p0); typedef enum alt_CWeaponDamageEvent_BodyPart { ALT_CWEAPONDAMAGEEVENT_BODYPART_PELVIS = 0, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_HIP = 1, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_LEG = 2, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_FOOT = 3, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_HIP = 4, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_LEG = 5, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_FOOT = 6, ALT_CWEAPONDAMAGEEVENT_BODYPART_LOWER_TORSO = 7, ALT_CWEAPONDAMAGEEVENT_BODYPART_UPPER_TORSO = 8, ALT_CWEAPONDAMAGEEVENT_BODYPART_CHEST = 9, ALT_CWEAPONDAMAGEEVENT_BODYPART_UNDER_NECK = 10, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_SHOULDER = 11, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_UPPER_ARM = 12, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_ELBROW = 13, ALT_CWEAPONDAMAGEEVENT_BODYPART_LEFT_WRIST = 14, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_SHOULDER = 15, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_UPPER_ARM = 16, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_ELBROW = 17, ALT_CWEAPONDAMAGEEVENT_BODYPART_RIGHT_WRIST = 18, ALT_CWEAPONDAMAGEEVENT_BODYPART_NECK = 19, ALT_CWEAPONDAMAGEEVENT_BODYPART_HEAD = 20, ALT_CWEAPONDAMAGEEVENT_BODYPART_UNKNOWN = 255 }; typedef struct alt_CWeaponDamageEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer source; struct alt_RefBase_RefStore_IEntity target; unsigned int weaponHash; unsigned short damageValue; struct alt_Vector_float_3_VectorLayout_float_3 shotOffset; alt_CWeaponDamageEvent_BodyPart bodyPart; } alt_CWeaponDamageEvent; CAPI void alt_CWeaponDamageEvent_CAPI_Free(struct alt_CWeaponDamageEvent* ptr); CAPI struct alt_CWeaponDamageEvent* alt_CEvent_to_alt_CWeaponDamageEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CWeaponDamageEvent_to_alt_CEvent(struct alt_CWeaponDamageEvent* from); CAPI void alt_CWeaponDamageEvent_Create(alt_CEvent_Type _type, struct alt_CWeaponDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CWeaponDamageEvent_CAPI_Free() CAPI struct alt_CWeaponDamageEvent* alt_CWeaponDamageEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CWeaponDamageEvent_GetType(struct alt_CWeaponDamageEvent* _instance); CAPI _Bool alt_CWeaponDamageEvent_WasCancelled(struct alt_CWeaponDamageEvent* _instance); CAPI void alt_CWeaponDamageEvent_Cancel(struct alt_CWeaponDamageEvent* _instance); CAPI void alt_CWeaponDamageEvent_Create_1(struct alt_CEvent* _p0, struct alt_CWeaponDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CWeaponDamageEvent_CAPI_Free() CAPI struct alt_CWeaponDamageEvent* alt_CWeaponDamageEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CWeaponDamageEvent_Assign_constCEventRef(struct alt_CWeaponDamageEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CWeaponDamageEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _source, struct alt_RefBase_RefStore_IEntity* _target, unsigned int _weaponHash, unsigned short _damageValue, struct alt_Vector_float_3_VectorLayout_float_3* _shotOffset, alt_CWeaponDamageEvent_BodyPart _bodyPart, struct alt_CWeaponDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CWeaponDamageEvent_CAPI_Free() CAPI struct alt_CWeaponDamageEvent* alt_CWeaponDamageEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _source, struct alt_RefBase_RefStore_IEntity* _target, unsigned int _weaponHash, unsigned short _damageValue, struct alt_Vector_float_3_VectorLayout_float_3* _shotOffset, alt_CWeaponDamageEvent_BodyPart _bodyPart); CAPI void alt_CWeaponDamageEvent_GetSource(struct alt_CWeaponDamageEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CWeaponDamageEvent_GetSource_CAPI_Heap(struct alt_CWeaponDamageEvent* _instance); CAPI void alt_CWeaponDamageEvent_GetTarget(struct alt_CWeaponDamageEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CWeaponDamageEvent_GetTarget_CAPI_Heap(struct alt_CWeaponDamageEvent* _instance); CAPI unsigned int alt_CWeaponDamageEvent_GetWeaponHash(struct alt_CWeaponDamageEvent* _instance); CAPI unsigned short alt_CWeaponDamageEvent_GetDamageValue(struct alt_CWeaponDamageEvent* _instance); CAPI void alt_CWeaponDamageEvent_GetShotOffset(struct alt_CWeaponDamageEvent* _instance, struct alt_Vector_float_3_VectorLayout_float_3* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_VectorLayout_float_3_CAPI_Free() CAPI struct alt_Vector_float_3_VectorLayout_float_3* alt_CWeaponDamageEvent_GetShotOffset_CAPI_Heap(struct alt_CWeaponDamageEvent* _instance); CAPI alt_CWeaponDamageEvent_BodyPart alt_CWeaponDamageEvent_GetBodyPart(struct alt_CWeaponDamageEvent* _instance); CAPI void alt_CWeaponDamageEvent_Create_3(struct alt_CWeaponDamageEvent* _p0, struct alt_CWeaponDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CWeaponDamageEvent_CAPI_Free() CAPI struct alt_CWeaponDamageEvent* alt_CWeaponDamageEvent_Create_3_CAPI_Heap(struct alt_CWeaponDamageEvent* _p0); CAPI void alt_CWeaponDamageEvent_Create_4(struct alt_CWeaponDamageEvent* _p0, struct alt_CWeaponDamageEvent* _returnValue); // Return ptr must be manually freed with alt_CWeaponDamageEvent_CAPI_Free() CAPI struct alt_CWeaponDamageEvent* alt_CWeaponDamageEvent_Create_4_CAPI_Heap(struct alt_CWeaponDamageEvent* _p0); CAPI void alt_CWeaponDamageEvent_Assign_constCWeaponDamageEventRef(struct alt_CWeaponDamageEvent* _instance, struct alt_CWeaponDamageEvent* _p0); CAPI void alt_CWeaponDamageEvent_Assign_CWeaponDamageEventRefRef(struct alt_CWeaponDamageEvent* _instance, struct alt_CWeaponDamageEvent* _p0); typedef enum alt_CExplosionEvent_ExplosionType { ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_GRENADE = 0, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_GRENADELAUNCHER = 1, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_STICKYBOMB = 2, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_MOLOTOV = 3, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_ROCKET = 4, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_TANKSHELL = 5, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_HI_OCTANE = 6, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_CAR = 7, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_PLANE = 8, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_PETROL_PUMP = 9, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_BIKE = 10, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_DIR_STEAM = 11, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_DIR_FLAME = 12, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_DIR_WATER_HYDRANT = 13, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_DIR_GAS_CANISTER = 14, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_BOAT = 15, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_SHIP_DESTROY = 16, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_TRUCK = 17, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_BULLET = 18, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_SMOKEGRENADELAUNCHER = 19, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_SMOKEGRENADE = 20, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_BZGAS = 21, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_FLARE = 22, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_GAS_CANISTER = 23, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_EXTINGUISHER = 24, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_PROGRAMMABLEAR = 25, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_TRAIN = 26, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_BARREL = 27, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_PROPANE = 28, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_BLIMP = 29, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_DIR_FLAME_EXPLODE = 30, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_TANKER = 31, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_PLANE_ROCKET = 32, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_VEHICLE_BULLET = 33, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_GAS_TANK = 34, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_FIREWORK = 35, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_SNOWBALL = 36, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_PROXMINE = 37, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_VALKYRIE_CANNON = 38, ALT_CEXPLOSIONEVENT_EXPLOSIONTYPE_UNKNOWN = 255 }; typedef struct alt_CExplosionEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IPlayer source; alt_CExplosionEvent_ExplosionType explosionType; struct alt_Vector_float_3_PointLayout position; unsigned int explosionFX; } alt_CExplosionEvent; CAPI void alt_CExplosionEvent_CAPI_Free(struct alt_CExplosionEvent* ptr); CAPI struct alt_CExplosionEvent* alt_CEvent_to_alt_CExplosionEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CExplosionEvent_to_alt_CEvent(struct alt_CExplosionEvent* from); CAPI void alt_CExplosionEvent_Create(alt_CEvent_Type _type, struct alt_CExplosionEvent* _returnValue); // Return ptr must be manually freed with alt_CExplosionEvent_CAPI_Free() CAPI struct alt_CExplosionEvent* alt_CExplosionEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CExplosionEvent_GetType(struct alt_CExplosionEvent* _instance); CAPI _Bool alt_CExplosionEvent_WasCancelled(struct alt_CExplosionEvent* _instance); CAPI void alt_CExplosionEvent_Cancel(struct alt_CExplosionEvent* _instance); CAPI void alt_CExplosionEvent_Create_1(struct alt_CEvent* _p0, struct alt_CExplosionEvent* _returnValue); // Return ptr must be manually freed with alt_CExplosionEvent_CAPI_Free() CAPI struct alt_CExplosionEvent* alt_CExplosionEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CExplosionEvent_Assign_constCEventRef(struct alt_CExplosionEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CExplosionEvent_Create_2(struct alt_RefBase_RefStore_IPlayer* _source, alt_CExplosionEvent_ExplosionType _explosionType, struct alt_Vector_float_3_PointLayout* _position, unsigned int _explosionFX, struct alt_CExplosionEvent* _returnValue); // Return ptr must be manually freed with alt_CExplosionEvent_CAPI_Free() CAPI struct alt_CExplosionEvent* alt_CExplosionEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IPlayer* _source, alt_CExplosionEvent_ExplosionType _explosionType, struct alt_Vector_float_3_PointLayout* _position, unsigned int _explosionFX); CAPI void alt_CExplosionEvent_GetSource(struct alt_CExplosionEvent* _instance, struct alt_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_RefBase_RefStore_IPlayer* alt_CExplosionEvent_GetSource_CAPI_Heap(struct alt_CExplosionEvent* _instance); CAPI alt_CExplosionEvent_ExplosionType alt_CExplosionEvent_GetExplosionType(struct alt_CExplosionEvent* _instance); CAPI void alt_CExplosionEvent_GetPosition(struct alt_CExplosionEvent* _instance, struct alt_Vector_float_3_PointLayout* _returnValue); // Return ptr must be manually freed with alt_Vector_float_3_PointLayout_CAPI_Free() CAPI struct alt_Vector_float_3_PointLayout* alt_CExplosionEvent_GetPosition_CAPI_Heap(struct alt_CExplosionEvent* _instance); CAPI unsigned int alt_CExplosionEvent_GetExplosionFX(struct alt_CExplosionEvent* _instance); CAPI void alt_CExplosionEvent_Create_3(struct alt_CExplosionEvent* _p0, struct alt_CExplosionEvent* _returnValue); // Return ptr must be manually freed with alt_CExplosionEvent_CAPI_Free() CAPI struct alt_CExplosionEvent* alt_CExplosionEvent_Create_3_CAPI_Heap(struct alt_CExplosionEvent* _p0); CAPI void alt_CExplosionEvent_Create_4(struct alt_CExplosionEvent* _p0, struct alt_CExplosionEvent* _returnValue); // Return ptr must be manually freed with alt_CExplosionEvent_CAPI_Free() CAPI struct alt_CExplosionEvent* alt_CExplosionEvent_Create_4_CAPI_Heap(struct alt_CExplosionEvent* _p0); CAPI void alt_CExplosionEvent_Assign_constCExplosionEventRef(struct alt_CExplosionEvent* _instance, struct alt_CExplosionEvent* _p0); CAPI void alt_CExplosionEvent_Assign_CExplosionEventRefRef(struct alt_CExplosionEvent* _instance, struct alt_CExplosionEvent* _p0); typedef struct alt_IResource { void* vtable; } alt_IResource; CAPI struct alt_IScriptRuntime* alt_IResource_GetRuntime(struct alt_IResource* _instance); CAPI struct alt_IResource_Impl* alt_IResource_GetImpl(struct alt_IResource* _instance); CAPI _Bool alt_IResource_IsStarted(struct alt_IResource* _instance); CAPI void alt_IResource_GetType(struct alt_IResource* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IResource_GetType_CAPI_Heap(struct alt_IResource* _instance); CAPI void alt_IResource_GetName(struct alt_IResource* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IResource_GetName_CAPI_Heap(struct alt_IResource* _instance); CAPI void alt_IResource_GetPath(struct alt_IResource* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IResource_GetPath_CAPI_Heap(struct alt_IResource* _instance); CAPI void alt_IResource_GetMain(struct alt_IResource* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_IResource_GetMain_CAPI_Heap(struct alt_IResource* _instance); CAPI struct alt_IPackage* alt_IResource_GetPackage(struct alt_IResource* _instance); CAPI void alt_IResource_GetExports(struct alt_IResource* _instance, struct alt_RefBase_RefStore_IMValueDict* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueDict_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueDict* alt_IResource_GetExports_CAPI_Heap(struct alt_IResource* _instance); CAPI void alt_IResource_GetDependencies(struct alt_IResource* _instance, struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with constArray_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_IResource_GetDependencies_CAPI_Heap(struct alt_IResource* _instance); CAPI void alt_IResource_GetDependants(struct alt_IResource* _instance, struct alt_Array_StringView* _returnValue); // Return ptr must be manually freed with constArray_StringView_CAPI_Free() CAPI struct alt_Array_StringView* alt_IResource_GetDependants_CAPI_Heap(struct alt_IResource* _instance); CAPI void alt_IResource_SetExports(struct alt_IResource* _instance, struct alt_RefBase_RefStore_IMValueDict* exports); CAPI void alt_IResource_Assign_constIResourceRef(struct alt_IResource* _instance, struct alt_IResource* _p0); typedef struct alt_IResource_CreationInfo { struct alt_String type; struct alt_String name; struct alt_String main; struct alt_IPackage* pkg; } alt_IResource_CreationInfo; CAPI void alt_IResource_CreationInfo_CAPI_Free(struct alt_IResource_CreationInfo* ptr); CAPI void alt_IResource_CreationInfo_Create(struct alt_IResource_CreationInfo* _p0, struct alt_IResource_CreationInfo* _returnValue); // Return ptr must be manually freed with alt_IResource_CreationInfo_CAPI_Free() CAPI struct alt_IResource_CreationInfo* alt_IResource_CreationInfo_Create_CAPI_Heap(struct alt_IResource_CreationInfo* _p0); CAPI void alt_IResource_CreationInfo_Create_1(struct alt_IResource_CreationInfo* _p0, struct alt_IResource_CreationInfo* _returnValue); // Return ptr must be manually freed with alt_IResource_CreationInfo_CAPI_Free() CAPI struct alt_IResource_CreationInfo* alt_IResource_CreationInfo_Create_1_CAPI_Heap(struct alt_IResource_CreationInfo* _p0); CAPI void alt_IResource_CreationInfo_Assign_IResource_CreationInfoRefRef(struct alt_IResource_CreationInfo* _instance, struct alt_IResource_CreationInfo* _p0); typedef struct alt_IResource_Impl { void* vtable; } alt_IResource_Impl; CAPI void alt_IResource_Impl_CAPI_Free(struct alt_IResource_Impl* ptr); CAPI _Bool alt_IResource_Impl_MakeClient(struct alt_IResource_Impl* _instance, struct alt_IResource_CreationInfo* info, struct alt_Array_String* files); CAPI _Bool alt_IResource_Impl_Start(struct alt_IResource_Impl* _instance); CAPI _Bool alt_IResource_Impl_Stop(struct alt_IResource_Impl* _instance); CAPI _Bool alt_IResource_Impl_OnEvent(struct alt_IResource_Impl* _instance, struct alt_CEvent* ev); CAPI void alt_IResource_Impl_OnTick(struct alt_IResource_Impl* _instance); CAPI void alt_IResource_Impl_OnCreateBaseObject(struct alt_IResource_Impl* _instance, struct alt_RefBase_RefStore_IBaseObject* object); CAPI void alt_IResource_Impl_OnRemoveBaseObject(struct alt_IResource_Impl* _instance, struct alt_RefBase_RefStore_IBaseObject* object); CAPI void alt_IResource_Impl_Assign_constIResource_ImplRef(struct alt_IResource_Impl* _instance, struct alt_IResource_Impl* _p0); typedef struct alt_CResourceStartEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_IResource* resource; } alt_CResourceStartEvent; CAPI void alt_CResourceStartEvent_CAPI_Free(struct alt_CResourceStartEvent* ptr); CAPI struct alt_CResourceStartEvent* alt_CEvent_to_alt_CResourceStartEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CResourceStartEvent_to_alt_CEvent(struct alt_CResourceStartEvent* from); CAPI void alt_CResourceStartEvent_Create(alt_CEvent_Type _type, struct alt_CResourceStartEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStartEvent_CAPI_Free() CAPI struct alt_CResourceStartEvent* alt_CResourceStartEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CResourceStartEvent_GetType(struct alt_CResourceStartEvent* _instance); CAPI _Bool alt_CResourceStartEvent_WasCancelled(struct alt_CResourceStartEvent* _instance); CAPI void alt_CResourceStartEvent_Cancel(struct alt_CResourceStartEvent* _instance); CAPI void alt_CResourceStartEvent_Create_1(struct alt_CEvent* _p0, struct alt_CResourceStartEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStartEvent_CAPI_Free() CAPI struct alt_CResourceStartEvent* alt_CResourceStartEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CResourceStartEvent_Assign_constCEventRef(struct alt_CResourceStartEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CResourceStartEvent_Create_2(struct alt_IResource* _resource, struct alt_CResourceStartEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStartEvent_CAPI_Free() CAPI struct alt_CResourceStartEvent* alt_CResourceStartEvent_Create_2_CAPI_Heap(struct alt_IResource* _resource); CAPI struct alt_IResource* alt_CResourceStartEvent_GetResource(struct alt_CResourceStartEvent* _instance); CAPI void alt_CResourceStartEvent_Create_3(struct alt_CResourceStartEvent* _p0, struct alt_CResourceStartEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStartEvent_CAPI_Free() CAPI struct alt_CResourceStartEvent* alt_CResourceStartEvent_Create_3_CAPI_Heap(struct alt_CResourceStartEvent* _p0); CAPI void alt_CResourceStartEvent_Create_4(struct alt_CResourceStartEvent* _p0, struct alt_CResourceStartEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStartEvent_CAPI_Free() CAPI struct alt_CResourceStartEvent* alt_CResourceStartEvent_Create_4_CAPI_Heap(struct alt_CResourceStartEvent* _p0); CAPI void alt_CResourceStartEvent_Assign_constCResourceStartEventRef(struct alt_CResourceStartEvent* _instance, struct alt_CResourceStartEvent* _p0); CAPI void alt_CResourceStartEvent_Assign_CResourceStartEventRefRef(struct alt_CResourceStartEvent* _instance, struct alt_CResourceStartEvent* _p0); typedef struct alt_CResourceStopEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_IResource* resource; } alt_CResourceStopEvent; CAPI void alt_CResourceStopEvent_CAPI_Free(struct alt_CResourceStopEvent* ptr); CAPI struct alt_CResourceStopEvent* alt_CEvent_to_alt_CResourceStopEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CResourceStopEvent_to_alt_CEvent(struct alt_CResourceStopEvent* from); CAPI void alt_CResourceStopEvent_Create(alt_CEvent_Type _type, struct alt_CResourceStopEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStopEvent_CAPI_Free() CAPI struct alt_CResourceStopEvent* alt_CResourceStopEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CResourceStopEvent_GetType(struct alt_CResourceStopEvent* _instance); CAPI _Bool alt_CResourceStopEvent_WasCancelled(struct alt_CResourceStopEvent* _instance); CAPI void alt_CResourceStopEvent_Cancel(struct alt_CResourceStopEvent* _instance); CAPI void alt_CResourceStopEvent_Create_1(struct alt_CEvent* _p0, struct alt_CResourceStopEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStopEvent_CAPI_Free() CAPI struct alt_CResourceStopEvent* alt_CResourceStopEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CResourceStopEvent_Assign_constCEventRef(struct alt_CResourceStopEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CResourceStopEvent_Create_2(struct alt_IResource* _resource, struct alt_CResourceStopEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStopEvent_CAPI_Free() CAPI struct alt_CResourceStopEvent* alt_CResourceStopEvent_Create_2_CAPI_Heap(struct alt_IResource* _resource); CAPI struct alt_IResource* alt_CResourceStopEvent_GetResource(struct alt_CResourceStopEvent* _instance); CAPI void alt_CResourceStopEvent_Create_3(struct alt_CResourceStopEvent* _p0, struct alt_CResourceStopEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStopEvent_CAPI_Free() CAPI struct alt_CResourceStopEvent* alt_CResourceStopEvent_Create_3_CAPI_Heap(struct alt_CResourceStopEvent* _p0); CAPI void alt_CResourceStopEvent_Create_4(struct alt_CResourceStopEvent* _p0, struct alt_CResourceStopEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceStopEvent_CAPI_Free() CAPI struct alt_CResourceStopEvent* alt_CResourceStopEvent_Create_4_CAPI_Heap(struct alt_CResourceStopEvent* _p0); CAPI void alt_CResourceStopEvent_Assign_constCResourceStopEventRef(struct alt_CResourceStopEvent* _instance, struct alt_CResourceStopEvent* _p0); CAPI void alt_CResourceStopEvent_Assign_CResourceStopEventRefRef(struct alt_CResourceStopEvent* _instance, struct alt_CResourceStopEvent* _p0); typedef struct alt_CResourceErrorEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_IResource* resource; } alt_CResourceErrorEvent; CAPI void alt_CResourceErrorEvent_CAPI_Free(struct alt_CResourceErrorEvent* ptr); CAPI struct alt_CResourceErrorEvent* alt_CEvent_to_alt_CResourceErrorEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CResourceErrorEvent_to_alt_CEvent(struct alt_CResourceErrorEvent* from); CAPI void alt_CResourceErrorEvent_Create(alt_CEvent_Type _type, struct alt_CResourceErrorEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceErrorEvent_CAPI_Free() CAPI struct alt_CResourceErrorEvent* alt_CResourceErrorEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CResourceErrorEvent_GetType(struct alt_CResourceErrorEvent* _instance); CAPI _Bool alt_CResourceErrorEvent_WasCancelled(struct alt_CResourceErrorEvent* _instance); CAPI void alt_CResourceErrorEvent_Cancel(struct alt_CResourceErrorEvent* _instance); CAPI void alt_CResourceErrorEvent_Create_1(struct alt_CEvent* _p0, struct alt_CResourceErrorEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceErrorEvent_CAPI_Free() CAPI struct alt_CResourceErrorEvent* alt_CResourceErrorEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CResourceErrorEvent_Assign_constCEventRef(struct alt_CResourceErrorEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CResourceErrorEvent_Create_2(struct alt_IResource* _resource, struct alt_CResourceErrorEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceErrorEvent_CAPI_Free() CAPI struct alt_CResourceErrorEvent* alt_CResourceErrorEvent_Create_2_CAPI_Heap(struct alt_IResource* _resource); CAPI struct alt_IResource* alt_CResourceErrorEvent_GetResource(struct alt_CResourceErrorEvent* _instance); CAPI void alt_CResourceErrorEvent_Create_3(struct alt_CResourceErrorEvent* _p0, struct alt_CResourceErrorEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceErrorEvent_CAPI_Free() CAPI struct alt_CResourceErrorEvent* alt_CResourceErrorEvent_Create_3_CAPI_Heap(struct alt_CResourceErrorEvent* _p0); CAPI void alt_CResourceErrorEvent_Create_4(struct alt_CResourceErrorEvent* _p0, struct alt_CResourceErrorEvent* _returnValue); // Return ptr must be manually freed with alt_CResourceErrorEvent_CAPI_Free() CAPI struct alt_CResourceErrorEvent* alt_CResourceErrorEvent_Create_4_CAPI_Heap(struct alt_CResourceErrorEvent* _p0); CAPI void alt_CResourceErrorEvent_Assign_constCResourceErrorEventRef(struct alt_CResourceErrorEvent* _instance, struct alt_CResourceErrorEvent* _p0); CAPI void alt_CResourceErrorEvent_Assign_CResourceErrorEventRefRef(struct alt_CResourceErrorEvent* _instance, struct alt_CResourceErrorEvent* _p0); typedef struct alt_CSyncedMetaDataChangeEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IEntity target; struct alt_String key; struct alt_RefBase_RefStore_constIMValue val; struct alt_RefBase_RefStore_constIMValue oldVal; } alt_CSyncedMetaDataChangeEvent; CAPI void alt_CSyncedMetaDataChangeEvent_CAPI_Free(struct alt_CSyncedMetaDataChangeEvent* ptr); CAPI struct alt_CSyncedMetaDataChangeEvent* alt_CEvent_to_alt_CSyncedMetaDataChangeEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CSyncedMetaDataChangeEvent_to_alt_CEvent(struct alt_CSyncedMetaDataChangeEvent* from); CAPI void alt_CSyncedMetaDataChangeEvent_Create(alt_CEvent_Type _type, struct alt_CSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CSyncedMetaDataChangeEvent* alt_CSyncedMetaDataChangeEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CSyncedMetaDataChangeEvent_GetType(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI _Bool alt_CSyncedMetaDataChangeEvent_WasCancelled(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI void alt_CSyncedMetaDataChangeEvent_Cancel(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI void alt_CSyncedMetaDataChangeEvent_Create_1(struct alt_CEvent* _p0, struct alt_CSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CSyncedMetaDataChangeEvent* alt_CSyncedMetaDataChangeEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CSyncedMetaDataChangeEvent_Assign_constCEventRef(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CSyncedMetaDataChangeEvent_Create_2(struct alt_RefBase_RefStore_IEntity* _target, struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal, struct alt_CSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CSyncedMetaDataChangeEvent* alt_CSyncedMetaDataChangeEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IEntity* _target, struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal); CAPI void alt_CSyncedMetaDataChangeEvent_GetTarget(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CSyncedMetaDataChangeEvent_GetTarget_CAPI_Heap(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI void alt_CSyncedMetaDataChangeEvent_GetKey(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CSyncedMetaDataChangeEvent_GetKey_CAPI_Heap(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI void alt_CSyncedMetaDataChangeEvent_GetVal(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CSyncedMetaDataChangeEvent_GetVal_CAPI_Heap(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI void alt_CSyncedMetaDataChangeEvent_GetOldVal(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CSyncedMetaDataChangeEvent_GetOldVal_CAPI_Heap(struct alt_CSyncedMetaDataChangeEvent* _instance); CAPI void alt_CSyncedMetaDataChangeEvent_Create_3(struct alt_CSyncedMetaDataChangeEvent* _p0, struct alt_CSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CSyncedMetaDataChangeEvent* alt_CSyncedMetaDataChangeEvent_Create_3_CAPI_Heap(struct alt_CSyncedMetaDataChangeEvent* _p0); CAPI void alt_CSyncedMetaDataChangeEvent_Create_4(struct alt_CSyncedMetaDataChangeEvent* _p0, struct alt_CSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CSyncedMetaDataChangeEvent* alt_CSyncedMetaDataChangeEvent_Create_4_CAPI_Heap(struct alt_CSyncedMetaDataChangeEvent* _p0); CAPI void alt_CSyncedMetaDataChangeEvent_Assign_constCSyncedMetaDataChangeEventRef(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_CSyncedMetaDataChangeEvent* _p0); CAPI void alt_CSyncedMetaDataChangeEvent_Assign_CSyncedMetaDataChangeEventRefRef(struct alt_CSyncedMetaDataChangeEvent* _instance, struct alt_CSyncedMetaDataChangeEvent* _p0); typedef struct alt_CStreamSyncedMetaDataChangeEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IEntity target; struct alt_String key; struct alt_RefBase_RefStore_constIMValue val; struct alt_RefBase_RefStore_constIMValue oldVal; } alt_CStreamSyncedMetaDataChangeEvent; CAPI void alt_CStreamSyncedMetaDataChangeEvent_CAPI_Free(struct alt_CStreamSyncedMetaDataChangeEvent* ptr); CAPI struct alt_CStreamSyncedMetaDataChangeEvent* alt_CEvent_to_alt_CStreamSyncedMetaDataChangeEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CStreamSyncedMetaDataChangeEvent_to_alt_CEvent(struct alt_CStreamSyncedMetaDataChangeEvent* from); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Create(alt_CEvent_Type _type, struct alt_CStreamSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CStreamSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CStreamSyncedMetaDataChangeEvent* alt_CStreamSyncedMetaDataChangeEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CStreamSyncedMetaDataChangeEvent_GetType(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI _Bool alt_CStreamSyncedMetaDataChangeEvent_WasCancelled(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Cancel(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Create_1(struct alt_CEvent* _p0, struct alt_CStreamSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CStreamSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CStreamSyncedMetaDataChangeEvent* alt_CStreamSyncedMetaDataChangeEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Assign_constCEventRef(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Create_2(struct alt_RefBase_RefStore_IEntity* _target, struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal, struct alt_CStreamSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CStreamSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CStreamSyncedMetaDataChangeEvent* alt_CStreamSyncedMetaDataChangeEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IEntity* _target, struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal); CAPI void alt_CStreamSyncedMetaDataChangeEvent_GetTarget(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_CStreamSyncedMetaDataChangeEvent_GetTarget_CAPI_Heap(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI void alt_CStreamSyncedMetaDataChangeEvent_GetKey(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CStreamSyncedMetaDataChangeEvent_GetKey_CAPI_Heap(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI void alt_CStreamSyncedMetaDataChangeEvent_GetVal(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CStreamSyncedMetaDataChangeEvent_GetVal_CAPI_Heap(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI void alt_CStreamSyncedMetaDataChangeEvent_GetOldVal(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CStreamSyncedMetaDataChangeEvent_GetOldVal_CAPI_Heap(struct alt_CStreamSyncedMetaDataChangeEvent* _instance); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Create_3(struct alt_CStreamSyncedMetaDataChangeEvent* _p0, struct alt_CStreamSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CStreamSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CStreamSyncedMetaDataChangeEvent* alt_CStreamSyncedMetaDataChangeEvent_Create_3_CAPI_Heap(struct alt_CStreamSyncedMetaDataChangeEvent* _p0); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Create_4(struct alt_CStreamSyncedMetaDataChangeEvent* _p0, struct alt_CStreamSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CStreamSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CStreamSyncedMetaDataChangeEvent* alt_CStreamSyncedMetaDataChangeEvent_Create_4_CAPI_Heap(struct alt_CStreamSyncedMetaDataChangeEvent* _p0); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Assign_constCStreamSyncedMetaDataChangeEventRef(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_CStreamSyncedMetaDataChangeEvent* _p0); CAPI void alt_CStreamSyncedMetaDataChangeEvent_Assign_CStreamSyncedMetaDataChangeEventRefRef(struct alt_CStreamSyncedMetaDataChangeEvent* _instance, struct alt_CStreamSyncedMetaDataChangeEvent* _p0); typedef struct alt_CGlobalMetaDataChangeEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_String key; struct alt_RefBase_RefStore_constIMValue val; struct alt_RefBase_RefStore_constIMValue oldVal; } alt_CGlobalMetaDataChangeEvent; CAPI void alt_CGlobalMetaDataChangeEvent_CAPI_Free(struct alt_CGlobalMetaDataChangeEvent* ptr); CAPI struct alt_CGlobalMetaDataChangeEvent* alt_CEvent_to_alt_CGlobalMetaDataChangeEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CGlobalMetaDataChangeEvent_to_alt_CEvent(struct alt_CGlobalMetaDataChangeEvent* from); CAPI void alt_CGlobalMetaDataChangeEvent_Create(alt_CEvent_Type _type, struct alt_CGlobalMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalMetaDataChangeEvent* alt_CGlobalMetaDataChangeEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CGlobalMetaDataChangeEvent_GetType(struct alt_CGlobalMetaDataChangeEvent* _instance); CAPI _Bool alt_CGlobalMetaDataChangeEvent_WasCancelled(struct alt_CGlobalMetaDataChangeEvent* _instance); CAPI void alt_CGlobalMetaDataChangeEvent_Cancel(struct alt_CGlobalMetaDataChangeEvent* _instance); CAPI void alt_CGlobalMetaDataChangeEvent_Create_1(struct alt_CEvent* _p0, struct alt_CGlobalMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalMetaDataChangeEvent* alt_CGlobalMetaDataChangeEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CGlobalMetaDataChangeEvent_Assign_constCEventRef(struct alt_CGlobalMetaDataChangeEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CGlobalMetaDataChangeEvent_Create_2(struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal, struct alt_CGlobalMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalMetaDataChangeEvent* alt_CGlobalMetaDataChangeEvent_Create_2_CAPI_Heap(struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal); CAPI void alt_CGlobalMetaDataChangeEvent_GetKey(struct alt_CGlobalMetaDataChangeEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CGlobalMetaDataChangeEvent_GetKey_CAPI_Heap(struct alt_CGlobalMetaDataChangeEvent* _instance); CAPI void alt_CGlobalMetaDataChangeEvent_GetVal(struct alt_CGlobalMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CGlobalMetaDataChangeEvent_GetVal_CAPI_Heap(struct alt_CGlobalMetaDataChangeEvent* _instance); CAPI void alt_CGlobalMetaDataChangeEvent_GetOldVal(struct alt_CGlobalMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CGlobalMetaDataChangeEvent_GetOldVal_CAPI_Heap(struct alt_CGlobalMetaDataChangeEvent* _instance); CAPI void alt_CGlobalMetaDataChangeEvent_Create_3(struct alt_CGlobalMetaDataChangeEvent* _p0, struct alt_CGlobalMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalMetaDataChangeEvent* alt_CGlobalMetaDataChangeEvent_Create_3_CAPI_Heap(struct alt_CGlobalMetaDataChangeEvent* _p0); CAPI void alt_CGlobalMetaDataChangeEvent_Create_4(struct alt_CGlobalMetaDataChangeEvent* _p0, struct alt_CGlobalMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalMetaDataChangeEvent* alt_CGlobalMetaDataChangeEvent_Create_4_CAPI_Heap(struct alt_CGlobalMetaDataChangeEvent* _p0); CAPI void alt_CGlobalMetaDataChangeEvent_Assign_constCGlobalMetaDataChangeEventRef(struct alt_CGlobalMetaDataChangeEvent* _instance, struct alt_CGlobalMetaDataChangeEvent* _p0); CAPI void alt_CGlobalMetaDataChangeEvent_Assign_CGlobalMetaDataChangeEventRefRef(struct alt_CGlobalMetaDataChangeEvent* _instance, struct alt_CGlobalMetaDataChangeEvent* _p0); typedef struct alt_CGlobalSyncedMetaDataChangeEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_String key; struct alt_RefBase_RefStore_constIMValue val; struct alt_RefBase_RefStore_constIMValue oldVal; } alt_CGlobalSyncedMetaDataChangeEvent; CAPI void alt_CGlobalSyncedMetaDataChangeEvent_CAPI_Free(struct alt_CGlobalSyncedMetaDataChangeEvent* ptr); CAPI struct alt_CGlobalSyncedMetaDataChangeEvent* alt_CEvent_to_alt_CGlobalSyncedMetaDataChangeEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CGlobalSyncedMetaDataChangeEvent_to_alt_CEvent(struct alt_CGlobalSyncedMetaDataChangeEvent* from); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Create(alt_CEvent_Type _type, struct alt_CGlobalSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalSyncedMetaDataChangeEvent* alt_CGlobalSyncedMetaDataChangeEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CGlobalSyncedMetaDataChangeEvent_GetType(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance); CAPI _Bool alt_CGlobalSyncedMetaDataChangeEvent_WasCancelled(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Cancel(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Create_1(struct alt_CEvent* _p0, struct alt_CGlobalSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalSyncedMetaDataChangeEvent* alt_CGlobalSyncedMetaDataChangeEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Assign_constCEventRef(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Create_2(struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal, struct alt_CGlobalSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalSyncedMetaDataChangeEvent* alt_CGlobalSyncedMetaDataChangeEvent_Create_2_CAPI_Heap(struct alt_StringView* _key, struct alt_RefBase_RefStore_constIMValue* _val, struct alt_RefBase_RefStore_constIMValue* _oldVal); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_GetKey(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_CGlobalSyncedMetaDataChangeEvent_GetKey_CAPI_Heap(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_GetVal(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CGlobalSyncedMetaDataChangeEvent_GetVal_CAPI_Heap(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_GetOldVal(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_CGlobalSyncedMetaDataChangeEvent_GetOldVal_CAPI_Heap(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Create_3(struct alt_CGlobalSyncedMetaDataChangeEvent* _p0, struct alt_CGlobalSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalSyncedMetaDataChangeEvent* alt_CGlobalSyncedMetaDataChangeEvent_Create_3_CAPI_Heap(struct alt_CGlobalSyncedMetaDataChangeEvent* _p0); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Create_4(struct alt_CGlobalSyncedMetaDataChangeEvent* _p0, struct alt_CGlobalSyncedMetaDataChangeEvent* _returnValue); // Return ptr must be manually freed with alt_CGlobalSyncedMetaDataChangeEvent_CAPI_Free() CAPI struct alt_CGlobalSyncedMetaDataChangeEvent* alt_CGlobalSyncedMetaDataChangeEvent_Create_4_CAPI_Heap(struct alt_CGlobalSyncedMetaDataChangeEvent* _p0); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Assign_constCGlobalSyncedMetaDataChangeEventRef(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance, struct alt_CGlobalSyncedMetaDataChangeEvent* _p0); CAPI void alt_CGlobalSyncedMetaDataChangeEvent_Assign_CGlobalSyncedMetaDataChangeEventRefRef(struct alt_CGlobalSyncedMetaDataChangeEvent* _instance, struct alt_CGlobalSyncedMetaDataChangeEvent* _p0); typedef struct alt_CVehicleDestroyEvent { void* vtable; alt_CEvent_Type type; _Bool cancelled; struct alt_RefBase_RefStore_IVehicle target; } alt_CVehicleDestroyEvent; CAPI void alt_CVehicleDestroyEvent_CAPI_Free(struct alt_CVehicleDestroyEvent* ptr); CAPI struct alt_CVehicleDestroyEvent* alt_CEvent_to_alt_CVehicleDestroyEvent(struct alt_CEvent* from); CAPI struct alt_CEvent* alt_CVehicleDestroyEvent_to_alt_CEvent(struct alt_CVehicleDestroyEvent* from); CAPI void alt_CVehicleDestroyEvent_Create(alt_CEvent_Type _type, struct alt_CVehicleDestroyEvent* _returnValue); // Return ptr must be manually freed with alt_CVehicleDestroyEvent_CAPI_Free() CAPI struct alt_CVehicleDestroyEvent* alt_CVehicleDestroyEvent_Create_CAPI_Heap(alt_CEvent_Type _type); CAPI alt_CEvent_Type alt_CVehicleDestroyEvent_GetType(struct alt_CVehicleDestroyEvent* _instance); CAPI _Bool alt_CVehicleDestroyEvent_WasCancelled(struct alt_CVehicleDestroyEvent* _instance); CAPI void alt_CVehicleDestroyEvent_Cancel(struct alt_CVehicleDestroyEvent* _instance); CAPI void alt_CVehicleDestroyEvent_Create_1(struct alt_CEvent* _p0, struct alt_CVehicleDestroyEvent* _returnValue); // Return ptr must be manually freed with alt_CVehicleDestroyEvent_CAPI_Free() CAPI struct alt_CVehicleDestroyEvent* alt_CVehicleDestroyEvent_Create_1_CAPI_Heap(struct alt_CEvent* _p0); CAPI void alt_CVehicleDestroyEvent_Assign_constCEventRef(struct alt_CVehicleDestroyEvent* _instance, struct alt_CEvent* _p0); CAPI void alt_CVehicleDestroyEvent_Create_2(struct alt_RefBase_RefStore_IVehicle* _target, struct alt_CVehicleDestroyEvent* _returnValue); // Return ptr must be manually freed with alt_CVehicleDestroyEvent_CAPI_Free() CAPI struct alt_CVehicleDestroyEvent* alt_CVehicleDestroyEvent_Create_2_CAPI_Heap(struct alt_RefBase_RefStore_IVehicle* _target); CAPI void alt_CVehicleDestroyEvent_GetTarget(struct alt_CVehicleDestroyEvent* _instance, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_CVehicleDestroyEvent_GetTarget_CAPI_Heap(struct alt_CVehicleDestroyEvent* _instance); CAPI void alt_CVehicleDestroyEvent_Create_3(struct alt_CVehicleDestroyEvent* _p0, struct alt_CVehicleDestroyEvent* _returnValue); // Return ptr must be manually freed with alt_CVehicleDestroyEvent_CAPI_Free() CAPI struct alt_CVehicleDestroyEvent* alt_CVehicleDestroyEvent_Create_3_CAPI_Heap(struct alt_CVehicleDestroyEvent* _p0); CAPI void alt_CVehicleDestroyEvent_Create_4(struct alt_CVehicleDestroyEvent* _p0, struct alt_CVehicleDestroyEvent* _returnValue); // Return ptr must be manually freed with alt_CVehicleDestroyEvent_CAPI_Free() CAPI struct alt_CVehicleDestroyEvent* alt_CVehicleDestroyEvent_Create_4_CAPI_Heap(struct alt_CVehicleDestroyEvent* _p0); CAPI void alt_CVehicleDestroyEvent_Assign_constCVehicleDestroyEventRef(struct alt_CVehicleDestroyEvent* _instance, struct alt_CVehicleDestroyEvent* _p0); CAPI void alt_CVehicleDestroyEvent_Assign_CVehicleDestroyEventRefRef(struct alt_CVehicleDestroyEvent* _instance, struct alt_CVehicleDestroyEvent* _p0); typedef struct alt_IPackage { void* vtable; } alt_IPackage; CAPI void alt_IPackage_CAPI_Free(struct alt_IPackage* ptr); typedef enum alt_IPackage_Mode { ALT_IPACKAGE_MODE_READ = 0, ALT_IPACKAGE_MODE_WRITE = 1 }; CAPI alt_IPackage_Mode alt_IPackage_GetMode(struct alt_IPackage* _instance); CAPI _Bool alt_IPackage_FileExists(struct alt_IPackage* _instance, struct alt_StringView* path); CAPI struct alt_IPackage_File* alt_IPackage_OpenFile(struct alt_IPackage* _instance, struct alt_StringView* path); CAPI void alt_IPackage_CloseFile(struct alt_IPackage* _instance, struct alt_IPackage_File* file); CAPI unsigned long long alt_IPackage_GetFileSize(struct alt_IPackage* _instance, struct alt_IPackage_File* file); typedef enum alt_IPackage_SeekOrigin { ALT_IPACKAGE_SEEKORIGIN_SET = 0, ALT_IPACKAGE_SEEKORIGIN_CUR = 1, ALT_IPACKAGE_SEEKORIGIN_END = 2 }; CAPI void alt_IPackage_SeekFile(struct alt_IPackage* _instance, struct alt_IPackage_File* file, unsigned long long offset, alt_IPackage_SeekOrigin origin); CAPI unsigned long long alt_IPackage_TellFile(struct alt_IPackage* _instance, struct alt_IPackage_File* file); CAPI unsigned long long alt_IPackage_ReadFile(struct alt_IPackage* _instance, struct alt_IPackage_File* file, void* buffer, unsigned long long size); CAPI unsigned long long alt_IPackage_WriteFile(struct alt_IPackage* _instance, struct alt_IPackage_File* file, void* buffer, unsigned long long size); typedef struct alt_IPackage_File { void* vtable; } alt_IPackage_File; CAPI void alt_IPackage_File_CAPI_Free(struct alt_IPackage_File* ptr); CAPI void alt_IPackage_File_Assign_constIPackage_FileRef(struct alt_IPackage_File* _instance, struct alt_IPackage_File* _p0); typedef struct alt_IScriptRuntime { void* vtable; } alt_IScriptRuntime; CAPI void alt_IScriptRuntime_CAPI_Free(struct alt_IScriptRuntime* ptr); CAPI _Bool alt_IScriptRuntime_RequiresMain(struct alt_IScriptRuntime* _instance); CAPI struct alt_IResource_Impl* alt_IScriptRuntime_CreateImpl(struct alt_IScriptRuntime* _instance, struct alt_IResource* resource); CAPI void alt_IScriptRuntime_DestroyImpl(struct alt_IScriptRuntime* _instance, struct alt_IResource_Impl* impl); CAPI void alt_IScriptRuntime_OnTick(struct alt_IScriptRuntime* _instance); CAPI void alt_IScriptRuntime_OnDispose(struct alt_IScriptRuntime* _instance); CAPI void alt_IScriptRuntime_Assign_constIScriptRuntimeRef(struct alt_IScriptRuntime* _instance, struct alt_IScriptRuntime* _p0); typedef struct alt_KeyState { _Bool down; _Bool toggled; } alt_KeyState; CAPI void alt_KeyState_CAPI_Free(struct alt_KeyState* ptr); CAPI void alt_KeyState_Create(_Bool down, _Bool toggled, struct alt_KeyState* _returnValue); // Return ptr must be manually freed with alt_KeyState_CAPI_Free() CAPI struct alt_KeyState* alt_KeyState_Create_CAPI_Heap(_Bool down, _Bool toggled); CAPI _Bool alt_KeyState_IsDown(struct alt_KeyState* _instance); CAPI _Bool alt_KeyState_IsToggled(struct alt_KeyState* _instance); typedef struct alt_ICore { void* vtable; } alt_ICore; CAPI void alt_ICore_LogInfo(struct alt_ICore* _instance, struct alt_StringView* str); CAPI void alt_ICore_LogDebug(struct alt_ICore* _instance, struct alt_StringView* str); CAPI void alt_ICore_LogWarning(struct alt_ICore* _instance, struct alt_StringView* str); CAPI void alt_ICore_LogError(struct alt_ICore* _instance, struct alt_StringView* str); CAPI void alt_ICore_LogColored(struct alt_ICore* _instance, struct alt_StringView* str); CAPI void alt_ICore_CreateMValueNone(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IMValueNone* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueNone_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueNone* alt_ICore_CreateMValueNone_CAPI_Heap(struct alt_ICore* _instance); CAPI void alt_ICore_CreateMValueNil(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IMValueNil* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueNil_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueNil* alt_ICore_CreateMValueNil_CAPI_Heap(struct alt_ICore* _instance); CAPI void alt_ICore_CreateMValueBool(struct alt_ICore* _instance, _Bool val, struct alt_RefBase_RefStore_IMValueBool* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueBool_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueBool* alt_ICore_CreateMValueBool_CAPI_Heap(struct alt_ICore* _instance, _Bool val); CAPI void alt_ICore_CreateMValueInt(struct alt_ICore* _instance, long long val, struct alt_RefBase_RefStore_IMValueInt* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueInt_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueInt* alt_ICore_CreateMValueInt_CAPI_Heap(struct alt_ICore* _instance, long long val); CAPI void alt_ICore_CreateMValueUInt(struct alt_ICore* _instance, unsigned long long val, struct alt_RefBase_RefStore_IMValueUInt* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueUInt_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueUInt* alt_ICore_CreateMValueUInt_CAPI_Heap(struct alt_ICore* _instance, unsigned long long val); CAPI void alt_ICore_CreateMValueDouble(struct alt_ICore* _instance, double val, struct alt_RefBase_RefStore_IMValueDouble* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueDouble_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueDouble* alt_ICore_CreateMValueDouble_CAPI_Heap(struct alt_ICore* _instance, double val); CAPI void alt_ICore_CreateMValueString(struct alt_ICore* _instance, struct alt_String* val, struct alt_RefBase_RefStore_IMValueString* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueString_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueString* alt_ICore_CreateMValueString_CAPI_Heap(struct alt_ICore* _instance, struct alt_String* val); CAPI void alt_ICore_CreateMValueList(struct alt_ICore* _instance, unsigned long long size, struct alt_RefBase_RefStore_IMValueList* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueList_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueList* alt_ICore_CreateMValueList_CAPI_Heap(struct alt_ICore* _instance, unsigned long long size); CAPI void alt_ICore_CreateMValueDict(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IMValueDict* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueDict_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueDict* alt_ICore_CreateMValueDict_CAPI_Heap(struct alt_ICore* _instance); CAPI void alt_ICore_CreateMValueBaseObject(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IBaseObject* val, struct alt_RefBase_RefStore_IMValueBaseObject* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueBaseObject_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueBaseObject* alt_ICore_CreateMValueBaseObject_CAPI_Heap(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IBaseObject* val); CAPI void alt_ICore_CreateMValueFunction(struct alt_ICore* _instance, struct alt_IMValueFunction_Impl* impl, struct alt_RefBase_RefStore_IMValueFunction* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueFunction_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueFunction* alt_ICore_CreateMValueFunction_CAPI_Heap(struct alt_ICore* _instance, struct alt_IMValueFunction_Impl* impl); CAPI void alt_ICore_CreateMValueVector3(struct alt_ICore* _instance, struct alt_Vector_float_3_VectorLayout_float_3* val, struct alt_RefBase_RefStore_IMValueVector3* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueVector3_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueVector3* alt_ICore_CreateMValueVector3_CAPI_Heap(struct alt_ICore* _instance, struct alt_Vector_float_3_VectorLayout_float_3* val); CAPI void alt_ICore_CreateMValueRGBA(struct alt_ICore* _instance, struct alt_RGBA* val, struct alt_RefBase_RefStore_IMValueRGBA* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueRGBA_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueRGBA* alt_ICore_CreateMValueRGBA_CAPI_Heap(struct alt_ICore* _instance, struct alt_RGBA* val); CAPI void alt_ICore_CreateMValueByteArray(struct alt_ICore* _instance, unsigned char* data, unsigned long long size, struct alt_RefBase_RefStore_IMValueByteArray* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueByteArray_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueByteArray* alt_ICore_CreateMValueByteArray_CAPI_Heap(struct alt_ICore* _instance, unsigned char* data, unsigned long long size); CAPI void alt_ICore_CreateMValueByteArray_1(struct alt_ICore* _instance, unsigned long long size, struct alt_RefBase_RefStore_IMValueByteArray* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IMValueByteArray_CAPI_Free() CAPI struct alt_RefBase_RefStore_IMValueByteArray* alt_ICore_CreateMValueByteArray_1_CAPI_Heap(struct alt_ICore* _instance, unsigned long long size); CAPI _Bool alt_ICore_IsDebug(struct alt_ICore* _instance); CAPI unsigned int alt_ICore_Hash(struct alt_ICore* _instance, struct alt_StringView* str); CAPI _Bool alt_ICore_RegisterScriptRuntime(struct alt_ICore* _instance, struct alt_StringView* resourceType, struct alt_IScriptRuntime* runtime); CAPI _Bool alt_ICore_FileExists(struct alt_ICore* _instance, struct alt_StringView* path); CAPI void alt_ICore_FileRead(struct alt_ICore* _instance, struct alt_StringView* path, struct alt_String* _returnValue); // Return ptr must be manually freed with alt_String_CAPI_Free() CAPI struct alt_String* alt_ICore_FileRead_CAPI_Heap(struct alt_ICore* _instance, struct alt_StringView* path); CAPI struct alt_IResource* alt_ICore_GetResource(struct alt_ICore* _instance, struct alt_StringView* name); CAPI void alt_ICore_GetEntityByID(struct alt_ICore* _instance, unsigned short id, struct alt_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_RefBase_RefStore_IEntity* alt_ICore_GetEntityByID_CAPI_Heap(struct alt_ICore* _instance, unsigned short id); CAPI void alt_ICore_GetEntities(struct alt_ICore* _instance, struct alt_Array_RefBase_RefStore_IEntity* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_IEntity_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_IEntity* alt_ICore_GetEntities_CAPI_Heap(struct alt_ICore* _instance); CAPI void alt_ICore_GetPlayers(struct alt_ICore* _instance, struct alt_Array_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_IPlayer* alt_ICore_GetPlayers_CAPI_Heap(struct alt_ICore* _instance); CAPI void alt_ICore_GetVehicles(struct alt_ICore* _instance, struct alt_Array_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_IVehicle* alt_ICore_GetVehicles_CAPI_Heap(struct alt_ICore* _instance); CAPI void alt_ICore_TriggerLocalEvent(struct alt_ICore* _instance, struct alt_StringView* ev, struct alt_Array_RefBase_RefStore_constIMValue* args); CAPI _Bool alt_ICore_HasMetaData(struct alt_ICore* _instance, struct alt_StringView* key); CAPI void alt_ICore_GetMetaData(struct alt_ICore* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_ICore_GetMetaData_CAPI_Heap(struct alt_ICore* _instance, struct alt_StringView* key); CAPI void alt_ICore_SetMetaData(struct alt_ICore* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_ICore_DeleteMetaData(struct alt_ICore* _instance, struct alt_StringView* key); CAPI _Bool alt_ICore_HasSyncedMetaData(struct alt_ICore* _instance, struct alt_StringView* key); CAPI void alt_ICore_GetSyncedMetaData(struct alt_ICore* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_constIMValue* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_constIMValue_CAPI_Free() CAPI struct alt_RefBase_RefStore_constIMValue* alt_ICore_GetSyncedMetaData_CAPI_Heap(struct alt_ICore* _instance, struct alt_StringView* key); CAPI void alt_ICore_GetRootDirectory(struct alt_ICore* _instance, struct alt_StringView* _returnValue); // Return ptr must be manually freed with alt_StringView_CAPI_Free() CAPI struct alt_StringView* alt_ICore_GetRootDirectory_CAPI_Heap(struct alt_ICore* _instance); CAPI struct alt_IResource* alt_ICore_StartResource(struct alt_ICore* _instance, struct alt_StringView* name); CAPI void alt_ICore_StopResource(struct alt_ICore* _instance, struct alt_StringView* name); CAPI struct alt_IResource* alt_ICore_RestartResource(struct alt_ICore* _instance, struct alt_StringView* name); CAPI void alt_ICore_TriggerClientEvent(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IPlayer* target, struct alt_StringView* ev, struct alt_Array_RefBase_RefStore_constIMValue* args); CAPI void alt_ICore_SetSyncedMetaData(struct alt_ICore* _instance, struct alt_StringView* key, struct alt_RefBase_RefStore_IMValue* val); CAPI void alt_ICore_DeleteSyncedMetaData(struct alt_ICore* _instance, struct alt_StringView* key); CAPI void alt_ICore_CreateVehicle(struct alt_ICore* _instance, unsigned int model, struct alt_Vector_float_3_PointLayout* pos, struct alt_Vector_float_3_RotationLayout* rot, struct alt_RefBase_RefStore_IVehicle* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVehicle_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVehicle* alt_ICore_CreateVehicle_CAPI_Heap(struct alt_ICore* _instance, unsigned int model, struct alt_Vector_float_3_PointLayout* pos, struct alt_Vector_float_3_RotationLayout* rot); CAPI void alt_ICore_CreateCheckpoint(struct alt_ICore* _instance, unsigned char type, struct alt_Vector_float_3_PointLayout* pos, float radius, float height, struct alt_RGBA* color, struct alt_RefBase_RefStore_ICheckpoint* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_ICheckpoint_CAPI_Free() CAPI struct alt_RefBase_RefStore_ICheckpoint* alt_ICore_CreateCheckpoint_CAPI_Heap(struct alt_ICore* _instance, unsigned char type, struct alt_Vector_float_3_PointLayout* pos, float radius, float height, struct alt_RGBA* color); CAPI void alt_ICore_CreateBlip(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IPlayer* target, alt_IBlip_BlipType type, struct alt_Vector_float_3_PointLayout* pos, struct alt_RefBase_RefStore_IBlip* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBlip_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBlip* alt_ICore_CreateBlip_CAPI_Heap(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IPlayer* target, alt_IBlip_BlipType type, struct alt_Vector_float_3_PointLayout* pos); CAPI void alt_ICore_CreateBlip_1(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IPlayer* target, alt_IBlip_BlipType type, struct alt_RefBase_RefStore_IEntity* attachTo, struct alt_RefBase_RefStore_IBlip* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IBlip_CAPI_Free() CAPI struct alt_RefBase_RefStore_IBlip* alt_ICore_CreateBlip_1_CAPI_Heap(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IPlayer* target, alt_IBlip_BlipType type, struct alt_RefBase_RefStore_IEntity* attachTo); CAPI void alt_ICore_CreateVoiceChannel(struct alt_ICore* _instance, _Bool spatial, float maxDistance, struct alt_RefBase_RefStore_IVoiceChannel* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IVoiceChannel_CAPI_Free() CAPI struct alt_RefBase_RefStore_IVoiceChannel* alt_ICore_CreateVoiceChannel_CAPI_Heap(struct alt_ICore* _instance, _Bool spatial, float maxDistance); CAPI void alt_ICore_CreateColShapeCylinder(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, float radius, float height, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_ICore_CreateColShapeCylinder_CAPI_Heap(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, float radius, float height); CAPI void alt_ICore_CreateColShapeSphere(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, float radius, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_ICore_CreateColShapeSphere_CAPI_Heap(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, float radius); CAPI void alt_ICore_CreateColShapeCircle(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, float radius, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_ICore_CreateColShapeCircle_CAPI_Heap(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, float radius); CAPI void alt_ICore_CreateColShapeCube(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, struct alt_Vector_float_3_PointLayout* pos2, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_ICore_CreateColShapeCube_CAPI_Heap(struct alt_ICore* _instance, struct alt_Vector_float_3_PointLayout* pos, struct alt_Vector_float_3_PointLayout* pos2); CAPI void alt_ICore_CreateColShapeRectangle(struct alt_ICore* _instance, float x1, float y1, float x2, float y2, float z, struct alt_RefBase_RefStore_IColShape* _returnValue); // Return ptr must be manually freed with alt_RefBase_RefStore_IColShape_CAPI_Free() CAPI struct alt_RefBase_RefStore_IColShape* alt_ICore_CreateColShapeRectangle_CAPI_Heap(struct alt_ICore* _instance, float x1, float y1, float x2, float y2, float z); CAPI void alt_ICore_DestroyBaseObject(struct alt_ICore* _instance, struct alt_RefBase_RefStore_IBaseObject* handle); CAPI void alt_ICore_GetPlayersByName(struct alt_ICore* _instance, struct alt_StringView* name, struct alt_Array_RefBase_RefStore_IPlayer* _returnValue); // Return ptr must be manually freed with alt_Array_RefBase_RefStore_IPlayer_CAPI_Free() CAPI struct alt_Array_RefBase_RefStore_IPlayer* alt_ICore_GetPlayersByName_CAPI_Heap(struct alt_ICore* _instance, struct alt_StringView* name); CAPI unsigned int alt_ICore_GetNetTime(struct alt_ICore* _instance); CAPI struct alt_ICore* alt_ICore_Instance(); CAPI void alt_ICore_SetInstance(struct alt_ICore* server); CAPI void alt_ICore_Assign_constICoreRef(struct alt_ICore* _instance, struct alt_ICore* _p0); CAPI void alt_config_Error_CAPI_Free(struct alt_config_Error* ptr); CAPI char* alt_config_Error_what(struct alt_config_Error* _instance); CAPI unsigned long long alt_config_Error_position(struct alt_config_Error* _instance); CAPI unsigned long long alt_config_Error_line(struct alt_config_Error* _instance); CAPI unsigned long long alt_config_Error_column(struct alt_config_Error* _instance); CAPI void alt_config_Error_Create_1(struct alt_config_Error* _p0, struct alt_config_Error* _returnValue); // Return ptr must be manually freed with alt_config_Error_CAPI_Free() CAPI struct alt_config_Error* alt_config_Error_Create_1_CAPI_Heap(struct alt_config_Error* _p0); CAPI void alt_config_Error_Create_2(struct alt_config_Error* _p0, struct alt_config_Error* _returnValue); // Return ptr must be manually freed with alt_config_Error_CAPI_Free() CAPI struct alt_config_Error* alt_config_Error_Create_2_CAPI_Heap(struct alt_config_Error* _p0); CAPI void alt_config_Error_Assign_constconfig_ErrorRef(struct alt_config_Error* _instance, struct alt_config_Error* _p0); CAPI void alt_config_Error_Assign_config_ErrorRefRef(struct alt_config_Error* _instance, struct alt_config_Error* _p0); typedef enum alt_config_Node_Type { ALT_CONFIG_NODE_TYPE_NONE = 0, ALT_CONFIG_NODE_TYPE_SCALAR = 1, ALT_CONFIG_NODE_TYPE_LIST = 2, ALT_CONFIG_NODE_TYPE_DICT = 3 }; typedef struct alt_config_Node { alt_config_Node_Type type; struct alt_config_Node_Value* val; } alt_config_Node; CAPI void alt_config_Node_CAPI_Free(struct alt_config_Node* ptr); CAPI void alt_config_Node_Create(struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_CAPI_Heap(); CAPI void alt_config_Node_Create_1(_Bool _val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_1_CAPI_Heap(_Bool _val); CAPI void alt_config_Node_Create_2(double _val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_2_CAPI_Heap(double _val); CAPI void alt_config_Node_Create_3(int val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_3_CAPI_Heap(int val); CAPI void alt_config_Node_Create_4(unsigned int val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_4_CAPI_Heap(unsigned int val); CAPI void alt_config_Node_Create_5(long long val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_5_CAPI_Heap(long long val); CAPI void alt_config_Node_Create_6(unsigned long long val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_6_CAPI_Heap(unsigned long long val); CAPI void alt_config_Node_Create_8(char* val, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_8_CAPI_Heap(char* val); CAPI void alt_config_Node_Create_11(struct alt_config_Node* that, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Node_Create_11_CAPI_Heap(struct alt_config_Node* that); CAPI void alt_config_Node_Assign_constconfig_NodeRef(struct alt_config_Node* _instance, struct alt_config_Node* that); CAPI _Bool alt_config_Node_IsNone(struct alt_config_Node* _instance); CAPI _Bool alt_config_Node_IsScalar(struct alt_config_Node* _instance); CAPI _Bool alt_config_Node_IsList(struct alt_config_Node* _instance); CAPI _Bool alt_config_Node_IsDict(struct alt_config_Node* _instance); CAPI _Bool alt_config_Node_ToBool(struct alt_config_Node* _instance); CAPI _Bool alt_config_Node_ToBool_1(struct alt_config_Node* _instance, _Bool def); CAPI double alt_config_Node_ToNumber(struct alt_config_Node* _instance); CAPI double alt_config_Node_ToNumber_1(struct alt_config_Node* _instance, double def); CAPI struct alt_config_Node* alt_config_Node_Access_size_t(struct alt_config_Node* _instance, unsigned long long idx); CAPI struct alt_config_Node* alt_config_Node_Access_constcharPtr(struct alt_config_Node* _instance, char* key); CAPI _Bool alt_config_Node_To__Bool(struct alt_config_Node* _instance); typedef struct alt_config_Node_Value { void* vtable; } alt_config_Node_Value; CAPI void alt_config_Parser_CAPI_Free(struct alt_config_Parser* ptr); CAPI void alt_config_Parser_Create_2(char* data, unsigned long long size, struct alt_config_Parser* _returnValue); // Return ptr must be manually freed with alt_config_Parser_CAPI_Free() CAPI struct alt_config_Parser* alt_config_Parser_Create_2_CAPI_Heap(char* data, unsigned long long size); CAPI void alt_config_Parser_Parse(struct alt_config_Parser* _instance, struct alt_config_Node* _returnValue); // Return ptr must be manually freed with alt_config_Node_CAPI_Free() CAPI struct alt_config_Node* alt_config_Parser_Parse_CAPI_Heap(struct alt_config_Parser* _instance); CAPI void alt_config_Parser_Create_3(struct alt_config_Parser* _p0, struct alt_config_Parser* _returnValue); // Return ptr must be manually freed with alt_config_Parser_CAPI_Free() CAPI struct alt_config_Parser* alt_config_Parser_Create_3_CAPI_Heap(struct alt_config_Parser* _p0); CAPI void alt_config_Parser_Create_4(struct alt_config_Parser* _p0, struct alt_config_Parser* _returnValue); // Return ptr must be manually freed with alt_config_Parser_CAPI_Free() CAPI struct alt_config_Parser* alt_config_Parser_Create_4_CAPI_Heap(struct alt_config_Parser* _p0); CAPI void alt_config_Parser_Assign_config_ParserRefRef(struct alt_config_Parser* _instance, struct alt_config_Parser* _p0); typedef enum alt_config_Parser_Token_Type { ALT_CONFIG_PARSER_TOKEN_TYPE_ARRAY_START = 0, ALT_CONFIG_PARSER_TOKEN_TYPE_ARRAY_END = 1, ALT_CONFIG_PARSER_TOKEN_TYPE_DICT_START = 2, ALT_CONFIG_PARSER_TOKEN_TYPE_DICT_END = 3, ALT_CONFIG_PARSER_TOKEN_TYPE_KEY = 4, ALT_CONFIG_PARSER_TOKEN_TYPE_SCALAR = 5 }; typedef struct alt_config_Emitter alt_config_Emitter; CAPI void alt_config_Emitter_CAPI_Free(struct alt_config_Emitter* ptr); #endif // _CAPI_H_
53.978378
338
0.870035
[ "object", "model" ]
78424c52b803833997afeeebdaec1b5172b3a3ec
2,807
h
C
lib/include/xnetwork/generators/tests/test_atlas.h
luk036/xnetwork
462c25da3aead6b834e6027f4d679dc47965b134
[ "MIT" ]
1
2020-03-31T06:10:58.000Z
2020-03-31T06:10:58.000Z
lib/include/xnetwork/generators/tests/test_atlas.h
luk036/xnetwork
462c25da3aead6b834e6027f4d679dc47965b134
[ "MIT" ]
null
null
null
lib/include/xnetwork/generators/tests/test_atlas.h
luk036/xnetwork
462c25da3aead6b834e6027f4d679dc47965b134
[ "MIT" ]
1
2020-04-08T05:56:26.000Z
2020-04-08T05:56:26.000Z
from itertools import groupby from nose.tools import assert_equal from nose.tools import assert_less_equal from nose.tools import raises #include <xnetwork.hpp> // as xn from xnetwork.testing import * #include <xnetwork.hpp> // import graph_atlas #include <xnetwork.hpp> // import graph_atlas_g from xnetwork.generators.atlas import NUM_GRAPHS #include <xnetwork/utils.hpp> // import pairwise class TestAtlasGraph: public object { /** Unit tests for the :func:`~xnetwork.graph_atlas` function. */ /// /// @raises(ValueError); auto test_index_too_small() { graph_atlas(-1); /// /// @raises(ValueError); auto test_index_too_large() { graph_atlas(NUM_GRAPHS); auto test_graph() { G = graph_atlas(6); assert_nodes_equal(G.nodes(), range(3)); assert_edges_equal(G.edges(), [(0, 1), (0, 2)]); class TestAtlasGraphG: public object { /** Unit tests for the :func:`~xnetwork.graph_atlas_g` function. */ auto setUp() { this->GAG = graph_atlas_g(); auto test_sizes() { G = this->GAG[0]; assert_equal(G.number_of_nodes(), 0); assert_equal(G.number_of_edges(), 0); G = this->GAG[7]; assert_equal(G.number_of_nodes(), 3); assert_equal(G.number_of_edges(), 3); auto test_names() { for (auto i, G : enumerate(this->GAG) { assert_equal(int(G.name[1:]), i); auto test_nondecreasing_nodes() { // check for nondecreasing number of nodes for (auto n1, n2 : pairwise(map(len, this->GAG)) { assert_less_equal(n2, n1 + 1); auto test_nondecreasing_edges() { // check for nondecreasing number of edges (for fixed number of // nodes); for (auto n, group : groupby(this->GAG, key=xn::number_of_nodes) { for (auto m1, m2 : pairwise(map(xn::number_of_edges, group)) { assert_less_equal(m2, m1 + 1); auto test_nondecreasing_degree_sequence() { // Check for lexicographically nondecreasing degree sequences // (for fixed number of nodes && edges). // // There are three exceptions to this rule : the order given in // the "Atlas of Graphs" book, so we need to manually exclude // those. exceptions = [("G55", "G56"), ("G1007", "G1008"), ("G1012", "G1013")]; for (auto n, group : groupby(this->GAG, key=xn::number_of_nodes) { for (auto m, group : groupby(group, key=xn::number_of_edges) { for (auto G1, G2 : pairwise(group) { if ((G1.name, G2.name] : exceptions) { continue; d1 = sorted(d for v, d : G1.degree()); d2 = sorted(d for v, d : G2.degree()); assert_less_equal(d1, d2);
35.531646
78
0.600641
[ "object" ]
7845de9ea8f63ed5fdc500953ada8a5af5e7ccff
33,712
c
C
develop/Logical/Libraries/ac_invlib/ac_invparameter.c
hilch/ac_invlib
75d5afbaf6bcf2b055c5ab9ef61384f8c2ebb2b8
[ "CECILL-B" ]
3
2019-05-17T17:19:11.000Z
2021-03-14T17:23:44.000Z
develop/Logical/Libraries/ac_invlib/ac_invparameter.c
hilch/ac_invlib
75d5afbaf6bcf2b055c5ab9ef61384f8c2ebb2b8
[ "CECILL-B" ]
5
2019-09-04T11:28:04.000Z
2021-12-30T14:34:12.000Z
develop/Logical/Libraries/ac_invlib/ac_invparameter.c
hilch/ac_invlib
75d5afbaf6bcf2b055c5ab9ef61384f8c2ebb2b8
[ "CECILL-B" ]
2
2019-04-18T15:23:18.000Z
2020-12-13T07:41:55.000Z
/* This file is part of ACOPOSinverter- Library https://github.com/hilch/ac_invlib. The source code is released under LGPL: GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. */ #include <bur/plctypes.h> #include <stdlib.h> #include <string.h> #include <ac_inv_global.h> #include <ac_invparameter.h> #include <P86_registers.h> #include <P84_registers.h> #include <P74_registers.h> #include <P76_registers.h> /* ----------------------------------------------------------------------------------- find parameter in list returns index of parameter in parameter list or -1 in case of failure ----------------------------------------------------------------------------------- */ int find_parameter( char *name, UINT *index, USINT *subindex, ac_inv_DriveType drive_type ) { int i = 0; acpireg *regs; switch( drive_type ) { default: regs = p86reg; break; case ACPiDriveType_P84: regs = p84reg; break; case ACPiDriveType_P74: regs = p74reg; break; case ACPiDriveType_P76: case ACPiDriveType_P66: regs = p76reg; break; } while( regs[i].name ) { if( strcasecmp( regs[i].name, name ) == 0 ) /* found ? */ { if( index ) *index = regs[i].index; if( subindex ) *subindex = regs[i].subindex; return i; } ++i; } return -1; /* not found */ } /* ----------------------------------------------------------------------------------- returns the enumerated name of the parameter's value ----------------------------------------------------------------------------------- */ char *find_value_constant( char *name, UINT value, ac_inv_DriveType drive_type ) { int index; static char s[20]; char sign = 'u'; acpireg *regs; switch( drive_type ) { default: regs = p86reg; break; case ACPiDriveType_P84: regs = p84reg; break; case ACPiDriveType_P74: regs = p74reg; break; case ACPiDriveType_P76: case ACPiDriveType_P66: regs = p76reg; break; } index = find_parameter( name, 0, 0, drive_type ); if( index >= 0 ) { int i = 0; sign = regs[index].sign; /* translate parameter value to enumeration constant */ if( regs[index].enu ) /* are constants defined ? */ { while( regs[index].enu[i].name ) { if( regs[index].enu[i].value == value ) { return( regs[index].enu[i].name ); /* return enumerated name */ } ++i; } } } if( sign == 'u' ) m_ltoa( value , s, 10 ); /* return numeric value */ else m_ltoa( (INT) value, s, 10 ); return s; /* not found or no constant defined */ } /* ----------------------------------------------------------------------------------- returns the value for the given constant ----------------------------------------------------------------------------------- */ int find_numeric_value( char *name, char *constant, ac_inv_DriveType drive_type ) { int index; acpireg *regs; switch( drive_type ) { default: regs = p86reg; break; case ACPiDriveType_P84: regs = p84reg; break; case ACPiDriveType_P74: regs = p74reg; break; case ACPiDriveType_P76: case ACPiDriveType_P66: regs = p76reg; break; } index = find_parameter( name, 0, 0, drive_type ); if( index >= 0 ) { int i = 0; /* try to find the constant */ if( regs[index].enu ) /* are constants defined ? */ { while( regs[index].enu[i].name ) { if( strcasecmp( regs[index].enu[i].name, constant ) == 0 ) { return( regs[index].enu[i].value ); /* return enumerated name */ } ++i; } } } return m_atol(constant); /* return numeric value */ } /* ------------------------------------------------------------------------------------- read parameter from inverter ------------------------------------------------------------------------------------- */ void read_parameter( ac_inv_AxIdent *ax_ident ) { for(;;) { switch( ax_ident->sdo_read_step ) { case 0: /* wait for command */ ax_ident->fub_sdoread.enable = 0; break; case 1: /* start read */ if( find_parameter( ax_ident->sdo_read_par_name, &ax_ident->fub_sdoread.index, &ax_ident->fub_sdoread.subindex, ax_ident->drive_type ) < 0 ) { ax_ident->sdo_read_step = 3; ax_ident->sdo_read_status = ac_invlibERR_PARNOTFOUND; ax_ident->sdo_read_errorinfo = 0; continue; /* save on cycle */ } else { /* fill the fub structure */ ax_ident->sdo_read_value = 0; ax_ident->fub_sdoread.enable = 1; ax_ident->fub_sdoread.pData = (UDINT) &ax_ident->sdo_read_value; ax_ident->fub_sdoread.datalen = sizeof(ax_ident->sdo_read_value); ax_ident->sdo_read_step = 2; ax_ident->sdo_read_status = 65535; ax_ident->sdo_read_errorinfo = 0; } break; case 2: /* wait until read */ if( ax_ident->fub_sdoread.status != 65535 ) /* value read */ { ax_ident->fub_sdoread.enable = 0; /* disable fub */ ax_ident->sdo_read_status = ax_ident->fub_sdoread.status; ax_ident->sdo_read_errorinfo = ax_ident->fub_sdoread.errorinfo; ax_ident->sdo_read_step = 3; continue; /* save on cycle */ } break; case 3: /* write into log */ { char tempstring[20]; const char *ret = find_value_constant( ax_ident->sdo_read_par_name, ax_ident->sdo_read_value, ax_ident->drive_type ); strcpy( ax_ident->sdo_read_value_constant, ret ); strcpy( ax_ident->log_info, ax_ident->interface ); strcat( ax_ident->log_info, "." ); m_ltoa( ax_ident->node_number, tempstring, 10 ); strcat( ax_ident->log_info, tempstring ); strcat( ax_ident->log_info, " " ); strcat( ax_ident->log_info, ax_ident->sdo_read_par_name ); strcat( ax_ident->log_info, " -->#" ); strcat( ax_ident->log_info, ax_ident->sdo_read_value_constant ); if( ax_ident->sdo_read_status != 0 ) { ax_ident->fub_log_write.logLevel = arlogLEVEL_FATAL; if( ax_ident->sdo_read_status == ERR_ASEPL_ACCESS_FAILED ) { strcat( ax_ident->log_info, ":errorinfo=" ); strcat( ax_ident->log_info, "/0x" ); m_ltoa( ax_ident->sdo_read_errorinfo, tempstring, 16 ); strcat( ax_ident->log_info, tempstring ); } else if( ax_ident->sdo_read_status == ac_invlibERR_PARNOTFOUND ) { strcat( ax_ident->log_info, ":parameter not found" ); } } else { ax_ident->fub_log_write.logLevel = arlogLEVEL_INFO; } ax_ident->fub_log_write.errornr = ax_ident->sdo_read_status; ax_ident->fub_log_write.mem = (UDINT) &ax_ident->node_number; ax_ident->fub_log_write.len = sizeof(ax_ident->node_number); ax_ident->fub_log_write.asciiString = (UDINT) ax_ident->log_info; AsArLogWrite( &ax_ident->fub_log_write ); ax_ident->sdo_read_step = 4; } break; case 4: /* wait until log entry written */ if( ax_ident->fub_log_write.status != 65535 ) { ax_ident->sdo_read_step = 0; } else { AsArLogWrite( &ax_ident->fub_log_write ); } break; /* start reading without writing to log file in case of success (for fub inside use ! */ case 10: if( find_parameter( ax_ident->sdo_read_par_name, &ax_ident->fub_sdoread.index, &ax_ident->fub_sdoread.subindex, ax_ident->drive_type ) < 0 ) { ax_ident->sdo_read_step = 3; ax_ident->sdo_read_status = ac_invlibERR_PARNOTFOUND; ax_ident->sdo_read_errorinfo = 0; continue; /* save on cycle */ } else { /* fill the fub structure */ ax_ident->sdo_read_value = 0; ax_ident->fub_sdoread.enable = 1; ax_ident->fub_sdoread.pData = (UDINT) &ax_ident->sdo_read_value; ax_ident->fub_sdoread.datalen = sizeof(ax_ident->sdo_read_value); ax_ident->sdo_read_step = 11; ax_ident->sdo_read_status = 65535; ax_ident->sdo_read_errorinfo = 0; } break; case 11: /* wait until read */ if( ax_ident->fub_sdoread.status != 65535 ) /* value read */ { ax_ident->fub_sdoread.enable = 0; /* disable fub */ ax_ident->sdo_read_status = ax_ident->fub_sdoread.status; ax_ident->sdo_read_errorinfo = ax_ident->fub_sdoread.errorinfo; ax_ident->sdo_read_step = 0; } break; /* use SDO read directly (for fub inside use !) */ case 100: ax_ident->fub_sdoread.enable = 1; ax_ident->sdo_read_step = 101; break; case 101: if( ax_ident->fub_sdoread.status != 65535 ) /* value read */ { ax_ident->fub_sdoread.enable = 0; /* disable fub */ ax_ident->sdo_read_status = ax_ident->fub_sdoread.status; ax_ident->sdo_read_errorinfo = ax_ident->fub_sdoread.errorinfo; ax_ident->sdo_read_step = 0; } break; } break; /* exit for(;;) */ } if( ax_ident->isCANopen ) { /* FUB- Eingaenge umkopieren */ ax_ident->fub_canopen_sdoread.enable = ax_ident->fub_sdoread.enable; ax_ident->fub_canopen_sdoread.index = ax_ident->fub_sdoread.index; ax_ident->fub_canopen_sdoread.subindex = ax_ident->fub_sdoread.subindex; ax_ident->fub_canopen_sdoread.transfertype = ax_ident->sdo_read_transfertype; ax_ident->fub_canopen_sdoread.pRxdata = ax_ident->fub_sdoread.pData; ax_ident->fub_canopen_sdoread.maxlength = ax_ident->fub_sdoread.datalen; CANopenSDOReadData( &ax_ident->fub_canopen_sdoread ); /* FUB- Ausgaenge umkopieren */ ax_ident->fub_sdoread.status = ax_ident->fub_canopen_sdoread.status; ax_ident->fub_sdoread.errorinfo = ax_ident->fub_canopen_sdoread.errorinfo; ax_ident->sdo_read_transfertype = coSDO_TYPE_AUTO_BEST_CASE; } else EplSDORead( &ax_ident->fub_sdoread ); } /* ------------------------------------------------------------------------------------- write parameter to inverter via EPL ------------------------------------------------------------------------------------- */ void write_parameter( ac_inv_AxIdent *ax_ident ) { for(;;) { switch( ax_ident->sdo_write_step ) { case 0: /* wait for command */ ax_ident->fub_sdowrite.enable = 0; break; case 1: /* start write */ if( find_parameter( ax_ident->sdo_write_par_name, &ax_ident->fub_sdowrite.index, &ax_ident->fub_sdowrite.subindex, ax_ident->drive_type ) < 0 ) { ax_ident->sdo_write_step = 3; ax_ident->sdo_write_status = ac_invlibERR_PARNOTFOUND; ax_ident->sdo_write_errorinfo = 0; continue; /* save on cycle */ } else { /* fill the fub structure */ ax_ident->sdo_write_value = find_numeric_value( ax_ident->sdo_write_par_name, ax_ident->sdo_write_value_constant, ax_ident->drive_type ); ax_ident->fub_sdowrite.enable = 1; ax_ident->sdo_write_step = 2; ax_ident->sdo_write_status = 65535; ax_ident->sdo_write_errorinfo = 0; } break; case 2: /* wait until written */ if( ax_ident->fub_sdowrite.status != 65535 ) { ax_ident->sdo_write_status = ax_ident->fub_sdowrite.status; ax_ident->sdo_write_errorinfo = ax_ident->fub_sdowrite.errorinfo; ax_ident->fub_sdowrite.enable = 0; /* disable fub */ ax_ident->sdo_write_step = 3; continue; /* save on cycle */ } break; case 3: /* write into log */ { char tempstring[20]; strcpy( ax_ident->log_info, ax_ident->interface ); strcat( ax_ident->log_info, "." ); m_ltoa( ax_ident->node_number, tempstring, 10 ); strcat( ax_ident->log_info, tempstring ); strcat( ax_ident->log_info, " #" ); strcat( ax_ident->log_info, ax_ident->sdo_write_value_constant ); strcat( ax_ident->log_info, " -->" ); strcat( ax_ident->log_info, ax_ident->sdo_write_par_name ); if( ax_ident->sdo_write_status != 0 ) { if( ax_ident->sdo_write_status == ERR_ASEPL_ACCESS_FAILED ) { ax_ident->fub_log_write.logLevel = arlogLEVEL_FATAL; strcat( ax_ident->log_info, " :errorinfo=" ); strcat( ax_ident->log_info, "/0x" ); m_ltoa( ax_ident->sdo_write_errorinfo, tempstring, 16 ); strcat( ax_ident->log_info, tempstring ); } else if( ax_ident->sdo_write_status == ac_invlibERR_PARNOTFOUND ) { strcat( ax_ident->log_info, ":parameter not found" ); } } else { ax_ident->fub_log_write.logLevel = arlogLEVEL_INFO; } ax_ident->fub_log_write.errornr = ax_ident->sdo_write_status; ax_ident->fub_log_write.mem = (UDINT) &ax_ident->node_number; ax_ident->fub_log_write.len = sizeof(ax_ident->node_number); ax_ident->fub_log_write.asciiString = (UDINT) ax_ident->log_info; AsArLogWrite( &ax_ident->fub_log_write ); ax_ident->sdo_write_step = 4; continue; /* save on cycle */ } break; case 4: /* wait until log entry written */ if( ax_ident->fub_log_write.status != 65535 ) { ax_ident->sdo_write_step = 0; } else { AsArLogWrite( &ax_ident->fub_log_write ); } break; } break; /* exit for(;;) */ } if( ax_ident->isCANopen ) { /* FUB- Eingaenge umkopieren */ ax_ident->fub_canopen_sdowrite.enable = ax_ident->fub_sdowrite.enable; ax_ident->fub_canopen_sdowrite.index = ax_ident->fub_sdowrite.index; ax_ident->fub_canopen_sdowrite.subindex = ax_ident->fub_sdowrite.subindex; CANopenSDOWriteData( &ax_ident->fub_canopen_sdowrite ); /* FUB- Ausgaenge umkopieren */ ax_ident->fub_sdowrite.status = ax_ident->fub_canopen_sdowrite.status; ax_ident->fub_sdowrite.errorinfo = ax_ident->fub_canopen_sdowrite.errorinfo; } else EplSDOWrite( &ax_ident->fub_sdowrite ); } /* ------------------------------------------------------------------------------------- write parameter from parameter list to inverter ------------------------------------------------------------------------------------- */ void write_parameterlist( ac_inv_AxIdent *ax_ident ) { char tempstring[80]; char *source, *dest; int i; switch( ax_ident->write_parameterlist_step ) { case 0: break; case 1: /* download started - write header to log */ if( ax_ident->p_alloc->pcfgpar[0] || ax_ident->p_alloc->pcfgpar[1] || ax_ident->p_alloc->pcfgpar[2] ) { ax_ident->parameterlist_index = 0; ax_ident->sdo_write_status = 0; /* clear last SDO write error */ strcpy( ax_ident->log_info, ax_ident->interface ); strcat( ax_ident->log_info, "." ); m_ltoa( ax_ident->node_number, tempstring, 10 ); strcat( ax_ident->log_info, tempstring ); strcat( ax_ident->log_info, " download " ); for( i = 0; i < 3; ++i ) { if( ax_ident->p_alloc->pcfgpar[i] ) { strcat( ax_ident->log_info, " \"" ); strcat( ax_ident->log_info, (char*) ax_ident->p_alloc->pcfgpar[i] ); strcat( ax_ident->log_info, "\" " ); } } ax_ident->fub_log_write.logLevel = arlogLEVEL_INFO; ax_ident->fub_log_write.errornr = 0; ax_ident->fub_log_write.mem = (UDINT) &ax_ident->node_number; ax_ident->fub_log_write.len = sizeof(ax_ident->node_number); ax_ident->fub_log_write.asciiString = (UDINT) ax_ident->log_info; AsArLogWrite( &ax_ident->fub_log_write ); ax_ident->write_parameterlist_step = 2; } else { ax_ident->write_parameterlist_step = 0; } break; case 2: /* wait until log entry written */ if( ax_ident->fub_log_write.status == 0 ) { ax_ident->write_parameterlist_step = 3; } else if( ax_ident->fub_log_write.status != 65535 ) /* error */ { ax_ident->write_parameterlist_step = 0; } else { AsArLogWrite( &ax_ident->fub_log_write ); } break; case 3: /* read next row */ if( ax_ident->sdo_write_step == 0 ) /* service channel free ? */ { source = (char*) ax_ident->p_sorted_parameters[ax_ident->parameterlist_index]; dest = tempstring; memset( tempstring, 0, sizeof(tempstring) ); if( ax_ident->sdo_write_status != 0 ) /* error after writing the last parameter */ { ax_ident->write_parameterlist_status = ax_ident->sdo_write_status; ax_ident->write_parameterlist_step = 0; break; } else if( ax_ident->parameterlist_index >= ax_ident->number_of_parameters ) /* end of list */ { strcpy( ax_ident->log_info, ax_ident->interface ); strcat( ax_ident->log_info, "." ); m_ltoa( ax_ident->node_number, tempstring, 10 ); strcat( ax_ident->log_info, tempstring ); strcat( ax_ident->log_info, " end of " ); for( i = 0; i < 3; ++i ) { if( ax_ident->p_alloc->pcfgpar[i] ) { strcat( ax_ident->log_info, " \"" ); strcat( ax_ident->log_info, (char*) ax_ident->p_alloc->pcfgpar[i] ); strcat( ax_ident->log_info, "\" " ); } } ax_ident->fub_log_write.logLevel = arlogLEVEL_INFO; ax_ident->fub_log_write.errornr = 0; ax_ident->fub_log_write.mem = (UDINT) &ax_ident->node_number; ax_ident->fub_log_write.len = sizeof(ax_ident->node_number); ax_ident->fub_log_write.asciiString = (UDINT) ax_ident->log_info; AsArLogWrite( &ax_ident->fub_log_write ); ax_ident->write_parameterlist_step = 4; break; } else { while( ax_ident->parameterlist_index < ax_ident->number_of_parameters ) { if( *source == 0 ) /* end of a row ? */ { strncpy( ax_ident->sdo_write_value_constant, tempstring, sizeof(ax_ident->sdo_write_value_constant) - 1 ); ax_ident->sdo_write_step = 1; /* write parameter to inverter */ ++ax_ident->parameterlist_index; break; } else if( !isprint(*source) || *source == ' ' ) /* ignore control chars and spaces */ { ++source; } else if( *source == '=' ) { ++source; strncpy( ax_ident->sdo_write_par_name, tempstring, sizeof(ax_ident->sdo_write_par_name) - 1 ); memset( tempstring, 0, sizeof(tempstring) ); dest = tempstring; } else { *dest++ = *source++; /* copy to tempstring */ } } } } break; case 4: /* wait until tail is written */ if( ax_ident->fub_log_write.status != 65535 ) { ax_ident->write_parameterlist_step = 0; } else { AsArLogWrite( &ax_ident->fub_log_write ); } break; } } /* ------------------------------------------------------------------------------------- compare parameter from parameter list with inverter ------------------------------------------------------------------------------------- */ void compare_parameterlist( ac_inv_AxIdent *ax_ident ) { char tempstring[80]; char *source, *dest; switch( ax_ident->compare_parameterlist_step ) { case 0: break; case 1: /* start comparing */ ax_ident->parameterlist_index = 0; ax_ident->compare_parameterlist_step = 2; break; /* compare next parameter */ case 2: if( ax_ident->parameterlist_index >= ax_ident->number_of_parameters ) /* end of list */ { ax_ident->compare_parameterlist_step = 0; break; } else { source = (char*) ax_ident->p_sorted_parameters[ax_ident->parameterlist_index]; dest = tempstring; memset( tempstring, 0, sizeof(tempstring) ); while( ax_ident->parameterlist_index < ax_ident->number_of_parameters ) { if( *source == 0 ) /* end of a row ? */ { *dest++ = *source++; strncpy( ax_ident->compare_value_constant, tempstring, sizeof(ax_ident->compare_value_constant) - 1 ); ax_ident->sdo_read_step = 10; /* read without logger entry */ ++ax_ident->parameterlist_index; ax_ident->compare_parameterlist_step = 3; break; } else if( !isprint(*source) || *source == ' ' ) /* ignore control chars and spaces */ { ++source; } else if( *source == '=' ) { ++source; strncpy( ax_ident->sdo_read_par_name, tempstring, sizeof(ax_ident->sdo_read_par_name) - 1 ); memset( tempstring, 0, sizeof(tempstring) ); dest = tempstring; } else { *dest++ = *source++; /* copy to tempstring */ } } } break; case 3: /* wait for sdo read value */ if( ax_ident->sdo_read_step == 0 ) /* service channel free ? */ { const char *ret = find_value_constant( ax_ident->sdo_read_par_name, ax_ident->sdo_read_value, ax_ident->drive_type ); strcpy( ax_ident->sdo_read_value_constant, ret ); if( strcasecmp( ax_ident->sdo_read_value_constant, ax_ident->compare_value_constant) ) /* different to set value ? */ { ax_ident->compare_parameterlist_step = 4; } else /* equal -> ok */ { ax_ident->compare_parameterlist_step = 2; } } break; case 4: /* write into log */ { char tempstring[20]; strcpy( ax_ident->log_info, ax_ident->interface ); strcat( ax_ident->log_info, "." ); m_ltoa( ax_ident->node_number, tempstring, 10 ); strcat( ax_ident->log_info, tempstring ); strcat( ax_ident->log_info, " " ); strcat( ax_ident->log_info, ax_ident->sdo_read_par_name ); strcat( ax_ident->log_info, " -->#" ); strcat( ax_ident->log_info, ax_ident->sdo_read_value_constant ); strcat( ax_ident->log_info, " (#" ); strcat( ax_ident->log_info, ax_ident->compare_value_constant ); strcat( ax_ident->log_info, ")" ); ax_ident->fub_log_write.logLevel = arlogLEVEL_WARNING; ax_ident->fub_log_write.errornr = ac_invlibERR_CFI; ax_ident->fub_log_write.mem = (UDINT) &ax_ident->node_number; ax_ident->fub_log_write.len = sizeof(ax_ident->node_number); ax_ident->fub_log_write.asciiString = (UDINT) ax_ident->log_info; AsArLogWrite( &ax_ident->fub_log_write ); ax_ident->compare_parameterlist_step = 5; break; case 5: /* wait until log entry written */ if( ax_ident->fub_log_write.status != 65535 ) { ax_ident->compare_parameterlist_step = 0; } else { AsArLogWrite( &ax_ident->fub_log_write ); } } break; } } /* ------------------------------------------------------------------------------------- create a list of parameters from the data modules ------------------------------------------------------------------------------------- */ void create_parameterlist( ac_inv_AxIdent *ax_ident ) { int index_module = 0; ax_ident->number_of_parameters = 0; memset( &ax_ident->p_sorted_parameters, 0, sizeof(ax_ident->p_sorted_parameters) ); while( ax_ident->p_alloc->pcfgpar[index_module] ) { ax_ident->fub_datobjinfo.enable = 1; ax_ident->fub_datobjinfo.pName = ax_ident->p_alloc->pcfgpar[index_module]; DatObjInfo( &ax_ident->fub_datobjinfo ); if( ax_ident->fub_datobjinfo.status == 0 ) { char *source = (char*) ax_ident->fub_datobjinfo.pDatObjMem; while( ax_ident->fub_datobjinfo.len ){ if( *source == 0 ){ /* end of a row ? */ ++ax_ident->number_of_parameters; while( *source == 0 && ax_ident->fub_datobjinfo.len ){ /* ignore filling zeros */ ++source; --ax_ident->fub_datobjinfo.len; } } else if( ax_ident->p_sorted_parameters[ax_ident->number_of_parameters] == 0 ) { /* store pointer to parameter row */ ax_ident->p_sorted_parameters[ax_ident->number_of_parameters] = (UDINT) source++; ax_ident->fub_datobjinfo.len--; } else { source++; ax_ident->fub_datobjinfo.len--; } } } if( ++index_module >= 3 ) /* no more data modules */ break; } } /* ------------------------------------------------------------------------------------- compare function for qsort() ------------------------------------------------------------------------------------- */ int compare_download_index_P84 (const void * a, const void * b) { char name[20]; char *s, *d; int index_a=0, index_b=0; char **list; /* copy parameter name a */ s = *(char**) a; d= name; while( *s != ' ' && *s != 0 && *s != '=') *d++ = *s++; *d = 0; list = P84_download_index; while( list[index_a] ) { if( strcasecmp( list[index_a], name ) == 0 ) /* found ? */ break; ++index_a; } /* copy parameter name b */ s = *(char**) b; d= name; while( *s != ' ' && *s != 0 && *s != '=') *d++ = *s++; *d = 0; list = P84_download_index; while( list[index_b] ) { if( strcasecmp( list[index_b], name ) == 0 ) /* found ? */ break; ++index_b; } if ( index_a < index_b ) return -1; if ( index_a > index_b ) return 1; return 0; } int compare_download_index_P74 (const void * a, const void * b) { char name[20]; char *s, *d; int index_a=0, index_b=0; char **list; /* copy parameter name a */ s = *(char**) a; d= name; while( *s != ' ' && *s != 0 && *s != '=') *d++ = *s++; *d = 0; list = P74_download_index; while( list[index_a] ) { if( strcasecmp( list[index_a], name ) == 0 ) /* found ? */ break; ++index_a; } /* copy parameter name b */ s = *(char**) b; d= name; while( *s != ' ' && *s != 0 && *s != '=') *d++ = *s++; *d = 0; list = P74_download_index; while( list[index_b] ) { if( strcasecmp( list[index_b], name ) == 0 ) /* found ? */ break; ++index_b; } if ( index_a < index_b ) return -1; if ( index_a > index_b ) return 1; return 0; } int compare_download_index_P76 (const void * a, const void * b) { char name[20]; char *s, *d; int index_a=0, index_b=0; char **list; /* copy parameter name a */ s = *(char**) a; d= name; while( *s != ' ' && *s != 0 && *s != '=') *d++ = *s++; *d = 0; list = P76_download_index; while( list[index_a] ) { if( strcasecmp( list[index_a], name ) == 0 ) /* found ? */ break; ++index_a; } /* copy parameter name b */ s = *(char**) b; d= name; while( *s != ' ' && *s != 0 && *s != '=') *d++ = *s++; *d = 0; list = P76_download_index; while( list[index_b] ) { if( strcasecmp( list[index_b], name ) == 0 ) /* found ? */ break; ++index_b; } if ( index_a < index_b ) return -1; if ( index_a > index_b ) return 1; return 0; } /* ------------------------------------------------------------------------------------- sorts the parameter list ------------------------------------------------------------------------------------- */ void sort_parameterlist( ac_inv_AxIdent *ax_ident ) { switch( ax_ident->drive_type ) { default: qsort( (void*) &ax_ident->p_sorted_parameters, ax_ident->number_of_parameters, sizeof(UDINT), compare_download_index_P84 ); break; case ACPiDriveType_P74: qsort( (void*) &ax_ident->p_sorted_parameters, ax_ident->number_of_parameters, sizeof(UDINT), compare_download_index_P74 ); break; case ACPiDriveType_P76: case ACPiDriveType_P66: qsort( (void*) &ax_ident->p_sorted_parameters, ax_ident->number_of_parameters, sizeof(UDINT), compare_download_index_P76 ); break; } }
29.417103
146
0.645201
[ "object" ]
7849192f9dfcc389f4875b7e5f9219e1b57d9f59
2,337
h
C
JavaScriptPlugin/bmplugin_pch.h
Stanbroek/BakkesModSDK-JavaScript
356c466766a24016edf6a6a6a9b43b0d30407b76
[ "MIT" ]
1
2022-01-27T17:35:02.000Z
2022-01-27T17:35:02.000Z
JavaScriptPlugin/bmplugin_pch.h
Stanbroek/BakkesModSDK-JavaScript
356c466766a24016edf6a6a6a9b43b0d30407b76
[ "MIT" ]
null
null
null
JavaScriptPlugin/bmplugin_pch.h
Stanbroek/BakkesModSDK-JavaScript
356c466766a24016edf6a6a6a9b43b0d30407b76
[ "MIT" ]
null
null
null
/// pch.h: This is a precompiled header file. /// Files listed below are compiled only once, improving build performance for /// future builds. This also affects IntelliSense performance, including code /// completion and many code browsing features. However, files listed here are /// ALL re-compiled if any one of them is updated between builds. Do not add /// files here that you will be updating frequently as this negates the /// performance advantage. #ifndef BMPLUGIN_PCH_H #define BMPLUGIN_PCH_H /// add headers that you want to pre-compile here #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define BMDEBUG // Windows Headers #include <Windows.h> #include <list> #include <memory> #include <string> #include <vector> #include <utility> #include <iostream> #include <filesystem> // Node #include "aliased_buffer.h" #include "base_object-inl.h" #include "env-inl.h" #include "node_internals.h" #include "util-inl.h" #include "uv.h" #include "v8.h" // FMT #define FMT_HEADER_ONLY #include "fmt/format.h" #include "fmt/chrono.h" #include "fmt/os.h" #include "fmt/ostream.h" #include "fmt/ranges.h" #include "fmt/xchar.h" // v8pp #pragma warning(push, 0) #include "v8pp/class.hpp" #include "v8pp/module.hpp" #pragma warning(pop) // BakkesMod SDK #pragma comment(lib, "pluginsdk.lib") #pragma warning(push, 0) #include "bakkesmod/plugin/bakkesmodplugin.h" // Include everything #include "bakkesmod/wrappers/includes.h" // and even more #include "bakkesmod/wrappers/Engine/WorldInfoWrapper.h" //#include "bakkesmod/wrappers/GameObject/RumbleComponent/BasketballPickup.h" #include "bakkesmod/wrappers/GameObject/PerformanceStats/StartGraphSystemWrapper.h" #include "bakkesmod/wrappers/GameObject/Stats/StatEventWrapper.h" #include "bakkesmod/wrappers/PluginManagerWrapper.h" #include "bakkesmod/wrappers/kismet/SequenceVariableWrapper.h" #include "bakkesmod/wrappers/kismet/SequenceWrapper.h" //#include "bakkesmod/wrappers/replaywrapper.h" #include "utils/parser.h" #pragma warning(pop) // BakkesMod SDK Additions #include "utils/cvarmanagerwrapperdebug.h" #include "utils/exception_safety.h" enum { PLUGINTYPE_ALL = 0x00 }; // General Utils #include "utils/persistent_storage.h" #include "utils/stringify.h" #include "utils/threading.h" #include "utils/timer.h" #endif // BMPLUGIN_PCH_H
28.156627
83
0.770646
[ "vector" ]
78509127df442da2dba93d516e66e4b1b32ad870
9,677
h
C
Source/RuntimeBlueprints/Structs/IntVector4D.h
HiIAmMoot/RuntimeBPs
1fe34ae0ea8d9e0ca376c7ec663a0e2cf537c77b
[ "MIT" ]
61
2020-04-30T06:50:47.000Z
2022-03-25T05:41:29.000Z
Source/RuntimeBlueprints/Structs/IntVector4D.h
monizka/RuntimeBPs
8def2f98bed6d2d5705c12ffe54c3f7123395265
[ "MIT" ]
7
2020-11-09T14:40:07.000Z
2021-02-25T01:22:32.000Z
Source/RuntimeBlueprints/Structs/IntVector4D.h
monizka/RuntimeBPs
8def2f98bed6d2d5705c12ffe54c3f7123395265
[ "MIT" ]
21
2020-05-23T16:39:29.000Z
2022-03-25T05:41:31.000Z
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreTypes.h" #include "Misc/Crc.h" #include "Math/UnrealMathUtility.h" #include "Containers/UnrealString.h" #include "Serialization/StructuredArchive.h" #include "IntVector4D.generated.h" /** * Structure for integer vectors in 4-d space. */ USTRUCT(BlueprintType) struct FIntVector4D { GENERATED_BODY() /** Holds the vectors's x-component. */ UPROPERTY(EditAnywhere, BlueprintReadWrite) int X; UPROPERTY(EditAnywhere, BlueprintReadWrite) /** Holds the vectors's y-component. */ int Y; UPROPERTY(EditAnywhere, BlueprintReadWrite) /** Holds the vectors's z-component. */ int Z; UPROPERTY(EditAnywhere, BlueprintReadWrite) /** Holds the vectors's w-component. */ int W; public: /** * Default constructor (no initialization). */ FIntVector4D(); /** * Creates and initializes a new instance with the specified coordinates. * * @param InX The x-component. * @param InY The y-component. * @param InZ The z-component. * @param InW The w-component. */ FIntVector4D(int32 InX, int32 InY, int32 InZ, int32 InW); /** * Constructor * * @param InValue replicated to all components */ explicit FIntVector4D(int32 InValue); /** * Constructor * * @param InVector4 float vector converted to int */ explicit FIntVector4D(FVector4 InVector); /** * Constructor * * @param EForceInit Force init enum */ explicit FORCEINLINE FIntVector4D(EForceInit); public: /** * Gets specific component of a point. * * @param ComponentIndex Index of point component. * @return const reference to component. */ const int32& operator()(int32 ComponentIndex) const; /** * Gets specific component of a point. * * @param ComponentIndex Index of point component. * @return reference to component. */ int32& operator()(int32 ComponentIndex); /** * Gets specific component of a point. * * @param ComponentIndex Index of point component. * @return const reference to component. */ const int32& operator[](int32 ComponentIndex) const; /** * Gets specific component of a point. * * @param ComponentIndex Index of point component. * @return reference to component. */ int32& operator[](int32 ComponentIndex); /** * Compares points for equality. * * @param Other The other int point being compared. * @return true if the points are equal, false otherwise.. */ bool operator==(const FIntVector4D& Other) const; /** * Compares points for inequality. * * @param Other The other int point being compared. * @return true if the points are not equal, false otherwise.. */ bool operator!=(const FIntVector4D& Other) const; /** * Scales this point. * * @param Scale What to multiply the point by. * @return Reference to this point after multiplication. */ FIntVector4D& operator*=(int32 Scale); /** * Divides this point. * * @param Divisor What to divide the point by. * @return Reference to this point after division. */ FIntVector4D& operator/=(int32 Divisor); /** * Adds to this point. * * @param Other The point to add to this point. * @return Reference to this point after addition. */ FIntVector4D& operator+=(const FIntVector4D& Other); /** * Subtracts from this point. * * @param Other The point to subtract from this point. * @return Reference to this point after subtraction. */ FIntVector4D& operator-=(const FIntVector4D& Other); /** * Assigns another point to this one. * * @param Other The point to assign this point from. * @return Reference to this point after assignment. */ FIntVector4D& operator=(const FIntVector4D& Other); /** * Gets the result of scaling on this point. * * @param Scale What to multiply the point by. * @return A new scaled int point. */ FIntVector4D operator*(int32 Scale) const; /** * Gets the result of division on this point. * * @param Divisor What to divide the point by. * @return A new divided int point. */ FIntVector4D operator/(int32 Divisor) const; /** * Gets the result of addition on this point. * * @param Other The other point to add to this. * @return A new combined int point. */ FIntVector4D operator+(const FIntVector4D& Other) const; /** * Gets the result of subtraction from this point. * * @param Other The other point to subtract from this. * @return A new subtracted int point. */ FIntVector4D operator-(const FIntVector4D& Other) const; public: /** * Gets the maximum value in the point. * * @return The maximum value in the point. */ float GetMax() const; /** * Gets the minimum value in the point. * * @return The minimum value in the point. */ float GetMin() const; /** * Gets the distance of this point from (0,0,0,0). * * @return The distance of this point from (0,0,0,0). */ int32 Size() const; /** * Get a textual representation of this vector. * * @return A string describing the vector. */ FString ToString() const; public: /** * Divide an int point and round up the result. * * @param lhs The int point being divided. * @param Divisor What to divide the int point by. * @return A new divided int point. */ static FIntVector4D DivideAndRoundUp(FIntVector4D lhs, int32 Divisor); /** * Gets the number of components a point has. * * @return Number of components point has. */ static int32 Num(); public: /** * Serializes the Rectangle. * * @param Ar The archive to serialize into. * @param Vector The vector to serialize. * @return Reference to the Archive after serialization. */ friend FArchive& operator<<(FArchive& Ar, FIntVector4D& Vector) { return Ar << Vector.X << Vector.Y << Vector.Z << Vector.W; } friend void operator<<(FStructuredArchive::FSlot Slot, FIntVector4D& Vector) { FStructuredArchive::FRecord Record = Slot.EnterRecord(); Record << SA_VALUE(TEXT("X"), Vector.X); Record << SA_VALUE(TEXT("Y"), Vector.Y); Record << SA_VALUE(TEXT("Z"), Vector.Z); Record << SA_VALUE(TEXT("W"), Vector.W); } bool Serialize(FArchive& Ar) { Ar << *this; return true; } }; /* FIntVector4D inline functions *****************************************************************************/ FORCEINLINE FIntVector4D::FIntVector4D() { } FORCEINLINE FIntVector4D::FIntVector4D(int32 InX, int32 InY, int32 InZ, int32 InW) : X(InX) , Y(InY) , Z(InZ) , W(InW) { } FORCEINLINE FIntVector4D::FIntVector4D(int32 InValue) : X(InValue) , Y(InValue) , Z(InValue) , W(InValue) { } FORCEINLINE FIntVector4D::FIntVector4D(EForceInit) : X(0) , Y(0) , Z(0) , W(0) { } FORCEINLINE const int32& FIntVector4D::operator()(int32 ComponentIndex) const { return (&X)[ComponentIndex]; } FORCEINLINE int32& FIntVector4D::operator()(int32 ComponentIndex) { return (&X)[ComponentIndex]; } FORCEINLINE const int32& FIntVector4D::operator[](int32 ComponentIndex) const { return (&X)[ComponentIndex]; } FORCEINLINE int32& FIntVector4D::operator[](int32 ComponentIndex) { return (&X)[ComponentIndex]; } FORCEINLINE bool FIntVector4D::operator==(const FIntVector4D& Other) const { return X == Other.X && Y == Other.Y && Z == Other.Z && W == Other.W; } FORCEINLINE bool FIntVector4D::operator!=(const FIntVector4D& Other) const { return X != Other.X || Y != Other.Y || Z != Other.Z || W != Other.W; } FORCEINLINE FIntVector4D& FIntVector4D::operator*=(int32 Scale) { X *= Scale; Y *= Scale; Z *= Scale; W *= Scale; return *this; } FORCEINLINE FIntVector4D& FIntVector4D::operator/=(int32 Divisor) { X /= Divisor; Y /= Divisor; Z /= Divisor; W /= Divisor; return *this; } FORCEINLINE FIntVector4D& FIntVector4D::operator+=(const FIntVector4D& Other) { X += Other.X; Y += Other.Y; Z += Other.Z; W += Other.W; return *this; } FORCEINLINE FIntVector4D& FIntVector4D::operator-=(const FIntVector4D& Other) { X -= Other.X; Y -= Other.Y; Z -= Other.Z; W -= Other.W; return *this; } FORCEINLINE FIntVector4D& FIntVector4D::operator=(const FIntVector4D& Other) { X = Other.X; Y = Other.Y; Z = Other.Z; W = Other.W; return *this; } FORCEINLINE FIntVector4D FIntVector4D::operator*(int32 Scale) const { return FIntVector4D(*this) *= Scale; } FORCEINLINE FIntVector4D FIntVector4D::operator/(int32 Divisor) const { return FIntVector4D(*this) /= Divisor; } FORCEINLINE FIntVector4D FIntVector4D::operator+(const FIntVector4D& Other) const { return FIntVector4D(*this) += Other; } FORCEINLINE FIntVector4D FIntVector4D::operator-(const FIntVector4D& Other) const { return FIntVector4D(*this) -= Other; } FORCEINLINE FIntVector4D FIntVector4D::DivideAndRoundUp(FIntVector4D lhs, int32 Divisor) { return FIntVector4D(FMath::DivideAndRoundUp(lhs.X, Divisor), FMath::DivideAndRoundUp(lhs.Y, Divisor), FMath::DivideAndRoundUp(lhs.Z, Divisor), FMath::DivideAndRoundUp(lhs.W, Divisor)); } FORCEINLINE float FIntVector4D::GetMax() const { return FMath::Max(FMath::Max(X, Y), FMath::Max(Z, W)); } FORCEINLINE float FIntVector4D::GetMin() const { return FMath::Min(FMath::Min(X, Y), FMath::Min(Z, W)); } FORCEINLINE int32 FIntVector4D::Num() { return 4; } FORCEINLINE int32 FIntVector4D::Size() const { int64 X64 = (int64)X; int64 Y64 = (int64)Y; int64 Z64 = (int64)Z; int64 W64 = (int64)W; return int32(FMath::Sqrt(float(X64 * X64 + Y64 * Y64 + Z64 * Z64 + W64 * W64))); } FORCEINLINE FString FIntVector4D::ToString() const { return FString::Printf(TEXT("X=%d Y=%d Z=%d W=%d"), X, Y, Z, W); } FORCEINLINE uint32 GetTypeHash(const FIntVector4D& Vector) { return FCrc::MemCrc_DEPRECATED(&Vector, sizeof(FIntVector4D)); }
21.082789
185
0.682856
[ "vector" ]
7a84eeea41eb6ff80fd337f69fb1487cd039e592
7,245
h
C
texthuds.h
miheslkivi/pac-person-freespace
a136ce07fbd7ac3125e5d04758725b8a36431c71
[ "BSD-3-Clause" ]
2
2018-05-21T10:09:30.000Z
2018-05-24T11:37:04.000Z
texthuds.h
miheslkivi/pac-person-freespace
a136ce07fbd7ac3125e5d04758725b8a36431c71
[ "BSD-3-Clause" ]
1
2018-02-10T17:39:02.000Z
2018-02-10T17:39:02.000Z
texthuds.h
miheslkivi/pac-person-freespace
a136ce07fbd7ac3125e5d04758725b8a36431c71
[ "BSD-3-Clause" ]
null
null
null
/* * * Pac-person freespace continuum undiscreted ( PPFCU or p-pf-scu-d ) - Copyright (C) 2018 by Mikko Heiska * * *** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * The names of its contributors may not 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." ** ** ** ****************************************************************************/ #ifndef TEXTHUDS_H #define TEXTHUDS_H #include <QtGui/QBitmap> #include <QtGui/QPainter> #include <QGraphicsScene> #include <cstdlib> #include<ctime> #include<iostream> #include<cmath> #include <QTextCodec> #include <QGraphicsItem> #include <QColor> #include <cstdlib> #include"geome.h" #include"gmu.h" #include"messages.h" #include<sstream> using namespace std; class hudtt : public QGraphicsItem { public: hudtt(QList<QPixmap> &qlipxmap, gsvar &jgsvar, QGraphicsScene *scene = 0); void setFrame(int frame); inline int frame() const { return currentFrame; } inline int frameCount() const { return frames.size(); } inline QPixmap image(int frame) const { return frames.isEmpty() ? QPixmap() : frames.at(frame % frames.size()).pixmap; } inline void setVelocity( qreal xvel, qreal yvel) { vx = xvel; vy = yvel; } inline qreal xVelocity() const { return vx; } inline qreal yVelocity() const { return vy; } QRectF boundingRect() const; // QPainterPath shape() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void advance(int phase); qreal vx, vy; void setgsvar( gsvar jg ) { jgv_=jg; } void setgsett( gsett jg ) { jgsett_=jg; } private: struct Frame { QPixmap pixmap; QPainterPath shape; QRectF boundingRect; }; gsvar jgv_; gsett jgsett_ ; int currentFrame; QList<Frame> frames; QTransform jtr; }; class helphud : public QGraphicsItem { public: helphud(QList<QPixmap> &qlipxmap, gsvar &jgsvar, gsett jgset, QGraphicsScene *scene = 0); void setFrame(int frame); inline int frame() const { return currentFrame; } inline int frameCount() const { return frames.size(); } inline QPixmap image(int frame) const { return frames.isEmpty() ? QPixmap() : frames.at(frame % frames.size()).pixmap; } inline void setVelocity( qreal xvel, qreal yvel) { vx = xvel; vy = yvel; } inline qreal xVelocity() const { return vx; } inline qreal yVelocity() const { return vy; } QRectF boundingRect() const; // QPainterPath shape() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void advance(int phase); qreal vx, vy; void sethelpmes( helpmes hm, int num ) { jhelpm_=hm; num_=num; } void setgsett( gsett jg ) { jgsett_=jg; } void setgsvar( gsvar jg ) { jgv_=jg; } void sethcolor( QColor hcol ) { hcol_=hcol; } private: struct Frame { QPixmap pixmap; QPainterPath shape; QRectF boundingRect; }; gsvar jgv_; gsett jgsett_ ; helpmes jhelpm_; int currentFrame, num_; QList<Frame> frames; QTransform jtr; QColor hcol_; }; class helphudsh : public QGraphicsItem { public: helphudsh(QList<QPixmap> &qlipxmap, gsvar &jgsvar, gsett jgset, QGraphicsScene *scene = 0); void setFrame(int frame); inline int frame() const { return currentFrame; } inline int frameCount() const { return frames.size(); } inline QPixmap image(int frame) const { return frames.isEmpty() ? QPixmap() : frames.at(frame % frames.size()).pixmap; } inline void setVelocity( qreal xvel, qreal yvel) { vx = xvel; vy = yvel; } inline qreal xVelocity() const { return vx; } inline qreal yVelocity() const { return vy; } QRectF boundingRect() const; // QPainterPath shape() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void advance(int phase); qreal vx, vy; void sethelpmes( helpmes hm, int num ) { msgcou_++; jhelpm_=hm; jmesn_.mes=num; jmesn_.tcou=0; jmesn_.sernum=msgcou_; } void sethelpmes2( gsvar &gsv ) { msgcou_++; int ite, meslsize; jmesl_.mli.clear(); for( ite=0; ite<gsv.shortmsglist.size() ; ite++) { mnu jmnu; mesnum jmesnum=gsv.shortmsglist.at( ite ); jmnu.distance=jmesnum.distance; jmnu.mes=jmesnum.mes; jmnu.tcoun=jmesnum.tcoun; jmesl_.mli.append( jmnu ); } jmesl_.tcou=0; gsv.shortmsglist.clear(); meslistvec_.at( mpla2_ )=jmesl_; meslsize=meslistvec_.size(); if( mpla2_>= meslsize-1 ) { mpla2_=0; } else { mpla2_++; } } void proch(); void setgsett( gsett jg ) { jgsett_=jg; } void setgsvar( gsvar jg ) { jgv_=jg; } void sethcolor( QColor hcol ) { hcol_=hcol; } private: struct Frame { QPixmap pixmap; QPainterPath shape; QRectF boundingRect; }; gsvar jgv_; gsett jgsett_ ; helpmes jhelpm_; int currentFrame, mpla_, mpla2_; QList<Frame> frames; QTransform jtr; QColor hcol_; mesnum jmesn_; QList<mesnum> numli_; vector<mesnum> jmesnvec_; QList<int> tur_; int msgcou_; meslist jmesl_; vector<meslist> meslistvec_; int colgoalre_, retec_; }; #endif // TEXTHUDS_H
29.45122
134
0.617943
[ "shape", "vector" ]
7a9a6700aa6265d19dbb11ccc907aa87e0daa18a
7,985
h
C
addons/ofxGuido/lib/guidolib-code/Qt/GuidoSceneComposer/src/GuidoItemContainer/QSimpleItemContainer.h
k4rm/AscoGraph
9038ae785b6f4f144a3ab5c4c5520761c0cd08f2
[ "MIT" ]
18
2015-01-18T22:34:22.000Z
2020-09-06T20:30:30.000Z
addons/ofxGuido/lib/guidolib-code/Qt/GuidoSceneComposer/src/GuidoItemContainer/QSimpleItemContainer.h
k4rm/AscoGraph
9038ae785b6f4f144a3ab5c4c5520761c0cd08f2
[ "MIT" ]
2
2015-08-04T00:07:46.000Z
2017-05-10T15:53:51.000Z
addons/ofxGuido/lib/guidolib-code/Qt/GuidoSceneComposer/src/GuidoItemContainer/QSimpleItemContainer.h
k4rm/AscoGraph
9038ae785b6f4f144a3ab5c4c5520761c0cd08f2
[ "MIT" ]
10
2015-01-18T23:46:10.000Z
2019-08-25T12:10:04.000Z
/* * QSimpleItemContainer.h * * Created by Christophe Daudin on 12/05/09. * Copyright 2009 Grame. All rights reserved. * * GNU Lesser General Public License Usage * Alternatively, this file may be used under the terms of the GNU Lesser * General Public License version 2.1 as published by the Free Software * Foundation and appearing in the file LICENSE.LGPL included in the * packaging of this file. Please review the following information to * ensure the GNU Lesser General Public License version 2.1 requirements * will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. * * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef SIMPLE_ITEM_CONTAINER_H #define SIMPLE_ITEM_CONTAINER_H #include "QLanguageItem.h" #include "QSwitcher.h" #include <QPen> #include <QBrush> #include <QtDebug> #include <QMimeData> #define SIMPLE_ITEM_BASE_RGB 197,214,255 #define SIMPLE_ITEM_ALPHA_1 200 #define SIMPLE_ITEM_ALPHA_2 100 #define SIMPLE_ITEM_ALPHA_3 50 #define DOM_SIMPLE_TEXT_ITEM "DomSimpleTextItem" #define MIME_SIMPLE_TEXT_ITEM "MimeSimpleTextItem" #define DOM_SIMPLE_PIXMAP_ITEM "DomSimplePixmapItem" #define MIME_SIMPLE_PIXMAP_ITEM "MimeSimplePixmapItem" class QItemAdapter { public : virtual ~QItemAdapter() {} virtual QString code() const = 0; virtual bool setCode(const QString& code) = 0; virtual bool isValid() const = 0; virtual void setFile(const QString& fileName) = 0; virtual QString domId() const = 0; virtual QString mimeId() const = 0; virtual QMenu* buildContextMenu( QMenu* standardMenu ) const { return standardMenu; } virtual bool isEqualTo( const QItemAdapter * other ) const = 0; }; class QSimpleItemContainer : public QLanguageItem { Q_OBJECT protected: QItemAdapter * mItemAdapter; QGraphicsItem * mContainedItem; public: /** * \brief Constructor. */ QSimpleItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter , QGraphicsItem * parent = 0); QSimpleItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter , const QMimeData * mimeData , QGraphicsItem * parent = 0); QSimpleItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter , const QDomElement * domElement , QGraphicsItem * parent = 0); QSimpleItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter , const QSimpleItemContainer * other , QGraphicsItem * parent = 0); virtual ~QSimpleItemContainer(); /*! * \brief Create a new QDomElement storing the properties of the QSimpleItemContainer. * * \note The QDomElement may be further used to setup another QSimpleItemContainer, using QSimpleItemContainer::loadFromDomElement. */ virtual QDomElement saveToDomElement( QDomDocument * doc); float currentScale() const { return mContainedItem->transform().m11(); } bool isValid() const { return mItemAdapter->isValid(); } bool setCode( const QString& code ); QString code() const { return mItemAdapter->code(); } QGraphicsItem * containedItem() { return mContainedItem; } /*! * \brief QSimpleItemContainer comparator. */ bool isEqualTo( QLanguageItem * item ) const { QSimpleItemContainer* other = dynamic_cast<QSimpleItemContainer*>(item); if ( !other ) return false; else return mItemAdapter->isEqualTo( other->mItemAdapter ); } QItemAdapter * adapter() const { return mItemAdapter; } public Q_SLOTS : void resized(const QRectF& newRect); protected: void setFile( const QString& fileName ) { QLanguageItem::setFile(fileName); mItemAdapter->setFile(fileName); } void init(QGraphicsItem * containedItem , QItemAdapter * adapter); void simpleItemUpdateGeometry(const QRectF& newGeometry); /*! * \brief QLanguageItem implementation. */ QImage* buildDragImage(); /*! * \brief QLanguageItem specialization. */ QMimeData * buildMimeData(); /*! * \brief QLanguageItem specialization. */ QMenu * buildContextMenu(); /*! * \brief Updates the "mSelectionItem" pen and brush according to mPenBrushSwitcher's state. */ void updateSelectionItem(); QVariant itemChange( GraphicsItemChange change, const QVariant& value ); void hoverEnterEvent ( QGraphicsSceneHoverEvent * e ); void hoverLeaveEvent ( QGraphicsSceneHoverEvent * e ); struct PenBrush { QPen mPen; QBrush mBrush; PenBrush(const QPen& p = QPen() , const QBrush& b = QBrush()) { mPen = p; mBrush = b; } }; QSwitcher<PenBrush> mPenBrushSwitcher; QGraphicsRectItem * mSelectionItem; public: static bool isSimpleItemContainer( const QMimeData* mimeData); static bool isSimpleItemContainer( const QDomElement* e); }; class QPixmapItemContainer : public QSimpleItemContainer { public: static QPixmapItemContainer* buildPixmapItemContainer(QGraphicsItem * parent = 0); static QPixmapItemContainer* buildPixmapItemContainer(const QMimeData * mimeData , QGraphicsItem * parent = 0); static QPixmapItemContainer* buildPixmapItemContainer(const QDomElement * domElement , QGraphicsItem * parent = 0); static QPixmapItemContainer* buildPixmapItemContainer(const QSimpleItemContainer * other , QGraphicsItem * parent = 0); protected: QPixmapItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter , QGraphicsItem * parent = 0); QPixmapItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter ,const QMimeData * mimeData , QGraphicsItem * parent = 0); QPixmapItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter ,const QDomElement * domElement , QGraphicsItem * parent = 0); QPixmapItemContainer(QGraphicsItem * containedItem , QItemAdapter * adapter ,const QSimpleItemContainer * other , QGraphicsItem * parent = 0); void init(); }; class QGraphicsSimpleTextItemAdapter : public QItemAdapter { public : QGraphicsSimpleTextItemAdapter( QGraphicsSimpleTextItem* item) { mItem = item; } QString code() const { return mItem->text(); } bool setCode(const QString& code) { mItem->setText(code); return isValid(); } bool isValid() const { return true; } void setFile(const QString&) {} static bool recognizes( const QMimeData* mimeData) { return mimeData->hasFormat( MIME_SIMPLE_TEXT_ITEM ); } static bool recognizes( const QDomElement* e) { return ( QVariant( e->attribute( DOM_SIMPLE_TEXT_ITEM, "0" ) ).toInt() == 1 ); } QString domId() const { return DOM_SIMPLE_TEXT_ITEM; } QString mimeId() const { return MIME_SIMPLE_TEXT_ITEM; } bool isEqualTo( const QItemAdapter * adapter ) const { const QGraphicsSimpleTextItemAdapter* other = dynamic_cast<const QGraphicsSimpleTextItemAdapter*>(adapter); if ( !other ) return false; else return ( other->code() == code() ); } protected: QGraphicsSimpleTextItem * mItem; }; #include <QImageReader> #include <QFile> class QGraphicsPixmapItemAdapter : public QItemAdapter { public : QGraphicsPixmapItemAdapter( QGraphicsPixmapItem* item ); QString code() const { return mFile; } bool setCode(const QString& file); bool isValid() const { return mIsValid; } void setFile(const QString& fileName) { setCode( fileName ); } static bool recognizes( const QMimeData* mimeData) { return mimeData->hasFormat( MIME_SIMPLE_PIXMAP_ITEM ); } static bool recognizes( const QDomElement* e) { return ( QVariant( e->attribute( DOM_SIMPLE_PIXMAP_ITEM, "0" ) ).toInt() == 1 ); } QString domId() const { return DOM_SIMPLE_PIXMAP_ITEM; } QString mimeId() const { return MIME_SIMPLE_PIXMAP_ITEM; } QMenu* buildContextMenu( QMenu* standardMenu ) const; bool isEqualTo( const QItemAdapter * adapter ) const; protected: QGraphicsPixmapItem * mItem; QString mFile; bool mIsValid; }; #endif //SIMPLE_ITEM_CONTAINER_H
34.418103
145
0.727489
[ "transform" ]
7a9e4ef0c09b3cff3b167ebe5568d7d9c7df19fa
15,434
c
C
src/main.c
Stellaris-code/DanmakuParanoia
8745ee76d66a6267974c7597b1e771027f4f3e97
[ "MIT" ]
null
null
null
src/main.c
Stellaris-code/DanmakuParanoia
8745ee76d66a6267974c7597b1e771027f4f3e97
[ "MIT" ]
null
null
null
src/main.c
Stellaris-code/DanmakuParanoia
8745ee76d66a6267974c7597b1e771027f4f3e97
[ "MIT" ]
null
null
null
/******************************************************************************************* * * raylib [text] example - Text formatting * * This example has been created using raylib 1.1 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * * Copyright (c) 2014 Ramon Santamaria (@raysan5) * ********************************************************************************************/ #include "raylib.h" #include "rlgl.h" #include "gameplay/bullet/bullet.h" #include "gameplay/player.h" #include "gameplay/gamestate.h" #include "gameplay/entity.h" #include "collision/collision.h" #include "resources/texture_handler.h" #include "resources/music_handler.h" #include "draw/draw.h" #include "draw/vfx.h" #include "draw/animation.h" #include "draw/shader_fx.h" #include "draw/drawlist.h" #include "draw/zorder.h" #include "draw/particles.h" #include "bckgs/3d_obj.h" #include "bckgs/skybox.h" #include "scripting/syscalls.h" #include "scripting/vm_drawlist.h" #include "math/vector.h" #include "ui/hud.h" #include "utils/timed_action.h" #include "utils/utils.h" #include "sys/cleanup.h" #include "vm.h" #define _GNU_SOURCE #include <math.h> #include <stdio.h> #include <assert.h> #include <time.h> #define TARGET_FPS 60 // CONVENTION : // angles in radians // distance unit : pixel void spawn_vfx_2(void* arg); void spawn_vfx_1(void* arg) { static float offset = 50.f; static float delay = 0.5f; static int max_rects = 50; SPAWN_VFX(1, sheared_rectangle, (vector2d_t){offset, 0.f}, COL_PINK, 20.f, -0.25f, 0.0f, 1000.f, 1.0f, false); SPAWN_VFX(0, sheared_rectangle, (vector2d_t){offset + 15.f, 0.f + 15.f}, COL_LITERAL(color_t){ 255/2, 109/2, 194/2, 255 }, 20.f, -0.25f, 0.0f, 1000.f, 1.0f, false); offset += 80.f; --max_rects; if (max_rects < 0) return; // don't spawn more rects if (offset >= 800.f + 100.f) { schedule_action(0.2f, spawn_vfx_2, NULL); offset = 50.f; } schedule_action(delay, spawn_vfx_1, NULL); delay *= 0.75f; } void spawn_vfx_2(void* arg) { static float offset = -200.f; static int foo = 0; SPAWN_VFX(2, sheared_rectangle, (vector2d_t){00.0f, offset}, foo ? COL_GRAY : COL_DARKGRAY, 100.f, -0.50f, 1.92f, -1400.f, 0.8f, true); foo = !foo; offset += 200.f; } void start_transition(void* arg) { enable_shader(*(int*)arg, 2.0f, ABOVEALL_ZORDER, true); } vm_state_t* test_vm; int death_frame; float death_time; float frame_time; sprite_frame_id_t sprite; sprite_frame_id_t shard_sprite; sprite_frame_id_t particles_sheet; void reset(); void handle_events() { if (IsKeyPressed(KEY_Q)) { reset(); } if (IsKeyPressed(KEY_SPACE)) { DrawText(TextFormat("Mouse Pos : %i, %i", GetMouseX(), GetMouseY()), 200, 40, 20, BLACK); for (int i = 0; i < 0x1000*25; ++i) { bullet_t bullet = {0}; bullet.type = Circle; bullet.sprite = sprite; bullet.motion.direction_angle = M_PI_4; bullet.motion.velocity = 400.f; bullet.motion.angular_velocity = 4.f; bullet.motion.relative_x = 400.f; bullet.motion.relative_y = 225.f; circle_info_t info = {0}; info.radius = 10.f; info.hitbox_radius = 5.f; register_bullet(bullet, &info); } } if (IsKeyPressed(KEY_B)) { DrawText(TextFormat("Mouse Pos : %i, %i", GetMouseX(), GetMouseY()), 200, 40, 20, BLACK); for (int i = 0; i < 0x1; ++i) { bullet_t bullet = {0}; bullet.type = Rect; bullet.sprite = shard_sprite; bullet.motion.direction_angle = M_PI_4; //bullet.motion.velocity = 400.f; //bullet.motion.angular_acceleration = 4.f; //bullet.motion.rotational_speed = 50.f/20.f; bullet.motion.rotation = M_PI_4; bullet.motion.relative_x = 400.f; bullet.motion.relative_y = 225.f; rect_info_t info = {0}; info.width = 16.f; info.height = 18.f; info.hitbox_width = 6.f; info.hitbox_height = 12.f; bullet_t* root_ptr = register_bullet(bullet, &info); bullet_t satellite = {0}; satellite.type = Circle; satellite.sprite = sprite; satellite.motion.direction_angle = M_PI_2; // looking up satellite.motion.velocity = 50.f; satellite.motion.angular_velocity = 50.f/20.f; // omega=V/R in radians satellite.motion.relative_x = 20.f; satellite.motion.relative_y = 00.f; satellite.motion.root = &root_ptr->motion; circle_info_t satellite_info = {0}; satellite_info.radius = 10.f; //register_bullet(satellite, &satellite_info); // another one satellite = (bullet_t){0}; satellite.type = Circle; satellite.sprite = sprite; satellite.motion.direction_angle = M_PI_2; // looking up satellite.motion.velocity = 140.f; satellite.motion.angular_velocity = 140.f/40.f; // omega=V/R in radians satellite.motion.relative_x = 40.f; satellite.motion.relative_y = 00.f; satellite.motion.root = &root_ptr->motion; satellite_info = (circle_info_t){0}; satellite_info.radius = 10.f; //register_bullet(satellite, &satellite_info); } } //if (false&&IsKeyPressed(KEY_S)) { float vm_start_time = GetTime(); vm_reset(test_vm); vm_run(test_vm); if (test_vm->allocated_region_count >= MAX_MEMORY_REGIONS/2) vm_run_gc(test_vm); global_state.vm_frame_time = GetTime() - vm_start_time; } if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { DrawCircle(GetMouseX(), GetMouseY(), 10, GREEN); global_state.player.pos.x = GetMouseX(); global_state.player.pos.y = GetMouseY(); } if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { SPAWN_VFX(0, screen_shake, 10, 10, 120.f, 0.5f); } if (IsKeyPressed(KEY_F)) { emitter_t* emitter = create_emitter(); emitter->lifetime = 5.0f; emitter->archetype_count = 1; emitter->archetype_strategy = LOOP; emitter->particles_sheet = particles_sheet; emitter->zorder = BELOWALL_ZORDER; emitter->blend_mode = BlendAdditive; emitter->frequency = 5.0f; emitter->burst_size = 2; emitter->motion = (motion_data_t){0}; emitter->motion.relative_x = global_state.game_area_size.x/2.0; emitter->motion.relative_y = 100.0; emitter->motion_randomness.direction_angle = 2.f*M_PI; emitter->motion_randomness.velocity = 20.f; particle_t particle = {0}; particle.initial_color = COL_GRAY; particle.initial_color.a = 200; particle.final_color = COL_RED; particle.final_color.a = 0; particle.initial_scale = (vector2d_t){0.25f, 0.25f}; particle.final_scale = (vector2d_t){0.25f, 0.25f}; particle.lifetime = 2.f; particle.motion.rotational_speed = M_PI; particle.motion.velocity = 20.f; particle.motion.max_rot = particle.motion.max_accel = particle.motion.max_speed = particle.motion.max_angular = +INFINITY; rect_t sprite_rect; sprite_rect.x = 8*512; sprite_rect.y = 8*512; sprite_rect.w = sprite_rect.h = 512; particle.spriteframe = load_sprite_frame(particles_sheet, sprite_rect); emitter->particle_archetypes[0] = particle; } } void compile_scripts() { system("\"D:/Compiegne C++/Projets C++/DanPaCompiler/DanPaCompiler/build/DanPaCompiler.exe\""); system("\"D:/Compiegne C++/Projets C++/DanPaAssembler/build/DanPaAssembler.exe\""); } void reset() { if (current_bgm != INVALID_MUSIC_ID) stop_music(current_bgm); clear_bullets(); cleanup_obj3ds(); clear_entities(); clear_particles(); global_state.current_frame = global_state.current_frame = 0; global_state.player_dead = 0; global_state.player.inactive = false; global_state.player.pos.x = 400; global_state.player.pos.y = 450 - 2; vm_clear(test_vm); vm_run_init(test_vm); } // TODO : warn about issue if .obj file normals are not written int main(void) { // Initialization //-------------------------------------------------------------------------------------- srand(time(0)); float timescale = 1.0f; compile_scripts(); test_vm = create_vm("in.bin"); init_scripting_syscalls(test_vm); vm_run_init(test_vm); global_state.player.focused_speed = 80.0f; global_state.player.unfocused_speed = 300.0f; global_state.player.hitbox_radius = 2.0f; global_state.player.pos.x = 400; global_state.player.pos.y = 450 - 2; SetConfigFlags(FLAG_MSAA_4X_HINT); InitWindow(800, 450, "raylib [text] example - 弾幕パラノイア"); InitAudioDevice(); SetTargetFPS(TARGET_FPS); // Set our game to run at 60 frames-per-second global_state.game_area_size = (ivector2d_t){800, 450}; Sound death_sound = LoadSound("resources/sfx/deathsound.mp3"); init_music_handler(); init_texture_handler(); init_skybox(); init_obj3ds(); init_vfx(); init_shader_fx(); init_textures(); init_player(); init_particle_system(); spritesheet_id_t sheet = load_spritesheet("resources/spritesheets/th06spritesheet_alpha.png", "danmaku-sheet-1"); rect_t rect = {.x = 364, .y = 62, .w = 16, .h = 16}; sprite = load_sprite_frame(sheet, rect); rect = (rect_t){.x = 380, .y = 95, .w = 16, .h = 18}; shard_sprite = load_sprite_frame(sheet, rect); particles_sheet = load_spritesheet("resources/spritesheets/particles.png", "particles-sheet"); SPAWN_VFX(0, sheared_rectangle, (vector2d_t){200.f, 000.f}, COL_PINK, 20.f, -0.25f, 0.0f, 1000.f, 1.f, false); SPAWN_VFX(0, sheared_rectangle, (vector2d_t){800.f, -500.f}, COL_PINK, 20.f, -0.25f, 0.0f, 1000.f, 1.2f, false); SPAWN_VFX(0, sheared_rectangle, (vector2d_t){400.f, -1500.f}, COL_PINK, 30.f, -0.25f, 0.0f, 2000.f, 1.5f, false); Camera camera = { { 1.0f, 1.0f, 1.0f }, { 4.0f, 1.0f, 4.0f }, { 0.0f, 1.0f, 0.0f }, 40.0f, 0 }; SetCameraMode(camera, CAMERA_FIRST_PERSON); load_skybox("resources/skybox.png"); int cool_id = load_shader("resources/shaders/death_shader.fs", NormalShader); int transition_shader = load_shader("resources/shaders/circle_transition.fs", NormalShader); int grayscale_shader = load_shader("resources/shaders/grayscale.fs", PostFXShader); //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- // TODO: Update your variables here //---------------------------------------------------------------------------------- float frame_start_time = GetTime(); //const float dt = GetFrameTime(); const float dt = (1.0f/TARGET_FPS) * timescale; // fixed timestep frame_time = dt; float collision_start_time = GetTime(); bool player_collision = test_player_collision(&global_state.player); global_state.collision_frame_time = GetTime() - collision_start_time; float game_logic_start_time = GetTime(); vm_drawlist_reset(); update_music_streams(); timed_actions_update(dt); vfx_update(dt); update_shader_fx(dt); update_player(dt, &global_state.player); update_bullets(dt); UpdateCamera(&camera); global_state.game_logic_frame_time = GetTime() - game_logic_start_time; float particles_start_time = GetTime(); update_particle_system(dt); global_state.particles_frame_time = GetTime() - particles_start_time; if (!global_state.player_dead && player_collision) { //TakeScreenshot("death.png"); global_state.player_dead = true; death_frame = global_state.current_frame; death_time = GetTime(); global_state.player.inactive = true; schedule_action(1.20f, start_transition, &transition_shader); schedule_action(2.25f, reset, NULL); PlaySound(death_sound); enable_shader(cool_id, 2.0f, UNDER_PLAYER_ZORDER, false); enable_shader(grayscale_shader, 1.0f, BELOWALL_ZORDER, true); SPAWN_VFX(0, screen_shake, 35, 35, 160.f, 0.5f); } color_t bg_color = {0xff, 0xff, 0xff, 0xff}; if (global_state.player_dead) { if (current_bgm != INVALID_MUSIC_ID) set_music_volume(current_bgm, 1.0f - fminf((global_state.current_frame-death_frame)/50.f, 1.0f)); } Color rl_bgcol; rl_bgcol.r = bg_color.r; rl_bgcol.g = bg_color.g; rl_bgcol.b = bg_color.b; rl_bgcol.a = bg_color.a; // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(rl_bgcol); float bckg_start_time = GetTime(); BeginMode3D(camera); draw_skybox(); draw_all_obj3d(); EndMode3D(); global_state.bckg_frame_time = GetTime() - bckg_start_time; vfx_draw(); draw_shader_fx(); if (global_state.player_dead && (global_state.current_frame-death_frame)>60) { translate_viewport((vector3d_t){0.0, -expf((global_state.current_frame-death_frame-60)/10.f), 0.0}); } handle_events(); draw_bullets(); draw_particles(); if (!global_state.player_dead) draw_player(&global_state.player); // to handle z-ordered rendering float render2d_start_time = GetTime(); sort_drawlist(); commit_drawlist(); global_state.render2d_frame_time = GetTime() - render2d_start_time; // HUD stuff : ignore previous transforms reset_viewport(); draw_hud(); global_state.busy_frame_time = GetTime() - frame_start_time; /* int id = test_collision(GetMouseX(), GetMouseY(), 10); if (id) { DrawText(FormatText("Collision test : %d", id), 10, 260, 20, BLACK); } */ rect_t game_area_rect; game_area_rect.x = game_area_rect.y = 0; game_area_rect.w = global_state.game_area_size.x; game_area_rect.h = global_state.game_area_size.y; EndDrawing(); //---------------------------------------------------------------------------------- ++global_state.current_frame; } do_cleanup(); // De-Initialization //-------------------------------------------------------------------------------------- CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- cleanup_vm(test_vm); return 0; }
32.561181
146
0.585979
[ "vector" ]
7a9f13b49c06bed48bb49e0d3cfc196ac996db0b
1,137
h
C
src/yb/gen_yrpc/gen_yrpc_fwd.h
polarweasel/yugabyte-db
9064eca9dc35769cf6b034e537ee42efed03c47d
[ "Apache-2.0", "CC0-1.0" ]
2,759
2017-10-05T22:15:20.000Z
2019-09-16T13:16:21.000Z
src/yb/gen_yrpc/gen_yrpc_fwd.h
polarweasel/yugabyte-db
9064eca9dc35769cf6b034e537ee42efed03c47d
[ "Apache-2.0", "CC0-1.0" ]
2,195
2017-11-06T23:38:44.000Z
2019-09-16T20:24:31.000Z
src/yb/gen_yrpc/gen_yrpc_fwd.h
polarweasel/yugabyte-db
9064eca9dc35769cf6b034e537ee42efed03c47d
[ "Apache-2.0", "CC0-1.0" ]
257
2017-10-06T02:23:19.000Z
2019-09-13T18:01:15.000Z
// Copyright (c) YugaByte, 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. // #ifndef YB_GEN_YRPC_GEN_YRPC_FWD_H #define YB_GEN_YRPC_GEN_YRPC_FWD_H #include <vector> namespace google { namespace protobuf { class FieldDescriptor; class FileDescriptor; class Descriptor; class MethodDescriptor; class ServiceDescriptor; namespace io { class Printer; } // namespace io } // namespace protobuf } // namespace google namespace yb { namespace gen_yrpc { class Substituter; using Substitutions = std::vector<std::pair<std::string, std::string>>; } // namespace gen_yrpc } // namespace yb #endif // YB_GEN_YRPC_GEN_YRPC_FWD_H
24.191489
100
0.759894
[ "vector" ]
7aa934c67f3910bf91eeb2b63393f22c18d6cc62
2,192
h
C
Raven.CppClient/RawDocumentQuery.h
maximburyak/ravendb-cpp-client
ab284d00bc659e8438c829f1b4a39aa78c31fa88
[ "MIT" ]
null
null
null
Raven.CppClient/RawDocumentQuery.h
maximburyak/ravendb-cpp-client
ab284d00bc659e8438c829f1b4a39aa78c31fa88
[ "MIT" ]
null
null
null
Raven.CppClient/RawDocumentQuery.h
maximburyak/ravendb-cpp-client
ab284d00bc659e8438c829f1b4a39aa78c31fa88
[ "MIT" ]
null
null
null
#pragma once #include "AbstractDocumentQuery.h" #include "IRawDocumentQuery.h" namespace ravendb::client::documents::session { template<typename T> class RawDocumentQuery : public AbstractDocumentQuery<T>, public IRawDocumentQuery<T, RawDocumentQuery<T>> { private: std::weak_ptr<RawDocumentQuery> _weak_this{}; RawDocumentQuery(InMemoryDocumentSessionOperations& session, std::string raw_query) : AbstractDocumentQuery(session, {}, {}, false, {}, {}, {}) { AbstractDocumentQuery<T>::query_raw = std::move(raw_query); } public: std::shared_ptr<RawDocumentQuery> skip(int32_t count) { AbstractDocumentQuery<T>::_skip(count); return _weak_this.lock(); } std::shared_ptr<RawDocumentQuery> take(int32_t count) { AbstractDocumentQuery<T>::_take(count); return _weak_this.lock(); } int32_t count() { return AbstractDocumentQuery<T>::count(); } std::shared_ptr<RawDocumentQuery> no_tracking() { AbstractDocumentQuery<T>::_no_tracking(); return _weak_this.lock(); } std::shared_ptr<RawDocumentQuery> no_caching() { AbstractDocumentQuery<T>::_no_caching(); return _weak_this.lock(); } std::shared_ptr<RawDocumentQuery> using_default_operator(queries::QueryOperator query_operator) { AbstractDocumentQuery<T>::_using_default_operator(query_operator); return _weak_this.lock(); } std::shared_ptr<RawDocumentQuery> add_parameter(std::string name, nlohmann::json value) { AbstractDocumentQuery<T>::_add_parameter(std::move(name), std::move(value)); return _weak_this.lock(); } std::vector<std::shared_ptr<T>> to_list() { return AbstractDocumentQuery<T>::to_list(); } Lazy<std::vector<std::shared_ptr<T>>> lazily( const std::optional<std::function<void(const std::vector<std::shared_ptr<T>>&)>>& on_eval = {}) { return AbstractDocumentQuery<T>::lazily(on_eval); } static std::shared_ptr<RawDocumentQuery> create(InMemoryDocumentSessionOperations& session, std::string raw_query) { auto new_object = std::shared_ptr<RawDocumentQuery>(new RawDocumentQuery(session, std::move(raw_query))); new_object->_weak_this = new_object; return new_object; } }; }
26.409639
116
0.724453
[ "vector" ]
7aa9dd325d1403bbbf0819704f754d998e102aed
4,970
c
C
base/hals/intfilter/src/filter/power.c
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
base/hals/intfilter/src/filter/power.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
base/hals/intfilter/src/filter/power.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 1999 Microsoft Corporation Module Name: power.c Abstract: Interrupt-affinity Filter (Roughly based on "NULL filter driver" in DDK, by ervinp and t-chrpri) Author: t-chrpri Environment: Kernel mode Revision History: --*/ #include <WDM.H> #include "filter.h" #ifdef ALLOC_PRAGMA #pragma alloc_text(PAGElock, VA_Power) #endif NTSTATUS VA_Power(struct DEVICE_EXTENSION *devExt, PIRP irp) /*++ Routine Description: Dispatch routine for Power IRPs (MajorFunction == IRP_MJ_Power) Arguments: devExt - device extension for targetted device object irp - Io Request Packet Return Value: NT status code --*/ { PIO_STACK_LOCATION irpSp; NTSTATUS status; irpSp = IoGetCurrentIrpStackLocation(irp); DBGOUT(("VA_Power, minorFunc = 0x%X ", (ULONG)irpSp->MinorFunction)); switch (irpSp->MinorFunction){ case IRP_MN_SET_POWER: switch (irpSp->Parameters.Power.Type) { case SystemPowerState: /* * For system power states, just pass the IRP down. */ break; case DevicePowerState: switch (irpSp->Parameters.Power.State.DeviceState) { case PowerDeviceD0: /* * Resume from APM Suspend * * Do nothing here; * Send down the read IRPs in the completion * routine for this (the power) IRP. */ break; case PowerDeviceD1: case PowerDeviceD2: case PowerDeviceD3: /* * Suspend */ if (devExt->state == STATE_STARTED){ devExt->state = STATE_SUSPENDED; } break; } break; } break; } /* * Send the IRP down the driver stack, * using PoCallDriver (not IoCallDriver, as for non-power irps). */ IncrementPendingActionCount(devExt); IoCopyCurrentIrpStackLocationToNext(irp); IoSetCompletionRoutine( irp, VA_PowerComplete, (PVOID)devExt, // context TRUE, TRUE, TRUE); status = PoCallDriver(devExt->topDevObj, irp); return status; } NTSTATUS VA_PowerComplete( IN PDEVICE_OBJECT devObj, IN PIRP irp, IN PVOID context) /*++ Routine Description: Completion routine for Power IRPs (MajorFunction == IRP_MJ_Power) Arguments: devObj - targetted device object irp - Io Request Packet context - context value passed to IoSetCompletionRoutine by VA_Power Return Value: NT status code --*/ { PIO_STACK_LOCATION irpSp; struct DEVICE_EXTENSION *devExt = (struct DEVICE_EXTENSION *)context; ASSERT(devExt); ASSERT(devExt->signature == DEVICE_EXTENSION_SIGNATURE); /* * If the lower driver returned PENDING, mark our stack location as * pending also. */ if( irp->PendingReturned ) { DBGOUT(( "in PowerComplete -- irp was 'PendingReturned'!" )); IoMarkIrpPending(irp); } irpSp = IoGetCurrentIrpStackLocation(irp); ASSERT(irpSp->MajorFunction == IRP_MJ_POWER); if (NT_SUCCESS(irp->IoStatus.Status)){ switch (irpSp->MinorFunction){ case IRP_MN_SET_POWER: switch (irpSp->Parameters.Power.Type){ case DevicePowerState: switch (irpSp->Parameters.Power.State.DeviceState){ case PowerDeviceD0: if (devExt->state == STATE_SUSPENDED){ devExt->state = STATE_STARTED; } break; } break; } break; } } /* * Whether we are completing or relaying this power IRP, * we must call PoStartNextPowerIrp. */ PoStartNextPowerIrp(irp); /* * Decrement the pendingActionCount, which we incremented in VA_Power. */ DecrementPendingActionCount(devExt); return STATUS_SUCCESS; }
24.009662
76
0.481489
[ "object" ]
7ab193b9c06c81db369efaf14ef2b84094c851fa
10,645
h
C
src/lib/include/nanotdf_builder.h
opentdf/client-cpp
9c6dbc73a989733e30371555aa7a24ff496a62f1
[ "MIT" ]
null
null
null
src/lib/include/nanotdf_builder.h
opentdf/client-cpp
9c6dbc73a989733e30371555aa7a24ff496a62f1
[ "MIT" ]
3
2022-01-31T14:42:51.000Z
2022-03-28T22:44:54.000Z
src/lib/include/nanotdf_builder.h
opentdf/client-cpp
9c6dbc73a989733e30371555aa7a24ff496a62f1
[ "MIT" ]
1
2022-03-09T18:40:47.000Z
2022-03-09T18:40:47.000Z
/* * Copyright 2020 Virtru Corporation * * SPDX - License Identifier: BSD-3-Clause-Clear * */ // // TDF SDK // // Created by Sujan Reddy on 2020/06/02 // #ifndef VIRTRU_NANO_TDF_BUILDER_H #define VIRTRU_NANO_TDF_BUILDER_H #include <memory> #include <string> #include <unordered_map> #include "tdf_constants.h" #include "network_interface.h" namespace virtru { using namespace virtru; /// /// NOTE: User of this SDK has to catch virtru::exception. This sdk throws exception if any of the interfaces are /// not used or not configured correctly. /// /// Forward declaration. class PolicyObject; class EntityObject; class NanoTDF; class NanoTDFImpl; class NanoTDFBuilderImpl; class ILogger; class INetwork; class NanoTDFDatasetClient; class NanoTDFBuilder { public: /// NOTE: This is a required interface. There are no default implementations, /// the consumer of the SDK must provide these /// Constructor /// \param user - The owner of this TDF creation process explicit NanoTDFBuilder(const std::string& user); /// Set the eas url that will be used for nano tdf operations. /// \param easUrl - The eas(Entity Attribute Server) url. /// \return - Return a reference of this instance. NanoTDFBuilder& setEasUrl(const std::string& easUrl); /// Return a unique ptr to the NanoTDF object. This can be used to exercise operations like /// encryption/decryption of the payload. /// \return - Unique ptr of the NanoTDF instance. /// NOTE: Throws an virtru::exception if any of the information is missing for construction /// of the NanoTDF object. std::unique_ptr<NanoTDF> build(); /// Return a unique ptr of Dataset of NanoTDF object. This can be use to exercise operation like /// encryption/decryption of the payload. /// \param maxKeyIterations - Maximum number of encrypt operations before a new key is generated. /// \return - Unique ptr of the NanoTDF instance. /// NOTE: Throws an virtru::exception if any of the information is missing for construction of the TDF object. std::unique_ptr<NanoTDF> buildNanoTDFDataset(uint32_t maxKeyIterations); public: /// Optional /// Set the entity object. This can be used for offline mode. /// \param entityObject - The key access type. /// \return - Return a reference of this instance. NanoTDFBuilder& setEntityObject(const EntityObject& entityObject); /// Set the policy object on the TDF instance. /// \param policyObject - The policy object. /// \return - Return a reference of this instance. NanoTDFBuilder& setPolicyObject(const PolicyObject& policyObject); /// Set the Elliptic-curve to be used for encryption/decryption of the payload/policy. /// \param curve - The elliptic curve. The default curve is "secp256k1" /// \return - Return a reference of this instance. NanoTDFBuilder& setEllipticCurve(EllipticCurve curve); /// Set the entity private key(In PEM format), which will be used by this SDK for encryption/decryption of /// the payload/policy. The private key should be from one of predefined curves defined in tdf_constants.h /// \param privateKey - The PEM-encoded private key as a string. /// \param curve - The elliptic curve of the key-pair /// NOTE: This is the optional interface, if the consumer of the SDK didn't provide one, the SDK /// will generate one. NanoTDFBuilder& setEntityPrivateKey(const std::string& privateKey, EllipticCurve curve); /// Set the signer private key(In PEM format). Calling this method enables the signature entry in nano tdf /// The ECC private key should be from one of predefined curves which are defined in tdf_constants.h. /// \param signerPrivateKey - The PEM-encoded signer private key. /// \param curve - The elliptic curve of the public key /// \return - Return a reference of this instance. /// NOTE: This is the optional interface, signature is not enabled by default. NanoTDFBuilder& setSignerPrivateKey(const std::string& signerPrivateKey, EllipticCurve curve); /// Validate the TDF on decrypt(check if the TDF is singed by right entity). Throws exception /// on decrypt if the given public key doesn't match the one in TDF. /// \param signerPublicKey - The PEM-encoded public key as a string. /// \return - Return a reference of this instance. NanoTDFBuilder& validateSignature(const std::string& signerPublicKey); /// Set the kas url that will be used for tdf operations. This can be used for offline mode, in online case /// this information is Entity Object. /// \param kasUrl - The kas(Key Access Server) url. /// \return - Return a reference of this instance. NanoTDFBuilder& setKasUrl(const std::string& kasUrl); /// Feature flag for OIDC-based auth flows /// In this mode, EOs are not used and EAS is not called /// Additionally, KAS requests will be different. /// \return - Return a reference of this instance. NanoTDFBuilder& enableOIDC(bool enableOIDC); /// Set the kas public key(In PEM format). This can be used for offline mode. /// \param publicKey - The PEM-encoded kas public key as a string. /// \return - Return a reference of this instance. /// NOTE: This is the optional interface, kas public is part of Entity object. NanoTDFBuilder& setKasPublicKey(const std::string& kasPublicKey); /// Set the offline mode. /// \param state - If true, all the nano tdf operation are performed without a network connection. /// NOTE: All the necessary keys needs to set to perform offline nano tdf operations. /// \return - Return a reference of this instance. NanoTDFBuilder& setOffline(bool state); /// Set the policy type of the tdf. The default is embedded policy as plain text. /// \param policyType - The policy type /// \return - Return a reference of this instance. /// NOTE: This is the optional interface, the default is EMBEDDED_POLICY_ENCRYPTED NanoTDFBuilder& setPolicyType(NanoTDFPolicyType policyType); /// Set the symmetric ciphers to use for encrypting the payload and/or /// the policy (if the policy is encrypted). The default is aes-256 with gcm 64bit tag. /// \param cipher - The symmetric cipher /// \return - Return a reference of this instance. NanoTDFBuilder& setCipher(NanoTDFCipher cipher); /// Enable ecdsa policy binding, the default is gmac. /// \return - Return a reference of this instance. NanoTDFBuilder& enableECDSABinding(); /// Disable ecdsa policy binding /// \return - Return a reference of this instance. NanoTDFBuilder& disableECDSABinding(); /// Get current ecdsa policy binding setting /// \return - true if enabled, false otherwise bool getECDSABinding(); /// Enable the flag to use old format(smaller IV) for decrypting the // Nano tdfs void enableFlagToUseOldFormatNTDF(); /// Disable the flag to use old format(smaller IV) for decrypting the // Nano tdfs void disableFlagToUseOldFormatNTDF(); public: /// Optional - Logging /// Enable the logger to write logs to the console. /// \return - Return a reference of this instance. /// \param logLevel - The log level. /// NOTE: This is the optional interface. NanoTDFBuilder& enableConsoleLogging(LogLevel logLevel = LogLevel::Current); /// Set the external logger. /// NOTE: Setting this will disable the console output if it was enabled /// \param externalLogger - The external logger shared ptr. /// \param logLevel - The log level. NanoTDFBuilder& setExternalLogger(std::shared_ptr<ILogger> externalLogger, LogLevel logLevel = LogLevel::Current); public: /// Network I/O /// Set the http headers will be used for all the all the http network operations. /// \param properties - A unordered map holding the http headers. /// \return - Unique ptr of the TDF instance. NanoTDFBuilder& setHttpHeaders(const std::unordered_map<std::string, std::string>& headers); /// Set the callback interface which will invoked for all the http network operations. /// \param httpServiceProvider - A callback interface which the caller has to implement for performing the /// network http operations. /// \return - Unique ptr of the TDF3 instance. NanoTDFBuilder& setHTTPServiceProvider(std::weak_ptr<INetwork> httpServiceProvider); public: /// Optional - configure root CA's /// Set the certAuthority which will be used in SSL handshake for all the network I/O. /// \param certAutority - A string which holds the cert authority which will be used in SSL handshake /// for all the network I/O /// \return - Return a reference of this instance. /// NOTE: This is the optional interface. if the consumer of the SDK didn't provide one, the SDK /// will use the default ones packaged in library. NanoTDFBuilder& setCertAuthority(const std::string& certAutority); /// Set the cert authority which will be used in SSL handshake for all the network I/O. /// \param certAutority - A string(R-value) which holds the cert authority which will be used in SSL handshake /// for all the network I/O /// \return - Return a reference of this instance. /// NOTE: This is the optional interface. if the consumer of the SDK didn't provide one, the SDK /// will use the default ones packaged in library. NanoTDFBuilder& setCertAuthority(std::string&& certAutority) noexcept; /// Destructor ~NanoTDFBuilder(); /// Remove default constructor NanoTDFBuilder() = delete; protected: /// Validate the data set by the consumer of the NanoTDFBuilder void validate(); private: /// Data friend class NanoTDF; friend class NanoTDFImpl; friend class NanoTDFClient; friend class NanoTDFDatasetClient; std::unique_ptr<NanoTDFBuilderImpl> m_impl; }; } #endif //VIRTRU_NANO_TDF_BUILDER_H
46.894273
123
0.667825
[ "object" ]
7ab5c397abc7a1ca32aa7c5055bbc81f1bce9f24
1,059
h
C
ATM/repository/db_impl/transactionrepositorydbimpl.h
kirill26031/ATM
e59b57491abb8ceaa74a57af68410813656322c7
[ "MIT" ]
null
null
null
ATM/repository/db_impl/transactionrepositorydbimpl.h
kirill26031/ATM
e59b57491abb8ceaa74a57af68410813656322c7
[ "MIT" ]
1
2021-11-03T19:26:30.000Z
2021-11-03T19:26:30.000Z
ATM/repository/db_impl/transactionrepositorydbimpl.h
kirill26031/ATM
e59b57491abb8ceaa74a57af68410813656322c7
[ "MIT" ]
null
null
null
#ifndef TRANSACTIONREPOSITORYDBIMPL_H #define TRANSACTIONREPOSITORYDBIMPL_H #include "repository/transactionrepository.h" #include "exception/notfoundexception.h" #include <string> #include "dbmanager.h" #include "repository/vector_impl/transactionrepositoryvectorimpl.h" class TransactionRepositoryDBImpl : public TransactionRepository { public: TransactionEntity getById(long) override; std::vector<TransactionEntity> getAll() override; void setById(long, const TransactionEntity&) override; void deleteById(long) override; void clearAll() override {}; bool existsById(long) override; static TransactionRepository* getInstance(); ~TransactionRepositoryDBImpl(){} // destructor for _rep is called from global window destructor protected: TransactionRepositoryDBImpl(); private: void fillCache(const std::vector<TransactionEntity>& vector); static TransactionRepository* _rep; TransactionRepository* _cache; bool _cache_modified; DBManager* _db_manager; };; #endif // TRANSACTIONREPOSITORYDBIMPL_H
31.147059
99
0.784703
[ "vector" ]
7abb4dcf462604252f939dbe659adb8f0aa10095
7,060
c
C
src/af-mraa-binding.c
intel-iot-devkit/af-mraa-binding
071d50b38fd5d379169bd904c1acb5f309cc3b25
[ "MIT" ]
null
null
null
src/af-mraa-binding.c
intel-iot-devkit/af-mraa-binding
071d50b38fd5d379169bd904c1acb5f309cc3b25
[ "MIT" ]
null
null
null
src/af-mraa-binding.c
intel-iot-devkit/af-mraa-binding
071d50b38fd5d379169bd904c1acb5f309cc3b25
[ "MIT" ]
null
null
null
/* * Copyright (C) Intel Corp. * Author: Brendan Le Foll <brendan.le.foll@intel.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define _GNU_SOURCE #define AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX #define AFB_BINDING_VERSION 2 #include <afb/afb-binding.h> #include <json-c/json.h> #include <string.h> #include <mraa.h> #include "wrapjson/wrap-json.h" //#include "uthash/utarray.h" //struct _i2c afb_dd2c_contexts[10]; //UT_icd afb_i2c_contexts_icd = {sizeof(mraa_i2c_context), NULL, NULL, NULL}; //UT_array *afb_i2c_contexts; mraa_i2c_context i2c_dev[1024]; static void version(struct afb_req request) { json_object *jsrep = json_object_new_string (mraa_get_version()); json_object *query = afb_req_json(request); afb_req_success_f(request, jsrep, "libmraa Version is %s, runnng on %s", mraa_get_version(), mraa_get_platform_name(), json_object_to_json_string(query)); } static void command(struct afb_req request) { struct json_object *queryJ; mraa_result_t mraa_ret; json_object *mraa_resp = json_object_new_object(); queryJ = afb_req_json(request); if (!queryJ) { afb_req_fail_f (request, "query-notjson","query=%s not a valid json entry", afb_req_value(request,"")); return; } char* command; char* data; char* dataout; int intarg, intarg2, index, jwrap_ret; printf("%s\n---\n", json_object_to_json_string_ext(queryJ, JSON_C_TO_STRING_PRETTY)); jwrap_ret = wrap_json_unpack(queryJ, "[si!]", &command, &index); if (jwrap_ret == 0) { if (strcmp(command, "mraa_i2c_read_byte") == 0) { int mraaread = mraa_i2c_read_byte(i2c_dev[index]); wrap_json_pack(&mraa_resp, "{s:i}", "mraachar", mraaread); } afb_req_success(request, mraa_resp, NULL); return; } jwrap_ret = wrap_json_unpack(queryJ, "[sii!]", &command, &index, &intarg); if (jwrap_ret == 0) { if (strcmp(command, "mraa_i2c_address") == 0) { mraa_ret = mraa_i2c_address(i2c_dev[index], intarg); wrap_json_pack(&mraa_resp, "{s:i}", "mraa_result_t", mraa_ret); } else if (strcmp(command, "mraa_i2c_frequency") == 0) { mraa_ret = mraa_i2c_frequency(i2c_dev[index], (mraa_i2c_mode_t) intarg); wrap_json_pack(&mraa_resp, "{s:i}", "mraa_result_t", mraa_ret); } else if (strcmp(command, "mraa_i2c_read_byte_data") == 0) { int mraaread = mraa_i2c_read_byte_data(i2c_dev[index], intarg); wrap_json_pack(&mraa_resp, "{s:i, s:s}", "length", mraaread, "data", data); } else if (strcmp(command, "mraa_i2c_read_word_data") == 0) { int mraaread = mraa_i2c_read_word_data(i2c_dev[index], intarg); wrap_json_pack(&mraa_resp, "{s:i, s:s}", "length", mraaread, "data", data); } else if (strcmp(command, "mraa_i2c_write_byte") == 0) { mraa_ret = mraa_i2c_write_byte(i2c_dev[index], intarg); wrap_json_pack(&mraa_resp, "{s:i}", "mraa_result_t", mraa_ret); } afb_req_success(request, mraa_resp, NULL); return; } jwrap_ret = wrap_json_unpack(queryJ, "[siii!]", &command, &index, &intarg, &intarg2); if (jwrap_ret == 0) { if (strcmp(command, "mraa_i2c_write_byte_data") == 0) { mraa_ret = mraa_i2c_write_byte_data(i2c_dev[index], intarg, intarg2); wrap_json_pack(&mraa_resp, "{s:i}", "mraa_result_t", mraa_ret); } else if (strcmp(command, "mraa_i2c_write_word_data") == 0) { mraa_ret = mraa_i2c_write_word_data(i2c_dev[index], intarg, intarg2); wrap_json_pack(&mraa_resp, "{s:i}", "mraa_result_t", mraa_ret); } afb_req_success(request, mraa_resp, NULL); return; } jwrap_ret = wrap_json_unpack(queryJ, "[sisi!]", &command, &index, &data, &intarg); if (jwrap_ret == 0) { if (strcmp(command, "mraa_i2c_read") == 0) { dataout = (char*) calloc(intarg, sizeof(char)); int mraaread = mraa_i2c_read(i2c_dev[index], dataout, intarg); wrap_json_pack(&mraa_resp, "{s:i, s:s}", "length", mraaread, "data", dataout); } else if (strcmp(command, "mraa_i2c_write") == 0) { dataout = (char*) calloc(intarg, sizeof(char)); mraa_ret = mraa_i2c_write(i2c_dev[index], dataout, intarg); wrap_json_pack(&mraa_resp, "{s:i, s:s}", "mraa_result_t", mraa_ret, "data", dataout); } afb_req_success(request, mraa_resp, NULL); return; } } static void dev_init(struct afb_req request) { struct json_object *queryJ; mraa_result_t res; json_object *mraa_resp = json_object_new_object(); const char* initfunc; int index; queryJ = afb_req_json(request); if (!queryJ) { afb_req_fail_f(request, "query-notjson","query=%s not a valid json entry", afb_req_value(request,"")); return; } printf("%s\n---\n", json_object_to_json_string_ext(queryJ, JSON_C_TO_STRING_PRETTY)); int ret = wrap_json_unpack(queryJ, "[si!]", &initfunc, &index); if (ret == 0) { if (strcmp(initfunc, "mraa_i2c_init") == 0) { i2c_dev[index] = mraa_i2c_init(index+512); if (i2c_dev == NULL) { afb_req_fail_f(request, "query-notvalid","mraa_i2c_init failed"); return; } wrap_json_pack(&mraa_resp, "[I]", &i2c_dev); afb_req_success(request, mraa_resp, NULL); return; } } afb_req_fail_f(request, "query-notarray","query=%s not valid JSON mraa.io command", afb_req_value(request,"")); return; } static void dev_init_raw(struct afb_req request) { return; } /* * Verb Array */ static const struct afb_verb_v2 verbs[] = { { "version", version, NULL, AFB_SESSION_NONE }, { "dev-init", dev_init, NULL, AFB_SESSION_NONE }, { "dev-init-raw", dev_init_raw, NULL, AFB_SESSION_NONE }, { "command", command, NULL, AFB_SESSION_NONE }, { NULL } }; static int preinit() { AFB_NOTICE("mraa binding preinit (was register)"); // utarray_new(afb_i2c_contexts, &afb_i2c_contexts_icd); return 0; } static int init() { AFB_NOTICE("mraa binding init"); // TODO: Check return value and do something intelligent here mraa_init(); // special X1 lenovo command mraa_add_subplatform(MRAA_GENERIC_FIRMATA, "/dev/ttyACM4"); return 0; } static void onevent(const char *event, struct json_object *object) { AFB_NOTICE("onevent %s", event); } /* * description of the binding for afb-daemon */ const struct afb_binding_v2 afbBindingV2 = { /* description conforms to VERSION 2 because VERSION 1 is OLD! */ .api = "mraa", .specification = NULL, .verbs = verbs, .preinit = preinit, .init = init };
31.517857
115
0.66983
[ "object" ]
7abc03645f68b2cb897a7d73d7d0ec9625879a8c
558
h
C
LoganEngine/src/lCore/lRenderer/lrRenderer/lGLRenderer/lGLResources/lrGLMesh/lrGLMeshResources/lrGLSkeletalMeshResource.h
sereslorant/logan_engine
a596b4128d0a58236be00f93064e276e43484017
[ "MIT" ]
1
2019-12-26T13:22:29.000Z
2019-12-26T13:22:29.000Z
LoganEngine/src/lCore/lRenderer/lrRenderer/lGLRenderer/lGLResources/lrGLMesh/lrGLMeshResources/lrGLSkeletalMeshResource.h
sereslorant/logan_engine
a596b4128d0a58236be00f93064e276e43484017
[ "MIT" ]
null
null
null
LoganEngine/src/lCore/lRenderer/lrRenderer/lGLRenderer/lGLResources/lrGLMesh/lrGLMeshResources/lrGLSkeletalMeshResource.h
sereslorant/logan_engine
a596b4128d0a58236be00f93064e276e43484017
[ "MIT" ]
null
null
null
#ifndef LR_GL_SKELETAL_MESH_RESOURCE_H #define LR_GL_SKELETAL_MESH_RESOURCE_H #include "../lrGLMeshData/lrGLVertexData.h" #include "../lrGLMeshData/lrGLBoneData.h" #include "../lrGLMeshData/lrGLPrimitiveData.h" #include <vector> struct lrGLSkeletalMeshResource { lrGLVertexData VertexData; lrGLBoneData BoneData; std::vector<lrGLPrimitiveData> MaterialGroups; void Initialize(lrmSkeletalMesh &skeletal_mesh); lrGLSkeletalMeshResource() {} ~lrGLSkeletalMeshResource() {} /* * End of class */ }; #endif // LR_GL_SKELETAL_MESH_RESOURCE_H
19.241379
49
0.783154
[ "vector" ]
7abf22b789c6a7f7ee5fe1b10da44478ebd56e83
750
h
C
Scrabble.h
Nikol164/Scrabble
b3aee999bb70495a04c440ed5622d4f437537dd4
[ "MIT" ]
null
null
null
Scrabble.h
Nikol164/Scrabble
b3aee999bb70495a04c440ed5622d4f437537dd4
[ "MIT" ]
null
null
null
Scrabble.h
Nikol164/Scrabble
b3aee999bb70495a04c440ed5622d4f437537dd4
[ "MIT" ]
null
null
null
/** * * Solution to course project # 7 * Introduction to programming course * Faculty of Mathematics and Informatics of Sofia University * Winter semester 2021/2022 * * This file contains helper functions for the program * */ #pragma once #include <vector> #include <iostream> #include <string> #include <fstream> using namespace std; int maxLetters = 10; int rounds = 5; int tries = 2; int shuffles = 2; int main(); void menu(); void nameOfTheGame(); void inputFromThePlayer(); void playGame(); void numberFromTheList(); bool checkCharacters(string input, vector<char> characters); bool checkIfDictionaryContainTheWord(string input, vector<string> words); bool checkIfLengthOfInputIsSmallerThanGivenLetters(int currentMaxLetters, string input);
22.058824
88
0.773333
[ "vector" ]
7ac4f091f1aa44f287075283eaff705865553c2f
1,283
h
C
Descending Europa/Temp/StagingArea/Data/il2cppOutput/System.Core_ArrayTypes.h
screwylightbulb/europa
3dcc98369c8066cb2310143329535206751c8846
[ "MIT" ]
null
null
null
Descending Europa/Temp/StagingArea/Data/il2cppOutput/System.Core_ArrayTypes.h
screwylightbulb/europa
3dcc98369c8066cb2310143329535206751c8846
[ "MIT" ]
null
null
null
Descending Europa/Temp/StagingArea/Data/il2cppOutput/System.Core_ArrayTypes.h
screwylightbulb/europa
3dcc98369c8066cb2310143329535206751c8846
[ "MIT" ]
null
null
null
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include "mscorlib_System_Array1146569071.h" #include "System_Core_System_Collections_Generic_HashSet_1_L2122599155.h" #include "System_Core_System_Collections_Generic_HashSet_1_L2749541277.h" #pragma once // System.Collections.Generic.HashSet`1/Link<System.Object>[] struct LinkU5BU5D_t3085427682 : public Il2CppArray { public: ALIGN_FIELD (8) Link_t2122599155 m_Items[1]; public: inline Link_t2122599155 GetAt(il2cpp_array_size_t index) const { return m_Items[index]; } inline Link_t2122599155 * GetAddressAt(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAt(il2cpp_array_size_t index, Link_t2122599155 value) { m_Items[index] = value; } }; // System.Collections.Generic.HashSet`1/Link<UnityEngine.UI.IClippable>[] struct LinkU5BU5D_t1725180240 : public Il2CppArray { public: ALIGN_FIELD (8) Link_t2749541277 m_Items[1]; public: inline Link_t2749541277 GetAt(il2cpp_array_size_t index) const { return m_Items[index]; } inline Link_t2749541277 * GetAddressAt(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAt(il2cpp_array_size_t index, Link_t2749541277 value) { m_Items[index] = value; } };
27.891304
94
0.789556
[ "object" ]
7ac6c9f0529e45d7a1d4a6fef836352b303d5484
8,138
c
C
device/sensor/drv/drv_pm_sensirion_sps30/drv_pm_sensirion_sps30.c
comporsa/AliOS-Things
759927f7e107baa2d9dc8a5b48860ab7c093af8c
[ "Apache-2.0" ]
null
null
null
device/sensor/drv/drv_pm_sensirion_sps30/drv_pm_sensirion_sps30.c
comporsa/AliOS-Things
759927f7e107baa2d9dc8a5b48860ab7c093af8c
[ "Apache-2.0" ]
null
null
null
device/sensor/drv/drv_pm_sensirion_sps30/drv_pm_sensirion_sps30.c
comporsa/AliOS-Things
759927f7e107baa2d9dc8a5b48860ab7c093af8c
[ "Apache-2.0" ]
1
2020-11-04T04:30:48.000Z
2020-11-04T04:30:48.000Z
/* * Copyright (C) 2019 X-Cite SA (http://www.x-cite.io) * Written by Lemmer El Assal (lemmer@x-cite.io) */ #include "sps30.h" #include "sensor.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <aos/aos.h> #include <vfs_conf.h> #include <vfs_err.h> #include <vfs_register.h> #include <hal/base.h> #include "common.h" #include "sensor_drv_api.h" #include "sensor_hal.h" #ifndef SPS30_I2C_PORT #define SPS30_I2C_PORT 1 #endif #ifndef SPS30_DATA_READ_MIN_INTERVAL #define SPS30_DATA_READ_MIN_INTERVAL 10000 #endif #ifndef SPS30_I2C_FREQ #define SPS30_I2C_FREQ 10000 #endif #ifndef SPS30_MAX_TRIES #define SPS30_MAX_TRIES 10 #endif #ifndef REDTEXT #define REDTEXT "\x1B[31m" #endif #ifndef GREENTEXT #define GREENTEXT "\x1B[32m" #endif #ifndef RESETTEXT #define RESETTEXT "\x1B[0m" #endif #ifndef TRACE_COLOR #define TRACE_COLOR(color, type, fmt, ...) \ do { \ HAL_Printf("%s%s|%03d :: [%s] ", color, __func__, __LINE__, type); \ HAL_Printf(fmt, ##__VA_ARGS__); \ HAL_Printf("%s" RESETTEXT, "\r\n"); \ } while(0) #endif #ifndef TRACE_ERROR #define TRACE_ERROR(fmt, ...) TRACE_COLOR(REDTEXT, "ERROR", fmt, ##__VA_ARGS__) #endif #ifndef TRACE_INFO #define TRACE_INFO(fmt, ...) TRACE_COLOR(GREENTEXT, "INFO", fmt, ##__VA_ARGS__) #endif static struct sps30_measurement g_sps30_data_new; sensor_obj_t sensor_pm; i2c_dev_t sps30_ctx = { .port = SPS30_I2C_PORT, .config.freq = SPS30_I2C_FREQ, .config.address_width = I2C_MEM_ADDR_SIZE_8BIT, .config.dev_addr = SPS_I2C_ADDRESS, }; void sensirion_i2c_init(); s8 sensirion_i2c_read(u8 address, u8* data, u16 count); s8 sensirion_i2c_write(u8 address, const u8* data, u16 count); void sensirion_sleep_usec(u32 useconds); static int drv_sps30_update_data() { static uint32_t prev_update_tick = 0; uint32_t now_tick = 0; int ret = 0; int tries = SPS30_MAX_TRIES; now_tick = aos_now_ms(); if ((now_tick - prev_update_tick >= SPS30_DATA_READ_MIN_INTERVAL) || (prev_update_tick == 0)) { ret = sps30_start_measurement(); if(ret) { TRACE_ERROR("[SPS30] Start measurement failed (returned %d)", ret); return ret; } // SPS30 should spin up here and requires some time to be ready. aos_msleep(2000); uint16_t dataready = 0; do { do { ret = sps30_read_data_ready(&dataready); if(ret) { TRACE_ERROR("[SPS30] Data ready failed (returned %d)", ret); return ret; } if((dataready & 1) == 0) aos_msleep(1000); // delay by 1 s before retrying. } while((dataready & 1) == 0); if(ret == 0) { ret = sps30_read_measurement(&g_sps30_data_new); if (unlikely(ret != 0)) { TRACE_ERROR("[SPS30] Read measurement failed (returned %d)", ret); aos_msleep(1000); // delay by 1 s before retrying. tries--; } else { ret = sps30_stop_measurement(); if (unlikely(ret != 0)) { TRACE_ERROR("[SPS30] Stop measurement failed (returned %d)", ret); aos_msleep(1000); // delay by 1 s before retrying. tries--; } } } else tries--; } while(tries && ret); if(ret == 0) prev_update_tick = now_tick; return ret; } return 0; } static void drv_pm_sensirion_sps30_irq_handle(void) { /* no handle so far */ } static int drv_pm_sensirion_sps30_open(void) { LOG("%s %s successfully \n", SENSOR_STR, __func__); return 0; } static int drv_pm_sensirion_sps30_close(void) { LOG("%s %s successfully \n", SENSOR_STR, __func__); return 0; } static int drv_pm_sensirion_sps30_read(void *buf, size_t len) { int ret = 0; const size_t size = sizeof(pm_data_t); pm_data_t *pdata = (pm_data_t*)buf; if ((buf == NULL) || (len < size)){ return -1; } ret = drv_sps30_update_data(); if(ret) return ret; pdata->mc_1p0 = g_sps30_data_new.mc_1p0; pdata->mc_2p5 = g_sps30_data_new.mc_2p5; pdata->mc_4p0 = g_sps30_data_new.mc_4p0; pdata->mc_10p0 = g_sps30_data_new.mc_10p0; pdata->nc_0p5 = g_sps30_data_new.nc_0p5; pdata->nc_1p0 = g_sps30_data_new.nc_1p0; pdata->nc_2p5 = g_sps30_data_new.nc_2p5; pdata->nc_4p0 = g_sps30_data_new.nc_4p0; pdata->nc_10p0 = g_sps30_data_new.nc_10p0; pdata->typical_particle_size = g_sps30_data_new.typical_particle_size; pdata->timestamp = aos_now_ms(); return (int)size; } static int drv_pm_sensirion_sps30_write(const void *buf, size_t len) { (void)buf; (void)len; return 0; } static int drv_pm_sensirion_sps30_ioctl(int cmd, unsigned long arg) { switch (cmd) { case SENSOR_IOCTL_GET_INFO: { /* fill the dev info here */ dev_sensor_info_t *info = (dev_sensor_info_t *)arg; info->model = "SPS30"; info->vendor = DEV_SENSOR_VENDOR_SENSIRION; } break; default: return -1; } LOG("%s %s successfully \n", SENSOR_STR, __func__); return 0; } int32_t drv_sps30_init() { uint32_t ret = 0; sensirion_i2c_init(); char serial[SPS_MAX_SERIAL_LEN]; ret = sps30_get_serial(serial); if(!ret) TRACE_INFO("[SPS30] Serial: %s", serial); else TRACE_ERROR("[SPS30] Get serial failed (returned %d).", ret); memset(&sensor_pm, 0, sizeof(sensor_pm)); /* fill the sensor_pm obj parameters here */ sensor_pm.tag = TAG_DEV_PM; sensor_pm.path = dev_pm_path; sensor_pm.io_port = SPS30_I2C_PORT; sensor_pm.open = drv_pm_sensirion_sps30_open; sensor_pm.close = drv_pm_sensirion_sps30_close; sensor_pm.read = drv_pm_sensirion_sps30_read; sensor_pm.write = drv_pm_sensirion_sps30_write; sensor_pm.ioctl = drv_pm_sensirion_sps30_ioctl; sensor_pm.irq_handle = drv_pm_sensirion_sps30_irq_handle; ret = sensor_create_obj(&sensor_pm); if (unlikely(ret)) { return -1; } return ret; } /** * Initialize all hard- and software components that are needed for the I2C * communication. */ void sensirion_i2c_init() { hal_i2c_init(&sps30_ctx); } /** * Execute one read transaction on the I2C bus, reading a given number of bytes. * If the device does not acknowledge the read command, an error shall be * returned. * * @param address 7-bit I2C address to read from * @param data pointer to the buffer where the data is to be stored * @param count number of bytes to read from I2C and store in the buffer * @returns 0 on success, error code otherwise */ s8 sensirion_i2c_read(u8 address, u8* data, u16 count) { return hal_i2c_master_recv(&sps30_ctx, address, data, count, 1000); } /** * Execute one write transaction on the I2C bus, sending a given number of bytes. * The bytes in the supplied buffer must be sent to the given address. If the * slave device does not acknowledge any of the bytes, an error shall be * returned. * * @param address 7-bit I2C address to write to * @param data pointer to the buffer containing the data to write * @param count number of bytes to read from the buffer and send over I2C * @returns 0 on success, error code otherwise */ s8 sensirion_i2c_write(u8 address, const u8* data, u16 count) { return hal_i2c_master_send(&sps30_ctx, address, data, count, 1000); } /** * Sleep for a given number of microseconds. The function should delay the * execution for at least the given time, but may also sleep longer. * * Despite the unit, a <10 millisecond precision is sufficient. * * @param useconds the sleep time in microseconds */ void sensirion_sleep_usec(u32 useconds) { int mseconds = (int) useconds / 1000; if(mseconds == 0) aos_msleep(1); else aos_msleep(mseconds); }
27.126667
99
0.641067
[ "model" ]
7adc9fde99334974f32a79ed810048d420c79709
987
h
C
common/atlas.h
jasbok/libshimmer
794b0e27ee8492f46202efebd24dab32a7c5c1da
[ "MIT" ]
null
null
null
common/atlas.h
jasbok/libshimmer
794b0e27ee8492f46202efebd24dab32a7c5c1da
[ "MIT" ]
null
null
null
common/atlas.h
jasbok/libshimmer
794b0e27ee8492f46202efebd24dab32a7c5c1da
[ "MIT" ]
null
null
null
#ifndef COMMON_ATLAS_H #define COMMON_ATLAS_H #include "coords.h" #include "img.h" namespace common::atlas { struct atlas_coords { atlas_coords() = default; atlas_coords( const coords_2u& coords, const dims_2u& dims ); void normalise ( float factor ); coords_2f tl, tr, bl, br; }; struct atlas { atlas( std::vector<atlas_coords>&& coords, common::img::image&& texture ); atlas( atlas&& move ) = default; atlas( const atlas& copy ) = delete; virtual ~atlas() = default; atlas& operator=( atlas&& move ) = default; atlas& operator=( const atlas& copy ) = delete; std::vector<atlas_coords> coords; img::image texture; }; atlas build ( const std::vector<img::image>& bitmaps, unsigned int spacing = 7, float resize_rate = 1.05f ); void sort ( std::vector<img::image>& bitmaps ); } #endif // ifndef COMMON_ATLAS_H
20.5625
67
0.586626
[ "vector" ]
18ed6bae24fb83b8ccd5c4b3755d0addc0dc42f4
848
h
C
src/sgl/public/templates/singleton.h
sneppy/chord
fe5fc996344649432435bb74e6066563ffe1ef3b
[ "MIT" ]
1
2019-07-14T08:19:57.000Z
2019-07-14T08:19:57.000Z
src/sgl/public/templates/singleton.h
sneppy/chord
fe5fc996344649432435bb74e6066563ffe1ef3b
[ "MIT" ]
null
null
null
src/sgl/public/templates/singleton.h
sneppy/chord
fe5fc996344649432435bb74e6066563ffe1ef3b
[ "MIT" ]
2
2019-05-17T10:21:44.000Z
2021-05-18T05:15:46.000Z
#pragma once #include "core_types.h" /** * @class Singleton templates/singleton.h * * A singleton is an object that exists only * once in the lifetime of an application */ template<class T> class Singleton { public: static Singleton * instance; public: /// Default constructor FORCE_INLINE Singleton() { if (instance == nullptr) instance = this; else /* Fail */; } private: /// Copy constructor, removed Singleton(const Singleton&) = delete; /// Copy assignment, removed Singleton & operator=(const Singleton&) = delete; public: /// Returns pointer to global instance static FORCE_INLINE T * getPtr() { return reinterpret_cast<T*>(instance); } /// Returns ref to global instance static FORCE_INLINE T & get() { return *getPtr(); } }; template<typename T> Singleton<T> * Singleton<T>::instance = nullptr;
17.306122
50
0.691038
[ "object" ]
7a0b3aedd98cb3aa9597348e5f96e56bbe24da28
45,906
h
C
lonestar/eda/cpu/sproute/flute.h
bigwater/Galois
03738c883301844cfb15a71647744a59184f43c0
[ "BSD-3-Clause" ]
230
2018-06-20T22:18:31.000Z
2022-03-27T13:09:59.000Z
lonestar/eda/cpu/sproute/flute.h
bigwater/Galois
03738c883301844cfb15a71647744a59184f43c0
[ "BSD-3-Clause" ]
307
2018-06-23T12:45:31.000Z
2022-03-26T01:54:38.000Z
lonestar/eda/cpu/sproute/flute.h
bigwater/Galois
03738c883301844cfb15a71647744a59184f43c0
[ "BSD-3-Clause" ]
110
2018-06-19T04:39:16.000Z
2022-03-29T01:55:47.000Z
#ifndef _FLUTE_H_ #define _FLUTE_H_ #include <stdio.h> #include <stdlib.h> #include <limits.h> #include <math.h> //#include "flute_mst.h" /*****************************/ /* User-Defined Parameters */ /*****************************/ #define MAXD 1000 // max. degree that can be handled #define ACCURACY 10 // Default accuracy #define ROUTING 1 // 1 to construct routing, 0 to estimate WL only #define LOCAL_REFINEMENT 1 // Suggestion: Set to 1 if ACCURACY >= 5 #define REMOVE_DUPLICATE_PIN 1 // Remove dup. pin for flute_wl() & flute() #ifndef DTYPE // Data type for distance #define DTYPE int #endif /*****************************/ /* User-Callable Functions */ /*****************************/ // void readLUT(); // DTYPE flute_wl(int d, DTYPE x[], DTYPE y[], int acc); // DTYPE flutes_wl(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); // Tree flute(int d, DTYPE x[], DTYPE y[], int acc); // Tree flutes(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); // DTYPE wirelength(Tree t); // void printtree(Tree t); // void plottree(Tree t); /*************************************/ /* Internal Parameters and Functions */ /*************************************/ #define POWVFILE "/POWV9.dat" // LUT for POWV (Wirelength Vector) #define POSTFILE "/POST9.dat" // LUT for POST (Steiner Tree) #define D 9 // LUT is used for d <= D, D <= 9 #define TAU(A) (8 + 1.3 * (A)) #define D1(A) (25 + 120 / ((A) * (A))) // flute_mr is used for D1 < d <= D2 #define D2(A) ((A) <= 6 ? 500 : 75 + 5 * (A)) typedef struct { DTYPE x, y; // starting point of the branch int n; // index of neighbor } Branch; typedef struct { int deg; // degree DTYPE length; // total wirelength Branch* branch; // array of tree branches } Tree; #if REMOVE_DUPLICATE_PIN == 1 #define flutes_wl(d, xs, ys, s, acc) flutes_wl_RDP(d, xs, ys, s, acc) #define flutes(d, xs, ys, s, acc) flutes_RDP(d, xs, ys, s, acc) #else #define flutes_wl(d, xs, ys, s, acc) flutes_wl_ALLD(d, xs, ys, s, acc) #define flutes(d, xs, ys, s, acc) flutes_ALLD(d, xs, ys, s, acc) #endif #define flutes_wl_ALLD(d, xs, ys, s, acc) flutes_wl_LMD(d, xs, ys, s, acc) #define flutes_ALLD(d, xs, ys, s, acc) \ (d <= D ? flutes_LD(d, xs, ys, s) : flutes_MD(d, xs, ys, s, acc)) // : (d<=D1(acc) ? flutes_MD(d, xs, ys, s, acc) // : flutes_HD(d, xs, ys, s, acc))) #define flutes_wl_LMD(d, xs, ys, s, acc) \ (d <= D ? flutes_wl_LD(d, xs, ys, s) : flutes_wl_MD(d, xs, ys, s, acc)) #define flutes_LMD(d, xs, ys, s, acc) \ (d <= D ? flutes_LD(d, xs, ys, s) : flutes_MD(d, xs, ys, s, acc)) //#define max(x,y) ((x)>(y)?(x):(y)) //#define min(x,y) ((x)<(y)?(x):(y)) // to work around max conflict with bitmap //#define abs(x) ((x)<0?(-x):(x)) using namespace std; #define ADIFF(x, y) ((x) > (y) ? (x - y) : (y - x)) // Absolute difference #if D <= 7 #define MGROUP 5040 / 4 // Max. # of groups, 7! = 5040 #define MPOWV 15 // Max. # of POWVs per group #elif D == 8 #define MGROUP 40320 / 4 // Max. # of groups, 8! = 40320 #define MPOWV 33 // Max. # of POWVs per group #elif D == 9 #define MGROUP 362880 / 4 // Max. # of groups, 9! = 362880 #define MPOWV 79 // Max. # of POWVs per group #endif int numgrp[10] = {0, 0, 0, 0, 6, 30, 180, 1260, 10080, 90720}; struct csoln { unsigned char parent; unsigned char seg[11]; // Add: 0..i, Sub: j..10; seg[i+1]=seg[j-1]=0 unsigned char rowcol[D - 2]; // row = rowcol[]/16, col = rowcol[]%16, unsigned char neighbor[2 * D - 2]; }; struct csoln* LUT[D + 1][MGROUP]; // storing 4 .. D int numsoln[D + 1][MGROUP]; typedef struct node_pair_s { // pair of nodes representing an edge int node1, node2; } node_pair; node_pair* heap; struct point { DTYPE x, y; int o; }; void readLUT(); DTYPE flute_wl(int d, DTYPE x[], DTYPE y[], int acc); DTYPE flutes_wl_LD(int d, DTYPE xs[], DTYPE ys[], int s[]); DTYPE flutes_wl_MD(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); DTYPE flutes_wl_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); Tree flute(int d, DTYPE x[], DTYPE y[], int acc); Tree flutes_LD(int d, DTYPE xs[], DTYPE ys[], int s[]); Tree flutes_MD(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); Tree flutes_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); Tree dmergetree(Tree t1, Tree t2); Tree hmergetree(Tree t1, Tree t2, int s[]); Tree vmergetree(Tree t1, Tree t2); void local_refinement(Tree* tp, int p); DTYPE wirelength(Tree t); void printtree(Tree t); void plottree(Tree t); #define MAX_HEAP_SIZE (MAXD * 2) int max_heap_size = MAX_HEAP_SIZE; void init_param() { heap = (node_pair*)malloc(sizeof(node_pair) * (max_heap_size + 1)); } [[noreturn]] void abort_with_message(std::string message) noexcept { std::cerr << message << std::endl; std::abort(); } void readLUT(const char* fluteDir) { unsigned char charnum[256], line[32], *linep, c; FILE *fpwv, *fprt; struct csoln* p; int d, i, j, k, kk, ns, nn; init_param(); for (i = 0; i <= 255; i++) { if ('0' <= i && i <= '9') charnum[i] = i - '0'; else if (i >= 'A') charnum[i] = i - 'A' + 10; else // if (i=='$' || i=='\n' || ... ) charnum[i] = 0; } string powvfile, postfile; powvfile = fluteDir; powvfile += POWVFILE; postfile = fluteDir; postfile += POSTFILE; fpwv = fopen(powvfile.c_str(), "r"); if (fpwv == NULL) { printf("Error in opening POWV: %s\n", powvfile.c_str()); exit(1); } #if ROUTING == 1 fprt = fopen(postfile.c_str(), "r"); if (fprt == NULL) { printf("Error in opening POST: %s\n", postfile.c_str()); exit(1); } #endif for (d = 4; d <= D; d++) { if (fscanf(fpwv, "d=%d\n", &d) != 1) abort_with_message("Unable to get needed info from POWV."); #if ROUTING == 1 if (fscanf(fprt, "d=%d\n", &d) != 1) abort_with_message("Unable to get needed info from POST."); #endif for (k = 0; k < numgrp[d]; k++) { ns = (int)charnum[fgetc(fpwv)]; if (ns == 0) { // same as some previous group if (fscanf(fpwv, "%d\n", &kk) != 1) abort_with_message("Unable to get needed info from POWV."); numsoln[d][k] = numsoln[d][kk]; LUT[d][k] = LUT[d][kk]; } else { fgetc(fpwv); // '\n' numsoln[d][k] = ns; p = (struct csoln*)malloc(ns * sizeof(struct csoln)); LUT[d][k] = p; for (i = 1; i <= ns; i++) { linep = (unsigned char*)fgets((char*)line, 32, fpwv); p->parent = charnum[*(linep++)]; j = 0; while ((p->seg[j++] = charnum[*(linep++)]) != 0) ; j = 10; while ((p->seg[j--] = charnum[*(linep++)]) != 0) ; #if ROUTING == 1 nn = 2 * d - 2; if (!fread(line, 1, d - 2, fprt)) abort_with_message("Unable to get needed info from POST."); linep = line; for (j = d; j < nn; j++) { c = charnum[*(linep++)]; p->rowcol[j - d] = c; } if (!fread(line, 1, nn / 2 + 1, fprt)) abort_with_message("Unable to get needed info from POST."); linep = line; // last char \n for (j = 0; j < nn;) { c = *(linep++); p->neighbor[j++] = c / 16; p->neighbor[j++] = c % 16; } #endif p++; } } } } } void readLUT() { unsigned char charnum[256], line[32], *linep, c; FILE *fpwv, *fprt; struct csoln* p; int d, i, j, k, kk, ns, nn; init_param(); for (i = 0; i <= 255; i++) { if ('0' <= i && i <= '9') charnum[i] = i - '0'; else if (i >= 'A') charnum[i] = i - 'A' + 10; else // if (i=='$' || i=='\n' || ... ) charnum[i] = 0; } fpwv = fopen(POWVFILE, "r"); if (fpwv == NULL) { printf("Error in opening %s\n", POWVFILE); exit(1); } #if ROUTING == 1 fprt = fopen(POSTFILE, "r"); if (fprt == NULL) { printf("Error in opening %s\n", POSTFILE); exit(1); } #endif for (d = 4; d <= D; d++) { if (fscanf(fpwv, "d=%d\n", &d) != 1) abort_with_message("Unable to get needed info from POWV."); #if ROUTING == 1 if (fscanf(fprt, "d=%d\n", &d) != 1) abort_with_message("Unable to get needed info from POST."); #endif for (k = 0; k < numgrp[d]; k++) { ns = (int)charnum[fgetc(fpwv)]; if (ns == 0) { // same as some previous group if (fscanf(fpwv, "%d\n", &kk) != 1) abort_with_message("Unable to get needed info from POWV."); numsoln[d][k] = numsoln[d][kk]; LUT[d][k] = LUT[d][kk]; } else { fgetc(fpwv); // '\n' numsoln[d][k] = ns; p = (struct csoln*)malloc(ns * sizeof(struct csoln)); LUT[d][k] = p; for (i = 1; i <= ns; i++) { linep = (unsigned char*)fgets((char*)line, 32, fpwv); p->parent = charnum[*(linep++)]; j = 0; while ((p->seg[j++] = charnum[*(linep++)]) != 0) ; j = 10; while ((p->seg[j--] = charnum[*(linep++)]) != 0) ; #if ROUTING == 1 nn = 2 * d - 2; if (!fread(line, 1, d - 2, fprt)) abort_with_message("Unable to get needed info from POST."); linep = line; for (j = d; j < nn; j++) { c = charnum[*(linep++)]; p->rowcol[j - d] = c; } if (!fread(line, 1, nn / 2 + 1, fprt)) abort_with_message("Unable to get needed info from POST."); linep = line; // last char \n for (j = 0; j < nn;) { c = *(linep++); p->neighbor[j++] = c / 16; p->neighbor[j++] = c % 16; } #endif p++; } } } } } DTYPE flute_wl(int d, DTYPE x[], DTYPE y[], int acc) { DTYPE xs[MAXD], ys[MAXD], minval, l, xu, xl, yu, yl; int s[MAXD]; int i, j, k, minidx; struct point pt[MAXD], *ptp[MAXD], *tmpp; if (d == 2) l = ADIFF(x[0], x[1]) + ADIFF(y[0], y[1]); else if (d == 3) { if (x[0] > x[1]) { xu = max(x[0], x[2]); xl = min(x[1], x[2]); } else { xu = max(x[1], x[2]); xl = min(x[0], x[2]); } if (y[0] > y[1]) { yu = max(y[0], y[2]); yl = min(y[1], y[2]); } else { yu = max(y[1], y[2]); yl = min(y[0], y[2]); } l = (xu - xl) + (yu - yl); } else { for (i = 0; i < d; i++) { pt[i].x = x[i]; pt[i].y = y[i]; ptp[i] = &pt[i]; } // sort x for (i = 0; i < d - 1; i++) { minval = ptp[i]->x; minidx = i; for (j = i + 1; j < d; j++) { if (minval > ptp[j]->x) { minval = ptp[j]->x; minidx = j; } } tmpp = ptp[i]; ptp[i] = ptp[minidx]; ptp[minidx] = tmpp; } #if REMOVE_DUPLICATE_PIN == 1 ptp[d] = &pt[d]; ptp[d]->x = ptp[d]->y = -999999; j = 0; for (i = 0; i < d; i++) { for (k = i + 1; ptp[k]->x == ptp[i]->x; k++) if (ptp[k]->y == ptp[i]->y) // pins k and i are the same break; if (ptp[k]->x != ptp[i]->x) ptp[j++] = ptp[i]; } d = j; #endif for (i = 0; i < d; i++) { xs[i] = ptp[i]->x; ptp[i]->o = i; } // sort y to find s[] for (i = 0; i < d - 1; i++) { minval = ptp[i]->y; minidx = i; for (j = i + 1; j < d; j++) { if (minval > ptp[j]->y) { minval = ptp[j]->y; minidx = j; } } ys[i] = ptp[minidx]->y; s[i] = ptp[minidx]->o; ptp[minidx] = ptp[i]; } ys[d - 1] = ptp[d - 1]->y; s[d - 1] = ptp[d - 1]->o; l = flutes_wl(d, xs, ys, s, acc); } return l; } // xs[] and ys[] are coords in x and y in sorted order // s[] is a list of nodes in increasing y direction // if nodes are indexed in the order of increasing x coord // i.e., s[i] = s_i as defined in paper // The points are (xs[s[i]], ys[i]) for i=0..d-1 // or (xs[i], ys[si[i]]) for i=0..d-1 DTYPE flutes_wl_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc) { int i, j, ss; for (i = 0; i < d - 1; i++) { if (xs[s[i]] == xs[s[i + 1]] && ys[i] == ys[i + 1]) { if (s[i] < s[i + 1]) ss = s[i + 1]; else { ss = s[i]; s[i] = s[i + 1]; } for (j = i + 2; j < d; j++) { ys[j - 1] = ys[j]; s[j - 1] = s[j]; } for (j = ss + 1; j < d; j++) xs[j - 1] = xs[j]; for (j = 0; j <= d - 2; j++) if (s[j] > ss) s[j]--; i--; d--; } } return flutes_wl_ALLD(d, xs, ys, s, acc); } // For low-degree, i.e., 2 <= d <= D DTYPE flutes_wl_LD(int d, DTYPE xs[], DTYPE ys[], int s[]) { int k, pi, i, j; struct csoln* rlist; DTYPE dd[2 * D - 2]; // 0..D-2 for v, D-1..2*D-3 for h DTYPE minl, sum, l[MPOWV + 1]; if (d <= 3) minl = xs[d - 1] - xs[0] + ys[d - 1] - ys[0]; else { k = 0; if (s[0] < s[2]) k++; if (s[1] < s[2]) k++; for (i = 3; i <= d - 1; i++) { // p0=0 always, skip i=1 for symmetry pi = s[i]; for (j = d - 1; j > i; j--) if (s[j] < s[i]) pi--; k = pi + (i + 1) * k; } if (k < numgrp[d]) // no horizontal flip for (i = 1; i <= d - 3; i++) { dd[i] = ys[i + 1] - ys[i]; dd[d - 1 + i] = xs[i + 1] - xs[i]; } else { k = 2 * numgrp[d] - 1 - k; for (i = 1; i <= d - 3; i++) { dd[i] = ys[i + 1] - ys[i]; dd[d - 1 + i] = xs[d - 1 - i] - xs[d - 2 - i]; } } minl = l[0] = xs[d - 1] - xs[0] + ys[d - 1] - ys[0]; rlist = LUT[d][k]; for (i = 0; rlist->seg[i] > 0; i++) minl += dd[rlist->seg[i]]; l[1] = minl; j = 2; while (j <= numsoln[d][k]) { rlist++; sum = l[rlist->parent]; for (i = 0; rlist->seg[i] > 0; i++) sum += dd[rlist->seg[i]]; for (i = 10; rlist->seg[i] > 0; i--) sum -= dd[rlist->seg[i]]; minl = min(minl, sum); l[j++] = sum; } } return minl; } // For medium-degree, i.e., D+1 <= d DTYPE flutes_wl_MD(int d, DTYPE xs[], DTYPE ys[], int s[], int acc) { DTYPE x1[MAXD], x2[MAXD], y1[MAXD], y2[MAXD]; int si[MAXD], s1[MAXD], s2[MAXD]; float score[2 * MAXD], penalty[MAXD], pnlty, dx, dy; DTYPE ll, minl, extral = 0; int i, r, p, maxbp, nbp, bp, ub, lb, n1, n2, newacc; int ms, mins, maxs, minsi, maxsi; DTYPE distx[MAXD], disty[MAXD], xydiff; if (s[0] < s[d - 1]) { ms = max(s[0], s[1]); for (i = 2; i <= ms; i++) ms = max(ms, s[i]); if (ms <= d - 3) { for (i = 0; i <= ms; i++) { x1[i] = xs[i]; y1[i] = ys[i]; s1[i] = s[i]; } x1[ms + 1] = xs[ms]; y1[ms + 1] = ys[ms]; s1[ms + 1] = ms + 1; s2[0] = 0; for (i = 1; i <= d - 1 - ms; i++) s2[i] = s[i + ms] - ms; return flutes_wl_LMD(ms + 2, x1, y1, s1, acc) + flutes_wl_LMD(d - ms, xs + ms, ys + ms, s2, acc); } } else { // (s[0] > s[d-1]) ms = min(s[0], s[1]); for (i = 2; i <= d - 1 - ms; i++) ms = min(ms, s[i]); if (ms >= 2) { x1[0] = xs[ms]; y1[0] = ys[0]; s1[0] = s[0] - ms + 1; for (i = 1; i <= d - 1 - ms; i++) { x1[i] = xs[i + ms - 1]; y1[i] = ys[i]; s1[i] = s[i] - ms + 1; } x1[d - ms] = xs[d - 1]; y1[d - ms] = ys[d - 1 - ms]; s1[d - ms] = 0; s2[0] = ms; for (i = 1; i <= ms; i++) s2[i] = s[i + d - 1 - ms]; return flutes_wl_LMD(d + 1 - ms, x1, y1, s1, acc) + flutes_wl_LMD(ms + 1, xs, ys + d - 1 - ms, s2, acc); } } // Find inverse si[] of s[] for (r = 0; r < d; r++) si[s[r]] = r; // Determine breaking directions and positions dp[] lb = (d - 2 * acc + 2) / 4; if (lb < 2) lb = 2; ub = d - 1 - lb; // Compute scores #define AAWL 0.6 #define BBWL 0.3 float CCWL = 7.4 / ((d + 10.) * (d - 3.)); float DDWL = 4.8 / (d - 1); // Compute penalty[] dx = CCWL * (xs[d - 2] - xs[1]); dy = CCWL * (ys[d - 2] - ys[1]); for (r = d / 2, pnlty = 0; r >= 0; r--, pnlty += dx) penalty[r] = pnlty, penalty[d - 1 - r] = pnlty; for (r = d / 2 - 1, pnlty = dy; r >= 0; r--, pnlty += dy) penalty[s[r]] += pnlty, penalty[s[d - 1 - r]] += pnlty; //#define CCWL 0.16 // for (r=0; r<d; r++) // penalty[r] = abs(d-1-r-r)*dx + abs(d-1-si[r]-si[r])*dy; // Compute distx[], disty[] xydiff = (xs[d - 1] - xs[0]) - (ys[d - 1] - ys[0]); if (s[0] < s[1]) mins = s[0], maxs = s[1]; else mins = s[1], maxs = s[0]; if (si[0] < si[1]) minsi = si[0], maxsi = si[1]; else minsi = si[1], maxsi = si[0]; for (r = 2; r <= ub; r++) { if (s[r] < mins) mins = s[r]; else if (s[r] > maxs) maxs = s[r]; distx[r] = xs[maxs] - xs[mins]; if (si[r] < minsi) minsi = si[r]; else if (si[r] > maxsi) maxsi = si[r]; disty[r] = ys[maxsi] - ys[minsi] + xydiff; } if (s[d - 2] < s[d - 1]) mins = s[d - 2], maxs = s[d - 1]; else mins = s[d - 1], maxs = s[d - 2]; if (si[d - 2] < si[d - 1]) minsi = si[d - 2], maxsi = si[d - 1]; else minsi = si[d - 1], maxsi = si[d - 2]; for (r = d - 3; r >= lb; r--) { if (s[r] < mins) mins = s[r]; else if (s[r] > maxs) maxs = s[r]; distx[r] += xs[maxs] - xs[mins]; if (si[r] < minsi) minsi = si[r]; else if (si[r] > maxsi) maxsi = si[r]; disty[r] += ys[maxsi] - ys[minsi]; } nbp = 0; for (r = lb; r <= ub; r++) { if (si[r] == 0 || si[r] == d - 1) score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] - AAWL * (ys[d - 2] - ys[1]) - DDWL * disty[r]; else score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] - BBWL * (ys[si[r] + 1] - ys[si[r] - 1]) - DDWL * disty[r]; nbp++; if (s[r] == 0 || s[r] == d - 1) score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] - AAWL * (xs[d - 2] - xs[1]) - DDWL * distx[r]; else score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] - BBWL * (xs[s[r] + 1] - xs[s[r] - 1]) - DDWL * distx[r]; nbp++; } if (acc <= 3) newacc = 1; else { newacc = acc / 2; if (acc >= nbp) acc = nbp - 1; } minl = (DTYPE)INT_MAX; for (i = 0; i < acc; i++) { maxbp = 0; for (bp = 1; bp < nbp; bp++) if (score[maxbp] < score[bp]) maxbp = bp; score[maxbp] = -9e9; #define BreakPt(bp) ((bp) / 2 + lb) #define BreakInX(bp) ((bp) % 2 == 0) p = BreakPt(maxbp); // Breaking in p if (BreakInX(maxbp)) { // break in x n1 = n2 = 0; for (r = 0; r < d; r++) { if (s[r] < p) { s1[n1] = s[r]; y1[n1] = ys[r]; n1++; } else if (s[r] > p) { s2[n2] = s[r] - p; y2[n2] = ys[r]; n2++; } else { // if (s[r] == p) i.e., r = si[p] s1[n1] = p; s2[n2] = 0; if (r == d - 1 || r == d - 2) { y1[n1] = y2[n2] = ys[r - 1]; extral = ys[r] - ys[r - 1]; } if (r == 0 || r == 1) { y1[n1] = y2[n2] = ys[r + 1]; extral = ys[r + 1] - ys[r]; } else { y1[n1] = y2[n2] = ys[r]; extral = 0; } n1++; n2++; } } ll = extral + flutes_wl_LMD(p + 1, xs, y1, s1, newacc) + flutes_wl_LMD(d - p, xs + p, y2, s2, newacc); } else { // if (!BreakInX(maxbp)) n1 = n2 = 0; for (r = 0; r < d; r++) { if (si[r] < p) { s1[si[r]] = n1; x1[n1] = xs[r]; n1++; } else if (si[r] > p) { s2[si[r] - p] = n2; x2[n2] = xs[r]; n2++; } else { // if (si[r] == p) i.e., r = s[p] s1[p] = n1; s2[0] = n2; if (r == d - 1 || r == d - 2) { x1[n1] = x2[n2] = xs[r - 1]; extral = xs[r] - xs[r - 1]; } if (r == 0 || r == 1) { x1[n1] = x2[n2] = xs[r + 1]; extral = xs[r + 1] - xs[r]; } else { x1[n1] = x2[n2] = xs[r]; extral = 0; } n1++; n2++; } } ll = extral + flutes_wl_LMD(p + 1, x1, ys, s1, newacc) + flutes_wl_LMD(d - p, x2, ys + p, s2, newacc); } if (minl > ll) minl = ll; } return minl; } static int orderx(const void* a, const void* b) { struct point *pa, *pb; pa = *(struct point**)a; pb = *(struct point**)b; if (pa->x < pb->x) return -1; if (pa->x > pb->x) return 1; return 0; } static int ordery(const void* a, const void* b) { struct point *pa, *pb; pa = *(struct point**)a; pb = *(struct point**)b; if (pa->y < pb->y) return -1; if (pa->y > pb->y) return 1; return 0; } Tree flute(int d, DTYPE x[], DTYPE y[], int acc) { DTYPE *xs, *ys, minval; int* s; int i, j, k, minidx; struct point *pt, **ptp, *tmpp; Tree t; if (d == 2) { t.deg = 2; t.length = ADIFF(x[0], x[1]) + ADIFF(y[0], y[1]); t.branch = (Branch*)malloc(2 * sizeof(Branch)); t.branch[0].x = x[0]; t.branch[0].y = y[0]; t.branch[0].n = 1; t.branch[1].x = x[1]; t.branch[1].y = y[1]; t.branch[1].n = 1; } else { xs = (DTYPE*)malloc(sizeof(DTYPE) * (d)); ys = (DTYPE*)malloc(sizeof(DTYPE) * (d)); s = (int*)malloc(sizeof(int) * (d)); pt = (struct point*)malloc(sizeof(struct point) * (d + 1)); ptp = (struct point**)malloc(sizeof(struct point*) * (d + 1)); for (i = 0; i < d; i++) { pt[i].x = x[i]; pt[i].y = y[i]; ptp[i] = &pt[i]; } // sort x if (d < 200) { for (i = 0; i < d - 1; i++) { minval = ptp[i]->x; minidx = i; for (j = i + 1; j < d; j++) { if (minval > ptp[j]->x) { minval = ptp[j]->x; minidx = j; } } tmpp = ptp[i]; ptp[i] = ptp[minidx]; ptp[minidx] = tmpp; } } else { qsort(ptp, d, sizeof(struct point*), orderx); } #if REMOVE_DUPLICATE_PIN == 1 ptp[d] = &pt[d]; ptp[d]->x = ptp[d]->y = -999999; j = 0; for (i = 0; i < d; i++) { for (k = i + 1; ptp[k]->x == ptp[i]->x; k++) if (ptp[k]->y == ptp[i]->y) // pins k and i are the same break; if (ptp[k]->x != ptp[i]->x) ptp[j++] = ptp[i]; } d = j; #endif for (i = 0; i < d; i++) { xs[i] = ptp[i]->x; ptp[i]->o = i; } // sort y to find s[] if (d < 200) { for (i = 0; i < d - 1; i++) { minval = ptp[i]->y; minidx = i; for (j = i + 1; j < d; j++) { if (minval > ptp[j]->y) { minval = ptp[j]->y; minidx = j; } } ys[i] = ptp[minidx]->y; s[i] = ptp[minidx]->o; ptp[minidx] = ptp[i]; } ys[d - 1] = ptp[d - 1]->y; s[d - 1] = ptp[d - 1]->o; } else { qsort(ptp, d, sizeof(struct point*), ordery); for (i = 0; i < d; i++) { ys[i] = ptp[i]->y; s[i] = ptp[i]->o; } } t = flutes(d, xs, ys, s, acc); free(xs); free(ys); free(s); free(pt); free(ptp); } return t; } // xs[] and ys[] are coords in x and y in sorted order // s[] is a list of nodes in increasing y direction // if nodes are indexed in the order of increasing x coord // i.e., s[i] = s_i as defined in paper // The points are (xs[s[i]], ys[i]) for i=0..d-1 // or (xs[i], ys[si[i]]) for i=0..d-1 Tree flutes_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc) { int i, j, ss; for (i = 0; i < d - 1; i++) { if (xs[s[i]] == xs[s[i + 1]] && ys[i] == ys[i + 1]) { if (s[i] < s[i + 1]) ss = s[i + 1]; else { ss = s[i]; s[i] = s[i + 1]; } for (j = i + 2; j < d; j++) { ys[j - 1] = ys[j]; s[j - 1] = s[j]; } for (j = ss + 1; j < d; j++) xs[j - 1] = xs[j]; for (j = 0; j <= d - 2; j++) if (s[j] > ss) s[j]--; i--; d--; } } return flutes_ALLD(d, xs, ys, s, acc); } // For low-degree, i.e., 2 <= d <= D Tree flutes_LD(int d, DTYPE xs[], DTYPE ys[], int s[]) { int k, pi, i, j; struct csoln *rlist, *bestrlist; DTYPE dd[2 * D - 2]; // 0..D-2 for v, D-1..2*D-3 for h DTYPE minl, sum, l[MPOWV + 1]; int hflip; Tree t; t.deg = d; t.branch = (Branch*)malloc((2 * d - 2) * sizeof(Branch)); if (d == 2) { minl = xs[1] - xs[0] + ys[1] - ys[0]; t.branch[0].x = xs[s[0]]; t.branch[0].y = ys[0]; t.branch[0].n = 1; t.branch[1].x = xs[s[1]]; t.branch[1].y = ys[1]; t.branch[1].n = 1; } else if (d == 3) { minl = xs[2] - xs[0] + ys[2] - ys[0]; t.branch[0].x = xs[s[0]]; t.branch[0].y = ys[0]; t.branch[0].n = 3; t.branch[1].x = xs[s[1]]; t.branch[1].y = ys[1]; t.branch[1].n = 3; t.branch[2].x = xs[s[2]]; t.branch[2].y = ys[2]; t.branch[2].n = 3; t.branch[3].x = xs[1]; t.branch[3].y = ys[1]; t.branch[3].n = 3; } else { k = 0; if (s[0] < s[2]) k++; if (s[1] < s[2]) k++; for (i = 3; i <= d - 1; i++) { // p0=0 always, skip i=1 for symmetry pi = s[i]; for (j = d - 1; j > i; j--) if (s[j] < s[i]) pi--; k = pi + (i + 1) * k; } if (k < numgrp[d]) { // no horizontal flip hflip = 0; for (i = 1; i <= d - 3; i++) { dd[i] = ys[i + 1] - ys[i]; dd[d - 1 + i] = xs[i + 1] - xs[i]; } } else { hflip = 1; k = 2 * numgrp[d] - 1 - k; for (i = 1; i <= d - 3; i++) { dd[i] = ys[i + 1] - ys[i]; dd[d - 1 + i] = xs[d - 1 - i] - xs[d - 2 - i]; } } minl = l[0] = xs[d - 1] - xs[0] + ys[d - 1] - ys[0]; rlist = LUT[d][k]; for (i = 0; rlist->seg[i] > 0; i++) minl += dd[rlist->seg[i]]; bestrlist = rlist; l[1] = minl; j = 2; while (j <= numsoln[d][k]) { rlist++; sum = l[rlist->parent]; for (i = 0; rlist->seg[i] > 0; i++) sum += dd[rlist->seg[i]]; for (i = 10; rlist->seg[i] > 0; i--) sum -= dd[rlist->seg[i]]; if (sum < minl) { minl = sum; bestrlist = rlist; } l[j++] = sum; } t.branch[0].x = xs[s[0]]; t.branch[0].y = ys[0]; t.branch[1].x = xs[s[1]]; t.branch[1].y = ys[1]; for (i = 2; i < d - 2; i++) { t.branch[i].x = xs[s[i]]; t.branch[i].y = ys[i]; t.branch[i].n = bestrlist->neighbor[i]; } t.branch[d - 2].x = xs[s[d - 2]]; t.branch[d - 2].y = ys[d - 2]; t.branch[d - 1].x = xs[s[d - 1]]; t.branch[d - 1].y = ys[d - 1]; if (hflip) { if (s[1] < s[0]) { t.branch[0].n = bestrlist->neighbor[1]; t.branch[1].n = bestrlist->neighbor[0]; } else { t.branch[0].n = bestrlist->neighbor[0]; t.branch[1].n = bestrlist->neighbor[1]; } if (s[d - 1] < s[d - 2]) { t.branch[d - 2].n = bestrlist->neighbor[d - 1]; t.branch[d - 1].n = bestrlist->neighbor[d - 2]; } else { t.branch[d - 2].n = bestrlist->neighbor[d - 2]; t.branch[d - 1].n = bestrlist->neighbor[d - 1]; } for (i = d; i < 2 * d - 2; i++) { t.branch[i].x = xs[d - 1 - bestrlist->rowcol[i - d] % 16]; t.branch[i].y = ys[bestrlist->rowcol[i - d] / 16]; t.branch[i].n = bestrlist->neighbor[i]; } } else { // !hflip if (s[0] < s[1]) { t.branch[0].n = bestrlist->neighbor[1]; t.branch[1].n = bestrlist->neighbor[0]; } else { t.branch[0].n = bestrlist->neighbor[0]; t.branch[1].n = bestrlist->neighbor[1]; } if (s[d - 2] < s[d - 1]) { t.branch[d - 2].n = bestrlist->neighbor[d - 1]; t.branch[d - 1].n = bestrlist->neighbor[d - 2]; } else { t.branch[d - 2].n = bestrlist->neighbor[d - 2]; t.branch[d - 1].n = bestrlist->neighbor[d - 1]; } for (i = d; i < 2 * d - 2; i++) { t.branch[i].x = xs[bestrlist->rowcol[i - d] % 16]; t.branch[i].y = ys[bestrlist->rowcol[i - d] / 16]; t.branch[i].n = bestrlist->neighbor[i]; } } } t.length = minl; return t; } // For medium-degree, i.e., D+1 <= d Tree flutes_MD(int d, DTYPE xs[], DTYPE ys[], int s[], int acc) { DTYPE x1[MAXD], x2[MAXD], y1[MAXD], y2[MAXD]; int si[MAXD], s1[MAXD], s2[MAXD]; float score[2 * MAXD], penalty[MAXD], pnlty, dx, dy; DTYPE ll, minl, coord1, coord2; int i, r, p, maxbp, bestbp = 0, bp, nbp, ub, lb, n1, n2, nn1 = 0, nn2 = 0, newacc; Tree t, t1, t2, bestt1, bestt2; int ms, mins, maxs, minsi, maxsi; DTYPE distx[MAXD], disty[MAXD], xydiff; if (s[0] < s[d - 1]) { ms = max(s[0], s[1]); for (i = 2; i <= ms; i++) ms = max(ms, s[i]); if (ms <= d - 3) { for (i = 0; i <= ms; i++) { x1[i] = xs[i]; y1[i] = ys[i]; s1[i] = s[i]; } x1[ms + 1] = xs[ms]; y1[ms + 1] = ys[ms]; s1[ms + 1] = ms + 1; s2[0] = 0; for (i = 1; i <= d - 1 - ms; i++) s2[i] = s[i + ms] - ms; t1 = flutes_LMD(ms + 2, x1, y1, s1, acc); t2 = flutes_LMD(d - ms, xs + ms, ys + ms, s2, acc); t = dmergetree(t1, t2); free(t1.branch); free(t2.branch); return t; } } else { // (s[0] > s[d-1]) ms = min(s[0], s[1]); for (i = 2; i <= d - 1 - ms; i++) ms = min(ms, s[i]); if (ms >= 2) { x1[0] = xs[ms]; y1[0] = ys[0]; s1[0] = s[0] - ms + 1; for (i = 1; i <= d - 1 - ms; i++) { x1[i] = xs[i + ms - 1]; y1[i] = ys[i]; s1[i] = s[i] - ms + 1; } x1[d - ms] = xs[d - 1]; y1[d - ms] = ys[d - 1 - ms]; s1[d - ms] = 0; s2[0] = ms; for (i = 1; i <= ms; i++) s2[i] = s[i + d - 1 - ms]; t1 = flutes_LMD(d + 1 - ms, x1, y1, s1, acc); t2 = flutes_LMD(ms + 1, xs, ys + d - 1 - ms, s2, acc); t = dmergetree(t1, t2); free(t1.branch); free(t2.branch); return t; } } // Find inverse si[] of s[] for (r = 0; r < d; r++) si[s[r]] = r; // Determine breaking directions and positions dp[] lb = (d - 2 * acc + 2) / 4; if (lb < 2) lb = 2; ub = d - 1 - lb; // Compute scores #define AA 0.6 // 2.0*BB #define BB 0.3 float CC = 7.4 / ((d + 10.) * (d - 3.)); float DD = 4.8 / (d - 1); // Compute penalty[] dx = CC * (xs[d - 2] - xs[1]); dy = CC * (ys[d - 2] - ys[1]); for (r = d / 2, pnlty = 0; r >= 2; r--, pnlty += dx) penalty[r] = pnlty, penalty[d - 1 - r] = pnlty; penalty[1] = pnlty, penalty[d - 2] = pnlty; penalty[0] = pnlty, penalty[d - 1] = pnlty; for (r = d / 2 - 1, pnlty = dy; r >= 2; r--, pnlty += dy) penalty[s[r]] += pnlty, penalty[s[d - 1 - r]] += pnlty; penalty[s[1]] += pnlty, penalty[s[d - 2]] += pnlty; penalty[s[0]] += pnlty, penalty[s[d - 1]] += pnlty; //#define CC 0.16 //#define v(r) ((r==0||r==1||r==d-2||r==d-1) ? d-3 : abs(d-1-r-r)) // for (r=0; r<d; r++) // penalty[r] = v(r)*dx + v(si[r])*dy; // Compute distx[], disty[] xydiff = (xs[d - 1] - xs[0]) - (ys[d - 1] - ys[0]); if (s[0] < s[1]) mins = s[0], maxs = s[1]; else mins = s[1], maxs = s[0]; if (si[0] < si[1]) minsi = si[0], maxsi = si[1]; else minsi = si[1], maxsi = si[0]; for (r = 2; r <= ub; r++) { if (s[r] < mins) mins = s[r]; else if (s[r] > maxs) maxs = s[r]; distx[r] = xs[maxs] - xs[mins]; if (si[r] < minsi) minsi = si[r]; else if (si[r] > maxsi) maxsi = si[r]; disty[r] = ys[maxsi] - ys[minsi] + xydiff; } if (s[d - 2] < s[d - 1]) mins = s[d - 2], maxs = s[d - 1]; else mins = s[d - 1], maxs = s[d - 2]; if (si[d - 2] < si[d - 1]) minsi = si[d - 2], maxsi = si[d - 1]; else minsi = si[d - 1], maxsi = si[d - 2]; for (r = d - 3; r >= lb; r--) { if (s[r] < mins) mins = s[r]; else if (s[r] > maxs) maxs = s[r]; distx[r] += xs[maxs] - xs[mins]; if (si[r] < minsi) minsi = si[r]; else if (si[r] > maxsi) maxsi = si[r]; disty[r] += ys[maxsi] - ys[minsi]; } nbp = 0; for (r = lb; r <= ub; r++) { if (si[r] <= 1) score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] - AA * (ys[2] - ys[1]) - DD * disty[r]; else if (si[r] >= d - 2) score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] - AA * (ys[d - 2] - ys[d - 3]) - DD * disty[r]; else score[nbp] = (xs[r + 1] - xs[r - 1]) - penalty[r] - BB * (ys[si[r] + 1] - ys[si[r] - 1]) - DD * disty[r]; nbp++; if (s[r] <= 1) score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] - AA * (xs[2] - xs[1]) - DD * distx[r]; else if (s[r] >= d - 2) score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] - AA * (xs[d - 2] - xs[d - 3]) - DD * distx[r]; else score[nbp] = (ys[r + 1] - ys[r - 1]) - penalty[s[r]] - BB * (xs[s[r] + 1] - xs[s[r] - 1]) - DD * distx[r]; nbp++; } if (acc <= 3) newacc = 1; else { newacc = acc / 2; if (acc >= nbp) acc = nbp - 1; } minl = (DTYPE)INT_MAX; bestt1.branch = bestt2.branch = NULL; for (i = 0; i < acc; i++) { maxbp = 0; for (bp = 1; bp < nbp; bp++) if (score[maxbp] < score[bp]) maxbp = bp; score[maxbp] = -9e9; #define BreakPt(bp) ((bp) / 2 + lb) #define BreakInX(bp) ((bp) % 2 == 0) p = BreakPt(maxbp); // Breaking in p if (BreakInX(maxbp)) { // break in x n1 = n2 = 0; for (r = 0; r < d; r++) { if (s[r] < p) { s1[n1] = s[r]; y1[n1] = ys[r]; n1++; } else if (s[r] > p) { s2[n2] = s[r] - p; y2[n2] = ys[r]; n2++; } else { // if (s[r] == p) i.e., r = si[p] s1[n1] = p; s2[n2] = 0; y1[n1] = y2[n2] = ys[r]; nn1 = n1; nn2 = n2; n1++; n2++; } } t1 = flutes_LMD(p + 1, xs, y1, s1, newacc); t2 = flutes_LMD(d - p, xs + p, y2, s2, newacc); ll = t1.length + t2.length; coord1 = t1.branch[t1.branch[nn1].n].y; coord2 = t2.branch[t2.branch[nn2].n].y; if (t2.branch[nn2].y > max(coord1, coord2)) ll -= t2.branch[nn2].y - max(coord1, coord2); else if (t2.branch[nn2].y < min(coord1, coord2)) ll -= min(coord1, coord2) - t2.branch[nn2].y; } else { // if (!BreakInX(maxbp)) n1 = n2 = 0; for (r = 0; r < d; r++) { if (si[r] < p) { s1[si[r]] = n1; x1[n1] = xs[r]; n1++; } else if (si[r] > p) { s2[si[r] - p] = n2; x2[n2] = xs[r]; n2++; } else { // if (si[r] == p) i.e., r = s[p] s1[p] = n1; s2[0] = n2; x1[n1] = x2[n2] = xs[r]; n1++; n2++; } } t1 = flutes_LMD(p + 1, x1, ys, s1, newacc); t2 = flutes_LMD(d - p, x2, ys + p, s2, newacc); ll = t1.length + t2.length; coord1 = t1.branch[t1.branch[p].n].x; coord2 = t2.branch[t2.branch[0].n].x; if (t2.branch[0].x > max(coord1, coord2)) ll -= t2.branch[0].x - max(coord1, coord2); else if (t2.branch[0].x < min(coord1, coord2)) ll -= min(coord1, coord2) - t2.branch[0].x; } if (minl > ll) { minl = ll; free(bestt1.branch); free(bestt2.branch); bestt1 = t1; bestt2 = t2; bestbp = maxbp; } else { free(t1.branch); free(t2.branch); } } #if LOCAL_REFINEMENT == 1 if (BreakInX(bestbp)) { t = hmergetree(bestt1, bestt2, s); local_refinement(&t, si[BreakPt(bestbp)]); } else { t = vmergetree(bestt1, bestt2); local_refinement(&t, BreakPt(bestbp)); } #else if (BreakInX(bestbp)) { t = hmergetree(bestt1, bestt2, s); } else { t = vmergetree(bestt1, bestt2); } #endif free(bestt1.branch); free(bestt2.branch); return t; } Tree dmergetree(Tree t1, Tree t2) { int i, d, prev, curr, next, offset1, offset2; Tree t; t.deg = d = t1.deg + t2.deg - 2; t.length = t1.length + t2.length; t.branch = (Branch*)malloc((2 * d - 2) * sizeof(Branch)); offset1 = t2.deg - 2; offset2 = 2 * t1.deg - 4; for (i = 0; i <= t1.deg - 2; i++) { t.branch[i].x = t1.branch[i].x; t.branch[i].y = t1.branch[i].y; t.branch[i].n = t1.branch[i].n + offset1; } for (i = t1.deg - 1; i <= d - 1; i++) { t.branch[i].x = t2.branch[i - t1.deg + 2].x; t.branch[i].y = t2.branch[i - t1.deg + 2].y; t.branch[i].n = t2.branch[i - t1.deg + 2].n + offset2; } for (i = d; i <= d + t1.deg - 3; i++) { t.branch[i].x = t1.branch[i - offset1].x; t.branch[i].y = t1.branch[i - offset1].y; t.branch[i].n = t1.branch[i - offset1].n + offset1; } for (i = d + t1.deg - 2; i <= 2 * d - 3; i++) { t.branch[i].x = t2.branch[i - offset2].x; t.branch[i].y = t2.branch[i - offset2].y; t.branch[i].n = t2.branch[i - offset2].n + offset2; } prev = t2.branch[0].n + offset2; curr = t1.branch[t1.deg - 1].n + offset1; next = t.branch[curr].n; while (curr != next) { t.branch[curr].n = prev; prev = curr; curr = next; next = t.branch[curr].n; } t.branch[curr].n = prev; return t; } Tree hmergetree(Tree t1, Tree t2, int s[]) { int i, prev, curr, next, extra, offset1, offset2; int p, ii = 0, n1, n2, nn1 = 0, nn2 = 0; DTYPE coord1, coord2; Tree t; t.deg = t1.deg + t2.deg - 1; t.length = t1.length + t2.length; t.branch = (Branch*)malloc((2 * t.deg - 2) * sizeof(Branch)); offset1 = t2.deg - 1; offset2 = 2 * t1.deg - 3; p = t1.deg - 1; n1 = n2 = 0; for (i = 0; i < t.deg; i++) { if (s[i] < p) { t.branch[i].x = t1.branch[n1].x; t.branch[i].y = t1.branch[n1].y; t.branch[i].n = t1.branch[n1].n + offset1; n1++; } else if (s[i] > p) { t.branch[i].x = t2.branch[n2].x; t.branch[i].y = t2.branch[n2].y; t.branch[i].n = t2.branch[n2].n + offset2; n2++; } else { t.branch[i].x = t2.branch[n2].x; t.branch[i].y = t2.branch[n2].y; t.branch[i].n = t2.branch[n2].n + offset2; nn1 = n1; nn2 = n2; ii = i; n1++; n2++; } } for (i = t.deg; i <= t.deg + t1.deg - 3; i++) { t.branch[i].x = t1.branch[i - offset1].x; t.branch[i].y = t1.branch[i - offset1].y; t.branch[i].n = t1.branch[i - offset1].n + offset1; } for (i = t.deg + t1.deg - 2; i <= 2 * t.deg - 4; i++) { t.branch[i].x = t2.branch[i - offset2].x; t.branch[i].y = t2.branch[i - offset2].y; t.branch[i].n = t2.branch[i - offset2].n + offset2; } extra = 2 * t.deg - 3; coord1 = t1.branch[t1.branch[nn1].n].y; coord2 = t2.branch[t2.branch[nn2].n].y; if (t2.branch[nn2].y > max(coord1, coord2)) { t.branch[extra].y = max(coord1, coord2); t.length -= t2.branch[nn2].y - t.branch[extra].y; } else if (t2.branch[nn2].y < min(coord1, coord2)) { t.branch[extra].y = min(coord1, coord2); t.length -= t.branch[extra].y - t2.branch[nn2].y; } else t.branch[extra].y = t2.branch[nn2].y; t.branch[extra].x = t2.branch[nn2].x; t.branch[extra].n = t.branch[ii].n; t.branch[ii].n = extra; prev = extra; curr = t1.branch[nn1].n + offset1; next = t.branch[curr].n; while (curr != next) { t.branch[curr].n = prev; prev = curr; curr = next; next = t.branch[curr].n; } t.branch[curr].n = prev; return t; } Tree vmergetree(Tree t1, Tree t2) { int i, prev, curr, next, extra, offset1, offset2; DTYPE coord1, coord2; Tree t; t.deg = t1.deg + t2.deg - 1; t.length = t1.length + t2.length; t.branch = (Branch*)malloc((2 * t.deg - 2) * sizeof(Branch)); offset1 = t2.deg - 1; offset2 = 2 * t1.deg - 3; for (i = 0; i <= t1.deg - 2; i++) { t.branch[i].x = t1.branch[i].x; t.branch[i].y = t1.branch[i].y; t.branch[i].n = t1.branch[i].n + offset1; } for (i = t1.deg - 1; i <= t.deg - 1; i++) { t.branch[i].x = t2.branch[i - t1.deg + 1].x; t.branch[i].y = t2.branch[i - t1.deg + 1].y; t.branch[i].n = t2.branch[i - t1.deg + 1].n + offset2; } for (i = t.deg; i <= t.deg + t1.deg - 3; i++) { t.branch[i].x = t1.branch[i - offset1].x; t.branch[i].y = t1.branch[i - offset1].y; t.branch[i].n = t1.branch[i - offset1].n + offset1; } for (i = t.deg + t1.deg - 2; i <= 2 * t.deg - 4; i++) { t.branch[i].x = t2.branch[i - offset2].x; t.branch[i].y = t2.branch[i - offset2].y; t.branch[i].n = t2.branch[i - offset2].n + offset2; } extra = 2 * t.deg - 3; coord1 = t1.branch[t1.branch[t1.deg - 1].n].x; coord2 = t2.branch[t2.branch[0].n].x; if (t2.branch[0].x > max(coord1, coord2)) { t.branch[extra].x = max(coord1, coord2); t.length -= t2.branch[0].x - t.branch[extra].x; } else if (t2.branch[0].x < min(coord1, coord2)) { t.branch[extra].x = min(coord1, coord2); t.length -= t.branch[extra].x - t2.branch[0].x; } else t.branch[extra].x = t2.branch[0].x; t.branch[extra].y = t2.branch[0].y; t.branch[extra].n = t.branch[t1.deg - 1].n; t.branch[t1.deg - 1].n = extra; prev = extra; curr = t1.branch[t1.deg - 1].n + offset1; next = t.branch[curr].n; while (curr != next) { t.branch[curr].n = prev; prev = curr; curr = next; next = t.branch[curr].n; } t.branch[curr].n = prev; return t; } void local_refinement(Tree* tp, int p) { int d, dd, i, ii, j, prev, curr, next, root; int SteinerPin[2 * MAXD], index[2 * MAXD]; DTYPE x[MAXD], xs[D], ys[D]; int ss[D]; Tree tt; d = tp->deg; root = tp->branch[p].n; // Reverse edges to point to root prev = root; curr = tp->branch[prev].n; next = tp->branch[curr].n; while (curr != next) { tp->branch[curr].n = prev; prev = curr; curr = next; next = tp->branch[curr].n; } tp->branch[curr].n = prev; tp->branch[root].n = root; // Find Steiner nodes that are at pins for (i = d; i <= 2 * d - 3; i++) SteinerPin[i] = -1; for (i = 0; i < d; i++) { next = tp->branch[i].n; if (tp->branch[i].x == tp->branch[next].x && tp->branch[i].y == tp->branch[next].y) SteinerPin[next] = i; // Steiner 'next' at Pin 'i' } SteinerPin[root] = p; // Find pins that are directly connected to root dd = 0; for (i = 0; i < d; i++) { curr = tp->branch[i].n; if (SteinerPin[curr] == i) curr = tp->branch[curr].n; while (SteinerPin[curr] < 0) curr = tp->branch[curr].n; if (curr == root) { x[dd] = tp->branch[i].x; if (SteinerPin[tp->branch[i].n] == i && tp->branch[i].n != root) index[dd++] = tp->branch[i].n; // Steiner node else index[dd++] = i; // Pin } } if (4 <= dd && dd <= D) { // Find Steiner nodes that are directly connected to root ii = dd; for (i = 0; i < dd; i++) { curr = tp->branch[index[i]].n; while (SteinerPin[curr] < 0) { index[ii++] = curr; SteinerPin[curr] = INT_MAX; curr = tp->branch[curr].n; } } index[ii] = root; for (ii = 0; ii < dd; ii++) { ss[ii] = 0; for (j = 0; j < ii; j++) if (x[j] < x[ii]) ss[ii]++; for (j = ii + 1; j < dd; j++) if (x[j] <= x[ii]) ss[ii]++; xs[ss[ii]] = x[ii]; ys[ii] = tp->branch[index[ii]].y; } tt = flutes_LD(dd, xs, ys, ss); // Find new wirelength tp->length += tt.length; for (ii = 0; ii < 2 * dd - 3; ii++) { i = index[ii]; j = tp->branch[i].n; tp->length -= ADIFF(tp->branch[i].x, tp->branch[j].x) + ADIFF(tp->branch[i].y, tp->branch[j].y); } // Copy tt into t for (ii = 0; ii < dd; ii++) { tp->branch[index[ii]].n = index[tt.branch[ii].n]; } for (; ii <= 2 * dd - 3; ii++) { tp->branch[index[ii]].x = tt.branch[ii].x; tp->branch[index[ii]].y = tt.branch[ii].y; tp->branch[index[ii]].n = index[tt.branch[ii].n]; } free(tt.branch); } return; } DTYPE wirelength(Tree t) { int i, j; DTYPE l = 0; for (i = 0; i < 2 * t.deg - 2; i++) { j = t.branch[i].n; l += ADIFF(t.branch[i].x, t.branch[j].x) + ADIFF(t.branch[i].y, t.branch[j].y); } return l; } void printtree(Tree t) { int i; for (i = 0; i < t.deg; i++) printf(" %-2d: x=%4g y=%4g e=%d\n", i, (float)t.branch[i].x, (float)t.branch[i].y, t.branch[i].n); for (i = t.deg; i < 2 * t.deg - 2; i++) printf("s%-2d: x=%4g y=%4g e=%d\n", i, (float)t.branch[i].x, (float)t.branch[i].y, t.branch[i].n); printf("\n"); } // Output in a format that can be plotted by gnuplot void plottree(Tree t) { int i; for (i = 0; i < 2 * t.deg - 2; i++) { printf("%d %d\n", t.branch[i].x, t.branch[i].y); printf("%d %d\n\n", t.branch[t.branch[i].n].x, t.branch[t.branch[i].n].y); } } #endif /* _FLUTE_H_ */
27.889429
80
0.441206
[ "vector" ]
7a13ad376269b462faf45ef62ced9e10c45e391c
2,011
h
C
Builder/Builder/include/NewMaterial.h
sglab/OpenIRT
1a1522ed82f6bb26f1d40dc93024487869045ab2
[ "BSD-2-Clause" ]
2
2015-09-28T12:59:25.000Z
2020-03-28T22:28:03.000Z
Builder/Builder/include/NewMaterial.h
sglab/OpenIRT
1a1522ed82f6bb26f1d40dc93024487869045ab2
[ "BSD-2-Clause" ]
2
2018-10-26T12:17:53.000Z
2018-11-09T07:04:17.000Z
Builder/Builder/include/NewMaterial.h
sglab/OpenIRT
1a1522ed82f6bb26f1d40dc93024487869045ab2
[ "BSD-2-Clause" ]
null
null
null
#ifndef NEW_MATERIAL_H #define NEW_MATERIAL_H #include "Vector3.h" class NewMaterial { public: NewMaterial() { setDefault(); }; ~NewMaterial() {}; void clear() { mat_Ka = Vector3(0.0f, 0.0f, 0.0f); mat_Kd = Vector3(0.0f, 0.0f, 0.0f); mat_Ks = Vector3(0.0f, 0.0f, 0.0f); mat_Tf = Vector3(0.0f, 0.0f, 0.0f); mat_d = 0.f; mat_Ns = 0.f; mat_illum = 2; //default name[0] = 0; } void setDefault() { clear(); mat_Kd = Vector3(1.0f, 1.0f, 1.0f); // default NewMaterial mat_Tf = Vector3(1.0f, 1.0f, 1.0f); mat_d = 1.0f; } bool hasDiffuse() {return mat_Kd > Vector3(0,0,0);} bool hasSpecular() {return mat_Ks > Vector3(0,0,0);} void setMatKa(const Vector3 &newKa) {mat_Ka = newKa;} void setMatKd(const Vector3 &newKd) {mat_Kd = newKd;} void setMatKs(Vector3 &newKs) {mat_Ks = newKs;} void setMatTf(Vector3 &newTf) {mat_Tf = newTf;} void setMat_d(float &newMat_d) {mat_d = newMat_d;} void setMat_Ns(float &newMat_Ns) {mat_Ns = newMat_Ns;} void setMat_illum(int &illum) {mat_illum = illum;} void setName( const char *matName ) {strcpy_s(name, 59, matName);} const Vector3 &getMatKa() const {return mat_Ka;} const Vector3 &getMatKd() const {return mat_Kd;} const Vector3 &getMatKs() const {return mat_Ks;} const Vector3 &getMatTf() const {return mat_Tf;} float getMat_d() const {return mat_d;} float getMat_Ns() const {return mat_Ns;} int getMat_illum() const {return mat_illum;} const char *getName() const {return name;} bool isPerfectSpecular(float mat_Ns) const {return mat_Ns > 2047.0f;} bool isPerfectSpecular() const {return mat_Ns > 2047.0f;} protected: Vector3 mat_Ka; // ambient reflectance Vector3 mat_Kd; // diffuse reflectance Vector3 mat_Ks; // specular reflectance Vector3 mat_Tf; // transmission filter float mat_d; // dissolve, (1(default): opaque, 0: transparent) float mat_Ns; // specular exponent int mat_illum; // illumination model char name[60]; }; typedef std::vector<NewMaterial> NewMaterialList; #endif
26.460526
70
0.689209
[ "vector", "model" ]
7a1787dacbb960593ad209591439ef9cd3c6acbf
18,384
h
C
sevn-interface/SEVN/include/binstar/Processes.h
giulianoiorio/PeTar
f6a849552b3d8e47c5e08fe90fed05bf38bc407d
[ "MIT" ]
null
null
null
sevn-interface/SEVN/include/binstar/Processes.h
giulianoiorio/PeTar
f6a849552b3d8e47c5e08fe90fed05bf38bc407d
[ "MIT" ]
null
null
null
sevn-interface/SEVN/include/binstar/Processes.h
giulianoiorio/PeTar
f6a849552b3d8e47c5e08fe90fed05bf38bc407d
[ "MIT" ]
null
null
null
// // Created by spera on 13/02/19. // /** * When Adding a process, remember that the process should usually estimate: * BSE * - DA: Variation of Semimajor axis * - DE: Variation of Eccentricity * SSE * - DM: Variation of Mass * - DAngMomSpin: Variation of stellar angular momentum spin * * * Notice that the various processes should take into account that during the RLO, * the radius should be replaced by an effective radius equal to max(RL,Rc). * */ #ifndef SEVN_PROCESSES_H #define SEVN_PROCESSES_H #include <iostream> #include <vector> #include <string> #include <map> #include <random> #include <property.h> #include <BinaryProperty.h> #include <Orbit.h> #include <IO.h> #include <lookup_and_phases.h> #include <sevnlog.h> using sevnstd::SevnLogging; class Star; class Binstar; class Orbital_change; class Process { public: Process(){ size++; VB.resize(BinaryProperty::all.size()); VS.resize(2); VS[0].resize(Property::all.size()); VS[1].resize(Property::all.size()); set_V_to_0(); } virtual ~ Process(); static std::vector<Process*> all; typedef std::map<std::string,size_t> _PrintMap; static _PrintMap PrintMap; virtual Process * Instance(_UNUSED IO *_io){ return nullptr; } virtual inline std::string name(){return "Property (generic)";} virtual int evolve(_UNUSED Binstar *binstar){return EXIT_SUCCESS;} virtual int special_evolve(_UNUSED Binstar *binstar){return 0;} //0 Means system is not broken double get(const size_t &id){ return VB[id]; } double get_var(const size_t &starID, const size_t &propID){ return VS[starID][propID]; } std::string & get_msg() {return message;} inline void restore(){set_V_to_0();} //Special functions to modify the VB matrix /** * Correct the VB cell containing the Semimajor variation * @param factor correction factor the new DA will be DA*factor. * @return EXIT_SUCCESS */ int modify_SemimajorDV_by_a_factor(double factor){ VB[Semimajor::ID]*=factor; return EXIT_SUCCESS; } /** * Correct the VB cell containing the Eccentricity variation * @param factor correction factor the new DE will be DE*factor. * @return EXIT_SUCCESS */ int modify_EccentricityDV_by_a_factor(double factor){ VB[Eccentricity::ID]*=factor; return EXIT_SUCCESS; } /** * Check if this process is changing the mass * @return false if the DV regarding the Mass of both stars is currently set to 0, true otherwise */ bool is_mass_transfer_happening(){ if (VS[0][Mass::ID]==0 && VS[1][Mass::ID]==0) return false; else return true; } /** * Check if the current process is ongoing * @return true if the process is ongoing, false otherwise */ virtual bool is_process_ongoing() const {return orb_change->is_process_ongoing();}; ///Events handling inline void set_event(double code){event_code=code;} inline double get_event(){return event_code;} inline void reset_event(){event_code=-1;} private: static size_t size; std::vector<double> VB; /**< values of the properties of the binary system (e.g. processes change eccentricity, semimajor...) */ std::vector<std::vector<double>> VS; /**< variations of the single star parameters due to binary stellar evolution processes (e.g. mass, radius...) */ std::string message; double event_code=-1; // //std::string log_message_core protected: //Notice the pointer are set to nullptr because now the Collision process don't initialise them //so when the Process destructor is called it could be possible that it will try to delete a fake memory //address. With orb_change=nullptr this will not happen and we can avoid SEGFAULT ERRORS Star *donor= nullptr; Star *accretor= nullptr; SevnLogging svlog; Orbital_change *orb_change= nullptr; void Register(Process *_p, size_t *id, const std::string &_name){ Process::all.push_back(_p); *id = Process::size - 1; Process::PrintMap.insert(std::pair<std::string,size_t>(_name, *id)); svlog.debug("Binary process "+ name() + " registered" + " (Nproperties: " + utilities::n2s(all.size(),__FILE__,__LINE__) + ")"); } std::uniform_real_distribution<double> _uniform_real; void set(const size_t &id, const double &value){ VB[id] = value; } void set_var(const size_t &starID, const size_t &propID, const double &value){ VS[starID][propID] = value; } void set_msg(const std::string &str) {message = str;} inline void set_V_to_0(){ for(size_t i = 0; i < VB.size(); i++) VB[i] = 0.0; for(size_t i = 0; i < 2; i++){ for(size_t k = 0; k < VS[i].size(); k++){ VS[i][k] = 0.0; } } } }; class CommonEnvelope : public Process{ public: CommonEnvelope(_UNUSED IO *_io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } if (_io!= nullptr){ std::string orb_change_name=Lookup::cemap_name.at(Lookup::cemap.at(_io->CE_mode)); orb_change = Orbital_change_CE::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("CE mode " + _io->CE_mode + " not available", __FILE__, __LINE__); } } static size_t ID; static CommonEnvelope _commonenvelope; CommonEnvelope *Instance(IO *_io) override { return (new CommonEnvelope(_io, false)); } inline std::string name() override { return "CommonEnvelope"; } int special_evolve(Binstar *binstar) override; static std::string log_mess(Binstar *binstar, Star *primary, Star *secondary); /** * Swallowed after CE, assumint always that the swallowed star is the primary * @param binstar pointer to the binary * @return A string log message */ std::string log_message_swallowed(Binstar *binstar); protected: int init(Binstar *binstar); /** * Initialise the primary and secondary attribute with the stars in the binary system. * The primary is the star in the system that has a core and is overfilling the Roche Lobe. * If both stars satisfied these conditions, the primary is the star that is more overfilling the Roche Lobe (R1/RL1>R2/RL2). * @param binstar Pointer to the binary system * @return EXIT_SUCCESS or throw an error. * * @throws sevenstd::bse_error Thrown if neither of the two stars has a core and is overfilling the Roche Lobe (The system should not start a CE). * */ int whoisprimary(Binstar *binstar); /** * Estimate the final mass after CE coalescence using a simple precription: * Mf = (Mc1 + Mc2) + K_NCE * (M2_NCE) + k_CE * (M1_CE + M2_CE), * where: * - Mc1, Mc2: Masses of the cores (He + CO) * - K_NCE: fraction [0,1] of the (non core) mass of the secondary M2_NCE not participating to the CE (e.g. MS) reteained after the CE * - K_CE: fraction [0,1] of the (non core) mass of the primary M1_CE and secondary M2_CE participating to the CE reteained after the CE * @param primary Pointer to the primary star, NB this is the star starting the CE, it has to have a core. * @param secondary Pointer to the secondary star * @return Final total mass after CE */ double final_mass_after_coalescence(); /** * Let the two stars coalesce after the common envelope. * @param binstar Pointer to the binary system * @return A string with the log message from MIX::log_message */ std::string main_coalesce(Binstar *binstar); /** * Handling the coalesce after the common envelope using the SEVN2 formalism. * @param binstar Pointer to the binary system * @return A string with the log message from MIX::log_message * */ std::string coalesce(Binstar *binstar); /** * Handling the coalesce after coalesce after the common envelope using the SEVN1 binding energy approach * @param binstar Pointer to the binary system * @return A string with the log message from MIX::log_message */ std::string coalesce_with_bindingEnergy(Binstar *binstar); /** * Remove the envelope after the CE phase. * @param binstar Pointer to the binary system. * @return EXIT_SUCCESS */ int lose_the_envelope(Binstar *binstar); inline double hurley_rm_x(double Z){ double zeta = std::log(Z/0.02); double ret = 0.30406 + 0.0805*zeta + 0.0897*zeta*zeta + 0.0878*zeta*zeta*zeta + 0.0222*zeta*zeta*zeta*zeta; return ret; } double hurley_final_mass(const double Ebindf, const double toll=1e-3, const double maxit=100){ //Check if (!isinisialised) svlog.critical("CE process has not been initialised",__FILE__,__LINE__,sevnstd::ce_error()); double XX = 1 + hurley_rm_x(primary->get_Z()); double MC22=secondary->getp(MHE::ID); double MC1=M_core_primary; double M1=primary->getp(Mass::ID); double M2=secondary->getp(Mass::ID); double DELY, DERI; int Niter = 0; double Eratio = Ebindf/Ebind_ini; double CONST = (pow(M1+M2,XX))*(M1-MC1+M2-MC22)*Eratio; double MF=std::max(MC1+MC22, (M1+M2)*pow((Eratio),(1/XX))); DELY = 10*toll*MF; while(std::abs(DELY/MF)>toll && Niter<maxit){ DELY = pow(MF,XX)*(MF-MC1-MC22) - CONST; DERI = pow(MF,(XX-1))*((1+XX)*MF - XX*(MC1+MC22)); MF -= DELY/DERI; Niter++; } return MF; } private: //Common variables Star * primary; Star * secondary; //CE lambda, alpha formalism double lambda; //Concentraction factor to define the envelope binding energy double alpha; //Fraction of orbital energy used to expel the envelope //Orbital double a_fin, ecc_fin; //Mass and radii double M_env_primary, M_core_primary; double R_core_primary; double M_env_secondary, M_core_secondary; double R_core_secondary; double RL_primary_final, RL_secondary_final; //Roche Lobe of primary and secondary after CE //Energies double Ebind_ini; // Initial envelope binding energy double Eorb_ini, Eorb_fin; //Initial and final orbital energy of the cores //Initilisation check bool isinisialised=false; }; class MaccretionProcess : public Process{ public: /** * This function estimate the increment or decrement of NS Bmag due do the accretion of material * @param s Pointer to the star that is accreting * @param dM Mass accreted in Msun * @return THe difference in Bmag after accretion */ virtual double NS_DBmag_accretion (_UNUSED Binstar *b, _UNUSED Star *s, _UNUSED double DM) const; /** * This function estimate the increment or decrement of NS angular velocity OmegaRem due do the accretion of material * @param s Pointer to the star that is accreting * @param dM Mass accreted in Msun * @return THe difference in OmegaRem after accretion */ virtual double NS_DOmegaRem_accretion (_UNUSED Binstar *b, _UNUSED Star *s, _UNUSED double DM) const; protected: /** *It is a wrapper of all the necessray function calls to set the DV of NS properties after mass accretion * @param s Pointer to the ns star * @param dM Mass accreted in Msun */ virtual void handle_NS_massaccretion(_UNUSED Binstar *b, _UNUSED Star *s, _UNUSED double DM); }; class RocheLobe : public MaccretionProcess{ public: //The RocheLobe in a eccentric orbit //https://iopscience.iop.org/article/10.1086/513736/pdf RocheLobe(_UNUSED IO *_io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } if (_io!= nullptr){ std::string orb_change_name=Lookup::rlmap_name.at(Lookup::rlmap.at(_io->RL_mode)); orb_change = Orbital_change_RL::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("RL mode " + _io->RL_mode + " not available", __FILE__, __LINE__); //TODO io should be passed directly to Instance orb_change->set_options(_io); } } static size_t ID; static RocheLobe _rochelobe; RocheLobe *Instance(IO *_io) override { return (new RocheLobe(_io, false)); } inline std::string name() override { return "RocheLobe"; } int evolve(Binstar *binstar) override; /** * Roche Lobe speciale evolve: dynamic_swallowing. * The star is entirely swallowed through the RLO, but we don't have a mix, rather just a certain amount of mass * can be accreted on the other star. * @param binstar Pointer to the binary * @return EXIT_SUCCES */ int special_evolve(Binstar *binstar) override; std::string log_message_start(Binstar *binstar, double q, double qcrit); std::string log_message_end(Binstar *binstar); static std::string log_message_swallowed(Binstar *binstar, Star *swallowed, Star *other); std::string log_message_swallowed(Binstar *binstar); protected: bool RLO_last_step=false; std::string _log_message(Binstar *binstar); inline int reset_DM_global(){DM_global_0=DM_global_1=0.0; return EXIT_SUCCESS;} private: double DM_global_0=0.0, DM_global_1=0.0; }; class Windaccretion : public MaccretionProcess{ public: Windaccretion(IO * _io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } betaw = 0.125; alphaw = 1.5; muw = 1.0; if (_io!= nullptr){ std::string orb_change_name=Lookup::windsmap_name.at(Lookup::windsmap.at(_io->winds_mode)); orb_change = Orbital_change_Wind::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("Windaccretion mode " + _io->winds_mode + " not available", __FILE__, __LINE__); alphaw = _io->svpar.get_num("w_alpha"); betaw = _io->svpar.get_num("w_beta"); } } static size_t ID; static Windaccretion _windaccretion; Windaccretion *Instance(IO * _io) override { return (new Windaccretion(_io,false)); } inline std::string name() override { return "Windaccretion"; } int evolve(Binstar *binstar) override; protected: int accrete_mass(Binstar *binstar); private: double betaw; /*!< Wind escape velocity parameter (Eq. 9, Hurley+02) */ double alphaw; /*!< Bondi-Hoyle accretion parameter (Eq. 6, Hurley+02) */ double muw; /*!< Angular momentum transfer efficiency (Eq. 11, Hurley+02) */ }; class SNKicks : public Process{ public: SNKicks(_UNUSED IO *_io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } if (_io!= nullptr){ std::string orb_change_name=Lookup::snkmap_name.at(Lookup::snkmap.at(_io->SNK_mode)); orb_change = Orbital_change_SNKicks::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("RL mode " + _io->RL_mode + " not available", __FILE__, __LINE__); } } static size_t ID; static SNKicks _snkicks; SNKicks *Instance(IO *_io) override { return (new SNKicks(_io, false)); } inline std::string name() override { return "SNKick"; } /** * This special evolve it is called before the other processes. If it returns 1 it means that the bianry has been broken an the * other processes are not considered. * @param binstar Pointer to the binary * @return 1 if the binary has been broken by the kick, 0 if not. */ int special_evolve(Binstar *binstar) override; static std::string log_message(Binstar *binstar,double a_fin,double e_fin, double cos_nu, double vcom); }; class GWrad : public Process{ public: GWrad(_UNUSED IO *_io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } if (_io!= nullptr){ std::string orb_change_name=Lookup::gwmap_name.at(Lookup::gwmap.at(_io->GW_mode)); orb_change = Orbital_change_GW::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("GW mode " + _io->GW_mode + " not available", __FILE__, __LINE__); } } static size_t ID; static GWrad _gwrad; GWrad *Instance(IO *_io) override { return (new GWrad(_io, false)); } inline std::string name() override { return "GWrad"; } int evolve(Binstar *binstar) override; private: bool first_time_GW = true; //This true until the GW orbital energy loss starts to be estimated (see inside evolve) }; class Tides : public Process{ public: Tides(IO * _io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } if (_io!= nullptr){ std::string orb_change_name=Lookup::tidesmap_name.at(Lookup::tidesmap.at(_io->tides_mode)); orb_change = Orbital_change_Tides::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("Tides mode " + _io->tides_mode + " not available", __FILE__, __LINE__); } } static size_t ID; static Tides _tides; Tides *Instance(IO * _io) override { return (new Tides(_io,false)); } inline std::string name() override { return "Tides"; } int evolve(Binstar *binstar) override; }; class Mix : public Process{ public: Mix(_UNUSED IO *_io= nullptr, bool reg = true) { if (reg) { Register(this, &ID, name()); } if (_io!= nullptr){ std::string orb_change_name=Lookup::mixmap_name.at(Lookup::mixmap.at(_io->mix_mode)); orb_change = Orbital_change_Mix::Instance(orb_change_name); if(orb_change== nullptr) svlog.critical("Mix mode " + _io->mix_mode + " not available", __FILE__, __LINE__); } } static size_t ID; static Mix _mix; Mix *Instance(IO *_io) override { return (new Mix(_io, false)); } inline std::string name() override { return "Mix"; } int special_evolve(Binstar *binstar) override; static std::string log_message(Binstar *binstar, Star *accretor, Star *donor); }; #endif //SEVN_PROCESSES_H
29.747573
154
0.649859
[ "vector" ]
7a207a870af64f1f81c8cab4dc81000acbaa149a
4,108
c
C
NGSpice/ngspice-30/src/ciderlib/input/mobset.c
Surya-98/Snapcuit
9789a779485d8af2426a2d4e6403a06f44acadcb
[ "MIT" ]
null
null
null
NGSpice/ngspice-30/src/ciderlib/input/mobset.c
Surya-98/Snapcuit
9789a779485d8af2426a2d4e6403a06f44acadcb
[ "MIT" ]
null
null
null
NGSpice/ngspice-30/src/ciderlib/input/mobset.c
Surya-98/Snapcuit
9789a779485d8af2426a2d4e6403a06f44acadcb
[ "MIT" ]
null
null
null
/********** Copyright 1991 Regents of the University of California. All rights reserved. Author: 1991 David A. Gates, U. C. Berkeley CAD Group Modified: 2001 Paolo Nenzi **********/ #include "ngspice/ngspice.h" #include "ngspice/cktdefs.h" #include "ngspice/numconst.h" #include "ngspice/numenum.h" #include "ngspice/mobdefs.h" #include "ngspice/material.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" #include "ngspice/cidersupt.h" extern int MOBcheck( MOBcard *, MaterialInfo * ); extern int MOBsetup( MOBcard *, MaterialInfo * ); /* * Name: MOBcheck * Purpose: checks a list of MOBcards for input errors * Formals: cardList: the list to check * Returns: OK/E_PRIVATE * Users: numerical device setup routines * Calls: error message handler */ int MOBcheck(MOBcard *cardList, MaterialInfo *matlList) { MOBcard *card; MATLmaterial *matl; int cardNum = 0; int error = OK; for ( card = cardList; card != NULL; card = card->MOBnextCard ) { cardNum++; if (!card->MOBmaterialGiven) { SPfrontEnd->IFerrorf( ERR_WARNING, "mobility card %d is missing a material index", cardNum ); error = E_PRIVATE; } else { /* Make sure the material exists */ for ( matl = matlList; matl != NULL; matl = matl->next ) { if ( card->MOBmaterial == matl->id ) { break; } } if (matl == NULL) { SPfrontEnd->IFerrorf( ERR_WARNING, "mobility card %d specifies a non-existent material", cardNum ); error = E_PRIVATE; } } if (!card->MOBcarrierGiven) { card->MOBcarrier = ELEC; } if (!card->MOBcarrTypeGiven) { card->MOBcarrType = MAJOR; } if (!card->MOBinitGiven) { card->MOBinit = FALSE; } /* Return now if anything has failed */ if (error) return(error); } return(OK); } /* * Name: MOBsetup * Purpose: setup the mobility model parameters * Formals: cardList: list of cards to setup * Returns: OK/E_PRIVATE * Users: numerical devices * Calls: MOBcheck */ int MOBsetup(MOBcard *cardList, MaterialInfo *materialList) { MOBcard *card; MATLmaterial *matl; int error; /* Check the card list */ if ((error = MOBcheck( cardList, materialList )) != 0) return( error ); for ( card = cardList; card != NULL; card = card->MOBnextCard ) { /* Find the right material */ for ( matl = materialList; matl != NULL; matl = matl->next ) { if ( card->MOBmaterial == matl->id ) { break; } } /* Default models depend on previous value */ if (!card->MOBconcModelGiven) { card->MOBconcModel = matl->concModel; } if (!card->MOBfieldModelGiven) { card->MOBfieldModel = matl->fieldModel; } /* Load in default values if desired */ if ( card->MOBinitGiven ) { MOBdefaults( matl, card->MOBcarrier, card->MOBcarrType, card->MOBconcModel, card->MOBfieldModel ); } /* Override defaults */ if ( card->MOBconcModelGiven ) { matl->concModel = card->MOBconcModel; } if ( card->MOBfieldModelGiven ) { matl->fieldModel = card->MOBfieldModel; } if ( card->MOBmuMaxGiven ) { matl->muMax[card->MOBcarrier][card->MOBcarrType] = card->MOBmuMax; } if ( card->MOBmuMinGiven ) { matl->muMin[card->MOBcarrier][card->MOBcarrType] = card->MOBmuMin; } if ( card->MOBntRefGiven ) { matl->ntRef[card->MOBcarrier][card->MOBcarrType] = card->MOBntRef; } if ( card->MOBntExpGiven ) { matl->ntExp[card->MOBcarrier][card->MOBcarrType] = card->MOBntExp; } if ( card->MOBvSatGiven ) { matl->vSat[card->MOBcarrier] = card->MOBvSat; } if ( card->MOBvWarmGiven ) { matl->vWarm[card->MOBcarrier] = card->MOBvWarm; } if ( card->MOBmusGiven ) { matl->mus[card->MOBcarrier] = card->MOBmus; } if ( card->MOBecAGiven ) { matl->thetaA[card->MOBcarrier] = 1.0 / MAX( card->MOBecA, 1e-20 ); } if ( card->MOBecBGiven ) { matl->thetaB[card->MOBcarrier] = 1.0 / MAX( ABS(card->MOBecB), 1e-20 ); matl->thetaB[card->MOBcarrier] *= matl->thetaB[card->MOBcarrier]; matl->thetaB[card->MOBcarrier] *= SGN( card->MOBecB ); } } return( OK ); }
27.026316
100
0.636319
[ "cad", "model" ]
7a35dc989af61679d4313f928d5f7dae0c18be1f
6,770
h
C
aws-cpp-sdk-timestream-query/include/aws/timestream-query/model/S3Configuration.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-timestream-query/include/aws/timestream-query/model/S3Configuration.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-timestream-query/include/aws/timestream-query/model/S3Configuration.h
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/timestream-query/TimestreamQuery_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/timestream-query/model/S3EncryptionOption.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace TimestreamQuery { namespace Model { /** * <p>Details on S3 location for error reports that result from running a query. * </p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/timestream-query-2018-11-01/S3Configuration">AWS * API Reference</a></p> */ class AWS_TIMESTREAMQUERY_API S3Configuration { public: S3Configuration(); S3Configuration(Aws::Utils::Json::JsonView jsonValue); S3Configuration& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline const Aws::String& GetBucketName() const{ return m_bucketName; } /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline bool BucketNameHasBeenSet() const { return m_bucketNameHasBeenSet; } /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline void SetBucketName(const Aws::String& value) { m_bucketNameHasBeenSet = true; m_bucketName = value; } /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline void SetBucketName(Aws::String&& value) { m_bucketNameHasBeenSet = true; m_bucketName = std::move(value); } /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline void SetBucketName(const char* value) { m_bucketNameHasBeenSet = true; m_bucketName.assign(value); } /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline S3Configuration& WithBucketName(const Aws::String& value) { SetBucketName(value); return *this;} /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline S3Configuration& WithBucketName(Aws::String&& value) { SetBucketName(std::move(value)); return *this;} /** * <p> Name of the S3 bucket under which error reports will be created.</p> */ inline S3Configuration& WithBucketName(const char* value) { SetBucketName(value); return *this;} /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline const Aws::String& GetObjectKeyPrefix() const{ return m_objectKeyPrefix; } /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline bool ObjectKeyPrefixHasBeenSet() const { return m_objectKeyPrefixHasBeenSet; } /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline void SetObjectKeyPrefix(const Aws::String& value) { m_objectKeyPrefixHasBeenSet = true; m_objectKeyPrefix = value; } /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline void SetObjectKeyPrefix(Aws::String&& value) { m_objectKeyPrefixHasBeenSet = true; m_objectKeyPrefix = std::move(value); } /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline void SetObjectKeyPrefix(const char* value) { m_objectKeyPrefixHasBeenSet = true; m_objectKeyPrefix.assign(value); } /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline S3Configuration& WithObjectKeyPrefix(const Aws::String& value) { SetObjectKeyPrefix(value); return *this;} /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline S3Configuration& WithObjectKeyPrefix(Aws::String&& value) { SetObjectKeyPrefix(std::move(value)); return *this;} /** * <p> Prefix for the error report key. Timestream by default adds the following * prefix to the error report path. </p> */ inline S3Configuration& WithObjectKeyPrefix(const char* value) { SetObjectKeyPrefix(value); return *this;} /** * <p> Encryption at rest options for the error reports. If no encryption option is * specified, Timestream will choose SSE_S3 as default. </p> */ inline const S3EncryptionOption& GetEncryptionOption() const{ return m_encryptionOption; } /** * <p> Encryption at rest options for the error reports. If no encryption option is * specified, Timestream will choose SSE_S3 as default. </p> */ inline bool EncryptionOptionHasBeenSet() const { return m_encryptionOptionHasBeenSet; } /** * <p> Encryption at rest options for the error reports. If no encryption option is * specified, Timestream will choose SSE_S3 as default. </p> */ inline void SetEncryptionOption(const S3EncryptionOption& value) { m_encryptionOptionHasBeenSet = true; m_encryptionOption = value; } /** * <p> Encryption at rest options for the error reports. If no encryption option is * specified, Timestream will choose SSE_S3 as default. </p> */ inline void SetEncryptionOption(S3EncryptionOption&& value) { m_encryptionOptionHasBeenSet = true; m_encryptionOption = std::move(value); } /** * <p> Encryption at rest options for the error reports. If no encryption option is * specified, Timestream will choose SSE_S3 as default. </p> */ inline S3Configuration& WithEncryptionOption(const S3EncryptionOption& value) { SetEncryptionOption(value); return *this;} /** * <p> Encryption at rest options for the error reports. If no encryption option is * specified, Timestream will choose SSE_S3 as default. </p> */ inline S3Configuration& WithEncryptionOption(S3EncryptionOption&& value) { SetEncryptionOption(std::move(value)); return *this;} private: Aws::String m_bucketName; bool m_bucketNameHasBeenSet; Aws::String m_objectKeyPrefix; bool m_objectKeyPrefixHasBeenSet; S3EncryptionOption m_encryptionOption; bool m_encryptionOptionHasBeenSet; }; } // namespace Model } // namespace TimestreamQuery } // namespace Aws
36.994536
143
0.691137
[ "model" ]
7a49cf0ea7ed588f8d2ee8c5df9a212d0423084b
866
h
C
M4AnimationCore/Src/OC/Core/M4Animation.h
hellochenms/M4AnimationCore
3387b8c08071aef62b30d31dc97547c18e34501e
[ "MIT" ]
null
null
null
M4AnimationCore/Src/OC/Core/M4Animation.h
hellochenms/M4AnimationCore
3387b8c08071aef62b30d31dc97547c18e34501e
[ "MIT" ]
null
null
null
M4AnimationCore/Src/OC/Core/M4Animation.h
hellochenms/M4AnimationCore
3387b8c08071aef62b30d31dc97547c18e34501e
[ "MIT" ]
null
null
null
// // M4Animation.h // M4AnimationCore // // Created by Chen,Meisong on 2018/7/5. // Copyright © 2018年 xyz.chenms. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> typedef NS_ENUM(NSUInteger, M4ValueType) { M4ValueTypeCGFloat, }; @interface M4Animation : NSObject @property (nonatomic, copy) NSString *keyPath; @property (nonatomic) M4ValueType valueType; @property CFTimeInterval duration; @property (nonatomic) id fromValue; @property (nonatomic) id toValue; @property (nonatomic, weak) NSObject *object; @property (nonatomic) CFTimeInterval beginTime; @property (nonatomic) BOOL hasDone; + (M4Animation *)animationWithKeyPath:(NSString *)keyPath; - (id)currentValueWithProgress:(CGFloat)progress; @end @interface CALayer(M4Animation) - (void)m4a_addAnimation:(M4Animation *)anim; - (void)m4a_removeAllAnimations; @end
26.242424
58
0.764434
[ "object" ]
7a573e98846ac38b80ba2bd18ba65024522ea7ea
8,138
h
C
NEST-14.0-FPGA/libnestutil/lockptr.h
OpenHEC/SNN-simulator-on-PYNQcluster
14f86a76edf4e8763b58f84960876e95d4efc43a
[ "MIT" ]
45
2019-12-09T06:45:53.000Z
2022-01-29T12:16:41.000Z
NEST-14.0-FPGA/libnestutil/lockptr.h
zlchai/SNN-simulator-on-PYNQcluster
14f86a76edf4e8763b58f84960876e95d4efc43a
[ "MIT" ]
2
2020-05-23T05:34:21.000Z
2021-09-08T02:33:46.000Z
NEST-14.0-FPGA/libnestutil/lockptr.h
OpenHEC/SNN-simulator-on-PYNQcluster
14f86a76edf4e8763b58f84960876e95d4efc43a
[ "MIT" ]
10
2019-12-09T06:45:59.000Z
2021-03-25T09:32:56.000Z
/* * lockptr.h * * This file is part of NEST. * * Copyright (C) 2004 The NEST Initiative * * NEST is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * NEST is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NEST. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef LOCK_PTR_H #define LOCK_PTR_H #ifdef NDEBUG #define LOCK_PTR_NDEBUG #endif // C++ includes: #include <cassert> #include <cstddef> /** \class lockPTR This template is the standard safe-pointer implementation of SYNOD. In order for this scheme to work smoothly, the user has to take some precautions: 1. each pointer should only be used ONCE to initialize a lockPTR. 2. The lockPTR assumes that there are no other access points to the protected pointer. 3. The lockPTR can freely be copied and passed between objects and functions. 4. lockPTR objects should be used like the pointer to the object. 5. lockPTR objects should be passed as objects in function calls and function return values. 6. There should be no pointers to lockPTR objects. Class lockPTR is designed to behave just like the pointer would. You can use the dereference operators (* and ->) to access the protected object. However, the pointer itself is (with exceptions) never exposed to the user. Since all access to the referenced object is done via a lockPTR, it is possible to maintain a count of all active references. If this count dropts to zero, the referenced object can savely be destroyed. For dynamically allocated objects, delete is envoked on the stored pointer. class lockPTR distinguishes between dynamically and automatically allocated objects by the way it is initialised: If a lockPTR is initialised with a pointer, it assumes that the referenced object was dynamically allocated and will call the destructor once the reference count drops to zero. If the lockPTR is initialised with a reference, it assumes that the object is automatically allocated. Thus, the lockPTR wil NOT call the destructor. In some cases it is necessary for a routine to actually get hold of the pointer, contained in the lockPTR object. This can be done by using the member function get(). After the pointer has been exposed this way, the lockPTR will regard the referenced object as unsafe, since the user might call delete on the pointer. Thus, lockPTR will "lock" the referenced object and deny all further access. The object can be unlocked by calling the unlock() member. Equality for lockPTRs is defined as identity of the data object. */ template < class D > class lockPTR { class PointerObject { private: D* pointee; // pointer to handled Datum object size_t number_of_references; bool deletable; bool locked; // forbid this constructor! PointerObject( PointerObject const& ); public: PointerObject( D* p = NULL ) : pointee( p ) , number_of_references( 1 ) , deletable( true ) , locked( false ) { } PointerObject( D& p_o ) : pointee( &p_o ) , number_of_references( 1 ) , deletable( false ) , locked( false ) { } ~PointerObject() { assert( number_of_references == 0 ); // This will invalidate the still // existing pointer! assert( not locked ); if ( ( pointee != NULL ) && deletable && ( not locked ) ) { delete pointee; } } D* get( void ) const { return pointee; } void addReference( void ) { ++number_of_references; } void removeReference( void ) { // assert(number_of_references > 0); --number_of_references; if ( number_of_references == 0 ) { delete this; } } size_t references( void ) const { return number_of_references; } bool islocked( void ) const { return locked; } bool isdeletable( void ) const { return deletable; } void lock( void ) { assert( locked == false ); locked = true; } void unlock( void ) { assert( locked == true ); locked = false; } }; PointerObject* obj; public: // lockPTR() ; // generated automatically. // The default, argumentless constructor is used in // class declarations and generates an empty lockPTR // object which must then be initialised, for example // by assignement. explicit lockPTR( D* p = NULL ) { obj = new PointerObject( p ); assert( obj != NULL ); } explicit lockPTR( D& p_o ) { obj = new PointerObject( p_o ); assert( obj != NULL ); } lockPTR( const lockPTR< D >& spd ) : obj( spd.obj ) { assert( obj != NULL ); obj->addReference(); } virtual ~lockPTR() { assert( obj != NULL ); obj->removeReference(); } lockPTR< D > operator=( const lockPTR< D >& spd ) { // assert(obj != NULL); // assert(spd.obj != NULL); // The following order of the expressions protects // against a=a; spd.obj->addReference(); obj->removeReference(); obj = spd.obj; return *this; } lockPTR< D > operator=( D& s ) { *this = lockPTR< D >( s ); assert( not( obj->isdeletable() ) ); return *this; } lockPTR< D > operator=( D const& s ) { *this = lockPTR< D >( s ); assert( not( obj->isdeletable() ) ); return *this; } D* get( void ) { assert( not obj->islocked() ); obj->lock(); // Try to lock Object return obj->get(); } D* get( void ) const { assert( not obj->islocked() ); obj->lock(); // Try to lock Object return obj->get(); } D* operator->() const { assert( obj->get() != NULL ); return obj->get(); } D* operator->() { assert( obj->get() != NULL ); return obj->get(); } D& operator*() { assert( obj->get() != NULL ); return *( obj->get() ); } const D& operator*() const { assert( obj->get() != NULL ); return *( obj->get() ); } bool operator not() const //!< returns true if and only if obj->pointee == NULL { // assert(obj != NULL); return ( obj->get() == NULL ); } /* operator==, != Identity operator. These are inherited by derived types, so they should only be called by the equals method of the derived class which checks for type identity or when both classes are known to be bare lockPTR<D>. These follow identity semantics rather than equality semantics. The underlying object should only ever be owned by a single PointerObject that are shared by lockPTR<D>s, so this is equivalent to comparing the address of the D objects. */ bool operator==( const lockPTR< D >& p ) const { return ( obj == p.obj ); } bool operator!=( const lockPTR< D >& p ) const { return ( obj != p.obj ); } bool valid( void ) const //!< returns true if and only if obj->pointee != NULL { assert( obj != NULL ); return ( obj->get() != NULL ); } bool islocked( void ) const { assert( obj != NULL ); return ( obj->islocked() ); } bool deletable( void ) const { assert( obj != NULL ); return ( obj->isdeletable() ); } void lock( void ) const { assert( obj != NULL ); obj->lock(); } void unlock( void ) const { assert( obj != NULL ); obj->unlock(); } void unlock( void ) { assert( obj != NULL ); obj->unlock(); } size_t references( void ) const { return ( obj == NULL ) ? 0 : obj->references(); } }; #ifndef LOCK_PTR_NDEBUG #undef NDEBUG #endif #endif
21.643617
80
0.624601
[ "object" ]
7a634919f9c2fd3770ca6c55666990299beaa269
14,174
c
C
lang/lc/symtbl.c
abfeldman/lydia
03b220cd7fb743f341086ae2d950d97d17f7073f
[ "MIT" ]
null
null
null
lang/lc/symtbl.c
abfeldman/lydia
03b220cd7fb743f341086ae2d950d97d17f7073f
[ "MIT" ]
null
null
null
lang/lc/symtbl.c
abfeldman/lydia
03b220cd7fb743f341086ae2d950d97d17f7073f
[ "MIT" ]
null
null
null
#include "rewrite.h" #include "config.h" #include "symtbl.h" #include "search.h" #include "array.h" #include "error.h" #include "list.h" #include "attr.h" #include "lc.h" #include <assert.h> static lydia_symbol report = lydia_symbolNIL; static lydia_symbol_list undefined = lydia_symbol_listNIL; static int check_type(int reference, type t, user_type_entry_list user_type_table, lydia_symbol where, int function) { unsigned int pos; if (typeNIL == t) { return 0; } if (t->tag != TAGuser_type) { return 1; } if (reference) { if (search_user_type_entry_list(user_type_table, to_user_type(t)->name->sym, &pos) && (user_type_table->arr[pos]->tag == TAGsystem_user_type_entry || user_type_table->arr[pos]->tag == TAGfunction_user_type_entry)) { return 1; } } else { if (search_user_type_entry_list(user_type_table, to_user_type(t)->name->sym, &pos) && !(user_type_table->arr[pos]->tag == TAGsystem_user_type_entry || user_type_table->arr[pos]->tag == TAGfunction_user_type_entry)) { return 1; } } if (report != where) { report = where; rfre_lydia_symbol_list(undefined); undefined = new_lydia_symbol_list(); } if (member_lydia_symbol_list(undefined, to_user_type(t)->name->sym)) { return 0; } undefined = append_lydia_symbol_list(undefined, to_user_type(t)->name->sym); leh_error(ERR_UNDEFINED_IDENTIFIER, function, to_user_type(t)->name->org, where->name, to_user_type(t)->name->sym->name); return 0; } static int check_attribute(type t, attribute_entry_list attribute_table, lydia_symbol where) { if (typeNIL == t) { return 0; } if (t->tag != TAGuser_type) { return 1; } if (is_attribute(attribute_table, to_user_type(t)->name->sym)) { return 1; } if (report != where) { report = where; rfre_lydia_symbol_list(undefined); undefined = new_lydia_symbol_list(); } if (member_lydia_symbol_list(undefined, to_user_type(t)->name->sym)) { return 0; } undefined = append_lydia_symbol_list(undefined, to_user_type(t)->name->sym); leh_error(ERR_UNDEFINED_IDENTIFIER, LEH_LOCATION_SYSTEM, to_user_type(t)->name->org, where->name, to_user_type(t)->name->sym->name); return 0; } static int build_predicate_symbol_table(predicate p, formal_list formals, local_list locals, reference_list references, attribute_list attributes, lydia_symbol system, user_type_entry_list user_type_table, attribute_entry_list attribute_table) { int result = 1; unsigned int pos; register unsigned int ix, iy; type t, q; variable_identifier id; int_list ref_count; assert(local_listNIL != locals); assert(formal_listNIL != formals); assert(reference_listNIL != references); switch (p->tag) { case TAGsimple_predicate: /* Noop. */ break; case TAGforall_predicate: result &= build_predicate_symbol_table(to_predicate(to_forall_predicate(p)->body), formals, locals, references, attributes, system, user_type_table, attribute_table); break; case TAGexists_predicate: result &= build_predicate_symbol_table(to_predicate(to_exists_predicate(p)->body), formals, locals, references, attributes, system, user_type_table, attribute_table); break; case TAGcompound_predicate: for (ix = 0; ix < to_compound_predicate(p)->predicates->sz; ix++) { result &= build_predicate_symbol_table(to_compound_predicate(p)->predicates->arr[ix], formals, locals, references, attributes, system, user_type_table, attribute_table); } break; case TAGif_predicate: if (to_if_predicate(p)->thenval != compound_predicateNIL) { result &= build_predicate_symbol_table(to_predicate(to_if_predicate(p)->thenval), formals, locals, references, attributes, system, user_type_table, attribute_table); } if (to_if_predicate(p)->elseval != compound_predicateNIL) { result &= build_predicate_symbol_table(to_predicate(to_if_predicate(p)->elseval), formals, locals, references, attributes, system, user_type_table, attribute_table); } break; case TAGswitch_predicate: for (ix = 0; ix < to_switch_predicate(p)->choices->sz; ix++) { result &= build_predicate_symbol_table(to_predicate(to_switch_predicate(p)->choices->arr[ix]->predicate), formals, locals, references, attributes, system, user_type_table, attribute_table); } if (to_switch_predicate(p)->deflt != compound_predicateNIL) { result &= build_predicate_symbol_table(to_predicate(to_switch_predicate(p)->deflt), formals, locals, references, attributes, system, user_type_table, attribute_table); } break; case TAGvariable_declaration: if (!check_type(0, to_variable_declaration(p)->type, user_type_table, system, 0)) { /* * This is a variable which is of undefined user type. * In this case we reported that here and then we continue suppressing all the * other errors and warning related to that symbol. */ to_variable_declaration(p)->type = typeNIL; result = 0; break; } for (ix = 0; ix < to_variable_declaration(p)->instances->sz; ix++) { int redefined = 0; if (reverse_search_local_list(locals, to_variable_declaration(p)->instances->arr[ix]->name->sym, &pos)) { leh_error(ERR_REDEFINED_IDENTIFIER, LEH_LOCATION_SYSTEM, to_variable_declaration(p)->instances->arr[ix]->name->org, system->name, to_variable_declaration(p)->instances->arr[ix]->name->sym->name, locals->arr[pos]->name->name->org, to_variable_declaration(p)->instances->arr[ix]->name->sym->name); result = 0; redefined = 1; } else if (reverse_search_formal_list(formals, to_variable_declaration(p)->instances->arr[ix]->name->sym, &pos)) { leh_error(ERR_REDEFINED_IDENTIFIER, LEH_LOCATION_SYSTEM, to_variable_declaration(p)->instances->arr[ix]->name->org, system->name, to_variable_declaration(p)->instances->arr[ix]->name->sym->name, formals->arr[pos]->name->name->org, to_variable_declaration(p)->instances->arr[ix]->name->sym->name); result = 0; redefined = 1; } id = new_variable_identifier(rdup_orig_symbol(to_variable_declaration(p)->instances->arr[ix]->name), rdup_extent_list(to_variable_declaration(p)->instances->arr[ix]->ranges), variable_qualifier_listNIL); q = to_variable_declaration(p)->type; ref_count = int_listNIL; if (!redefined) { ref_count = init_reference_count(to_variable_declaration(p)->instances->arr[ix]->ranges, q, user_type_table); } append_local_list(locals, new_local(id, rdup_type(q), ref_count)); if (to_variable_declaration(p)->instances->arr[ix]->val != exprNIL) { increase_reference_count_array(locals->arr[locals->sz - 1]->name->ranges, locals->arr[locals->sz - 1]->name->ranges, locals->arr[locals->sz - 1]->ref_count, 0, index_entry_listNIL, user_type_table); } } break; case TAGattribute_declaration: for (ix = 0; ix < to_attribute_declaration(p)->instances->sz; ix++) { type attr_type = to_attribute_declaration(p)->instances->arr[ix]->type; assert(attr_type->tag == TAGuser_type); if (!check_attribute(attr_type, attribute_table, system)) { to_attribute_declaration(p)->instances->arr[ix]->type = typeNIL; result = 0; continue; } for (iy = 0; iy < to_attribute_declaration(p)->instances->arr[ix]->variables->sz; iy++) { expr_variable var = to_attribute_declaration(p)->instances->arr[ix]->variables->arr[iy]; if (reverse_search_attribute_list(attributes, var->name, to_user_type(attr_type)->name->sym, &pos)) { leh_error(ERR_REDEFINED_ATTRIBUTE, LEH_LOCATION_SYSTEM, var->name->name->org, system->name, to_user_type(attr_type)->name->sym->name, var->name->name->sym->name, attributes->arr[pos]->var->name->name->org, to_user_type(attr_type)->name->sym->name, var->name->name->sym->name); result = 0; continue; } append_attribute_list(attributes, new_attribute(rdup_type(attr_type), rdup_expr_variable(var), rdup_orig_symbol(to_attribute_declaration(p)->instances->arr[ix]->alias), rdup_expr(to_attribute_declaration(p)->instances->arr[ix]->val))); } } break; case TAGsystem_declaration: t = to_type(new_user_type(rdup_orig_symbol(to_system_declaration(p)->name))); if (!check_type(1, t, user_type_table, system, 0)) { t = typeNIL; result = 0; } for (ix = 0; ix < to_system_declaration(p)->instances->sz; ix++) { orig_symbol name = to_system_declaration(p)->instances->arr[ix]->name; extent_list ranges = to_system_declaration(p)->instances->arr[ix]->ranges; int_list ref_count; int redefined = 0; if (reverse_search_reference_list(references, name->sym, &pos)) { leh_error(ERR_REDEFINED_IDENTIFIER, LEH_LOCATION_SYSTEM, name->org, system->name, name->sym->name, references->arr[pos]->name->org, name->sym->name); result = 0; redefined = 1; } ref_count = int_listNIL; if (!redefined) { ref_count = init_reference_count(ranges, t, user_type_table); } append_reference_list(references, new_reference(rdup_orig_symbol(name), rdup_extent_list(ranges), rdup_type(t), ref_count)); if (to_system_declaration(p)->instances->arr[ix]->arguments != expr_listNIL) { increase_reference_count_array(references->arr[references->sz - 1]->ranges, references->arr[references->sz - 1]->ranges, references->arr[references->sz - 1]->ref_count, 0, index_entry_listNIL, user_type_table); } } rfre_type(t); break; } return result; } static int build_system_symbol_table(system_definition sys, user_type_entry_list user_type_table, attribute_entry_list attribute_table) { int result = 1; lydia_symbol system; unsigned int pos; unsigned int ix; system = sys->name->sym; assert(formal_listNIL != sys->formals); for (ix = 0; ix < sys->formals->sz; ix++) { if (reverse_search_beginning_formal_list(sys->formals, sys->formals->arr[ix]->name, ix, &pos)) { leh_error(ERR_REDEFINED_IDENTIFIER, LEH_LOCATION_SYSTEM, sys->formals->arr[ix]->name->name->org, system->name, sys->formals->arr[ix]->name->name->sym->name, sys->formals->arr[pos]->name->name->org, sys->formals->arr[ix]->name->name->sym->name); result = 0; /* Do not count referneces on a redeclared varaible. */ rfre_int_list(sys->formals->arr[pos]->ref_count); sys->formals->arr[pos]->ref_count = int_listNIL; continue; } if (typeNIL == sys->formals->arr[ix]->type) { continue; } sys->formals->arr[ix]->ref_count = init_reference_count(sys->formals->arr[ix]->name->ranges, sys->formals->arr[ix]->type, user_type_table); } result &= build_predicate_symbol_table(to_predicate(sys->predicates), sys->formals, sys->locals, sys->references, sys->attributes, system, user_type_table, attribute_table); for (ix = 0; ix < sys->formals->sz; ix++) { if (typeNIL != sys->formals->arr[ix]->type) { /* Can bin NIL as we will later take the type of the formal which is on the left. */ result &= check_type(0, sys->formals->arr[ix]->type, user_type_table, system, 0); } } for (ix = 0; ix < sys->locals->sz; ix++) { result &= check_type(0, sys->locals->arr[ix]->type, user_type_table, system, 0); } for (ix = 0; ix < sys->references->sz; ix++) { result &= check_type(1, sys->references->arr[ix]->type, user_type_table, system, 0); } return result; } static int build_function_symbol_table(function_definition func, user_type_entry_list user_type_table) { /* * Functions have only formal parameters, no locally declared variables and * system references. */ int result = 1; lydia_symbol function = func->name->sym; unsigned int pos; unsigned int ix; assert(formal_listNIL != func->formals); for (ix = 0; ix < func->formals->sz; ix++) { if (reverse_search_beginning_formal_list(func->formals, func->formals->arr[ix]->name, ix, &pos)) { leh_error(ERR_REDEFINED_IDENTIFIER, LEH_LOCATION_FUNCTION, func->formals->arr[ix]->name->name->org, function->name, func->formals->arr[ix]->name->name->sym->name, func->formals->arr[pos]->name->name->org, func->formals->arr[ix]->name->name->sym->name); result = 0; /* Do not count referneces on a redeclared varaible. */ rfre_int_list(func->formals->arr[pos]->ref_count); func->formals->arr[pos]->ref_count = int_listNIL; continue; } func->formals->arr[ix]->ref_count = init_reference_count(func->formals->arr[ix]->name->ranges, func->formals->arr[ix]->type, user_type_table); } for (ix = 0; ix < func->formals->sz; ix++) { if (typeNIL != func->formals->arr[ix]->type) { result &= check_type(0, func->formals->arr[ix]->type, user_type_table, function, 1); } } return result; } int build_symbol_tables(model m, user_type_entry_list user_type_table, attribute_entry_list attribute_table) { register unsigned int ix; int result = 1; if (m == modelNIL) { return 1; } assert(definition_listNIL != m->defs); for (ix = 0; ix < m->defs->sz; ix++) { if (m->defs->arr[ix]->tag == TAGsystem_definition) { result &= build_system_symbol_table(to_system_definition(m->defs->arr[ix]), user_type_table, attribute_table); } if (m->defs->arr[ix]->tag == TAGfunction_definition) { result &= build_function_symbol_table(to_function_definition(m->defs->arr[ix]), user_type_table); } } if (lydia_symbol_listNIL != undefined) { rfre_lydia_symbol_list(undefined); } return result; } /* * local variables: * mode: c * tab-width: 8 * c-basic-offset: 4 * End: * vim600: sw=4 ts=8 fdm=marker * vim<600: sw=4 ts=8 */
34.740196
243
0.670171
[ "model" ]
7a677932490de7368a3d74fdda76145c9b49c6ab
31,638
h
C
ProjectAloe/Win32/Win32CWindow.h
sadhbh-c0d3/ProjectALOE
8574483d73cb71ba3330f6449f17ed0e5f2693e9
[ "MIT" ]
null
null
null
ProjectAloe/Win32/Win32CWindow.h
sadhbh-c0d3/ProjectALOE
8574483d73cb71ba3330f6449f17ed0e5f2693e9
[ "MIT" ]
null
null
null
ProjectAloe/Win32/Win32CWindow.h
sadhbh-c0d3/ProjectALOE
8574483d73cb71ba3330f6449f17ed0e5f2693e9
[ "MIT" ]
null
null
null
#ifndef ALOE_WIN32_SYSTEM #error "DO NOT INCLUDE THIS FILE!!! This header file can be only included by source file 'Win32System.cpp'." #endif namespace Aloe { namespace Win32 { struct CWindow : Detail::Implementation < CWindow , Detail::Interfaces< IEventSource, Aloe::IWindow, Win32::IWindow, Win32::ILayeredWindow, IFrame, IContainer > , Detail::Bases< Detail::CRefCount > , 0x1002 > { typedef std::map< ::HWND, CWindow * > DictWindows_t; static DictWindows_t s_dictWindows; ::HWND m_hWnd; Types::Bool m_bMouseOver; Types::Bool m_bFocussed; Types::Point2i m_lastMotionPos; Types::Bool m_layerPendingCommit; Types::UByte m_layerOpacity; Types::Color32 m_layerCK; Types::Long m_layerFlags; typedef std::set< Types::Int > SetOfDragButtons_t; SetOfDragButtons_t m_setOfDragButtons; CWindow() : m_hWnd(0) , m_bMouseOver(0) , m_bFocussed(0) , m_layerFlags(0) , m_layerPendingCommit(0) {} ThisPtr __init__( ::HWND hWnd ) { s_dictWindows[ hWnd ] = this; m_hWnd = hWnd; return Super::__init__(); } ~CWindow() { if ( RemoveObject( m_hWnd )) { Close( Types::None() ); } } CWindow * RemoveObject( ::HWND hWnd ) { DictWindows_t::iterator iter = s_dictWindows.find( hWnd ); if ( iter != s_dictWindows.end() ) { CWindow *pWnd = iter->second; s_dictWindows.erase( iter ); return pWnd; } else { return NULL; } } static CWindow * GetObject( ::HWND hWnd ) { DictWindows_t::iterator iter = s_dictWindows.find( hWnd ); if ( iter != s_dictWindows.end() ) { return iter->second; } else { return NULL; } } LRESULT ProcessMessage( UINT uMsg, WPARAM wParam, LPARAM lParam ) { __self__()[ &IEventSource::Raise ][ &Win32::IWindowEvents::Event ]( __self__(), Utils::copyCast< Types::Long >( uMsg ), Utils::copyCast< Types::LongPointer >( wParam ), Utils::copyCast< Types::LongPointer >( lParam ) ); Types::Bool isButton = false; Types::Bool isDown = false; Types::Bool isDblClick = false; Types::Bool isSize = false; Types::Bool isFocus = false; switch( uMsg ) { case WM_CREATE: { } break; case WM_DESTROY: { if ( RemoveObject( m_hWnd )) { if( s_dictWindows.empty() ) { ::PostQuitMessage(0); } } __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Close ]( __self__() ); __self__()[ &IEventSource::Raise ][ &Aloe::IUserInterfaceEvents::Close ]( __self__(), 0 ); } break; case WM_ACTIVATE: { Types::Bool bActive = ( LOWORD( wParam ) > 0 ); __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Activate ]( __self__(), bActive ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents::Activate ]( __self__(), bActive ); } break; case WM_SETFOCUS: isFocus = true; case WM_KILLFOCUS: { m_bFocussed = isFocus; __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Focus ]( __self__(), isFocus ); __self__()[ &IEventSource::Raise ][ &IUserInputEvents::Focus ]( __self__(), isFocus ); } break; case WM_SHOWWINDOW: { Types::Long flags = (wParam > 0 ? true : false); // lParam is 0 for call to ShowWindow() or: // SW_OTHERUNZOOM // SW_OTHERZOOM // SW_PARENTCLOSING // SW_PARENTOPENING // __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Show ]( __self__(), flags ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents::Show ]( __self__(), flags ); } break; case WM_SIZE: isSize = true; case WM_MOVE: { Types::Recti rect = get_FrameRect(); Types::Long flags = ( isSize ? 1 : 0 ); __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Move ]( __self__(), rect, flags ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents::Move ]( __self__(), rect, flags ); Types::Recti clientRect = get_ClientRect(); for ( SetOfClients_t::iterator iter = m_setOfClients.begin(); iter != m_setOfClients.end(); ++iter ) { (*iter)[ &IFrameClient::Move ]( clientRect ); } } break; case WM_KEYDOWN: isDown = true; case WM_KEYUP: { __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Key ]( __self__(), Utils::copyCast< Types::Long >( wParam ), isDown ); __self__()[ &IEventSource::Raise ][ &IUserInputEvents::Key ]( __self__(), Utils::copyCast< Types::Long >( wParam ), isDown ); } break; case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDBLCLK: isDblClick = true; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: isDown = true; case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: isButton = true; case WM_MOUSEMOVE: { ::POINT pt, ptScreen; ::GetCursorPos( &ptScreen ); pt = ptScreen; ::ScreenToClient( m_hWnd, &pt ); #if 0 if ( uMsg == WM_MOUSEMOVE ) { wchar_t buffer[100]; swprintf( buffer, L"WM_MOUSEMOVE screen=(%i %i) pt=(%i %i)\n", ptScreen.x, ptScreen.y, pt.x, pt.y ); ::OutputDebugString( buffer ); } #endif Types::Point2i pos( pt.x, pt.y ); if ( !isButton ) { __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Motion ]( __self__(), pos ); for ( SetOfDragButtons_t::iterator iter = m_setOfDragButtons.begin(); iter != m_setOfDragButtons.end(); ++iter ) { Types::Int iButton = *iter; __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents4::DragContinue ]( __self__(), iButton, pos ); } if ( !m_bMouseOver ) { m_bMouseOver = true; ::TRACKMOUSEEVENT trackInfo; std::memset( &trackInfo, 0, sizeof( ::TRACKMOUSEEVENT )); trackInfo.cbSize = sizeof( ::TRACKMOUSEEVENT ); trackInfo.dwFlags = TME_LEAVE; trackInfo.hwndTrack = m_hWnd; trackInfo.dwHoverTime = 0; ::TrackMouseEvent( &trackInfo ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents2::Hover ]( __self__() ); } else { __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents2::Motion ]( __self__(), pos ); } m_lastMotionPos = pos; break; } else { Types::Long btnNo = 0; switch( uMsg ) { case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONUP: btnNo = 1; break; case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: btnNo = 2; break; }; if ( !isDblClick ) { while( true ) { __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Button ]( __self__(), pos, btnNo, isDown ); if ( isDown ) { __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents3::Press ]( __self__(), btnNo, pos ); ::UpdateWindow( m_hWnd ); if ( ::DragDetect( m_hWnd, ptScreen )) { m_setOfDragButtons.insert( btnNo ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents4::DragStart ]( __self__(), btnNo, pos ); } else { isDown = false; continue; } ::SetCapture( m_hWnd ); } else { SetOfDragButtons_t::iterator iterButton = m_setOfDragButtons.find( btnNo ); if ( m_setOfDragButtons.end() != iterButton ) { m_setOfDragButtons.erase( iterButton ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents4::DragEnd ]( __self__(), btnNo, pos ); } else { __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents3::Click ]( __self__(), btnNo, pos ); } __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents3::Release ]( __self__(), btnNo, pos ); if ( m_setOfDragButtons.empty() ) { ::ReleaseCapture(); } } break; }; } else { __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::DoubleClick ]( __self__(), pos, btnNo ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents3::DoubleClick ]( __self__(), btnNo, pos ); } } }; break; case WM_MOUSELEAVE: { if ( m_bMouseOver ) { m_bMouseOver = false; ::TRACKMOUSEEVENT trackInfo; std::memset( &trackInfo, 0, sizeof( ::TRACKMOUSEEVENT )); trackInfo.cbSize = sizeof( ::TRACKMOUSEEVENT ); trackInfo.dwFlags = TME_CANCEL; trackInfo.hwndTrack = m_hWnd; trackInfo.dwHoverTime = 0; ::TrackMouseEvent( &trackInfo ); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents2::Leave ]( __self__() ); } } break; case WM_CAPTURECHANGED: { Utils::SmartPtr<> capture; if ( CWindow *pWnd = GetObject( (::HWND)lParam )) { capture = pWnd->__self__(); } __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::LostCapture ]( __self__(), capture ); return 1; } break; case WM_ERASEBKGND: { return 1; } break; case WM_PAINT: { PAINTSTRUCT ps; if ( ::HDC hDc = ::BeginPaint( m_hWnd, &ps )) { Utils::SmartPtr< CDevContext > dev = ( new CDevContext )->__init__( hDc ); __self__()[ &IEventSource::Raise ][ &Aloe::IWindowEvents::Paint ]( __self__(), dev, reinterpret_cast< Types::Recti & >( ps.rcPaint )); __self__()[ &IEventSource::Raise ][ &IUserInterfaceEvents::Paint ]( __self__(), dev, reinterpret_cast< Types::Recti & >( ps.rcPaint )); ::EndPaint( m_hWnd, &ps ); if ( m_layerPendingCommit ) { CommitLayeredAttributes(); } return 0; } } break; }; return ::DefWindowProc( m_hWnd, uMsg, wParam, lParam ); } // // IEventSource // typedef std::set< Utils::SmartPtr<> > SetOfListeners_t; SetOfListeners_t m_setOfListeners; aloe__property_imp_append( IEventSource, Listeners, listener ) { return m_setOfListeners.insert( listener ).second; } aloe__property_imp_remove( IEventSource, Listeners, listener ) { SetOfListeners_t::iterator found = m_setOfListeners.find( listener ); if ( found != m_setOfListeners.end() ) { m_setOfListeners.erase( found ); return true; } else { return false; } } aloe__method_imp( IEventSource, RaiseEvent, event ) { for ( SetOfListeners_t::iterator i = m_setOfListeners.begin(); i != m_setOfListeners.end(); ++i ) { if ( !event->Invoke( *i )) { break; } } return Types::None(); } // // IWindow // aloe__property_imp_put( Aloe::IWindow, FrameRect, rect ) { ::MoveWindow( m_hWnd, rect.upperLeft().x, rect.upperLeft().y, rect.width(), rect.height(), TRUE ); } aloe__property_imp_put( Aloe::IWindow, ClientRect, rect ) { ::RECT w32RectClient; ::GetClientRect( m_hWnd, &w32RectClient ); int dx = (w32RectClient.right - w32RectClient.left) - rect.width(); int dy = (w32RectClient.bottom - w32RectClient.top) - rect.height(); ::RECT w32Rect; ::GetWindowRect( m_hWnd, &w32Rect ); w32Rect.left += rect.upperLeft().x; w32Rect.top += rect.upperLeft().y; w32Rect.right += rect.upperLeft().x - dx; w32Rect.bottom += rect.upperLeft().y - dy; ::MoveWindow( m_hWnd, w32Rect.left, w32Rect.top, w32Rect.right - w32Rect.left, w32Rect.bottom - w32Rect.top, TRUE ); } aloe__property_imp_get( Aloe::IWindow, FrameRect ) { ::RECT w32Rect; ::GetWindowRect( m_hWnd, &w32Rect ); Types::Recti rect; rect.upperLeft() = Types::Point2i( w32Rect.left, w32Rect.top ); rect.bottomRight() = Types::Point2i( w32Rect.right, w32Rect.bottom ); return rect; } aloe__property_imp_get( Aloe::IWindow, ClientRect ) { ::RECT w32Rect; ::GetClientRect( m_hWnd, &w32Rect ); Types::Recti rect; rect.upperLeft() = Types::Point2i( w32Rect.left, w32Rect.top ); rect.bottomRight() = Types::Point2i( w32Rect.right, w32Rect.bottom ); return rect; } aloe__method_imp( Aloe::IWindow, Close, argv ) { ::PostMessage( m_hWnd, WM_CLOSE, 0, 0 ); return Types::None(); } aloe__property_imp_put( Aloe::IWindow, Region, region ) { if ( !region ) { ::SetWindowRgn( m_hWnd, (::HRGN)NULL, FALSE ); } else { ::SetWindowRgn( m_hWnd, region[ &Win32::IRegion::HRgn ], TRUE ); } } aloe__property_imp_get( Aloe::IWindow, Region ) { ::HRGN hRgn = ::CreateRectRgn(0,0,0,0); ::GetWindowRgn( m_hWnd, hRgn ); return (new CRegion)->__init__( (new CGDIRegion)->__init__( hRgn, true )); } aloe__property_imp_append( Aloe::IWindow, DirtyRects, rect ) { ::InvalidateRect( m_hWnd, (LPRECT)&rect, FALSE ); return Types::None(); } aloe__property_imp_remove( Aloe::IWindow, DirtyRects, rect ) { ::ValidateRect( m_hWnd, (LPRECT)&rect ); return Types::None(); } aloe__property_imp_append( Aloe::IWindow, DirtyRegions, region ) { ::InvalidateRgn( m_hWnd, region[ &Win32::IRegion::HRgn ], FALSE ); return Types::None(); } aloe__property_imp_remove( Aloe::IWindow, DirtyRegions, region ) { ::ValidateRgn( m_hWnd, region[ &Win32::IRegion::HRgn ] ); return Types::None(); } aloe__method_imp( Aloe::IWindow, Update, argv ) { ::UpdateWindow( m_hWnd ); return Types::None(); } aloe__method_imp( Aloe::IWindow, RedrawRect, argv ) { aloe__extract2( Aloe::IWindow, RedrawRect, args, argv, rect, flags ); ::RedrawWindow( m_hWnd, (LPRECT)&rect, (::HRGN)NULL, flags ); return Types::None(); } aloe__method_imp( Aloe::IWindow, RedrawRegion, argv ) { aloe__extract2( Aloe::IWindow, RedrawRegion, args, argv, region, flags ); ::RedrawWindow( m_hWnd, NULL, region[ &Win32::IRegion::HRgn ], flags ); return Types::None(); } // // Win32::IWindow // aloe__property_imp_put( Win32::IWindow, Style, style ) { SetWindowLong( m_hWnd, GWL_STYLE, style ); } aloe__property_imp_put( Win32::IWindow, ExStyle, exStyle ) { SetWindowLong( m_hWnd, GWL_EXSTYLE, exStyle ); } aloe__property_imp_put( Win32::IWindow, UserData, data ) { SetWindowLong( m_hWnd, GWL_USERDATA, data ); } aloe__prop_map_imp_put( Win32::IWindow, Long, idx, value ) { SetWindowLong( m_hWnd, idx, value ); } aloe__property_imp_get( Win32::IWindow, Class ) { return ( new CWindowClass )->__init__( m_hWnd ); } aloe__property_imp_get( Win32::IWindow, Style ) { return GetWindowLong( m_hWnd, GWL_STYLE ); } aloe__property_imp_get( Win32::IWindow, ExStyle ) { return GetWindowLong( m_hWnd, GWL_EXSTYLE ); } aloe__property_imp_get( Win32::IWindow, UserData ) { return GetWindowLong( m_hWnd, GWL_USERDATA ); } aloe__prop_map_imp_get( Win32::IWindow, Long, idx ) { return GetWindowLong( m_hWnd, idx ); } aloe__property_imp_get( Win32::IWindow, HWnd ) { return m_hWnd; } // // Win32::ILayeredWindow // aloe__property_imp_put( Win32::ILayeredWindow, Opacity, opacity ) { m_layerOpacity = opacity; m_layerPendingCommit = true; } aloe__property_imp_get( Win32::ILayeredWindow, Opacity ) { return m_layerOpacity; } aloe__property_imp_put( Win32::ILayeredWindow, ColorKey, ck ) { m_layerCK = ck; m_layerPendingCommit = true; } aloe__property_imp_get( Win32::ILayeredWindow, ColorKey ) { return m_layerCK; } aloe__property_imp_put( Win32::ILayeredWindow, Flags, flags ) { m_layerFlags = flags; m_layerPendingCommit = true; } aloe__property_imp_get( Win32::ILayeredWindow, Flags ) { return m_layerFlags; } aloe__method_imp( Win32::ILayeredWindow, Commit, argv ) { return CommitLayeredAttributes(); } bool CommitLayeredAttributes() { ::LONG lExStyle = ::GetWindowLong( m_hWnd, GWL_EXSTYLE ); m_layerPendingCommit = false; if ( !m_layerFlags ) { if ( lExStyle & WS_EX_LAYERED ) { ::SetWindowLong( m_hWnd, GWL_EXSTYLE, lExStyle & (~WS_EX_LAYERED) ); } } else { if (!( lExStyle & WS_EX_LAYERED )) { ::SetWindowLong( m_hWnd, GWL_EXSTYLE, lExStyle | WS_EX_LAYERED ); } #ifdef WIN32 ::BOOL bOk = ::SetLayeredWindowAttributes( m_hWnd, RGB( m_layerCK.Redub(), m_layerCK.Greenub(), m_layerCK.Blueub() ), m_layerOpacity, m_layerFlags ); return (bOk == TRUE); #endif } return true; } // // IContainer // typedef std::set< Utils::SmartPtr<> > SetOfObjects_t; SetOfObjects_t m_setOfObjects; aloe__property_imp_get( IContainer, Objects ) { Utils::VectorOf< Utils::SmartPtr<> > array; for ( SetOfObjects_t::iterator iter = m_setOfObjects.begin(); iter != m_setOfObjects.end(); ++iter ) { array.push_back( *iter ); } return array.tight_array(); } aloe__property_imp_put( IContainer, Objects, objects ) { m_setOfObjects.clear(); for ( size_t i = 0, n = objects.size(); i < n; ++i ) { m_setOfObjects.insert( objects[i] ); } } aloe__property_imp_append( IContainer, Objects, object ) { return m_setOfObjects.insert( object ).second; } aloe__property_imp_remove( IContainer, Objects, object ) { SetOfObjects_t::iterator iter = m_setOfObjects.find( object ); if ( iter != m_setOfObjects.end() ) { m_setOfObjects.erase( iter ); return true; } else { return false; } } aloe__prop_map_imp_get( IContainer, ObjectByName, index ) { for ( SetOfObjects_t::iterator iter = m_setOfObjects.begin(); iter != m_setOfObjects.end(); ++iter ) { Utils::SmartPtr< IEntity > entity; if ( entity.QueryFrom( *iter )) { Types::String name = entity[ &IEntity::Name ]; if ( index == name ) { return entity; } } } return Types::None(); } aloe__prop_map_imp_get( IContainer, ObjectByPoint, index ) { for ( SetOfObjects_t::iterator iter = m_setOfObjects.begin(); iter != m_setOfObjects.end(); ++iter ) { Utils::SmartPtr< IFrameClient > client; if ( client.QueryFrom( *iter )) { Types::Recti bound = client[ &IFrameClient::Frame ][ IFrame::Bound ]; if ( bound.isPointInside( index )) { return client; } } } return Types::None(); } // // IFrame // typedef std::set< Utils::SmartPtr< IFrameClient > > SetOfClients_t; SetOfClients_t m_setOfClients; aloe__property_imp_put( IFrame, Bound, bound ) { return put_ClientRect( bound ); } aloe__property_imp_get( IFrame, Bound ) { return get_ClientRect(); } aloe__property_imp_put( IFrame, Parent, parent ) { // not allowed! } aloe__property_imp_get( IFrame, Parent ) { return Types::None(); } aloe__property_imp_get( IFrame, Clients ) { Utils::VectorOf< Utils::SmartPtr< IFrameClient > > array; for ( SetOfClients_t::iterator iter = m_setOfClients.begin(); iter != m_setOfClients.end(); ++iter ) { array.push_back( *iter ); } return array.tight_array(); } aloe__property_imp_put( IFrame, Clients, clients ) { m_setOfClients.clear(); for ( size_t i = 0, n = clients.size(); i < n; ++i ) { m_setOfClients.insert( clients[i] ); } } aloe__property_imp_append( IFrame, Clients, client ) { return m_setOfClients.insert( client ).second; } aloe__property_imp_remove( IFrame, Clients, client ) { SetOfClients_t::iterator iter = m_setOfClients.find( client ); if ( iter != m_setOfClients.end() ) { m_setOfClients.erase( iter ); return true; } else { return false; } } };//CWindow };//Win32 };//Aloe
39.696361
146
0.385328
[ "object" ]
7a707f2696ff8365ddde9c7b85b81e1015c9b45e
2,007
h
C
libs/sge_utils/src/sge_utils/math/MultiCurve2D.h
Alekssasho/sge_source
2db4ae08f7b3434d32dd9767fe1136234cb70b83
[ "MIT" ]
34
2021-06-15T10:24:49.000Z
2022-03-22T19:20:23.000Z
libs/sge_utils/src/sge_utils/math/MultiCurve2D.h
Alekssasho/sge_source
2db4ae08f7b3434d32dd9767fe1136234cb70b83
[ "MIT" ]
9
2021-03-04T21:34:03.000Z
2021-05-04T18:33:47.000Z
libs/sge_utils/src/sge_utils/math/MultiCurve2D.h
Alekssasho/sge_source
2db4ae08f7b3434d32dd9767fe1136234cb70b83
[ "MIT" ]
2
2021-12-29T01:15:22.000Z
2022-02-01T10:53:15.000Z
#pragma once #include "sge_utils/math/vec2.h" #include <unordered_map> #include <vector> namespace sge { struct MultiCurve2D { public: enum PointType : int { pointType_linear, pointType_constant, pointType_smooth, pointType_bezierKey, pointType_bezierHandle0, pointType_bezierHandle1, }; static bool pointType_isBezierHandle(const PointType pt) { return pt == pointType_bezierHandle0 || pt == pointType_bezierHandle1; } static bool pointType_isBezierKey(const PointType pt) { return pt == pointType_bezierKey; } static bool pointType_isControlPoint(const PointType pt) { return !pointType_isBezierHandle(pt); } struct Point { Point() = default; Point(PointType type, float x, float y) : type(type) , x(x) , y(y) {} vec2f getPos() const { return vec2f(x, y); } PointType type = pointType_linear; float x = 0.f; float y = 0.f; }; public: bool isIndexValid(int idx) const { return idx >= 0 && idx < m_pointsWs.size(); } int findBezierH0(const int iBezierKey) const; int findBezierH1(const int iBezierKey) const; int findHandleKeyPoint(const int iHandle) const; int findHandleAttachmentPoint(const int iHandle) const; int findNextKeyPoint(const int iStart) const; int findPrevKeyPoint(const int iStart) const; bool isCurveValid() const; void sortPointsByX(); bool sortPointsByX(std::vector<int>& outIndexRemap); bool addSmoothPointSafe(const float x, const float y); bool removePointSafe(const int idx, std::vector<int>& outIndexRemap); bool chnagePointType(const int idx, const PointType newType); void addPointUnsafe(const Point& pt); bool removePointUnsafe(const int idx); float sample(const float x) const; float sampleDerivative(const float x) const; const std::vector<Point>& getPoints() const { return m_pointsWs; } const int getNumPoints() const { return int(m_pointsWs.size()); } std::vector<Point>& getPointsMutable() { return m_pointsWs; } public: std::vector<Point> m_pointsWs; }; } // namespace sge
25.730769
132
0.736423
[ "vector" ]
7a7d4351e1c565d1813942ea89008be4271c0ab6
3,495
h
C
emulator/src/devices/bus/bbc/tube/tube.h
rjw57/tiw-computer
5ef1c79893165b8622d1114d81cd0cded58910f0
[ "MIT" ]
1
2022-01-15T21:38:38.000Z
2022-01-15T21:38:38.000Z
emulator/src/devices/bus/bbc/tube/tube.h
rjw57/tiw-computer
5ef1c79893165b8622d1114d81cd0cded58910f0
[ "MIT" ]
null
null
null
emulator/src/devices/bus/bbc/tube/tube.h
rjw57/tiw-computer
5ef1c79893165b8622d1114d81cd0cded58910f0
[ "MIT" ]
null
null
null
// license:BSD-3-Clause // copyright-holders:Nigel Barnes /********************************************************************** BBC Tube emulation ********************************************************************** Pinout: 0V 1 2 R/NW (read/not-write) 0V 3 4 2MHzE 0V 5 6 NIRQ (not-interrupt request) 0V 7 8 NTUBE 0V 9 10 NRST (not-reset) 0V 11 12 D0 0V 13 14 D1 0V 15 16 D2 0V 17 18 D3 0V 19 20 D4 0V 21 22 D5 0V 23 24 D6 0V 25 26 D7 0V 27 28 A0 0V 29 30 A1 +5V 31 32 A2 +5V 33 34 A3 +5V 35 36 A4 +5V 37 38 A5 +5V 39 40 A6 **********************************************************************/ #ifndef MAME_BUS_BBC_TUBE_TUBE_H #define MAME_BUS_BBC_TUBE_TUBE_H #pragma once //************************************************************************** // CONSTANTS //************************************************************************** #define BBC_TUBE_SLOT_TAG "tube" //************************************************************************** // INTERFACE CONFIGURATION MACROS //************************************************************************** #define MCFG_BBC_TUBE_SLOT_ADD(_tag, _slot_intf, _def_slot) \ MCFG_DEVICE_ADD(_tag, BBC_TUBE_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) #define MCFG_BBC_TUBE_SLOT_IRQ_HANDLER(_devcb) \ devcb = &downcast<bbc_tube_slot_device &>(*device).set_irq_handler(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS //************************************************************************** // ======================> bbc_tube_slot_device class device_bbc_tube_interface; class bbc_tube_slot_device : public device_t, public device_slot_interface { public: // construction/destruction bbc_tube_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~bbc_tube_slot_device(); // callbacks template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); } DECLARE_READ8_MEMBER( host_r ); DECLARE_WRITE8_MEMBER( host_w ); DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); } protected: // device-level overrides virtual void device_validity_check(validity_checker &valid) const override; virtual void device_start() override; virtual void device_reset() override; device_bbc_tube_interface *m_card; private: devcb_write_line m_irq_handler; }; // ======================> device_bbc_tube_interface class device_bbc_tube_interface : public device_slot_card_interface { public: // construction/destruction virtual ~device_bbc_tube_interface(); // reading and writing virtual DECLARE_READ8_MEMBER(host_r) { return 0xfe; } virtual DECLARE_WRITE8_MEMBER(host_w) { } protected: device_bbc_tube_interface(const machine_config &mconfig, device_t &device); bbc_tube_slot_device *m_slot; }; // device type definition DECLARE_DEVICE_TYPE(BBC_TUBE_SLOT, bbc_tube_slot_device) SLOT_INTERFACE_EXTERN( bbc_extube_devices ); SLOT_INTERFACE_EXTERN( bbc_intube_devices ); //SLOT_INTERFACE_EXTERN( bbc_x25tube_devices ); #endif // MAME_BUS_BBC_TUBE_TUBE_H
27.96
130
0.546495
[ "object" ]
7a7d726d55772e228010a590c6b051528a00bc71
600
c
C
mud/scn/furni/basin.c
shentino/simud
644b7d4f56bf8d4695442b8efcfd56e0a561fe21
[ "Apache-2.0" ]
3
2015-07-18T00:19:51.000Z
2016-02-20T17:25:37.000Z
mud/scn/furni/basin.c
shentino/simud
644b7d4f56bf8d4695442b8efcfd56e0a561fe21
[ "Apache-2.0" ]
2
2021-03-04T19:24:03.000Z
2021-03-08T10:17:34.000Z
mud/scn/furni/basin.c
shentino/simud
644b7d4f56bf8d4695442b8efcfd56e0a561fe21
[ "Apache-2.0" ]
2
2015-12-22T06:16:53.000Z
2016-11-18T16:32:50.000Z
inherit "/obj/scenery"; #include <container.h> NAME( "basin" ) SPECIFIC( "the basin" ) DISTANT( "a basin" ) LOOK( "A carefully carved stone container, the basin is appropriate for all your liquid-storage needs.?(HASINV: In the basin $(ISINV) $(INV).)" ) void create() { ::create(); /* OBJEDIT { */ set_phrase( "There is a stone basin ~plac." ); set_position( "here" ); set_preposition( "in" ); set_bulk_capacity( 10000 ); set_weight_capacity( 15000 ); /* } OBJEDIT */ } void on_map_paint( object painter ) { painter->paint( query_x(), query_y(), '&', 11, LAYER_FURNITURE ); }
26.086957
145
0.653333
[ "object" ]
7a7f6f501fb6e70308f8020619b6d1bda34a7a4b
1,183
h
C
Source/BlueprintSound/Classes/BlueprintSoundFunctions.h
getsetgames/BlueprintSound
4b6f034452bb5c7182eb5781bbf984f266e48d8c
[ "MIT" ]
9
2015-09-15T08:17:11.000Z
2021-11-07T02:56:08.000Z
Source/BlueprintSound/Classes/BlueprintSoundFunctions.h
getsetgames/BlueprintSound
4b6f034452bb5c7182eb5781bbf984f266e48d8c
[ "MIT" ]
null
null
null
Source/BlueprintSound/Classes/BlueprintSoundFunctions.h
getsetgames/BlueprintSound
4b6f034452bb5c7182eb5781bbf984f266e48d8c
[ "MIT" ]
5
2015-09-15T08:17:13.000Z
2021-07-11T02:44:44.000Z
// // Created by Derek van Vliet on 2015-03-16. // Copyright (c) 2015 Get Set Games Inc. All rights reserved. // #pragma once #include "UObject/Object.h" #include "UObject/ScriptMacros.h" #include "Sound/SoundClass.h" #include "BlueprintSoundFunctions.generated.h" UCLASS(NotBlueprintable) class UBlueprintSoundFunctions : public UObject { GENERATED_BODY() public: UFUNCTION(BlueprintCallable, meta = (Keywords = "sound sfx music audio volume"), Category = Sound) static void SetSoundClassVolume(USoundClass* SoundClass, float Volume); UFUNCTION(BlueprintPure, meta = (Keywords = "sound sfx music audio volume"), Category = Sound) static float GetSoundClassVolume(USoundClass* SoundClass); UFUNCTION(BlueprintCallable, meta = (Keywords = "sound sfx music audio pitch"), Category = Sound) static void SetSoundClassPitch(USoundClass* SoundClass, float Pitch); UFUNCTION(BlueprintPure, meta = (Keywords = "sound sfx music audio pitch"), Category = Sound) static float GetSoundClassPitch(USoundClass* SoundClass); UFUNCTION(BlueprintPure, meta = (Keywords = "sound sfx music audio background"), Category = Sound) static bool IsExternalBackgroundSoundActive(); };
35.848485
99
0.768385
[ "object" ]
7a80fc15fca50f1c473bc81a9680ae3f75e22b31
4,513
c
C
parse.c
donkomura/Donko9cc
db90b8bc49710b3387063333b770a7490cfb5616
[ "MIT" ]
null
null
null
parse.c
donkomura/Donko9cc
db90b8bc49710b3387063333b770a7490cfb5616
[ "MIT" ]
null
null
null
parse.c
donkomura/Donko9cc
db90b8bc49710b3387063333b770a7490cfb5616
[ "MIT" ]
null
null
null
#include "9cc.h" static int blockCount; Node *new_node(int ty, Node *lhs, Node *rhs) { Node *node = malloc(sizeof(Node)); node->ty = ty; node->lhs = lhs; node->rhs = rhs; return node; } Node *new_node_num(int ty) { Node *node = malloc(sizeof(Node)); node->ty = ND_NUM; node->val = ty; return node; } Node *new_node_indent(char *name) { Node *node = malloc(sizeof(Node)); node->ty = ND_IDENT; node->name = name; map_set(map, name, offset_count++); return node; } int consume(int ty) { Token *token = tokens->data[pos]; if (token->ty != ty) return 0; pos++; return 1; } // parser abstract syntax tree void program() { Token *token = tokens->data[pos]; if (token->ty == TK_EOF) return; Node *node = stmt(); vec_push(code, node); code_pos++; code->data[code_pos] = NULL; return program(); } Node *stmt() { Token *token = tokens->data[pos]; Node *node; if (consume('{')) { node = malloc(sizeof(Node)); node->ty = ND_BLOCK; Vector *vec = new_vector(); while (!consume('}')) { vec_push(vec, stmt()); vec->data[++blockCount] = NULL; } node->block = (__typeof__(node->block))vec; return node; } if (consume(TK_IF)) { node = malloc(sizeof(Node)); node->ty = ND_IF; if (consume('(')) { node->cond = expr(); if (!consume(')')) { error_at(token->input, "invalid syntax: no ')'"); } } node->then = stmt(); if (consume(TK_ELSE)) { node->els = stmt(); } return node; } if (consume(TK_WHILE)) { node = malloc(sizeof(Node)); node->ty = ND_WHILE; if (consume('(')) { node->cond = expr(); if (!consume(')')) { error_at(token->input, "invalid syntax: no ')'"); } } node->body = stmt(); return node; } if (consume(TK_FOR)) { node = malloc(sizeof(Node)); node->ty = ND_FOR; if (consume('(')) { node->init = expr(); if (!consume(';')) { error_at(token->input, "invalid syntax: no ')'"); } node->cond = expr(); if (!consume(';')) { error_at(token->input, "invalid syntax: no ')'"); } node->inc = expr(); if (!consume(')')) { error_at(token->input, "invalid syntax: no ')'"); } } node->body = stmt(); return node; } if (consume(TK_RETURN)) { node = malloc(sizeof(Node)); node->ty = ND_RETURN; node->lhs = expr(); } else { node = expr(); } if (!consume(';')) error_at(token->input, "This token may be ';'"); return node; } Node *expr() { return assign(); } Node *assign() { Node *node = equality(); if (consume('=')) node = new_node('=', node, assign()); return node; } Node *equality() { Node *node = relational(); for (;;) { if (consume(TK_EQ)) node = new_node(ND_EQ, node, relational()); else if (consume(TK_NE)) node = new_node(ND_NE, node, relational()); else return node; } } Node *relational() { Node *node = add(); for (;;) { if (consume(TK_GE)) node = new_node(ND_GE, node, add()); else if (consume(TK_LE)) node = new_node(ND_LE, node, add()); else if (consume(TK_GT)) node = new_node(ND_GT, node, add()); else if (consume(TK_LT)) node = new_node(ND_LT, node, add()); else return node; } } Node *add() { Node *node = mul(); for (;;) { if (consume('+')) node = new_node('+', node, mul()); else if (consume('-')) node = new_node('-', node, mul()); else return node; } } Node *mul() { Node *node = unary(); for (;;) { if (consume('*')) node = new_node('*', node, unary()); else if (consume('/')) node = new_node('/', node, unary()); else return node; } } Node *unary() { for (;;) { if (consume('+')) { return term(); } if (consume('-')) { return new_node('-', new_node_num(0), term()); } return term(); // 単項演算子なし } } Node *term() { Token *token = tokens->data[pos]; if (consume('(')) { Node *node = expr(); if (!consume(')')) { error_at(token->input, "invalid syntax: no ')'"); } return node; } if (token->ty == TK_NUM) { token = tokens->data[pos++]; return new_node_num(token->val); } if (token->ty == TK_IDENT) { token = tokens->data[pos++]; return new_node_indent(token->name); } token = tokens->data[pos++]; error_at(token->input, "invalid token"); }
19.204255
57
0.524928
[ "vector" ]
a36e4a5fdc2652d1aa0221a9aa4008b81ceae5f8
5,576
h
C
include/rw/_autoptr.h
isabella232/stdcxx
b0b0cab391b7b1f2d17ef4342aeee6b792bde63c
[ "Apache-2.0" ]
53
2015-01-13T05:46:43.000Z
2022-02-24T23:46:04.000Z
include/rw/_autoptr.h
mann-patel/stdcxx
a22c5192f4b2a8b0b27d3588ea8f6d1faf8b037a
[ "Apache-2.0" ]
1
2021-11-04T12:35:39.000Z
2021-11-04T12:35:39.000Z
include/rw/_autoptr.h
isabella232/stdcxx
b0b0cab391b7b1f2d17ef4342aeee6b792bde63c
[ "Apache-2.0" ]
33
2015-07-09T13:31:00.000Z
2021-11-04T12:12:20.000Z
// -*- C++ -*- /*************************************************************************** * * _autoptr.h - definition of the class template auto_ptr * * This is an internal header file used to implement the C++ Standard * Library. It should never be #included directly by a program. * * $Id$ * *************************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ #ifndef _RWSTD_RW_AUTOPTR_H_INCLUDED #define _RWSTD_RW_AUTOPTR_H_INCLUDED #ifndef _RWSTD_RW_DEFS_H_INCLUDED # include <rw/_defs.h> #endif // _RWSTD_RW_DEFS_H_INCLUDED _RWSTD_NAMESPACE (__rw) { template <class _TypeT> struct __rw_nonvoid_ref { typedef _TypeT& _C_ref; }; _RWSTD_SPECIALIZED_CLASS struct __rw_nonvoid_ref<void> { // makes the declaration of auto_ptr<void>::operator*() well-formed // (the function definition itself may still be ill-formed and must // not be instantiated) typedef void _C_ref; }; #ifndef _RWSTD_NO_CV_VOID_SPECIALIZATIONS _RWSTD_SPECIALIZED_CLASS struct __rw_nonvoid_ref<const void> { typedef void _C_ref; }; _RWSTD_SPECIALIZED_CLASS struct __rw_nonvoid_ref<volatile void> { typedef void _C_ref; }; _RWSTD_SPECIALIZED_CLASS struct __rw_nonvoid_ref<const volatile void> { typedef void _C_ref; }; #endif // _RWSTD_NO_CV_VOID_SPECIALIZATIONS } // namespace __rw _RWSTD_NAMESPACE (std) { // 20.4.5 - Template class auto_ptr template <class _TypeT> class auto_ptr; // 20.4.5, p2 (defined outside of auto_ptr<> according to the proposed // resolution of lwg issue 127) template <class _TypeT> class auto_ptr_ref { template <class _TypeU> friend class auto_ptr; // implicit conversion from auto_ptr<U> available only // if U* is implicitly convertible to T* (via inheritance) template <class _TypeU> auto_ptr_ref (auto_ptr<_TypeU>& __rhs, const _TypeU* = 0) _THROWS (()) : _C_ptr (_RWSTD_REINTERPRET_CAST (auto_ptr<_TypeT>&, __rhs)) { } // reference to the owning auto_ptr object auto_ptr<_TypeT>& _C_ptr; }; template<class _TypeT> class auto_ptr { public: typedef _TypeT element_type; // 20.4.5.1, p1 explicit auto_ptr (element_type* __p = 0) _THROWS (()) : _C_ptr (__p) { } // 20.4.5.1, p2 auto_ptr (auto_ptr& __rhs) _THROWS (()) : _C_ptr (__rhs.release ()) { } // 20.4.5.1, p7 auto_ptr& operator= (auto_ptr& __rhs) _THROWS (()) { reset (__rhs.release ()); return *this; } // 20.4.5.1, p13 ~auto_ptr () _THROWS (()) { delete _C_ptr; } // 20.4.5.1, p4 template <class _TypeU> auto_ptr (auto_ptr<_TypeU>& __rhs) _THROWS (()) : _C_ptr (__rhs.release ()) { } // 20.4.5.1, p10 template <class _TypeU> auto_ptr& operator= (auto_ptr<_TypeU>& __rhs) _THROWS (()) { reset (__rhs.release ()); return *this; } // 20.4.5.3, p3 template <class _TypeU> operator auto_ptr_ref<_TypeU>() _THROWS (()) { // convertible only if T* is implicitly convertible to U* return auto_ptr_ref<_TypeU>(*this, _C_ptr); } // 20.4.5.3, p4 template <class _TypeU> operator auto_ptr<_TypeU>() _THROWS (()) { return auto_ptr<_TypeU>(release ()); } // 20.4.5.2, p1 typename _RW::__rw_nonvoid_ref<element_type>::_C_ref operator* () const _THROWS (()) { _RWSTD_ASSERT (0 != get ()); return *get (); } #ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN // 20.4.5.2, p3 element_type* operator->() const _THROWS (()) { // avoid using the _RWSTD_OPERATOR_ARROW() helper macro // (defined in terms of operator*()) in order to permit // auto_ptr<void>::operator->() to be instantiated return _C_ptr; } #endif // _RWSTD_NO_NONCLASS_ARROW_RETURN // 20.4.5.2, p4 element_type* get () const _THROWS (()) { return _C_ptr; } // 20.4.5.2, p5 element_type* release () _THROWS (()) { element_type* __tmp = _C_ptr; _C_ptr = 0; return __tmp; } // 20.4.5.2, p7 void reset (element_type* __p = 0) _THROWS (()) { if (_C_ptr != __p) { delete _C_ptr; _C_ptr = __p; } } // 20.4.5.3, p1 auto_ptr (auto_ptr_ref<element_type> __r) _THROWS (()) : _C_ptr (__r._C_ptr.release ()) { } // 20.4.5.3, p? - follows lwg issue 127 auto_ptr& operator= (auto_ptr_ref<element_type> __rhs) _THROWS (()) { reset (__rhs._C_ptr.release ()); return *this; } private: element_type* _C_ptr; }; } // namespace std #endif // _RWSTD_RW_AUTOPTR_H_INCLUDED
25.230769
76
0.61944
[ "object" ]
a37963f5e4e5be4873b77097fc0d364764b3f45f
3,035
h
C
util/strings.h
kirmorozov/pecl-database-mysql_xdevapi
214e0b13dcea17dfa86000092860e3fb35f02257
[ "PHP-3.01" ]
14
2017-11-16T03:13:31.000Z
2022-03-10T14:59:53.000Z
util/strings.h
kirmorozov/pecl-database-mysql_xdevapi
214e0b13dcea17dfa86000092860e3fb35f02257
[ "PHP-3.01" ]
8
2018-03-02T06:08:27.000Z
2022-01-18T10:34:43.000Z
util/strings.h
kirmorozov/pecl-database-mysql_xdevapi
214e0b13dcea17dfa86000092860e3fb35f02257
[ "PHP-3.01" ]
18
2018-03-01T13:45:16.000Z
2022-03-10T06:30:02.000Z
/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Darek Slusarczyk <marines@php.net> | +----------------------------------------------------------------------+ */ #ifndef MYSQL_XDEVAPI_UTIL_STRINGS_H #define MYSQL_XDEVAPI_UTIL_STRINGS_H #include "php_api.h" extern "C" { struct st_mysqlnd_string; struct st_mysqlnd_const_string; } #include <string> #include <string_view> #include <sstream> #include <cstring> #include <boost/format.hpp> #include "allocator.h" #include "types.h" namespace mysqlx { namespace util { using string_view = std::string_view; template<typename CharT, typename Traits = std::char_traits<CharT>> using basic_string = std::basic_string<CharT, Traits, allocator<CharT>>; using string = basic_string<char>; using wstring = basic_string<wchar_t>; using strings = vector<string>; using stringset = set<string>; template<typename CharT, typename Traits = std::char_traits<CharT>> using basic_ostringstream = std::basic_ostringstream<CharT, Traits, allocator<CharT>>; using ostringstream = basic_ostringstream<char>; template<typename CharT, typename Traits = std::char_traits<CharT>> using basic_istringstream = std::basic_istringstream<CharT, Traits, allocator<CharT>>; using istringstream = basic_istringstream<char>; template<typename CharT, typename Traits = std::char_traits<CharT>> using basic_stringstream = std::basic_stringstream<CharT, Traits, allocator<CharT>>; using stringstream = basic_stringstream<char>; std::ostream& operator<<(std::ostream& os, const string& str); template<typename CharT, typename Traits = std::char_traits<CharT>> using basic_formatter = boost::basic_format<CharT, Traits, allocator<CharT>>; using formatter = basic_formatter<char>; using wformatter = basic_formatter<wchar_t>; using std_strings = std::vector<std::string>; using std_stringset = std::set<std::string>; void single_separator_split( util::vector< util::string >& output, const util::string& input, const char separator ); } // namespace util } // namespace mysqlx #endif // MYSQL_XDEVAPI_UTIL_STRINGS_H
36.566265
86
0.609885
[ "vector" ]
a37a257c58f4af1419146a51ec71cc9c5f1cabe0
461
h
C
project_history/version1/Plot.h
rodohanna/Simulation-Engine
1ff3acf5949a5651f862cac90a44eb7e0d044e9f
[ "MIT" ]
null
null
null
project_history/version1/Plot.h
rodohanna/Simulation-Engine
1ff3acf5949a5651f862cac90a44eb7e0d044e9f
[ "MIT" ]
null
null
null
project_history/version1/Plot.h
rodohanna/Simulation-Engine
1ff3acf5949a5651f862cac90a44eb7e0d044e9f
[ "MIT" ]
null
null
null
#ifndef PLOT_h_ #define PLOT_h_ #include <SDL2/SDL.h> #include "GameEntity.h" #include "GameEvent.h" #include "GameState.h" #include "TileMap.h" #include "EventBus.h" struct Plot : GameEntity, Subscriber { Plot(TileMap *t); ~Plot(); bool update(GameState &state); void render(SDL_Renderer *renderer, SDL_Rect &camera); void handleEvent(GameEvent *e, GameState *state); TileMap *mTileMap; // debug SDL_Rect mDebugRect; }; #endif
20.954545
58
0.694143
[ "render" ]
a3913106ad138795e2ce1758f7fe45cf3af8edf8
729
h
C
CPP/CPP_Advanced/01_PointersAndReferences/04_Profits/ProfitReport.h
Knightwalker/Knowledgebase
00c6dea5e52c0d2b0fe0dc3b7b5c298d445f0161
[ "MIT" ]
null
null
null
CPP/CPP_Advanced/01_PointersAndReferences/04_Profits/ProfitReport.h
Knightwalker/Knowledgebase
00c6dea5e52c0d2b0fe0dc3b7b5c298d445f0161
[ "MIT" ]
null
null
null
CPP/CPP_Advanced/01_PointersAndReferences/04_Profits/ProfitReport.h
Knightwalker/Knowledgebase
00c6dea5e52c0d2b0fe0dc3b7b5c298d445f0161
[ "MIT" ]
null
null
null
#ifndef PROFIT_REPORT_H #define PROFIT_REPORT_H #include "Company.h" #include "ProfitCalculator.h" #include <map> #include <vector> #include <string> #include <sstream> std::string getProfitReport(Company* fromInclusive, Company* toInclusive, std::map<int, ProfitCalculator>& profitCalculatorsByCompany) { std::ostringstream report; while (true) { int id = fromInclusive->getId(); auto it = profitCalculatorsByCompany.find(id); if (it != profitCalculatorsByCompany.end()) { int profit = it->second.calculateProfit(*fromInclusive); report << fromInclusive->getName() << " = " << profit << std::endl; } if (fromInclusive++ == toInclusive) { break; } } return report.str(); } #endif // !PROFIT_REPORT_H
22.78125
136
0.711934
[ "vector" ]
a394ab84ff86098b89260a6d84ed351c4bca4225
390
h
C
src/players/ai/EasyAI.h
droplet92/reversi
3731926a1fa1ef0bd7198e9283cf84503f96ec4f
[ "MIT" ]
null
null
null
src/players/ai/EasyAI.h
droplet92/reversi
3731926a1fa1ef0bd7198e9283cf84503f96ec4f
[ "MIT" ]
null
null
null
src/players/ai/EasyAI.h
droplet92/reversi
3731926a1fa1ef0bd7198e9283cf84503f96ec4f
[ "MIT" ]
null
null
null
#pragma once #include "GameAI.h" #include "../../components/board/GameBoard.h" #include "../../utilities/Logger.h" #include <vector> namespace reversi { class EasyAI : public GameAI { public: EasyAI(const PlayerType type) :GameAI(type) {} int think([[maybe_unused]] GameBoard&) final { return 1; } void printDifficulty() const final { Logger::instance().write("EasyAI"); } }; }
21.666667
76
0.684615
[ "vector" ]
a3a6eeb46062f6952b4086d8a3ec5f1e11d9c0b3
7,369
c
C
d/deku/town/info_office.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-07-19T05:24:44.000Z
2021-11-18T04:08:19.000Z
d/deku/town/info_office.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
4
2021-03-15T18:56:39.000Z
2021-08-17T17:08:22.000Z
d/deku/town/info_office.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-09-12T06:22:38.000Z
2022-01-31T01:15:12.000Z
#include <std.h> #include <daemons.h> #define LF_AR "deku_names_seeking_array" #define LF_RW "deku_names_seeking_rewards_array" #define VCONTRACTS "valid_deku_contracts" inherit ROOM; int guards_out; void make_list(); void create() { ::create(); set_light(2); set_indoors(1); set_terrain(WOOD_BUILDING); set_travel(DIRT_ROAD); set_short("%^RED%^Verbobone Information Office%^RESET%^"); set_long("This building is massive, its walls and ceiling formed "+ "from heavy wooden logs. The floor of this building is "+ "constructed of several flat slabs of oak that have been "+ "carefully placed together to create a solid surface. Desks "+ "line the east wall and numerous pieces of parchment litter "+ "each desk. A large round table sits in the center of this "+ "building, its surface marred with stains from recent spills, "+ "apparently of both food and drink. Your first thought is "+ "that it serves as a dining table for the individuals who "+ "work night and day here, trying to recover the decades of "+ "lost people of verbobone and its surroundings. The north "+ "wall of this room is littered with large pieces of parchment "+ "but one large %^RED%^notice%^RESET%^ "+ "immediately catches your attention. The door "+ "leading out of this building is an open doorway, reflecting "+ "the fact that this building is never closed."); set_listen("default","The excited chatter of people eager to find lost loved ones fills this room."); set_smell("default","Body odor has mixed with the scent of "+ "fresh ink and parchment, assaulting this room."); set_exits((["west":"/d/deku/town/road11"])); set_items(([ ({"notice","notices"}) : ({"%^RED%^These are large "+ "pieces of parchment that have been attached to the north "+ "wall. A large central one really catches your attention, you "+ "could probably read it.",(:TO,"display_info":),"wizish"}), ] )); guards_out = 0; new("/d/deku/monster/elite_guard")->move(TO); new("/d/deku/monster/elite_guard")->move(TO); if(!present("dariul")) { find_object_or_load("/d/deku/monster/dariul_tymor")->move(TO); } make_list(); } void make_list() { int x, tmp; string *people,person,*rewards,tmp2; tmp = sizeof(SAVE_D->query_array(LF_AR)); if(tmp < 4) { for(x = 0;x < 4 - tmp;x++) { if(sizeof(SAVE_D->query_array("deku_dead_names_array")) < 1 || sizeof(SAVE_D->query_array("deku_missing_names_array")) < 1) { "/d/deku/inherits/name_gen_d.c"->make_dead_name_list(); "/d/deku/inherits/name_gen_d.c"->make_missing_name_list(); } people = random(2) ? SAVE_D->query_array("deku_dead_names_array") : SAVE_D->query_array("deku_missing_names_array"); person = people[random(sizeof(people))]; if(member_array(person,SAVE_D->query_array(LF_AR)) != -1) { x--; continue; } SAVE_D->set_value(LF_AR,person); SAVE_D->set_value(LF_RW,300 + random(300) + random(300) + random(200)); } } } void init() { ::init(); add_action("display_contracts","display"); add_action("void_contract","void"); } void query_guards_out() { return guards_out; } int add_guards_out(int x) { guards_out += x; return 1; } void do_rewards() { int x; string tmp2, *people, *rewards; write("Rewards are offered for information leading to the "+ "location of the following individuals, dead or alive.\n"); write("%^BLUE%^=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"); people = SAVE_D->query_array(LF_AR); rewards = SAVE_D->query_array(LF_RW); for(x = 0;x < sizeof(people);x++) { tmp2 = sprintf("%%^RED%%^ %-20s %%^YELLOW%%^ %2d%%^RESET%%^ gold coins.",capitalize(people[x]),rewards[x]); write(tmp2); } } void display_info() { string str, tmp; write("%^RED%^=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=%^RESET%^\n"); str = "The city of verbobone is currently offering contracts "+ "to invidiuals interested in investing gold for the furthering "+ "of our humble town. You can now %^CYAN%^<buy contract for # gold>%^RESET%^. "+ "The town will offer contracts of up to 5,000 gold "+ "pieces in value and honor those that have reached up to "+ "twice their original worth in value. You need simply to give them "+ "to our Dariul while he is in to collect the gold for the "+ "contract. You may have him %^CYAN%^<estimate contract>%^RESET%^"+ " to get the current worth of a contract that you carry."; if(avatarp(TP)) { tmp = "\n\nAVATARS ONLY - You may %^CYAN%^<display "+ "contracts>%^RESET%^ to view those that have been "+ "sold by ID (A long string of random nums & letters.) - "+ "You may %^CYAN%^<void contract #>%^RESET%^ to void anything in "+ "that list. Please have a valid reason to void a contract."; } if(tmp) { str += tmp; } return str; //"'request a guard' from him or <show> him someone who was "+ //"missing that you have brought in and if you owe a fine "+ //"you may %^RED%^<pay fine>%^RESET%^%^CYAN%^. "); } int read_list(string str) { if(!str) { return 0; } // if(str == "notices") { // write("Read %^CYAN%^<seeking notice>%^RESET%^, "+ // "%^CYAN%^<dead notice>%^RESET%^, or %^CYAN%^<returned "+ // "noticed>%^RESET%^"); // return 1; //} /*if(str == "seeking notice") { do_rewards(); return 1; } if(str == "dead notice") { write("list of dead people reported already and dates associated with them"); return 1; } if(str == "returned notice") { write("list of missing people returned already"); return 1; }*/ } void display_contracts(string str) { int x; string *tmp, tmp2; if(!str) return 0; if(!avatarp(TP)) return 0; if(str == "contracts" || str == "contract" || str == "bonds") { write("The following bonds have been recorded as sold and "+ "not yet claimed."); tmp = SAVE_D->query_array(VCONTRACTS); for(x = 0;x < sizeof(tmp);x++) { if(tmp2) { tmp2 += x +":%^BOLD%^%^GREEN%^ "+tmp[x]+"\n"; continue; } tmp2 = x + ":%^BOLD%^%^GREEN%^ "+tmp[x]+"\n"; continue; } if(tmp2) { TP->more(explode(tmp2,"\n")); } return 1; } return 0; } void void_contract(string str) { string tmp,*tmp2; int num; if(!str) return 0; if(sscanf(str,"%s %d",tmp,num) == 2) { if(tmp == "contracts" || tmp == "contract" || tmp == "bonds") { tmp2 = SAVE_D->query_array(VCONTRACTS); if(tmp2[num] != -1) { SAVE_D->remove_name_from_array(VCONTRACTS,tmp2[num]); write("Contract "+tmp2[num]+" officially rendered "+ "void."); return 1; } write("No such contract is currently valid. Try again."); return 1; } return 0; } return 0; } void reset() { ::reset(); if(!present("dariul")) { find_object_or_load("/d/deku/monster/dariul_tymor")->move(TO); } }
34.924171
128
0.585968
[ "solid" ]
a3aaba50789d964b8adb9096f5a00a41c6bd54ee
4,205
h
C
node.h
mikahlbk/ScePlantCells
666d643e08efa30d4032e0544ee10ba6cd00b03f
[ "MIT" ]
null
null
null
node.h
mikahlbk/ScePlantCells
666d643e08efa30d4032e0544ee10ba6cd00b03f
[ "MIT" ]
null
null
null
node.h
mikahlbk/ScePlantCells
666d643e08efa30d4032e0544ee10ba6cd00b03f
[ "MIT" ]
null
null
null
//node.h //===================== // Include Guards #ifndef NODE_H //if node.h hasn't been included yet #define NODE_H // define it so the compiler knows //===================== // Forward Declarations class Wall_Node; class Cell; //===================== // Include Declarations #include <iostream> #include <vector> #include "phys.h" #include "coord.h" //===================== class Node { protected: //variables that will be shared by all nodes Coord my_loc; Coord new_force; Cell* my_cell; public: //functions that you will want performed on all nodes //Constructor Node(Coord loc, Cell* my_cell); //some functions you can define in base class because // all nodes will use the exact same function virtual Coord get_Location(); virtual Coord get_Force(); virtual void update_Location(); //other functions might be executed differently based on // which node you are. Thus define as "pure virtual" and // properly define them in a derived class virtual void calc_Forces() = 0; virtual ~Node(); }; class Cyt_Node: public Node { private: //if don't need to keep any more information then just leave blank public: Cyt_Node(Coord loc, Cell* my_cell); virtual void calc_Forces(); Coord calc_Morse_II(vector<Cyt_Node*>& cyt_nodes); Coord calc_Morse_MI(Wall_Node* curr); Coord morse_Equation(Cyt_Node* cyt); Coord morse_Equation(Wall_Node* wall); ~Cyt_Node(); }; class Wall_Node: public Node { protected: //variables that will be shared by all wall nodes Wall_Node* left; Wall_Node* right; double my_angle; double cross_Prod; Coord cyt_force; public: //function that you want performed on all wall nodes // Constructors Wall_Node(Coord loc, Cell* my_cell); Wall_Node(Coord loc, Cell* my_cell, Wall_Node* left, Wall_Node* right); //maybe could define them here if corner and edge both perform // these functions identically // Getters and Setters virtual double get_Angle(); virtual Coord get_CytForce(); virtual Wall_Node* get_Left_Neighbor(); virtual Wall_Node* get_Right_Neighbor(); virtual void set_Left_Neighbor(Wall_Node* new_Left); virtual void set_Right_Neighbor(Wall_Node* new_Right); // Force Calculations virtual void calc_Forces(); virtual void update_Angle(); virtual Coord calc_Morse_SC(); virtual Coord calc_Morse_DC(); virtual Coord calc_Bending(); virtual Coord morse_Equation(Cyt_Node* cyt); virtual Coord morse_Equation(Wall_Node* wall); virtual Coord linear_Equation(Wall_Node* wall, double k_Linear); virtual Coord bending_Equation_Center(); virtual Coord bending_Equation_Left(); virtual Coord bending_Equation_Right(); //otherwise set as pure virtual virtual Coord calc_Linear() = 0; virtual double get_Equi_Angle() = 0; virtual double get_linearSpring() = 0; virtual double get_bendingSpring() = 0; virtual bool is_Corner() = 0; virtual ~Wall_Node(); }; class Corner_Node: public Wall_Node { public: Corner_Node(Coord loc, Cell* my_cell); Corner_Node(Coord loc, Cell* my_cell, Wall_Node* left, Wall_Node* right); virtual double get_Equi_Angle(); virtual double get_linearSpring(); virtual double get_bendingSpring(); virtual Coord calc_Linear(); virtual bool is_Corner(); ~Corner_Node(); }; class Flank_Node: public Wall_Node { public: Flank_Node(Coord loc, Cell* my_cell); Flank_Node(Coord loc, Cell* my_cell, Wall_Node* left, Wall_Node* right); virtual Coord calc_Linear(); virtual double get_Equi_Angle(); virtual double get_linearSpring(); virtual double get_bendingSpring(); virtual bool is_Corner(); ~Flank_Node(); }; class End_Node: public Wall_Node { public: End_Node(Coord loc, Cell* my_cell); End_Node(Coord loc, Cell* my_cell, Wall_Node* left, Wall_Node* right); virtual Coord calc_Linear(); virtual double get_Equi_Angle(); virtual double get_linearSpring(); virtual double get_bendingSpring(); virtual bool is_Corner(); ~End_Node(); }; //=========================== #endif
29.201389
81
0.682759
[ "vector" ]
a3ace68ff595ac0e54bd3442e60451c09bd802a3
2,275
c
C
d/dagger/drow/temple/mon/pest.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-07-19T05:24:44.000Z
2021-11-18T04:08:19.000Z
d/dagger/drow/temple/mon/pest.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
4
2021-03-15T18:56:39.000Z
2021-08-17T17:08:22.000Z
d/dagger/drow/temple/mon/pest.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-09-12T06:22:38.000Z
2022-01-31T01:15:12.000Z
#include <std.h> inherit "std/monster"; object owner; int FLAG; void create() { :: create(); set_name("spider"); set_id(({ "spider","black spider","pest" })); set_short("%^RED%^Small spider%^RESET%^"); set_long( "A small black spider which seems to enjoy climbing on " "you.%^RESET%^" ); set_gender("male"); set_level(5); set_weight(30); set_overall_ac(-9); set_body_type("arachnid"); set_race("spider"); set_class("fighter"); set_stats("strength",10); set_stats("constitution",10); set_stats("dexterity",10); set_stats("wisdom",15); set_stats("intelligence",15); set_stats("charisma",5); set_exp(1100); set_max_hp(60); set_hp(60); set("aggressive","aggfunc"); set_emotes(2,({ "%^GREEN%^The spider climbs up your leg.%^RESET%^", "%^GREEN%^The spider climbs up your arm.%^RESET%^", "%^GREEN%^The spider climbs inside your clothes.%^RESET%^", "%^GREEN%^The spider climbs across your neck.%^RESET%^", "%^GREEN%^The spider climbs into your hair.%^RESET%^", "%^GREEN%^The spider climbs across your back.%^RESET%^", "%^GREEN%^The spider tries to climb into your ear.%^RESET%^" }),0); } void aggfunc() { if(FLAG == 0) { owner = TP; FLAG = 1; write( "%^GREEN%^The small spider clambers up your " "leg.%^RESET%^" ); } } void heart_beat() { object env; ::heart_beat(); if(!objectp(TO)) { return; } if(!objectp(ETO)) { return; } env = environment(this_object()); if(!owner) return; if(FLAG == 0) return; if(owner->query_ghost()) { FLAG == 0; TO->remove(); return; } if(present(owner,env)) { if(random(10) < 3) { owner->add_hp(-(random(4)+1)); owner->add_poisoning(2); this_object()->add_hp(5); return; } else { return; } } else { if(environment(TO) !=environment(owner)) { tell_room(environment(TO), "The spider wanders after " +owner->query_cap_name()+".\n" ); tell_room(environment(owner), "A small spider enters.\n" ); move_object(environment(owner)); return; } } }
24.728261
64
0.549451
[ "object" ]
a3ad552b752cd506ac565de5f60edd89b5830810
4,128
h
C
BlackVision/LibBlackVision/Source/Engine/Models/Plugins/Simple/TextPlugins/DefaultText3DPlugin.h
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
[ "MIT" ]
1
2022-01-28T11:43:47.000Z
2022-01-28T11:43:47.000Z
BlackVision/LibBlackVision/Source/Engine/Models/Plugins/Simple/TextPlugins/DefaultText3DPlugin.h
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
[ "MIT" ]
null
null
null
BlackVision/LibBlackVision/Source/Engine/Models/Plugins/Simple/TextPlugins/DefaultText3DPlugin.h
black-vision-engine/bv-engine
85089d41bb22afeaa9de070646e12aa1777ecedf
[ "MIT" ]
null
null
null
#pragma once #include "Mathematics/Transform/MatTransform.h" #include "Engine/Models/Plugins/Channels/DefaultPixelShaderChannel.h" #include "Engine/Models/Plugins/Channels/DefaultVertexShaderChannel.h" #include "Engine/Models/Plugins/Channels/Transform/DefaultTransformChannel.h" #include "Engine/Models/Plugins/Parameters/ParametersFactory.h" #include "Engine/Models/Plugins/ParamValModel/DefaultPluginParamValModel.h" #include "Engine/Models/Plugins/Descriptor/BasePluginDescriptor.h" #include "Engine/Models/Plugins/Plugin.h" #include "Engine/Events/BaseEvent.h" #include "Assets/Font/3D/FontAsset3D.h" #include "Assets/Font/3D/FontAsset3DDesc.h" #include "Assets/Font/TextHelper.h" namespace bv { namespace model { typedef ParamEnum< TextAlignmentType > ParamEnumTAT; DEFINE_PTR_TYPE( ParamEnumTAT ); // ***************************** DESCRIPTOR ********************************** class DefaultText3DPluginDesc : public BasePluginDescriptor { public: DefaultText3DPluginDesc (); virtual IPluginPtr CreatePlugin ( const std::string & name, IPluginPtr prev, ITimeEvaluatorPtr timeEvaluator ) const override; virtual DefaultPluginParamValModelPtr CreateDefaultModel ( ITimeEvaluatorPtr timeEvaluator ) const override; static std::string UID (); static std::string TextureName (); }; // ***************************** PLUGIN ********************************** /// @ingroup PluginsList class DefaultText3DPlugin : public BasePlugin { public: struct PARAMS { static const std::string TEXT; static const std::string FONT_SIZE; static const std::string NEW_LINE_SIZE; static const std::string SPACING; static const std::string ALIGNEMENT; static const std::string USE_KERNING; static const std::string ALIGN_CHARACTER; static const std::string TEXT_BOX; static const std::string USE_TEXT_BOX; }; private: DefaultPixelShaderChannelPtr m_psc; DefaultVertexShaderChannelPtr m_vsc; VertexAttributesChannelPtr m_vaChannel; ParamWStringPtr m_textParam; ValueBoolPtr m_useKerningValue; ValueFloatPtr m_spacingValue; ValueFloatPtr m_fontSize; ValueFloatPtr m_newLineSize; ParamEnumTATPtr m_alignmentParam; ValueIntPtr m_alignCharacter; FontAsset3DConstPtr m_fontAsset; void SetText ( const std::wstring & newText ); void RebuildText (); public: virtual void Update ( TimeType t ) override; virtual bool LoadResource ( AssetDescConstPtr assetDescr ) override; virtual IVertexAttributesChannelConstPtr GetVertexAttributesChannel () const override; virtual IPixelShaderChannelPtr GetPixelShaderChannel () const override; virtual IVertexShaderChannelConstPtr GetVertexShaderChannel () const override; private: virtual mathematics::RectConstPtr GetAABB ( const glm::mat4 & trans ) const override; void ScaleToMaxTextLength (); public: explicit DefaultText3DPlugin ( const std::string & name, const std::string & uid, IPluginPtr prev, DefaultPluginParamValModelPtr model ); ~DefaultText3DPlugin (); virtual bool SetPrevPlugin ( IPluginPtr plugin ); std::wstring GetText () const; static bool SetText ( IPluginPtr, const std::wstring& ); }; } // model } // bv
37.527273
182
0.578488
[ "model", "transform", "3d" ]
a3baa5603acdd614e7e005d2e58322a96e781edf
3,467
h
C
DataMgr/ForeignStorage/TypedParquetDetectBuffer.h
omnisci/mapd-core
cde582ebc3edba3fb86bacefa5bd9b3418a367b4
[ "Apache-2.0" ]
266
2018-09-27T06:11:36.000Z
2019-05-10T15:03:55.000Z
DataMgr/ForeignStorage/TypedParquetDetectBuffer.h
omnisci/mapd-core
cde582ebc3edba3fb86bacefa5bd9b3418a367b4
[ "Apache-2.0" ]
96
2018-10-01T18:30:31.000Z
2019-05-13T14:41:11.000Z
DataMgr/ForeignStorage/TypedParquetDetectBuffer.h
omnisci/mapd-core
cde582ebc3edba3fb86bacefa5bd9b3418a367b4
[ "Apache-2.0" ]
38
2018-10-04T01:02:54.000Z
2019-05-09T04:23:35.000Z
/* * Copyright 2022 HEAVY.AI, 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. */ #pragma once #include "DataMgr/AbstractBuffer.h" namespace foreign_storage { class TypedParquetDetectBuffer : public Data_Namespace::AbstractBuffer { public: TypedParquetDetectBuffer(); void read(int8_t* const destination, const size_t num_bytes, const size_t offset = 0, const Data_Namespace::MemoryLevel destination_buffer_type = Data_Namespace::CPU_LEVEL, const int destination_device_id = -1) override; void write( int8_t* source, const size_t num_bytes, const size_t offset = 0, const Data_Namespace::MemoryLevel source_buffer_type = Data_Namespace::CPU_LEVEL, const int source_device_id = -1) override; void reserve(size_t additional_num_bytes) override; void append( int8_t* source, const size_t num_bytes, const Data_Namespace::MemoryLevel source_buffer_type = Data_Namespace::CPU_LEVEL, const int device_id = -1) override; void reserveNumElements(size_t additional_num_elements); int8_t* getMemoryPtr() override; size_t pageCount() const override; size_t pageSize() const override; size_t reservedSize() const override; Data_Namespace::MemoryLevel getType() const override; template <typename T> void setConverterType(std::function<std::string(const T&)> element_to_string) { data_to_string_converter_ = std::make_unique<DataTypeToStringConverter<T>>(element_to_string); } const std::vector<std::string>& getStrings() { return buffer_; } void appendValue(const std::string& value) { buffer_.push_back(value); } private: class AbstractDataTypeToStringConverter { public: virtual ~AbstractDataTypeToStringConverter() = default; virtual std::vector<std::string> convert(const int8_t* bytes, const size_t num_bytes) = 0; }; template <typename T> class DataTypeToStringConverter : public AbstractDataTypeToStringConverter { public: DataTypeToStringConverter(std::function<std::string(const T&)> element_to_string) : element_to_string_(element_to_string) {} std::vector<std::string> convert(const int8_t* bytes, const size_t num_bytes) override { CHECK(num_bytes % sizeof(T) == 0); const size_t num_elements = num_bytes / sizeof(T); const auto elements = reinterpret_cast<const T*>(bytes); std::vector<std::string> strings; strings.reserve(num_elements); for (size_t i = 0; i < num_elements; ++i) { strings.emplace_back(element_to_string_(elements[i])); } return strings; } private: std::function<std::string(const T&)> element_to_string_; }; std::vector<std::string> buffer_; std::unique_ptr<AbstractDataTypeToStringConverter> data_to_string_converter_; }; } // namespace foreign_storage
33.660194
87
0.702913
[ "vector" ]
a3c16788435d16456e5b80dd9d3b90081f754bd5
1,191
h
C
clang-tools-extra/clangd/InlayHints.h
LaudateCorpus1/llvm-project
ff2e0f0c1112558b3f30d8afec7c9882c33c79e3
[ "Apache-2.0" ]
null
null
null
clang-tools-extra/clangd/InlayHints.h
LaudateCorpus1/llvm-project
ff2e0f0c1112558b3f30d8afec7c9882c33c79e3
[ "Apache-2.0" ]
null
null
null
clang-tools-extra/clangd/InlayHints.h
LaudateCorpus1/llvm-project
ff2e0f0c1112558b3f30d8afec7c9882c33c79e3
[ "Apache-2.0" ]
null
null
null
//===--- InlayHints.h --------------------------------------------*- C++-*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Support for the proposed "inlay hints" LSP feature. // The version currently implemented is the one proposed here: // https://github.com/microsoft/vscode-languageserver-node/pull/609/. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INLAYHINTS_H #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INLAYHINTS_H #include "Protocol.h" #include <vector> namespace clang { namespace clangd { class ParsedAST; /// Compute and return inlay hints for a file. /// If RestrictRange is set, return only hints whose location is in that range. std::vector<InlayHint> inlayHints(ParsedAST &AST, llvm::Optional<Range> RestrictRange); } // namespace clangd } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INLAYHINTS_H
35.029412
80
0.604534
[ "vector" ]
a3e15362db5b50bfbbc89ee24daef4a99422483d
5,107
h
C
include/lol/private/base/string.h
aaronstjohn/lol
f554ecaf3c9e921372a14297433627f2a5a35a55
[ "WTFPL" ]
32
2016-09-05T07:10:20.000Z
2021-12-04T08:43:21.000Z
include/lol/private/base/string.h
aaronstjohn/lol
f554ecaf3c9e921372a14297433627f2a5a35a55
[ "WTFPL" ]
8
2016-09-26T14:59:38.000Z
2022-03-02T14:27:22.000Z
include/lol/private/base/string.h
aaronstjohn/lol
f554ecaf3c9e921372a14297433627f2a5a35a55
[ "WTFPL" ]
14
2016-11-08T15:13:10.000Z
2021-12-06T17:44:09.000Z
// // Lol Engine // // Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net> // © 2013—2015 Benjamin “Touky” Huet <huet.benjamin@gmail.com> // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it // and/or modify it under the terms of the Do What the Fuck You Want // to Public License, Version 2, as published by the WTFPL Task Force. // See http://www.wtfpl.net/ for more details. // #pragma once // // The string tools // ———————————————— // Contains some utilities to work with std::string objects. // #include "../features.h" #include <vector> // std::vector #include <string> // std::basic_string #include <algorithm> // std::transform #include <cstdarg> // va_list #include <cctype> // size_t namespace lol { // Split a string along a single separator template<typename T> std::vector<std::basic_string<T>> split(std::basic_string<T> const &s, T sep = T('\n')) { std::vector<std::basic_string<T>> ret; size_t start = 0, end = 0; while ((end = s.find(sep, start)) != std::basic_string<T>::npos) { ret.push_back(s.substr(start, end - start)); start = end + 1; } ret.push_back(s.substr(start)); return ret; } // Split a string along multiple separator template<typename T> std::vector<std::basic_string<T>> split(std::basic_string<T> const &s, std::basic_string<T> const &seps) { std::vector<std::string> ret; size_t start = s.find_first_not_of(seps), end = 0; while ((end = s.find_first_of(seps, start)) != std::basic_string<T>::npos) { ret.push_back(s.substr(start, end - start)); start = s.find_first_not_of(seps, end); } if (start != std::string::npos) ret.push_back(s.substr(start)); return ret; } // Helper for template deduction template<typename T> std::vector<std::basic_string<T>> split(std::basic_string<T> const &s, T const *seps) { return split(s, std::basic_string<T>(seps)); } // Check whether a string starts with a given substring template<typename T> bool starts_with(std::basic_string<T> const &s, std::basic_string<T> const &prefix) { return s.size() >= prefix.size() && s.compare(0, prefix.size(), prefix) == 0; } template<typename T> bool starts_with(std::basic_string<T> const &s, T const *prefix) { return starts_with(s, std::basic_string<T>(prefix)); } template<typename T> bool starts_with(T const *s, T const *suffix) { return starts_with(std::basic_string<T>(s), std::basic_string<T>(suffix)); } // Check whether a string ends with a given substring template<typename T> bool ends_with(std::basic_string<T> const &s, std::basic_string<T> const &suffix) { return s.size() >= suffix.size() && s.compare(s.size() - suffix.size(), suffix.size(), suffix) == 0; } template<typename T> bool ends_with(std::basic_string<T> const &s, T const *suffix) { return ends_with(s, std::basic_string<T>(suffix)); } template<typename T> bool ends_with(T const *s, T const *suffix) { return ends_with(std::basic_string<T>(s), std::basic_string<T>(suffix)); } // Convert a string to lowercase or uppercase template<typename T> std::basic_string<T> tolower(std::basic_string<T> const &s) { std::string ret; std::transform(s.begin(), s.end(), std::back_inserter(ret), [](T c){ return std::tolower(c); }); return ret; } template<typename T> std::basic_string<T> tolower(T const *s) { return tolower(std::basic_string<T>(s)); } template<typename T> std::basic_string<T> toupper(std::basic_string<T> const &s) { std::string ret; std::transform(s.begin(), s.end(), std::back_inserter(ret), [](T c){ return std::toupper(c); }); return ret; } template<typename T> std::basic_string<T> toupper(T const *s) { return toupper(std::basic_string<T>(s)); } // Format a string, printf-style template<typename T = char> std::basic_string<T> vformat(char const *fmt, va_list ap) { va_list ap2; #if defined va_copy || !defined _MSC_VER // Visual Studio 2010 does not support va_copy. va_copy(ap2, ap); #else ap2 = ap; #endif // vsnprintf() tells us how many characters we need, not counting // the terminating null character. size_t needed = vsnprintf(nullptr, 0, fmt, ap2); #if defined va_copy || !defined _MSC_VER // do not call va_end() if va_copy() wasn't called. va_end(ap2); #endif std::string ret; ret.resize(needed); vsnprintf(&ret[0], needed + 1, fmt, ap); return ret; } // XXX: we cheat by setting the argument time to char instead of T, because // I found no other way to use the printf attribute. template<typename T = char> std::basic_string<T> lol_attr_printf_format(1, 2) format(char const *fmt, ...) { va_list ap; va_start(ap, fmt); std::basic_string<T> ret = vformat(fmt, ap); va_end(ap); return ret; } } // namespace lol
26.598958
78
0.637752
[ "vector", "transform" ]
a3e706dc51c8081010fa214a168bc1665248352e
463
h
C
core/LZerD/read.h
tecdatalab/legacy
9b5286d3375fff691a80ceb44172549e9a6bdee5
[ "Apache-2.0" ]
null
null
null
core/LZerD/read.h
tecdatalab/legacy
9b5286d3375fff691a80ceb44172549e9a6bdee5
[ "Apache-2.0" ]
15
2019-06-17T16:13:39.000Z
2022-02-27T05:23:59.000Z
db/Updater/generators/LZerD/read.h
tecdatalab/biostructure
a30e907e83fa5bbfb934d951b7c663b622104fcc
[ "Apache-2.0" ]
null
null
null
/* prototypes for read.cc */ #ifndef _READ_H_ #define _READ_H_ #include <string> #include <sstream> #include <vector> #include <iostream> #include <fstream> using namespace std; #include "cp.h" #include "pdb.h" void read_protein(string, vector<atom>&); void read_point_info(string, vector<cp>&); void read_zd_info(string, vector<cp>&); void read_interface_residues(string, vector<pair<string, string> >&); void read_names(string, vector<string>&); #endif
17.807692
69
0.736501
[ "vector" ]
a3eb9231cf26d7891c7500d2bb0106682a592f6d
1,960
h
C
master/core/third/SMailer/FileHelper.h
importlib/klib
a59837857689d0e60d3df6d2ebd12c3160efa794
[ "MIT" ]
4
2017-12-04T08:22:48.000Z
2019-10-26T21:44:59.000Z
master/core/third/SMailer/FileHelper.h
isuhao/klib
a59837857689d0e60d3df6d2ebd12c3160efa794
[ "MIT" ]
null
null
null
master/core/third/SMailer/FileHelper.h
isuhao/klib
a59837857689d0e60d3df6d2ebd12c3160efa794
[ "MIT" ]
4
2017-12-19T11:13:56.000Z
2018-02-23T08:44:03.000Z
//////////////////////////////////////////////////////////////////////////////// // General utilities : File I/O helper class // // Copyright (c) 2003 by Morning // http://morningspace.51.net // mailto:moyingzz@etang.com // // Permission to use, copy, modify, distribute and sell this program for any // purpose is hereby granted without fee, provided that the above copyright // notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // // It is provided "as is" without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// #ifndef _FILE_HELPER_H_ #define _FILE_HELPER_H_ // #include <string> #include <vector> #include <fstream> #include <stdio.h> // namespace MUtils { class FileHelper { public: // used to open binary file static bool open(const std::string filename, std::string& content) { FILE *file = fopen(filename.c_str(), "rb"); if (file == NULL) return false; fseek(file, 0, SEEK_END); int len = ftell(file); rewind(file); char *buffer = new char[len]; fread(buffer, sizeof(char), len, file); content.assign(buffer, len); delete []buffer; fclose(file); return true; } // used to open text file static bool open(const std::string file_name, std::vector<std::string>& lines) { std::ifstream file(file_name.c_str(), std::ios::in); if (!file) { return false; } lines.clear(); char buffer[buffer_size]; while (file.getline(buffer, buffer_size, '\n')) { lines.push_back(buffer); } return true; } private: enum { buffer_size = 3000 }; }; } // namespace MUtils #endif // _FILE_HELPER_H_
25.128205
83
0.539796
[ "vector" ]
a3ed156a9c078cc6cade51b678dc93cbd9a84a88
411
c
C
Editor/model.c
demisardonic/battletested
89f502a721f4d7056a74acd22af9d79c8e3f0dba
[ "MIT" ]
null
null
null
Editor/model.c
demisardonic/battletested
89f502a721f4d7056a74acd22af9d79c8e3f0dba
[ "MIT" ]
null
null
null
Editor/model.c
demisardonic/battletested
89f502a721f4d7056a74acd22af9d79c8e3f0dba
[ "MIT" ]
null
null
null
#include <stdlib.h> #include <stdint.h> #include "model.h" #include "util.h" model_t *model; model_t *init_model(){ model = malloc(sizeof(model_t)); model->map = malloc(GAME_HEIGHT * GAME_WIDTH); model->selectedX = 0; model->selectedY = 0; model->selectedWidth = 1; model->selectedHeight = 1; return model; } void free_model(model_t* model){ free(model->map); free(model); }
17.869565
48
0.652068
[ "model" ]
a3fadbeb8711111068bb1d2c43b452943334cebd
1,880
h
C
pigasus/software/src/service_inspectors/wizard/curses.h
zhipengzhaocmu/fpga2022_artifact
0ac088a5b04c5c75ae6aef25202b66b0f674acd3
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
null
null
null
pigasus/software/src/service_inspectors/wizard/curses.h
zhipengzhaocmu/fpga2022_artifact
0ac088a5b04c5c75ae6aef25202b66b0f674acd3
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
null
null
null
pigasus/software/src/service_inspectors/wizard/curses.h
zhipengzhaocmu/fpga2022_artifact
0ac088a5b04c5c75ae6aef25202b66b0f674acd3
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
null
null
null
//-------------------------------------------------------------------------- // Copyright (C) 2016-2018 Cisco and/or its affiliates. All rights reserved. // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License Version 2 as published // by the Free Software Foundation. You may not use, modify or distribute // this program under any other version of the GNU General Public License. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //-------------------------------------------------------------------------- // curses.h author Maya Dagon <mdagon@cisco.com> #ifndef CURSES_H #define CURSES_H #include <cstdint> #include <string> #include <vector> enum DCE_States { STATE_0 = 0, STATE_1, STATE_2, STATE_3, STATE_4, STATE_5, STATE_6, STATE_7, STATE_8, STATE_9, STATE_10 }; class CurseTracker { public: DCE_States state; uint32_t helper; CurseTracker() { state = STATE_0; } }; typedef bool (* curse_alg)(const uint8_t* data, unsigned len, CurseTracker*); struct CurseDetails { std::string name; std::string service; curse_alg alg; bool is_tcp; }; class CurseBook { public: bool add_curse(const char* service); const std::vector<const CurseDetails*>& get_curses(bool tcp) const; private: std::vector<const CurseDetails*> tcp_curses; std::vector<const CurseDetails*> non_tcp_curses; }; #endif
25.405405
77
0.656383
[ "vector" ]
a3fc98d2b29495ef8db35400aa72ec1afd63fd28
1,734
h
C
dependencies/panda/Panda3D-1.10.0-x64/include/eggCharacterFilter.h
CrankySupertoon01/Toontown-2
60893d104528a8e7eb4aced5d0015f22e203466d
[ "MIT" ]
3
2018-03-09T12:07:29.000Z
2021-02-25T06:50:25.000Z
pandatool/src/eggcharbase/eggCharacterFilter.h
Sinkay/panda3d
16bfd3750f726a8831771b81649d18d087917fd5
[ "PHP-3.01", "PHP-3.0" ]
1
2018-07-28T20:07:04.000Z
2018-07-30T18:28:34.000Z
pandatool/src/eggcharbase/eggCharacterFilter.h
Sinkay/panda3d
16bfd3750f726a8831771b81649d18d087917fd5
[ "PHP-3.01", "PHP-3.0" ]
2
2019-12-02T01:39:10.000Z
2021-02-13T22:41:00.000Z
// Filename: eggCharacterFilter.h // Created by: drose (23Feb01) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef EGGCHARACTERFILTER_H #define EGGCHARACTERFILTER_H #include "pandatoolbase.h" #include "eggMultiFilter.h" class EggCharacterData; class EggCharacterCollection; //////////////////////////////////////////////////////////////////// // Class : EggCharacterFilter // Description : This is the base class for a family of programs that // operate on a number of character models and their // associated animation files together. It reads in a // number of egg files, any combination of model files // or character files which must all represent the same // character skeleton, and maintains a single hierarchy // of joints and sliders that may be operated on before // writing the files back out. //////////////////////////////////////////////////////////////////// class EggCharacterFilter : public EggMultiFilter { public: EggCharacterFilter(); virtual ~EggCharacterFilter(); void add_fixrest_option(); protected: virtual bool post_command_line(); virtual void write_eggs(); virtual EggCharacterCollection *make_collection(); EggCharacterCollection *_collection; bool _force_initial_rest_frame; }; #endif
30.964286
70
0.598039
[ "model", "3d" ]
430c4afcd0b4956a4251b05d45bd714c22987c6b
69,084
c
C
sci/secmod/psec_openssh.c
hongsenliu/cloudland
81a9394f6e74658141ee66557731985f80a9f6ab
[ "Apache-2.0" ]
69
2019-04-17T04:03:31.000Z
2021-11-08T10:29:54.000Z
sci/secmod/psec_openssh.c
hongsenliu/cloudland
81a9394f6e74658141ee66557731985f80a9f6ab
[ "Apache-2.0" ]
113
2019-04-13T06:46:32.000Z
2021-11-02T01:45:06.000Z
sci/secmod/psec_openssh.c
hongsenliu/cloudland
81a9394f6e74658141ee66557731985f80a9f6ab
[ "Apache-2.0" ]
46
2019-04-17T04:03:36.000Z
2021-09-26T13:11:37.000Z
#ifndef _PRAGMA_COPYRIGHT_ #define _PRAGMA_COPYRIGHT_ #pragma comment(copyright, "%Z% %I% %W% %D% %T%\0") #endif /* _PRAGMA_COPYRIGHT_ */ /**************************************************************************** * Copyright (c) 2008, 2010 IBM Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0s * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html Description: psec functions from poe Author: Serban Maerean History: Date Who ID Description -------- --- --- ----------- 10/06/08 serban Initial code (D153875) ****************************************************************************/ #include <pthread.h> #include <stdlib.h> #include <errno.h> #include <stdio.h> #include <string.h> #include <assert.h> #include <unistd.h> #include <pwd.h> #include <ctype.h> #include <dlfcn.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/param.h> #include <openssl/pem.h> #include <openssl/bio.h> #include <openssl/md5.h> #include <openssl/aes.h> #include "psec_openssh.h" #define USR_CONFIG_FILE ".ssh/config" #define SSH_CONFIG_FILE "/etc/ssh/ssh_config" #define SSHD_CONFIG_FILE "/etc/ssh/sshd_config" #define CONFIG_FILE_MAXSIZE 10*1024 pthread_key_t _prngKey; time_t _idtokTTL = 600; char *authzkeyfile = NULL; char *osslversion = NULL; #if defined(_AIX) #define _BIO_f_base64 BIO_f_base64 #define _BIO_free BIO_free #define _BIO_free_all BIO_free_all #define _BIO_new BIO_new #define _BIO_new_mem_buf BIO_new_mem_buf #define _BIO_push BIO_push #define _BIO_read BIO_read #define _BIO_set_flags BIO_set_flags #define _BN_bin2bn BN_bin2bn #define _BN_dec2bn BN_dec2bn #define _BN_free BN_free #define _DSA_free DSA_free #define _DSA_new DSA_new #define _DSA_sign DSA_sign #define _DSA_size DSA_size #define _DSA_verify DSA_verify #define _PEM_read_DSAPrivateKey PEM_read_DSAPrivateKey #define _PEM_read_RSAPrivateKey PEM_read_RSAPrivateKey #define _RSA_free RSA_free #define _RSA_new RSA_new #define _RSA_sign RSA_sign #define _RSA_size RSA_size #define _RSA_verify RSA_verify #define _RSA_public_encrypt RSA_public_encrypt #define _RSA_private_decrypt RSA_private_decrypt #define _SHA1 SHA1 #define _MD5_Init MD5_Init #define _MD5_Update MD5_Update #define _MD5_Final MD5_Final #define _AES_set_encrypt_key AES_set_encrypt_key #define _AES_encrypt AES_encrypt #define _BIO_set_flags BIO_set_flags #define OSSL_FNCSELECT(name) name #elif defined(_LINUX) typedef BIO_METHOD *(*_ft_BIO_f_base64)(void); typedef int (*_ft_BIO_free)(BIO *); typedef void (*_ft_BIO_free_all)(BIO *); typedef BIO *(*_ft_BIO_new)(BIO_METHOD *); typedef BIO *(*_ft_BIO_new_mem_buf)(void *, int); typedef BIO *(*_ft_BIO_push)(BIO *, BIO *); typedef int (*_ft_BIO_read)(BIO *, void *, int); typedef int (*_ft_BN_dec2bn)(BIGNUM **, const char *); typedef BIGNUM *(*_ft_BN_bin2bn)(const unsigned char *,int , BIGNUM *); typedef void (*_ft_BN_free)(BIGNUM *); typedef void (*_ft_DSA_free)(DSA *); typedef DSA *(*_ft_DSA_new)(void); typedef int (*_ft_DSA_sign)(int, const unsigned char *, int, unsigned char *, unsigned int *, DSA *); typedef int (*_ft_DSA_size)(const DSA *); typedef int (*_ft_DSA_verify)(int, const unsigned char *, int, const unsigned char *, int, DSA *); typedef DSA *(*_ft_PEM_read_DSAPrivateKey)(FILE *, ...); typedef RSA *(*_ft_PEM_read_RSAPrivateKey)(FILE *, ...); typedef void (*_ft_RSA_free)(RSA *); typedef RSA *(*_ft_RSA_new)(void); typedef int (*_ft_RSA_sign)(int, const unsigned char *, unsigned int, unsigned char *, unsigned int *, RSA *); typedef int (*_ft_RSA_size)(const RSA *); typedef int (*_ft_RSA_verify)(int, const unsigned char *, unsigned int, unsigned char *, unsigned int, RSA *); typedef int (*_ft_RSA_public_encrypt)(int, unsigned char *, unsigned char *, RSA *, int); typedef int (*_ft_RSA_private_decrypt)(int, unsigned char *, unsigned char *, RSA *, int); typedef unsigned char *(*_ft_SHA1)(const unsigned char *, size_t, unsigned char *); typedef int (*_ft_MD5_Init)(MD5_CTX *); typedef int (*_ft_MD5_Update)(MD5_CTX *, void *, size_t); typedef int (*_ft_MD5_Final)(unsigned char *, MD5_CTX *); typedef int (*_ft_AES_set_encrypt_key)(const unsigned char *, const int, AES_KEY *); typedef void (*_ft_AES_encrypt)(const unsigned char *, unsigned char *, const AES_KEY *); #if !defined(BIO_set_flags) typedef void (*_ft_BIO_set_flags)(BIO *, int); #endif typedef struct func_doublet_s { char *fncname; void *fncpntr; } func_doublet_desc, *func_doublet_t; #define _fpi_BIO_f_base64 0 #define _fpi_BIO_free 1 #define _fpi_BIO_free_all 2 #define _fpi_BIO_new 3 #define _fpi_BIO_new_mem_buf 4 #define _fpi_BIO_push 5 #define _fpi_BIO_read 6 #define _fpi_BN_bin2bn 7 #define _fpi_BN_dec2bn 8 #define _fpi_BN_free 9 #define _fpi_DSA_free 10 #define _fpi_DSA_new 11 #define _fpi_DSA_sign 12 #define _fpi_DSA_size 13 #define _fpi_DSA_verify 14 #define _fpi_PEM_read_DSAPrivateKey 15 #define _fpi_PEM_read_RSAPrivateKey 16 #define _fpi_RSA_free 17 #define _fpi_RSA_new 18 #define _fpi_RSA_sign 19 #define _fpi_RSA_size 20 #define _fpi_RSA_verify 21 #define _fpi_RSA_public_encrypt 22 #define _fpi_RSA_private_decrypt 23 #define _fpi_SHA1 24 #define _fpi_MD5_Init 25 #define _fpi_MD5_Update 26 #define _fpi_MD5_Final 27 #define _fpi_AES_set_encrypt_key 28 #define _fpi_AES_encrypt 29 #if defined(BIO_set_flags) #define OSSL_FNCSTBLE_SIZE 30 void *_fp_BIO_set_flags = NULL; #else #define _fpi_BIO_set_flags 30 void _fp_BIO_set_flags(BIO *b, int flags) { b->flags |= flags; } #define OSSL_FNCSTBLE_SIZE 31 #endif func_doublet_desc ossl_fncstble[OSSL_FNCSTBLE_SIZE] = { {"BIO_f_base64", NULL}, {"BIO_free", NULL}, {"BIO_free_all", NULL}, {"BIO_new", NULL}, {"BIO_new_mem_buf", NULL}, {"BIO_push", NULL}, {"BIO_read", NULL}, {"BN_bin2bn", NULL}, {"BN_dec2bn", NULL}, {"BN_free", NULL}, {"DSA_free", NULL}, {"DSA_new", NULL}, {"DSA_sign", NULL}, {"DSA_size", NULL}, {"DSA_verify", NULL}, {"PEM_read_DSAPrivateKey", NULL}, {"PEM_read_RSAPrivateKey", NULL}, {"RSA_free", NULL}, {"RSA_new", NULL}, {"RSA_sign", NULL}, {"RSA_size", NULL}, {"RSA_verify", NULL}, {"RSA_public_encrypt", NULL}, {"RSA_private_decrypt", NULL}, {"SHA1", NULL}, {"MD5_Init", NULL}, {"MD5_Update", NULL}, {"MD5_Final", NULL}, {"AES_set_encrypt_key", NULL}, {"AES_encrypt", NULL} #if !defined(BIO_set_flags) , {"BIO_set_flags", NULL} #endif }; #define OSSL_FNCSELECT(name) ((_ft##name)(ossl_fncstble[_fpi##name].fncpntr)) #endif int _read_config_param( char *cfgfile, char *param, char *value) { int rc = 0; do { struct stat cfgstat = {0}; if (0>stat(cfgfile, &cfgstat)) { // printf("Error [%s:%d]: stat() failed for %s: errno = %d\n", __FILE__, __LINE__, cfgfile, errno); rc = OSSH_CFGFILE_ERR; break; } if (0==cfgstat.st_size) { rc = OSSH_CFGFILE_SIZE_ERR; break; } if (CONFIG_FILE_MAXSIZE<cfgstat.st_size) { rc = OSSH_CFGFILE_SIZE_ERR; break; } { FILE *cfgstrm = NULL; if (NULL==(cfgstrm = fopen(cfgfile, "r"))) { // printf("Error [%s:%d]: fopen() failed for %s: errno = %d\n", __FILE__, __LINE__, cfgfile, errno); rc = OSSH_CFGFILE_OPEN_ERR; break; } pthread_cleanup_push((void(*)(void *))fclose, (void *)cfgstrm); do { char *cfgline = malloc(cfgstat.st_size); if (!cfgline) { // printf("Error [%s:%d]: fopen() failed w/errno = %d (%d)\n", __FILE__, __LINE__, errno, cfgstat.st_size); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, cfgline); do { char *cp = NULL; if (NULL==(cp = fgets(cfgline, cfgstat.st_size, cfgstrm))) { // if (ferror(cfgstrm)) printf("Error [%s:%d]: fgets() failed for %s: errno = %d\n", __FILE__, __LINE__, cfgfile, errno); if (feof(cfgstrm)) break; rc = OSSH_CFGFILE_GETS_ERR; break; } if (('#' == *cp) || ('\n' == *cp)) continue; { while (isblank(*cp)) cp++; if (!strncmp(cp, param, strlen(param))) { char *pcp = cp + strlen(param); if (!isblank(*pcp)) continue; while (isblank(*pcp)) pcp++; { char *ecp = pcp; while (ispunct(*ecp)||isalnum(*ecp)) ecp++; if (ecp == pcp) { rc = OSSH_CFGFILE_DATA_ERR; break; } if (PATH_MAX-1<ecp-pcp) { rc = OSSH_CFGFILE_DATA_ERR; break; } strncpy(value, pcp, ecp-pcp); value[ecp-pcp] = '\0'; break; } } } } while (1); pthread_cleanup_pop(1); // free(cfgline); } while (0); pthread_cleanup_pop(1); // fclose(cfgstrm); } } while (0); return rc; } void _nfree(void *p) { if (p) free(p); } int _get_identity_fname( char *luser, char *ruser, char *rhost, char **idfpath) { // ruser and rhost not used at this time int rc = 0; char *usrConfigFile = NULL, *usrHomeDir = NULL; pthread_cleanup_push((void(*)(void *))_nfree, usrConfigFile); pthread_cleanup_push((void(*)(void *))_nfree, usrHomeDir); do { char vIdentityFile[PATH_MAX] = ""; size_t usrHomeDirLen = 0; // get the user's home directory long pwrbufsize = sysconf(_SC_GETPW_R_SIZE_MAX); void *pwrbuf = malloc(pwrbufsize); if (!pwrbuf) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, pwrbuf); do { struct passwd usrpwd, *usrpwdp = NULL; if (luser&&('\0'!=*luser)) rc = getpwnam_r(luser, &usrpwd, pwrbuf, pwrbufsize, &usrpwdp); else rc = getpwuid_r(geteuid(), &usrpwd, pwrbuf, pwrbufsize, &usrpwdp); if (rc) { // printf("Error [%s:%d]: getpwuid_r() failed: rc = %d\n", __FILE__, __LINE__, rc); rc = OSSH_PWUID_ERR; break; } if (usrpwd.pw_dir&&(usrHomeDirLen = strlen(usrpwd.pw_dir))) { if(!(usrHomeDir = strdup(usrpwd.pw_dir))) { // printf("Error [%s:%d]: strdup() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } if (!(usrConfigFile = malloc(usrHomeDirLen+strlen(USR_CONFIG_FILE)+2))) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } sprintf(usrConfigFile, "%s/%s", usrHomeDir, USR_CONFIG_FILE); } } while (0); pthread_cleanup_pop(1); // free(pwrbuf); if (rc) break; do { if (!usrConfigFile) { rc = OSSH_CFGFILE_ERR; break; } rc = _read_config_param(usrConfigFile, "IdentityFile", vIdentityFile); } while (0); if (rc||('\0'==*vIdentityFile)) { rc = _read_config_param(SSH_CONFIG_FILE, "IdentityFile", vIdentityFile); } if ((!rc)&&('\0' != *vIdentityFile)) { // check the file name if (strchr(vIdentityFile, '%')) { // printf("Error [%s:%d]: invalid format of identity file name: %s\n", __FILE__, __LINE__, vIdentityFile); rc = OSSH_IDFILE_NAME_ERR; break; } do { if ('/' == *vIdentityFile) { // absolute file path rc = OSSH_IDFILE_NAME_ERR; break; } // relative file path to user's home directory if (!usrHomeDir) { rc = OSSH_PWUID_HOMEDIR_ERR; break; } if ('~' == *vIdentityFile) { if ('/' != *(vIdentityFile+1)) { // printf("Error [%s:%d]: invalid format of identity file name %s\n", __FILE__, __LINE__, vIdentityFile); rc = OSSH_IDFILE_NAME_ERR; break; } if (PATH_MAX-1<(usrHomeDirLen+strlen(vIdentityFile+1))) { // id file name too long rc = OSSH_IDFILE_PATH_ERR; break; } memmove(&vIdentityFile[usrHomeDirLen], vIdentityFile+1, strlen(vIdentityFile+1)); } else { if (PATH_MAX-2<(usrHomeDirLen+strlen(vIdentityFile))) { // id file name too long rc = OSSH_IDFILE_PATH_ERR; break; } memmove(&vIdentityFile[usrHomeDirLen+1], vIdentityFile, strlen(vIdentityFile)); vIdentityFile[usrHomeDirLen] = '/'; } memcpy(vIdentityFile, usrHomeDir, usrHomeDirLen); } while (0); if (rc) break; { // check the identity file struct stat idfstat = {0}; if (0>stat(vIdentityFile, &idfstat)) { // printf("Error [%s:%d]: stat() failed for %s: errno = %d\n", __FILE__, __LINE__, idfpath, errno); rc = OSSH_IDFILE_PATH_ERR; break; } if (0==idfstat.st_size) { // printf("Error [%s:%d]: invalid private identity file (size = %d)\n", __FILE__, __LINE__, idfstat.st_size); rc = OSSH_IDFILE_SIZE_ERR; break; } } } else { // either error reading config file or no identity file name // try the default file names: identity, id_rsa, id_dsa struct stat idfstat = {0}; strcpy(vIdentityFile, usrHomeDir); do { rc = 0; // reset error code, in case of any strcpy(vIdentityFile+usrHomeDirLen, "/.ssh/id_rsa"); if ((0==stat(vIdentityFile, &idfstat))&&(0!=idfstat.st_size)) { // found this default file break; } memset(&idfstat, 0, sizeof(struct stat)); strcpy(vIdentityFile+usrHomeDirLen, "/.ssh/id_dsa"); if ((0==stat(vIdentityFile, &idfstat))&&(0!=idfstat.st_size)) { // found this default file break; } memset(&idfstat, 0, sizeof(struct stat)); strcpy(vIdentityFile+usrHomeDirLen, "/.ssh/identity"); if ((0==stat(vIdentityFile, &idfstat))&&(0!=idfstat.st_size)) { // found this default file break; } rc = OSSH_IDFILE_DEFS_ERR; } while (0); if (rc) break; } if (!(*idfpath = strdup(vIdentityFile))) { // printf("Error [%s:%d]: strdup() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } } while (0); pthread_cleanup_pop(1); // _nfree(usrHomeDir) pthread_cleanup_pop(1); // _nfree(usrConfigFile) return rc; } int _get_authz_fname( char *luser, char **azfpath) { int rc = 0; do { int dvAuthorizedFilef = 0, vAuthorizedFileLen = 0; char vAuthorizedFile[PATH_MAX] = "", *dvAuthorizedFilep = ".ssh/authorized_keys"; if (!authzkeyfile) _read_config_param(SSHD_CONFIG_FILE, "AuthorizedKeysFile", vAuthorizedFile); else strcpy(vAuthorizedFile, authzkeyfile); do { if ('\0' == *vAuthorizedFile) { // no value found for authorized keys parameter strcpy(vAuthorizedFile, dvAuthorizedFilep); dvAuthorizedFilef++; } if ('/' == *vAuthorizedFile) { // absolute file path rc = OSSH_AUTHZFILE_NAME_ERR; break; } // relative path to user's home directory { size_t usrHomeDirLen = 0; long pwrbufsize = sysconf(_SC_GETPW_R_SIZE_MAX); void *pwrbuf = malloc(pwrbufsize); if (!pwrbuf) { // printf("Error [%s:%d]: malloc() failed w/errno = %s\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, pwrbuf); do { struct passwd usrpwd, *usrpwdp = NULL; if (luser) rc = getpwnam_r(luser, &usrpwd, pwrbuf, pwrbufsize, &usrpwdp); else rc = getpwuid_r(geteuid(), &usrpwd, pwrbuf, pwrbufsize, &usrpwdp); if (rc) { // printf("Error [%s:%d]: getpwuid_r() failed: rc = %d\n", __FILE__, __LINE__, rc); rc = OSSH_PWUID_ERR; break; } if (!usrpwd.pw_dir|| (0==(usrHomeDirLen = strlen(usrpwd.pw_dir)))) { // printf("Error [%s:%d]: invalid user home directory\n", __FILE__, __LINE__); rc = OSSH_PWUID_HOMEDIR_ERR; break; } if ('~' == *vAuthorizedFile) { if ('/' != *(vAuthorizedFile+1)) { // printf("Error [%s:%d]: invalid format of authorized key file name: %s\n", __FILE__, __LINE__, vAuthorizedFile); rc = OSSH_AUTHZFILE_NAME_ERR; break; } if (PATH_MAX-1<(vAuthorizedFileLen = usrHomeDirLen+strlen(vAuthorizedFile+1))) { // authorized file name too long rc = OSSH_AUTHZFILE_PATH_ERR; break; } memmove(&vAuthorizedFile[usrHomeDirLen], vAuthorizedFile+1, strlen(vAuthorizedFile+1)); } else { if (PATH_MAX-2<(vAuthorizedFileLen = usrHomeDirLen+strlen(vAuthorizedFile))) { // authorized file name too long rc = OSSH_AUTHZFILE_PATH_ERR; break; } memmove(&vAuthorizedFile[usrHomeDirLen+1], vAuthorizedFile, strlen(vAuthorizedFile)); vAuthorizedFile[usrHomeDirLen] = '/'; } memcpy(vAuthorizedFile, usrpwd.pw_dir, usrHomeDirLen); } while (0); pthread_cleanup_pop(1); // free(pwrbuf) } } while (0); if (rc) break; { // check the authorization file struct stat azfstat = {0}; if (0>stat(vAuthorizedFile, &azfstat)) { if ((ENOENT!=errno)||(0==dvAuthorizedFilef)) { // printf("Error [%s:%d]: stat() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_AUTHZFILE_PATH_ERR; break; } // default authorization file does not exist: try the 2 version memset(&azfstat, 0, sizeof(struct stat)); if (PATH_MAX-2<vAuthorizedFileLen) { // too long rc = OSSH_AUTHZFILE_PATH_ERR; break; } strcat(vAuthorizedFile, "2"); if (0>stat(vAuthorizedFile, &azfstat)) { // printf("Error [%s:%d]: stat() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_AUTHZFILE_PATH_ERR; break; } } } if (!(*azfpath = strdup(vAuthorizedFile))) { // printf("Error [%s:%d]: strdup() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } } while (0); return rc; } #define KEYTYPE_STR_DSA "ssh-dss" DSA * _read_dsa_public_key( char *s, char **usrid) { DSA *dsapub = NULL; do { int rc = 0; char *ts = strdup(s); if (!ts) { // printf("Error [%s:%d]: strdup() failed w/errno = %d\n", __FILE__, __LINE__, errno); break; } pthread_cleanup_push((void(*)(void *))free, ts); do { // find the dsa header in the public key data char *cp = strstr(ts, KEYTYPE_STR_DSA); if (!cp) { // not a DSA public key // printf("Error [%s:%d]: invalid DSA public key format\n", __FILE__, __LINE__); rc = OSSH_DSA_INVALID_FORMAT_ERR; break; } { // version 2 DSA public key char *lasts, *buf = NULL; size_t len; // get the base64 key encoding if (!(cp = strtok_r(cp+strlen(KEYTYPE_STR_DSA), " ", &lasts))) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_DSA_INVALID_FORMAT_ERR; break; } if (!(buf = malloc(2*(len=strlen(cp)+1)))) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, len); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, buf); do { { // decode the base64 encoded public key data BIO *bio, *b64; if (!(bio = OSSL_FNCSELECT(_BIO_new_mem_buf)(cp, -1))) { // printf("Error [%s:%d]: BIO_new_mem_buf() failed...\n", __FILE__, __LINE__); rc = OSSH_BIO_NEW_MEMBUF_ERR; break; } pthread_cleanup_push((void(*)(void *))OSSL_FNCSELECT(_BIO_free_all), bio); do { if (!(b64 = OSSL_FNCSELECT(_BIO_new)(OSSL_FNCSELECT(_BIO_f_base64)()))) { // printf("Error [%s:%d]: BIO_new failed...\n", __FILE__, __LINE__); rc = OSSH_BIO_NEW_ERR; break; } #if defined(BIO_set_flags) BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); #else OSSL_FNCSELECT(_BIO_set_flags)(b64, BIO_FLAGS_BASE64_NO_NL); #endif if (!(bio = OSSL_FNCSELECT(_BIO_push)(b64, bio))) { // printf("Error [%s:%d]: BIO_push() failed...\n", __FILE__, __LINE__); OSSL_FNCSELECT(_BIO_free)(b64); rc = OSSH_BIO_PUSH_ERR; break; } if (0>=(len = OSSL_FNCSELECT(_BIO_read)(bio, buf, len))) { // printf("Error [%s:%d]: BIO_read() failed\n", __FILE__, __LINE__); rc = OSSH_BIO_READ_ERR; break; } } while (0); pthread_cleanup_pop(1); // BIO_free_all(bio); } if (rc) break; { // make sense of the public key data BIGNUM *p = NULL, *q = NULL, *g = NULL, *y= NULL; char *cp = buf; // 1st field should be key type int len = ntohl(*((int *)cp)); if (strncmp(cp+=sizeof(int), KEYTYPE_STR_DSA, len)) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_DSA_INVALID_FORMAT_ERR; break; } else cp += len; // the subsequent fields for DSA should be the p, q, g and y parameters len = ntohl(*((int *)cp)); cp += sizeof(int); do { // read the p parameter if (!(p = OSSL_FNCSELECT(_BN_bin2bn)(cp, len, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for the p parameter...\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += len; len = ntohl(*((int *)cp)); cp += sizeof(int); // read the q parameter if (!(q = OSSL_FNCSELECT(_BN_bin2bn)(cp, len, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for q parameter...\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += len; len = ntohl(*((int *)cp)); cp += sizeof(int); // read the g parameter if (!(g = OSSL_FNCSELECT(_BN_bin2bn)(cp, len, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for the g parameter...\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += len; len = ntohl(*((int *)cp)); cp += sizeof(int); // read the y parameter if (!(y = OSSL_FNCSELECT(_BN_bin2bn)(cp, len, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for the y parameter...\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } if (!(dsapub = OSSL_FNCSELECT(_DSA_new)())) { // printf("Error [%s:%d]: DSA_new() failed...\n", __FILE__, __LINE__); rc = OSSH_DSA_NEW_ERR; break; } dsapub->p = p; dsapub->q = q; dsapub->g = g; dsapub->pub_key = y; } while (0); if (rc) { if (p) OSSL_FNCSELECT(_BN_free)(p); if (q) OSSL_FNCSELECT(_BN_free)(q); if (g) OSSL_FNCSELECT(_BN_free)(g); if (y) OSSL_FNCSELECT(_BN_free)(y); } } } while (0); pthread_cleanup_pop(1); // free(buf) if (rc) break; if (usrid&&(cp = strtok_r(NULL, " \n", &lasts))) *usrid = strdup(cp); } } while (0); pthread_cleanup_pop(1); // free (ts); } while (0); return dsapub; } #define KEYTYPE_STR_RSA "ssh-rsa" RSA * _read_rsa_public_key( char *s, char **usrid) { // this routine reads a public RSA key from either an openSSH v1 or v2 // formatted public key identity file // the v1 format appears to be as follows: options, key length, public // exponent, modulus, comments; the fields are separated by white // spaces // the v2 format appears to be as follows: options, key type, key // value, comment; the fields are separated by one blank space // in both versions options are optional; the comment field is not used RSA *rsapub = NULL; do { int rc = 0; char *ts = strdup(s); if (!ts) { // printf("Error [%s:%d]: strdup() failed w/errno = %d\n", __FILE__, __LINE__, errno); break; } pthread_cleanup_push((void(*)(void *))free, ts); do { // if rsa header, then RSA v2 key char *cp = strstr(ts, KEYTYPE_STR_RSA); if (!cp) { // possibly a v1 RSA public key // split the input string in tokens separated by blank spaces int noofquotes = 0; char *lasts, *cp = strtok_r(ts, " ", &lasts); if (!cp) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } if (!isdigit(*cp)) { // this must be a comment int quotesclosed = 0; while (!quotesclosed) { { // check whether a blank space whithin quotes char *cp2 = cp-1; while (cp2 = strchr(cp2+1, '"')) noofquotes++; if (!(noofquotes%2)) quotesclosed++; if (!(cp = strtok_r(NULL, " ", &lasts))) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } } } if (!isdigit(*cp)) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } } // version 1 public key; get the key length BIGNUM *e = NULL, *n = NULL; long keylen; if ((0==(errno = 0, keylen=atol(cp)))&&(EINVAL==errno)) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } if (((LONG_MAX==keylen)||(LONG_MIN==keylen))&&(ERANGE==errno)) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } if (0>=keylen) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } // get the public exponent if (!(cp = strtok_r(NULL, " ", &lasts))) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } if (!(OSSL_FNCSELECT(_BN_dec2bn)(&e, cp))) { // printf("Error [%s:%d]: BN_dec2bn() failed...\n", __FILE__, __LINE__); rc = OSSH_BN_DEC2BN_ERR; break; } do { // get the modulus if (!(cp = strtok_r(NULL, " ", &lasts))) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } if (!(OSSL_FNCSELECT(_BN_dec2bn)(&n, cp))) { // printf("Error [%s:%d]: BN_dec2bn() failed...\n", __FILE__, __LINE__); rc = OSSH_BN_DEC2BN_ERR; break; } do { if (!(rsapub = OSSL_FNCSELECT(_RSA_new)())) { // printf("Error [%s:%d]: RSA_new() failed...\n", __FILE__, __LINE__); rc = OSSH_RSA_NEW_ERR; break; } rsapub->n = n; rsapub->e = e; } while (0); if (rc) { OSSL_FNCSELECT(_BN_free)(n); break; } } while (0); if (rc) { OSSL_FNCSELECT(_BN_free)(e); break; } // get the user id, if any--normally, there should be a // user@hostname id if (usrid&&(cp = strtok_r(NULL, " \n", &lasts))) *usrid = strdup(cp); } else { // version 2 public key char *lasts, *buf = NULL; size_t len; // get the base64 key encoding if (!(cp = strtok_r(cp+strlen(KEYTYPE_STR_RSA), " ", &lasts))) { // printf("Error [%s:%d]: invalid RSA public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } if (!(buf = malloc(2*(len=strlen(cp)+1)))) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, len); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, buf); do { { // decode the base64 encoded public key data BIO *bio, *b64; if (!(bio = OSSL_FNCSELECT(_BIO_new_mem_buf)(cp, -1))) { // printf("Error [%s:%d]: BIO_new_mem_buf() failed...\n", __FILE__, __LINE__); rc = OSSH_BIO_NEW_MEMBUF_ERR; break; } pthread_cleanup_push((void(*)(void *))OSSL_FNCSELECT(_BIO_free_all), bio); do { if (!(b64 = OSSL_FNCSELECT(_BIO_new)(OSSL_FNCSELECT(_BIO_f_base64)()))) { // printf("Error [%s:%d]: BIO_new failed...\n", __FILE__, __LINE__); rc = OSSH_BIO_NEW_ERR; break; } #if defined(BIO_set_flags) BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); #else OSSL_FNCSELECT(_BIO_set_flags)(b64, BIO_FLAGS_BASE64_NO_NL); #endif if (!(bio = OSSL_FNCSELECT(_BIO_push)(b64, bio))) { // printf("Error [%s:%d]: BIO_push() failed...\n", __FILE__, __LINE__); OSSL_FNCSELECT(_BIO_free)(b64); rc = OSSH_BIO_PUSH_ERR; break; } if (0>=(len = OSSL_FNCSELECT(_BIO_read)(bio, buf, len))) { // printf("Error [%s:%d]: BIO_read() failed...\n", __FILE__, __LINE__); rc = OSSH_BIO_READ_ERR; break; } } while (0); pthread_cleanup_pop(1); // BIO_free_all(bio); } if (rc) break; { // make sense of the public key data BIGNUM *e = NULL, *n = NULL; char *cp = buf; // check the key type int len = ntohl(*((int *)cp)); if (strncmp(cp+=sizeof(int), KEYTYPE_STR_RSA, len)) { // printf("Error [%s:%d]: invalid public key format\n", __FILE__, __LINE__); rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } else cp += len; do { // read the public exponent len = ntohl(*((int *)cp)); cp += sizeof(int); if (!(e = OSSL_FNCSELECT(_BN_bin2bn)(cp, len, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for the public exponent...\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } cp += len; // read the modulus len = ntohl(*((int *)cp)); cp += sizeof(int); // read the modulus if (!(n = OSSL_FNCSELECT(_BN_bin2bn)(cp, len, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for modulus...\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } if (!(rsapub = OSSL_FNCSELECT(_RSA_new)())) { // printf("Error [%s:%d]: RSA_new() failed...\n", __FILE__, __LINE__); rc = OSSH_RSA_NEW_ERR; break; } rsapub->n = n; rsapub->e = e; } while (0); if (rc) { if (e) OSSL_FNCSELECT(_BN_free)(e); if (n) OSSL_FNCSELECT(_BN_free)(n); } } } while (0); pthread_cleanup_pop(1); // free(buf); if (rc) break; if (usrid&&(cp = strtok_r(NULL, " \n", &lasts))) *usrid = strdup(cp); } } while (0); pthread_cleanup_pop(1); // free(ts); } while (0); return rsapub; } #define SSHRSA1_FILE_IDSTR "SSH PRIVATE KEY FILE FORMAT 1.1\n" RSA * _read_rsa1_private_key( FILE *strm) { RSA *rsaprv = NULL; do { // get the file desriptor number and check the size of the private key // file int strmfsize = 0; char *strmfbuf; int strmfd = fileno(strm); if (0>strmfd) { // printf("Error [%s:%d]: fileno() failed w/errno = %d\n", __FILE__, __LINE__, errno); break; } { struct stat strmstat = {0}; if (0>fstat(strmfd, &strmstat)) { // printf("Error [%s:%d]: fstat() failed w/errno = %d\n", __FILE__, __LINE__, errno); break; } if ((0==(strmfsize = strmstat.st_size))||(1024*1024<strmfsize)) { // printf("Error [%s:%d]: private key file out of range (%d bytes)\n", __FILE__, __LINE__, strmfsize); break; } } // allocate memory for the private key file content if(!(strmfbuf = malloc(strmfsize))) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); break; } pthread_cleanup_push((void(*)(void *))free, strmfbuf); do { // read the private key file size_t nbytes; if (0>(nbytes = read(strmfd, strmfbuf, strmfsize))) { // printf("Error [%s:%d]: read() failed w/errno = %d\n", __FILE__, __LINE__, nbytes); break; } if (nbytes != strmfsize) { // printf("Error [%s:%d]: failed to read the entire private key file\n", __FILE__, __LINE__); break; } { // check the private key file contents char *cp = strmfbuf; if (strcmp(SSHRSA1_FILE_IDSTR, cp)) { // printf("Error [%s:%d]: not an RSA1 private key file\n", __FILE__, __LINE__); break; } cp += strlen(SSHRSA1_FILE_IDSTR)+1; // check the cipher type if (0!=cp[0]) { // printf("Error [%s:%d]: no support for passphrase protected private key files\n", __FILE__, __LINE__); break; } else cp++; // skip the reserved data cp += sizeof(int); { int rc = 0; BIGNUM *n = NULL, *e = NULL, *d = NULL, *iqmp = NULL, *p = NULL, *q = NULL; do { // next is the public key int pkeysize; short bnsize; size_t bnbytes; // the key size -- not really used pkeysize = ntohl(*((unsigned int *)cp)); cp += sizeof(unsigned int); // the modulus bnsize = ntohs(*((unsigned short int *)cp)); cp += sizeof(unsigned short int); bnbytes = (bnsize +7)/8; if (!(n = OSSL_FNCSELECT(_BN_bin2bn)(cp, bnbytes, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for modulus\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += bnbytes; // the public exponent bnsize = ntohs(*((unsigned short int *)cp)); cp += sizeof(unsigned short int); bnbytes = (bnsize+7)/8; if (!(e = OSSL_FNCSELECT(_BN_bin2bn)(cp, bnbytes, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for public exponent\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += bnbytes; // skip the comment bnbytes = ntohl(*((unsigned int *)cp)); cp += sizeof(unsigned int); cp += bnbytes; // check the cipher verification data if ((cp[0]!=cp[2])||(cp[1]!=cp[3])) { // printf("Error [%s:%d]: cipher verification failure\n", __FILE__, __LINE__); rc = OSSH_CIPHER_VERIF_ERR; break; } else cp += sizeof(unsigned int); // get private key bnsize = ntohs(*((unsigned short int *)cp)); cp += sizeof(unsigned short int); bnbytes = (bnsize+7)/8; if (!(d = OSSL_FNCSELECT(_BN_bin2bn)(cp, bnbytes, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for private key\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += bnbytes; // get (q^-1)mod(p) bnsize = ntohs(*((unsigned short int *)cp)); cp += sizeof(unsigned short int); bnbytes = (bnsize+7)/8; if (!(iqmp = OSSL_FNCSELECT(_BN_bin2bn)(cp, bnbytes, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for (q^-1)mod(p)\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += bnbytes; // get prime factors bnsize = ntohs(*((unsigned short int *)cp)); cp += sizeof(unsigned short int); bnbytes = (bnsize+7)/8; if (!(q = OSSL_FNCSELECT(_BN_bin2bn)(cp, bnbytes, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for prime factor q\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } else cp += bnbytes; bnsize = ntohs(*((unsigned short int *)cp)); cp += sizeof(unsigned short int); bnbytes = (bnsize+7)/8; if (!(p = OSSL_FNCSELECT(_BN_bin2bn)(cp, bnbytes, NULL))) { // printf("Error [%s:%d]: BN_bin2bn() failed for prime factor p\n", __FILE__, __LINE__); rc = OSSH_BN_BIN2BN_ERR; break; } // create an RSA key and fill it in if (!(rsaprv = OSSL_FNCSELECT(_RSA_new)())) { // printf("Error [%s:%d]: RSA_new() failed...\n", __FILE__, __LINE__); rc = OSSH_RSA_NEW_ERR; break; } rsaprv->n = n; rsaprv->e = e; rsaprv->d = d; rsaprv->p = p; rsaprv->q = q; rsaprv->iqmp = iqmp; } while (0); if (rc) { if (n) OSSL_FNCSELECT(_BN_free)(n); if (e) OSSL_FNCSELECT(_BN_free)(e); if (d) OSSL_FNCSELECT(_BN_free)(d); if (iqmp) OSSL_FNCSELECT(_BN_free)(iqmp); if (p) OSSL_FNCSELECT(_BN_free)(p); if (q) OSSL_FNCSELECT(_BN_free)(q); } } } } while (0); pthread_cleanup_pop(1); // free(strmfbuf); } while (0); return rsaprv; } #include <time.h> int _prng_random(unsigned int *prn) { int rc = 0; unsigned int *_prngData; do { // get the thread specific data for the PRNG if (!(_prngData = pthread_getspecific(_prngKey))) { // allocate memory for the thread specific PRNG data if (!(_prngData = calloc(1, sizeof(unsigned int)))) { // printf("Error [%s:%d]: calloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } { // seed the PRNG data #ifdef _AIX struct timespec ts = {0}; clock_gettime(CLOCK_REALTIME, &ts); *_prngData = (unsigned int)(ts.tv_sec^ts.tv_nsec); #else struct timeval tv = {0}; gettimeofday(&tv, NULL); *_prngData = (unsigned int)(tv.tv_sec^tv.tv_usec); #endif } // set the PRNG data if (rc = pthread_setspecific(_prngKey, _prngData)) { // printf("Error [%s:%d]: pthread_setspecific() failed w/rc = %d\n", __FILE__, __LINE__, rc); rc = OSSH_PTHRD_SETSPECIFIC_ERR; break; } } { // mangle the _prngData #ifdef _AIX struct timespec ts = {0}; clock_gettime(CLOCK_REALTIME, &ts); *_prngData |= (unsigned int)(ts.tv_sec^ts.tv_nsec); #else struct timeval tv = {0}; gettimeofday(&tv, NULL); *_prngData |= (unsigned int)(tv.tv_sec^tv.tv_usec); #endif } *prn = rand_r(_prngData); } while (0); return rc; } int _generate_session_key( RSA *pub, unsigned char *key, size_t *keylen) { // this routine generates a 128bit AES key and encrypts it with the // RSA public key provided // will not check the arguments because I control how this routine // is called int rc = 0; unsigned char rawkey[16]; size_t tkeylen; do { // generate the key int i = 0; for(;i<4; i++) if (rc = _prng_random((unsigned int *)((void *)rawkey+i*sizeof(unsigned int)))) break; if (rc) break; // encrypt the key if (0>(tkeylen = OSSL_FNCSELECT(_RSA_public_encrypt)(16, rawkey, key, pub, RSA_PKCS1_PADDING))) { // printf("Error [%s:%d]: RSA_public_encrypt() failed for session key\n", __FILE__, __LINE__); rc = OSSH_RSA_PUBLIC_ENCRYPT_ERR; break; } *keylen = tkeylen; } while (0); return rc; } int _recover_session_key( RSA *prv, unsigned char *ekey, size_t ekeylen, unsigned char *key, size_t *keylen) { // this routine recovers the key data from the encrypted key // material in the identity token; the encrypted material was // generated by encrypting a raw 128bit AES key with the user's // OpenSSH RSA public key; therefore, the recovery of the session // key uses the user's OpenSSH RSA private key to decrypt the // encrypted key material // it assumes valid arguments int rc = 0; unsigned char *tbuf; do { if (16>*keylen) { // not enough memory to store the return session key // printf("Error [%s:%d]: not enough memory for the session key; bytes required: 16\n", __FILE__, __LINE__): *keylen=16; rc = OSSH_MEMORY_ERR; break; } // allocate memory for a temporary buffer if (!(tbuf = malloc(OSSL_FNCSELECT(_RSA_size)(prv)))) { // unable to allocate memory for the encrypted key // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); *keylen = 0; rc = OSSH_MEMORY_ERR; break; } do { // decrypt the encrypted key if (16 != OSSL_FNCSELECT(_RSA_private_decrypt)(ekeylen, ekey, tbuf, prv, RSA_PKCS1_PADDING)) { rc = OSSH_RSA_PRIVATE_DECRYPT_ERR; break; } memcpy(key, tbuf, *keylen=16); } while (0); free(tbuf); } while (0); return rc; } int psm__init( char *opts) { int rc = 0; do { // create a pthread key for the pseudo-random specific data if (rc = pthread_key_create(&_prngKey, free)) { // printf("Error [%s:%d]: pthread_key_create() failed w/rc = %d\n", __FILE__, __LINE__, rc); rc = OSSH_PTHRD_KEYCREATE_ERR; break; } if (!opts||('\0'==opts)) break; { char *tcp, *lasts, *cp = strdup(opts); if (!cp) { // printf("Error [%s:%d]: strdup() failed w/errno = %s\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } do { tcp = strtok_r(cp, ",", &lasts); do { switch (*tcp) { case 't': if ('='!=*++tcp) break; { time_t tidtokTTL; if (0==(tidtokTTL = strtol(++tcp, NULL, 10))) { // printf("Error [%s:%d]: TTL value must be a positive number\n", __FILE__, __LINE__); break; } if (0>tidtokTTL) _idtokTTL = 0; else _idtokTTL = tidtokTTL; } break; case 'v': if ('='!=*++tcp) break; if (PATH_MAX-25<strlen(++tcp)) { // printf("Error [%s:%d]: Version must have a valid format for openssl\n", __FILE__, __LINE__); break; } osslversion = strdup(tcp); break; case 'z': if ('='!=*++tcp) break; if (PATH_MAX-1<strlen(++tcp)) { // printf("Error [%s:%d]: Authorized keys file must be a valid file name\n", __FILE__, __LINE__); break; } authzkeyfile = strdup(tcp); break; default: // skip unknown options break; } } while (tcp = strtok_r(NULL, ",", &lasts)); } while (0); free(cp); } { // open the libcrypto.so library and resolve required symbols char osslcryptolib[PATH_MAX+1] = "", *errmsg = NULL; int i; void *p; #if defined(_LINUX) #if defined(__64BIT__) strcpy(osslcryptolib, "/usr/lib64/libcrypto.so"); #else strcpy(osslcryptolib, "/usr/lib/libcrypto.so"); #endif if (osslversion) { strcat(osslcryptolib, "."); strcat(osslcryptolib, osslversion); } p = dlopen(osslcryptolib, RTLD_NOW); if (!p) { char *errmsg = dlerror(); // printf("Error [%s:%d]: dlopen() failed: %s\n", __FILE__, __LINE__, errmsg?errmsg:"<no error message>"); rc = OSSH_DLOPEN_ERR; break; } for (i=0; i<OSSL_FNCSTBLE_SIZE; i++) { if (!(ossl_fncstble[i].fncpntr = dlsym(p, ossl_fncstble[i].fncname))) { if (!strcmp(ossl_fncstble[i].fncname, "BIO_set_flags")) { ossl_fncstble[i].fncpntr = _fp_BIO_set_flags; continue; } errmsg = dlerror(); // printf("Error [%s:%d]: dlsym() failed for %s: %s\n", __FILE__, __LINE__, ossl_fncstble[i].fncname, errmsg?errmsg:"<no error message>"); rc = OSSH_DLSYM_ERR; break; } } if (rc) break; #elif !defined(_AIX) rc = OSSH_DLOPEN_ERR; break; #endif } } while (0); return rc; } void psm__cleanup() { do { // nothing to do } while (0); return; } typedef union { u_int64_t l; u_int32_t i[2]; u_int16_t s[4]; u_int8_t c[8]; } Uu_int64_t; #define IDTOK_LEN_MIN 32 #define IDTOK_LEN (4*1024) int _increase_tknsize( size_t len, void **p, size_t *nlen) { int rc = 0; do { void *tp = NULL; size_t tlen = (len/IDTOK_LEN+1)*IDTOK_LEN; if (!(tp = realloc(*p, tlen))) { // printf("Error [%s:d]: realloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } *p = tp; *nlen = tlen; } while (0); return rc; } int psm__get_id_token( char *ruser, char *rhost, psm_idbuf_t idtok) { int rc = 0; do { if (!idtok) { // printf("Error [%s:%d]: invalid id buffer descriptor\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } { char *idfpath = NULL, *pubidfpath = NULL; if (rc = _get_identity_fname(NULL, ruser, rhost, &idfpath)) break; pthread_cleanup_push((void(*)(void *))free, idfpath); do { if (!(pubidfpath = malloc(strlen(idfpath)+strlen(".pub")+1))) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, pubidfpath); do { strcpy(pubidfpath, idfpath); strcat(pubidfpath, ".pub"); { struct stat idfstat = {0}; if (0>stat(pubidfpath, &idfstat)) { // printf("Error [%s:%d]: stat() failed for %s: errno = %d\n", __FILE__, __LINE__, pubidfpath, errno); rc = OSSH_PIDFILE_PATH_ERR; break; } if (0==idfstat.st_size) { // printf("Error [%s:%d]: invalid public identity file (size = %d)\n", __FILE__, __LINE__, idfstat.st_size); rc = OSSH_PIDFILE_SIZE_ERR; break; } } { // read the keys RSA *rsaprv = NULL, *rsapub = NULL; DSA *dsaprv = NULL, *dsapub = NULL; char usridstr[1024] = ""; int usridstrlen = strlen(usridstr); do { { // open the private identity file FILE *idfstrm = fopen(idfpath, "r"); if (!idfstrm) { // printf("Error [%s:%d]: fopen() failed for %s: errno = %d\n", __FILE__, __LINE__, idfpath, errno); rc = OSSH_IDFILE_OPEN_ERR; break; } pthread_cleanup_push((void(*)(void *))fclose, idfstrm); do { // read the private key if (rsaprv = _read_rsa1_private_key(idfstrm)) break; // rewind the stream to the beginning fseek(idfstrm, 0, SEEK_SET); if (rsaprv = OSSL_FNCSELECT(_PEM_read_RSAPrivateKey)(idfstrm, NULL, NULL, "")) break; // rewind the stream to the beginning fseek(idfstrm, 0, SEEK_SET); if (dsaprv = OSSL_FNCSELECT(_PEM_read_DSAPrivateKey)(idfstrm, NULL, NULL, "")) break; // printf("Error [%s:%d]: unable to read user's private key\n", __FILE__, __LINE__); rc = OSSH_IDFILE_READ_ERR; break; } while (0); pthread_cleanup_pop(1); // fclose(idfstrm); if (rc) break; } // the type of key in the public identity file can be derived from // the type of the private key; if the private key is a DSA key, // the public key must be also a DSA key; if the private key is an // RSA key, the public identity file may containe either an SSH-1 // or an SSH-2 formatted RSA public key { // open the public identity file char *usrid = NULL; FILE *idfstrm = NULL; pthread_cleanup_push((void(*)(void *))_nfree, usrid); do { if (!(idfstrm=fopen(pubidfpath, "r"))) { // printf("Error [%s:%d]: fopen() failed for %s: errno = %d\n", __FILE__, __LINE__, pubidfpath, errno); rc = OSSH_PIDFILE_OPEN_ERR; break; } pthread_cleanup_push((void(*)(void *))fclose, idfstrm); do { char *cp, pubkeydata[8*1024] = ""; if (!(cp = fgets(pubkeydata, 8*1024, idfstrm))) { // printf("Error [%s:%d]: fgets() failed or EOF\n", __FILE__, __LINE__); rc = OSSH_PIDFILE_GETS_ERR; break; } if (dsaprv) { // this must be a DSA public key file if (!(dsapub = _read_dsa_public_key(cp, &usrid))) rc = OSSH_DSA_INVALID_FORMAT_ERR; break; } if (!(rsapub = _read_rsa_public_key(cp, &usrid))) { rc = OSSH_RSA_INVALID_FORMAT_ERR; break; } } while (0); pthread_cleanup_pop(1); // fclose(idfstrm); if (rc) break; { // build the id token and sign it; start w/a 4k buffer and realloc if // necessary // the id token's structure is as follows: // 4 bytes: magic - "ossh" #define IDTOK_OFFST_STATVER 4 // 1 byte: status (high nibble) and version (low nibble) #define IDTOK_OFFST_KEYTYPE 5 // 1 byte: key type - 1 for DSA, 2 for RSA #define IDTOK_OFFST_NONCE 6 // 8 bytes: nonce #define IDTOK_OFFST_TMSTAMP 14 // 8 bytes: time stamp #define IDTOK_OFFST_IDDATA 22 // 2 bytes: length of target user name - N bytes // N bytes: target user name // 2 bytes: length of target host name - M bytes // M bytes: target host name // 2 bytes: length of user name - P bytes // P bytes: user name // 2 bytes: length of encrypted session key - Q bytes // Q bytes: encrypted session key // 2 bytes: length of id token signature - R bytes // R bytes: id token signature // minimum length of the id token is 34 bytes, including a minimum // 1 byte for the user id and a minimum 1 byte for the signature #define IDTOK_OFFST_MINLEN 32 #define IDTOK_MAGIC "ossh" size_t idtoklen = IDTOK_LEN, cidlen = 0; char *idtokbuf = (char *)malloc(IDTOK_LEN); if (!idtokbuf) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } do { // no cancellations points in this loop // write the magic, version and key type sprintf(idtokbuf, "%s", IDTOK_MAGIC); cidlen += strlen(IDTOK_MAGIC); *((unsigned char *)(idtokbuf+cidlen)) = 0x02; cidlen += sizeof(unsigned char); *((unsigned char *)(idtokbuf+cidlen)) = dsaprv?0x01:0x02; cidlen += sizeof(unsigned char); { // write the nonce... Uu_int64_t nonce; _prng_random((unsigned int *)&nonce.i[0]); _prng_random((unsigned int *)&nonce.i[1]); *((u_int32_t *)(idtokbuf+cidlen)) = htonl(nonce.i[0]); cidlen += sizeof(nonce.i[0]); *((u_int32_t *)(idtokbuf+cidlen)) = htonl(nonce.i[1]); cidlen += sizeof(nonce.i[0]); // ...and skip the time stamp--will do that later cidlen += sizeof(Uu_int64_t); } { // write the remote user id unsigned short ruserlen = ruser?strlen(ruser):0; if (idtoklen<(cidlen+sizeof(unsigned long)+ruserlen)) { // not enough space in the allocated id token buffer--need to // reallocate if (rc = _increase_tknsize(cidlen+sizeof(unsigned long)+ruserlen, (void **)&idtokbuf, &idtoklen)) break; } // write the remote user id length... *((unsigned short *)(idtokbuf+cidlen)) = htons(ruserlen); cidlen += sizeof(unsigned short); // ...and the remote user id if (ruserlen) { sprintf(idtokbuf+cidlen, "%s", ruser); cidlen += ruserlen; } } { // write the remote host name unsigned short rhostlen = rhost?strlen(rhost):0; if (idtoklen<(cidlen+sizeof(unsigned long)+rhostlen)) { // not enough space in the allocated id token buffer--need to // reallocate if (rc = _increase_tknsize(cidlen+sizeof(unsigned long)+rhostlen, (void **)&idtokbuf, &idtoklen)) break; } // write the remote user id length... *((unsigned short *)(idtokbuf+cidlen)) = htons(rhostlen); cidlen += sizeof(unsigned short); // ...and the remote user id if (rhostlen) { sprintf(idtokbuf+cidlen, "%s", rhost); cidlen += rhostlen; } } // write the user id (len and value) if (!usrid) { /* build a user id, but for the time being return an error */ // printf("Error [%s:%d]: no user id\n", __FILE__, __LINE__); rc = OSSH_NOUSERID_ERR; break; } { size_t usridlen = strlen(usrid); if (SHRT_MAX < usridlen) { // printf("Error [%s:%d]: userid too long\n", __FILE__, __LINE__); rc = OSSH_USERID_LEN_ERR; break; } if (idtoklen<(cidlen+sizeof(unsigned short)+usridlen)) { // not enough space in the allocated id token buffer--need to // reallocate if (rc = _increase_tknsize(cidlen+sizeof(unsigned short)+usridlen, (void **)&idtokbuf, &idtoklen)) break; } // write the user id length... *((unsigned short *)(idtokbuf+cidlen)) = htons((unsigned short)usridlen); cidlen += sizeof(unsigned short); // ...and the user id sprintf(idtokbuf+cidlen, "%s", usrid); cidlen += usridlen; } { // generate an encrypted, 128bit AES session key; this will be done // only for RSA identity keys; // the whole idea with generating a session key is based on how // customers use such a large system like an HPC cluster; usually, // the user's home directory is mounted on the compute nodes, so // the application has access to the user's ~/.ssh subdir; when end // users setup key-based login, they add the OpenSSH public key to // their own authorized keys file and, on the compute node, they // use the public key from their own authorized keys file to login // as themselves on the compute node; however, in addition to the // authorized keys file, users also have access to their own // private key file, and that is what I am trying to exploit here; // of course, in the grand schema of things, there is still the // question of the network file system services accessing the end // user's home directory (and their private key, respectively)--if // that is not secure and the private key can be sniffed off the // network, what's the point having this key distibution mechanism? // one could ask; the answer lays in what we try to protect here, // and that is separating users from each others and ensureing that // one end-user does not submit jobs as another end-user; // in addition to user's home directory setup, this mechanism // requires RSA keys; to keep the key distribution simple and // scalable, the authn/authz mechanism employs a 1-to-many // communication path, i.e. one client to many servers; // consequentely, there is no negotiation between the client and // the server; the server uses whatever the client sends, in one // shot, and that's it; all servers receive the same identity token // from the client; so the key is generated on the client side and // sent to the servers encrypted with the user's public key; the // servers decrypt the session key with the users's private key and // subsequently use it; the encryption and decryption with the // user's public and private key requires a key type that supports // such operations and the DSA standard does not support encryption // and decryption (that's not to say that one cannot use elliptic // keys to encrypt and decrypt data); consequently, the session key // can be distributed only if the user's identity file contains an // RSA key (i.e. it is either an SSH-1 or SSH-2 RSA identity file); size_t skeylen = 0; unsigned char *keybuf = NULL; do { if (rsapub) { if (!(keybuf = malloc(2*(skeylen=OSSL_FNCSELECT(_RSA_size)(rsapub))))) { // unable to allocate memory for the encrypted key // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } if (rc = _generate_session_key(rsapub, keybuf, &skeylen)) break; } // write the encrypted key and its length if (idtoklen<(cidlen+sizeof(unsigned short)+skeylen)) { // not enough space in the allocated id token buffer--need to // reallocate if (rc = _increase_tknsize(cidlen+sizeof(unsigned short)+skeylen, (void **)&idtokbuf, &idtoklen)) break; } *((unsigned short *)(idtokbuf+cidlen)) = htons((unsigned short)skeylen); cidlen += sizeof(unsigned short); if (skeylen) { memcpy((void *)(idtokbuf+cidlen), (void *)keybuf, skeylen); cidlen += skeylen; } } while (0); if (keybuf) free(keybuf); if (rc) break; } { // time stamp the id token Uu_int64_t tmstamp; tmstamp.l = time(NULL); #if BYTE_ORDER == LITTLE_ENDIAN *((u_int32_t *)(idtokbuf+IDTOK_OFFST_TMSTAMP)) = htonl(tmstamp.i[1]); *((u_int32_t *)(idtokbuf+IDTOK_OFFST_TMSTAMP+sizeof(tmstamp.i[1]))) = htonl(tmstamp.i[0]); #elif BYTE_ORDER == BIG_ENDIAN *((u_int32_t *)(idtokbuf+IDTOK_OFFST_TMSTAMP)) = htonl(tmstamp.i[0]); *((u_int32_t *)(idtokbuf+IDTOK_OFFST_TMSTAMP+sizeof(tmstamp.i[0]))) = htonl(tmstamp.i[1]); #else #error BYTE_ORDER must be either BIG_ENDIAN or LITTLE_ENDIAN #endif } { // sign the id token char idtoksha1[20] = ""; unsigned int idtoksiglen = dsaprv?OSSL_FNCSELECT(_DSA_size)(dsaprv):OSSL_FNCSELECT(_RSA_size)(rsaprv); if (0==idtoksiglen) { // printf("Error [%s:%d]: invalid public key size...\n", __FILE__, __LINE__); rc = OSSH_DRSA_SIZE_ERR; break; } if (!OSSL_FNCSELECT(_SHA1)(idtokbuf, cidlen, idtoksha1)) { // printf("Error [%s:%d]: SHA1() failed for id token\n", __FILE__, __LINE__); rc = OSSH_SHA1_ERR; break; } if (idtoklen<cidlen+sizeof(unsigned short)+idtoksiglen) { // not enough space in the allocated id token buffer--need to // reallocate if (rc = _increase_tknsize(cidlen+sizeof(unsigned short)+idtoksiglen, (void **)&idtokbuf, &idtoklen)) break; } cidlen += sizeof(unsigned short); // write the signature... if (!(dsaprv?OSSL_FNCSELECT(_DSA_sign)(NID_sha1, idtoksha1, 20, (char *)(idtokbuf+cidlen), &idtoksiglen, dsaprv): OSSL_FNCSELECT(_RSA_sign)(NID_sha1, idtoksha1, 20, (char *)(idtokbuf+cidlen), &idtoksiglen, rsaprv))) { // printf("Error [%s:%d]: DSA/RSA_sign() failed...\n", __FILE__, __LINE__); rc = OSSH_DRSA_SIGN_ERR; break; } // ...and the signature length *((unsigned short *)(idtokbuf+cidlen-sizeof(unsigned short))) = htons((unsigned short)idtoksiglen); cidlen += idtoksiglen; // scale back the memory allocated for the id token buf. if need be if (cidlen<idtoklen) idtokbuf = realloc(idtokbuf, cidlen); idtok->iov_base = idtokbuf; idtok->iov_len = cidlen; } } while (0); if (rc) { memset(idtokbuf, 0, idtoklen); free(idtokbuf); } } } while (0); pthread_cleanup_pop(1); // _nfree(usrid) } } while (0); // cleanup the public keys if (rsaprv) OSSL_FNCSELECT(_RSA_free)(rsaprv); if (rsapub) OSSL_FNCSELECT(_RSA_free)(rsapub); if (dsaprv) OSSL_FNCSELECT(_DSA_free)(dsaprv); if (dsapub) OSSL_FNCSELECT(_DSA_free)(dsapub); } } while (0); pthread_cleanup_pop(1); // free(pubidfpath); } while (0); pthread_cleanup_pop(1); // free(idfpath); } } while (0); return rc; } #define IDTOK_STAT_VRFIED 0x80 #define IDTOK_STAT_ISVRFIED(idtok) \ (IDTOK_STAT_VRFIED&(*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER)))) #define IDTOK_STAT_SETVRFIED(idtok) \ (*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER)) |= IDTOK_STAT_VRFIED) #define IDTOK_STAT_CLRVRFIED(idtok) \ (*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER)) &= ~IDTOK_STAT_VRFIED) #define IDTOK_STAT_SKEY 0x40 #define IDTOK_STAT_HASKEY(idtok) \ (IDTOK_STAT_SKEY&(*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER)))) #define IDTOK_STAT_SETSKEY(idtok) \ (*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER)) |= IDTOK_STAT_SKEY) #define IDTOK_STAT_CLRSKEY(idtok) \ (*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER)) &= ~IDTOK_STAT_SKEY) int psm__verify_id_token( char *uname, psm_idbuf_t idtok) { int rc = 0; do { if (!idtok || !idtok->iov_base || (IDTOK_LEN_MIN>=idtok->iov_len)) { // printf("Error [%s:%d]: invalid id buffer descriptor\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } if (!uname||('\0'==uname[0])) { // printf("Error [%s:%d]: invalid user name\n", __FILE__, __LINE__); rc = OSSH_UNAME_INVALID_ERR; break; } { // check the id token size_t idtokbuflen = 0; unsigned char keytype = 0; char *cp = idtok->iov_base; int idtokver = 0; if (strncmp(cp, "ossh", strlen("ossh"))) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } else cp += strlen("ossh"); if ((1!=(idtokver=0x0f&(*((unsigned char *)cp))))&&(2!=idtokver)) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } else cp += sizeof(unsigned char); if ((0x01!=(keytype = *cp))&&(0x02!=keytype)) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } else cp += sizeof(unsigned char); // skip the nonce cp += sizeof(Uu_int64_t); { // check the time against the skew time_t ltime = time(NULL); Uu_int64_t tmstamp = {0}; #if BYTE_ORDER == LITTLE_ENDIAN tmstamp.i[1] = ntohl(*((u_int32_t *)cp)); cp += sizeof(tmstamp.i[1]); tmstamp.i[0] = ntohl(*((u_int32_t *)cp)); cp += sizeof(tmstamp.i[0]); #elif BYTE_ORDER == BIG_ENDIAN tmstamp.i[0] = ntohl(*((u_int32_t *)cp)); cp += sizeof(tmstamp.i[0]); tmstamp.i[1] = ntohl(*((u_int32_t *)cp)); cp += sizeof(tmstamp.i[1]); #endif if (_idtokTTL&&(ltime>(time_t)tmstamp.l+_idtokTTL)) { // printf("Error [%s:%d]: id token skew too big\n", __FILE__, __LINE__); rc = OSSH_IDTOK_SKEW_ERR; break; } } { // check the remote user id unsigned short tuserlen = ntohs(*((unsigned short *)cp)); cp += sizeof(unsigned short); if (tuserlen&&((tuserlen!=strlen(uname))||strncmp(uname, cp, tuserlen))) { // printf("Error [%s:%d]: id token not valid for target user %s\n", __FILE__, __LINE__, uname); rc = OSSH_IDTOK_USER_ERR; break; } cp += tuserlen; } { // skip the host -- we'll come back to it, if need be unsigned short thostlen = ntohs(*((unsigned short *)cp)); cp += sizeof(unsigned short); cp += thostlen; } { char *rusrnid, idtoksha1[20] = ""; unsigned short rusrnidlen = ntohs(*((unsigned short *)cp)); cp += sizeof(unsigned short); if (!rusrnidlen) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } if (idtok->iov_len<((void *)cp-idtok->iov_base+rusrnidlen)) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } if (!(rusrnid = malloc(rusrnidlen+1))) { // printf("Error [%s:%d]: malloc() failed w/errno = %d\n", __FILE__, __LINE__, errno); rc = OSSH_MEMORY_ERR; break; } pthread_cleanup_push((void(*)(void *))free, rusrnid); do { strncpy(rusrnid, cp, rusrnidlen); rusrnid[rusrnidlen] = '\0'; // skip the target user id cp += rusrnidlen; // skip the session key, if any if (1<idtokver) { // id tokens version 2 and above have a session key field unsigned short skeylen = ntohs(*((unsigned short *)cp)); cp += sizeof(unsigned short)+skeylen; } idtokbuflen = (size_t)((void *)cp-idtok->iov_base); // calculate the SHA1 digest if (!(OSSL_FNCSELECT(_SHA1)(idtok->iov_base, idtokbuflen, idtoksha1))) { // printf("Error [%s:%d]: SHA1() failed for id token\n", __FILE__, __LINE__); rc = OSSH_SHA1_ERR; break; } { // get the signature and its length unsigned short idtoksiglen = ntohs(*((unsigned short *)cp)); unsigned char *idtoksig = (unsigned char *)(cp+=sizeof(unsigned short)); if (!idtoksiglen) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } if (idtok->iov_len<((void *)cp-idtok->iov_base+idtoksiglen)) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } { // get the name of the authorized key file char *azfpath = NULL; if (rc = _get_authz_fname(uname, &azfpath)) { // printf("Error [%s:%d]: invalid authorized key file\n", __FILE__, __LINE__); break; } pthread_cleanup_push((void(*)(void *))free, azfpath); do { // open the authorized keys file and read it, one line at a time FILE *azfstrm = NULL; if (!(azfstrm=fopen(azfpath, "r"))) { // printf("Error [%s:%d]: fopen() failed for %s: errno = %d\n", __FILE__, __LINE__, azfpath, errno); rc = OSSH_AUTHZFILE_OPEN_ERR; break; } pthread_cleanup_push((void(*)(void *))fclose, azfstrm); do { char *cp, pubkeydata[8*1024] = ""; do { if (!(cp = fgets(pubkeydata, 8*1024, azfstrm))) { // printf("Error [%s:%d]: fgets() failed or EOF\n", __FILE__, __LINE__); rc = OSSH_AUTHZFILE_GETS_ERR; break; } if ('#' != *cp) { DSA *dsapub = NULL; RSA *rsapub = NULL; char *usrid = NULL; // try to read the key data as RSA if (0x01==keytype) { if (!(dsapub = _read_dsa_public_key(cp, &usrid))) continue; if (usrid&&strcmp(usrid, rusrnid)) { // user ids don't match OSSL_FNCSELECT(_DSA_free)(dsapub); free(usrid); continue; } rc = OSSL_FNCSELECT(_DSA_verify)(NID_sha1, idtoksha1, 20, idtoksig, idtoksiglen, dsapub); OSSL_FNCSELECT(_DSA_free)(dsapub); if (!rc||(0>rc)) { rc = OSSH_DSA_VERIFY_ERR; // printf("Error [%s:%d]: DSA_verify() failed...\n", __FILE__, __LINE__); // there is no user id associated w/this key, so // I'll continue searching for another DSA key continue; } else rc = 0; if (usrid) free(usrid); break; } if (0x02==keytype) { if (!(rsapub = _read_rsa_public_key(cp, &usrid))) continue; if (usrid&&strcmp(usrid, rusrnid)) { // user ids don't match OSSL_FNCSELECT(_RSA_free)(rsapub); free(usrid); continue; } rc = OSSL_FNCSELECT(_RSA_verify)(NID_sha1, idtoksha1, 20, idtoksig, idtoksiglen, rsapub); OSSL_FNCSELECT(_RSA_free)(rsapub); if (!rc||(0>rc)) { rc = OSSH_RSA_VERIFY_ERR; // printf("Error [%s:%d]: RSA_verify() failed...\n", __FILE__, __LINE__); // there is no user id associated w/this key, so // I'll continue searching for another RSA key continue; } else rc = 0; if (usrid) free(usrid); break; } } } while (1); if (rc) { // just to make sure the verified bit is not on IDTOK_STAT_CLRVRFIED(idtok); break; } else IDTOK_STAT_SETVRFIED(idtok); } while (0); pthread_cleanup_pop(1); // fclose(azfstrm); } while (0); pthread_cleanup_pop(1); // free(azfpath); } } } while (0); pthread_cleanup_pop(1); // free(rusrnid); } } } while (0); return rc; } int psm__free_id_token( psm_idbuf_t idtok) { int rc = 0; do { if (!idtok || !idtok->iov_base || (0==idtok->iov_len)) { // printf("Error [%s:%d]: invalid id buffer descriptor\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } free(idtok->iov_base); idtok->iov_base = (void *)NULL; idtok->iov_len = 0; } while (0); return rc; } int psm__get_id_from_token( psm_idbuf_t idtok, char *usrnid, size_t *usrnidlen) { int rc = 0; do { if (!idtok || !idtok->iov_base || (0==idtok->iov_len)) { // printf("Error [%s:%d]: invalid id buffer descriptor\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } if (!usrnidlen) { // printf("Error [%s:%d]: invalid userid buffer length\n", __FILE__, __LINE__); rc = OSSH_ARG_ERR; break; } if (!IDTOK_STAT_ISVRFIED(idtok)) { // printf("Error [%s:%d]: identity token is not verified\n", __FILE__, __LINE__); rc = OSSH_IDTOK_NOTVERIFD_ERR; break; } { size_t tusrnidlen; char *tusrnid; size_t nidoffset = IDTOK_OFFST_IDDATA; // skip the target user name nidoffset += ntohs(*((unsigned short *)(idtok->iov_base+nidoffset)))+sizeof(unsigned short); // skip the target host name nidoffset += ntohs(*((unsigned short *)(idtok->iov_base+nidoffset)))+sizeof(unsigned short); // get the user name (i.e. the client's name) tusrnidlen = ntohs(*((unsigned short *)(idtok->iov_base+nidoffset)))+1; if ((*usrnidlen<tusrnidlen)||(!usrnid)) { *usrnidlen = tusrnidlen; rc = PSM__MEMORY_ERR; break; } tusrnid = (char *)(idtok->iov_base+nidoffset+sizeof(unsigned short)); \ strncpy(usrnid, tusrnid, tusrnidlen-1); usrnid[tusrnidlen-1] = '\0'; *usrnidlen = tusrnidlen; } } while (0); return rc; } int psm__get_key_from_token( char *uname, psm_idbuf_t idtok, unsigned char *keybuf, size_t *keylen) { int rc = 0; do { if (!idtok || (NULL==idtok->iov_base) || (IDTOK_LEN_MIN>idtok->iov_len)) { // printf("Error [%s:%d]: invalid id buffer descriptor\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } if (!keylen) { // printf("Error [%s:%d]: invalid key buffer length\n", __FILE__, __LINE__); rc = OSSH_ARG_ERR; break; } if (!keybuf || (16>*keylen)) { // printf("Error [%s:%d]: not enough memory for the session key\n", __FILE__, __LINE__); *keylen = 16; rc = PSM__MEMORY_ERR; break; } // if user argument is provided, then I expect the token to have // been verified first if (uname && ('\0'!=*uname) && !IDTOK_STAT_ISVRFIED(idtok)) { // printf("Error [%s:%d]: identity token is not verified\n", __FILE__, __LINE__); rc = OSSH_IDTOK_NOTVERIFD_ERR; break; } // check the identity token if (strncmp((char *)idtok->iov_base, "ossh", strlen("ossh"))) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } { unsigned char idtokver = 0x0f&(*((unsigned char *)(idtok->iov_base+IDTOK_OFFST_STATVER))); if (2!=idtokver) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_IDTOK_INVALID_ERR; break; } } { unsigned char keytype = *((unsigned char *)(idtok->iov_base+IDTOK_OFFST_KEYTYPE)); if (0x02!=keytype) { // printf("Error [%s:%d]: invalid id token\n", __FILE__, __LINE__); rc = OSSH_SKEY_NOTRSA_ERR; break; } } { // check the user name, if provided char *cp = idtok->iov_base+IDTOK_OFFST_IDDATA; { size_t tuserlen = ntohs(*((unsigned short *)cp)); cp += sizeof(unsigned short); if (uname && ('\0' != *uname)) { // make sure it's the same as the remote user in the id token if (tuserlen&&((tuserlen!=strlen(uname))||strncmp(uname, cp-sizeof(unsigned short), tuserlen))) { // printf("Error [%s:%d]: id token not valid for target user %s\n", __FILE__, __LINE__, uname); rc = OSSH_IDTOK_USER_ERR; break; } } cp += tuserlen; } // skip the host name cp += ntohs(*((unsigned short *)cp)) + sizeof(unsigned short); // skip the remote user network id cp += ntohs(*((unsigned short *)cp)) + sizeof(unsigned short); { // check whether there is a session key // the public key used is RSA and there is a session key // get the user's identity file and try to de decrypt the // session key; if the user's identity file matches the public // keys used to initially encrypt the session key, then we can // decrypt the session key and will replace it w/the decrypted // value; this should work as the session key should be a // 128bit AES key, which is smaller than its encrypted version // (which is the size of the RSA key, at least 512bits); // any error encountered in this code path will not result // in invalidating the identity token, because the token has // already been verified; however, it will rezult in no session // key and no subsequent message authentication services size_t ekeylen = ntohs(*((unsigned short *)cp)); if (0 == ekeylen) { // printf("Error [%s:%d]: no session key in id token\n", __FILE__, __LINE__); rc = OSSH_SKEY_NOKEY_ERR; break; } cp += sizeof(unsigned short); { char *idfpath = NULL; RSA *rsaprv = NULL; if (rc = _get_identity_fname(uname, NULL, NULL, &idfpath)) break; pthread_cleanup_push((void(*)(void *))free, idfpath); do { // open the private identity file FILE *idfstrm = fopen(idfpath, "r"); if (!idfstrm) { // printf("Error [%s:%d]: fopen() failed for %s: errno = %d\n", __FILE__, __LINE__, idfpath, errno); rc = OSSH_IDFILE_OPEN_ERR; break; } pthread_cleanup_push((void(*)(void *))fclose, idfstrm); do { // read the private key if (rsaprv = _read_rsa1_private_key(idfstrm)) break; // rewind the stream to the beginning fseek(idfstrm, 0, SEEK_SET); if (rsaprv = OSSL_FNCSELECT(_PEM_read_RSAPrivateKey)(idfstrm, NULL, NULL, "")) break; // printf("Error [%s:%d]: unable to read user's private key\n", __FILE__, __LINE__); rc = OSSH_IDFILE_READ_ERR; break; } while (0); pthread_cleanup_pop(1); // fclose(idfstrm); } while (0); pthread_cleanup_pop(1); // free(idfpath); if (rc) break; pthread_cleanup_push((void(*)(void *))OSSL_FNCSELECT(_RSA_free), rsaprv); do { // now that I have the private key, decrypt the session key if (rc = _recover_session_key(rsaprv, cp, ekeylen, keybuf, keylen)) break; } while (0); pthread_cleanup_pop(1); // OSSL_FNCSELECT(_RSA_free) } } } } while (0); return rc; } int _generate_md5_digest( struct iovec *in, int cnt, unsigned char *digest) { // assumes valid arguments int rc = 0; struct iovec *tdata = in; do { MD5_CTX md5ctx = {0}; // initialize the MD5 engine if (1 != OSSL_FNCSELECT(_MD5_Init)(&md5ctx)) { // printf("Error [%s:%d]: MD5_Init() failed...\n", __FILE__, __LINE__); rc = OSSH_MD5_INIT_ERR; break; } while (cnt--) { if (1 != OSSL_FNCSELECT(_MD5_Update)(&md5ctx, tdata->iov_base, tdata->iov_len)) { // printf("Error [%s:%d]: MD5_Update() failed...\n", __FILE__, __LINE__); rc = OSSH_MD5_UPDATE_ERR; break; } tdata++; } if (rc) break; if (1 != OSSL_FNCSELECT(_MD5_Final)(digest, &md5ctx)) { // printf("Error [%s:%d]: MD5_Final() failed...\n", __FILE__, __LINE__); rc = OSSH_MD5_FINAL_ERR; break; } } while (0); return rc; } int psm__sign_data( unsigned char *key, size_t keylen, struct iovec *in, int cnt, struct iovec *sig) { // generate an MD5 digest of the messages received and then encrypt // the digest w/the 128bit AES key // data points to a NULL-terminated array of struct iovec scalars int rc = 0; do { if (!in || (0 == cnt)) { // printf("Error [%s:%d]: invalid data vector\n", __FILE__, __LINE__); rc = OSSH_DATA_INVALID_ERR; break; } { // generate the md5 digest unsigned char md5digest[MD5_DIGEST_LENGTH]; if (rc = _generate_md5_digest(in, cnt, md5digest)) break; { // sign the digest w/the AES key AES_KEY keysched = {0}; unsigned char *aescipher = malloc(AES_BLOCK_SIZE); if (!aescipher) { // printf("Error [%s:%d]: malloc() failed...\n", __FILE__, __LINE__); rc = OSSH_MEMORY_ERR; break; } if (rc = OSSL_FNCSELECT(_AES_set_encrypt_key)(key, 8*keylen, &keysched)) { // printf("Error [%s:%d]: AES_set_encrypt_key() failed...\n", __FILE__, __LINE__); rc = OSSH_AES_KEYSCHED_ERR; break; } OSSL_FNCSELECT(_AES_encrypt)(md5digest, aescipher, &keysched); sig->iov_base = aescipher; sig->iov_len = AES_BLOCK_SIZE; } } } while (0); return rc; } int psm__verify_data( unsigned char *key, size_t keylen, struct iovec *in, int cnt, struct iovec *sig) { int rc = 0; do { if (!sig||(!sig->iov_base)||(16!=sig->iov_len)) { // printf("Error [%s:%d]: signature is not valid\n", __FILE__, __LINE__); rc = OSSH_SIG_INVALID_ERR; break; } { struct iovec tsig = {0}; if (rc = psm__sign_data(key, keylen, in, cnt, &tsig)) break; if ((tsig.iov_len!=sig->iov_len)||memcmp(tsig.iov_base, sig->iov_base, tsig.iov_len)) { // printf("Error [%s:%d]: signature verification failed\n", __FILE__, __LINE__); rc = OSSH_SIG_SIGNATURE_ERR; } psm__free_signature(&tsig); } } while (0); return rc; } int psm__free_signature( struct iovec *sig) { int rc = 0; do { if (!sig || (0==sig->iov_len) || (!sig->iov_base)) { // printf("Error [%s:%d]: invalid signature descriptor\n", __FILE__, __LINE__); rc = OSSH_SIG_INVALID_ERR; break; } free(sig->iov_base); sig->iov_base = (void *)NULL; sig->iov_len = 0; } while (0); return rc; } // EOF
34.733032
218
0.671197
[ "vector" ]
431014c5cfed83e2f8b97b69684861c00927c1a8
3,582
h
C
XmlDocument/XmlParser/XmlParser.h
pampas93/ProjectDependency
f0ff9caea2e5065a125148378554d8d58f34bfac
[ "MIT" ]
null
null
null
XmlDocument/XmlParser/XmlParser.h
pampas93/ProjectDependency
f0ff9caea2e5065a125148378554d8d58f34bfac
[ "MIT" ]
null
null
null
XmlDocument/XmlParser/XmlParser.h
pampas93/ProjectDependency
f0ff9caea2e5065a125148378554d8d58f34bfac
[ "MIT" ]
null
null
null
#ifndef XMLPARSER_H #define XMLPARSER_H /////////////////////////////////////////////////////////////////// // XmlParser.h - build XML parse tree // // ver 1.3 // // Application: Support for XmlDocument, Summer 2015 // // Platform: Dell XPS 2720, Win 8.1 Pro, Visual Studio 2013 // // Author: Jim Fawcett, CST 4-187, 443-3948 // // jfawcett@twcny.rr.com // /////////////////////////////////////////////////////////////////// /* * Package Operations: * ------------------- * The XML Document Model is essentially a program-friendly wrapper * around an Abstract Syntax Tree (AST) used to contain the results * of parsing XML markup. * * This package provides parsing of an XML file or string and builds * it's AST. See the prologue of the XmlDocument package for more * details. * * XmlParser objects throw if given an invalid path to an XML file. * * Required Files: * --------------- * - XmlParser.h, XmlParser.cpp, * - XmlElementParts.h, XmlElementParts.cpp * - XmlDocument.h, XmlDocument.cpp, XmlElement.h, XmlElement.cpp * - ITokenCollection.h, Tokenizer.h, Tokenizer.cpp * - Utilities.Lib * Build Process: * -------------- * devenv XmlParser.sln /debug rebuild * * Maintenance History: * -------------------- * Ver 1.3 : 01 Jun 15 * - made constr src string const * - added src_ member string * Ver 1.2 : 31 May 15 * - factored parsing code to reduce size and complexity * - renamed a couple of methods to improve readability * Ver 1.1 : 30 May 15 * - reconfigured code to use and support repository storage * - using Repository::Utilities * - added Repository\include to Environment's Path to support * #include <utilities> * Ver 1.0 : 28 May 15 * - first release * * ToDo: * ----- * - polish into production code * - rigourous testing */ #include "../XmlElementParts/itokcollection.h" #include "../XmlElementParts/xmlElementParts.h" #include "../XmlElement/XmlElement.h" #include <vector> #include <stack> #include <memory> namespace XmlProcessing { class XmlDocument; class XmlParser { public: using sPtr = std::shared_ptr < AbstractXmlElement > ; using attrib = std::pair < std::string, std::string > ; using attribs = std::vector <attrib> ; using ElemStack = std::stack < sPtr > ; enum sourceType { file, str }; XmlParser(const std::string& src, sourceType type = file); bool good(); XmlDocument* buildDocument(); bool verbose(bool verb = true); private: std::string textFileToString(const std::string& fileSpec); void compress(std::string& xmlStr); std::string enquoteText(const std::string& src); std::string dequoteText(const std::string& src); sPtr createXmlDeclar(); sPtr createProcInstr(); sPtr createComment(); sPtr createTaggedElem(); sPtr createTextElem(); void processMarkup(ElemStack& stack); void processText(ElemStack& stack); void processEndElem(); void extractAttributes(); void showAttributes(); attribs& attributes(); attribs attribs_; ITokCollection* pTokColl_; XmlParts* pXmlParts_; Toker* pToker_ = nullptr; std::string src_; bool verbose_ = false; bool good_ = false; }; inline bool XmlParser::good() { return good_; } inline XmlParser::attribs& XmlParser::attributes() { return attribs_; } inline bool XmlParser::verbose(bool verb) { bool temp = verbose_; verbose_ = verb; return temp; } } #endif
30.615385
73
0.620324
[ "vector", "model" ]
43122c8828209749bc98f6cc67cf1735ee50760a
4,293
h
C
chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_NATIVE_VIEWS_H_ #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_NATIVE_VIEWS_H_ #include "base/macros.h" #include "base/optional.h" #include "chrome/browser/ui/autofill/autofill_popup_view.h" #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/font_list.h" #include "ui/gfx/path.h" #include "ui/views/bubble/bubble_border.h" #include <memory> #include <vector> namespace autofill { class AutofillPopupController; // Child view representing one row in the Autofill Popup. This could represent // a UI control (e.g., a suggestion which can be autofilled), or decoration like // separators. class AutofillPopupRowView : public views::View { public: ~AutofillPopupRowView() override = default; void SetSelected(bool is_selected); // views::View: // Drags and presses on any row should be a no-op; subclasses instead rely on // entry/release events. Returns true to indicate that those events have been // processed (i.e., intentionally ignored). bool OnMouseDragged(const ui::MouseEvent& event) override; bool OnMousePressed(const ui::MouseEvent& event) override; protected: AutofillPopupRowView(AutofillPopupController* controller, int line_number); // Init handles initialization tasks which require virtual methods. Subclasses // should have private/protected constructors and implement a static Create // method which calls Init before returning. void Init(); virtual void CreateContent() = 0; virtual void RefreshStyle() = 0; virtual std::unique_ptr<views::Background> CreateBackground() = 0; AutofillPopupController* controller_; const int line_number_; bool is_warning_ = false; // overwritten in ctor bool is_selected_ = false; }; // Views implementation for the autofill and password suggestion. // TODO(https://crbug.com/768881): Once this implementation is complete, this // class should be renamed to AutofillPopupViewViews and old // AutofillPopupViewViews should be removed. The main difference of // AutofillPopupViewNativeViews from AutofillPopupViewViews is that child views // are drawn using toolkit-views framework, in contrast to // AutofillPopupViewViews, where individuals rows are drawn directly on canvas. class AutofillPopupViewNativeViews : public AutofillPopupBaseView, public AutofillPopupView { public: AutofillPopupViewNativeViews(AutofillPopupController* controller, views::Widget* parent_widget); ~AutofillPopupViewNativeViews() override; const std::vector<AutofillPopupRowView*>& GetRowsForTesting() { return rows_; } // AutofillPopupView: void Show() override; void Hide() override; // views::View: gfx::Size CalculatePreferredSize() const override; // AutofillPopupBaseView: // TODO(crbug.com/831603): Remove these overrides and the corresponding // methods in AutofillPopupBaseView once deprecation of // AutofillPopupViewViews is complete. void OnMouseMoved(const ui::MouseEvent& event) override {} private: // views::View: void VisibilityChanged(View* starting_from, bool is_visible) override; void OnSelectedRowChanged(base::Optional<int> previous_row_selection, base::Optional<int> current_row_selection) override; void OnSuggestionsChanged() override; // Creates child views based on the suggestions given by |controller_|. void CreateChildViews(); // AutofillPopupBaseView: void AddExtraInitParams(views::Widget::InitParams* params) override; std::unique_ptr<views::View> CreateWrapperView() override; std::unique_ptr<views::Border> CreateBorder() override; void DoUpdateBoundsAndRedrawPopup() override; // Controller for this view. AutofillPopupController* controller_; std::vector<AutofillPopupRowView*> rows_; views::BubbleBorder* bubble_border_; DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewNativeViews); }; } // namespace autofill #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_NATIVE_VIEWS_H_
36.381356
80
0.765898
[ "vector" ]
43180b9bf502f31f221867442a5df79107e93351
5,429
h
C
math/Vector2.h
norioz/dngin
ec63b751c189e870764b40222c535b7496991e17
[ "MIT" ]
null
null
null
math/Vector2.h
norioz/dngin
ec63b751c189e870764b40222c535b7496991e17
[ "MIT" ]
null
null
null
math/Vector2.h
norioz/dngin
ec63b751c189e870764b40222c535b7496991e17
[ "MIT" ]
null
null
null
#pragma once #include <math.h> #include "Scalar.h" // --------- // Vector // ---------- // convert to a float pointer (implicit conversion?) -- doc this union Vector2 { struct { float x, y; }; float v[2]; const float & operator[] (size_t idx) const { return v[idx]; } float & operator[] (size_t idx) { return v[idx]; } Vector2 & operator= (Vector2 & other); Vector2 operator- (); Vector2 & operator+= (const Vector2 & other); Vector2 & operator-= (const Vector2 & other); Vector2 & operator/= (float scalar); Vector2 & operator*= (float scalar); }; inline Vector2 Vector2::operator- () { Vector2 v; v.x = -x; v.y = -y; return v; } inline Vector2 & Vector2::operator= (Vector2 & other) { x = other.x; y = other.y; return *this; } inline Vector2 & Vector2::operator+= (const Vector2 & other) { x += other.x; y += other.y; return *this; } inline Vector2 & Vector2::operator-= (const Vector2 & other) { x -= other.x; y -= other.y; return *this; } inline Vector2 & Vector2::operator*= (float scalar) { x *= scalar; y *= scalar; return *this; } inline Vector2 & Vector2::operator/= (float scalar) { x /= scalar; y /= scalar; return *this; } inline Vector2 operator+ (Vector2 a, Vector2 b) { Vector2 result; result.x = a.x + b.x; result.y = a.y + b.y; return result; } inline Vector2 operator- (Vector2 a, Vector2 b) { Vector2 result; result.x = a.x - b.x; result.y = a.y - b.y; return result; } inline Vector2 operator* (Vector2 v, float f) { Vector2 result; result.x = v.x * f; result.y = v.y * f; return result; } inline Vector2 operator* (float f, Vector2 v) { Vector2 result; result.x = v.x * f; result.y = v.y * f; return result; } inline Vector2 operator/ (Vector2 v, float f) { Vector2 result; result.x = v.x / f; result.y = v.y / f; return result; } inline bool operator== (Vector2 a, Vector2 & b) { return eq(a.x, b.x) && eq(a.y, b.y); } inline bool operator!= (Vector2 & a, Vector2 & b) { return !(a == b); } // magnitude inline float magnitudeSq (Vector2 & v) { return v.x * v.x + v.y * v.y; } inline float magnitude (Vector2 & v) { return sqrtf(magnitudeSq(v)); } // normalize inline Vector2 normalize (Vector2 & v) { float m = magnitude(v); if (eq(m, 0.f)) { return Vector2{ 0, 0 }; } return Vector2{ v.x / m, v.y / m }; } // perpendicular // Returns a vector that is perpendicular to the given vector. // Direction is no considerred. // (x, y) = > (-y, x) inline Vector2 perpendicular (Vector2 & v) { return Vector2{ -v.y, v.x }; } // distance inline float distSq (Vector2 & a, Vector2 & b) { float dx = a.x - b.x, dy = a.y - b.y; return (dx * dx + dy * dy); } inline float dist (Vector2 & a, Vector2 & b) { return sqrtf(distSq(a, b)); } //min Vector2 min (Vector2 & a, Vector2 & b) { return Vector2{ min(a.x, b.x), min(a.y, b.y) }; } template<typename... Args> Vector2 min (Vector2 & a, Vector2 & b, Args... args) { return min(min(a, b), args...); } // max Vector2 max (Vector2 & a, Vector2 & b) { return Vector2{ max(a.x, b.x), max(a.y, b.y) }; } template<typename... Args> Vector2 max (Vector2 & a, Vector2 b, Args... args) { return max(max(a, b), args...); } // Scalar product - dot product float dot (Vector2 a, Vector2 b) { return a.x * b.x + a.y * b.y; } // projection // project a onto b Vector2 project (Vector2 & a, Vector2 & b) { float bb = dot(b, b); if (eq(bb, 0.f)) { return Vector2{ 0, 0 }; } return (dot(a, b) / bb) * b; } // deprojection -- vector rejection // deproject a onto b Vector2 deproject (Vector2 & a, Vector2 & b) { Vector2 p = project(a, b); return a - p; } //reflect // n := normal vector // i := incident vector // Credit: HLSL documentation; GLSL spec documentation Vector2 reflect (Vector2 & i, Vector2 & n) { return i - 2.f * dot(i, n) * n; } // refract // o := incident // n := normal // eta := refraction index Vector2 refract (Vector2 & i, Vector2 & n, float eta) { float nDotI = dot(n, i); float k = 1.f - eta * eta * (1.f - nDotI * nDotI); if (lt(k, 0.f)) { return Vector2{ 0, 0 }; } return eta * i - (eta * nDotI + sqrtf(k)) * n; } // clamp // component wise clamp Vector2 clamp (Vector2 & v, Vector2 & low, Vector2 & high) { return Vector2{ clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y) }; } //clampM // Constrains the magnitude of the vector to less than or // equal to the passed in magnitude (maxLength). Vector2 clampM (Vector2 & v, float maxLength) { float mag = magnitude(v); Vector2 result = v; if (gt(mag, maxLength)) { (result / mag) * maxLength; } return result; } //snap Vector2 snap (Vector2 & v, Vector2 & low, Vector2 & high) { return Vector2{ snap(v.x, low.x, high.x), snap(v.y, low.y, high.y) }; } // lerp // component wise lerp Vector2 lerp (Vector2 & a, Vector2 & b, float t) { return Vector2{ lerp(a.x, b.x, t), lerp(a.y, b.y, t) }; } // slerp // Spherically interpolates between two vectors. // Interpolates between a and b by amount t. // The direction of the returned vector is interpolated by the angle // and its magnitude is the interpolation beteen the magnitudes of a // and b. //Vector2 slerp (Vector2 & a, Vector2 & b) { // //}
22.526971
75
0.590348
[ "vector" ]
4349cdab437c362e1ec4d1da5d87daab02cd7b79
6,422
c
C
32blit-stm32/Src/32blit.c
andreban/32blit-beta
8912540fb35dae6e0d3a4cf843677622dada70ba
[ "MIT" ]
null
null
null
32blit-stm32/Src/32blit.c
andreban/32blit-beta
8912540fb35dae6e0d3a4cf843677622dada70ba
[ "MIT" ]
null
null
null
32blit-stm32/Src/32blit.c
andreban/32blit-beta
8912540fb35dae6e0d3a4cf843677622dada70ba
[ "MIT" ]
null
null
null
#include "string.h" #include "32blit.h" #include "main.h" #include "adc.h" #include "ltdc.h" #include "tim.h" #include "32blit.hpp" using namespace blit; extern void init(); extern void update(uint32_t time); extern void render(uint32_t time); extern char __ltdc_start; extern char itcm_text_start; extern char itcm_text_end; extern char itcm_data; blit::screen_mode mode = blit::screen_mode::lores; /* configure the screen surface to point at the reserved LTDC framebuffer */ surface __ltdc((uint8_t *)&__ltdc_start, pixel_format::RGB565, size(320, 240)); uint8_t ltdc_buffer_id = 0; surface __fb(((uint8_t *)&__ltdc_start) + (320 * 240 * 2), pixel_format::RGB, size(160, 120)); void blit_tick() { blit::tick(blit::now()); } void blit_init() { blit::now = HAL_GetTick; blit::set_screen_mode = ::set_screen_mode; ::set_screen_mode(blit::lores); blit::update = ::update; blit::render = ::render; blit::init = ::init; blit::init(); } void blit_swap() { if (mode == blit::screen_mode::hires) { // LTDC framebuffer swap mode // 2 x 320x240 16-bit framebuffers are used alternately. Once drawing is // complete the data cache is invalidated and the LTDC hardware is pointed // to the freshly drawn framebuffer. Then the drawing framebuffer is swapped // for the next frame. // flip to non visible buffer for render ltdc_buffer_id = ltdc_buffer_id == 0 ? 1 : 0; blit::fb.data = (uint8_t *)(&__ltdc_start) + (ltdc_buffer_id * 320 * 240 * 2); }else { ltdc_buffer_id = 0; // set the LTDC layer framebuffer pointer shadow register LTDC_Layer1->CFBAR = (uint8_t *)(&__ltdc_start); // force LTDC driver to reload shadow registers LTDC->SRCR = LTDC_SRCR_IMR; } } void blit_flip() { if(mode == screen_mode::hires) { // HIRES mode SCB_CleanInvalidateDCache_by_Addr((uint32_t *)blit::fb.data, 320 * 240 * 2); // wait until next VSYNC period while (!(LTDC->CDSR & LTDC_CDSR_VSYNCS)); // set the LTDC layer framebuffer pointer shadow register LTDC_Layer1->CFBAR = (uint8_t *)(&__ltdc_start) + (ltdc_buffer_id * 320 * 240 * 2); // force LTDC driver to reload shadow registers LTDC->SRCR = LTDC_SRCR_IMR; } else { // LORES mode // wait for next frame if LTDC hardware currently drawing, ensures // no tearing while (!(LTDC->CDSR & LTDC_CDSR_VSYNCS)); // pixel double the framebuffer to the LTDC buffer rgb *src = (rgb *)blit::fb.data; uint16_t *dest = (uint16_t *)(&__ltdc_start); for(uint8_t y = 0; y < 120; y++) { // pixel double the current row while converting from RGBA to RGB565 for(uint8_t x = 0; x < 160; x++) { uint8_t r = src->r >> 3; uint8_t g = src->g >> 2; uint8_t b = src->b >> 3; uint16_t c = (b << 11) | (g << 5) | (r); *dest++ = c; *dest++ = c; src++; } // copy the previous converted row (640 bytes / 320 x 2-byte pixels) memcpy((uint8_t *)(dest), (uint8_t *)(dest) - 640, 640); dest += 320; } SCB_CleanInvalidateDCache_by_Addr((uint32_t *)&__ltdc_start, 320 * 240 * 2); } } void set_screen_mode(blit::screen_mode new_mode) { mode = new_mode; if(mode == blit::screen_mode::hires) { blit::fb = __ltdc; } else { blit::fb = __fb; } } void blit_clear_framebuffer() { // initialise the LTDC buffer with a checkerboard pattern so it's clear // when it hasn't been written to yet uint16_t *pc = (uint16_t *)&__ltdc_start; // framebuffer 1 for(uint16_t y = 0; y < 240; y++) { for(uint16_t x = 0; x < 320; x++) { *pc++ = (((x / 10) + (y / 10)) & 0b1) ? 0x7BEF : 0x38E7; } } // framebuffer 2 for(uint16_t y = 0; y < 240; y++) { for(uint16_t x = 0; x < 320; x++) { *pc++ = (((x / 10) + (y / 10)) & 0b1) ? 0x38E7 : 0x7BEF; } } } void blit_update_led() { // RED Led float compare_r = (LED.r * 10000) / 255; __HAL_TIM_SetCompare(&htim3, TIM_CHANNEL_3, compare_r); // GREEN Led float compare_g = (LED.g * 10000) / 255; __HAL_TIM_SetCompare(&htim3, TIM_CHANNEL_4, compare_g); // BLUE Led float compare_b = (LED.b * 10000) / 255; __HAL_TIM_SetCompare(&htim3, TIM_CHANNEL_2, compare_b); } void blit_process_input() { // read x axis of joystick uint16_t adc; bool joystick_button = false; HAL_ADC_Start(&hadc1); if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK) { adc = HAL_ADC_GetValue(&hadc1); float f = adc / 4096.0f; f += -0.5f; blit::joystick.x = f; } /*if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK) { adc = HAL_ADC_GetValue(&hadc1); float f = adc / 4096.0f; joystick_button = f > 0.5; }*/ if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK) { adc = HAL_ADC_GetValue(&hadc1); float f = adc / 4096.0f; f += -0.5f; blit::joystick.y = f; } HAL_ADC_Stop(&hadc1); // Read buttons blit::buttons = (!HAL_GPIO_ReadPin(DPAD_UP_GPIO_Port, DPAD_UP_Pin) ? blit::DPAD_UP : 0) | (!HAL_GPIO_ReadPin(DPAD_DOWN_GPIO_Port, DPAD_DOWN_Pin) ? blit::DPAD_DOWN : 0) | (!HAL_GPIO_ReadPin(DPAD_LEFT_GPIO_Port, DPAD_LEFT_Pin) ? blit::DPAD_LEFT : 0) | (!HAL_GPIO_ReadPin(DPAD_RIGHT_GPIO_Port, DPAD_RIGHT_Pin) ? blit::DPAD_RIGHT : 0) | (!HAL_GPIO_ReadPin(BUTTON_A_GPIO_Port, BUTTON_A_Pin) ? blit::A : 0) | (!HAL_GPIO_ReadPin(BUTTON_B_GPIO_Port, BUTTON_B_Pin) ? blit::B : 0) | (!HAL_GPIO_ReadPin(BUTTON_X_GPIO_Port, BUTTON_X_Pin) ? blit::X : 0) | (!HAL_GPIO_ReadPin(BUTTON_Y_GPIO_Port, BUTTON_Y_Pin) ? blit::Y : 0) | (HAL_GPIO_ReadPin(BUTTON_HOME_GPIO_Port, BUTTON_HOME_Pin) ? blit::HOME : 0) | // INVERTED LOGIC! (!HAL_GPIO_ReadPin(BUTTON_MENU_GPIO_Port, BUTTON_MENU_Pin) ? blit::MENU : 0) | (!HAL_GPIO_ReadPin(JOYSTICK_BUTTON_GPIO_Port, JOYSTICK_BUTTON_Pin) ? blit::JOYSTICK : 0); }
32.271357
110
0.587512
[ "render" ]
434a9b84e270010efc8dfdac237dad2392496da0
4,286
h
C
ToolKit/Chart/Styles/Point/XTPChartDiagram2DSeriesStyle.h
11Zero/DemoBCG
8f41d5243899cf1c82990ca9863fb1cb9f76491c
[ "MIT" ]
2
2018-03-30T06:40:08.000Z
2022-02-23T12:40:13.000Z
ToolKit/Chart/Styles/Point/XTPChartDiagram2DSeriesStyle.h
11Zero/DemoBCG
8f41d5243899cf1c82990ca9863fb1cb9f76491c
[ "MIT" ]
null
null
null
ToolKit/Chart/Styles/Point/XTPChartDiagram2DSeriesStyle.h
11Zero/DemoBCG
8f41d5243899cf1c82990ca9863fb1cb9f76491c
[ "MIT" ]
1
2020-08-11T05:48:02.000Z
2020-08-11T05:48:02.000Z
// XTPChartDiagram2DSeriesStyle.h // // This file is a part of the XTREME TOOLKIT PRO MFC class library. // (c)1998-2011 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ///////////////////////////////////////////////////////////////////////////// //{{AFX_CODEJOCK_PRIVATE #if !defined(__XTPCHARTDIAGRAM2DSERIESSTYLE_H__) #define __XTPCHARTDIAGRAM2DSERIESSTYLE_H__ //}}AFX_CODEJOCK_PRIVATE #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 class CXTPChartSeriesView; class CXTPChartMarker; #include "../../XTPChartSeriesStyle.h" #include "../../XTPChartSeries.h" #include "../../XTPChartSeriesView.h" #include "../../Diagram2D/XTPChartDiagram2DView.h" //=========================================================================== // Summary: // This class represents a line series style, which is a kind of // CXTPChartSeriesStyle. // Remarks: // A point chart is a type of graph, which displays information as a // series of data points.It is a basic type of chart common in many // fields. //=========================================================================== class _XTP_EXT_CLASS CXTPChartDiagram2DSeriesStyle : public CXTPChartSeriesStyle { DECLARE_DYNAMIC(CXTPChartDiagram2DSeriesStyle) public: //----------------------------------------------------------------------- // Summary: // Constructs a CXTPChartDiagram2DSeriesStyle object. // Remarks: //----------------------------------------------------------------------- CXTPChartDiagram2DSeriesStyle(); //------------------------------------------------------------------------- // Summary: // Destroys a CXTPChartDiagram2DSeriesStyle object, handles cleanup //------------------------------------------------------------------------- virtual ~CXTPChartDiagram2DSeriesStyle(); public: void SetSecondaryAxisX(BOOL bSecondaryAxis); BOOL IsSecondaryAxisX() const; void SetSecondaryAxisY(BOOL bSecondaryAxis); BOOL IsSecondaryAxisY() const; public: void DoPropExchange(CXTPPropExchange* pPX); public: //----------------------------------------------------------------------- // Summary: // Call this function to create the diagram for this series. // Returns: // A pointer to CXTPChartDiagram2D object, which is a kind of CXTPChartDiagram. // Remarks: //----------------------------------------------------------------------- virtual CXTPChartDiagram* CreateDiagram(); //----------------------------------------------------------------------- // Summary: // Call this function to check whether chart diagram object passed // is a kind of 2D diagram(CXTPChartDiagram2D object). // Parameters: // pDiagram - A pointer to a chart diagram, whose type is to be identified. // Returns: // TRUE if the chart diagram is a 2D diagram and FALSE if not. // Remarks: //----------------------------------------------------------------------- virtual BOOL IsStyleDiagram(CXTPChartDiagram* pDiagram) const; #ifdef _XTP_ACTIVEX public: //{{AFX_CODEJOCK_PRIVATE DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartDiagram2DSeriesStyle); //}}AFX_CODEJOCK_PRIVATE #endif protected: BOOL m_bSecondaryAxisX; BOOL m_bSecondaryAxisY; }; AFX_INLINE void CXTPChartDiagram2DSeriesStyle::SetSecondaryAxisX(BOOL bSecondaryAxis) { m_bSecondaryAxisX = bSecondaryAxis; OnChartChanged(); } AFX_INLINE BOOL CXTPChartDiagram2DSeriesStyle::IsSecondaryAxisX() const { return m_bSecondaryAxisX; } AFX_INLINE void CXTPChartDiagram2DSeriesStyle::SetSecondaryAxisY(BOOL bSecondaryAxis) { m_bSecondaryAxisY = bSecondaryAxis; OnChartChanged(); } AFX_INLINE BOOL CXTPChartDiagram2DSeriesStyle::IsSecondaryAxisY() const { return m_bSecondaryAxisY; } #endif //#if !defined(__XTPCHARTDIAGRAM2DSERIESSTYLE_H__)
32.717557
87
0.618292
[ "object" ]
abff3e83f9f42bf2bdeb47bcd5d655780f84adf9
1,020
h
C
OS/OSKernel/include/Object/Directory.h
limnarch/andromeda
dce866c2c58741d460cc12bddab60052691306e0
[ "MIT" ]
3
2021-06-21T23:09:21.000Z
2021-08-07T13:19:52.000Z
OS/OSKernel/include/Object/Directory.h
limnarch/andromeda
bf65ddbcb6dc0c76bb4e9ce41829a6457ac94d7d
[ "MIT" ]
null
null
null
OS/OSKernel/include/Object/Directory.h
limnarch/andromeda
bf65ddbcb6dc0c76bb4e9ce41829a6457ac94d7d
[ "MIT" ]
null
null
null
extern ObRootDirectoryLockUnalertable { -- } extern ObRootDirectoryLock { -- ok } extern ObRootDirectoryLockShared { -- ok } extern ObRootDirectoryLockSharedUnalertable { -- } extern ObRootDirectoryUnlock { -- } extern ObDirectoryCreate { permissions name -- dirhandle ok } extern ObDirectoryCreateObject { permissions name flags -- dirobject ok } extern ObDirectoryCountQuery { directoryhandle -- count ok } extern ObDirectoryQueryAll { buffer maxquery directoryhandle -- count ok } extern ObDirectoryInsert { objecthandle directoryhandle -- ok } extern ObDirectoryRemove { objecthandle -- ok } extern ObDirectoryRemoveByPointer { locked object -- ok } extern ObDirectoryInsertByPointers { object directory -- ok } extern ObDirectoryDumpTree { directory spaces -- } extern ObObjectReferenceByPath { flags path initialobject process -- object ok } extern ObObjectOpenByPath { flags access initialobjecthandle path -- handle ok } extern ObObjectOpenByPathProcess { flags access initialobject path process -- handle ok }
53.684211
89
0.79902
[ "object" ]
2810610846ba14013f54073e2a76c69615b5f5d6
6,869
h
C
src/gmail/messages/MessagesMessageResource.h
Vadimatorik/googleQt
814ad6f695bb8e88d6a773e69fb8c188febaab00
[ "MIT" ]
24
2016-12-03T09:12:43.000Z
2022-03-29T19:51:48.000Z
src/gmail/messages/MessagesMessageResource.h
Vadimatorik/googleQt
814ad6f695bb8e88d6a773e69fb8c188febaab00
[ "MIT" ]
4
2016-12-03T09:14:42.000Z
2022-03-29T22:02:21.000Z
src/gmail/messages/MessagesMessageResource.h
Vadimatorik/googleQt
814ad6f695bb8e88d6a773e69fb8c188febaab00
[ "MIT" ]
7
2018-01-01T09:14:10.000Z
2022-03-29T21:50:11.000Z
/********************************************************** DO NOT EDIT This file was generated from stone specification "messages" Part of "Ardi - the organizer" project. osoft4ardi@gmail.com www.prokarpaty.net ***********************************************************/ #pragma once #include "google/endpoint/ApiUtil.h" #include "gmail/GmailRequestArg.h" #include "gmail/messages/MessagesMessagePayload.h" namespace googleQt{ namespace messages{ class MessageResource{ /** field: id: The immutable ID of the message. field: thread_id: The ID of the thread the message belongs to. field: label_ids: List of IDs of labels applied to this message. field: snippet: A short part of the message text. field: history_id: The ID of the last history record that modified this message. field: internal_date: The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the Date header. However, for API-migrated mail, it can be configured by client to be based on the Date header. field: payload: The parsed email structure in the message parts. field: size_estimate: Estimated size in bytes of the message. field: raw: The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied. */ public: MessageResource(){}; MessageResource(const QString& arg){ m_id = arg; }; virtual ~MessageResource(){}; public: /** The immutable ID of the message. */ QString id()const{return m_id;}; MessageResource& setId(const QString& arg){m_id=arg;return *this;}; /** The ID of the thread the message belongs to. */ QString threadid()const{return m_threadId;}; MessageResource& setThreadid(const QString& arg){m_threadId=arg;return *this;}; /** List of IDs of labels applied to this message. */ const std::vector<QString>& labelids()const{return m_labelIds;}; MessageResource& setLabelids(const std::vector<QString>& arg){m_labelIds=arg;return *this;}; /** A short part of the message text. */ QString snippet()const{return m_snippet;}; MessageResource& setSnippet(const QString& arg){m_snippet=arg;return *this;}; /** The ID of the last history record that modified this message. */ quint64 historyid()const{return m_historyId;}; MessageResource& setHistoryid(const quint64& arg){m_historyId=arg;return *this;}; /** The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the Date header. However, for API-migrated mail, it can be configured by client to be based on the Date header. */ quint64 internaldate()const{return m_internalDate;}; MessageResource& setInternaldate(const quint64& arg){m_internalDate=arg;return *this;}; /** The parsed email structure in the message parts. */ const MessagePayload& payload()const{return m_payload;}; MessageResource& setPayload(const MessagePayload& arg){m_payload=arg;return *this;}; /** Estimated size in bytes of the message. */ quint64 sizeestimate()const{return m_sizeEstimate;}; MessageResource& setSizeestimate(const quint64& arg){m_sizeEstimate=arg;return *this;}; /** The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied. */ QByteArray raw()const{return m_raw;}; MessageResource& setRaw(const QByteArray& arg){m_raw=arg;return *this;}; public: operator QJsonObject ()const; virtual void fromJson(const QJsonObject& js); virtual void toJson(QJsonObject& js)const; virtual QString toString(bool multiline = true)const; class factory{ public: static std::unique_ptr<MessageResource> create(const QByteArray& data); static std::unique_ptr<MessageResource> create(const QJsonObject& js); }; #ifdef API_QT_AUTOTEST static std::unique_ptr<MessageResource> EXAMPLE(int context_index, int parent_context_index); #endif //API_QT_AUTOTEST protected: /** The immutable ID of the message. */ QString m_id; /** The ID of the thread the message belongs to. */ QString m_threadId; /** List of IDs of labels applied to this message. */ std::vector<QString> m_labelIds; /** A short part of the message text. */ QString m_snippet; /** The ID of the last history record that modified this message. */ quint64 m_historyId = {0}; /** The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the Date header. However, for API-migrated mail, it can be configured by client to be based on the Date header. */ quint64 m_internalDate = {0}; /** The parsed email structure in the message parts. */ MessagePayload m_payload; /** Estimated size in bytes of the message. */ quint64 m_sizeEstimate = {0}; /** The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied. */ QByteArray m_raw; };//MessageResource }//messages }//googleQt
37.950276
101
0.584365
[ "vector" ]
281c21ba9203d9be362e7a022a2c133e2ec27b96
14,464
c
C
source/base/VirtualList.c
VUEngine/VUEngine-Core
4737e0efd2c8e6ba7f69e689bf9e79dcdd627050
[ "MIT" ]
9
2021-01-09T19:24:27.000Z
2022-03-27T11:57:20.000Z
source/base/VirtualList.c
VUEngine/VUEngine-Core
4737e0efd2c8e6ba7f69e689bf9e79dcdd627050
[ "MIT" ]
null
null
null
source/base/VirtualList.c
VUEngine/VUEngine-Core
4737e0efd2c8e6ba7f69e689bf9e79dcdd627050
[ "MIT" ]
null
null
null
/* VUEngine - Virtual Utopia Engine <https://www.vuengine.dev> * A universal game engine for the Nintendo Virtual Boy * * © Jorge Eremiev <jorgech3@gmail.com> and Christian Radke <c.radke@posteo.de>, 2007-2020 * * 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. */ //--------------------------------------------------------------------------------------------------------- // INCLUDES //--------------------------------------------------------------------------------------------------------- #include <VirtualNode.h> #include <VirtualList.h> //--------------------------------------------------------------------------------------------------------- // CLASS' MACROS //--------------------------------------------------------------------------------------------------------- // define a limit to prevent, and detect looped lists #define LIST_MAX_SIZE 1000 //--------------------------------------------------------------------------------------------------------- // CLASS'S DEFINITION //--------------------------------------------------------------------------------------------------------- friend class VirtualNode; //--------------------------------------------------------------------------------------------------------- // CLASS'S METHODS //--------------------------------------------------------------------------------------------------------- /** * Class constructor */ void VirtualList::constructor() { Base::constructor(); // set members' default values this->head = NULL; this->tail = NULL; } /** * Class destructor */ void VirtualList::destructor() { // make sure we remove all nodes VirtualList::clear(this); // destroy super object // must always be called at the end of the destructor Base::destructor(); } /** * Remove all nodes from the list */ void VirtualList::clear() { if(this->head) { // point to the head VirtualNode node = this->head; // move the head to next node this->head = this->head->next; // while there are nodes while(node) { // call destructor delete node; // move the node to the head node = this->head; // move the head if(this->head) { this->head = this->head->next; } } ASSERT(!this->head, "VirtualList::clear: head is not NULL"); this->tail = NULL; } } /** * Add a new node to the beginning of the list * * @param data */ int32 VirtualList::pushFront(const void* const data) { VirtualNode newNode = new VirtualNode(data); // set previous if list isn't empty if(this->head) { this->head->previous = newNode; } // assign the node to the head of the list newNode->next = this->head; // move the head this->head = newNode; // set the tail if(!this->tail) { this->tail = this->head; } return true; } /** * Remove the first element from the list * * @return Removed element */ void* VirtualList::popFront() { // if head isn't null if(this->head) { VirtualNode node = this->head; void* data = node->data; if(node->next) { this->head = node->next; // move head's previous pointer this->head->previous = NULL; } else { // set head this->head = NULL; this->tail = NULL; } // free dynamic memory delete node; return data; } return NULL; } /** * Remove the last element from the list * * @return Removed element */ void* VirtualList::popBack() { // if tail isn't null if(this->tail) { VirtualNode node = this->tail; void* data = node->data; if(node->previous) { this->tail = node->previous; // move head's previous pointer this->tail->next = NULL; } else { // set tail this->tail = NULL; this->head = NULL; } // free dynamic memory delete node; return data; } return NULL; } /** * Add a new node to the end of the list * * @param data */ int32 VirtualList::pushBack(const void* const data) { VirtualNode newNode = new VirtualNode(data); ASSERT(data, "VirtualList::pushBack: null data"); // set the tail if(!this->head) { this->head = this->tail = newNode; } else { // set previous if list isn't empty if(this->tail) { this->tail->next = newNode; } // link new node to the tail newNode->previous = this->tail; // move the tail this->tail = newNode; } return true; } /** * Retrieve the number of objects the list has * * @return Number of objects */ int32 VirtualList::getSize() { int32 counter = 0; VirtualNode node = this->head; while(node) { // load next node node = node->next; ++counter; // increment counter ASSERT(counter < LIST_MAX_SIZE, "VirtualList::getSize: endless list getting size"); } return counter; } /** * Return data pointer of object in the given index node * * @param item * @return Data pointer of object in the given index node */ void* VirtualList::getNodeData(int32 item) { // get the node VirtualNode node = VirtualList::getNode(this, item); // return the data return (node) ? node->data : NULL; } /** * Get node at item position * * @param item Numeric position of node * @return Node */ VirtualNode VirtualList::getNode(int32 item) { int32 counter = 0; int32 listSize = VirtualList::getSize(this); VirtualNode node = this->head; // if not null head if(node) { // if item hasn't reached list's size if(item < listSize) { // increase counter while node hasn't reached list's end // and counter hasn't reached the item requested while(node && counter < item) { // increase counter counter++; // load next node node = node->next; // if item reached if(counter == item) { // return node's data return node; } } // if item reached if(counter == item) { // return node's data return node; } return NULL; } } return NULL; } /** * Get address of node containing dataPointer * * @param dataPointer * @return Node */ void* VirtualList::getObject(void* const dataPointer) { // check if data pointer is valid if(!dataPointer) { return NULL; } VirtualNode node = this->head; // locate node while(node && node->data != dataPointer) { node = node->next; } return node; } /** * Remove a node * * @param node Node to be removed from list */ bool VirtualList::doRemoveNode(VirtualNode node) { if(NULL == node) { return false; } // if the node is the head of the list if(node == this->head) { if(node->next) { // move head to next element this->head = node->next; // move head's previous pointer this->head->previous = NULL; } else { // set head this->head = this->tail = NULL; } } else { // if node isn't the last in the list if(node == this->tail) { // set the tail this->tail->previous->next = NULL; this->tail = this->tail->previous; } else { // join the previous and next nodes node->previous->next = node->next; node->next->previous = node->previous; } } // free dynamic memory delete node; return true; } /** * Remove a node * * @param node Node to be removed from list * @return Flag whether action was successful or not */ bool VirtualList::removeNode(VirtualNode node) { // if node isn't null if(VirtualList::checkThatNodeIsPresent(this, node)) { return VirtualList::doRemoveNode(this, node); } return false; } /** * Find a node in the list * * @param dataPointer * @return Node */ VirtualNode VirtualList::find(const void* const dataPointer) { VirtualNode node = this->head; for(; node && node->data != (void*)dataPointer; node = node->next); return node; } /** * Get position of data in the list * * @param dataPointer * @return Numeric position of node, or -1 when node could not be found */ int32 VirtualList::getDataPosition(const void* const dataPointer) { VirtualNode node = this->head; int32 position = 0; for(; node && node->data != (void*)dataPointer; node = node->next, position++); return !node ? -1 : position; } /** * Get position of node in the list * * @param node * @return Numeric position of node */ int32 VirtualList::getNodePosition(VirtualNode node) { VirtualNode currentNode = this->head; int32 position = 0; for(; node && currentNode && currentNode != node; currentNode = currentNode->next, position++); return !node || !currentNode ? -1 : position; } /** * Remove a node from the list * * @param dataPointer * @return Flag whether action was successful or not */ bool VirtualList::removeElement(const void* const dataPointer) { return VirtualList::doRemoveNode(this, VirtualList::find(this, dataPointer)); } /** * Copy source list's elements to destination list * * @param sourceList */ void VirtualList::copy(VirtualList sourceList) { #ifdef __DEBUG int32 counter = 0; #endif VirtualNode node = sourceList->head; VirtualList::clear(this); while(node) { // add next node VirtualList::pushBack(this, node->data); // move to next node node = node->next; ASSERT(++counter < LIST_MAX_SIZE, "VirtualList::copy: endless list copying"); } } /** * Add source list's elements to destination list * * @param sourceList */ void VirtualList::add(VirtualList sourceList) { #ifdef __DEBUG int32 counter = 0; #endif VirtualNode node = sourceList->head; while(node) { // add next node VirtualList::pushBack(this, node->data); // move to next node node = node->next; ASSERT(++counter < LIST_MAX_SIZE, "VirtualList::copy: endless list copying"); } } /** * Remove source list's elements from list * * @param sourceList */ void VirtualList::substract(VirtualList sourceList) { #ifdef __DEBUG int32 counter = 0; #endif VirtualNode node = sourceList->head; while(node) { // add next node VirtualList::removeElement(this, node->data); // move to next node node = node->next; ASSERT(++counter < LIST_MAX_SIZE, "VirtualList::remove: endless list removing"); } } /** * Copy source list's elements in reverse order * * @param sourceList */ void VirtualList::reverse(VirtualList sourceList) { #ifdef __DEBUG int32 counter = 0; #endif VirtualNode node = sourceList->head; VirtualList::clear(this); while(node) { // add next node VirtualList::pushFront(this, node->data); // move to next node node = node->next; ASSERT(++counter < LIST_MAX_SIZE, "VirtualList::copy: endless list copying"); } } /** * Retrieve list's head's address * * @return Node */ VirtualNode VirtualList::begin() { return this->head; } /** * Retrieve the first element * * @return Head data */ void* VirtualList::front() { return this->head ? this->head->data : NULL; } /** * Retrieve list's last node * * @return Node */ VirtualNode VirtualList::end() { return this->tail; } /** * Retrieve the last element * * @return Tail data */ void* VirtualList::back() { return this->tail ? this->tail->data : NULL; } /** * Check if a node is part of this list * * @private * @param node node to check */ bool VirtualList::checkThatNodeIsPresent(VirtualNode node) { if(!node) { return false; } VirtualNode auxNode = this->head; for(; auxNode; auxNode = auxNode->next) { if(auxNode == node) { return true; } } return false; } /** * Insert a node after the node specified * * @param node Insert after this node * @param data Data for new node * @return Newly inserted Node */ VirtualNode VirtualList::insertAfter(VirtualNode node, const void* const data) { if(!VirtualList::checkThatNodeIsPresent(this, node)) { return NULL; } VirtualNode newNode = NULL; if(!node || node == this->tail) { VirtualList::pushBack(this, data); newNode = this->tail; } else { newNode = new VirtualNode(data); if(!newNode) { return false; } newNode->next = node->next; if(node->next) { node->next->previous = newNode; } node->next = newNode; newNode->previous = node; } return newNode; } /** * Insert a node before the node specified * * @param node Insert before this node * @param data Data for new node * @return Newly inserted Node */ VirtualNode VirtualList::insertBefore(VirtualNode node, const void* const data) { if(!VirtualList::checkThatNodeIsPresent(this, node)) { return NULL; } VirtualNode newNode = NULL; if(!node || node == this->head) { VirtualList::pushFront(this, data); newNode = this->head; } else { newNode = new VirtualNode(data); if(!newNode) { return false; } newNode->previous = node->previous; if(node->previous) { node->previous->next = newNode; } node->previous = newNode; newNode->next = node; } return newNode; } /** * Swap two lists' heads and tails * * @param secondList Function scope */ void VirtualList::swap(VirtualList secondList) { // swap heads VirtualNode aux = this->head; this->head = secondList->head; secondList->head = aux; // swap tails aux = this->tail; this->tail = secondList->tail; secondList->tail = aux; } /** * Get node's address at given position * * @param position Function scope * @return Node data or NULL if no node could be found at position */ void* VirtualList::getObjectAtPosition(int32 position) { VirtualNode node = this->head; int32 counter = 0; if(position < 0) { return NULL; } // locate node for(; node && counter < position; node = node->next, counter++); if(node) { return node->data; } return NULL; }
18.057428
107
0.616565
[ "object" ]
282c514dd1e6170819e81bc5e1be8e6b003aeaef
1,665
h
C
include/pica/particles/Ensemble.h
pictools/pica
6b82a0a91fcb9a7be56c13bb1d3941748160eca7
[ "MIT" ]
3
2017-09-20T14:20:07.000Z
2017-10-30T07:14:32.000Z
include/pica/particles/Ensemble.h
pictools/pica
6b82a0a91fcb9a7be56c13bb1d3941748160eca7
[ "MIT" ]
null
null
null
include/pica/particles/Ensemble.h
pictools/pica
6b82a0a91fcb9a7be56c13bb1d3941748160eca7
[ "MIT" ]
1
2019-10-09T06:38:29.000Z
2019-10-09T06:38:29.000Z
#ifndef PICA_ENSEMBLE_H #define PICA_ENSEMBLE_H #include "pica/math/Dimension.h" #include "pica/particles/EnsembleOrdered.h" #include "pica/particles/EnsembleSupercells.h" #include "pica/particles/EnsembleUnordered.h" #include "pica/particles/Particle.h" #include "pica/particles/ParticleTraits.h" #include "pica/threading/OpenMPHelper.h" #include <algorithm> #include <map> #include <string> #include <vector> namespace pica { enum EnsembleRepresentation { EnsembleRepresentation_Unordered, EnsembleRepresentation_Ordered, EnsembleRepresentation_Supercells }; inline std::string toString(EnsembleRepresentation ensembleRepresentation) { std::map<EnsembleRepresentation, std::string> names; names[EnsembleRepresentation_Unordered] = "unordered"; names[EnsembleRepresentation_Ordered] = "ordered"; names[EnsembleRepresentation_Supercells] = "supercells"; return names[ensembleRepresentation]; } // Traits class to provide a Type corresponding to array of particles // according to the given representation template<class ParticleArray, EnsembleRepresentation storage> struct Ensemble { }; template<class ParticleArray> struct Ensemble<ParticleArray, EnsembleRepresentation_Unordered> { typedef EnsembleUnordered<ParticleArray> Type; }; template<class ParticleArray> struct Ensemble<ParticleArray, EnsembleRepresentation_Ordered> { typedef EnsembleOrdered<ParticleArray> Type; }; template<class ParticleArray> struct Ensemble<ParticleArray, EnsembleRepresentation_Supercells> { typedef EnsembleSupercells<ParticleArray> Type; }; } // namespace pica #endif
27.75
96
0.776577
[ "vector" ]
283eb7e44f25f619dcd3915ab358b9988895318f
1,551
h
C
generate/templates/manual/include/configurable_class_wrapper.h
0x1af2aec8f957/nodegit
3b8329f9ea29707d0b5c7ee1c3e6c18d0c2a3bc4
[ "MIT" ]
4,935
2015-01-01T13:41:40.000Z
2022-03-30T19:53:18.000Z
generate/templates/manual/include/configurable_class_wrapper.h
0x1af2aec8f957/nodegit
3b8329f9ea29707d0b5c7ee1c3e6c18d0c2a3bc4
[ "MIT" ]
1,326
2015-01-05T17:27:48.000Z
2022-03-31T11:17:00.000Z
generate/templates/manual/include/configurable_class_wrapper.h
0x1af2aec8f957/nodegit
3b8329f9ea29707d0b5c7ee1c3e6c18d0c2a3bc4
[ "MIT" ]
832
2015-01-04T13:28:51.000Z
2022-03-31T11:09:14.000Z
#ifndef CALLER_CONFIGURABLE_CLASS_WRAPPER_H #define CALLER_CONFIGURABLE_CLASS_WRAPPER_H #include <memory> #include <nan.h> #include <string> #include "cleanup_handle.h" namespace nodegit { class Context; template<typename Traits> class ConfigurableClassWrapper : public CleanupHandle { public: typedef typename Traits::cType cType; typedef typename Traits::configurableCppClass configurableCppClass; struct v8ConversionResult { v8ConversionResult(std::string _error) : error(std::move(_error)), result(nullptr) {} v8ConversionResult(std::shared_ptr<configurableCppClass> _result) : result(std::move(_result)) {} std::string error; std::shared_ptr<configurableCppClass> result; }; // We copy the entity ConfigurableClassWrapper(nodegit::Context *_nodeGitContext) : nodegitContext(_nodeGitContext), raw(nullptr) {} ConfigurableClassWrapper(const ConfigurableClassWrapper &) = delete; ConfigurableClassWrapper(ConfigurableClassWrapper &&) = delete; ConfigurableClassWrapper &operator=(const ConfigurableClassWrapper &) = delete; ConfigurableClassWrapper &operator=(ConfigurableClassWrapper &&) = delete; virtual ~ConfigurableClassWrapper() { if (raw != nullptr) { delete raw; raw = nullptr; } } const Context *nodegitContext = nullptr; cType *GetValue() { return raw; } protected: cType *raw; std::vector<std::shared_ptr<CleanupHandle>> childCleanupVector; }; } #endif
25.85
83
0.707286
[ "vector" ]
2844fd9a8946284c9d5838eb34ae50094f78faae
6,437
h
C
Kernel/Walls/TriangleWall.h
gustavo-castillo-bautista/Mercury
eeb402ccec8e487652229d4595c46ec84f6aefbb
[ "BSD-3-Clause" ]
null
null
null
Kernel/Walls/TriangleWall.h
gustavo-castillo-bautista/Mercury
eeb402ccec8e487652229d4595c46ec84f6aefbb
[ "BSD-3-Clause" ]
null
null
null
Kernel/Walls/TriangleWall.h
gustavo-castillo-bautista/Mercury
eeb402ccec8e487652229d4595c46ec84f6aefbb
[ "BSD-3-Clause" ]
null
null
null
//Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved. //For the list of developers, see <http://www.MercuryDPM.org/Team>. // //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 MercuryDPM 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 MERCURYDPM DEVELOPERS TEAM 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 TriangleWall_H #define TriangleWall_H #include <vector> #include "BaseWall.h" #include "InfiniteWall.h" #include "Math/Vector.h" /*! * \brief A TriangleWall is convex polygon defined as an intersection of InfiniteWall's. * \details It can be defined as the intersection of a set * of \ref InfiniteWall's, defined by the normal vector into the wall and a point on the wall: * \code * TriangleWall w; * //for each wall, specify a normal and position vector * w.addObject(Vec3D(-1.0,0.0,0.0),Vec3D(1.0,0.0,0.0)); * w.addObject(Vec3D(1.0,0.0,0.0),Vec3D(0.0,0.0,0.0)); * w.addObject(Vec3D(0.0,-1.0,0.0),Vec3D(0.0,1.0,0.0)); * w.addObject(Vec3D(0.0,1.0,0.0),Vec3D(0.0,0.0,0.0)); * wallHandler.copyAndAddObject(w); * \endcode * A particle of radius *r* and position *x* touches an #InfiniteWall with normal *n* and position *p* if * \f$p-n\cdot x\leq r\f$ * (note 'touching particles' also includes particles that are completely enclosed inside the wall). * A particle touches an #TriangleWall if it touches all InfiniteWall objects (shown in the image below). * <img src="T8_fig2_finitewall.jpg" height="250px"> * * For a demonstration on how to use this class, see \ref T8 and \ref HourGlass3DDemo (shown in the image below). * <img src="HourGlass2DDemo.png" height="250px"> */ class TriangleWall : public BaseWall { public: /*! * \brief Default constructor. */ TriangleWall() = default; /*! * \brief Copy constructor. */ TriangleWall(const TriangleWall& other) = default; /*! * \brief Destructor. */ ~TriangleWall() override = default; /*! * \brief Wall copy method. It calls the copy constructor of this Wall, useful for polymorphism */ TriangleWall* copy() const override { return new TriangleWall(*this); } /*! * \brief Returns the name of the object, here the string "TriangleWall". */ std::string getName() const override { return "TriangleWall"; } /*! * \brief Reads an TriangleWall from an input stream, for example a restart file. */ void read(std::istream& is) override; /*! * \brief Writes an TriangleWall to an output stream, for example a restart file. */ void write(std::ostream& os) const override; /*! * \brief Sets member variables such that the wall represents a triangle with vertices A, B, C * - position_ is set to the center of mass of the wall * - vertexInLabFrame_ is set relative to the position * - updateVertexAndNormal is called to set the remaining variables */ void setVertices(Vec3D A, Vec3D B, Vec3D C); std::array<Vec3D,3> getVertices() const {return vertex_;} void move(const Vec3D& move) override; /*! * \brief Same as #setVertices(A,B,C), but sets the position explicitly. * The position is important when you rotate the wall, as the wall will be rotated around this position. */ void setVertices(Vec3D A, Vec3D B, Vec3D C, Vec3D position); void writeVTK(VTKContainer& vtk) const override; /*! * \brief Returns the position of a vertex */ const Vec3D& getVertex(unsigned i) const {return vertex_[i];} /*! * \brief Compute the distance from the wall for a given BaseParticle and return if there is a collision. * If there is a collision, also return the normal vector. */ bool getDistanceAndNormal(const BaseParticle& p, Mdouble& distance, Vec3D& normal_return) const override; void rotate(const Vec3D& angularVelocity) override; bool isLocal(Vec3D& min, Vec3D& max) const override; bool isInsideTriangle(const Vec3D &point) const; private: void updateVertexAndNormal(); /*! * stores the position of the vertices relative to the position of the wall and rotated into the lab frame; */ std::array<Vec3D, 3> vertexInLabFrame_; /*! * stores the position of the vertices relative to the position of the wall but not rotated into the lab frame; * thus, if the wall rotates, these vertices have to be rotated as well */ std::array<Vec3D, 3> vertex_; /*! * stores the min and max coordinate values of the vertices (needed for hGrid) */ Vec3D vertexMin_; Vec3D vertexMax_; /*! * stores the wall normal n in n.x=p */ std::array<Vec3D, 3> edgeNormal_; std::array<Vec3D, 3> edge_; std::array<double, 3> edgeLength_; /*! * stores the face normal, not rotated into the lab frame; thus, if the wall rotates, this normal has to be rotated as well */ Vec3D faceNormal_; // /*! // * number of edges that should be treated as edges (instead of ignored) // */ // unsigned nEdges = 3; }; #endif
37.208092
127
0.687587
[ "object", "vector" ]
285c7355bd5f18959d1e307f5a0d76158d8d367c
2,109
h
C
rootex/framework/ecs_factory.h
LASTEXILE-CH/Rootex
685b9bb5763bbc35041f3a5f193a43b3156394a6
[ "MIT" ]
1
2021-03-29T09:46:28.000Z
2021-03-29T09:46:28.000Z
rootex/framework/ecs_factory.h
LASTEXILE-CH/Rootex
685b9bb5763bbc35041f3a5f193a43b3156394a6
[ "MIT" ]
null
null
null
rootex/framework/ecs_factory.h
LASTEXILE-CH/Rootex
685b9bb5763bbc35041f3a5f193a43b3156394a6
[ "MIT" ]
null
null
null
#pragma once #include "common/common.h" #include "core/resource_files/text_resource_file.h" #include "entity.h" #include "component.h" /// Function pointer to a function that constructs a component, taking in a set of component data. typedef Ptr<Component> (*ComponentCreator)(const JSON::json& componentDescription); /// Collection of a component, its name, and a function that constructs that component. typedef Vector<Tuple<ComponentID, String, ComponentCreator>> ComponentDatabase; /// Collection of all components active inside the scene. typedef HashMap<ComponentID, Vector<Component*>> ComponentInstanceDatabase; #define REGISTER_COMPONENT(ComponentType) ECSFactory::RegisterComponent<ComponentType>(#ComponentType) class ECSFactory { static inline ComponentDatabase s_ComponentCreators; static inline ComponentInstanceDatabase s_ComponentInstances; public: template <class T> static Vector<Component*>& GetComponents(); static void Initialize(); static bool AddComponent(Entity* entity, Ptr<Component>& component); static Ptr<Component> CreateComponent(const String& componentName, const JSON::json& componentData); static Ptr<Component> CreateDefaultComponent(const String& componentName); static Ptr<Entity> CreateEntity(Scene* scene, const JSON::json& entityJSON); static Ptr<Entity> CreateEntityFromFile(Scene* scene, TextResourceFile* textResourceFile); static Ptr<Entity> CreateEmptyEntity(Scene* scene); static Ptr<Entity> CreateRootEntity(Scene* scene); static Ptr<Entity> CopyEntity(Scene* scene, Entity& entity); static const ComponentDatabase& GetComponentDatabase() { return s_ComponentCreators; } template <class T> static void RegisterComponent(const String& name); static void RegisterComponentInstance(Component* component); static void DeregisterComponentInstance(Component* component); }; template <class T> inline Vector<Component*>& ECSFactory::GetComponents() { return s_ComponentInstances[T::s_ID]; } template <class T> inline void ECSFactory::RegisterComponent(const String& name) { s_ComponentCreators.push_back({ T::s_ID, name, T::Create }); }
37
102
0.798957
[ "vector" ]
2873fcdf2f1fb1829e7a7b2d13a7dc53cdf6bfa8
15,630
c
C
msp/src/msmath.c
mlconnolly1951/biohedron
5ee538068dab114d965e07204f6634cca000b0b8
[ "MIT" ]
1
2018-02-13T20:32:12.000Z
2018-02-13T20:32:12.000Z
msp/src/msmath.c
mlconnolly1951/biohedron
5ee538068dab114d965e07204f6634cca000b0b8
[ "MIT" ]
null
null
null
msp/src/msmath.c
mlconnolly1951/biohedron
5ee538068dab114d965e07204f6634cca000b0b8
[ "MIT" ]
null
null
null
/* Molecular Surface Package */ /* General Math Routines */ /* Written by Michael L. Connolly */ /* January 7, 2002 */ #include "ms.h" #include "msenum.h" #include "mslimit.h" #include "msdefault.h" #include "msstruct.h" #include "msglobal.h" #include "msfunction.h" /* low level mathematical functions */ /* double-precision routines */ /* change vector length to 1 (i.e. normalize) */ int normalize (double vect[3]) { int k; double n; n = norm (vect); if (n <= 0.0) { return (0); } for (k = 0; k < 3; k++) vect[k] /= n; return (1); } /* return norm of vector */ double norm(double f[3]) { double n; n = norm_squared (f); if (n <= 0.0) return (0.0); n = sqrt (n); return (n); } /* return square of norm of vector */ double norm_squared (double f[3]) { int k; double n; n = 0.0; for (k = 0; k < 3; k++) n += f[k] * f[k]; return (n); } /* return dot product of two vectors */ double dot_product (double f[3], double g[3]) { int k; double n; n = 0.0; for (k = 0; k < 3; k++) n += f[k] * g[k]; return (n); } /* return squared distance between points */ double distance_squared (double f[3], double g[3]) { int k; double fg[3]; for (k = 0; k < 3; k++) fg[k] = f[k] - g[k]; return (norm_squared (fg)); } int negdot (double vect1[3], double vect2[3]) { int isneg; double dt; dt = dot_product (vect1, vect2); isneg = ((int) (dt < 0.0)); return (isneg); } /* reverse direction of vector */ void reverse (double vect[3]) { int k; for (k = 0; k < 3; k++) vect[k] = (-vect[k]); } /* return distance between two points */ double distance (double f[3], double g[3]) { int k; double fg[3]; for (k = 0; k < 3; k++) fg[k] = f[k] - g[k]; return (norm (fg)); } /* cross product of two vectors */ void cross (double f[3], double g[3], double h[3]) { h[0] = f[1] * g[2] - f[2] * g[1]; h[1] = f[2] * g[0] - f[0] * g[2]; h[2] = f[0] * g[1] - f[1] * g[0]; } /* triple product of three vectors */ double triple_product (double f[3], double g[3], double h[3]) { double t; double fg[3]; cross (f, g, fg); t = h[0] * fg[0] + h[1] * fg[1] + h[2] * fg[2]; return (t); } /* return area of triangle */ double triangle_area (double p[3], double q[3], double r[3]) { int k; double a; double u[3], v[3], uv[3]; for (k = 0; k < 3; k++) { u[k] = q[k] - p[k]; v[k] = r[k] - p[k]; } cross (u, v, uv); a = norm (uv) / 2.0; return (a); } /* return signed area of triangle */ double signed_triangle_area (double p[3], double q[3], double r[3], double axis[3]) { int k; double a, dt; double u[3], v[3], uv[3]; for (k = 0; k < 3; k++) { u[k] = q[k] - p[k]; v[k] = r[k] - p[k]; } cross (u, v, uv); dt = dot_product (uv, axis); a = norm (uv) / 2.0; if (dt < 0.0) a = (-a); return (a); } /* volume of tetrahedron */ double tetrahedron_volume (double p[3], double q[3], double r[3], double s[3]) { int k; double t; double u[3], v[3], w[3]; for (k = 0; k < 3; k++) { u[k] = q[k] - p[k]; v[k] = r[k] - p[k]; w[k] = s[k] - p[k]; } t = (-triple_product (u, v, w)) / 6.0; return (t); } /* set up axis given triangle */ /* solid angle of tetrahedron seen by first vertex */ double tetra_solid (double v1[3], double v2[3], double v3[3], double v4[3]) { int k; double sum, ang1, ang2, ang3, angle; double vect1[3], vect2[3], vect3[3]; double axis1[3], axis2[3], axis3[3]; /* compute vectors from first vertex to other three */ for (k = 0; k < 3; k++) { vect1[k] = v2[k] - v1[k]; vect2[k] = v3[k] - v1[k]; vect3[k] = v4[k] - v1[k]; } if (!normalize (vect1)) { return (0.0); } if (!normalize (vect2)) { return (0.0); } if (!normalize (vect3)) { return (0.0); } /* compute normals to three faces */ cross (vect1, vect2, axis1); cross (vect2, vect3, axis2); cross (vect3, vect1, axis3); if (!normalize (axis1)) { return (0.0); } if (!normalize (axis2)) { return (0.0); } if (!normalize (axis3)) { return (0.0); } /* compute interior angles from dihedral angles */ /* later: check fourth argument */ ang1 = PI - odd_angle (axis3, axis1, vect1, (double) 1.0); ang2 = PI - odd_angle (axis1, axis2, vect2, (double) 1.0); ang3 = PI - odd_angle (axis2, axis3, vect3, (double) 1.0); sum = ang1 + ang2 + ang3; /* subtract the pi to get excess (use 5 pi for negative orientations) */ if (sum >= 3 * PI) angle = (sum - 5 * PI); else angle = (sum - PI); return (angle); } int clockwise (double p1[2], double p2[2], double p3[2]) { int k; double v12[2], v13[2]; double crs; for (k = 0; k < 2; k++) { v12[k] = p2[k] - p1[k]; v13[k] = p3[k] - p1[k]; } crs = v12[0] * v13[1] - v12[1] * v13[0]; return (crs <= 0.0); } int pit (double pnt[2], int up, double t1[2], double t2[2], double t3[2]) { if (up == clockwise (pnt, t1, t2)) return (0); if (up == clockwise (pnt, t2, t3)) return (0); if (up == clockwise (pnt, t3, t1)) return (0); return (1); } int piq (double pnt[2], int up, double t1[2], double t2[2], double t3[2], double t4[2]) { if (up == clockwise (pnt, t1, t2)) return (0); if (up == clockwise (pnt, t2, t3)) return (0); if (up == clockwise (pnt, t3, t4)) return (0); if (up == clockwise (pnt, t4, t1)) return (0); return (1); } int lines_intersect (double p1[2], double p2[2], double p3[2], double p4[2]) { int k; for (k = 0; k < 2; k++) { if (p1[k] == p3[k]) return (0); if (p1[k] == p4[k]) return (0); if (p2[k] == p3[k]) return (0); if (p2[k] == p4[k]) return (0); } if (clockwise (p1, p3, p4) == clockwise (p2, p3, p4)) return (0); if (clockwise (p3, p1, p2) == clockwise (p4, p1, p2)) return (0); return (1); } /* return the fraction of the distance from p1 to p2 that the intersection point is */ double line_intersection (double p1[2], double p2[2], double p3[2], double p4[2]) { int k; double nperp, d13, d12, ratio; double v12[2], v13[2], v34[2]; double perp[2]; for (k = 0; k < 2; k++) { v34[k] = p4[k] - p3[k]; v13[k] = p3[k] - p1[k]; v12[k] = p2[k] - p1[k]; } /* compute unit vector perpendicular to v34 */ perp[0] = v34[1]; perp[1] = - v34[0]; nperp = perp[0] * perp[0] + perp[1] * perp[1]; if (nperp <= 0.0) return (0.5); nperp = sqrt (nperp); if (nperp <= 0.0) return (0.5); for (k = 0; k < 2; k++) perp[k] /= nperp; d13 = v13[0] * perp[0] + v13[1] * perp[1]; d12 = v12[0] * perp[0] + v12[1] * perp[1]; if (d12 == 0.0) return (0.5); ratio = d13/d12; return (ratio); } /* solid angle of tetrahedron seen by first vertex */ double tetra_solid_angle (double v1[3], double v2[3], double v3[3], double v4[3]) { int k, nnegative; double sum, omega; double ong1, ong2, ong3; double ing1, ing2, ing3; double vect1[3], vect2[3], vect3[3]; double axis1[3], axis2[3], axis3[3]; omega = 0.0; /* compute vectors from first vertex to other three */ for (k = 0; k < 3; k++) { vect1[k] = v2[k] - v1[k]; vect2[k] = v3[k] - v1[k]; vect3[k] = v4[k] - v1[k]; } if (!normalize (vect1)) { return (0.0); } if (!normalize (vect2)) { return (0.0); } if (!normalize (vect3)) { return (0.0); } /* compute normals to three faces */ cross (vect1, vect2, axis1); cross (vect2, vect3, axis2); cross (vect3, vect1, axis3); if (!normalize (axis1)) { return (0.0); } if (!normalize (axis2)) { return (0.0); } if (!normalize (axis3)) { return (0.0); } /* compute interior angles from dihedral angles */ nnegative = 0; ong1 = odd_angle (axis3, axis1, vect1, 1.0); if (ong1 < 0.0) nnegative++; if (ong1 >= 0.0) ing1 = PI - ong1; else if (ong1 < 0.0) ing1 = PI + ong1; ong2 = odd_angle (axis1, axis2, vect2, 1.0); if (ong2 < 0.0) nnegative++; if (ong2 >= 0.0) ing2 = PI - ong2; else if (ong2 < 0.0) ing2 = PI + ong2; ong3 = odd_angle (axis2, axis3, vect3, 1.0); if (ong3 < 0.0) nnegative++; if (ong3 >= 0.0) ing3 = PI - ong3; else if (ong3 < 0.0) ing3 = PI + ong3; /* pang1 = positive_angle (axis3, axis1, vect1); pang2 = positive_angle (axis1, axis2, vect2); pang3 = positive_angle (axis2, axis3, vect3); */ if (fabs (ong1) < 0.01) return (0.0); if (fabs (ong2) < 0.01) return (0.0); if (fabs (ong3) < 0.01) return (0.0); sum = (ing1 + ing2 + ing3); if (nnegative == 0) omega = sum - PI; else if (nnegative == 3) omega = PI - sum; else omega = 0.0; return (omega); } /* in range from minus pi to pi */ /* axis and v0, v1 are assumed to be of unit length */ double triple_angle (double v0[3], double v1[3], double axis[3]) { double t, d, angle; if (v1[0] == v0[0] && v1[1] == v0[1] && v1[2] == v0[2]) return (0.0); d = dot_product (v0, v1); if (d < -1.0) d = (-1.0); else if (d > 1.0) d = 1.0; angle = acos (d); t = triple_product (v0, v1, axis); if (t < 0) angle = (- angle); return (angle); } void setup_axis (double p[3], double q[3], double r[3], double a[3]) { int k; double nw; double u[3], v[3], w[3]; for (k = 0; k < 3; k++) { u[k] = q[k] - p[k]; v[k] = r[k] - p[k]; } cross (u, v, w); nw = norm (w); if (nw <= 0.0) { return; } for (k = 0; k < 3; k++) a[k] = w[k] / nw; } double do_axis (double trico[3][3], double axis[3]) { int k; int i0, i1, i2, three; int okays[3]; double area, areas[3], axes[3][3]; double vect1[3], vect2[3]; for (three = 0; three < 3; three++) { if (three == 0) { i0 = 0; i1 = 1; i2 = 2; } else if (three == 1) { i0 = 1; i1 = 2; i2 = 0; } else if (three == 2) { i0 = 2; i1 = 0; i2 = 1; } for (k = 0; k < 3; k++) { vect1[k] = trico[i1][k] - trico[i0][k]; vect2[k] = trico[i2][k] - trico[i0][k]; } cross (vect1, vect2, axes[three]); area = norm (axes[three]) / 2.0; areas[three] = fabs (area); okays[three] = normalize (axes[three]); } for (three = 0; three < 3; three++) { area = areas[three]; if (okays[three] && area > 0.0) { for (k = 0; k < 3; k++) axis[k] = axes[three][k]; return (area); } } return (0.0); } /* return angle between vectors */ double simple_angle (double vect1[3], double vect2[3]) { double dt, norm1, norm2, ang; norm1 = norm (vect1); if (norm1 <= 0.0) { return (0.0); } norm2 = norm (vect2); if (norm2 <= 0.0) { return (0.0); } dt = dot_product (vect1, vect2); dt /= (norm1 * norm2); if (dt < -1.0) dt = -1.0; if (dt > 1.0) dt = 1.0; ang = acos (dt); return (ang); } /* return angle between vectors */ double positive_angle (double vect1[3], double vect2[3], double axis[3]) { double dt, norm1, norm2, norm12, trip, ang; norm1 = norm (vect1); if (norm1 <= 0.0) { return (0.0); } norm2 = norm (vect2); if (norm2 <= 0.0) { return (0.0); } norm12 = norm1 * norm2; if (norm12 <= 0.0) { return (0.0); } dt = dot_product (vect1, vect2); dt /= (norm12); if (dt < -1.0) dt = -1.0; if (dt > 1.0) dt = 1.0; ang = acos (dt); trip = triple_product (vect1, vect2, axis); if (trip < 0.0) ang = 2 * PI - ang; return (ang); } /* return angle between vectors */ double odd_angle (double vect1[3], double vect2[3], double axis[3], double sgn) { double ang; double axis2[3]; int k; for (k = 0; k < 3; k++) axis2[k] = sgn * axis[k]; ang = positive_angle (vect1, vect2, axis2); if (ang > PI) ang -= 2 * PI; return (ang); } /* arbitrary perpendicular */ void arbprp (double given[3], double perp[3]) { int k; double dott; double try[3]; /* my own algorithm */ try[0] = given[1] * given[1] + given[2] * given[2]; try[1] = given[0] * given[0] + given[2] * given[2]; try[2] = given[0] * given[0] + given[1] * given[1]; if (!normalize (try)) return; /* subtract parallel component of first try */ dott = dot_product (given, try); for (k = 0; k < 3; k++) try[k] = try[k] - dott * given[k]; if (!normalize (try)) return; /* check correctness */ if (fabs (dot_product (given, try)) > 0.001) { return; } for (k = 0; k < 3; k++) perp[k] = try[k]; } /* create rotation matrix given axis and angle */ int generate_rotation (double direction[3], double angle, double rotation_matrix[3][3]) { int j, k; double a[3][3], b[3][3], z[3][3], za[3][3]; if (norm(direction) <= 0.0) return (0); for (k = 0; k < 3; k++) a[2][k] = direction[k]; arbprp (a[2], a[0]); cross (a[2], a[0], a[1]); if (norm(a[1]) <= 0.0) return (0); for (j = 0; j < 3; j++) for (k = 0; k < 3; k++) b[j][k] = a[k][j]; for (j = 0; j < 3; j++) for (k = 0; k < 3; k++) z[j][k] = (j == k); z[0][0] = cos (angle); z[1][1] = cos (angle); z[0][1] = -sin (angle); z[1][0] = sin (angle); for (j = 0; j < 3; j++) for (k = 0; k < 3; k++) za[j][k] = z[j][0] * a[0][k] + z[j][1] * a[1][k] + z[j][2] * a[2][k]; for (j = 0; j < 3; j++) for (k = 0; k < 3; k++) rotation_matrix[j][k] = b[j][0] * za[0][k] + b[j][1] * za[1][k] + b[j][2] * za[2][k]; return (1); } double quad_angle (v1, v2, v3, v4) double v1[3], v2[3], v3[3], v4[3]; { int k; double qa; double vect23[3], vect24[3], vect41[3], vect12[3]; double axis[3]; for (k = 0; k < 3; k++) { vect23[k] = v3[k] - v2[k]; vect24[k] = v4[k] - v2[k]; vect41[k] = v1[k] - v4[k]; vect12[k] = v2[k] - v1[k]; } if (!normalize (vect23)) return (0.0); if (!normalize (vect24)) return (0.0); if (!normalize (vect41)) return (0.0); if (!normalize (vect12)) return (0.0); cross (vect23, vect24, axis); if (norm (axis) <= 0.0) return (0.0); /* kludge */ if (!normalize (axis)) return (0.0); qa = odd_angle (vect41, vect12, axis, (double) 1.0); return (qa); } void make_matrix (double angle, double matrix[3][3]) { int j, k; double cos_ang, sin_ang, ang; ang = angle; cos_ang = cos (ang); sin_ang = sin (ang); for (j = 0; j < 3; j++) for (k = 0; k < 3; k++) matrix[j][k] = (j == k); matrix[0][0] = cos_ang; matrix[0][2] = sin_ang; matrix[2][0] = -sin_ang; matrix[2][2] = cos_ang; } /* transform vector */ void trvec (double rotation[3][3], double vec[3]) { int k; double out[3]; for (k = 0; k < 3; k++) out[k] = rotation[k][0] * vec[0] + rotation[k][1] * vec[1] + rotation[k][2] * vec[2]; for (k = 0; k < 3; k++) vec[k] = out[k]; } /* transform point */ void trpnt (double rotation[3][3], double center[3], double translate[3], double pnt[3]) { int k; double tmp1[3], tmp2[3]; for (k = 0; k < 3; k++) tmp1[k] = pnt[k] - center[k]; for (k = 0; k < 3; k++) tmp2[k] = rotation[k][0] * tmp1[0] + rotation[k][1] * tmp1[1] + rotation[k][2] * tmp1[2]; for (k = 0; k < 3; k++) pnt[k] = tmp2[k] + center[k] + translate[k]; } int pclipped (double clip_center[3], double clip_axis[3], double pnt[3]) { int k; double center_to_pnt[3]; double dt; for (k = 0; k < 3; k++) center_to_pnt[k] = pnt[k] - clip_center[k]; dt = dot_product (center_to_pnt, clip_axis); if (dt > 0.0) return (1); return (0); } /* find the z coordinate of the intersection of the z axis through * the point and the clipping plane */ double zclipped (double clip_center[3], double clip_axis[3], double pnt[3]) { int k; double nv, alpha, beta, sin_alpha, sin_beta, d; double z[3], v[3], vz[3], w[3], q[3]; z[0] = 0.0; z[1] = 0.0; z[2] = 1.0; for (k = 0; k < 3; k++) v[k] = clip_center[k] - pnt[k]; nv = norm (v); if (!normalize(v)) { return (clip_center[2]); } cross (v, z, vz); if (!normalize(vz)) { return (clip_center[2]); } cross (vz, clip_axis, w); if (!normalize (w)) { return (clip_center[2]); } alpha = dot_product (v, z); beta = dot_product (w, z); sin_alpha = sin (alpha); sin_beta = sin (beta); if (sin_beta == 0.0) { return (clip_center[2]); } d = (sin_alpha / sin_beta) * nv; for (k = 0; k < 3; k++) q[k] = clip_center[k] + d * w[k]; return (q[2]); } /* MSP Molecular Surface Package Copyright 1986, 1989 by Michael L. Connolly All rights reserved */
21.352459
88
0.550288
[ "vector", "transform", "solid" ]
287694e9d357439872d34d46db420ca86065a5ff
10,782
h
C
sumo/src/netedit/GNEInspectorFrame.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
null
null
null
sumo/src/netedit/GNEInspectorFrame.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
null
null
null
sumo/src/netedit/GNEInspectorFrame.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
2
2017-12-14T16:41:59.000Z
2020-10-16T17:51:27.000Z
/****************************************************************************/ /// @file GNEInspectorFrame.h /// @author Jakob Erdmann /// @date Mar 2011 /// @version $Id$ /// // The Widget for modifying network-element attributes (i.e. lane speed) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. // SUMO is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // /****************************************************************************/ #ifndef GNEInspectorFrame_h #define GNEInspectorFrame_h // =========================================================================== // included modules // =========================================================================== #ifdef _MSC_VER #include <windows_config.h> #else #include <config.h> #endif #include "GNEFrame.h" // =========================================================================== // class declarations // =========================================================================== class GNEAttributeCarrier; class GNEAdditional; class GNEEdge; // =========================================================================== // class definitions // =========================================================================== /** * @class GNEInspectorFrame * The Widget for modifying network-element attributes (i.e. lane speed) */ class GNEInspectorFrame : public GNEFrame { /// @brief FOX-declaration FXDECLARE(GNEInspectorFrame) public: // =========================================================================== // class AttributeInput // =========================================================================== class AttributeInput : public FXHorizontalFrame { /// @brief FOX-declaration FXDECLARE(GNEInspectorFrame::AttributeInput) public: /// @brief constructor AttributeInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent); /// @brief show attribute of ac void showAttribute(SumoXMLTag ACTag, SumoXMLAttr ACAttribute, const std::string& value); /// @brief show attribute void hideAttribute(); /// @brief refresh attribute void refreshAttribute(); /// @brief get current tag SumoXMLTag getTag() const; /// @brief get current Attr SumoXMLAttr getAttr() const; /// @name FOX-callbacks /// @{ /// @brief try to set new attribute value long onCmdSetAttribute(FXObject*, FXSelector, void*); /// @brief open model dialog for more comfortable attribute editing long onCmdOpenAllowDisallowEditor(FXObject*, FXSelector, void*); /// @} protected: /// @brief FOX needs this AttributeInput() {} /// @brief removed invalid spaces of Positions and shapes std::string stripWhitespaceAfterComma(const std::string& stringValue); private: /// @brief pointer to GNEInspectorFrame parent GNEInspectorFrame* myInspectorFrameParent; /// @brief current tag SumoXMLTag myTag; /// @brief current Attr SumoXMLAttr myAttr; /// @brief pointer to label FXLabel* myLabel; /// @brief textField to modify the value of int attributes FXTextField* myTextFieldInt; /// @brief textField to modify the value of real/Time attributes FXTextField* myTextFieldReal; /// @brief textField to modify the value of string attributes FXTextField* myTextFieldStrings; /// @brief pointer to combo box choices FXComboBox* myChoicesCombo; /// @brief pointer to menu check FXCheckButton* myBoolCheckButton; /// @brief pointer to buttonCombinableChoices FXButton* myButtonCombinableChoices; /// @brief set show as private function void show(); /// @brief set hide as private function void hide(); }; // =========================================================================== // class editorParameters // =========================================================================== class NeteditParameters : public FXGroupBox { /// @brief FOX-declaration FXDECLARE(GNEInspectorFrame::NeteditParameters) public: /// @brief constructor NeteditParameters(GNEInspectorFrame* inspectorFrameParent); /// @brief destructor ~NeteditParameters(); /// @brief show NeteditParameters void show(); /// @brief hide all NeteditParameters void hide(); /// @name FOX-callbacks /// @{ /// @brief called when user toogle the blocking movement CheckBox long onCmdSetBlockingMovement(FXObject*, FXSelector, void*); /// @brief called when user toogle the blocking shape CheckBox long onCmdSetBlockingShape(FXObject*, FXSelector, void*); /// @brief called when user toogle the closiong shape CheckBox long onCmdSetClosingShape(FXObject*, FXSelector, void*); /// @} protected: /// @brief FOX needs this NeteditParameters() {} private: /// @brief pointer to inspector frame parent GNEInspectorFrame* myInspectorFrameParent; /// @brief Label for Check blocked movement FXLabel* myLabelBlockMovement; /// @brief pointer to check box "Block movement" FXCheckButton* myCheckBoxBlockMovement; /// @brief Label for Check blocked shape FXLabel* myLabelBlockShape; /// @brief pointer to check box "Block Shape" FXCheckButton* myCheckBoxBlockShape; /// @brief Label for close shape FXLabel* myLabelCloseShape; /// @brief pointer to check box "Block movement" FXCheckButton* myCheckBoxCloseShape; }; /**@brief Constructor * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame */ GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); /// @brief Destructor ~GNEInspectorFrame(); /// @brief show inspector frame void show(); /// @brief Inspect a single element void inspectElement(GNEAttributeCarrier* AC); /// @brief Inspect the given multi-selection void inspectMultisection(const std::vector<GNEAttributeCarrier*>& ACs); /// @brief inspect child of already inspected element void inspectChild(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement); /// @brief inspect called from DeleteFrame void inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked); /// @brief get current list of ACs const std::vector<GNEAttributeCarrier*>& getACs() const; /// @brief get the template edge (to copy attributes from) GNEEdge* getEdgeTemplate() const; /// @brief seh the template edge (we assume shared responsibility via reference counting) void setEdgeTemplate(GNEEdge* tpl); /// @name FOX-callbacks /// @{ /// @brief copy edge attributes from edge template long onCmdCopyTemplate(FXObject*, FXSelector, void*); /// @brief set current edge as new template long onCmdSetTemplate(FXObject*, FXSelector, void*); /// @brief update the copy button with the name of the template long onUpdCopyTemplate(FXObject*, FXSelector, void*); /// @brief called when user toogle the go back button long onCmdGoBack(FXObject*, FXSelector, void*); /// @brief called when user press right click over an item of list of childs long onCmdShowChildMenu(FXObject*, FXSelector, void* data); /// @brief called when user select option "center item" of child Menu long onCmdCenterItem(FXObject*, FXSelector, void*); /// @brief called when user select option "inspect item" of child menu long onCmdInspectItem(FXObject*, FXSelector, void*); /// @brief called when user select option "delte item" of child menu long onCmdDeleteItem(FXObject*, FXSelector, void*); /// @} protected: /// @brief FOX needs this GNEInspectorFrame() {} // @brief create pop-up menu in the positions X-Y for the attribute carrier ac void createPopUpMenu(int X, int Y, GNEAttributeCarrier* ac); /// @brief show child of current attributeCarrier void showAttributeCarrierChilds(); /// @brief get reference to current inspected Attribute carriers const std::vector<GNEAttributeCarrier*>& getInspectedACs() const; private: /// @brief groupBox for attributes FXGroupBox* myGroupBoxForAttributes; /// @brief list of Attribute inputs std::vector<GNEInspectorFrame::AttributeInput*> myVectorOfAttributeInputs; /// @brief Netedit Parameters NeteditParameters* myNeteditParameters; /// @brief back Button FXButton* myBackButton; /// @brief groupBox for templates FXGroupBox* myGroupBoxForTemplates; /// @brief copy template button FXButton* myCopyTemplateButton; /// @brief set template button FXButton* mySetTemplateButton; /// @brief the edge template GNEEdge* myEdgeTemplate; /// @brief pointer to previous element called by Inspector Frame GNEAttributeCarrier* myPreviousElementInspect; /// @brief pointer to previous element called by Delete Frame GNEAttributeCarrier* myPreviousElementDelete; /// @brief flag to ckec if myPreviousElementDelete was marked in Delete Frame bool myPreviousElementDeleteWasMarked; /// @brief the multi-selection currently being inspected std::vector<GNEAttributeCarrier*> myACs; /// @brief groupBox for AttrConnection FXGroupBox* myGroupBoxForTreeList; /// @brief tree list to show the childs of the element to erase FXTreeList* myTreelist; /// @brief map used to save the Tree items with their AC std::map<FXTreeItem*, GNEAttributeCarrier*> myTreeItemToACMap; /// @brief set used to save tree items without AC assigned (for example, Incoming/Outcoming connections) std::set<FXTreeItem*> myTreeItemsWithoutAC; /// @brief pointer to current right clicked Attribute Carrier GNEAttributeCarrier* myRightClickedAC; }; #endif /****************************************************************************/
32.972477
126
0.606566
[ "shape", "vector", "model" ]
931b083afd171191e99d14a0c32a5bbed4ef2f12
10,589
h
C
s32v234_sdk/libs/apex/drivers/user/include/global_hal.h
intesight/Panorama4AIWAYS
46e1988e54a5155be3b3b47c486b3f722be00b5c
[ "WTFPL" ]
null
null
null
s32v234_sdk/libs/apex/drivers/user/include/global_hal.h
intesight/Panorama4AIWAYS
46e1988e54a5155be3b3b47c486b3f722be00b5c
[ "WTFPL" ]
null
null
null
s32v234_sdk/libs/apex/drivers/user/include/global_hal.h
intesight/Panorama4AIWAYS
46e1988e54a5155be3b3b47c486b3f722be00b5c
[ "WTFPL" ]
2
2021-01-21T02:06:16.000Z
2021-01-28T10:47:37.000Z
/***************************************************************************** * * NXP Confidential Proprietary * * (C) Copyright CogniVue Corporation. 2011-2014 All right reserved. * Copyright (c) 2014-2016 Freescale Semiconductor * Copyright 2017 NXP * All Rights Reserved * ****************************************************************************** * * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 APEXGLOBALHAL_H #define APEXGLOBALHAL_H ///////////////////////////////////////////////////////////////////////// /// \addtogroup global_hal /// global_hal provides global APEX services related to interrupts and /// reset for all APEX hardware. /// @{ #ifdef __cplusplus extern "C" { #endif //__cplusplus /// APEX interrupt bits typedef enum { APEX2_INTERRUPT_MULTI_DMA = 0, ///< MCDMA interrupt APEX2_INTERRUPT_MOT_COMP_DMA, ///< motion compensation DMA interrupt APEX2_INTERRUPT_SEQUENCER, ///< sequencer interrupt APEX2_INTERRUPT_STREAM_IN_0, ///< streamin 0 interrupt APEX2_INTERRUPT_STREAM_IN_1, ///< streamin 1 interrupt APEX2_INTERRUPT_STREAM_IN_2, ///< streamin 2 interrupt APEX2_INTERRUPT_STREAM_IN_3, ///< streamin 3 interrupt APEX2_INTERRUPT_STREAM_OUT_0, ///< streamout 0 interrupt APEX2_INTERRUPT_STREAM_OUT_1, ///< streamout 1 interrupt APEX2_INTERRUPT_HRSZ_0, ///< horizontal resizer 0 interrupt APEX2_INTERRUPT_HRSZ_1, ///< horizontal resizer 1 interrupt APEX2_INTERRUPT_MAX } APEX_INTERRUPT_BITS; ///////////////////////////////////////////////////////////////////////////////// /// Reset all APEX hardware on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_AllReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset sequencer on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_uSequencerReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset motion compensation DMA on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_MotCmpDmaReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset CMEM dma (i.e. stream DMA or streamin/streamout) on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_CmemDmaReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset CMEM interface on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_cmemIFReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset MCDMA (multi-channel DMA) on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_DmaReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset APU0 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apu0Reset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset APU1 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apu1Reset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset vector control unit 0 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Vu0Reset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset vector control unit 1 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Vu1Reset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset horizontal resizer on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_HrszReset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset DMEM fifo 0 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Dmem0Reset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Reset DMEM fifo 1 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Dmem1Reset(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Enable APU0 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apu0Enable(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Enable APU1 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apu1Enable(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Disable APU0 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apu0Disable(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Disable APU1 on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apu1Disable(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Disable (i.e. mask) the global interrupt \p intBit on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). /// /// \param[in] intBit /// Global interrupt ID. ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apex2GlobalInterruptDisable(int apexID, APEX_INTERRUPT_BITS intBit); ///////////////////////////////////////////////////////////////////////////////// /// Enable (i.e. un-mask) the global interrupt \p intBit on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). /// /// \param[in] intBit /// Global interrupt ID. ///////////////////////////////////////////////////////////////////////////////// void global_hal_Apex2GlobalInterruptEnable(int apexID, APEX_INTERRUPT_BITS intBit); ///////////////////////////////////////////////////////////////////////////////// /// Check to see if the global interrupt \p intBit on APEX \p apexID is enabled. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). /// /// \param[in] intBit /// Global interrupt ID. /// /// \return /// 1 if interrupt \p intBit is enabled, 0 if it is disabled/masked. ///////////////////////////////////////////////////////////////////////////////// int global_hal_isApex2GlobalInterruptEnabled(int apexID, APEX_INTERRUPT_BITS intBit); ///////////////////////////////////////////////////////////////////////////////// /// Return the interrupt status register field associated with global interrupt /// \p intBit on APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). /// /// \param[in] intBit /// Global interrupt ID. /// /// \return /// Interrupt status register field associated with global interrupt /// \p intBit on APEX \p apexID. ///////////////////////////////////////////////////////////////////////////////// int global_hal_Apex2GlobalInterruptStatus(int apexID, APEX_INTERRUPT_BITS intBit); ///////////////////////////////////////////////////////////////////////////////// /// Return the hardware version associated with APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). /// /// \return /// Hardware version associated with APEX \p apexID. /// <table> /// <caption id="multi_row">global_hal_RetHwVersion return values</caption> /// <tr> <th>return value <th>meaning /// <tr> <td>0x642 <td>64xCU 2xAPU configuration /// <tr> <td>0x321 <td>32xCU 1xAPU configuration /// </table> ///////////////////////////////////////////////////////////////////////////////// int global_hal_RetHwVersion(int apexID); ///////////////////////////////////////////////////////////////////////////////// /// Return the RTL build number associated with APEX \p apexID. /// /// \param[in] apexID /// APEX ID (e.g. 0, 1, etc.). /// /// \return /// RTL build number associated with APEX \p apexID. ///////////////////////////////////////////////////////////////////////////////// int global_hal_RetRtlBuildNumber(int apexID); #ifdef __cplusplus } #endif //__cplusplus /// @} #endif /* APEXGLOBALHAL_H */
37.817857
85
0.422325
[ "vector" ]
9326c6875c95d2df4fbfaf1648ae7d1ce3211fa0
51,565
h
C
src/CuMatrix.h
gitrah/cuMatrix
cab0239d0ec141528c7832275bac9c7daefdebf4
[ "Unlicense" ]
null
null
null
src/CuMatrix.h
gitrah/cuMatrix
cab0239d0ec141528c7832275bac9c7daefdebf4
[ "Unlicense" ]
null
null
null
src/CuMatrix.h
gitrah/cuMatrix
cab0239d0ec141528c7832275bac9c7daefdebf4
[ "Unlicense" ]
null
null
null
/* * CuMatrix.h * * Created on: Dec 3, 2012 * Author: reid */ #pragma once #include "util.h" #include "CuFunctor.h" #include "UnaryOpF_Gen.h" #include "UnaryOpIndexF_Gen.h" #include "BinaryOpF_Gen.h" #include <curand_kernel.h> #include "MemMgr.h" #include "Migrator.h" #include "CuDefs.h" #include "DMatrix.h" #include "Tiler.h" #include "MatrixExceptions.h" #include <cublas_v2.h> #include <set> template<typename T> class MemMgr; /* * m-m-m-my m-matrix * * TODO * proper pitch/cuda-style array support * */ extern __constant__ uint D_MaxRowsDisplayed; extern __constant__ uint D_MaxColsDisplayed; extern uint CuDestructs; extern __device__ uint CuDestructsD; #ifdef CuMatrix_UseCublas extern bool g_useCublas; extern cublasHandle_t g_handle; #endif template<typename T> class CuMatrix { // friend class Tiler<T>; public: static CuMatrix<T> ZeroMatrix; static MemMgr<T>* mgr; protected: bool ownsTxp; __host__ __device__ void freeTxp(); CuMatrix<T>* txp; // c++ limitation is that this won't compile as a value, only a pointer, because size of Matrix<T> is 'unknown' at this point __host__ __device__ void initMembers(); public: Modification lastMod; T* elements; int m, n, p; int oldM, oldN; long size; // in BYTES bool posed, colMajor, ownsDBuffers, ownsHBuffers; Tiler<T> tiler; // todo d and h tilers int _tileM, _tileN, _tileP; /* * in the extra resident case, a suitable row or column tile is calculated * tiler allocs one or more (if >1 gpus) tile-sized that will be shared by all the tiles * operations are then decomposed into bunches that operate sequentially over (pairs of) tiles */ TileDirection tileD; //int hTileCount; __host__ MemMgr<T>& getMgr() const; public: __host__ __device__ CuMatrix(); __host__ __device__ CuMatrix(const CuMatrix<T>& o); /* __host__ __device__ CuMatrix(const CuMat<T>& o);*/ explicit __host__ __device__ CuMatrix( T* h_data, int m, int n, bool allocateD); explicit __host__ __device__ CuMatrix( T* h_data, int m, int n, int p, bool allocateD); explicit __host__ __device__ CuMatrix(int m, int n, bool allocateH, bool allocateD ); explicit __host__ __device__ CuMatrix(int m, int n, int p, bool allocateH, bool allocateD ); explicit __host__ __device__ CuMatrix(int m, int n, int p, bool allocateH, bool allocateD, int gpuMask, TileDirection tileD = tdCols); explicit __host__ __device__ CuMatrix(int m, int n, int p, int tileM, int tileN, bool allocateH, bool allocateD, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdCols ); virtual __host__ __device__ ~CuMatrix(); __host__ __device__ CuMatrix copy(bool copyDeviceMem = true) const; static __host__ __device__ bool integralTypeQ(); //mem inline __host__ __device__ void tile0(DMatrix<T>& dm, cudaStream_t stream = 0) const { tile0(dm, lastMod == mod_host, stream); } inline __host__ __device__ void tile0(DMatrix<T>& dm, bool copy, cudaStream_t stream = 0) const { if(copy && !(lastMod == mod_synced || lastMod == mod_host)) { flprintf("bad mod %d\n", lastMod); } assert(!copy || ( lastMod == mod_synced || lastMod == mod_host)); tiler.tile0(dm,copy,stream); } /* * streams are per gpu * if a stream is specified and lastGpu/gpuMask cause a device change for this tile, kaboom */ __host__ __device__ int tile1D(DMatrix<T>& dm, int& roff, int& coff,int& tileM, int& tileN, int t, TileDirection tileD = tdRows, bool copy = true, int lastGpu = -1, cudaStream_t stream = 0) const; /* * calculate properties of next tile (indexed by rowTileIdx and or colTileIdx) * offset in source (roff, coff) * width of tile (dm.m, dm.n; same for all but, possibly, edge tiles) */ __host__ __device__ int tile2D(DMatrix<T>& dm, int& roff, int& coff, int& tileM, int& tileN, int rowTileIdx, int colTileIdx, int rowTileCount, int colTileCount, bool copy = true, int lastGpu =-1, cudaStream_t stream = 0) const; __host__ __device__ int releaseBuffers(); __host__ __device__ CuMatrix<T>& syncBuffers(bool copy = true); //__host__ __device__ void calcTiles(float headroom = DEFAULT_GMEM_HEADROOM_FACTOR); __host__ __device__ void invalidateHost(); __host__ __device__ void invalidateDevice(); __host__ __device__ T* currBuffer() const { return tiler.currBuffer(); } __host__ __device__ CuMatrix<T> syncHost(); __host__ __device__ CuMatrix<T> syncDevice(); inline __host__ __device__ ulong offset(int roff, int coff) const {return colMajor ? (coff * m + roff ) : (roff * p + coff);} // toRtiles, toLtiles __host__ __device__ DMatrix<T> asDmatrix( bool copy = true) const { DMatrix<T> dt; tile0(dt,lastMod == mod_host && copy); return dt; } __host__ __device__ void updateSize() { size = p * m * sizeof(T); } inline void allocHost() { getMgr().allocHost(*this); } __host__ CUDART_DEVICE CuMatrix<T> columnSubset( const int* indices, int count) const; __host__ CuMatrix<T> clippedRowSubset( const int *r, int count, intPair colRange) const; CuMatrix<T> addBiasColumn() const; void copy(CuMatrix<T>& res, int roff = 0, int coff = 0, bool onlyDevice = false) const; CuMatrix<T> replicateTiled(int mcopies, int ncopies) const; static void concat(CuMatrix<T>& canvas, int components, const CuMatrix<T>** parts, bool colMajor = false); static void concat(CuMatrix<T>& canvas, vector< CuMatrix<T>> parts, bool colMajor = false); __host__ __device__ cudaError_t rowCopy(CuMatrix<T>& targ, int tRow, int sRow) const; __host__ __device__ CuMatrix<T> derefIndices(const IndexArray& tary) const; static cudaError_t copyIndexed(CuMatrix<T>& targ, const IndexArray& tary, const CuMatrix<T>& src, const IndexArray& sary); // copy 'fraction' (normalized) of rows into 'trg' and remainder into 'leftovers' shuffling row order by using // vIndices to hold a random sequence that become the new indices void shuffle(CuMatrix<T>* trg, CuMatrix<T>* leftovers, T fraction, vector<int>& vIndices, TileDirection td = tdRows) const; std::pair<int,int> refCounts() const { return getMgr().refCounts(*this); } int hRefCount() { return elements ? getMgr().refCount(elements) : 0;} int dRefCount() { return tiler.buff() ? getMgr().refCount(tiler.buff()) : 0;} void toDevice(int dev); inline friend Migrator<T>& operator<<(Migrator<T>& mgrtr, CuMatrix<T>& m) { return mgrtr.migrate(m); } __host__ __device__ void zero(); __host__ void toFile(const char* fileName) const; __host__ CUDART_DEVICE CuMatrix<T> rightConcatenate( const CuMatrix<T>& other, cudaStream_t stream = 0) const; __host__ CUDART_DEVICE CuMatrix<T> bottomConcatenate(const CuMatrix<T>& other, cudaStream_t stream = 0) const; __host__ CUDART_DEVICE void set(int r, int c, T val); __host__ CUDART_DEVICE void set(int l, T val); __host__ __device__ T get(int r, int c) const; __host__ __device__ T getH(int r, int c) const; __host__ __device__ T get(long l) const; // Qs __host__ __device__ inline bool zeroDimsQ() const { return m == 0 && n == 0; } __host__ __device__ inline bool containableQ(const CuMatrix<T>& o) const { return o.m <= m && o.n <= n; } __host__ __device__ inline bool compatibleQ(const CuMatrix<T>& o) const { return o.m == m && o.n == n && o.p == p; } int indexOfGlolo(T val); int2 indexOf2D(T val,cudaStream_t stream = 0); bool zeroQ(T eps = util<T>::epsilon()); __host__ __device__ inline bool contiguousQ() const { return n == p; }; __host__ __device__ inline bool paddedQ() { return !contiguousQ(); } __host__ __device__ inline bool biLocatedQ() const { return (elements && tiler.hasDmemQ()); } __host__ __device__ inline bool gpuReadyQ() const { return tiler.hasDmemQ() && (lastMod == mod_synced || lastMod == mod_device || lastMod == mod_neither); } __host__ __device__ inline bool synchedQ() const { return elements != null && lastMod == mod_synced; } __host__ __device__ inline bool hostReadyQ() const { return elements && (lastMod == mod_synced || lastMod == mod_host); } __host__ __device__ inline bool vectorQ() const { return (m == 1 || n == 1); } __host__ __device__ inline ulong length() const { return m * n;} __host__ __device__ inline bool squareQ() const { return n == m; } __host__ __device__ inline bool rowVectorQ() const { return m == 1;} __host__ __device__ inline bool columnVectorQ() const { return n == 1;} __host__ __device__ inline bool scalarQ() const { return m == 1 && n == 1;} __host__ __device__ inline bool validDimsQ() const { return m != 0 && n != 0; } __host__ __device__ inline bool validColQ(int col) const { return col < n; } __host__ __device__ inline bool validRowQ(int row) const { return row < m; } __host__ __device__ inline bool validIndicesQ(int row, int col) const { return col < n && row < m; }; __host__ __device__ bool biasedQ() const; #ifdef CuMatrix_Enable_KTS template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE bool all(BoolUnaryOp<T> op) const; template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE long count(BoolUnaryOp<T> op) const; template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE long countRows(BoolUnaryOp<T> op) const; template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE IndexArray find(BoolUnaryOp<T> op) const; template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE void findFirstN(IndexArray arry, BoolUnaryOp<T> op) const; template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE bool any(BoolUnaryOp<T> op) const; template <template <typename> class BoolUnaryOp> __host__ CUDART_DEVICE bool none(BoolUnaryOp<T> op) const; #else template <int StateDim> __host__ CUDART_DEVICE bool all(UnaryOpF<T,StateDim> op) const; template <int StateDim> __host__ CUDART_DEVICE long count(UnaryOpF<T,StateDim> op) const; template <int StateDim> __host__ CUDART_DEVICE long countRows(UnaryOpF<T,StateDim> op) const; template <int StateDim> __host__ CUDART_DEVICE IndexArray find(UnaryOpF<T,StateDim> op) const; template <int StateDim> __host__ CUDART_DEVICE void findFirstN(IndexArray arry, UnaryOpF<T,StateDim> op) const; template <int StateDim> __host__ CUDART_DEVICE bool any(UnaryOpF<T,StateDim> op) const; template <int StateDim> __host__ CUDART_DEVICE bool none(UnaryOpF<T,StateDim> op) const; #endif template <typename IndexUnaryOp, template <typename> class BoolUnaryOp> bool indexedAll(IndexUnaryOp idxOp, BoolUnaryOp<T> op) const; template <typename IndexUnaryOp, template <typename> class BoolUnaryOp> bool indexedAny(IndexUnaryOp idxOp, BoolUnaryOp<T> op) const; template <typename IndexUnaryOp, template <typename> class BoolUnaryOp> bool indexedNone(IndexUnaryOp idxOp, BoolUnaryOp<T> op) const; bool isBinaryCategoryMatrix() const; // extent inline intPair dims() const { return intPair( m,n );} inline int longAxis() const { return MAX(m,n); } inline __host__ CUDART_DEVICE T vectorLength() const { return sqrt_p(autoDot()); } T max( cudaStream_t stream = 0) const; T min( cudaStream_t stream = 0) const; IndexArray rowIndices(int row) const; IndexArray columnIndices(int col) const; inline float aspect() { return 1.0f * m / n; } template <int N> static int sizeOfArray( T (& arry)[N]) { return N; } CuMatrix<T> toBinaryCategoryMatrix() const; CuMatrix<T> toMaxColumnIndexVector()const; ulong distinctCount() const; std::set<T> distinct() const; __host__ CUDART_DEVICE CuMatrix<T> histogram( cudaStream_t stream ) const ; __host__ CUDART_DEVICE void attributeFreqsKernelL(DMatrix<T>& d_freqs, DMatrix<T>& d_atts, DMatrix<T>& d_entropies, DMatrix<int>& d_counts, DMatrix<int>& d_depths, DMatrix<int>& d_distances, const DMatrix<T>& d_x, cudaStream_t stream ) const ; __host__ CUDART_DEVICE void attributeFrequencies( CuMatrix<T>& freqs, CuMatrix<T>& atts, CuMatrix<T>& entropies, CuMatrix<int>& counts, CuMatrix<int>& depths, CuMatrix<int>& distances, cudaStream_t stream = nullptr) const; __host__ CUDART_DEVICE CuMatrix<T> attributeFrequencies(cudaStream_t stream = nullptr) const; // form __host__ CUDART_DEVICE CuMatrix<T> transpose(cudaStream_t stream = 0) const; __host__ CUDART_DEVICE CuMatrix<T> transposeXr(cudaStream_t stream = 0) const; __host__ CUDART_DEVICE CuMatrix<T> transposeKernelPtr(void (*kernel)( T* tElements, const T* sElements, int width, int height)); __host__ CUDART_DEVICE CuMatrix<T> transposePitchKernelPtr(void (*kernel)(T* tElements, const T* sElements, int width, int height,int spitch,int tpitch)); __host__ CUDART_DEVICE void transpose(DMatrix<T>& res); __host__ CUDART_DEVICE void transposeKernelPtr(DMatrix<T>& res, void (*kernel)( T* tElements, const T* sElements, int width, int height)); __host__ CUDART_DEVICE void transposePitchKernelPtr(DMatrix<T>& res, void (*kernel)( T* tElements, const T* sElements, int width, int height, int spitch, int tpitch)); // create new matrix from array of row indices into this matrix CuMatrix<T> reconstruct(const IndexArray& arry); CuMatrix<T> poseAsRow(); CuMatrix<T> poseAsCol(); CuMatrix<T>& unPose(); __host__ CUDART_DEVICE CuMatrix<T> reshape(int rows, int cols, long offsetInTs); __host__ CUDART_DEVICE void reshape(CuMatrix<T>& target, int rows, int cols, ulong offsetInTs); __host__ CUDART_DEVICE void recreate(int rows, int cols, int pitch, bool allocH, bool allocD ); void unconcat(CuMatrix<T>& v, int rows, int cols, int pitch, int offsetInTs, bool colMajor = false) const; __host__ CUDART_DEVICE void submatrix(CuMatrix<T>& v, int rows, int cols, int roff, int coff) const; CuMatrix<T> redimension(pair<int, int>& dims, int offset = 0); __host__ CUDART_DEVICE CuMatrix<T> columnMatrix(int col) const; CuMatrix<T> rowMatrix(int row) const; CuMatrix<T> dropFirst(bool copy=true, cudaStream_t stream = 0) const; CuMatrix<T> dropLast(bool copy=false) const; CuMatrix<T> vectorToDiagonal() const; __host__ CUDART_DEVICE CuMatrix<T> columnVector(int col) const; CuMatrix<T> rowVector(int row) const; CuMatrix<T> toRowVector() const; CuMatrix<T> toColumnVector() const; CuMatrix<T> toDiagonalsVector() const; T toScalar() const; __host__ CUDART_DEVICE CuMatrix<T> extrude(int depth) const; __host__ CUDART_DEVICE inline Modification getLastMod() const { return lastMod; } /* * math */ CuMatrix<T> featureMeans(bool lv)const; void featureMeans( CuMatrix<T>& means, bool lv)const; void featureMeansTx( CuMatrix<T>& means)const; void featureMeansStreams( CuMatrix<T>& means, bool lv,int nstreams)const; CuMatrix<T> subMeans( const CuMatrix<T>& means)const; __host__ CUDART_DEVICE void subMeans( CuMatrix<T>& res, const CuMatrix<T>& means)const; CuMatrix<T> sqrSubMeans(const CuMatrix<T>& mus)const; // sub means but sqaur cudaError_t sqrSubMeans( CuMatrix<T>& res, const CuMatrix<T>& mus)const; CuMatrix<T> normalize()const; __host__ CUDART_DEVICE void rowSum(CuMatrix<T>& rowSumM)const; __host__ CUDART_DEVICE CuMatrix<T> rowSum()const; int sgn(int row, int col)const; void matrixMinorM(CuMatrix<T>& trg, int row, int col) const; CuMatrix<T> matrixMinorM(int row, int col) const; T matrixMinor(int row, int col) const; T cofactor(int row, int col)const; CuMatrix<T> cofactorM()const; T determinant()const; CuMatrix<T> inverse()const; CuMatrix<T> inverse(T determinant)const; __host__ CUDART_DEVICE T norm(int l); // todo move this to anom det void fitGaussians( CuMatrix<T>& sqrdSigmas, CuMatrix<T>& mus) const; void variance( CuMatrix<T>& sqrdSigmas, const CuMatrix<T>& mus) const; CuMatrix<T> toCovariance() const; // assumes this is the variance matrix void toCovariance(CuMatrix<T>& covariance) const; void multivariateGaussianFeatures( CuMatrix<T>& pden, const CuMatrix<T>& sigmaSquared, const CuMatrix<T>& mu); void mvGaussianVectorFromFeatures( CuMatrix<T>& pvec); void multivariateGaussianVector( CuMatrix<T>& pvec, const CuMatrix<T>& sigmaSquared, const CuMatrix<T>& mu); CuMatrix<T> multivariateGaussianVectorM( const CuMatrix<T>& sigmaSquared, const CuMatrix<T>& mu); __host__ CUDART_DEVICE CuMatrix<T> matrixProduct( const CuMatrix<T>& b, dim3* block = null, cudaStream_t stream = 0)const; __host__ CUDART_DEVICE CuMatrix<T> matrixProductResident(const CuMatrix<T>& b, dim3* block=null, cudaStream_t stream = 0)const; // mk => multi kernel, for matrix prods where either one or both mat are large enough to exhaust compute resources // todo multi-gpu mult // looping threads __host__ CUDART_DEVICE CuMatrix<T> mkMatrixProduct( const CuMatrix<T>& b, dim3* block = null, cudaStream_t stream = 0)const; __host__ CUDART_DEVICE CuMatrix<T> subFrom(T o)const; __host__ CUDART_DEVICE CuMatrix<T> hadamardProduct(const CuMatrix<T> o)const; __host__ CUDART_DEVICE CuMatrix<T> hadamardQuotient(const CuMatrix<T> o)const; // printing string dimsString() const; __host__ string toShortString() const; string toss() const { return toShortString();} __host__ __device__ void printShortString(const char* msg = null) const; __host__ string toString() const; __host__ string pAsRow(); __host__ __device__ void print(const char* fmt, const char* msg) const; __host__ __device__ void print(const char* msg) const; __host__ __device__ void printRow(int row) const; __host__ string rowStr(int row) const; // stats __host__ __device__ float flow(int iterations, int iterationMemoryFactor, float exeTime); // unary impls #ifdef CuMatrix_Enable_KTS template<template <typename> class UnaryOp> __host__ CUDART_DEVICE void unaryOp(CuMatrix<T>& res, UnaryOp<T> op, cudaStream_t stream = 0)const; template<template <typename> class UnaryOp> __host__ CUDART_DEVICE CuMatrix<T> unaryOp(UnaryOp<T> op, cudaStream_t stream = 0)const; #else template<int StateDim> __host__ CUDART_DEVICE void unaryOp(CuMatrix<T>& res, UnaryOpF<T,StateDim> op, cudaStream_t stream = 0)const; template<int StateDim> __host__ CUDART_DEVICE CuMatrix<T> unaryOp(UnaryOpF<T,StateDim> op, cudaStream_t stream = 0)const; #endif //template<typename UnaryOp> static void unaryOp(DMatrix<T>& dst, DMatrix<T>& src, UnaryOp op); __host__ CUDART_DEVICE CuMatrix<T> negate()const; __host__ CUDART_DEVICE CuMatrix<T> sigmoid()const; static __host__ CUDART_DEVICE void sigmoid(DMatrix<T>& trg, DMatrix<T> src, cudaStream_t stream = 0 ); __host__ CUDART_DEVICE CuMatrix<T> sigmoidGradient()const; __host__ CUDART_DEVICE CuMatrix<T> log()const; __host__ CUDART_DEVICE CuMatrix<T> ceil()const; __host__ CUDART_DEVICE CuMatrix<T> floor()const; __host__ CUDART_DEVICE CuMatrix<T> oneOver()const; __host__ CUDART_DEVICE CuMatrix<T> exp()const; __host__ CUDART_DEVICE CuMatrix<T> sqrt()const; __host__ CUDART_DEVICE CuMatrix<T> sqr()const; __host__ CUDART_DEVICE CuMatrix<T> pow(T o)const; __host__ CUDART_DEVICE CuMatrix<T> qpow(T o)const; __host__ CUDART_DEVICE CuMatrix<T> divSqrt(T divisor)const; __host__ CUDART_DEVICE void setAll(int val); // reduzziones #ifdef CuMatrix_Enable_KTS template<template <typename> class BinaryOp> __host__ CUDART_DEVICE void binaryOp(CuMatrix<T>& res, const CuMatrix<T>& o, BinaryOp<T> op, cudaStream_t stream = 0) const; template<template <typename> class BinaryOp> __host__ CUDART_DEVICE CuMatrix<T> binaryOp(const CuMatrix<T>& o, BinaryOp<T> op, cudaStream_t stream = 0) const; #else template<int StateDim> __host__ CUDART_DEVICE void binaryOp(CuMatrix<T>& res, const CuMatrix<T>& o, BinaryOpF<T,StateDim> op, cudaStream_t stream = 0) const; template<int StateDim>__host__ CUDART_DEVICE CuMatrix<T> binaryOp(const CuMatrix<T>& o, BinaryOpF<T,StateDim> op, cudaStream_t stream = 0) const; #endif #ifdef CuMatrix_Enable_KTS template <template <typename> class BinaryOp> __host__ CUDART_DEVICE T reduce(BinaryOp<T> op, T start, cudaStream_t stream = 0)const; template <template <typename> class BinaryOp> static __host__ CUDART_DEVICE T reduce(const DMatrix<T>& d_M, BinaryOp<T> op, T start, cudaStream_t stream = 0 ); #else template<int StateDim> __host__ CUDART_DEVICE T reduce(MonoidF<T,StateDim> op, T start, cudaStream_t stream = 0)const; template<int StateDim> static __host__ CUDART_DEVICE T reduce(const DMatrix<T>& d_M, MonoidF<T,StateDim> op, T start, cudaStream_t stream = 0 ); #endif #ifdef CuMatrix_Enable_KTS template <template <typename> class BinaryOp> __host__ CUDART_DEVICE void reduceAsync(T* result, BinaryOp<T> op, T start, cudaStream_t stream = 0)const; template <template <typename> class BinaryOp> static __host__ CUDART_DEVICE void reduceAsync(T* result, const DMatrix<T>& d_M, BinaryOp<T> op, T start, cudaStream_t stream = 0 ); template <template <typename> class BinaryOp> static __host__ CUDART_DEVICE void reduceAsyncBuffer(T* result, DMatrix<T>& buffer, int blocks, int threads, long nP, const DMatrix<T>& d_M, BinaryOp<T> op, T start, cudaStream_t stream = 0 ); #else template<int StateDim> __host__ CUDART_DEVICE void reduceAsync(T* result, MonoidF<T,StateDim> op, T start, cudaStream_t stream = 0)const; template<int StateDim> static __host__ CUDART_DEVICE void reduceAsync(T* result, const DMatrix<T>& d_M, MonoidF<T,StateDim> op, T start, cudaStream_t stream = 0 ); template<int StateDim> static __host__ CUDART_DEVICE void reduceAsyncBuffer(T* result, DMatrix<T>& buffer, int blocks, int threads, long nP, const DMatrix<T>& d_M, MonoidF<T,StateDim> op, T start, cudaStream_t stream = 0 ); #endif #ifdef CuMatrix_Enable_KTS template <typename IndexBoolUnaryOp, template <typename> class BinaryOp> __host__ CUDART_DEVICE T indexedReduce(IndexBoolUnaryOp idxOp, BinaryOp<T> op, T start, cudaStream_t stream = 0 )const; template <typename IndexBoolUnaryOp, template <typename> class BinaryOp> __host__ CUDART_DEVICE T indexedReduceL(const DMatrix<T>& d_M, IndexBoolUnaryOp idxOp, BinaryOp<T> op, T start, cudaStream_t stream = 0 )const; #else template <int IopDim, int BopDim> __host__ CUDART_DEVICE T indexedReduce(UnaryOpIndexF<T,IopDim> idxOp, MonoidF<T,BopDim> op, T start, cudaStream_t stream = 0 )const; template <int IopDim, int BopDim> __host__ CUDART_DEVICE T indexedReduceL(const DMatrix<T>& d_M, UnaryOpIndexF<T,IopDim> idxOp, MonoidF<T,BopDim> op, T start, ulong idxStart = 0, cudaStream_t stream = 0 )const; #endif #ifdef CuMatrix_Enable_KTS template <template <typename> class BinaryOp> __host__ CUDART_DEVICE T reduceColumn(BinaryOp<T> op, T start, int col, cudaStream_t stream = 0)const; template <template <typename> class BinaryOp> static __host__ CUDART_DEVICE void reduceColumn(T* res, const DMatrix<T>& d_M, BinaryOp<T> op, T start, int col, cudaStream_t stream = 0 ); #else template <int StateDim> __host__ CUDART_DEVICE T reduceColumn(MonoidF<T,StateDim> op, T start, int col, cudaStream_t stream = 0)const; template <int StateDim> static __host__ CUDART_DEVICE void reduceColumn(T* res, const DMatrix<T>& d_M, MonoidF<T,StateDim> op, T start, int col, cudaStream_t stream = 0 ); #endif #ifdef CuMatrix_Enable_KTS template <template <typename> class BinaryOp> static __host__ CUDART_DEVICE void reduceRowsNlte64(DMatrix<T>& resVec, const DMatrix<T>& d_M, BinaryOp<T> op, cudaStream_t stream = 0 ); template <template <typename> class BinaryOp> static __host__ CUDART_DEVICE void reduceRows(DMatrix<T>& resVec, const DMatrix<T>& d_M, BinaryOp<T> op, cudaStream_t stream = 0 ); #else template<int StateDim> static __host__ CUDART_DEVICE void reduceRowsNlte64(DMatrix<T>& resVec, const DMatrix<T>& d_M, MonoidF<T,StateDim> op, cudaStream_t stream = 0 ); template<int StateDim> static __host__ CUDART_DEVICE void reduceRows(DMatrix<T>& resVec, const DMatrix<T>& d_M, MonoidF<T,StateDim> op, cudaStream_t stream = 0 ); #endif #ifdef CuMatrix_Enable_KTS template <template <typename> class UnaryOp, template <typename> class BinaryOp> __host__ CUDART_DEVICE T gloloReduce(UnaryOp<T> gop, BinaryOp<T> lop, T start, cudaStream_t stream = 0 ) const; template <template <typename> class UnaryOp, template <typename> class BinaryOp> __host__ CUDART_DEVICE T gloloReduceL(const DMatrix<T>& d_M, UnaryOp<T> gop, BinaryOp<T> lop, T start, cudaStream_t stream = 0 )const; #else template <int UopDim, int BopDim> __host__ CUDART_DEVICE T gloloReduce(UnaryOpF<T,UopDim> gop, MonoidF<T,BopDim> lop, T start, cudaStream_t stream = 0 ) const; template <int UopDim, int BopDim> __host__ CUDART_DEVICE T gloloReduceL(const DMatrix<T>& d_M, UnaryOpF<T,UopDim> gop, MonoidF<T,BopDim> lop, T start, cudaStream_t stream = 0 )const; #endif /* * combine reduce first combines two matrices using the 'cop' binary op, which is applied element-wise * and the intermediate result is effectively a new matrix of same dim * next the reduction binary op 'bop' is applied per usual to the intermediate matrix */ #ifdef CuMatrix_Enable_KTS // matbinaryop to superpose (combine) matrices, binary op to reduce template <template <typename> class CombineOp, template <typename> class ReduceOp> __host__ CUDART_DEVICE T combineReduce(CombineOp<T> cop, ReduceOp<T> rop, const CuMatrix<T>& o, T start, cudaStream_t stream = 0 )const; template <template <typename> class CombineOp, template <typename> class ReduceOp> __host__ CUDART_DEVICE T combineReduce(CuMatrix<T>& buffer, CombineOp<T> cop, ReduceOp<T> rop, const CuMatrix<T>& o, T start, cudaStream_t stream = 0 )const; template <template <typename> class CombineOp, template <typename> class ReduceOp> __host__ CUDART_DEVICE T combineReduceL(const DMatrix<T>& d_M1, const DMatrix<T>& d_M2, CombineOp<T> cop, ReduceOp<T> rop, T start, cudaStream_t stream = 0)const; template <template <typename> class CombineOp, template <typename> class ReduceOp> __host__ CUDART_DEVICE T combineReduceL(CuMatrix<T>& buffer, const DMatrix<T>& d_M1, const DMatrix<T>& d_M2, CombineOp<T> cop, ReduceOp<T> rop, T start, cudaStream_t stream = 0)const; #else template <int CopDim, int RopDim> __host__ CUDART_DEVICE T combineReduce( BinaryOpF<T,CopDim> cop, BinaryOpF<T,RopDim> rop, const CuMatrix<T>& o, T start, cudaStream_t stream = 0 )const; template <int CopDim, int RopDim> __host__ CUDART_DEVICE T combineReduce(CuMatrix<T>& buffer, BinaryOpF<T,CopDim> cop, BinaryOpF<T,RopDim> rop, const CuMatrix<T>& o, T start, cudaStream_t stream = 0 )const; template <int CopDim, int RopDim> __host__ CUDART_DEVICE T combineReduceL(const DMatrix<T>& d_M1, const DMatrix<T>& d_M2, BinaryOpF<T,CopDim> cop, BinaryOpF<T,RopDim> rop, T start, cudaStream_t stream = 0)const; template <int CopDim, int RopDim> __host__ CUDART_DEVICE T combineReduceL(CuMatrix<T>& buffer, const DMatrix<T>& d_M1, const DMatrix<T>& d_M2, BinaryOpF<T,CopDim> cop, BinaryOpF<T,RopDim> rop, T start, cudaStream_t stream = 0)const; #endif #ifdef CuMatrix_Enable_KTS template <template <typename> class BinaryOp> __host__ CUDART_DEVICE T columnReduceIndexed(BinaryOp<T> op, int column, T start, cudaStream_t stream = 0 )const; template <template <typename> class BinaryOp> __host__ CUDART_DEVICE T rowReduce(BinaryOp<T> op, int row, T start, cudaStream_t stream = 0 )const; #else template<int StateDim> __host__ CUDART_DEVICE T columnReduceIndexed(MonoidF<T,StateDim> op, int column, T start, cudaStream_t stream = 0 )const; template<int StateDim> __host__ CUDART_DEVICE T rowReduce(MonoidF<T,StateDim> op, int row, T start, cudaStream_t stream = 0 )const; #endif __host__ CUDART_DEVICE T columnSum(int column, cudaStream_t stream = 0) const; __host__ CUDART_DEVICE CuMatrix<T> columnSums(int numGpus = 1) const { cudaStream_t *streams = (cudaStream_t *) malloc( numGpus * sizeof(cudaStream_t)); CuMatrix<T> sums = CuMatrix<T>::zeros(1,n); #ifndef __CUDA_ARCH__ flprintf("sums.toss %s\n", sums.toss().c_str()); #endif for(auto i = 0; i < n; i++ ) { cherr(cudaStreamCreateWithFlags(&streams[i], cudaStreamNonBlocking)); } for(auto i = 0; i < n; i++ ) { sums.set(0,i, columnSum(i, streams[i])); } for(auto i = 0; i < n; i++ ) { cherr(cudaStreamDestroy(streams[i])); } cherr(cudaDeviceSynchronize()); return sums; } __host__ CUDART_DEVICE T sum(cudaStream_t stream = 0 ) const; __host__ T kahanSum() const; inline __host__ CUDART_DEVICE T autoDot( cudaStream_t stream = 0) const { #ifdef CuMatrix_Enable_KTS return gloloReduce(sqrUnaryOp<T>(), plusBinaryOp<T>(), 0, stream); #else MonoidF<T,1> pl = Functory<T,plusBinaryOp>::pinch(); return gloloReduce(Functory<T,sqrUnaryOp>::pinch(), pl, 0, stream); #endif } __host__ CUDART_DEVICE T rowSum(int row, cudaStream_t stream = 0) const; __host__ CUDART_DEVICE T prod( cudaStream_t stream = 0) const; __host__ pair<T,T> bounds() const; void bounds(T* min, T* max) const; __host__ CUDART_DEVICE T sumSqrDiff( const CuMatrix<T>& o)const; __host__ CUDART_DEVICE T sumSqrDiff(CuMatrix<T>& reductionBuffer, const CuMatrix<T>& o )const; __host__ CUDART_DEVICE T accuracy( const CuMatrix<T>& o)const; __host__ CUDART_DEVICE T accuracy( CuMatrix<T>& reductionBuffer, const CuMatrix<T>& o)const; // // operators // // matrix-matrix __host__ CUDART_DEVICE CuMatrix<T> operator|=( const CuMatrix<T> b) const; // right concat __host__ CUDART_DEVICE CuMatrix<T> operator/=( const CuMatrix<T> b) const; // bottom concat __host__ CUDART_DEVICE CuMatrix<T> operator-( const CuMatrix<T> o) const; __host__ CUDART_DEVICE CuMatrix<T> operator+( const CuMatrix<T> o) const; __host__ CUDART_DEVICE bool operator==( const CuMatrix<T> o) const; __host__ CUDART_DEVICE bool operator!=( const CuMatrix<T> o) const; __host__ CUDART_DEVICE CuMatrix<T> operator*( const CuMatrix<T> o) const; // matrix product __host__ CUDART_DEVICE CuMatrix<T> operator%( const CuMatrix<T> o) const; // hadamard product __host__ CUDART_DEVICE CuMatrix<T> operator&&( const CuMatrix<T> o) const; // elmtwise and __host__ CUDART_DEVICE CuMatrix<T> operator||( const CuMatrix<T> o) const; // elmtwise or __host__ CUDART_DEVICE CuMatrix<T> operator=(const CuMatrix<T> o); // assignment // matrix-scalar -> returns new matrix of element-wise application of op __host__ CUDART_DEVICE CuMatrix<T> operator^(T o) const; __host__ CUDART_DEVICE CuMatrix<T> operator<(T o) const; __host__ CUDART_DEVICE CuMatrix<T> operator<=(T o) const; __host__ CUDART_DEVICE CuMatrix<T> operator>(T o) const; __host__ CUDART_DEVICE CuMatrix<T> operator>=(T o) const; __host__ CUDART_DEVICE CuMatrix<T> operator==(T o) const; __host__ CUDART_DEVICE CuMatrix<T> operator+(T o) const; friend __host__ CUDART_DEVICE CuMatrix<T> operator+(T o, const CuMatrix<T> m){ return m + o; } __host__ CUDART_DEVICE CuMatrix<T> operator-(T o) const; inline friend __host__ CUDART_DEVICE CuMatrix<T> operator-(T o, const CuMatrix<T> m) { return m.unaryOp( Functory<T,subFromUnaryOp>::pinch(o)); } __host__ CUDART_DEVICE CuMatrix<T> operator*(T o) const; // elemwise scale inline friend __host__ CUDART_DEVICE CuMatrix<T> operator*(T o, const CuMatrix<T> m) { return m * o; } inline friend ostream& operator<<(ostream& os, const CuMatrix<T>& m) { return os << m.toString(); } __host__ CUDART_DEVICE CuMatrix<T> operator/(T o) const; // elemwise inv scale friend CuMatrix<T> operator/(T o, const CuMatrix<T> m) { return m.oneOver() * o; } __host__ CUDART_DEVICE bool almostEq( const CuMatrix<T>& o, T eps = util<T>::epsilon()) const; inline __host__ __device__ bool equalDims(const CuMatrix<T>& other) const { return m == other.m && n == other.n;} // statics static void initMemMgrForType(int maxThreads, int maxBlocks); static void cleanup(); static __host__ void cleanupHost(); static __device__ void cleanupDev(); static string typeStr(); // serialization (deserialization is static 'fromFile') static void toFile(const char* fileName, const CuMatrix<T>& o); static void toOctaveFile(const char* fileName, const CuMatrix<T>& o); static CuMatrix<T> fromFile(const char* fileName); static vector< CuMatrix<T> > fromFileN(const char* fileName); static int releaseFromMap(std::map<std::string, CuMatrix<T>*>& map); //static cudaError_t migrate(int dev, CuMatrix<T>& m, ...); static void parseDataLine(string line, T* elementData, int currRow, int rows, int cols, bool colMajor); static void parseCsvDataLine(const CuMatrix<T>* x, int currLine, string line, const char* sepChars); static map<string,dim3> parseOctaveMatrixSizes(const char * path ); static __host__ map<string, CuMatrix<T>*> parseOctaveDataFile( const char * path, bool colMajor, bool matrixOwnsBuffer = true); static __host__ map<string, CuMatrix<T>*> parseCsvDataFile( const char * path, const char * sepChars, bool colMajor, bool matrixOwnsBuffer = true, bool hasXandY = false); static CuMatrix<T>& getMatrix(std::map<std::string, CuMatrix<T>*> map, const char* key); /* * constructs a matrix from a buffer of (potentially) different data type */ static CuMatrix<T> fromBuffer(void* buffer, int elemBytes, T (*converter)(void*), int m, int n, int p); static void bounds( T* min, T* max, DMatrix<T>& minBuff, DMatrix<T>& maxBuff, const DMatrix<T>& src, int blocks, int threads, long nP ) ; //cudaError_t set( DMatrix<T> m, int row, int col, T val); static int maxSlices(int n); static __host__ CUDART_DEVICE void transposeL(DMatrix<T>& t, const DMatrix<T>& s, cudaStream_t stream = 0); static __host__ CUDART_DEVICE void transposeKernelPtrL( DMatrix<T>& t, void (*kernel)( T*, const T*, int, int), const DMatrix<T>& s, cudaStream_t stream = 0); static __host__ CUDART_DEVICE void transposePitchKernelPtrL( DMatrix<T>& t, void (*kernel)( T*, const T*, int, int,int,int), const DMatrix<T>& s, cudaStream_t stream = 0); static __host__ CUDART_DEVICE void rightConcatenateL(DMatrix<T>& trg, const DMatrix<T>& src1, const DMatrix<T>& src2, cudaStream_t stream = 0); static __host__ CUDART_DEVICE void bottomConcatenateL(DMatrix<T>& trg, const DMatrix<T>& src1, const DMatrix<T>& src2, cudaStream_t stream = 0); static dim3 DefaultMatProdBlock; /* static cudaError_t matrixProductL(DMatrix<T>& d_res, const DMatrix<T>& d_A, const DMatrix<T>& d_B, dim3* block); */ static cudaError_t matrixProductL2(DMatrix<T>& d_res, const DMatrix<T>& d_A, const DMatrix<T>& d_B, dim3* block); static cudaError_t matrixProductL3(DMatrix<T>& d_res, const DMatrix<T>& d_A, const DMatrix<T>& d_B, dim3* block); /* static cudaError_t matrixProductKPtrL(DMatrix<T>& d_res, void (*matProdKptr) (DMatrix<T>,const DMatrix<T>,const DMatrix<T>,int), const DMatrix<T>& d_A, const DMatrix<T>& d_B, dim3* block); */ static cudaError_t matrixProductTxdbL(DMatrix<T>& d_res, const DMatrix<T>& d_A, const DMatrix<T>& d_B, dim3* block); static cudaError_t matrixProductReduxL(DMatrix<T>& d_res, const DMatrix<T>& d_A, const DMatrix<T>& d_B, dim3* block); static void toMaxColumnIndexVectorL(DMatrix<T>& trg, const DMatrix<T>& src); static __host__ CUDART_DEVICE void columnMatrixL(DMatrix<T>& d_column, const DMatrix<T>& d_x, int col); static void rowMatrixCmL(DMatrix<T>& d_row, const DMatrix<T>& d_x, int row); static void varianceL(DMatrix<T>& d_sqrdSigmas, const DMatrix<T>& d_X, const DMatrix<T>& d_Mus); static void varianceAndMeanL(DMatrix<T>& d_sqrdSigmas, DMatrix<T>& d_Mus, const DMatrix<T>& d_X); static __host__ CUDART_DEVICE void featureAvgKernelL(DMatrix<T>& d_means, const DMatrix<T>& d_x, bool localVar, cudaStream_t stream = 0); static __host__ CUDART_DEVICE void featureAvgMultiStreamL(DMatrix<T>& d_means, const DMatrix<T>& d_x, bool localVar, int nstreams); static __host__ CUDART_DEVICE void featureAvgTxdKernelL(DMatrix<T>& d_means, const DMatrix<T>& d_x); static void multivariateGaussianFeatures( DMatrix<T>& d_pden, const DMatrix<T>& d_x, const DMatrix<T>& d_sqrdSigmas, const DMatrix<T>& d_mu); static void mvGaussianVectorFromFeatures( DMatrix<T>& d_pvec, const DMatrix<T>& d_pdens); static void multivariateGaussianVector( DMatrix<T>& d_pvec, const DMatrix<T>& d_x, const DMatrix<T>& d_sqrdSigmas, const DMatrix<T>& d_mu); static __host__ CUDART_DEVICE void meanSubL(DMatrix<T>& d_res, const DMatrix<T>& d_x, const DMatrix<T>& d_means, cudaStream_t stream = 0); static void meanSubSqrL(DMatrix<T>& d_res, const DMatrix<T>& d_x, const DMatrix<T>& d_means); static void columnProduct(DMatrix<T>& d_prod, const DMatrix<T>& d_x); static __host__ CUDART_DEVICE void rowSum(DMatrix<T>& d_prod, const DMatrix<T>& d_x, cudaStream_t stream = 0); /* * 'index...' reduction is of values generated from the block/thread index alone * 'indexed...' reduction is of global values selected from block/thread index */ #ifdef CuMatrix_Enable_KTS template<template <typename> class IndexUnaryOp,template <typename> class BinaryOp> static __host__ CUDART_DEVICE T indexReduceLauncher( T* d_odata, long n, IndexUnaryOp<T> idxOp, BinaryOp<T> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #else template<int IopDim, int BopDim> static __host__ CUDART_DEVICE T indexReduceLauncher( T* d_odata, long n, UnaryOpIndexF<T,IopDim> idxOp, MonoidF<T,BopDim> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #endif #ifdef CuMatrix_Enable_KTS template<typename IndexBoolUnaryOp,template <typename> class BinaryOp> static __host__ CUDART_DEVICE T indexedReduceLauncher( DMatrix<T> res, const T* d_idata, long n, IndexBoolUnaryOp idxOp, BinaryOp<T> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #else template<int IopDim, int BopDim> static __host__ CUDART_DEVICE T indexedReduceLauncher( DMatrix<T> res, const T* d_idata, long n, UnaryOpIndexF<T,IopDim> idxOp, MonoidF<T,BopDim> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #endif #ifdef CuMatrix_Enable_KTS template<template <typename> class IndexUnaryOp,template <typename> class BinaryOp> static __host__ CUDART_DEVICE T indexReduceLauncherPitch( T* d_odata, size_t pitch, size_t cols, size_t rows, IndexUnaryOp<T> idxOp, BinaryOp<T> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #else template<int IopDim, int BopDim> static __host__ CUDART_DEVICE T indexReduceLauncherPitch( T* d_odata, size_t pitch, size_t cols, size_t rows, UnaryOpIndexF<T,IopDim> idxOp, MonoidF<T,BopDim> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #endif #ifdef CuMatrix_Enable_KTS template<typename IndexBoolUnaryOp,template <typename> class BinaryOp> static __host__ CUDART_DEVICE T indexedReduceLauncherPitch( DMatrix<T> res, const T* d_idata, size_t pitch, size_t cols, size_t rows, IndexBoolUnaryOp idxOp, BinaryOp<T> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #else template<int IopDim, int BopDim> static __host__ CUDART_DEVICE T indexedReduceLauncherPitch( DMatrix<T> res, const T* d_idata, size_t pitch, size_t cols, size_t rows, UnaryOpIndexF<T,IopDim> idxOp, MonoidF<T,BopDim> op, T start, ulong idxStart =0, cudaStream_t stream = 0); #endif static __host__ CUDART_DEVICE T factorial(int val); // initial reduction is of values predicated by block/thread index static void binaryCategoryKernelL(DMatrix<T>& t, const DMatrix<T>& s, bool oneBased); static bool colocatedQ(vector<CuMatrix<T>> ms) { int currDev = -1; for( auto& m : ms) { if(currDev == -1) { currDev = m.tiler.deviceOfResidence(); } else { if(currDev != m.tiler.deviceOfResidence()){ outln("not on " << currDev << ": " << m.tiler); return false; } } } return true; } static int devByOccupancy(vector<CuMatrix<T>> ms) { map<int,long> devOx; for( int i = 0; i < ExecCaps::countGpus();i++) { devOx[i] = 0; } for( auto& m : ms) devOx[m.tiler.deviceOfResidence()] += m.size; int maxGpu; long maxOx = 0; for( const auto &p : devOx) { //printf("CUmat devByOccupancy: dev %d has ox %ld\n",p.first, p.second); if(p.second > maxOx) { maxOx = p.second; maxGpu = p.first; } } //outln("maxOx " << maxOx << " on g'piux " << maxGpu); return maxGpu; } template<template <typename> class CostFunction> static void gradientApprox( CostFunction<T> costFn, DMatrix<T> theta, DMatrix<T> perturb, DMatrix<T> grad, T epsilon); static void copy1D(T* trg, const T* src, int amountInTs, int offsetInTs, int lengthInTs, cudaStream_t stream = 0); static void copyK(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static __host__ CUDART_DEVICE void copy(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static void copyAsync(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static void copyUlong(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static void copyUint(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static void copyUlongDvrg(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static __host__ CUDART_DEVICE void copyUintDvrg(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static void copyIntDvrg(DMatrix<T>& trg, const DMatrix<T>& src, int troff, int tcoff); static void shuffleCopyRows(DMatrix<T>& trg, const DMatrix<T>& src, int* rowIndices); // indices must be dev mem static void initRand(int height, int width, int pitch); static void freeRand(); // les methodes du fillois static CuMatrix<T> freeform(int cols, const T* vals, ulong count ); static inline __host__ __device__ void defaultBlock(dim3& dim) { dim.x = TX_BLOCK_SIZE; dim.y = TX_BLOCK_SIZE/4; } static __host__ CUDART_DEVICE CuMatrix<T> fromScalar(T t, bool colMajor = false); #ifdef CuMatrix_Enable_KTS template <template <typename> class FillOp> static __host__ CUDART_DEVICE void fillFn(FillOp<T> op, CuMatrix<T>& res, cudaStream_t stream = 0); template <template <typename> class FillOp> static __host__ CUDART_DEVICE void fillFnNsb(FillOp<T> op, CuMatrix<T>& res, int w2h = 8, cudaStream_t stream = 0); #else template<int StateDim> static __host__ CUDART_DEVICE void fillFn(const UnaryOpIndexF<T,StateDim>& op, CuMatrix<T>& res, cudaStream_t stream = 0); template<int StateDim> static __host__ CUDART_DEVICE void fillFnNsb(UnaryOpIndexF<T,StateDim> op, CuMatrix<T>& res, int w2h = 8, cudaStream_t stream = 0); #endif static __host__ CUDART_DEVICE CuMatrix<T> increasingColumns(int rows, int cols, T start, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> increasingRows(int rows, int cols, T start, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> fill(int nRows, int nCols, T t, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false, cudaStream_t stream = 0); static __host__ CuMatrix<T> sfill(int nRows, int nCols, T t, bool colMajor = false, cudaStream_t stream = 0); static __host__ CUDART_DEVICE CuMatrix<T> fill(intPair dims, T t, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdCols, bool colMajor = false, cudaStream_t stream = 0); static __host__ CUDART_DEVICE CuMatrix<T> zeros(int nRows, int nCols, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> zeros(intPair dims, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> ones(int nRows, int nCols, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> ones(intPair dims, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> evens(int nRows, int nCols, T phase=0, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> odds(int nRows, int nCols, T phase=0, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> sin(int m, int n, T amplitude = 1./10, T period = 2*Pi,T phase =1, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> sin(intPair dims, T amplitude = 1, T period = 2*Pi, T phase =1, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> cos(int m, int n, T amplitude = 1, T period = 2*Pi, T phase=0, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> cos(intPair dims, T amplitude = 1, T period = 2*Pi, T phase=0, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> diagonal(int dim, T val, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> diagonal(int dim, const T* val, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> identity(int dim, bool colMajor = false); // should cache static cudaError_t randn(DMatrix<T>& d_ret, T epsilon = 1); static cudaError_t randmod(DMatrix<T>& d_ret, int mod, T epsilon = 1); static CuMatrix<T> randn(int rows, int cols, T epsilon = static_cast<T>( 1), bool colMajor = false); static CuMatrix<T> randmod(int rows, int cols, int mod, T epsilon = static_cast<T>( 1), bool colMajor = false); static CuMatrix<T> randn( const intPair& dims, float epsilon, bool colMajor = false); static CuMatrix<T> randn( const intPair& dims, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> span( int m, int n, T start, T end, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false, cudaStream_t stream = 0); static __host__ CUDART_DEVICE CuMatrix<T> spanMod( int m, int n, T start, T end, int steps, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false, cudaStream_t stream = 0); static __host__ CUDART_DEVICE CuMatrix<T> sequence(int m, int n, T start, T step = 1, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false, cudaStream_t stream = 0); //static __host__ CUDART_DEVICE CuMatrix<T> sequenceScale(T start, T scale, int m, int n, bool colMajor = false); static __host__ CUDART_DEVICE CuMatrix<T> seqMod(int m, int n, T start, T mod, int gpuMask = Tiler<T>::gpuMaskFromCurrGpu(), TileDirection tileD = tdRows, bool colMajor = false, cudaStream_t stream = 0); static __host__ CUDART_DEVICE CuMatrix<T> mapFeature(CuMatrix<T> m1, CuMatrix<T> m2, int degree = 6); static inline __host__ CUDART_DEVICE CuMatrix<T> reductionBuffer(int rows) { return zeros(rows,1); } static typename MatProd<T>::MatProdKptr g_matrix_product_kernel; private: static int MaxRowsDisplayed; // to force accessor calls which also sets device copy static int MaxColsDisplayed; public: //static string theTypeStr; static long Constructed; static long Destructed; static long HDCopied; static long DDCopied; static long DHCopied; //static CMap<string, int> methodDhCopies; //static CMap<string, long> methodDhVolumes; //static CMap<string, double> methodDhTimes; /* static int incDhCopy(string who, long bytes, double millis, int times = 1) { int dhCount = 0; auto itBytes = methodDhVolumes.find(who); auto itTimes = methodDhTimes.find(who); auto it = methodDhCopies.find(who); if (it != methodDhCopies.end()) { dhCount = ((*it).second + times) ; methodDhCopies.erase(it); } else { dhCount = times; } methodDhCopies.insert( methodDhCopies.end(), pair<string, int>(who, dhCount)); long dhVol = 0; if (itBytes != methodDhVolumes.end()) { dhVol = ((*itBytes).second + 1) + bytes; methodDhVolumes.erase(itBytes); } else { dhVol = bytes; } methodDhVolumes.insert( methodDhVolumes.end(), pair<string, long>(who, dhVol)); double dhTime = 0; if (itTimes != methodDhTimes.end()) { dhTime = ((*itTimes).second + 1) + millis; methodDhTimes.erase(itTimes); } else { dhTime = millis; } methodDhTimes.insert( methodDhTimes.end(), pair<string, double>(who, dhTime)); return dhCount; } static void dumpDhCopies() { auto it = methodDhCopies.begin(); // int proced = 0; flprintf("DhCopy Stats has %d stats\n", methodDhCopies.size()); long total=0l; int totalDh=0; double totalMillis=0; while(it != methodDhCopies.end() && proced++ < methodDhCopies.size()) { auto itl = methodDhVolumes.find((*it).first); auto itt = methodDhTimes.find((*it).first); long vol = 0l; double millis = 0; totalDh += (*it).second; if(itl != methodDhVolumes.end()) { vol = (*itl).second; millis = (*itt).second; total += vol; totalMillis += millis; } flprintf("caller %s dhCopies %d volume %s time %s\n", (*it).first.c_str(), (*it).second, b_util::expNotationMemStr(vol).c_str(), fromMillis( millis).c_str()); it++; } flprintf("Total DH copies %d, total bytes copied DH: %s time %s\n", totalDh, b_util::expNotationMemStr(total).c_str() , fromMillis(totalMillis).c_str()); } */ static long HHCopied; static long MemHdCopied; static long MemDdCopied; static long MemDhCopied; static long MemHhCopied; static const T MaxValue; static const T MinValue; static curandState * devStates; // fryeends template <typename U> friend class Migrator; template <typename U> friend class Locator; static CuMatrix<T>* Identities[1024]; // applies srcPix + factor(destPix - srcPix) static void linterp(CuMatrix<T>& result, const CuMatrix<T>& src, const CuMatrix<T>& dest, T factor); static __host__ void setMaxRowsDisplayed(int rows); static __host__ void setMaxColsDisplayed(int cols); static inline __host__ __device__ int getMaxRowsDisplayed() { #ifndef __CUDA_ARCH__ return MaxRowsDisplayed; #else //return D_MaxRowsDisplayed; return 5; #endif } static inline __host__ __device__ int getMaxColsDisplayed() { #ifndef __CUDA_ARCH__ return MaxColsDisplayed; #else //return D_MaxColsDisplayed; return 5; #endif } }; template<typename T> string pdm(const DMatrix<T>& md); template<typename T> inline __device__ void SetElement(DMatrix<T>& A, int row, int col, float value) { A.elements[row * A.p + col] = value; } template<typename T> inline __device__ DMatrix<T> GetSubMatrix( const DMatrix<T>& A, int row, int col, const dim3& dimBlock) { DMatrix<T> Asub; Asub.n = MIN(dimBlock.x, A.n - col * dimBlock.x); Asub.m = MIN(dimBlock.y, A.m - row * dimBlock.y); Asub.p = A.p; Asub.elements = &A.elements[A.p * dimBlock.y * row + dimBlock.x * col]; return Asub; } template <typename T> int numel(const CuMatrix<T>& x) { return x.m * x.n; } template <typename T> struct PackedMat { CuMatrix<T>* nn_params; bool owner; int layers; const uint2* dims; PackedMat( CuMatrix<T>* nn_params,const int layers, const uint2* dims) : nn_params{nn_params}, owner{false}, layers{layers}, dims(dims) { outln("PackedMat created " << this); } PackedMat( CuMatrix<T>* nn_params,bool ownier, const int layers, const uint2* dims) : nn_params{nn_params}, owner{ownier}, layers{layers}, dims(dims) { outln("PackedMat created " << this); } PackedMat(const PackedMat<T>& o); ~PackedMat() { outln("PackedMat destroying this " << this ); delete[] dims; if(owner) { outln("PackedMat freeing nn_params " << nn_params->toShortString()); delete nn_params; }else { outln("PackedMat sparing nn_params " << nn_params->toShortString()); } } string dumpDims() { stringstream ss; for(int i =0; i < layers; i++) { ss << "i " << i << " x: " << dims[i].x << ", y: " << dims[i].y << "\n"; } return ss.str(); } static PackedMat<T> pack( const vector<CuMatrix<T> >& v); static void pack( CuMatrix<T>& nn_params, uint2*& dims, int& layers, const vector<CuMatrix<T> >& v); }; extern template class PackedMat<float>; extern template class PackedMat<double>; extern template class PackedMat<long>; extern template class PackedMat<ulong>; extern template class PackedMat<int>; extern template class PackedMat<uint>;
49.966085
244
0.742131
[ "vector" ]
933549cb951716e222606f439f3900910ed2477d
1,803
h
C
yave/ecs/EntityScene.h
gan74/yave
c71b5dd7c05b1aa39c59a8071fc243c1472e71d1
[ "MIT" ]
null
null
null
yave/ecs/EntityScene.h
gan74/yave
c71b5dd7c05b1aa39c59a8071fc243c1472e71d1
[ "MIT" ]
null
null
null
yave/ecs/EntityScene.h
gan74/yave
c71b5dd7c05b1aa39c59a8071fc243c1472e71d1
[ "MIT" ]
null
null
null
/******************************* Copyright (c) 2016-2022 Gr�goire Angerand 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 YAVE_ECS_ENTITYSCENE_H #define YAVE_ECS_ENTITYSCENE_H #include "EntityPrefab.h" #include <yave/assets/AssetPtr.h> namespace yave { namespace ecs { class EntityScene { public: EntityScene() = default; EntityScene(core::Vector<EntityPrefab> prefabs) : _prefabs(std::move(prefabs)) { } core::Span<EntityPrefab> prefabs() const { return _prefabs; } y_reflect(_prefabs); private: core::Vector<EntityPrefab> _prefabs; }; } YAVE_DECLARE_GENERIC_ASSET_TRAITS(ecs::EntityScene, AssetType::Scene); } #endif // YAVE_ECS_SCENE_H
32.196429
89
0.704382
[ "vector" ]
933c271ec7058d0725ef4a32b14877ebfbb2e254
1,332
h
C
cppsrc/basic_simulator/include/utilities/simple_json.h
SpinQTech/SpinQKit
2e24826688b2b26cf7efa66fd47f0e7ef883a96c
[ "Apache-2.0" ]
2
2021-12-20T05:19:44.000Z
2021-12-20T05:21:48.000Z
cppsrc/basic_simulator/include/utilities/simple_json.h
SpinQTech/SpinQKit
2e24826688b2b26cf7efa66fd47f0e7ef883a96c
[ "Apache-2.0" ]
null
null
null
cppsrc/basic_simulator/include/utilities/simple_json.h
SpinQTech/SpinQKit
2e24826688b2b26cf7efa66fd47f0e7ef883a96c
[ "Apache-2.0" ]
1
2021-12-20T05:20:35.000Z
2021-12-20T05:20:35.000Z
/** * Copyright 2021 SpinQ Technology Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _SIMPLE_JSON_H_ #define _SIMPLE_JSON_H_ #include <vector> #include <string> #define INVALID_INT 0xFFFFFFFF #define INVALID_DOUBLE 0xFFFFFFFF class simple_json { private: std::string m_json; private: std::vector<size_t> getPairPosition( const std::string & json , char c1, char c2, size_t pos); public: simple_json(const std::string & str_json); std::string getSubJSON(char c1, char c2, uint8_t start_pos); std::string getString(const std::string & key); int getInteger(const std::string & key); double getDouble(const std::string & key); std::vector<std::string> getJSONArray(const std::string & key); }; #endif // _SIMPLE_JSON_H_
29.6
75
0.704204
[ "vector" ]
9357581d5af71f5eb72fa35e4e0b71c5c5456226
14,484
h
C
lib/SimpleHttpClient/SimpleHttpClient.h
morsdatum/ArangoDB
9cfc6d5cd50b8f451ebdedd77e2c5257fa72a573
[ "Apache-2.0" ]
null
null
null
lib/SimpleHttpClient/SimpleHttpClient.h
morsdatum/ArangoDB
9cfc6d5cd50b8f451ebdedd77e2c5257fa72a573
[ "Apache-2.0" ]
null
null
null
lib/SimpleHttpClient/SimpleHttpClient.h
morsdatum/ArangoDB
9cfc6d5cd50b8f451ebdedd77e2c5257fa72a573
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// /// @brief simple http client /// /// @file /// /// DISCLAIMER /// /// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Dr. Frank Celler /// @author Achim Brandt /// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2009-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// #ifndef ARANGODB_SIMPLE_HTTP_CLIENT_SIMPLE_HTTP_CLIENT_H #define ARANGODB_SIMPLE_HTTP_CLIENT_SIMPLE_HTTP_CLIENT_H 1 #include "Basics/Common.h" #include "Basics/StringBuffer.h" #include "Basics/logging.h" #include "Rest/HttpRequest.h" namespace triagens { namespace httpclient { class SimpleHttpResult; class GeneralClientConnection; //////////////////////////////////////////////////////////////////////////////// /// @brief simple http client //////////////////////////////////////////////////////////////////////////////// class SimpleHttpClient { private: SimpleHttpClient (SimpleHttpClient const&); SimpleHttpClient& operator= (SimpleHttpClient const&); public: //////////////////////////////////////////////////////////////////////////////// /// @brief state of the connection //////////////////////////////////////////////////////////////////////////////// enum request_state { IN_CONNECT, IN_WRITE, IN_READ_HEADER, IN_READ_BODY, IN_READ_CHUNKED_HEADER, IN_READ_CHUNKED_BODY, FINISHED, DEAD }; //////////////////////////////////////////////////////////////////////////////// /// @brief constructs a new http client //////////////////////////////////////////////////////////////////////////////// SimpleHttpClient (GeneralClientConnection*, double, bool); //////////////////////////////////////////////////////////////////////////////// /// @brief destructs a http client //////////////////////////////////////////////////////////////////////////////// ~SimpleHttpClient (); //////////////////////////////////////////////////////////////////////////////// /// @brief invalidates the connection used by the client /// this may be called from other objects that are responsible for managing /// connections. after this method has been called, the client must not be /// used for any further HTTP operations, but should be destroyed instantly. //////////////////////////////////////////////////////////////////////////////// void invalidateConnection () { _connection = nullptr; } //////////////////////////////////////////////////////////////////////////////// /// @brief close connection, go to state IN_CONNECT and clear the input /// buffer. This is used to organise a retry of the connection. //////////////////////////////////////////////////////////////////////////////// void close (); //////////////////////////////////////////////////////////////////////////////// /// @brief leave connection open on destruction //////////////////////////////////////////////////////////////////////////////// void keepConnectionOnDestruction (bool b) { _keepConnectionOnDestruction = b; } //////////////////////////////////////////////////////////////////////////////// /// @brief make a http request, creating a new HttpResult object /// the caller has to delete the result object //////////////////////////////////////////////////////////////////////////////// SimpleHttpResult* request (rest::HttpRequest::HttpRequestType, std::string const&, char const*, size_t, std::map<std::string, std::string> const&); //////////////////////////////////////////////////////////////////////////////// /// @brief sets username and password /// /// @param prefix prefix for sending username and password /// @param username username /// @param password password //////////////////////////////////////////////////////////////////////////////// void setUserNamePassword (const std::string& prefix, const std::string& username, const std::string& password); //////////////////////////////////////////////////////////////////////////////// /// @brief allows rewriting locations //////////////////////////////////////////////////////////////////////////////// void setLocationRewriter (void* data, std::string (*func)(void*, const std::string&)) { _locationRewriter.data = data; _locationRewriter.func = func; } //////////////////////////////////////////////////////////////////////////////// /// @brief enable or disable keep-alive //////////////////////////////////////////////////////////////////////////////// void setKeepAlive (bool value) { _keepAlive = value; } //////////////////////////////////////////////////////////////////////////////// /// @brief returns the current error message //////////////////////////////////////////////////////////////////////////////// const std::string& getErrorMessage () const { return _errorMessage; } //////////////////////////////////////////////////////////////////////////////// /// @brief register and dump an error message //////////////////////////////////////////////////////////////////////////////// void setErrorMessage (const std::string& message, bool forceWarn = false) { _errorMessage = message; if (_warn || forceWarn) { LOG_WARNING("%s", _errorMessage.c_str()); } } //////////////////////////////////////////////////////////////////////////////// /// @brief register an error message //////////////////////////////////////////////////////////////////////////////// void setErrorMessage (const std::string& message, int error) { if (error != TRI_ERROR_NO_ERROR) { _errorMessage = message + ": " + strerror(error); } else { setErrorMessage(message); } } private: //////////////////////////////////////////////////////////////////////////////// /// @brief initialise the connection //////////////////////////////////////////////////////////////////////////////// void handleConnect (); //////////////////////////////////////////////////////////////////////////////// /// @brief get timestamp //////////////////////////////////////////////////////////////////////////////// static double now () { struct timeval tv; gettimeofday(&tv, 0); double sec = (double) tv.tv_sec; // seconds double usc = (double) tv.tv_usec; // microseconds return sec + usc / 1000000.0; } //////////////////////////////////////////////////////////////////////////////// /// @brief clearReadBuffer, clears the read buffer as well as the result //////////////////////////////////////////////////////////////////////////////// void clearReadBuffer (); //////////////////////////////////////////////////////////////////////////////// /// @brief rewrite a location URL //////////////////////////////////////////////////////////////////////////////// std::string rewriteLocation (std::string const& location) { if (_locationRewriter.func != nullptr) { return _locationRewriter.func(_locationRewriter.data, location); } return location; } //////////////////////////////////////////////////////////////////////////////// /// @brief get the result /// the caller has to delete the result object //////////////////////////////////////////////////////////////////////////////// SimpleHttpResult* getResult (); //////////////////////////////////////////////////////////////////////////////// /// @brief set the request /// /// @param method request method /// @param location request uri /// @param body request body /// @param bodyLength size of body /// @param headerFields list of header fields //////////////////////////////////////////////////////////////////////////////// void setRequest (rest::HttpRequest::HttpRequestType method, std::string const& location, char const* body, size_t bodyLength, std::map<std::string, std::string> const& headerFields); //////////////////////////////////////////////////////////////////////////////// /// @brief process (a part of) the http header, the data is /// found in _readBuffer starting at _readBufferOffset until /// _readBuffer.length(). //////////////////////////////////////////////////////////////////////////////// void processHeader (); //////////////////////////////////////////////////////////////////////////////// /// @brief process (a part of) the body, read the http body by content length /// Note that when this is called, the content length of the body has always /// been set, either by finding a value in the HTTP header or by reading /// from the network until nothing more is found. The data is found in /// _readBuffer starting at _readBufferOffset until _readBuffer.length(). //////////////////////////////////////////////////////////////////////////////// void processBody (); //////////////////////////////////////////////////////////////////////////////// /// @brief process the chunk size of the next chunk (i.e. the chunk header), /// this is called when processing the body of a chunked transfer. The /// data is found in _readBuffer at position _readBufferOffset until /// _readBuffer.length(). /// Note that this method and processChunkedBody() call each other when /// they complete, counting on the fact that in a single transfer the /// number of chunks found is not so large to run into deep recursion /// problems. //////////////////////////////////////////////////////////////////////////////// void processChunkedHeader (); //////////////////////////////////////////////////////////////////////////////// /// @brief process the next chunk (i.e. the chunk body), this is called when /// processing the body of a chunked transfer. The data is found in /// _readBuffer at position _readBufferOffset until _readBuffer.length(). /// Note that this method and processChunkedHeader() call each other when /// they complete, counting on the fact that in a single transfer the /// number of chunks found is not so large to run into deep recursion /// problems. //////////////////////////////////////////////////////////////////////////////// void processChunkedBody (); private: //////////////////////////////////////////////////////////////////////////////// /// @brief connection used (TCP or SSL connection) //////////////////////////////////////////////////////////////////////////////// GeneralClientConnection* _connection; //////////////////////////////////////////////////////////////////////////////// /// @brief flag whether or not we keep the connection on destruction //////////////////////////////////////////////////////////////////////////////// bool _keepConnectionOnDestruction; //////////////////////////////////////////////////////////////////////////////// /// @brief write buffer //////////////////////////////////////////////////////////////////////////////// triagens::basics::StringBuffer _writeBuffer; //////////////////////////////////////////////////////////////////////////////// /// @brief read buffer //////////////////////////////////////////////////////////////////////////////// triagens::basics::StringBuffer _readBuffer; //////////////////////////////////////////////////////////////////////////////// /// @brief read buffer offset /// /// _state == IN_READ_BODY: /// points to the beginning of the body /// /// _state == IN_READ_HEADER: /// points to the beginning of the next header line /// /// _state == FINISHED: /// points to the beginning of the next request /// /// _state == IN_READ_CHUNKED_HEADER: /// points to the beginning of the next size line /// /// _state == IN_READ_CHUNKED_BODY: /// points to the beginning of the next body //////////////////////////////////////////////////////////////////////////////// size_t _readBufferOffset; double _requestTimeout; bool _warn; request_state _state; size_t _written; std::string _errorMessage; //////////////////////////////////////////////////////////////////////////////// /// @brief struct for rewriting location URLs //////////////////////////////////////////////////////////////////////////////// struct { void* data; std::string (*func)(void*, const std::string&); } _locationRewriter; uint32_t _nextChunkedSize; SimpleHttpResult* _result; std::vector<std::pair<std::string, std::string> >_pathToBasicAuth; const size_t _maxPacketSize; bool _keepAlive; rest::HttpRequest::HttpRequestType _method; }; } } #endif // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- // Local Variables: // mode: outline-minor // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}" // End:
37.426357
91
0.405896
[ "object", "vector" ]
935f8a6a8bf50835a21895e8724c8c8f02077124
4,047
h
C
examples/analytical_apps/smetric/smetric.h
rox906/libgrape-lite-brli
2772f641736d55d436840f477439dffa2a1fe14a
[ "Apache-2.0" ]
null
null
null
examples/analytical_apps/smetric/smetric.h
rox906/libgrape-lite-brli
2772f641736d55d436840f477439dffa2a1fe14a
[ "Apache-2.0" ]
null
null
null
examples/analytical_apps/smetric/smetric.h
rox906/libgrape-lite-brli
2772f641736d55d436840f477439dffa2a1fe14a
[ "Apache-2.0" ]
null
null
null
/** Copyright 2020 Alibaba Group Holding Limited. 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. */ #ifndef EXAMPLES_ANALYTICAL_APPS_SMETRIC_SMETRIC_H_ #define EXAMPLES_ANALYTICAL_APPS_SMETRIC_SMETRIC_H_ #include <grape/grape.h> #include "smetric/smetric_context.h" namespace grape { /** * @brief An implementation of SMetric, working on undirected graph. * * This version of SMetric inherits ParallelAppBase. Messages can be sent in * parallel to the evaluation. This strategy improve performance by overlapping * the communication time and the evaluation time. * * @tparam FRAG_T */ template <typename FRAG_T> class SMetric : public ParallelAppBase<FRAG_T, SMetricContext<FRAG_T>>, public ParallelEngine { public: INSTALL_PARALLEL_WORKER(SMetric<FRAG_T>, SMetricContext<FRAG_T>, FRAG_T) using vertex_t = typename fragment_t::vertex_t; // static constexpr bool need_split_edges = true; void PEval(const fragment_t& frag, context_t& ctx, message_manager_t& messages) { messages.InitChannels(thread_num()); auto inner_vertices = frag.InnerVertices(); auto outer_vertices = frag.OuterVertices(); auto vertices = frag.Vertices(); #ifdef PROFILING ctx.exec_time -= GetCurrentTime(); #endif auto& channel = messages.Channels(); ForEach(inner_vertices, [&ctx, &frag](int tid, vertex_t v) { ctx.deg[v] = frag.GetLocalOutDegree(v); }); ForEach(vertices, [&ctx, &frag](int tid, vertex_t v) { size_t t = 0; if (frag.IsInnerVertex(v)) { auto es = frag.GetOutgoingAdjList(v); for (auto& e : es) { auto u = e.get_neighbor(); if (frag.IsInnerVertex(u)) t += ctx.deg[u]; } } else { auto es = frag.GetIncomingAdjList(v); for (auto& e : es) { auto u = e.get_neighbor(); t += ctx.deg[u]; if (!frag.IsInnerVertex(u)) VLOG(1) << "read local degree of an outer vertex."; } } ctx.adjDegSum[v] = t; }); ForEach(outer_vertices, [&ctx, &frag, &channel](int tid, vertex_t v) { channel[tid].SyncStateOnOuterVertex<fragment_t, size_t>(frag, v, ctx.adjDegSum[v]); }); #ifdef PROFILING ctx.exec_time += GetCurrentTime(); ctx.postprocess_time -= GetCurrentTime(); #endif messages.ForceContinue(); #ifdef PROFILING ctx.postprocess_time += GetCurrentTime(); #endif } void IncEval(const fragment_t& frag, context_t& ctx, message_manager_t& messages) { int thrd_num = thread_num(); #ifdef PROFILING ctx.preprocess_time -= GetCurrentTime(); #endif messages.ParallelProcess<fragment_t, size_t>( thrd_num, frag, [&ctx](int tid, vertex_t v, size_t deg) { atomic_add(ctx.adjDegSum[v], deg); }); std::vector<size_t> thrd_smetric(thrd_num, 0); auto inner_vertices = frag.InnerVertices(); ForEach(inner_vertices, [&thrd_smetric, &ctx](int tid, vertex_t v) { thrd_smetric[tid] += ctx.adjDegSum[v] * ctx.deg[v]; }); for (int i = 0; i < thrd_num; ++i) { ctx.s_metric += thrd_smetric[i]; } #ifdef PROFILING ctx.preprocess_time += GetCurrentTime(); ctx.exec_time -= GetCurrentTime(); #endif #ifdef PROFILING ctx.exec_time += GetCurrentTime(); ctx.postprocess_time -= GetCurrentTime(); #endif #ifdef PROFILING ctx.postprocess_time += GetCurrentTime(); #endif } }; } // namespace grape #endif // EXAMPLES_ANALYTICAL_APPS_SMETRIC_SMETRIC_H_
28.702128
80
0.665925
[ "vector" ]
93601ed9c1157a3ae92afccae8dc8cbcdc3669aa
855
h
C
144. Binary Tree Postorder Traversal/solution.h
corkiwang1122/LeetCode
39b1680b58173e6ec23a475605c3450ce8f78a81
[ "MIT" ]
3,690
2015-01-03T03:40:23.000Z
2022-03-31T08:10:19.000Z
144. Binary Tree Postorder Traversal/solution.h
Windfall94/LeetCode
1756256d7e619164076bbf358c8f7ca68cd8bd79
[ "MIT" ]
21
2015-01-25T16:39:43.000Z
2021-02-26T05:28:22.000Z
144. Binary Tree Postorder Traversal/solution.h
Windfall94/LeetCode
1756256d7e619164076bbf358c8f7ca68cd8bd79
[ "MIT" ]
1,290
2015-01-09T01:28:20.000Z
2022-03-28T12:20:39.000Z
#include <vector> #include <stack> #include <cstddef> using std::vector; using std::stack; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: vector<int> postorderTraversal(TreeNode *root) { vector<int> retv; TreeNode *last = NULL; for (stack<TreeNode*> stk; root || !stk.empty(); ) { if (root) { stk.push(root); root = root->left; } else if (stk.top()->right && stk.top()->right != last) { root = stk.top()->right; } else { last = stk.top(); retv.push_back(last->val); stk.pop(); } } return retv; } };
22.5
66
0.453801
[ "vector" ]
93616eaad5bca61f651c270a9c438ca3e50eaa13
4,890
h
C
i_low_rank_solver.h
jmarecek/OnlineLowRank
903a096052080260ea819472be67164d05d313ab
[ "Apache-2.0" ]
1
2020-07-25T10:55:18.000Z
2020-07-25T10:55:18.000Z
i_low_rank_solver.h
jmarecek/OnlineLowRank
903a096052080260ea819472be67164d05d313ab
[ "Apache-2.0" ]
null
null
null
i_low_rank_solver.h
jmarecek/OnlineLowRank
903a096052080260ea819472be67164d05d313ab
[ "Apache-2.0" ]
1
2021-01-30T16:52:30.000Z
2021-01-30T16:52:30.000Z
// Copyright 2018 IBM. // This code is licensed under the Apache License, Version 2.0. You may // obtain a copy of this license in the LICENSE.txt file in the root // directory of this source tree or at // http://www.apache.org/licenses/LICENSE-2.0. // Any modifications or derivative works of this code must retain this // copyright notice, and modified files need to carry a notice // indicating that they have been altered from the originals. // If you use this code, please cite our paper: // @inproceedings{akhriev2018pursuit, // title={Pursuit of low-rank models of time-varying matrices robust to sparse and measurement noise}, // author={Akhriev, Albert and Marecek, Jakub and Simonetto, Andrea}, // note={arXiv preprint arXiv:1809.03550}, // booktitle={Proceedings of the AAAI Conference on Artificial Intelligence}, // volume={34}, // year={2020} // } // IBM-Review-Requirement: Art30.3 // Please note that the following code was developed for the project VaVeL at // IBM Research -- Ireland, funded by the European Union under the // Horizon 2020 Program. // The project started on December 1st, 2015 and was completed by December 1st, // 2018. Thus, in accordance with Article 30.3 of the Multi-Beneficiary General // Model Grant Agreement of the Program, certain limitations are in force up // to December 1st, 2022. For further details please contact Jakub Marecek // (jakub.marecek@ie.ibm.com) or Gal Weiss (wgal@ie.ibm.com). #pragma once class IContext; //============================================================================= // Interface to a solver for low-rank approximation of data matrix. //============================================================================= class ILowRankSolver { public: // Destructor. virtual ~ILowRankSolver() {} // Function updates low-rank approximation of the data matrix X, // considering the latter does not change dramatically between iterations. // Note, it might happen that this function does not finish a job within // prescribed time budget, so one should invoke it many times, with the // same "X" and "mask" arguments, until the "true" value is returned. Then // the low-rank approximation L*R and its factors L, R can be used for // further processing. Some reference data, supplied by user, can be used, // for example, for regularization of LR-solver. // @param X pointer to the beginning of data matrix. // @param X_end pointer to the end of data matrix. // @param mask pointer to the beginning of mask. // @param mask_end pointer to the end of mask. // @param ref pointer to the beginning of some reference data. // @param ref_end pointer to the end of some reference data. virtual bool Update(const ubyte * X, const ubyte * X_end, const ubyte * mask, const ubyte * mask_end, const float * ref, const float * ref_end) = 0; // Function resets the internal state, thus the updating process will // start from scratch upon calling the function Update(..). virtual void Reset() = 0; // Function returns M-x-rank row-major (!) matrix L of low-rank L*R // approximation to X. It makes sense to call this function only after // Update() returned "true". virtual const flt_arr_t & getL() const = 0; // Function returns rank-x-N column-major (!) matrix R of low-rank L*R // approximation to X. It makes sense to call this function only after // Update() returned "true". virtual const flt_arr_t & getR() const = 0; // Function returns M-x-N row-major (!) matrix of low-rank L*R // approximation to X. It makes sense to call this function only after // Update() returned "true". virtual void getApproximation(flt_arr_t & A) const = 0; // Function prints information about the solver. virtual void About() const = 0; // Function prints the left matrix of low-rank approximation L*R. virtual void PrintL() const = 0; // Function enables 100 epochs of optimization (in one go) aiming // to collect statistics for presentation, profiling or debugging. virtual void EnableOptimStatistics() = 0; }; typedef std::unique_ptr<ILowRankSolver> lr_solver_t; //// Factory function(s). //std::unique_ptr<ILowRankSolver> CreateLowRankSolver(int M, int N, int rank, // int num_bulk_iterations, // float mu); //std::unique_ptr<ILowRankSolver> CreateLowRankSolver2(const FeedList & params); //std::unique_ptr<ILowRankSolver> CreateLowRankSolver3(const IContext & ctx); //std::unique_ptr<ILowRankSolver> CreateLowRankSolver4(const IContext & ctx); //lr_solver_t CreateLowRankSolver5(const IContext & ctx); //lr_solver_t CreateLowRankSolverZeroDelta(const IContext & ctx); lr_solver_t CreateLowRankSolverTuned(const IContext & ctx);
47.019231
155
0.682822
[ "model" ]
936a69f838eb1a74a45f68950dde5120409c9ecd
1,774
h
C
SpaghettiDungeonGen/include/PlacedRoom.h
RedBreadcat/SpaghettiDungeonGenerator
1153dd8f26dfd835ca70c520e735f199f50ef858
[ "MIT" ]
39
2019-11-23T14:52:46.000Z
2022-01-04T08:57:04.000Z
SpaghettiDungeonGen/include/PlacedRoom.h
RedBreadcat/SpaghettiDungeonGenerator
1153dd8f26dfd835ca70c520e735f199f50ef858
[ "MIT" ]
null
null
null
SpaghettiDungeonGen/include/PlacedRoom.h
RedBreadcat/SpaghettiDungeonGenerator
1153dd8f26dfd835ca70c520e735f199f50ef858
[ "MIT" ]
5
2019-11-24T00:35:04.000Z
2019-12-09T11:08:16.000Z
#pragma once #include <vector> #include <variant> #include "PossibleDoor.h" #include "ConnectivityGrapher.h" #include "ConnectionNode.h" #include "TileWallData.h" #include "RoomType.h" class PlacedRoom : public ConnectionNode { public: PlacedRoom(int x, int y, const std::vector<PossibleDoor>& doors_in, TileWallData* tile_wall_data, int rotation_in, int prefab_index); PlacedRoom(int x, int y, const std::vector<PossibleDoor>& doors_in, std::unique_ptr<TileWallData> tile_wall_data); PlacedRoom(PlacedRoom&& placed_room) = delete; //Don't want to move, since I keep track of pointers. Don't want to accidentally use a pointer from before a move PlacedRoom& operator=(PlacedRoom&& placed_room) = delete; PlacedRoom& operator=(const PlacedRoom&) = delete; //Never want to copy a PlacedRoom PlacedRoom(PlacedRoom& placed_room) = delete; bool IsRoom() const override; bool IsCorridor() const override; void Unplace(); void ConnectToNearbyRoomsOrCorridors(); void TryPlaceDoor(PossibleDoor& d); //void TryConnectOpenConnections(OpenConnection& o); int UnconnectedDoors() const; bool HasConnectionAvailable() const; Coord p; int rotation; //Used by C# int prefab_index; RoomType room_type = RoomType::Normal; std::vector<PossibleDoor> possible_doors; //Only set at the end of room placement enum class RoomConnectivity { Regular = 0, DeadEnd, Isolated }; RoomConnectivity room_connectivity = RoomConnectivity::Regular; //Used to access positions of tiles and walls. //Raw: Points to data that is fixed at startup, like unmodified room prefabs //unique_ptr: Points to modified prefab data or proc gen room data. Stored in this object. std::variant<TileWallData*, std::unique_ptr<TileWallData>> tile_wall_data; private: void Place(); };
32.851852
161
0.766065
[ "object", "vector" ]
9374032eba2a36965e124b84bd1b5e7078030203
1,556
h
C
emitter/runtime_printer.h
nandor/genm-opt
b3347d508fff707837d1dc8232487ebfe157fe2a
[ "MIT" ]
13
2020-06-25T18:26:54.000Z
2021-02-16T03:14:38.000Z
emitter/runtime_printer.h
nandor/genm-opt
b3347d508fff707837d1dc8232487ebfe157fe2a
[ "MIT" ]
3
2020-07-01T01:39:47.000Z
2022-01-24T23:47:12.000Z
emitter/runtime_printer.h
nandor/genm-opt
b3347d508fff707837d1dc8232487ebfe157fe2a
[ "MIT" ]
2
2021-03-11T05:08:09.000Z
2021-07-17T23:36:17.000Z
// This file if part of the llir-opt project. // Licensing information can be found in the LICENSE file. // (C) 2018 Nandor Licker. All rights reserved. #pragma once #include <llvm/Pass.h> #include <llvm/MC/MCObjectFileInfo.h> #include <llvm/MC/MCStreamer.h> #include <llvm/Target/TargetMachine.h> class Prog; class Data; /** * Pass to print runtime methods to the output object. */ class RuntimePrinter : public llvm::ModulePass { public: /// Initialises the pass which prints data sections. RuntimePrinter( char &ID, const Prog &Prog, const llvm::TargetMachine &tm, llvm::MCContext &ctx, llvm::MCStreamer &os, const llvm::MCObjectFileInfo &objInfo, bool shared ); private: /// Creates MachineFunctions from LLIR IR. bool runOnModule(llvm::Module &M) override; /// Requires MachineModuleInfo. void getAnalysisUsage(llvm::AnalysisUsage &AU) const override; protected: /// Emits caml_call_gc virtual void EmitCamlCallGc(llvm::Function &F) = 0; /// Emits caml_c_call virtual void EmitCamlCCall(llvm::Function &F) = 0; protected: /// Program to print. const Prog &prog_; /// Reference to the target machine. const llvm::TargetMachine &tm_; /// LLVM context. llvm::MCContext &ctx_; /// Streamer to emit output to. llvm::MCStreamer &os_; /// Object-file specific information. const llvm::MCObjectFileInfo &objInfo_; /// Data layout. const llvm::DataLayout layout_; /// Flag to indicate whether a shared library or a static library is built. bool shared_; };
25.508197
77
0.703085
[ "object" ]
93766adedb13cba41f665886fc14d4f4237ce116
7,040
h
C
lib/tlrCore/AVIO.h
darbyjohnston/tlRender
0bdb8aa3795a0098811a7c3ed6add3023bcfd55a
[ "BSD-3-Clause" ]
59
2021-04-26T23:38:35.000Z
2022-03-23T15:21:44.000Z
lib/tlrCore/AVIO.h
darbyjohnston/tlRender
0bdb8aa3795a0098811a7c3ed6add3023bcfd55a
[ "BSD-3-Clause" ]
17
2021-04-30T02:03:08.000Z
2022-01-11T19:54:47.000Z
lib/tlrCore/AVIO.h
darbyjohnston/tlRender
0bdb8aa3795a0098811a7c3ed6add3023bcfd55a
[ "BSD-3-Clause" ]
5
2021-06-07T16:11:53.000Z
2021-12-10T23:29:45.000Z
// SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2021-2022 Darby Johnston // All rights reserved. #pragma once #include <tlrCore/Audio.h> #include <tlrCore/Image.h> #include <tlrCore/Path.h> #include <tlrCore/Time.h> #include <future> #include <iostream> #include <map> #include <set> namespace tlr { namespace core { class LogSystem; } //! Audio/video I/O. namespace avio { //! Video type. enum class VideoType { Movie, Sequence, Count, First = Movie }; TLR_ENUM(VideoType); TLR_ENUM_SERIALIZE(VideoType); //! File extension types. enum class FileExtensionType { VideoAndAudio = 1, VideoOnly = 2, AudioOnly = 4, Count, First = VideoAndAudio }; TLR_ENUM(FileExtensionType); TLR_ENUM_SERIALIZE(FileExtensionType); //! I/O information. struct Info { std::vector<imaging::Info> video; VideoType videoType = VideoType::Movie; otime::TimeRange videoTime = time::invalidTimeRange; audio::Info audio; otime::TimeRange audioTime = time::invalidTimeRange; std::map<std::string, std::string> tags; bool operator == (const Info&) const; bool operator != (const Info&) const; }; //! Video I/O data. struct VideoData { VideoData(); VideoData( const otime::RationalTime&, uint16_t layer, const std::shared_ptr<imaging::Image>&); otime::RationalTime time = time::invalidTime; uint16_t layer = 0; std::shared_ptr<imaging::Image> image; bool operator == (const VideoData&) const; bool operator != (const VideoData&) const; bool operator < (const VideoData&) const; }; //! Audio I/O data. struct AudioData { AudioData(); AudioData( const otime::RationalTime&, const std::shared_ptr<audio::Audio>&); otime::RationalTime time = time::invalidTime; std::shared_ptr<audio::Audio> audio; bool operator == (const AudioData&) const; bool operator != (const AudioData&) const; bool operator < (const AudioData&) const; }; //! Options. typedef std::map<std::string, std::string> Options; //! Merge options. Options merge(const Options&, const Options&); //! Base class for readers/writers. class IIO : public std::enable_shared_from_this<IIO> { TLR_NON_COPYABLE(IIO); protected: void _init( const file::Path&, const Options&, const std::shared_ptr<core::LogSystem>&); IIO(); public: virtual ~IIO() = 0; //! Get the path. const file::Path& getPath() const; protected: std::weak_ptr<core::LogSystem> _logSystem; file::Path _path; Options _options; }; //! Base class for readers. class IRead : public IIO { protected: void _init( const file::Path&, const Options&, const std::shared_ptr<core::LogSystem>&); IRead(); public: ~IRead() override; //! Get the information. virtual std::future<Info> getInfo() = 0; //! Read video data. virtual std::future<VideoData> readVideo(const otime::RationalTime&, uint16_t layer = 0); //! Read audio data. virtual std::future<AudioData> readAudio(const otime::TimeRange&); //! Are there pending requests? virtual bool hasRequests() = 0; //! Cancel pending requests. virtual void cancelRequests() = 0; //! Stop the reader. virtual void stop() = 0; //! Has the reader stopped? virtual bool hasStopped() const = 0; }; //! Base class for writers. class IWrite : public IIO { protected: void _init( const file::Path&, const Options&, const Info&, const std::shared_ptr<core::LogSystem>&); IWrite(); public: ~IWrite() override; //! Write video data. virtual void writeVideo( const otime::RationalTime&, const std::shared_ptr<imaging::Image>&) = 0; protected: Info _info; }; //! Base class for I/O plugins. class IPlugin : public std::enable_shared_from_this<IPlugin> { TLR_NON_COPYABLE(IPlugin); protected: void _init( const std::string& name, const std::map<std::string, FileExtensionType>& extensions, const std::shared_ptr<core::LogSystem>&); IPlugin(); public: virtual ~IPlugin() = 0; //! Get the plugin name. const std::string& getName() const; //! Get the supported file extensions. std::set<std::string> getExtensions(int types = static_cast<int>(FileExtensionType::VideoAndAudio) | static_cast<int>(FileExtensionType::VideoOnly) | static_cast<int>(FileExtensionType::AudioOnly)) const; //! Set the plugin options. void setOptions(const Options&); //! Create a reader for the given path. virtual std::shared_ptr<IRead> read( const file::Path&, const Options& = Options()) = 0; //! Get the list of writable image pixel types. virtual std::vector<imaging::PixelType> getWritePixelTypes() const = 0; //! Get the writable image data alignment. virtual uint8_t getWriteAlignment(imaging::PixelType) const; //! Get the writable image data endian. virtual memory::Endian getWriteEndian() const; //! Create a writer for the given path. virtual std::shared_ptr<IWrite> write( const file::Path&, const Info&, const Options& = Options()) = 0; protected: bool _isWriteCompatible(const imaging::Info&) const; std::weak_ptr<core::LogSystem> _logSystem; Options _options; private: TLR_PRIVATE(); }; } } #include <tlrCore/AVIOInline.h>
28.387097
101
0.505682
[ "vector" ]
937c9d1b3b68c81f320354342f2297f8b0ab0dde
303
h
C
DerydocaEngine/src/Rendering/Skybox.h
Derydoca/derydocaengine
a9cdb71082fbb879d9448dc0c1a95581681d61f1
[ "BSD-3-Clause" ]
37
2018-05-21T15:21:26.000Z
2020-11-16T17:50:44.000Z
DerydocaEngine/src/Rendering/Skybox.h
Derydoca/derydocaengine
a9cdb71082fbb879d9448dc0c1a95581681d61f1
[ "BSD-3-Clause" ]
38
2018-03-09T23:57:07.000Z
2020-07-10T20:52:42.000Z
DerydocaEngine/src/Rendering/Skybox.h
Derydoca/derydocaengine
a9cdb71082fbb879d9448dc0c1a95581681d61f1
[ "BSD-3-Clause" ]
5
2018-08-28T11:12:18.000Z
2019-09-05T09:30:41.000Z
#pragma once namespace DerydocaEngine::Rendering { class Mesh; } namespace DerydocaEngine::Rendering { class Skybox { public: Skybox(); Skybox(float const& size); ~Skybox(); Mesh* getMesh() const { return m_mesh; }; private: void buildMesh(float const& size); Mesh* m_mesh; }; }
12.12
43
0.673267
[ "mesh" ]
937cb1e557d3985df2707b7b7af9b16644941b3c
610
h
C
MyCustomUsage/Preprocess/ultra_transfer_data.h
phidra/ULTRA
d3de3dbbbd651ee8279dd605e6d8f73365c81735
[ "MIT" ]
null
null
null
MyCustomUsage/Preprocess/ultra_transfer_data.h
phidra/ULTRA
d3de3dbbbd651ee8279dd605e6d8f73365c81735
[ "MIT" ]
null
null
null
MyCustomUsage/Preprocess/ultra_transfer_data.h
phidra/ULTRA
d3de3dbbbd651ee8279dd605e6d8f73365c81735
[ "MIT" ]
null
null
null
#pragma once #include <vector> #include <filesystem> #include "DataStructures/Graph/Graph.h" #include "DataStructures/RAPTOR/Entities/Stop.h" #include "graph/walking_graph.h" namespace my::preprocess { struct UltraTransferData { UltraTransferData(uwpreprocess::WalkingGraph&&); static bool areApproxEqual(TransferGraph const& left, TransferGraph const& right); bool checkSerializationIdempotence() const; uwpreprocess::WalkingGraph walkingGraph; TransferGraph transferGraphUltra; // this is from ULTRA code (unfortunately, in the global namespace) }; } // namespace my::preprocess
26.521739
106
0.770492
[ "vector" ]
937eaca343a035fbe7f2ef78cf6af842647b211e
1,327
h
C
labsound/src/internal/AudioResampler.h
ngokevin/LabSound
1cd830e44befae10111675a2799dee3082e6ae1f
[ "MIT" ]
6
2018-02-24T05:55:56.000Z
2018-12-09T05:09:33.000Z
labsound/src/internal/AudioResampler.h
ngokevin/LabSound
1cd830e44befae10111675a2799dee3082e6ae1f
[ "MIT" ]
10
2018-06-05T09:45:19.000Z
2019-05-24T12:53:03.000Z
labsound/src/internal/AudioResampler.h
ngokevin/LabSound
1cd830e44befae10111675a2799dee3082e6ae1f
[ "MIT" ]
3
2018-03-29T16:16:03.000Z
2018-10-16T02:53:42.000Z
// License: BSD 2 Clause // Copyright (C) 2010, Google Inc. All rights reserved. // Copyright (C) 2015+, The LabSound Authors. All rights reserved. #ifndef AudioResampler_h #define AudioResampler_h #include "LabSound/core/AudioSourceProvider.h" #include "LabSound/core/AudioBus.h" #include "internal/AudioResamplerKernel.h" #include <vector> namespace lab { // AudioResampler resamples the audio stream from an AudioSourceProvider. // The audio stream may be single or multi-channel. // The default constructor defaults to single-channel (mono). class AudioResampler { public: AudioResampler(); AudioResampler(unsigned numberOfChannels); ~AudioResampler() { } // Given an AudioSourceProvider, process() resamples the source stream into destinationBus. void process(ContextRenderLock&, AudioSourceProvider*, AudioBus* destinationBus, size_t framesToProcess); // Resets the processing state. void reset(); void configureChannels(unsigned numberOfChannels); // 0 < rate <= MaxRate void setRate(double rate); double rate() const { return m_rate; } static const double MaxRate; private: double m_rate; std::vector<std::unique_ptr<AudioResamplerKernel> > m_kernels; std::unique_ptr<AudioBus> m_sourceBus; }; } // namespace lab #endif // AudioResampler_h
26.54
109
0.738508
[ "vector" ]
93876009e08cd88a2474298b4f2bd693d598190b
887
h
C
chapter_4/lesson_21/PlanetRenderer.h
sergey-shambir/cg_course_examples
921b6218d71731bcb79ddddcc92c9d04a72c62ab
[ "MIT" ]
5
2017-05-13T20:47:13.000Z
2020-04-18T18:18:03.000Z
chapter_4/lesson_21/PlanetRenderer.h
sergey-shambir/cg_course_examples
921b6218d71731bcb79ddddcc92c9d04a72c62ab
[ "MIT" ]
null
null
null
chapter_4/lesson_21/PlanetRenderer.h
sergey-shambir/cg_course_examples
921b6218d71731bcb79ddddcc92c9d04a72c62ab
[ "MIT" ]
8
2016-10-24T16:24:21.000Z
2021-03-15T11:23:57.000Z
#pragma once #include "libshading/IProgramAdapter.h" #include "Components.h" #include <glm/mat4x4.hpp> class CPlanetProgram; class CPlanetRenderer3D { public: CPlanetRenderer3D(const IProgramAdapter &program); ~CPlanetRenderer3D(); void SetupLight0(const glm::vec4 &position, const glm::vec4 &diffuse, const glm::vec4 &specular); void SetWorldMat4(const glm::mat4 &value); void SetViewMat4(const glm::mat4 &value); void SetProjectionMat4(const glm::mat4 &value); void Draw(const CMeshComponent &mesh); private: CProgramUniform GetUniform(UniformId id)const; void BindTextures(const CMeshComponent &mesh); void BindAttributes(const SGeometryLayout &layout)const; const IProgramAdapter &m_program; glm::mat4 m_world; glm::mat4 m_view; glm::mat4 m_projection; glm::mat4 m_normal; };
26.878788
60
0.70124
[ "mesh" ]