blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
698b1adaa4d625e9582100e9d9426c0f468efafc
ab930dc08fd3139d9e24797217b2f63b5d6a2eac
/proj.win32/speedplayer.h
61e454a0f4c743180e1e9254bf1d0da1fc1becff
[]
no_license
eoqn/cookierun
1029bb14134351117e75881495bab3ad297bb5d5
69ad1ce3af3bdc60c4b92f251e72818afd26a327
refs/heads/master
2023-03-24T08:11:50.154859
2021-03-26T04:08:27
2021-03-26T04:08:27
350,956,003
0
0
null
null
null
null
UTF-8
C++
false
false
156
h
speedplayer.h
#pragma once #include <cocos2d.h> USING_NS_CC; class speedplayer:public Node { public: CREATE_FUNC(speedplayer); bool init(); void update(float dt); };
5623379236f84834c25e627043648faf4d6772dd
ffb9f6b80c3f2ed668bcbb17b6f56ad81cc1981b
/src/DataProviders/Resource.h
2e13bf339e57d7e877462b915ee197eaea96d89c
[]
no_license
GhevondW/Game
3d526d6700a464225dfdb3a40af8a830d5928b41
96a76f763bf4beae29af3fb861e49f3969a329cf
refs/heads/main
2023-04-20T03:39:33.135101
2021-04-26T13:31:23
2021-04-26T13:31:23
358,872,388
0
0
null
null
null
null
UTF-8
C++
false
false
420
h
Resource.h
#ifndef _RESOURCE_H_ #define _RESOURCE_H_ #include <string> #include <vector> namespace game { struct ElementInfo { std::string name{}; std::string image_path{}; std::string code{}; }; struct TileInfo { std::string name{}; std::string image_path{}; std::string code{}; }; struct Resource { std::vector<ElementInfo> elements{}; std::vector<TileInfo> tiles{}; }; } #endif // !_RESOURCE_H_
52f0640d9b8cc461498c83cafe911f12b579dd84
2e83755617e502f4f0ea3dccaf62c1f951a955e4
/Visualizer/src/Config/Config.cpp
f8d57fd9929757f7e2bbdd899f6c245e9dd01a95
[]
no_license
KamilChowaniec/AudioVis
ee3d81a42dc0976f21ea38815ed2237018f150d7
76718b0225d182fe5899ab3af205c2a05850a306
refs/heads/master
2022-04-02T07:30:26.720311
2019-12-07T23:20:12
2019-12-07T23:20:12
220,535,563
0
0
null
null
null
null
UTF-8
C++
false
false
2,963
cpp
Config.cpp
#include "Config.hpp" #include "Types/Vec.hpp" #include "Viewers/ColorPicker.hpp" #include "Viewers/Slider.hpp" #include "Logger.hpp" #include "FileDialog.hpp" Config::Config() { resetToDefault(); } void Config::resetToDefault() { setEntry("lineColor", Color<float, ColorPicker4>({ 1, 1, 1, 1 })); setEntry("visibleFreq", Vec2<float, Slider2>({ 0, 1 }, {0, 1})); setEntry("count", Number<size_t, Slider1>(100L, { 3L, 500L })); setEntry("bend", Number<float, Slider1>(0, { 0, 360 })); setEntry("scale", Number<float, Slider1>(1, { 0, 2 })); setEntry("rotation", Number<float, Slider1>(0, { 0, 360 })); setEntry("centerX", Number<float, Slider1>(0, { -2, 2 })); setEntry("centerY", Number<float, Slider1>(0, { -2, 2 })); setEntry("width", Number<float, Slider1>(2, { 0, 4 })); setEntry("lineInterspace", Number<float, Slider1>(0.25, { 0, 1 })); setEntry("smoothness", Number<float, Slider1>(0.5, { 0, 1 })); setEntry("innerIntensity", Number<float, Slider1>(1, { 0, 2 })); setEntry("outerIntensity", Number<float, Slider1>(1, { 0, 2 })); } void Config::renderImGui() { if (ImGui::Button("Save")) { std::string filePath = FileDialog::saveFile("Save Config", "config.yaml", { "*.yaml" }); if(filePath.length() != 0) saveToFile(filePath); } ImGui::SameLine(); if (ImGui::Button("Load")) { std::string filePath = FileDialog::chooseFile("Choose Config", { "*.yaml" }); if (filePath.length() != 0) loadFromFile(filePath); } ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); showEntry("lineColor"); showEntry("visibleFreq"); showEntry("count"); showEntry("bend"); showEntry("scale"); showEntry("rotation"); showEntry("centerX"); showEntry("centerY"); showEntry("width"); showEntry("lineInterspace"); showEntry("smoothness"); showEntry("innerIntensity"); showEntry("outerIntensity"); } const Configurable& Config::operator[](std::string_view name) const { auto it = m_Data.find(name.data()); ASSERT(it != m_Data.end(), std::string("No entry [") + name.data() + "]!"); return *(*it).second; } void Config::loadFromFile(std::string_view filePath) { m_YamlStream.open(filePath, YAMLStream::in); if (m_YamlStream.isOpen()) for (auto& [name, con] : m_Data) { if(m_YamlStream[name]) con->decode(m_YamlStream[name]); else { LOG_WARN("Missing \"{0}\" entry in \"{1}\" config file!", name, filePath); } } m_YamlStream.close(); } void Config::saveToFile(std::string_view filePath) { m_YamlStream.open(filePath, YAMLStream::out); if (m_YamlStream.isOpen()) for (auto& entry: m_Data) m_YamlStream << entry; m_YamlStream.close(); } void Config::showEntry(std::string_view name) const { auto it = m_Data.find(name.data()); ASSERT(it != m_Data.end(), std::string("Unknown entry [") + name.data() + "]!"); (*it).second->show(name); }
ef46e6086dec1ff7c7da60a9c379e8b696e8ddbd
0a080dd71ae5a34ced094d747b017c37d8f4ad2a
/include/ClientLib/Scripting/ClientElementLibrary.hpp
f3db9960531a36dac02a9bbd479c0aa9abe72f65
[ "MIT" ]
permissive
DigitalPulseSoftware/BurgWar
f2489490ef53dc8a04b219f04d120e0bc9f7b2cb
e56d50184adc03462e8b0018f68bf357f1a9e506
refs/heads/master
2023-07-19T18:31:12.657056
2022-11-23T11:16:05
2022-11-23T11:16:05
150,015,581
56
21
MIT
2022-07-02T17:08:55
2018-09-23T18:56:44
C++
UTF-8
C++
false
false
980
hpp
ClientElementLibrary.hpp
// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Burgwar" project // For conditions of distribution and use, see copyright notice in LICENSE #pragma once #ifndef BURGWAR_CLIENTLIB_SCRIPTING_CLIENTELEMENTLIBRARY_HPP #define BURGWAR_CLIENTLIB_SCRIPTING_CLIENTELEMENTLIBRARY_HPP #include <CoreLib/Scripting/SharedElementLibrary.hpp> #include <ClientLib/Export.hpp> namespace bw { class ClientAssetStore; class BURGWAR_CLIENTLIB_API ClientElementLibrary : public SharedElementLibrary { public: inline ClientElementLibrary(const Logger& logger, ClientAssetStore& assetStore); ~ClientElementLibrary() = default; void RegisterLibrary(sol::table& elementMetatable) override; protected: virtual void RegisterClientLibrary(sol::table& elementTable); void SetScale(const Ndk::EntityHandle& entity, float newScale) override; private: ClientAssetStore& m_assetStore; }; } #include <ClientLib/Scripting/ClientElementLibrary.inl> #endif
6a4fb6d9c1c9b4da249d15aeaed415df3ffa19e6
1951d40de692fa6c4bb122c117ccbcd404bea1e2
/day20/main.cpp
aa8fbfba933d54af2e0bd83dc503a0f080de71c4
[]
no_license
pfaltynek/advent-of-code-2016-cpp
cea32e95f85e82b9f1ebdb884039fb181041da44
7ca11074b7ae79ccc2c957af0226f9feec87ab6e
refs/heads/master
2020-06-15T16:41:07.037042
2017-11-20T10:07:38
2017-11-20T10:07:38
75,279,438
0
0
null
null
null
null
UTF-8
C++
false
false
3,489
cpp
main.cpp
#include <cstring> #include <fstream> #include <iostream> #include <regex> #include <string> #include <vector> #define TEST 0 typedef struct { uint32_t first, last; } IP_RANGE; typedef std::vector<IP_RANGE>::iterator IT; void InsertRange(IP_RANGE new_range, std::vector<IP_RANGE> &ranges) { IT it1; it1 = ranges.begin(); while (it1 != ranges.end()) { if ((*it1).first >= new_range.first) { break; } it1++; } ranges.insert(it1, new_range); } void OptimizeRanges(std::vector<IP_RANGE> &ranges) { IT it1, it2; it1 = ranges.begin(); it2 = it1 + 1; //4258853578 while (it2 != ranges.end()) { if ((it1->first == 4258853578) || (it2->first == 4258853578)) { bool fnd = true; } if ((it1->last) >= (it2->first - 1)) { it1->last = (it1->last > it2->last) ? it1->last : it2->last; ranges.erase(it2); it2 = it1 + 1; } else { it1++; it2++; } } } uint32_t GetWhiteIPCount(std::vector<IP_RANGE> ranges) { IT it; uint32_t result = 0; long long next_check = 0; if (ranges.empty()) { return UINT32_MAX; } it = ranges.begin(); while ((it != ranges.end()) || (next_check > UINT32_MAX)) { if (it->first > next_check) { result += it->first - next_check; } next_check = it->last + 1; it++; } if (next_check < UINT32_MAX) { result += UINT32_MAX - next_check + 1; } return result; } bool GetFirstWhiteIP(std::vector<IP_RANGE> ranges, uint32_t &result) { IT it; uint32_t next_check = 0; it = ranges.begin(); while (it != ranges.end()) { if (it->last == UINT32_MAX) { return false; } if (it->first > next_check) { result = next_check; return true; } else { next_check = it->last + 1; it++; } } return false; } int main(void) { std::ifstream input; std::string line; uint32_t result1, result2, test, cnt, test2; std::regex data_pattern("^(\\d+)-(\\d+)$"); std::smatch sm; std::vector<IP_RANGE> data; IP_RANGE x; std::cout << "=== Advent of Code 2016 - day 20 ====" << std::endl; std::cout << "--- part 1 ---" << std::endl; input.open("input.txt", std::ifstream::in); if (input.fail()) { std::cout << "Error opening input file.\n"; return -1; } result1 = 0; result2 = 0; test = 0; test2 = 0; cnt = 0; #if TEST data.clear(); x.first = 5; x.last = 8; InsertRange(x, data); x.first = 0; x.last = 2; InsertRange(x, data); x.first = 4; x.last = 7; InsertRange(x, data); OptimizeRanges(data); if (GetFirstWhiteIP(data, test)) { std::cout << "Result is " << test << std::endl; } else { std::cout << "Result does not exist." << std::endl; } test2 = GetWhiteIPCount(data); #endif data.clear(); while (std::getline(input, line)) { cnt++; if (line.empty()) { continue; } if (regex_match(line, sm, data_pattern)) { IP_RANGE ipr; unsigned long int f, l; f = strtoul(sm.str(1).c_str(), NULL, 10); l = strtoul(sm.str(2).c_str(), NULL, 10); ipr.first = (uint32_t)f; ipr.last = (uint32_t)l; if (ipr.first > ipr.last) { int z = 11; } InsertRange(ipr, data); } else { std::cout << "Error decoding data of line " << cnt << std::endl; return -1; } } if (input.is_open()) { input.close(); } OptimizeRanges(data); if (GetFirstWhiteIP(data, result1)) { std::cout << "Result is " << result1 << std::endl; } else { std::cout << "Result does not exist." << std::endl; } std::cout << "--- part 2 ---" << std::endl; result2 = GetWhiteIPCount(data); std::cout << "Result is " << result2 << std::endl; }
43670f66b0a9d25d238edb694dc96fd7bf10be2b
d3be4f176970d2e65e540f8e195e22fe5e56835b
/tp1/exercice3.cpp
ad1124c213d7534787ad384e4f01c6452cbadc8f
[]
no_license
MartzolfTom/M3103-Algo
4c1fafe889ec3d262f837ba62f87e06fd34e2186
e053da72829388d82be98ef8d889ec046c9e890b
refs/heads/master
2020-07-28T06:20:21.656292
2019-10-21T11:56:46
2019-10-21T11:56:46
209,320,544
0
0
null
null
null
null
UTF-8
C++
false
false
1,669
cpp
exercice3.cpp
#include <iostream> using namespace std; /////////////////////////// /// fonction SaisieEntierPositif qui permet de saisir /// un entier positif et de le controler /// /// entrée : rien /// sortie : un entier positif ///////////////////////// int SaisieEntierPositif(){ int n = 0; cin>>n; while(n<0){ cout<<"erreur entier negatif re-saisir valeur de n :"; cin>>n; } return n; } ////////////////////////////////////////////////////////////////// //Description : retourne le PGCD des deux entiers pris en entrees // //Entrees : deux entiers quelconque // //Sorties : le PGCD de deux entiers // //Pre-Conditions : les entiers en entrees ne sont pas negatif // //Post-Condition : aucune ////////////////////////////////////////////////////////////////// int PGCD(int a, int b){ if (a>b) { PGCD(a-b, b); } else if (a<b){ PGCD(a, b-a); } else { return a; } } ////////////////////////////////////////////////////////////////// //Description : programme principal ou l'utilisateur rentre ses deux entiers // //Entrees : rien // //Sorties : rien // //Pre-Conditions : Aucune // //Post-Condition : aucune ////////////////////////////////////////////////////////////////// int main(){ int a, b, resultat; a = 0; b = 0; cout << "Rentrer le premier chiffre : "; a = SaisieEntierPositif(); cout << "Rentrer le second chiffre : "; b = SaisieEntierPositif(); resultat = PGCD(a,b); cout << "voici le PGCD de " << a << " et " << b << " : " << resultat; return 0; } /* condition d'arret : Si a = b on retourne a ou b Relation de récurrence : PGCD(a,b) = PGCD(a-b, b) si a>b sinon si a<b PGCD(a,b) = PGCD(a, b-a) */
7724ffbfc32d757fa8d9443a869ed0fa289b7a66
898c8528a70321dffedb8f37bbaebbae9b81fc89
/aura/user/control_event.cpp
20685dd67dffd7f209726e5da55b715f4e05b890
[]
no_license
ca2/app
b1de035566d9664aa7c5c9a94378cc352b1836ec
d916307f8b47f04fbd48068868a57b62d5bbf705
refs/heads/master
2023-08-27T07:19:45.584624
2023-01-07T02:50:50
2023-01-07T02:50:50
98,031,531
19
7
null
2017-08-14T11:13:14
2017-07-22T12:59:27
C++
UTF-8
C++
false
false
1,787
cpp
control_event.cpp
#include "framework.h" #if !BROAD_PRECOMPILED_HEADER #include "aura/user/_user.h" #endif namespace user { control_event::control_event() { set_layer(LAYERED_USER_CONTROL_EVENT, this); m_bOk = true; m_bRet = false; m_pmessage = nullptr; m_puie = nullptr; m_ptab = nullptr; } control_event::~control_event() { } ::user::interaction * control_event::get_form() { if (::is_null(m_puie)) { return nullptr; } return m_puie->get_form(); } ::user::interaction * control_event::get_parent_form() { if (::is_null(m_puie)) { return nullptr; } return m_puie->get_parent_form(); } void control_event::Nok() { m_bOk = false; m_bRet = true; } void control_event::Ret() { m_bRet = true; } void control_event::Ok() { m_bOk = true; m_bRet = true; } //impact * control_event::get_view() //{ // return dynamic_cast <::user::impact *> (m_puie); //} //document * control_event::get_document() //{ // impact * pimpact = get_view(); // if(pimpact == nullptr) // return nullptr; // return pimpact->get_document(); //} //impact_system * control_event::get_impact_system() //{ // document * pdocument = get_document(); // if(pdocument == nullptr) // return nullptr; // return pdocument->get_document_template(); //} //string control_event::get_impact_matter() //{ // impact_system * psystem = get_impact_system(); // if(psystem == nullptr) // return ""; // return psystem->m_strMatter; //} } // namespace user
9e3dc4667709c2d8981a84eaad64bdd0d6ca27c8
5376f9d9730b55b5377936b1b08d424349d88f16
/指针数值定义.cpp
7cfddebdbd6460d2bce8ba027b16a4326693764c
[]
no_license
ranrangong/CStudy
5e4c99aa0b7f130f840e485c4db6f506e1fcaf3e
d94ecb33a305ced3fa4ace88b73088c2c2833168
refs/heads/master
2021-06-16T15:16:46.258303
2017-05-06T09:54:41
2017-05-06T09:54:41
null
0
0
null
null
null
null
GB18030
C++
false
false
217
cpp
指针数值定义.cpp
//argc //任何编译习惯都有可能在这里产生 ///May/6/2017 #include<stdio.h> int main(int argc,char const *argv[] ) { int i=0; for(i;i<argc;i++){ printf("a[%d]:%s\n",i,argv[i]); } return 0; }
27176191689424d34ae1cefd8417c7cef90ec223
9ff3b530c713fd84154a5f3fc7fe32bc653ed8aa
/3rdparty/sgl/src/sgldisplay_qt_internal.h
bca46dcfc96007e8475b75fa55cb484ae9972277
[ "BSD-2-Clause" ]
permissive
HSarham/automatic-ar
f43d0f2e7ccc5b75d3d76468a9908d2ff3ac4b50
ae495352cc870464c08c263d6dd10e15cd365469
refs/heads/master
2023-01-22T13:44:33.136703
2023-01-15T14:04:12
2023-01-15T14:04:12
214,856,958
18
3
null
null
null
null
UTF-8
C++
false
false
861
h
sgldisplay_qt_internal.h
#ifndef _SglDisplay_QT_Internal_H #define _SglDisplay_QT_Internal_H #include <QWidget> #include <QLabel> #include <memory> #include "sgldisplay.h" namespace sgl{ class SglDisplay_QT_Internal : public QLabel { Q_OBJECT public: SglDisplay_QT_Internal(QWidget *parent = nullptr); void setParams(std::shared_ptr< SceneDrawer> sgldrawer , Scene *_scn); public slots: void redraw(); private: std::shared_ptr<SceneDrawer> _sglDrawer; sgl::Scene *_scene; void mouseMoveEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void wheelEvent(QWheelEvent *event); void keyPressEvent(QKeyEvent *ev); QPointF prevMousePos; enum MouseActions: int{MA_NONE,MA_TRANSLATE,MA_ROTATE,MA_ZOOM}; int mouseAction=MA_NONE; float strengthFactor=1; }; } #endif
16d1df4557d3578225202f5a21a77a6be8b8e3a5
f20d2c4399b42aea860db597938b476c522ad512
/examples/inverse_pendulum/modelIP.cpp
0b2d3135f15ac89838bd4d9a2977c91b1b6787ec
[]
no_license
flforget/ddp-actuator-solver
76da7546c00c65e32c0b99ce1e175d384baef168
5587fc857f5a336f63f541cbdc4c3b4656f12728
refs/heads/master
2018-12-11T06:16:10.244662
2018-10-31T12:42:28
2018-10-31T12:42:28
39,523,545
6
5
null
null
null
null
UTF-8
C++
false
false
2,327
cpp
modelIP.cpp
#include <math.h> #include <eigen3/unsupported/Eigen/MatrixFunctions> #include <sys/time.h> #include <iostream> #include "modelIP.hh" /* * x0 -> actuator position * x1 -> actuator speed * x2 -> motor temperature * x3 -> external torque * x4 -> ambiant temperature */ ModelIP::ModelIP(double& mydt, bool noiseOnParameters) { stateNb = 5; commandNb = 1; dt = mydt; if (!noiseOnParameters) { J = 119e-7; K_M = 77.1e-3; f_VL = 0.429e-6; R_th = 2.8; tau_th = 15.7; } else { J = 119e-17; K_M = 77.1e-3; f_VL = 0.429e-6; R_th = 2.8; tau_th = 15.7; } Id.setIdentity(); fu.setZero(); fx.setZero(); fxx[0].setZero(); fxx[1].setZero(); fxx[2].setZero(); fxx[3].setZero(); fxx[4].setZero(); fxu[0].setZero(); fxu[0].setZero(); fuu[0].setZero(); fux[0].setZero(); fxu[0].setZero(); QxxCont.setZero(); QuuCont.setZero(); QuxCont.setZero(); lowerCommandBounds << -1.0; upperCommandBounds << 1.0; } ModelIP::stateVec_t ModelIP::computeDeriv(double&, const stateVec_t& X, const commandVec_t &U) { dX[0] = X[1]; dX[1] = (K_M / J) * U[0] - (f_VL / J) * X[1] - (1.0 / J) * X[3]; dX[2] = R_th * U[0] * U[0] - (X[2] - X[4]) / tau_th; dX[3] = 0.0; dX[4] = 0.0; //std::cout << dX.transpose() << std::endl; return dX; } ModelIP::stateVec_t ModelIP::computeNextState(double& dt, const stateVec_t& X, const commandVec_t& U) { k1 = computeDeriv(dt, X, U); k2 = computeDeriv(dt, X + (dt / 2) * k1, U); k3 = computeDeriv(dt, X + (dt / 2) * k2, U); k4 = computeDeriv(dt, X + dt * k3, U); x_next = X + (dt / 6) * (k1 + 2 * k2 + 2 * k3 + k4); return x_next; } void ModelIP::computeModelDeriv(double& dt, const stateVec_t& X, const commandVec_t& U) { double dh = 1e-7; stateVec_t Xp, Xm; Xp = X; Xm = X; for (unsigned int i = 0; i < stateNb; i++) { Xp[i] += dh / 2; Xm[i] -= dh / 2; fx.col(i) = (computeNextState(dt, Xp, U) - computeNextState(dt, Xm, U)) / dh; Xp = X; Xm = X; } } ModelIP::stateMat_t ModelIP::computeTensorContxx(const stateVec_t& ) { return QxxCont; } ModelIP::commandMat_t ModelIP::computeTensorContuu(const stateVec_t& ) { return QuuCont; } ModelIP::commandR_stateC_t ModelIP::computeTensorContux(const stateVec_t& ) { return QuxCont; }
4aefbae0852d8000722265aab36a4f2d4e49b9e4
40d76c084205b75132ca23b44ce0ebd05da1172a
/ast.hpp
6a2af6ea3c3e0459fd4d5161a755260466875ebc
[]
no_license
isaacjensen/python-ast-visualizer
014233a3dcc9f7c9ffb6f1a1f01e617d6b096374
fb6d6e24b8023d5d434d3ff049f0458dd3dfda48
refs/heads/main
2023-07-03T01:44:36.984697
2021-07-28T15:42:47
2021-07-28T15:42:47
380,008,100
1
0
null
null
null
null
UTF-8
C++
false
false
265
hpp
ast.hpp
#include <vector> using namespace std; struct Node { string* type; string* value; vector<struct Node*> children; public: Node(string* n, string* v) { //constructor for struct Node type = n; value = v; } };
55c6a64ad60ced4a9d9d847f8e15c6c1f34fdee9
a1809f8abdb7d0d5bbf847b076df207400e7b08a
/Simpsons Hit&Run/game/libs/radmusic/inc/radmusic/schema.hpp
f034c23cc0f1acc3676fea46eee85e392a27b593
[]
no_license
RolphWoggom/shr.tar
556cca3ff89fff3ff46a77b32a16bebca85acabf
147796d55e69f490fb001f8cbdb9bf7de9e556ad
refs/heads/master
2023-07-03T19:15:13.649803
2021-08-27T22:24:13
2021-08-27T22:24:13
400,380,551
8
0
null
null
null
null
UTF-8
C++
false
false
255,875
hpp
schema.hpp
// Generated by Schema+ V1.0 (C) Radical Games #ifndef __6239 #define __6239 #include <ods/ods.hpp> namespace ods { // // class types // struct _comp; typedef pointer_templ<_comp> comp; struct _group; typedef pointer_templ<_group> group; struct _fade_transition; typedef pointer_templ<_fade_transition> fade_transition; struct _stitch_transition; typedef pointer_templ<_stitch_transition> stitch_transition; struct _event; typedef pointer_templ<_event> event; struct _event_matrix; typedef pointer_templ<_event_matrix> event_matrix; struct _state; typedef pointer_templ<_state> state; struct _rsd_file; typedef pointer_templ<_rsd_file> rsd_file; struct _stream; typedef pointer_templ<_stream> stream; struct _clip; typedef pointer_templ<_clip> clip; struct _region; typedef pointer_templ<_region> region; struct _sequence; typedef pointer_templ<_sequence> sequence; struct _layer; typedef pointer_templ<_layer> layer; struct _event_clip; typedef pointer_templ<_event_clip> event_clip; struct _event_stream; typedef pointer_templ<_event_stream> event_stream; struct _event_silence; typedef pointer_templ<_event_silence> event_silence; struct _event_var_volume; typedef pointer_templ<_event_var_volume> event_var_volume; struct _event_var_pitch; typedef pointer_templ<_event_var_pitch> event_var_pitch; struct _event_var_volume_rand_min; typedef pointer_templ<_event_var_volume_rand_min> event_var_volume_rand_min; struct _event_var_volume_rand_max; typedef pointer_templ<_event_var_volume_rand_max> event_var_volume_rand_max; struct _event_var_pitch_rand_min; typedef pointer_templ<_event_var_pitch_rand_min> event_var_pitch_rand_min; struct _event_var_pitch_rand_max; typedef pointer_templ<_event_var_pitch_rand_max> event_var_pitch_rand_max; struct _event_var_aux_gain; typedef pointer_templ<_event_var_aux_gain> event_var_aux_gain; struct _event_var_positional; typedef pointer_templ<_event_var_positional> event_var_positional; struct _event_var_pos_fall_off; typedef pointer_templ<_event_var_pos_fall_off> event_var_pos_fall_off; struct _event_var_pos_dist_min; typedef pointer_templ<_event_var_pos_dist_min> event_var_pos_dist_min; struct _event_var_pos_dist_max; typedef pointer_templ<_event_var_pos_dist_max> event_var_pos_dist_max; struct _event_callback; typedef pointer_templ<_event_callback> event_callback; struct _event_logic_and; typedef pointer_templ<_event_logic_and> event_logic_and; struct _event_logic_or; typedef pointer_templ<_event_logic_or> event_logic_or; struct _event_logic_repeat; typedef pointer_templ<_event_logic_repeat> event_logic_repeat; struct _play_region_action; typedef pointer_templ<_play_region_action> play_region_action; struct _push_region_action; typedef pointer_templ<_push_region_action> push_region_action; struct _pop_region_action; typedef pointer_templ<_pop_region_action> pop_region_action; struct _start_layer_action; typedef pointer_templ<_start_layer_action> start_layer_action; struct _stop_layer_action; typedef pointer_templ<_stop_layer_action> stop_layer_action; struct _rand_state_action; typedef pointer_templ<_rand_state_action> rand_state_action; struct _audio_format; typedef pointer_templ<_audio_format> audio_format; struct _tempo_track; typedef pointer_templ<_tempo_track> tempo_track; struct _sequence_event; typedef pointer_templ<_sequence_event> sequence_event; struct _beat_set; typedef pointer_templ<_beat_set> beat_set; struct _action; typedef pointer_templ<_action> action; // // ref types // struct _group_ref; typedef pointer_templ<_group_ref> group_ref; struct _rsd_file_ref; typedef pointer_templ<_rsd_file_ref> rsd_file_ref; struct _sequence_event_ref; typedef pointer_templ<_sequence_event_ref> sequence_event_ref; struct _stream_ref; typedef pointer_templ<_stream_ref> stream_ref; struct _clip_ref; typedef pointer_templ<_clip_ref> clip_ref; struct _region_ref; typedef pointer_templ<_region_ref> region_ref; struct _state_ref; typedef pointer_templ<_state_ref> state_ref; struct _action_ref; typedef pointer_templ<_action_ref> action_ref; struct _event_matrix_ref; typedef pointer_templ<_event_matrix_ref> event_matrix_ref; struct _layer_ref; typedef pointer_templ<_layer_ref> layer_ref; struct _sequence_ref; typedef pointer_templ<_sequence_ref> sequence_ref; // // array types // struct _group_array; typedef pointer_templ<_group_array> group_array; struct _fade_transition_array; typedef pointer_templ<_fade_transition_array> fade_transition_array; struct _stitch_transition_array; typedef pointer_templ<_stitch_transition_array> stitch_transition_array; struct _event_array; typedef pointer_templ<_event_array> event_array; struct _event_matrix_array; typedef pointer_templ<_event_matrix_array> event_matrix_array; struct _state_array; typedef pointer_templ<_state_array> state_array; struct _rsd_file_array; typedef pointer_templ<_rsd_file_array> rsd_file_array; struct _stream_array; typedef pointer_templ<_stream_array> stream_array; struct _clip_array; typedef pointer_templ<_clip_array> clip_array; struct _region_array; typedef pointer_templ<_region_array> region_array; struct _sequence_array; typedef pointer_templ<_sequence_array> sequence_array; struct _layer_array; typedef pointer_templ<_layer_array> layer_array; struct _event_clip_array; typedef pointer_templ<_event_clip_array> event_clip_array; struct _event_stream_array; typedef pointer_templ<_event_stream_array> event_stream_array; struct _event_silence_array; typedef pointer_templ<_event_silence_array> event_silence_array; struct _event_var_volume_array; typedef pointer_templ<_event_var_volume_array> event_var_volume_array; struct _event_var_pitch_array; typedef pointer_templ<_event_var_pitch_array> event_var_pitch_array; struct _event_var_volume_rand_min_array; typedef pointer_templ<_event_var_volume_rand_min_array> event_var_volume_rand_min_array; struct _event_var_volume_rand_max_array; typedef pointer_templ<_event_var_volume_rand_max_array> event_var_volume_rand_max_array; struct _event_var_pitch_rand_min_array; typedef pointer_templ<_event_var_pitch_rand_min_array> event_var_pitch_rand_min_array; struct _event_var_pitch_rand_max_array; typedef pointer_templ<_event_var_pitch_rand_max_array> event_var_pitch_rand_max_array; struct _event_var_aux_gain_array; typedef pointer_templ<_event_var_aux_gain_array> event_var_aux_gain_array; struct _event_var_positional_array; typedef pointer_templ<_event_var_positional_array> event_var_positional_array; struct _event_var_pos_fall_off_array; typedef pointer_templ<_event_var_pos_fall_off_array> event_var_pos_fall_off_array; struct _event_var_pos_dist_min_array; typedef pointer_templ<_event_var_pos_dist_min_array> event_var_pos_dist_min_array; struct _event_var_pos_dist_max_array; typedef pointer_templ<_event_var_pos_dist_max_array> event_var_pos_dist_max_array; struct _event_callback_array; typedef pointer_templ<_event_callback_array> event_callback_array; struct _event_logic_and_array; typedef pointer_templ<_event_logic_and_array> event_logic_and_array; struct _event_logic_or_array; typedef pointer_templ<_event_logic_or_array> event_logic_or_array; struct _event_logic_repeat_array; typedef pointer_templ<_event_logic_repeat_array> event_logic_repeat_array; struct _play_region_action_array; typedef pointer_templ<_play_region_action_array> play_region_action_array; struct _push_region_action_array; typedef pointer_templ<_push_region_action_array> push_region_action_array; struct _pop_region_action_array; typedef pointer_templ<_pop_region_action_array> pop_region_action_array; struct _start_layer_action_array; typedef pointer_templ<_start_layer_action_array> start_layer_action_array; struct _stop_layer_action_array; typedef pointer_templ<_stop_layer_action_array> stop_layer_action_array; struct _rand_state_action_array; typedef pointer_templ<_rand_state_action_array> rand_state_action_array; struct _stream_ref_array; typedef pointer_templ<_stream_ref_array> stream_ref_array; struct _clip_ref_array; typedef pointer_templ<_clip_ref_array> clip_ref_array; struct _region_ref_array; typedef pointer_templ<_region_ref_array> region_ref_array; struct _state_ref_array; typedef pointer_templ<_state_ref_array> state_ref_array; struct _action_ref_array; typedef pointer_templ<_action_ref_array> action_ref_array; struct _action_ref_array_array; typedef pointer_templ<_action_ref_array_array> action_ref_array_array; struct _string_array; typedef pointer_templ<_string_array> string_array; struct _layer_ref_array; typedef pointer_templ<_layer_ref_array> layer_ref_array; struct _float_array; typedef pointer_templ<_float_array> float_array; struct _sequence_event_ref_array; typedef pointer_templ<_sequence_event_ref_array> sequence_event_ref_array; // // class attribute accessor functions // // cls type comp inline comp comp_new( block * p_memory ); inline void comp_construct( const comp & ptr ); inline void comp_destroy( const comp & ptr ); inline void comp_delete( const comp & ptr ); inline uint32 comp_sound_memory_max( const comp & ); inline void comp_sound_memory_max( const comp &, uint32 ); inline uint32 comp_cache_memory_max( const comp & ); inline void comp_cache_memory_max( const comp &, uint32 ); inline uint32 comp_stream_size_min( const comp & ); inline void comp_stream_size_min( const comp &, uint32 ); inline const group_array comp_root_groups( const comp & ); inline void comp_root_groups( const comp &, const group_array ); inline const fade_transition_array comp_fade_transitions( const comp & ); inline void comp_fade_transitions( const comp &, const fade_transition_array ); inline const stitch_transition_array comp_stitch_transitions( const comp & ); inline void comp_stitch_transitions( const comp &, const stitch_transition_array ); inline const event_array comp_events( const comp & ); inline void comp_events( const comp &, const event_array ); inline const event_matrix_array comp_event_matricies( const comp & ); inline void comp_event_matricies( const comp &, const event_matrix_array ); inline const state_array comp_states( const comp & ); inline void comp_states( const comp &, const state_array ); inline const rsd_file_array comp_rsd_files( const comp & ); inline void comp_rsd_files( const comp &, const rsd_file_array ); inline const stream_array comp_streams( const comp & ); inline void comp_streams( const comp &, const stream_array ); inline const clip_array comp_clips( const comp & ); inline void comp_clips( const comp &, const clip_array ); inline const region_array comp_regions( const comp & ); inline void comp_regions( const comp &, const region_array ); inline const sequence_array comp_sequences( const comp & ); inline void comp_sequences( const comp &, const sequence_array ); inline const layer_array comp_layers( const comp & ); inline void comp_layers( const comp &, const layer_array ); inline const event_clip_array comp_event_clip_array( const comp & ); inline void comp_event_clip_array( const comp &, const event_clip_array ); inline const event_stream_array comp_event_stream_array( const comp & ); inline void comp_event_stream_array( const comp &, const event_stream_array ); inline const event_silence_array comp_event_silence_array( const comp & ); inline void comp_event_silence_array( const comp &, const event_silence_array ); inline const event_var_volume_array comp_event_var_volume_array( const comp & ); inline void comp_event_var_volume_array( const comp &, const event_var_volume_array ); inline const event_var_pitch_array comp_event_var_pitch_array( const comp & ); inline void comp_event_var_pitch_array( const comp &, const event_var_pitch_array ); inline const event_var_volume_rand_min_array comp_event_var_volume_rand_min_array( const comp & ); inline void comp_event_var_volume_rand_min_array( const comp &, const event_var_volume_rand_min_array ); inline const event_var_volume_rand_max_array comp_event_var_volume_rand_max_array( const comp & ); inline void comp_event_var_volume_rand_max_array( const comp &, const event_var_volume_rand_max_array ); inline const event_var_pitch_rand_min_array comp_event_var_pitch_rand_min_array( const comp & ); inline void comp_event_var_pitch_rand_min_array( const comp &, const event_var_pitch_rand_min_array ); inline const event_var_pitch_rand_max_array comp_event_var_pitch_rand_max_array( const comp & ); inline void comp_event_var_pitch_rand_max_array( const comp &, const event_var_pitch_rand_max_array ); inline const event_var_aux_gain_array comp_event_var_aux_gain_array( const comp & ); inline void comp_event_var_aux_gain_array( const comp &, const event_var_aux_gain_array ); inline const event_var_positional_array comp_event_var_positional_array( const comp & ); inline void comp_event_var_positional_array( const comp &, const event_var_positional_array ); inline const event_var_pos_fall_off_array comp_event_var_pos_fall_off_array( const comp & ); inline void comp_event_var_pos_fall_off_array( const comp &, const event_var_pos_fall_off_array ); inline const event_var_pos_dist_min_array comp_event_var_pos_dist_min_array( const comp & ); inline void comp_event_var_pos_dist_min_array( const comp &, const event_var_pos_dist_min_array ); inline const event_var_pos_dist_max_array comp_event_var_pos_dist_max_array( const comp & ); inline void comp_event_var_pos_dist_max_array( const comp &, const event_var_pos_dist_max_array ); inline const event_callback_array comp_event_callback_array( const comp & ); inline void comp_event_callback_array( const comp &, const event_callback_array ); inline const event_logic_and_array comp_event_logic_and_array( const comp & ); inline void comp_event_logic_and_array( const comp &, const event_logic_and_array ); inline const event_logic_or_array comp_event_logic_or_array( const comp & ); inline void comp_event_logic_or_array( const comp &, const event_logic_or_array ); inline const event_logic_repeat_array comp_event_logic_repeat_array( const comp & ); inline void comp_event_logic_repeat_array( const comp &, const event_logic_repeat_array ); inline const play_region_action_array comp_play_region_action_array( const comp & ); inline void comp_play_region_action_array( const comp &, const play_region_action_array ); inline const push_region_action_array comp_push_region_action_array( const comp & ); inline void comp_push_region_action_array( const comp &, const push_region_action_array ); inline const pop_region_action_array comp_pop_region_action_array( const comp & ); inline void comp_pop_region_action_array( const comp &, const pop_region_action_array ); inline const start_layer_action_array comp_start_layer_action_array( const comp & ); inline void comp_start_layer_action_array( const comp &, const start_layer_action_array ); inline const stop_layer_action_array comp_stop_layer_action_array( const comp & ); inline void comp_stop_layer_action_array( const comp &, const stop_layer_action_array ); inline const rand_state_action_array comp_rand_state_action_array( const comp & ); inline void comp_rand_state_action_array( const comp &, const rand_state_action_array ); // cls type group inline group group_new( block * p_memory ); inline void group_construct( const group & ptr ); inline void group_destroy( const group & ptr ); inline void group_delete( const group & ptr ); inline void group_name( const group & , char * p_string, unsigned int len); inline void group_name( const group &, const char * ); inline const group_array group_children( const group & ); inline void group_children( const group &, const group_array ); inline const stream_ref_array group_stream_refs( const group & ); inline void group_stream_refs( const group &, const stream_ref_array ); inline const clip_ref_array group_clip_refs( const group & ); inline void group_clip_refs( const group &, const clip_ref_array ); inline const region_ref_array group_region_refs( const group & ); inline void group_region_refs( const group &, const region_ref_array ); inline const group group_parent_ref( const group & ); inline void group_parent_ref( const group &, const group & ); inline uint32 group_tree_depth( const group & ); inline void group_tree_depth( const group &, uint32 ); // cls type fade_transition inline fade_transition fade_transition_new( block * p_memory ); inline void fade_transition_construct( const fade_transition & ptr ); inline void fade_transition_destroy( const fade_transition & ptr ); inline void fade_transition_delete( const fade_transition & ptr ); inline const region fade_transition_source_region_ref( const fade_transition & ); inline void fade_transition_source_region_ref( const fade_transition &, const region & ); inline const region fade_transition_target_region_ref( const fade_transition & ); inline void fade_transition_target_region_ref( const fade_transition &, const region & ); inline float fade_transition_source_time( const fade_transition & ); inline void fade_transition_source_time( const fade_transition &, float ); inline float fade_transition_source_start( const fade_transition & ); inline void fade_transition_source_start( const fade_transition &, float ); inline float fade_transition_target_time( const fade_transition & ); inline void fade_transition_target_time( const fade_transition &, float ); inline float fade_transition_target_start( const fade_transition & ); inline void fade_transition_target_start( const fade_transition &, float ); inline const beat_set fade_transition_beat_set( const fade_transition & ); inline void fade_transition_beat_set( const fade_transition &, const beat_set ); // cls type stitch_transition inline stitch_transition stitch_transition_new( block * p_memory ); inline void stitch_transition_construct( const stitch_transition & ptr ); inline void stitch_transition_destroy( const stitch_transition & ptr ); inline void stitch_transition_delete( const stitch_transition & ptr ); inline const region stitch_transition_source_region_ref( const stitch_transition & ); inline void stitch_transition_source_region_ref( const stitch_transition &, const region & ); inline const region stitch_transition_target_region_ref( const stitch_transition & ); inline void stitch_transition_target_region_ref( const stitch_transition &, const region & ); inline const region stitch_transition_transition_region_ref( const stitch_transition & ); inline void stitch_transition_transition_region_ref( const stitch_transition &, const region & ); // cls type event inline event event_new( block * p_memory ); inline void event_construct( const event & ptr ); inline void event_destroy( const event & ptr ); inline void event_delete( const event & ptr ); inline void event_name( const event & , char * p_string, unsigned int len); inline void event_name( const event &, const char * ); inline const action_ref_array_array event_action_arrays( const event & ); inline void event_action_arrays( const event &, const action_ref_array_array ); inline const event_matrix event_event_matrix_ref( const event & ); inline void event_event_matrix_ref( const event &, const event_matrix & ); // cls type event_matrix inline event_matrix event_matrix_new( block * p_memory ); inline void event_matrix_construct( const event_matrix & ptr ); inline void event_matrix_destroy( const event_matrix & ptr ); inline void event_matrix_delete( const event_matrix & ptr ); inline const state_ref_array event_matrix_state_ref_array( const event_matrix & ); inline void event_matrix_state_ref_array( const event_matrix &, const state_ref_array ); // cls type state inline state state_new( block * p_memory ); inline void state_construct( const state & ptr ); inline void state_destroy( const state & ptr ); inline void state_delete( const state & ptr ); inline void state_name( const state & , char * p_string, unsigned int len); inline void state_name( const state &, const char * ); inline const string_array state_values( const state & ); inline void state_values( const state &, const string_array ); // cls type rsd_file inline rsd_file rsd_file_new( block * p_memory ); inline void rsd_file_construct( const rsd_file & ptr ); inline void rsd_file_destroy( const rsd_file & ptr ); inline void rsd_file_delete( const rsd_file & ptr ); inline void rsd_file_file_name( const rsd_file & , char * p_string, unsigned int len); inline void rsd_file_file_name( const rsd_file &, const char * ); inline uint32 rsd_file_size( const rsd_file & ); inline void rsd_file_size( const rsd_file &, uint32 ); inline const audio_format rsd_file_audio_format( const rsd_file & ); inline void rsd_file_audio_format( const rsd_file &, const audio_format ); // cls type stream inline stream stream_new( block * p_memory ); inline void stream_construct( const stream & ptr ); inline void stream_destroy( const stream & ptr ); inline void stream_delete( const stream & ptr ); inline void stream_name( const stream & , char * p_string, unsigned int len); inline void stream_name( const stream &, const char * ); inline const group stream_parent_group_ref( const stream & ); inline void stream_parent_group_ref( const stream &, const group & ); inline const rsd_file stream_rsd_file_ref( const stream & ); inline void stream_rsd_file_ref( const stream &, const rsd_file & ); inline bool stream_streamed( const stream & ); inline void stream_streamed( const stream &, bool ); inline const tempo_track stream_tempo_track( const stream & ); inline void stream_tempo_track( const stream &, const tempo_track ); // cls type clip inline clip clip_new( block * p_memory ); inline void clip_construct( const clip & ptr ); inline void clip_destroy( const clip & ptr ); inline void clip_delete( const clip & ptr ); inline void clip_name( const clip & , char * p_string, unsigned int len); inline void clip_name( const clip &, const char * ); inline const group clip_parent_group_ref( const clip & ); inline void clip_parent_group_ref( const clip &, const group & ); inline const rsd_file clip_rsd_file_ref( const clip & ); inline void clip_rsd_file_ref( const clip &, const rsd_file & ); inline const tempo_track clip_tempo_track( const clip & ); inline void clip_tempo_track( const clip &, const tempo_track ); // cls type region inline region region_new( block * p_memory ); inline void region_construct( const region & ptr ); inline void region_destroy( const region & ptr ); inline void region_delete( const region & ptr ); inline void region_name( const region & , char * p_string, unsigned int len); inline void region_name( const region &, const char * ); inline const layer_ref_array region_layer_refs( const region & ); inline void region_layer_refs( const region &, const layer_ref_array ); inline const region region_exit_region_ref( const region & ); inline void region_exit_region_ref( const region &, const region & ); inline const group region_group_ref( const region & ); inline void region_group_ref( const region &, const group & ); inline float region_volume( const region & ); inline void region_volume( const region &, float ); // cls type sequence inline sequence sequence_new( block * p_memory ); inline void sequence_construct( const sequence & ptr ); inline void sequence_destroy( const sequence & ptr ); inline void sequence_delete( const sequence & ptr ); inline const sequence_event sequence_root_event( const sequence & ); inline void sequence_root_event( const sequence &, const sequence_event & ); inline uint32 sequence_stack_size( const sequence & ); inline void sequence_stack_size( const sequence &, uint32 ); // cls type layer inline layer layer_new( block * p_memory ); inline void layer_construct( const layer & ptr ); inline void layer_destroy( const layer & ptr ); inline void layer_delete( const layer & ptr ); inline void layer_name( const layer & , char * p_string, unsigned int len); inline void layer_name( const layer &, const char * ); inline bool layer_constant( const layer & ); inline void layer_constant( const layer &, bool ); inline const beat_set layer_beat_set( const layer & ); inline void layer_beat_set( const layer &, const beat_set ); inline const sequence layer_sequence_ref( const layer & ); inline void layer_sequence_ref( const layer &, const sequence & ); inline float layer_volume( const layer & ); inline void layer_volume( const layer &, float ); // cls type event_clip inline event_clip event_clip_new( block * p_memory ); inline void event_clip_construct( const event_clip & ptr ); inline void event_clip_destroy( const event_clip & ptr ); inline void event_clip_delete( const event_clip & ptr ); inline uint32 event_clip_type( const event_clip & ); inline void event_clip_type( const event_clip &, uint32 ); inline const clip event_clip_clip_ref( const event_clip & ); inline void event_clip_clip_ref( const event_clip &, const clip & ); // cls type event_stream inline event_stream event_stream_new( block * p_memory ); inline void event_stream_construct( const event_stream & ptr ); inline void event_stream_destroy( const event_stream & ptr ); inline void event_stream_delete( const event_stream & ptr ); inline uint32 event_stream_type( const event_stream & ); inline void event_stream_type( const event_stream &, uint32 ); inline const stream event_stream_stream_ref( const event_stream & ); inline void event_stream_stream_ref( const event_stream &, const stream & ); // cls type event_silence inline event_silence event_silence_new( block * p_memory ); inline void event_silence_construct( const event_silence & ptr ); inline void event_silence_destroy( const event_silence & ptr ); inline void event_silence_delete( const event_silence & ptr ); inline uint32 event_silence_type( const event_silence & ); inline void event_silence_type( const event_silence &, uint32 ); inline float event_silence_min_time( const event_silence & ); inline void event_silence_min_time( const event_silence &, float ); inline float event_silence_max_time( const event_silence & ); inline void event_silence_max_time( const event_silence &, float ); // cls type event_var_volume inline event_var_volume event_var_volume_new( block * p_memory ); inline void event_var_volume_construct( const event_var_volume & ptr ); inline void event_var_volume_destroy( const event_var_volume & ptr ); inline void event_var_volume_delete( const event_var_volume & ptr ); inline uint32 event_var_volume_type( const event_var_volume & ); inline void event_var_volume_type( const event_var_volume &, uint32 ); inline float event_var_volume_volume( const event_var_volume & ); inline void event_var_volume_volume( const event_var_volume &, float ); // cls type event_var_pitch inline event_var_pitch event_var_pitch_new( block * p_memory ); inline void event_var_pitch_construct( const event_var_pitch & ptr ); inline void event_var_pitch_destroy( const event_var_pitch & ptr ); inline void event_var_pitch_delete( const event_var_pitch & ptr ); inline uint32 event_var_pitch_type( const event_var_pitch & ); inline void event_var_pitch_type( const event_var_pitch &, uint32 ); inline float event_var_pitch_pitch( const event_var_pitch & ); inline void event_var_pitch_pitch( const event_var_pitch &, float ); // cls type event_var_volume_rand_min inline event_var_volume_rand_min event_var_volume_rand_min_new( block * p_memory ); inline void event_var_volume_rand_min_construct( const event_var_volume_rand_min & ptr ); inline void event_var_volume_rand_min_destroy( const event_var_volume_rand_min & ptr ); inline void event_var_volume_rand_min_delete( const event_var_volume_rand_min & ptr ); inline uint32 event_var_volume_rand_min_type( const event_var_volume_rand_min & ); inline void event_var_volume_rand_min_type( const event_var_volume_rand_min &, uint32 ); inline float event_var_volume_rand_min_volume_rand_min( const event_var_volume_rand_min & ); inline void event_var_volume_rand_min_volume_rand_min( const event_var_volume_rand_min &, float ); // cls type event_var_volume_rand_max inline event_var_volume_rand_max event_var_volume_rand_max_new( block * p_memory ); inline void event_var_volume_rand_max_construct( const event_var_volume_rand_max & ptr ); inline void event_var_volume_rand_max_destroy( const event_var_volume_rand_max & ptr ); inline void event_var_volume_rand_max_delete( const event_var_volume_rand_max & ptr ); inline uint32 event_var_volume_rand_max_type( const event_var_volume_rand_max & ); inline void event_var_volume_rand_max_type( const event_var_volume_rand_max &, uint32 ); inline float event_var_volume_rand_max_volume_rand_max( const event_var_volume_rand_max & ); inline void event_var_volume_rand_max_volume_rand_max( const event_var_volume_rand_max &, float ); // cls type event_var_pitch_rand_min inline event_var_pitch_rand_min event_var_pitch_rand_min_new( block * p_memory ); inline void event_var_pitch_rand_min_construct( const event_var_pitch_rand_min & ptr ); inline void event_var_pitch_rand_min_destroy( const event_var_pitch_rand_min & ptr ); inline void event_var_pitch_rand_min_delete( const event_var_pitch_rand_min & ptr ); inline uint32 event_var_pitch_rand_min_type( const event_var_pitch_rand_min & ); inline void event_var_pitch_rand_min_type( const event_var_pitch_rand_min &, uint32 ); inline float event_var_pitch_rand_min_pitch_rand_min( const event_var_pitch_rand_min & ); inline void event_var_pitch_rand_min_pitch_rand_min( const event_var_pitch_rand_min &, float ); // cls type event_var_pitch_rand_max inline event_var_pitch_rand_max event_var_pitch_rand_max_new( block * p_memory ); inline void event_var_pitch_rand_max_construct( const event_var_pitch_rand_max & ptr ); inline void event_var_pitch_rand_max_destroy( const event_var_pitch_rand_max & ptr ); inline void event_var_pitch_rand_max_delete( const event_var_pitch_rand_max & ptr ); inline uint32 event_var_pitch_rand_max_type( const event_var_pitch_rand_max & ); inline void event_var_pitch_rand_max_type( const event_var_pitch_rand_max &, uint32 ); inline float event_var_pitch_rand_max_pitch_rand_max( const event_var_pitch_rand_max & ); inline void event_var_pitch_rand_max_pitch_rand_max( const event_var_pitch_rand_max &, float ); // cls type event_var_aux_gain inline event_var_aux_gain event_var_aux_gain_new( block * p_memory ); inline void event_var_aux_gain_construct( const event_var_aux_gain & ptr ); inline void event_var_aux_gain_destroy( const event_var_aux_gain & ptr ); inline void event_var_aux_gain_delete( const event_var_aux_gain & ptr ); inline uint32 event_var_aux_gain_type( const event_var_aux_gain & ); inline void event_var_aux_gain_type( const event_var_aux_gain &, uint32 ); inline uint32 event_var_aux_gain_aux_number( const event_var_aux_gain & ); inline void event_var_aux_gain_aux_number( const event_var_aux_gain &, uint32 ); inline float event_var_aux_gain_aux_gain( const event_var_aux_gain & ); inline void event_var_aux_gain_aux_gain( const event_var_aux_gain &, float ); // cls type event_var_positional inline event_var_positional event_var_positional_new( block * p_memory ); inline void event_var_positional_construct( const event_var_positional & ptr ); inline void event_var_positional_destroy( const event_var_positional & ptr ); inline void event_var_positional_delete( const event_var_positional & ptr ); inline uint32 event_var_positional_type( const event_var_positional & ); inline void event_var_positional_type( const event_var_positional &, uint32 ); inline bool event_var_positional_positional( const event_var_positional & ); inline void event_var_positional_positional( const event_var_positional &, bool ); // cls type event_var_pos_fall_off inline event_var_pos_fall_off event_var_pos_fall_off_new( block * p_memory ); inline void event_var_pos_fall_off_construct( const event_var_pos_fall_off & ptr ); inline void event_var_pos_fall_off_destroy( const event_var_pos_fall_off & ptr ); inline void event_var_pos_fall_off_delete( const event_var_pos_fall_off & ptr ); inline uint32 event_var_pos_fall_off_type( const event_var_pos_fall_off & ); inline void event_var_pos_fall_off_type( const event_var_pos_fall_off &, uint32 ); inline float event_var_pos_fall_off_pos_fall_off( const event_var_pos_fall_off & ); inline void event_var_pos_fall_off_pos_fall_off( const event_var_pos_fall_off &, float ); // cls type event_var_pos_dist_min inline event_var_pos_dist_min event_var_pos_dist_min_new( block * p_memory ); inline void event_var_pos_dist_min_construct( const event_var_pos_dist_min & ptr ); inline void event_var_pos_dist_min_destroy( const event_var_pos_dist_min & ptr ); inline void event_var_pos_dist_min_delete( const event_var_pos_dist_min & ptr ); inline uint32 event_var_pos_dist_min_type( const event_var_pos_dist_min & ); inline void event_var_pos_dist_min_type( const event_var_pos_dist_min &, uint32 ); inline float event_var_pos_dist_min_pos_dist_min( const event_var_pos_dist_min & ); inline void event_var_pos_dist_min_pos_dist_min( const event_var_pos_dist_min &, float ); // cls type event_var_pos_dist_max inline event_var_pos_dist_max event_var_pos_dist_max_new( block * p_memory ); inline void event_var_pos_dist_max_construct( const event_var_pos_dist_max & ptr ); inline void event_var_pos_dist_max_destroy( const event_var_pos_dist_max & ptr ); inline void event_var_pos_dist_max_delete( const event_var_pos_dist_max & ptr ); inline uint32 event_var_pos_dist_max_type( const event_var_pos_dist_max & ); inline void event_var_pos_dist_max_type( const event_var_pos_dist_max &, uint32 ); inline float event_var_pos_dist_max_pos_dist_max( const event_var_pos_dist_max & ); inline void event_var_pos_dist_max_pos_dist_max( const event_var_pos_dist_max &, float ); // cls type event_callback inline event_callback event_callback_new( block * p_memory ); inline void event_callback_construct( const event_callback & ptr ); inline void event_callback_destroy( const event_callback & ptr ); inline void event_callback_delete( const event_callback & ptr ); inline uint32 event_callback_type( const event_callback & ); inline void event_callback_type( const event_callback &, uint32 ); inline void event_callback_callback_name( const event_callback & , char * p_string, unsigned int len); inline void event_callback_callback_name( const event_callback &, const char * ); // cls type event_logic_and inline event_logic_and event_logic_and_new( block * p_memory ); inline void event_logic_and_construct( const event_logic_and & ptr ); inline void event_logic_and_destroy( const event_logic_and & ptr ); inline void event_logic_and_delete( const event_logic_and & ptr ); inline uint32 event_logic_and_type( const event_logic_and & ); inline void event_logic_and_type( const event_logic_and &, uint32 ); inline const sequence_event_ref_array event_logic_and_events( const event_logic_and & ); inline void event_logic_and_events( const event_logic_and &, const sequence_event_ref_array ); // cls type event_logic_or inline event_logic_or event_logic_or_new( block * p_memory ); inline void event_logic_or_construct( const event_logic_or & ptr ); inline void event_logic_or_destroy( const event_logic_or & ptr ); inline void event_logic_or_delete( const event_logic_or & ptr ); inline uint32 event_logic_or_type( const event_logic_or & ); inline void event_logic_or_type( const event_logic_or &, uint32 ); inline const sequence_event_ref_array event_logic_or_events( const event_logic_or & ); inline void event_logic_or_events( const event_logic_or &, const sequence_event_ref_array ); // cls type event_logic_repeat inline event_logic_repeat event_logic_repeat_new( block * p_memory ); inline void event_logic_repeat_construct( const event_logic_repeat & ptr ); inline void event_logic_repeat_destroy( const event_logic_repeat & ptr ); inline void event_logic_repeat_delete( const event_logic_repeat & ptr ); inline uint32 event_logic_repeat_type( const event_logic_repeat & ); inline void event_logic_repeat_type( const event_logic_repeat &, uint32 ); inline uint32 event_logic_repeat_min_times( const event_logic_repeat & ); inline void event_logic_repeat_min_times( const event_logic_repeat &, uint32 ); inline uint32 event_logic_repeat_max_times( const event_logic_repeat & ); inline void event_logic_repeat_max_times( const event_logic_repeat &, uint32 ); inline const sequence_event event_logic_repeat_event_ref( const event_logic_repeat & ); inline void event_logic_repeat_event_ref( const event_logic_repeat &, const sequence_event & ); // cls type play_region_action inline play_region_action play_region_action_new( block * p_memory ); inline void play_region_action_construct( const play_region_action & ptr ); inline void play_region_action_destroy( const play_region_action & ptr ); inline void play_region_action_delete( const play_region_action & ptr ); inline uint32 play_region_action_type( const play_region_action & ); inline void play_region_action_type( const play_region_action &, uint32 ); inline const region play_region_action_region_ref( const play_region_action & ); inline void play_region_action_region_ref( const play_region_action &, const region & ); inline uint32 play_region_action_region_resume_type( const play_region_action & ); inline void play_region_action_region_resume_type( const play_region_action &, uint32 ); // cls type push_region_action inline push_region_action push_region_action_new( block * p_memory ); inline void push_region_action_construct( const push_region_action & ptr ); inline void push_region_action_destroy( const push_region_action & ptr ); inline void push_region_action_delete( const push_region_action & ptr ); inline uint32 push_region_action_type( const push_region_action & ); inline void push_region_action_type( const push_region_action &, uint32 ); inline const region push_region_action_region_ref( const push_region_action & ); inline void push_region_action_region_ref( const push_region_action &, const region & ); inline uint32 push_region_action_target_region_resume_type( const push_region_action & ); inline void push_region_action_target_region_resume_type( const push_region_action &, uint32 ); inline uint32 push_region_action_current_region_resume_type( const push_region_action & ); inline void push_region_action_current_region_resume_type( const push_region_action &, uint32 ); // cls type pop_region_action inline pop_region_action pop_region_action_new( block * p_memory ); inline void pop_region_action_construct( const pop_region_action & ptr ); inline void pop_region_action_destroy( const pop_region_action & ptr ); inline void pop_region_action_delete( const pop_region_action & ptr ); inline uint32 pop_region_action_type( const pop_region_action & ); inline void pop_region_action_type( const pop_region_action &, uint32 ); inline const region pop_region_action_region_ref( const pop_region_action & ); inline void pop_region_action_region_ref( const pop_region_action &, const region & ); // cls type start_layer_action inline start_layer_action start_layer_action_new( block * p_memory ); inline void start_layer_action_construct( const start_layer_action & ptr ); inline void start_layer_action_destroy( const start_layer_action & ptr ); inline void start_layer_action_delete( const start_layer_action & ptr ); inline uint32 start_layer_action_type( const start_layer_action & ); inline void start_layer_action_type( const start_layer_action &, uint32 ); inline void start_layer_action_layer_name( const start_layer_action & , char * p_string, unsigned int len); inline void start_layer_action_layer_name( const start_layer_action &, const char * ); // cls type stop_layer_action inline stop_layer_action stop_layer_action_new( block * p_memory ); inline void stop_layer_action_construct( const stop_layer_action & ptr ); inline void stop_layer_action_destroy( const stop_layer_action & ptr ); inline void stop_layer_action_delete( const stop_layer_action & ptr ); inline uint32 stop_layer_action_type( const stop_layer_action & ); inline void stop_layer_action_type( const stop_layer_action &, uint32 ); inline void stop_layer_action_layer_name( const stop_layer_action & , char * p_string, unsigned int len); inline void stop_layer_action_layer_name( const stop_layer_action &, const char * ); // cls type rand_state_action inline rand_state_action rand_state_action_new( block * p_memory ); inline void rand_state_action_construct( const rand_state_action & ptr ); inline void rand_state_action_destroy( const rand_state_action & ptr ); inline void rand_state_action_delete( const rand_state_action & ptr ); inline uint32 rand_state_action_type( const rand_state_action & ); inline void rand_state_action_type( const rand_state_action &, uint32 ); inline const state rand_state_action_state_ref( const rand_state_action & ); inline void rand_state_action_state_ref( const rand_state_action &, const state & ); // cls type audio_format inline audio_format audio_format_new( block * p_memory ); inline void audio_format_construct( const audio_format & ptr ); inline void audio_format_destroy( const audio_format & ptr ); inline void audio_format_delete( const audio_format & ptr ); inline uint32 audio_format_encoding( const audio_format & ); inline void audio_format_encoding( const audio_format &, uint32 ); inline uint32 audio_format_channels( const audio_format & ); inline void audio_format_channels( const audio_format &, uint32 ); inline uint32 audio_format_bit_resolution( const audio_format & ); inline void audio_format_bit_resolution( const audio_format &, uint32 ); inline uint32 audio_format_sampling_rate( const audio_format & ); inline void audio_format_sampling_rate( const audio_format &, uint32 ); // cls type tempo_track inline tempo_track tempo_track_new( block * p_memory ); inline void tempo_track_construct( const tempo_track & ptr ); inline void tempo_track_destroy( const tempo_track & ptr ); inline void tempo_track_delete( const tempo_track & ptr ); inline float tempo_track_bpm( const tempo_track & ); inline void tempo_track_bpm( const tempo_track &, float ); inline float tempo_track_start_beat( const tempo_track & ); inline void tempo_track_start_beat( const tempo_track &, float ); inline uint32 tempo_track_time_sig_numerator( const tempo_track & ); inline void tempo_track_time_sig_numerator( const tempo_track &, uint32 ); inline uint32 tempo_track_time_sig_denominator( const tempo_track & ); inline void tempo_track_time_sig_denominator( const tempo_track &, uint32 ); // cls type sequence_event inline sequence_event sequence_event_new( block * p_memory ); inline void sequence_event_construct( const sequence_event & ptr ); inline void sequence_event_destroy( const sequence_event & ptr ); inline void sequence_event_delete( const sequence_event & ptr ); inline uint32 sequence_event_type( const sequence_event & ); inline void sequence_event_type( const sequence_event &, uint32 ); // cls type beat_set inline beat_set beat_set_new( block * p_memory ); inline void beat_set_construct( const beat_set & ptr ); inline void beat_set_destroy( const beat_set & ptr ); inline void beat_set_delete( const beat_set & ptr ); inline const float_array beat_set_beats( const beat_set & ); inline void beat_set_beats( const beat_set &, const float_array ); // cls type action inline action action_new( block * p_memory ); inline void action_construct( const action & ptr ); inline void action_destroy( const action & ptr ); inline void action_delete( const action & ptr ); inline uint32 action_type( const action & ); inline void action_type( const action &, uint32 ); // // type safe dereferencing functions // inline void group_ref_construct( const group_ref & ptr ); inline void group_ref_destroy( const group_ref & ptr ); inline group deref( const group_ref & ptr ); inline void rsd_file_ref_construct( const rsd_file_ref & ptr ); inline void rsd_file_ref_destroy( const rsd_file_ref & ptr ); inline rsd_file deref( const rsd_file_ref & ptr ); inline void sequence_event_ref_construct( const sequence_event_ref & ptr ); inline void sequence_event_ref_destroy( const sequence_event_ref & ptr ); inline sequence_event deref( const sequence_event_ref & ptr ); inline void stream_ref_construct( const stream_ref & ptr ); inline void stream_ref_destroy( const stream_ref & ptr ); inline stream deref( const stream_ref & ptr ); inline void clip_ref_construct( const clip_ref & ptr ); inline void clip_ref_destroy( const clip_ref & ptr ); inline clip deref( const clip_ref & ptr ); inline void region_ref_construct( const region_ref & ptr ); inline void region_ref_destroy( const region_ref & ptr ); inline region deref( const region_ref & ptr ); inline void state_ref_construct( const state_ref & ptr ); inline void state_ref_destroy( const state_ref & ptr ); inline state deref( const state_ref & ptr ); inline void action_ref_construct( const action_ref & ptr ); inline void action_ref_destroy( const action_ref & ptr ); inline action deref( const action_ref & ptr ); inline void event_matrix_ref_construct( const event_matrix_ref & ptr ); inline void event_matrix_ref_destroy( const event_matrix_ref & ptr ); inline event_matrix deref( const event_matrix_ref & ptr ); inline void layer_ref_construct( const layer_ref & ptr ); inline void layer_ref_destroy( const layer_ref & ptr ); inline layer deref( const layer_ref & ptr ); inline void sequence_ref_construct( const sequence_ref & ptr ); inline void sequence_ref_destroy( const sequence_ref & ptr ); inline sequence deref( const sequence_ref & ptr ); // // array manipulation functions // inline group_array group_array_new( block * ); inline group_array group_array_delete( const group_array & ); inline void group_array_construct( const group_array & ); inline void group_array_destroy( const group_array & ); inline unsigned int group_array_num_items( const group_array &); inline void group_array_remove_item( const group_array &, unsigned int item); inline const group group_array_item_at( const group_array & ptr, unsigned int index ); inline const group group_array_add_item( const group_array &); inline fade_transition_array fade_transition_array_new( block * ); inline fade_transition_array fade_transition_array_delete( const fade_transition_array & ); inline void fade_transition_array_construct( const fade_transition_array & ); inline void fade_transition_array_destroy( const fade_transition_array & ); inline unsigned int fade_transition_array_num_items( const fade_transition_array &); inline void fade_transition_array_remove_item( const fade_transition_array &, unsigned int item); inline const fade_transition fade_transition_array_item_at( const fade_transition_array & ptr, unsigned int index ); inline const fade_transition fade_transition_array_add_item( const fade_transition_array &); inline stitch_transition_array stitch_transition_array_new( block * ); inline stitch_transition_array stitch_transition_array_delete( const stitch_transition_array & ); inline void stitch_transition_array_construct( const stitch_transition_array & ); inline void stitch_transition_array_destroy( const stitch_transition_array & ); inline unsigned int stitch_transition_array_num_items( const stitch_transition_array &); inline void stitch_transition_array_remove_item( const stitch_transition_array &, unsigned int item); inline const stitch_transition stitch_transition_array_item_at( const stitch_transition_array & ptr, unsigned int index ); inline const stitch_transition stitch_transition_array_add_item( const stitch_transition_array &); inline event_array event_array_new( block * ); inline event_array event_array_delete( const event_array & ); inline void event_array_construct( const event_array & ); inline void event_array_destroy( const event_array & ); inline unsigned int event_array_num_items( const event_array &); inline void event_array_remove_item( const event_array &, unsigned int item); inline const event event_array_item_at( const event_array & ptr, unsigned int index ); inline const event event_array_add_item( const event_array &); inline event_matrix_array event_matrix_array_new( block * ); inline event_matrix_array event_matrix_array_delete( const event_matrix_array & ); inline void event_matrix_array_construct( const event_matrix_array & ); inline void event_matrix_array_destroy( const event_matrix_array & ); inline unsigned int event_matrix_array_num_items( const event_matrix_array &); inline void event_matrix_array_remove_item( const event_matrix_array &, unsigned int item); inline const event_matrix event_matrix_array_item_at( const event_matrix_array & ptr, unsigned int index ); inline const event_matrix event_matrix_array_add_item( const event_matrix_array &); inline state_array state_array_new( block * ); inline state_array state_array_delete( const state_array & ); inline void state_array_construct( const state_array & ); inline void state_array_destroy( const state_array & ); inline unsigned int state_array_num_items( const state_array &); inline void state_array_remove_item( const state_array &, unsigned int item); inline const state state_array_item_at( const state_array & ptr, unsigned int index ); inline const state state_array_add_item( const state_array &); inline rsd_file_array rsd_file_array_new( block * ); inline rsd_file_array rsd_file_array_delete( const rsd_file_array & ); inline void rsd_file_array_construct( const rsd_file_array & ); inline void rsd_file_array_destroy( const rsd_file_array & ); inline unsigned int rsd_file_array_num_items( const rsd_file_array &); inline void rsd_file_array_remove_item( const rsd_file_array &, unsigned int item); inline const rsd_file rsd_file_array_item_at( const rsd_file_array & ptr, unsigned int index ); inline const rsd_file rsd_file_array_add_item( const rsd_file_array &); inline stream_array stream_array_new( block * ); inline stream_array stream_array_delete( const stream_array & ); inline void stream_array_construct( const stream_array & ); inline void stream_array_destroy( const stream_array & ); inline unsigned int stream_array_num_items( const stream_array &); inline void stream_array_remove_item( const stream_array &, unsigned int item); inline const stream stream_array_item_at( const stream_array & ptr, unsigned int index ); inline const stream stream_array_add_item( const stream_array &); inline clip_array clip_array_new( block * ); inline clip_array clip_array_delete( const clip_array & ); inline void clip_array_construct( const clip_array & ); inline void clip_array_destroy( const clip_array & ); inline unsigned int clip_array_num_items( const clip_array &); inline void clip_array_remove_item( const clip_array &, unsigned int item); inline const clip clip_array_item_at( const clip_array & ptr, unsigned int index ); inline const clip clip_array_add_item( const clip_array &); inline region_array region_array_new( block * ); inline region_array region_array_delete( const region_array & ); inline void region_array_construct( const region_array & ); inline void region_array_destroy( const region_array & ); inline unsigned int region_array_num_items( const region_array &); inline void region_array_remove_item( const region_array &, unsigned int item); inline const region region_array_item_at( const region_array & ptr, unsigned int index ); inline const region region_array_add_item( const region_array &); inline sequence_array sequence_array_new( block * ); inline sequence_array sequence_array_delete( const sequence_array & ); inline void sequence_array_construct( const sequence_array & ); inline void sequence_array_destroy( const sequence_array & ); inline unsigned int sequence_array_num_items( const sequence_array &); inline void sequence_array_remove_item( const sequence_array &, unsigned int item); inline const sequence sequence_array_item_at( const sequence_array & ptr, unsigned int index ); inline const sequence sequence_array_add_item( const sequence_array &); inline layer_array layer_array_new( block * ); inline layer_array layer_array_delete( const layer_array & ); inline void layer_array_construct( const layer_array & ); inline void layer_array_destroy( const layer_array & ); inline unsigned int layer_array_num_items( const layer_array &); inline void layer_array_remove_item( const layer_array &, unsigned int item); inline const layer layer_array_item_at( const layer_array & ptr, unsigned int index ); inline const layer layer_array_add_item( const layer_array &); inline event_clip_array event_clip_array_new( block * ); inline event_clip_array event_clip_array_delete( const event_clip_array & ); inline void event_clip_array_construct( const event_clip_array & ); inline void event_clip_array_destroy( const event_clip_array & ); inline unsigned int event_clip_array_num_items( const event_clip_array &); inline void event_clip_array_remove_item( const event_clip_array &, unsigned int item); inline const event_clip event_clip_array_item_at( const event_clip_array & ptr, unsigned int index ); inline const event_clip event_clip_array_add_item( const event_clip_array &); inline event_stream_array event_stream_array_new( block * ); inline event_stream_array event_stream_array_delete( const event_stream_array & ); inline void event_stream_array_construct( const event_stream_array & ); inline void event_stream_array_destroy( const event_stream_array & ); inline unsigned int event_stream_array_num_items( const event_stream_array &); inline void event_stream_array_remove_item( const event_stream_array &, unsigned int item); inline const event_stream event_stream_array_item_at( const event_stream_array & ptr, unsigned int index ); inline const event_stream event_stream_array_add_item( const event_stream_array &); inline event_silence_array event_silence_array_new( block * ); inline event_silence_array event_silence_array_delete( const event_silence_array & ); inline void event_silence_array_construct( const event_silence_array & ); inline void event_silence_array_destroy( const event_silence_array & ); inline unsigned int event_silence_array_num_items( const event_silence_array &); inline void event_silence_array_remove_item( const event_silence_array &, unsigned int item); inline const event_silence event_silence_array_item_at( const event_silence_array & ptr, unsigned int index ); inline const event_silence event_silence_array_add_item( const event_silence_array &); inline event_var_volume_array event_var_volume_array_new( block * ); inline event_var_volume_array event_var_volume_array_delete( const event_var_volume_array & ); inline void event_var_volume_array_construct( const event_var_volume_array & ); inline void event_var_volume_array_destroy( const event_var_volume_array & ); inline unsigned int event_var_volume_array_num_items( const event_var_volume_array &); inline void event_var_volume_array_remove_item( const event_var_volume_array &, unsigned int item); inline const event_var_volume event_var_volume_array_item_at( const event_var_volume_array & ptr, unsigned int index ); inline const event_var_volume event_var_volume_array_add_item( const event_var_volume_array &); inline event_var_pitch_array event_var_pitch_array_new( block * ); inline event_var_pitch_array event_var_pitch_array_delete( const event_var_pitch_array & ); inline void event_var_pitch_array_construct( const event_var_pitch_array & ); inline void event_var_pitch_array_destroy( const event_var_pitch_array & ); inline unsigned int event_var_pitch_array_num_items( const event_var_pitch_array &); inline void event_var_pitch_array_remove_item( const event_var_pitch_array &, unsigned int item); inline const event_var_pitch event_var_pitch_array_item_at( const event_var_pitch_array & ptr, unsigned int index ); inline const event_var_pitch event_var_pitch_array_add_item( const event_var_pitch_array &); inline event_var_volume_rand_min_array event_var_volume_rand_min_array_new( block * ); inline event_var_volume_rand_min_array event_var_volume_rand_min_array_delete( const event_var_volume_rand_min_array & ); inline void event_var_volume_rand_min_array_construct( const event_var_volume_rand_min_array & ); inline void event_var_volume_rand_min_array_destroy( const event_var_volume_rand_min_array & ); inline unsigned int event_var_volume_rand_min_array_num_items( const event_var_volume_rand_min_array &); inline void event_var_volume_rand_min_array_remove_item( const event_var_volume_rand_min_array &, unsigned int item); inline const event_var_volume_rand_min event_var_volume_rand_min_array_item_at( const event_var_volume_rand_min_array & ptr, unsigned int index ); inline const event_var_volume_rand_min event_var_volume_rand_min_array_add_item( const event_var_volume_rand_min_array &); inline event_var_volume_rand_max_array event_var_volume_rand_max_array_new( block * ); inline event_var_volume_rand_max_array event_var_volume_rand_max_array_delete( const event_var_volume_rand_max_array & ); inline void event_var_volume_rand_max_array_construct( const event_var_volume_rand_max_array & ); inline void event_var_volume_rand_max_array_destroy( const event_var_volume_rand_max_array & ); inline unsigned int event_var_volume_rand_max_array_num_items( const event_var_volume_rand_max_array &); inline void event_var_volume_rand_max_array_remove_item( const event_var_volume_rand_max_array &, unsigned int item); inline const event_var_volume_rand_max event_var_volume_rand_max_array_item_at( const event_var_volume_rand_max_array & ptr, unsigned int index ); inline const event_var_volume_rand_max event_var_volume_rand_max_array_add_item( const event_var_volume_rand_max_array &); inline event_var_pitch_rand_min_array event_var_pitch_rand_min_array_new( block * ); inline event_var_pitch_rand_min_array event_var_pitch_rand_min_array_delete( const event_var_pitch_rand_min_array & ); inline void event_var_pitch_rand_min_array_construct( const event_var_pitch_rand_min_array & ); inline void event_var_pitch_rand_min_array_destroy( const event_var_pitch_rand_min_array & ); inline unsigned int event_var_pitch_rand_min_array_num_items( const event_var_pitch_rand_min_array &); inline void event_var_pitch_rand_min_array_remove_item( const event_var_pitch_rand_min_array &, unsigned int item); inline const event_var_pitch_rand_min event_var_pitch_rand_min_array_item_at( const event_var_pitch_rand_min_array & ptr, unsigned int index ); inline const event_var_pitch_rand_min event_var_pitch_rand_min_array_add_item( const event_var_pitch_rand_min_array &); inline event_var_pitch_rand_max_array event_var_pitch_rand_max_array_new( block * ); inline event_var_pitch_rand_max_array event_var_pitch_rand_max_array_delete( const event_var_pitch_rand_max_array & ); inline void event_var_pitch_rand_max_array_construct( const event_var_pitch_rand_max_array & ); inline void event_var_pitch_rand_max_array_destroy( const event_var_pitch_rand_max_array & ); inline unsigned int event_var_pitch_rand_max_array_num_items( const event_var_pitch_rand_max_array &); inline void event_var_pitch_rand_max_array_remove_item( const event_var_pitch_rand_max_array &, unsigned int item); inline const event_var_pitch_rand_max event_var_pitch_rand_max_array_item_at( const event_var_pitch_rand_max_array & ptr, unsigned int index ); inline const event_var_pitch_rand_max event_var_pitch_rand_max_array_add_item( const event_var_pitch_rand_max_array &); inline event_var_aux_gain_array event_var_aux_gain_array_new( block * ); inline event_var_aux_gain_array event_var_aux_gain_array_delete( const event_var_aux_gain_array & ); inline void event_var_aux_gain_array_construct( const event_var_aux_gain_array & ); inline void event_var_aux_gain_array_destroy( const event_var_aux_gain_array & ); inline unsigned int event_var_aux_gain_array_num_items( const event_var_aux_gain_array &); inline void event_var_aux_gain_array_remove_item( const event_var_aux_gain_array &, unsigned int item); inline const event_var_aux_gain event_var_aux_gain_array_item_at( const event_var_aux_gain_array & ptr, unsigned int index ); inline const event_var_aux_gain event_var_aux_gain_array_add_item( const event_var_aux_gain_array &); inline event_var_positional_array event_var_positional_array_new( block * ); inline event_var_positional_array event_var_positional_array_delete( const event_var_positional_array & ); inline void event_var_positional_array_construct( const event_var_positional_array & ); inline void event_var_positional_array_destroy( const event_var_positional_array & ); inline unsigned int event_var_positional_array_num_items( const event_var_positional_array &); inline void event_var_positional_array_remove_item( const event_var_positional_array &, unsigned int item); inline const event_var_positional event_var_positional_array_item_at( const event_var_positional_array & ptr, unsigned int index ); inline const event_var_positional event_var_positional_array_add_item( const event_var_positional_array &); inline event_var_pos_fall_off_array event_var_pos_fall_off_array_new( block * ); inline event_var_pos_fall_off_array event_var_pos_fall_off_array_delete( const event_var_pos_fall_off_array & ); inline void event_var_pos_fall_off_array_construct( const event_var_pos_fall_off_array & ); inline void event_var_pos_fall_off_array_destroy( const event_var_pos_fall_off_array & ); inline unsigned int event_var_pos_fall_off_array_num_items( const event_var_pos_fall_off_array &); inline void event_var_pos_fall_off_array_remove_item( const event_var_pos_fall_off_array &, unsigned int item); inline const event_var_pos_fall_off event_var_pos_fall_off_array_item_at( const event_var_pos_fall_off_array & ptr, unsigned int index ); inline const event_var_pos_fall_off event_var_pos_fall_off_array_add_item( const event_var_pos_fall_off_array &); inline event_var_pos_dist_min_array event_var_pos_dist_min_array_new( block * ); inline event_var_pos_dist_min_array event_var_pos_dist_min_array_delete( const event_var_pos_dist_min_array & ); inline void event_var_pos_dist_min_array_construct( const event_var_pos_dist_min_array & ); inline void event_var_pos_dist_min_array_destroy( const event_var_pos_dist_min_array & ); inline unsigned int event_var_pos_dist_min_array_num_items( const event_var_pos_dist_min_array &); inline void event_var_pos_dist_min_array_remove_item( const event_var_pos_dist_min_array &, unsigned int item); inline const event_var_pos_dist_min event_var_pos_dist_min_array_item_at( const event_var_pos_dist_min_array & ptr, unsigned int index ); inline const event_var_pos_dist_min event_var_pos_dist_min_array_add_item( const event_var_pos_dist_min_array &); inline event_var_pos_dist_max_array event_var_pos_dist_max_array_new( block * ); inline event_var_pos_dist_max_array event_var_pos_dist_max_array_delete( const event_var_pos_dist_max_array & ); inline void event_var_pos_dist_max_array_construct( const event_var_pos_dist_max_array & ); inline void event_var_pos_dist_max_array_destroy( const event_var_pos_dist_max_array & ); inline unsigned int event_var_pos_dist_max_array_num_items( const event_var_pos_dist_max_array &); inline void event_var_pos_dist_max_array_remove_item( const event_var_pos_dist_max_array &, unsigned int item); inline const event_var_pos_dist_max event_var_pos_dist_max_array_item_at( const event_var_pos_dist_max_array & ptr, unsigned int index ); inline const event_var_pos_dist_max event_var_pos_dist_max_array_add_item( const event_var_pos_dist_max_array &); inline event_callback_array event_callback_array_new( block * ); inline event_callback_array event_callback_array_delete( const event_callback_array & ); inline void event_callback_array_construct( const event_callback_array & ); inline void event_callback_array_destroy( const event_callback_array & ); inline unsigned int event_callback_array_num_items( const event_callback_array &); inline void event_callback_array_remove_item( const event_callback_array &, unsigned int item); inline const event_callback event_callback_array_item_at( const event_callback_array & ptr, unsigned int index ); inline const event_callback event_callback_array_add_item( const event_callback_array &); inline event_logic_and_array event_logic_and_array_new( block * ); inline event_logic_and_array event_logic_and_array_delete( const event_logic_and_array & ); inline void event_logic_and_array_construct( const event_logic_and_array & ); inline void event_logic_and_array_destroy( const event_logic_and_array & ); inline unsigned int event_logic_and_array_num_items( const event_logic_and_array &); inline void event_logic_and_array_remove_item( const event_logic_and_array &, unsigned int item); inline const event_logic_and event_logic_and_array_item_at( const event_logic_and_array & ptr, unsigned int index ); inline const event_logic_and event_logic_and_array_add_item( const event_logic_and_array &); inline event_logic_or_array event_logic_or_array_new( block * ); inline event_logic_or_array event_logic_or_array_delete( const event_logic_or_array & ); inline void event_logic_or_array_construct( const event_logic_or_array & ); inline void event_logic_or_array_destroy( const event_logic_or_array & ); inline unsigned int event_logic_or_array_num_items( const event_logic_or_array &); inline void event_logic_or_array_remove_item( const event_logic_or_array &, unsigned int item); inline const event_logic_or event_logic_or_array_item_at( const event_logic_or_array & ptr, unsigned int index ); inline const event_logic_or event_logic_or_array_add_item( const event_logic_or_array &); inline event_logic_repeat_array event_logic_repeat_array_new( block * ); inline event_logic_repeat_array event_logic_repeat_array_delete( const event_logic_repeat_array & ); inline void event_logic_repeat_array_construct( const event_logic_repeat_array & ); inline void event_logic_repeat_array_destroy( const event_logic_repeat_array & ); inline unsigned int event_logic_repeat_array_num_items( const event_logic_repeat_array &); inline void event_logic_repeat_array_remove_item( const event_logic_repeat_array &, unsigned int item); inline const event_logic_repeat event_logic_repeat_array_item_at( const event_logic_repeat_array & ptr, unsigned int index ); inline const event_logic_repeat event_logic_repeat_array_add_item( const event_logic_repeat_array &); inline play_region_action_array play_region_action_array_new( block * ); inline play_region_action_array play_region_action_array_delete( const play_region_action_array & ); inline void play_region_action_array_construct( const play_region_action_array & ); inline void play_region_action_array_destroy( const play_region_action_array & ); inline unsigned int play_region_action_array_num_items( const play_region_action_array &); inline void play_region_action_array_remove_item( const play_region_action_array &, unsigned int item); inline const play_region_action play_region_action_array_item_at( const play_region_action_array & ptr, unsigned int index ); inline const play_region_action play_region_action_array_add_item( const play_region_action_array &); inline push_region_action_array push_region_action_array_new( block * ); inline push_region_action_array push_region_action_array_delete( const push_region_action_array & ); inline void push_region_action_array_construct( const push_region_action_array & ); inline void push_region_action_array_destroy( const push_region_action_array & ); inline unsigned int push_region_action_array_num_items( const push_region_action_array &); inline void push_region_action_array_remove_item( const push_region_action_array &, unsigned int item); inline const push_region_action push_region_action_array_item_at( const push_region_action_array & ptr, unsigned int index ); inline const push_region_action push_region_action_array_add_item( const push_region_action_array &); inline pop_region_action_array pop_region_action_array_new( block * ); inline pop_region_action_array pop_region_action_array_delete( const pop_region_action_array & ); inline void pop_region_action_array_construct( const pop_region_action_array & ); inline void pop_region_action_array_destroy( const pop_region_action_array & ); inline unsigned int pop_region_action_array_num_items( const pop_region_action_array &); inline void pop_region_action_array_remove_item( const pop_region_action_array &, unsigned int item); inline const pop_region_action pop_region_action_array_item_at( const pop_region_action_array & ptr, unsigned int index ); inline const pop_region_action pop_region_action_array_add_item( const pop_region_action_array &); inline start_layer_action_array start_layer_action_array_new( block * ); inline start_layer_action_array start_layer_action_array_delete( const start_layer_action_array & ); inline void start_layer_action_array_construct( const start_layer_action_array & ); inline void start_layer_action_array_destroy( const start_layer_action_array & ); inline unsigned int start_layer_action_array_num_items( const start_layer_action_array &); inline void start_layer_action_array_remove_item( const start_layer_action_array &, unsigned int item); inline const start_layer_action start_layer_action_array_item_at( const start_layer_action_array & ptr, unsigned int index ); inline const start_layer_action start_layer_action_array_add_item( const start_layer_action_array &); inline stop_layer_action_array stop_layer_action_array_new( block * ); inline stop_layer_action_array stop_layer_action_array_delete( const stop_layer_action_array & ); inline void stop_layer_action_array_construct( const stop_layer_action_array & ); inline void stop_layer_action_array_destroy( const stop_layer_action_array & ); inline unsigned int stop_layer_action_array_num_items( const stop_layer_action_array &); inline void stop_layer_action_array_remove_item( const stop_layer_action_array &, unsigned int item); inline const stop_layer_action stop_layer_action_array_item_at( const stop_layer_action_array & ptr, unsigned int index ); inline const stop_layer_action stop_layer_action_array_add_item( const stop_layer_action_array &); inline rand_state_action_array rand_state_action_array_new( block * ); inline rand_state_action_array rand_state_action_array_delete( const rand_state_action_array & ); inline void rand_state_action_array_construct( const rand_state_action_array & ); inline void rand_state_action_array_destroy( const rand_state_action_array & ); inline unsigned int rand_state_action_array_num_items( const rand_state_action_array &); inline void rand_state_action_array_remove_item( const rand_state_action_array &, unsigned int item); inline const rand_state_action rand_state_action_array_item_at( const rand_state_action_array & ptr, unsigned int index ); inline const rand_state_action rand_state_action_array_add_item( const rand_state_action_array &); inline stream_ref_array stream_ref_array_new( block * ); inline stream_ref_array stream_ref_array_delete( const stream_ref_array & ); inline void stream_ref_array_construct( const stream_ref_array & ); inline void stream_ref_array_destroy( const stream_ref_array & ); inline unsigned int stream_ref_array_num_items( const stream_ref_array &); inline void stream_ref_array_remove_item( const stream_ref_array &, unsigned int item); inline const stream stream_ref_array_item_at( const stream_ref_array & ptr, unsigned int index ); inline void stream_ref_array_add_item( const stream_ref_array &, const stream & ptr_item); inline clip_ref_array clip_ref_array_new( block * ); inline clip_ref_array clip_ref_array_delete( const clip_ref_array & ); inline void clip_ref_array_construct( const clip_ref_array & ); inline void clip_ref_array_destroy( const clip_ref_array & ); inline unsigned int clip_ref_array_num_items( const clip_ref_array &); inline void clip_ref_array_remove_item( const clip_ref_array &, unsigned int item); inline const clip clip_ref_array_item_at( const clip_ref_array & ptr, unsigned int index ); inline void clip_ref_array_add_item( const clip_ref_array &, const clip & ptr_item); inline region_ref_array region_ref_array_new( block * ); inline region_ref_array region_ref_array_delete( const region_ref_array & ); inline void region_ref_array_construct( const region_ref_array & ); inline void region_ref_array_destroy( const region_ref_array & ); inline unsigned int region_ref_array_num_items( const region_ref_array &); inline void region_ref_array_remove_item( const region_ref_array &, unsigned int item); inline const region region_ref_array_item_at( const region_ref_array & ptr, unsigned int index ); inline void region_ref_array_add_item( const region_ref_array &, const region & ptr_item); inline state_ref_array state_ref_array_new( block * ); inline state_ref_array state_ref_array_delete( const state_ref_array & ); inline void state_ref_array_construct( const state_ref_array & ); inline void state_ref_array_destroy( const state_ref_array & ); inline unsigned int state_ref_array_num_items( const state_ref_array &); inline void state_ref_array_remove_item( const state_ref_array &, unsigned int item); inline const state state_ref_array_item_at( const state_ref_array & ptr, unsigned int index ); inline void state_ref_array_add_item( const state_ref_array &, const state & ptr_item); inline action_ref_array action_ref_array_new( block * ); inline action_ref_array action_ref_array_delete( const action_ref_array & ); inline void action_ref_array_construct( const action_ref_array & ); inline void action_ref_array_destroy( const action_ref_array & ); inline unsigned int action_ref_array_num_items( const action_ref_array &); inline void action_ref_array_remove_item( const action_ref_array &, unsigned int item); inline const action action_ref_array_item_at( const action_ref_array & ptr, unsigned int index ); inline void action_ref_array_add_item( const action_ref_array &, const action & ptr_item); inline action_ref_array_array action_ref_array_array_new( block * ); inline action_ref_array_array action_ref_array_array_delete( const action_ref_array_array & ); inline void action_ref_array_array_construct( const action_ref_array_array & ); inline void action_ref_array_array_destroy( const action_ref_array_array & ); inline unsigned int action_ref_array_array_num_items( const action_ref_array_array &); inline void action_ref_array_array_remove_item( const action_ref_array_array &, unsigned int item); inline const action_ref_array action_ref_array_array_item_at( const action_ref_array_array & ptr, unsigned int index ); inline const action_ref_array action_ref_array_array_add_item( const action_ref_array_array &); inline string_array string_array_new( block * ); inline string_array string_array_delete( const string_array & ); inline void string_array_construct( const string_array & ); inline void string_array_destroy( const string_array & ); inline unsigned int string_array_num_items( const string_array &); inline void string_array_remove_item( const string_array &, unsigned int item); inline void string_array_item_at( const string_array & ptr, unsigned int index, char * p_string, unsigned int len ); inline void string_array_item_at( const string_array & ptr, unsigned int index, const char * p_new_val ); inline void string_array_add_item( const string_array &, const char * p_string ); inline layer_ref_array layer_ref_array_new( block * ); inline layer_ref_array layer_ref_array_delete( const layer_ref_array & ); inline void layer_ref_array_construct( const layer_ref_array & ); inline void layer_ref_array_destroy( const layer_ref_array & ); inline unsigned int layer_ref_array_num_items( const layer_ref_array &); inline void layer_ref_array_remove_item( const layer_ref_array &, unsigned int item); inline const layer layer_ref_array_item_at( const layer_ref_array & ptr, unsigned int index ); inline void layer_ref_array_add_item( const layer_ref_array &, const layer & ptr_item); inline float_array float_array_new( block * ); inline float_array float_array_delete( const float_array & ); inline void float_array_construct( const float_array & ); inline void float_array_destroy( const float_array & ); inline unsigned int float_array_num_items( const float_array &); inline void float_array_remove_item( const float_array &, unsigned int item); inline const float float_array_item_at( const float_array & ptr, unsigned int index ); inline void float_array_add_item( const float_array &, float item); inline sequence_event_ref_array sequence_event_ref_array_new( block * ); inline sequence_event_ref_array sequence_event_ref_array_delete( const sequence_event_ref_array & ); inline void sequence_event_ref_array_construct( const sequence_event_ref_array & ); inline void sequence_event_ref_array_destroy( const sequence_event_ref_array & ); inline unsigned int sequence_event_ref_array_num_items( const sequence_event_ref_array &); inline void sequence_event_ref_array_remove_item( const sequence_event_ref_array &, unsigned int item); inline const sequence_event sequence_event_ref_array_item_at( const sequence_event_ref_array & ptr, unsigned int index ); inline void sequence_event_ref_array_add_item( const sequence_event_ref_array &, const sequence_event & ptr_item); // // class attribute accessor definitions // // cls type comp inline comp comp_new( block * p_memory ) { comp ptr = (comp) block_alloc( p_memory, 1248, "comp" ) ; comp_construct( ptr ); return ptr; } inline void comp_construct( const comp & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); group_array_construct( pointer_templ< _group_array>( ptr.memory( ), ptr.offset( ) + 96 ) ); fade_transition_array_construct( pointer_templ< _fade_transition_array>( ptr.memory( ), ptr.offset( ) + 128 ) ); stitch_transition_array_construct( pointer_templ< _stitch_transition_array>( ptr.memory( ), ptr.offset( ) + 160 ) ); event_array_construct( pointer_templ< _event_array>( ptr.memory( ), ptr.offset( ) + 192 ) ); event_matrix_array_construct( pointer_templ< _event_matrix_array>( ptr.memory( ), ptr.offset( ) + 224 ) ); state_array_construct( pointer_templ< _state_array>( ptr.memory( ), ptr.offset( ) + 256 ) ); rsd_file_array_construct( pointer_templ< _rsd_file_array>( ptr.memory( ), ptr.offset( ) + 288 ) ); stream_array_construct( pointer_templ< _stream_array>( ptr.memory( ), ptr.offset( ) + 320 ) ); clip_array_construct( pointer_templ< _clip_array>( ptr.memory( ), ptr.offset( ) + 352 ) ); region_array_construct( pointer_templ< _region_array>( ptr.memory( ), ptr.offset( ) + 384 ) ); sequence_array_construct( pointer_templ< _sequence_array>( ptr.memory( ), ptr.offset( ) + 416 ) ); layer_array_construct( pointer_templ< _layer_array>( ptr.memory( ), ptr.offset( ) + 448 ) ); event_clip_array_construct( pointer_templ< _event_clip_array>( ptr.memory( ), ptr.offset( ) + 480 ) ); event_stream_array_construct( pointer_templ< _event_stream_array>( ptr.memory( ), ptr.offset( ) + 512 ) ); event_silence_array_construct( pointer_templ< _event_silence_array>( ptr.memory( ), ptr.offset( ) + 544 ) ); event_var_volume_array_construct( pointer_templ< _event_var_volume_array>( ptr.memory( ), ptr.offset( ) + 576 ) ); event_var_pitch_array_construct( pointer_templ< _event_var_pitch_array>( ptr.memory( ), ptr.offset( ) + 608 ) ); event_var_volume_rand_min_array_construct( pointer_templ< _event_var_volume_rand_min_array>( ptr.memory( ), ptr.offset( ) + 640 ) ); event_var_volume_rand_max_array_construct( pointer_templ< _event_var_volume_rand_max_array>( ptr.memory( ), ptr.offset( ) + 672 ) ); event_var_pitch_rand_min_array_construct( pointer_templ< _event_var_pitch_rand_min_array>( ptr.memory( ), ptr.offset( ) + 704 ) ); event_var_pitch_rand_max_array_construct( pointer_templ< _event_var_pitch_rand_max_array>( ptr.memory( ), ptr.offset( ) + 736 ) ); event_var_aux_gain_array_construct( pointer_templ< _event_var_aux_gain_array>( ptr.memory( ), ptr.offset( ) + 768 ) ); event_var_positional_array_construct( pointer_templ< _event_var_positional_array>( ptr.memory( ), ptr.offset( ) + 800 ) ); event_var_pos_fall_off_array_construct( pointer_templ< _event_var_pos_fall_off_array>( ptr.memory( ), ptr.offset( ) + 832 ) ); event_var_pos_dist_min_array_construct( pointer_templ< _event_var_pos_dist_min_array>( ptr.memory( ), ptr.offset( ) + 864 ) ); event_var_pos_dist_max_array_construct( pointer_templ< _event_var_pos_dist_max_array>( ptr.memory( ), ptr.offset( ) + 896 ) ); event_callback_array_construct( pointer_templ< _event_callback_array>( ptr.memory( ), ptr.offset( ) + 928 ) ); event_logic_and_array_construct( pointer_templ< _event_logic_and_array>( ptr.memory( ), ptr.offset( ) + 960 ) ); event_logic_or_array_construct( pointer_templ< _event_logic_or_array>( ptr.memory( ), ptr.offset( ) + 992 ) ); event_logic_repeat_array_construct( pointer_templ< _event_logic_repeat_array>( ptr.memory( ), ptr.offset( ) + 1024 ) ); play_region_action_array_construct( pointer_templ< _play_region_action_array>( ptr.memory( ), ptr.offset( ) + 1056 ) ); push_region_action_array_construct( pointer_templ< _push_region_action_array>( ptr.memory( ), ptr.offset( ) + 1088 ) ); pop_region_action_array_construct( pointer_templ< _pop_region_action_array>( ptr.memory( ), ptr.offset( ) + 1120 ) ); start_layer_action_array_construct( pointer_templ< _start_layer_action_array>( ptr.memory( ), ptr.offset( ) + 1152 ) ); stop_layer_action_array_construct( pointer_templ< _stop_layer_action_array>( ptr.memory( ), ptr.offset( ) + 1184 ) ); rand_state_action_array_construct( pointer_templ< _rand_state_action_array>( ptr.memory( ), ptr.offset( ) + 1216 ) ); } inline void comp_destroy( const comp & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); group_array_destroy( pointer_templ< _group_array>( ptr.memory( ), ptr.offset( ) + 96 ) ); fade_transition_array_destroy( pointer_templ< _fade_transition_array>( ptr.memory( ), ptr.offset( ) + 128 ) ); stitch_transition_array_destroy( pointer_templ< _stitch_transition_array>( ptr.memory( ), ptr.offset( ) + 160 ) ); event_array_destroy( pointer_templ< _event_array>( ptr.memory( ), ptr.offset( ) + 192 ) ); event_matrix_array_destroy( pointer_templ< _event_matrix_array>( ptr.memory( ), ptr.offset( ) + 224 ) ); state_array_destroy( pointer_templ< _state_array>( ptr.memory( ), ptr.offset( ) + 256 ) ); rsd_file_array_destroy( pointer_templ< _rsd_file_array>( ptr.memory( ), ptr.offset( ) + 288 ) ); stream_array_destroy( pointer_templ< _stream_array>( ptr.memory( ), ptr.offset( ) + 320 ) ); clip_array_destroy( pointer_templ< _clip_array>( ptr.memory( ), ptr.offset( ) + 352 ) ); region_array_destroy( pointer_templ< _region_array>( ptr.memory( ), ptr.offset( ) + 384 ) ); sequence_array_destroy( pointer_templ< _sequence_array>( ptr.memory( ), ptr.offset( ) + 416 ) ); layer_array_destroy( pointer_templ< _layer_array>( ptr.memory( ), ptr.offset( ) + 448 ) ); event_clip_array_destroy( pointer_templ< _event_clip_array>( ptr.memory( ), ptr.offset( ) + 480 ) ); event_stream_array_destroy( pointer_templ< _event_stream_array>( ptr.memory( ), ptr.offset( ) + 512 ) ); event_silence_array_destroy( pointer_templ< _event_silence_array>( ptr.memory( ), ptr.offset( ) + 544 ) ); event_var_volume_array_destroy( pointer_templ< _event_var_volume_array>( ptr.memory( ), ptr.offset( ) + 576 ) ); event_var_pitch_array_destroy( pointer_templ< _event_var_pitch_array>( ptr.memory( ), ptr.offset( ) + 608 ) ); event_var_volume_rand_min_array_destroy( pointer_templ< _event_var_volume_rand_min_array>( ptr.memory( ), ptr.offset( ) + 640 ) ); event_var_volume_rand_max_array_destroy( pointer_templ< _event_var_volume_rand_max_array>( ptr.memory( ), ptr.offset( ) + 672 ) ); event_var_pitch_rand_min_array_destroy( pointer_templ< _event_var_pitch_rand_min_array>( ptr.memory( ), ptr.offset( ) + 704 ) ); event_var_pitch_rand_max_array_destroy( pointer_templ< _event_var_pitch_rand_max_array>( ptr.memory( ), ptr.offset( ) + 736 ) ); event_var_aux_gain_array_destroy( pointer_templ< _event_var_aux_gain_array>( ptr.memory( ), ptr.offset( ) + 768 ) ); event_var_positional_array_destroy( pointer_templ< _event_var_positional_array>( ptr.memory( ), ptr.offset( ) + 800 ) ); event_var_pos_fall_off_array_destroy( pointer_templ< _event_var_pos_fall_off_array>( ptr.memory( ), ptr.offset( ) + 832 ) ); event_var_pos_dist_min_array_destroy( pointer_templ< _event_var_pos_dist_min_array>( ptr.memory( ), ptr.offset( ) + 864 ) ); event_var_pos_dist_max_array_destroy( pointer_templ< _event_var_pos_dist_max_array>( ptr.memory( ), ptr.offset( ) + 896 ) ); event_callback_array_destroy( pointer_templ< _event_callback_array>( ptr.memory( ), ptr.offset( ) + 928 ) ); event_logic_and_array_destroy( pointer_templ< _event_logic_and_array>( ptr.memory( ), ptr.offset( ) + 960 ) ); event_logic_or_array_destroy( pointer_templ< _event_logic_or_array>( ptr.memory( ), ptr.offset( ) + 992 ) ); event_logic_repeat_array_destroy( pointer_templ< _event_logic_repeat_array>( ptr.memory( ), ptr.offset( ) + 1024 ) ); play_region_action_array_destroy( pointer_templ< _play_region_action_array>( ptr.memory( ), ptr.offset( ) + 1056 ) ); push_region_action_array_destroy( pointer_templ< _push_region_action_array>( ptr.memory( ), ptr.offset( ) + 1088 ) ); pop_region_action_array_destroy( pointer_templ< _pop_region_action_array>( ptr.memory( ), ptr.offset( ) + 1120 ) ); start_layer_action_array_destroy( pointer_templ< _start_layer_action_array>( ptr.memory( ), ptr.offset( ) + 1152 ) ); stop_layer_action_array_destroy( pointer_templ< _stop_layer_action_array>( ptr.memory( ), ptr.offset( ) + 1184 ) ); rand_state_action_array_destroy( pointer_templ< _rand_state_action_array>( ptr.memory( ), ptr.offset( ) + 1216 ) ); } inline void comp_delete( const comp & ptr ) { comp_destroy( ptr ); block_free( ptr, 1248 ); } inline uint32 comp_sound_memory_max( const comp & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void comp_sound_memory_max( const comp & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline uint32 comp_cache_memory_max( const comp & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void comp_cache_memory_max( const comp & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline uint32 comp_stream_size_min( const comp & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void comp_stream_size_min( const comp & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } inline const group_array comp_root_groups( const comp & ptr) { return pointer_templ< _group_array>( ptr.memory( ), ptr.offset( ) + 96 ); } inline const fade_transition_array comp_fade_transitions( const comp & ptr) { return pointer_templ< _fade_transition_array>( ptr.memory( ), ptr.offset( ) + 128 ); } inline const stitch_transition_array comp_stitch_transitions( const comp & ptr) { return pointer_templ< _stitch_transition_array>( ptr.memory( ), ptr.offset( ) + 160 ); } inline const event_array comp_events( const comp & ptr) { return pointer_templ< _event_array>( ptr.memory( ), ptr.offset( ) + 192 ); } inline const event_matrix_array comp_event_matricies( const comp & ptr) { return pointer_templ< _event_matrix_array>( ptr.memory( ), ptr.offset( ) + 224 ); } inline const state_array comp_states( const comp & ptr) { return pointer_templ< _state_array>( ptr.memory( ), ptr.offset( ) + 256 ); } inline const rsd_file_array comp_rsd_files( const comp & ptr) { return pointer_templ< _rsd_file_array>( ptr.memory( ), ptr.offset( ) + 288 ); } inline const stream_array comp_streams( const comp & ptr) { return pointer_templ< _stream_array>( ptr.memory( ), ptr.offset( ) + 320 ); } inline const clip_array comp_clips( const comp & ptr) { return pointer_templ< _clip_array>( ptr.memory( ), ptr.offset( ) + 352 ); } inline const region_array comp_regions( const comp & ptr) { return pointer_templ< _region_array>( ptr.memory( ), ptr.offset( ) + 384 ); } inline const sequence_array comp_sequences( const comp & ptr) { return pointer_templ< _sequence_array>( ptr.memory( ), ptr.offset( ) + 416 ); } inline const layer_array comp_layers( const comp & ptr) { return pointer_templ< _layer_array>( ptr.memory( ), ptr.offset( ) + 448 ); } inline const event_clip_array comp_event_clip_array( const comp & ptr) { return pointer_templ< _event_clip_array>( ptr.memory( ), ptr.offset( ) + 480 ); } inline const event_stream_array comp_event_stream_array( const comp & ptr) { return pointer_templ< _event_stream_array>( ptr.memory( ), ptr.offset( ) + 512 ); } inline const event_silence_array comp_event_silence_array( const comp & ptr) { return pointer_templ< _event_silence_array>( ptr.memory( ), ptr.offset( ) + 544 ); } inline const event_var_volume_array comp_event_var_volume_array( const comp & ptr) { return pointer_templ< _event_var_volume_array>( ptr.memory( ), ptr.offset( ) + 576 ); } inline const event_var_pitch_array comp_event_var_pitch_array( const comp & ptr) { return pointer_templ< _event_var_pitch_array>( ptr.memory( ), ptr.offset( ) + 608 ); } inline const event_var_volume_rand_min_array comp_event_var_volume_rand_min_array( const comp & ptr) { return pointer_templ< _event_var_volume_rand_min_array>( ptr.memory( ), ptr.offset( ) + 640 ); } inline const event_var_volume_rand_max_array comp_event_var_volume_rand_max_array( const comp & ptr) { return pointer_templ< _event_var_volume_rand_max_array>( ptr.memory( ), ptr.offset( ) + 672 ); } inline const event_var_pitch_rand_min_array comp_event_var_pitch_rand_min_array( const comp & ptr) { return pointer_templ< _event_var_pitch_rand_min_array>( ptr.memory( ), ptr.offset( ) + 704 ); } inline const event_var_pitch_rand_max_array comp_event_var_pitch_rand_max_array( const comp & ptr) { return pointer_templ< _event_var_pitch_rand_max_array>( ptr.memory( ), ptr.offset( ) + 736 ); } inline const event_var_aux_gain_array comp_event_var_aux_gain_array( const comp & ptr) { return pointer_templ< _event_var_aux_gain_array>( ptr.memory( ), ptr.offset( ) + 768 ); } inline const event_var_positional_array comp_event_var_positional_array( const comp & ptr) { return pointer_templ< _event_var_positional_array>( ptr.memory( ), ptr.offset( ) + 800 ); } inline const event_var_pos_fall_off_array comp_event_var_pos_fall_off_array( const comp & ptr) { return pointer_templ< _event_var_pos_fall_off_array>( ptr.memory( ), ptr.offset( ) + 832 ); } inline const event_var_pos_dist_min_array comp_event_var_pos_dist_min_array( const comp & ptr) { return pointer_templ< _event_var_pos_dist_min_array>( ptr.memory( ), ptr.offset( ) + 864 ); } inline const event_var_pos_dist_max_array comp_event_var_pos_dist_max_array( const comp & ptr) { return pointer_templ< _event_var_pos_dist_max_array>( ptr.memory( ), ptr.offset( ) + 896 ); } inline const event_callback_array comp_event_callback_array( const comp & ptr) { return pointer_templ< _event_callback_array>( ptr.memory( ), ptr.offset( ) + 928 ); } inline const event_logic_and_array comp_event_logic_and_array( const comp & ptr) { return pointer_templ< _event_logic_and_array>( ptr.memory( ), ptr.offset( ) + 960 ); } inline const event_logic_or_array comp_event_logic_or_array( const comp & ptr) { return pointer_templ< _event_logic_or_array>( ptr.memory( ), ptr.offset( ) + 992 ); } inline const event_logic_repeat_array comp_event_logic_repeat_array( const comp & ptr) { return pointer_templ< _event_logic_repeat_array>( ptr.memory( ), ptr.offset( ) + 1024 ); } inline const play_region_action_array comp_play_region_action_array( const comp & ptr) { return pointer_templ< _play_region_action_array>( ptr.memory( ), ptr.offset( ) + 1056 ); } inline const push_region_action_array comp_push_region_action_array( const comp & ptr) { return pointer_templ< _push_region_action_array>( ptr.memory( ), ptr.offset( ) + 1088 ); } inline const pop_region_action_array comp_pop_region_action_array( const comp & ptr) { return pointer_templ< _pop_region_action_array>( ptr.memory( ), ptr.offset( ) + 1120 ); } inline const start_layer_action_array comp_start_layer_action_array( const comp & ptr) { return pointer_templ< _start_layer_action_array>( ptr.memory( ), ptr.offset( ) + 1152 ); } inline const stop_layer_action_array comp_stop_layer_action_array( const comp & ptr) { return pointer_templ< _stop_layer_action_array>( ptr.memory( ), ptr.offset( ) + 1184 ); } inline const rand_state_action_array comp_rand_state_action_array( const comp & ptr) { return pointer_templ< _rand_state_action_array>( ptr.memory( ), ptr.offset( ) + 1216 ); } // cls type group inline group group_new( block * p_memory ) { group ptr = (group) block_alloc( p_memory, 224, "group" ) ; group_construct( ptr ); return ptr; } inline void group_construct( const group & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); group_array_construct( pointer_templ< _group_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); stream_ref_array_construct( pointer_templ< _stream_ref_array>( ptr.memory( ), ptr.offset( ) + 64 ) ); clip_ref_array_construct( pointer_templ< _clip_ref_array>( ptr.memory( ), ptr.offset( ) + 96 ) ); region_ref_array_construct( pointer_templ< _region_ref_array>( ptr.memory( ), ptr.offset( ) + 128 ) ); group_ref_construct( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 160 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 192 ) ); } inline void group_destroy( const group & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); group_array_destroy( pointer_templ< _group_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); stream_ref_array_destroy( pointer_templ< _stream_ref_array>( ptr.memory( ), ptr.offset( ) + 64 ) ); clip_ref_array_destroy( pointer_templ< _clip_ref_array>( ptr.memory( ), ptr.offset( ) + 96 ) ); region_ref_array_destroy( pointer_templ< _region_ref_array>( ptr.memory( ), ptr.offset( ) + 128 ) ); group_ref_destroy( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 160 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 192 ) ); } inline void group_delete( const group & ptr ) { group_destroy( ptr ); block_free( ptr, 224 ); } inline void group_name( const group & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void group_name( const group & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline const group_array group_children( const group & ptr) { return pointer_templ< _group_array>( ptr.memory( ), ptr.offset( ) + 32 ); } inline const stream_ref_array group_stream_refs( const group & ptr) { return pointer_templ< _stream_ref_array>( ptr.memory( ), ptr.offset( ) + 64 ); } inline const clip_ref_array group_clip_refs( const group & ptr) { return pointer_templ< _clip_ref_array>( ptr.memory( ), ptr.offset( ) + 96 ); } inline const region_ref_array group_region_refs( const group & ptr) { return pointer_templ< _region_ref_array>( ptr.memory( ), ptr.offset( ) + 128 ); } inline const group group_parent_ref( const group & ptr) { return (group) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 160 ) ); } inline void group_parent_ref( const group & ptr, const group & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 160 ), ptr_item ); } inline uint32 group_tree_depth( const group & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 192 ) ); } inline void group_tree_depth( const group & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 192 ), value ); } // cls type fade_transition inline fade_transition fade_transition_new( block * p_memory ) { fade_transition ptr = (fade_transition) block_alloc( p_memory, 224, "fade_transition" ) ; fade_transition_construct( ptr ); return ptr; } inline void fade_transition_construct( const fade_transition & ptr ) { region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 128 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 160 ) ); beat_set_construct( pointer_templ< _beat_set>( ptr.memory( ), ptr.offset( ) + 192 ) ); } inline void fade_transition_destroy( const fade_transition & ptr ) { region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 128 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 160 ) ); beat_set_destroy( pointer_templ< _beat_set>( ptr.memory( ), ptr.offset( ) + 192 ) ); } inline void fade_transition_delete( const fade_transition & ptr ) { fade_transition_destroy( ptr ); block_free( ptr, 224 ); } inline const region fade_transition_source_region_ref( const fade_transition & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void fade_transition_source_region_ref( const fade_transition & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), ptr_item ); } inline const region fade_transition_target_region_ref( const fade_transition & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void fade_transition_target_region_ref( const fade_transition & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } inline float fade_transition_source_time( const fade_transition & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void fade_transition_source_time( const fade_transition & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } inline float fade_transition_source_start( const fade_transition & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void fade_transition_source_start( const fade_transition & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), value ); } inline float fade_transition_target_time( const fade_transition & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 128 ) ); } inline void fade_transition_target_time( const fade_transition & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 128 ), value ); } inline float fade_transition_target_start( const fade_transition & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 160 ) ); } inline void fade_transition_target_start( const fade_transition & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 160 ), value ); } inline const beat_set fade_transition_beat_set( const fade_transition & ptr) { return pointer_templ< _beat_set>( ptr.memory( ), ptr.offset( ) + 192 ); } // cls type stitch_transition inline stitch_transition stitch_transition_new( block * p_memory ) { stitch_transition ptr = (stitch_transition) block_alloc( p_memory, 96, "stitch_transition" ) ; stitch_transition_construct( ptr ); return ptr; } inline void stitch_transition_construct( const stitch_transition & ptr ) { region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void stitch_transition_destroy( const stitch_transition & ptr ) { region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void stitch_transition_delete( const stitch_transition & ptr ) { stitch_transition_destroy( ptr ); block_free( ptr, 96 ); } inline const region stitch_transition_source_region_ref( const stitch_transition & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void stitch_transition_source_region_ref( const stitch_transition & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), ptr_item ); } inline const region stitch_transition_target_region_ref( const stitch_transition & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void stitch_transition_target_region_ref( const stitch_transition & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } inline const region stitch_transition_transition_region_ref( const stitch_transition & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void stitch_transition_transition_region_ref( const stitch_transition & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), ptr_item ); } // cls type event inline event event_new( block * p_memory ) { event ptr = (event) block_alloc( p_memory, 96, "event" ) ; event_construct( ptr ); return ptr; } inline void event_construct( const event & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); action_ref_array_array_construct( pointer_templ< _action_ref_array_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); event_matrix_ref_construct( pointer_templ< _event_matrix_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_destroy( const event & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); action_ref_array_array_destroy( pointer_templ< _action_ref_array_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); event_matrix_ref_destroy( pointer_templ< _event_matrix_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_delete( const event & ptr ) { event_destroy( ptr ); block_free( ptr, 96 ); } inline void event_name( const event & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void event_name( const event & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline const action_ref_array_array event_action_arrays( const event & ptr) { return pointer_templ< _action_ref_array_array>( ptr.memory( ), ptr.offset( ) + 32 ); } inline const event_matrix event_event_matrix_ref( const event & ptr) { return (event_matrix) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_event_matrix_ref( const event & ptr, const event_matrix & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), ptr_item ); } // cls type event_matrix inline event_matrix event_matrix_new( block * p_memory ) { event_matrix ptr = (event_matrix) block_alloc( p_memory, 32, "event_matrix" ) ; event_matrix_construct( ptr ); return ptr; } inline void event_matrix_construct( const event_matrix & ptr ) { state_ref_array_construct( pointer_templ< _state_ref_array>( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_matrix_destroy( const event_matrix & ptr ) { state_ref_array_destroy( pointer_templ< _state_ref_array>( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_matrix_delete( const event_matrix & ptr ) { event_matrix_destroy( ptr ); block_free( ptr, 32 ); } inline const state_ref_array event_matrix_state_ref_array( const event_matrix & ptr) { return pointer_templ< _state_ref_array>( ptr.memory( ), ptr.offset( ) + 0 ); } // cls type state inline state state_new( block * p_memory ) { state ptr = (state) block_alloc( p_memory, 64, "state" ) ; state_construct( ptr ); return ptr; } inline void state_construct( const state & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_array_construct( pointer_templ< _string_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void state_destroy( const state & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_array_destroy( pointer_templ< _string_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void state_delete( const state & ptr ) { state_destroy( ptr ); block_free( ptr, 64 ); } inline void state_name( const state & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void state_name( const state & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline const string_array state_values( const state & ptr) { return pointer_templ< _string_array>( ptr.memory( ), ptr.offset( ) + 32 ); } // cls type rsd_file inline rsd_file rsd_file_new( block * p_memory ) { rsd_file ptr = (rsd_file) block_alloc( p_memory, 192, "rsd_file" ) ; rsd_file_construct( ptr ); return ptr; } inline void rsd_file_construct( const rsd_file & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); audio_format_construct( pointer_templ< _audio_format>( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void rsd_file_destroy( const rsd_file & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); audio_format_destroy( pointer_templ< _audio_format>( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void rsd_file_delete( const rsd_file & ptr ) { rsd_file_destroy( ptr ); block_free( ptr, 192 ); } inline void rsd_file_file_name( const rsd_file & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void rsd_file_file_name( const rsd_file & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline uint32 rsd_file_size( const rsd_file & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void rsd_file_size( const rsd_file & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline const audio_format rsd_file_audio_format( const rsd_file & ptr) { return pointer_templ< _audio_format>( ptr.memory( ), ptr.offset( ) + 64 ); } // cls type stream inline stream stream_new( block * p_memory ) { stream ptr = (stream) block_alloc( p_memory, 232, "stream" ) ; stream_construct( ptr ); return ptr; } inline void stream_construct( const stream & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); group_ref_construct( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); rsd_file_ref_construct( pointer_templ< _rsd_file_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); bool_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); tempo_track_construct( pointer_templ< _tempo_track>( ptr.memory( ), ptr.offset( ) + 104 ) ); } inline void stream_destroy( const stream & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); group_ref_destroy( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); rsd_file_ref_destroy( pointer_templ< _rsd_file_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); bool_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); tempo_track_destroy( pointer_templ< _tempo_track>( ptr.memory( ), ptr.offset( ) + 104 ) ); } inline void stream_delete( const stream & ptr ) { stream_destroy( ptr ); block_free( ptr, 232 ); } inline void stream_name( const stream & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void stream_name( const stream & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline const group stream_parent_group_ref( const stream & ptr) { return (group) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void stream_parent_group_ref( const stream & ptr, const group & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } inline const rsd_file stream_rsd_file_ref( const stream & ptr) { return (rsd_file) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void stream_rsd_file_ref( const stream & ptr, const rsd_file & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), ptr_item ); } inline bool stream_streamed( const stream & ptr) { return bool_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void stream_streamed( const stream & ptr, bool value ) { bool_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), value ); } inline const tempo_track stream_tempo_track( const stream & ptr) { return pointer_templ< _tempo_track>( ptr.memory( ), ptr.offset( ) + 104 ); } // cls type clip inline clip clip_new( block * p_memory ) { clip ptr = (clip) block_alloc( p_memory, 224, "clip" ) ; clip_construct( ptr ); return ptr; } inline void clip_construct( const clip & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); group_ref_construct( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); rsd_file_ref_construct( pointer_templ< _rsd_file_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); tempo_track_construct( pointer_templ< _tempo_track>( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void clip_destroy( const clip & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); group_ref_destroy( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); rsd_file_ref_destroy( pointer_templ< _rsd_file_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); tempo_track_destroy( pointer_templ< _tempo_track>( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void clip_delete( const clip & ptr ) { clip_destroy( ptr ); block_free( ptr, 224 ); } inline void clip_name( const clip & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void clip_name( const clip & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline const group clip_parent_group_ref( const clip & ptr) { return (group) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void clip_parent_group_ref( const clip & ptr, const group & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } inline const rsd_file clip_rsd_file_ref( const clip & ptr) { return (rsd_file) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void clip_rsd_file_ref( const clip & ptr, const rsd_file & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), ptr_item ); } inline const tempo_track clip_tempo_track( const clip & ptr) { return pointer_templ< _tempo_track>( ptr.memory( ), ptr.offset( ) + 96 ); } // cls type region inline region region_new( block * p_memory ) { region ptr = (region) block_alloc( p_memory, 160, "region" ) ; region_construct( ptr ); return ptr; } inline void region_construct( const region & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); layer_ref_array_construct( pointer_templ< _layer_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); group_ref_construct( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 96 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 128 ) ); } inline void region_destroy( const region & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); layer_ref_array_destroy( pointer_templ< _layer_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 64 ) ); group_ref_destroy( pointer_templ< _group_ref>( ptr.memory( ), ptr.offset( ) + 96 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 128 ) ); } inline void region_delete( const region & ptr ) { region_destroy( ptr ); block_free( ptr, 160 ); } inline void region_name( const region & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void region_name( const region & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline const layer_ref_array region_layer_refs( const region & ptr) { return pointer_templ< _layer_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ); } inline const region region_exit_region_ref( const region & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void region_exit_region_ref( const region & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), ptr_item ); } inline const group region_group_ref( const region & ptr) { return (group) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void region_group_ref( const region & ptr, const group & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), ptr_item ); } inline float region_volume( const region & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 128 ) ); } inline void region_volume( const region & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 128 ), value ); } // cls type sequence inline sequence sequence_new( block * p_memory ) { sequence ptr = (sequence) block_alloc( p_memory, 64, "sequence" ) ; sequence_construct( ptr ); return ptr; } inline void sequence_construct( const sequence & ptr ) { sequence_event_ref_construct( pointer_templ< _sequence_event_ref>( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void sequence_destroy( const sequence & ptr ) { sequence_event_ref_destroy( pointer_templ< _sequence_event_ref>( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void sequence_delete( const sequence & ptr ) { sequence_destroy( ptr ); block_free( ptr, 64 ); } inline const sequence_event sequence_root_event( const sequence & ptr) { return (sequence_event) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void sequence_root_event( const sequence & ptr, const sequence_event & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), ptr_item ); } inline uint32 sequence_stack_size( const sequence & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void sequence_stack_size( const sequence & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type layer inline layer layer_new( block * p_memory ) { layer ptr = (layer) block_alloc( p_memory, 136, "layer" ) ; layer_construct( ptr ); return ptr; } inline void layer_construct( const layer & ptr ) { string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); bool_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); beat_set_construct( pointer_templ< _beat_set>( ptr.memory( ), ptr.offset( ) + 40 ) ); sequence_ref_construct( pointer_templ< _sequence_ref>( ptr.memory( ), ptr.offset( ) + 72 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 104 ) ); } inline void layer_destroy( const layer & ptr ) { string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); bool_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); beat_set_destroy( pointer_templ< _beat_set>( ptr.memory( ), ptr.offset( ) + 40 ) ); sequence_ref_destroy( pointer_templ< _sequence_ref>( ptr.memory( ), ptr.offset( ) + 72 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 104 ) ); } inline void layer_delete( const layer & ptr ) { layer_destroy( ptr ); block_free( ptr, 136 ); } inline void layer_name( const layer & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string, len ); } inline void layer_name( const layer & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), p_string ); } inline bool layer_constant( const layer & ptr) { return bool_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void layer_constant( const layer & ptr, bool value ) { bool_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline const beat_set layer_beat_set( const layer & ptr) { return pointer_templ< _beat_set>( ptr.memory( ), ptr.offset( ) + 40 ); } inline const sequence layer_sequence_ref( const layer & ptr) { return (sequence) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 72 ) ); } inline void layer_sequence_ref( const layer & ptr, const sequence & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 72 ), ptr_item ); } inline float layer_volume( const layer & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 104 ) ); } inline void layer_volume( const layer & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 104 ), value ); } // cls type event_clip inline event_clip event_clip_new( block * p_memory ) { event_clip ptr = (event_clip) block_alloc( p_memory, 64, "event_clip" ) ; event_clip_construct( ptr ); return ptr; } inline void event_clip_construct( const event_clip & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); clip_ref_construct( pointer_templ< _clip_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_clip_destroy( const event_clip & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); clip_ref_destroy( pointer_templ< _clip_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_clip_delete( const event_clip & ptr ) { event_clip_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_clip_type( const event_clip & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_clip_type( const event_clip & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const clip event_clip_clip_ref( const event_clip & ptr) { return (clip) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_clip_clip_ref( const event_clip & ptr, const clip & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } // cls type event_stream inline event_stream event_stream_new( block * p_memory ) { event_stream ptr = (event_stream) block_alloc( p_memory, 64, "event_stream" ) ; event_stream_construct( ptr ); return ptr; } inline void event_stream_construct( const event_stream & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); stream_ref_construct( pointer_templ< _stream_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_stream_destroy( const event_stream & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); stream_ref_destroy( pointer_templ< _stream_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_stream_delete( const event_stream & ptr ) { event_stream_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_stream_type( const event_stream & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_stream_type( const event_stream & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const stream event_stream_stream_ref( const event_stream & ptr) { return (stream) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_stream_stream_ref( const event_stream & ptr, const stream & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } // cls type event_silence inline event_silence event_silence_new( block * p_memory ) { event_silence ptr = (event_silence) block_alloc( p_memory, 96, "event_silence" ) ; event_silence_construct( ptr ); return ptr; } inline void event_silence_construct( const event_silence & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_silence_destroy( const event_silence & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_silence_delete( const event_silence & ptr ) { event_silence_destroy( ptr ); block_free( ptr, 96 ); } inline uint32 event_silence_type( const event_silence & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_silence_type( const event_silence & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_silence_min_time( const event_silence & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_silence_min_time( const event_silence & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline float event_silence_max_time( const event_silence & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_silence_max_time( const event_silence & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } // cls type event_var_volume inline event_var_volume event_var_volume_new( block * p_memory ) { event_var_volume ptr = (event_var_volume) block_alloc( p_memory, 64, "event_var_volume" ) ; event_var_volume_construct( ptr ); return ptr; } inline void event_var_volume_construct( const event_var_volume & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_destroy( const event_var_volume & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_delete( const event_var_volume & ptr ) { event_var_volume_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_volume_type( const event_var_volume & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_volume_type( const event_var_volume & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_volume_volume( const event_var_volume & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_volume( const event_var_volume & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_pitch inline event_var_pitch event_var_pitch_new( block * p_memory ) { event_var_pitch ptr = (event_var_pitch) block_alloc( p_memory, 64, "event_var_pitch" ) ; event_var_pitch_construct( ptr ); return ptr; } inline void event_var_pitch_construct( const event_var_pitch & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_destroy( const event_var_pitch & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_delete( const event_var_pitch & ptr ) { event_var_pitch_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_pitch_type( const event_var_pitch & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_pitch_type( const event_var_pitch & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_pitch_pitch( const event_var_pitch & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_pitch( const event_var_pitch & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_volume_rand_min inline event_var_volume_rand_min event_var_volume_rand_min_new( block * p_memory ) { event_var_volume_rand_min ptr = (event_var_volume_rand_min) block_alloc( p_memory, 64, "event_var_volume_rand_min" ) ; event_var_volume_rand_min_construct( ptr ); return ptr; } inline void event_var_volume_rand_min_construct( const event_var_volume_rand_min & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_rand_min_destroy( const event_var_volume_rand_min & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_rand_min_delete( const event_var_volume_rand_min & ptr ) { event_var_volume_rand_min_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_volume_rand_min_type( const event_var_volume_rand_min & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_volume_rand_min_type( const event_var_volume_rand_min & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_volume_rand_min_volume_rand_min( const event_var_volume_rand_min & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_rand_min_volume_rand_min( const event_var_volume_rand_min & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_volume_rand_max inline event_var_volume_rand_max event_var_volume_rand_max_new( block * p_memory ) { event_var_volume_rand_max ptr = (event_var_volume_rand_max) block_alloc( p_memory, 64, "event_var_volume_rand_max" ) ; event_var_volume_rand_max_construct( ptr ); return ptr; } inline void event_var_volume_rand_max_construct( const event_var_volume_rand_max & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_rand_max_destroy( const event_var_volume_rand_max & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_rand_max_delete( const event_var_volume_rand_max & ptr ) { event_var_volume_rand_max_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_volume_rand_max_type( const event_var_volume_rand_max & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_volume_rand_max_type( const event_var_volume_rand_max & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_volume_rand_max_volume_rand_max( const event_var_volume_rand_max & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_volume_rand_max_volume_rand_max( const event_var_volume_rand_max & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_pitch_rand_min inline event_var_pitch_rand_min event_var_pitch_rand_min_new( block * p_memory ) { event_var_pitch_rand_min ptr = (event_var_pitch_rand_min) block_alloc( p_memory, 64, "event_var_pitch_rand_min" ) ; event_var_pitch_rand_min_construct( ptr ); return ptr; } inline void event_var_pitch_rand_min_construct( const event_var_pitch_rand_min & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_rand_min_destroy( const event_var_pitch_rand_min & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_rand_min_delete( const event_var_pitch_rand_min & ptr ) { event_var_pitch_rand_min_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_pitch_rand_min_type( const event_var_pitch_rand_min & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_pitch_rand_min_type( const event_var_pitch_rand_min & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_pitch_rand_min_pitch_rand_min( const event_var_pitch_rand_min & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_rand_min_pitch_rand_min( const event_var_pitch_rand_min & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_pitch_rand_max inline event_var_pitch_rand_max event_var_pitch_rand_max_new( block * p_memory ) { event_var_pitch_rand_max ptr = (event_var_pitch_rand_max) block_alloc( p_memory, 64, "event_var_pitch_rand_max" ) ; event_var_pitch_rand_max_construct( ptr ); return ptr; } inline void event_var_pitch_rand_max_construct( const event_var_pitch_rand_max & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_rand_max_destroy( const event_var_pitch_rand_max & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_rand_max_delete( const event_var_pitch_rand_max & ptr ) { event_var_pitch_rand_max_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_pitch_rand_max_type( const event_var_pitch_rand_max & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_pitch_rand_max_type( const event_var_pitch_rand_max & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_pitch_rand_max_pitch_rand_max( const event_var_pitch_rand_max & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pitch_rand_max_pitch_rand_max( const event_var_pitch_rand_max & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_aux_gain inline event_var_aux_gain event_var_aux_gain_new( block * p_memory ) { event_var_aux_gain ptr = (event_var_aux_gain) block_alloc( p_memory, 96, "event_var_aux_gain" ) ; event_var_aux_gain_construct( ptr ); return ptr; } inline void event_var_aux_gain_construct( const event_var_aux_gain & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_var_aux_gain_destroy( const event_var_aux_gain & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_var_aux_gain_delete( const event_var_aux_gain & ptr ) { event_var_aux_gain_destroy( ptr ); block_free( ptr, 96 ); } inline uint32 event_var_aux_gain_type( const event_var_aux_gain & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_aux_gain_type( const event_var_aux_gain & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline uint32 event_var_aux_gain_aux_number( const event_var_aux_gain & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_aux_gain_aux_number( const event_var_aux_gain & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline float event_var_aux_gain_aux_gain( const event_var_aux_gain & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_var_aux_gain_aux_gain( const event_var_aux_gain & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } // cls type event_var_positional inline event_var_positional event_var_positional_new( block * p_memory ) { event_var_positional ptr = (event_var_positional) block_alloc( p_memory, 40, "event_var_positional" ) ; event_var_positional_construct( ptr ); return ptr; } inline void event_var_positional_construct( const event_var_positional & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); bool_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_positional_destroy( const event_var_positional & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); bool_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_positional_delete( const event_var_positional & ptr ) { event_var_positional_destroy( ptr ); block_free( ptr, 40 ); } inline uint32 event_var_positional_type( const event_var_positional & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_positional_type( const event_var_positional & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline bool event_var_positional_positional( const event_var_positional & ptr) { return bool_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_positional_positional( const event_var_positional & ptr, bool value ) { bool_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_pos_fall_off inline event_var_pos_fall_off event_var_pos_fall_off_new( block * p_memory ) { event_var_pos_fall_off ptr = (event_var_pos_fall_off) block_alloc( p_memory, 64, "event_var_pos_fall_off" ) ; event_var_pos_fall_off_construct( ptr ); return ptr; } inline void event_var_pos_fall_off_construct( const event_var_pos_fall_off & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_fall_off_destroy( const event_var_pos_fall_off & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_fall_off_delete( const event_var_pos_fall_off & ptr ) { event_var_pos_fall_off_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_pos_fall_off_type( const event_var_pos_fall_off & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_pos_fall_off_type( const event_var_pos_fall_off & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_pos_fall_off_pos_fall_off( const event_var_pos_fall_off & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_fall_off_pos_fall_off( const event_var_pos_fall_off & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_pos_dist_min inline event_var_pos_dist_min event_var_pos_dist_min_new( block * p_memory ) { event_var_pos_dist_min ptr = (event_var_pos_dist_min) block_alloc( p_memory, 64, "event_var_pos_dist_min" ) ; event_var_pos_dist_min_construct( ptr ); return ptr; } inline void event_var_pos_dist_min_construct( const event_var_pos_dist_min & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_dist_min_destroy( const event_var_pos_dist_min & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_dist_min_delete( const event_var_pos_dist_min & ptr ) { event_var_pos_dist_min_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_pos_dist_min_type( const event_var_pos_dist_min & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_pos_dist_min_type( const event_var_pos_dist_min & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_pos_dist_min_pos_dist_min( const event_var_pos_dist_min & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_dist_min_pos_dist_min( const event_var_pos_dist_min & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_var_pos_dist_max inline event_var_pos_dist_max event_var_pos_dist_max_new( block * p_memory ) { event_var_pos_dist_max ptr = (event_var_pos_dist_max) block_alloc( p_memory, 64, "event_var_pos_dist_max" ) ; event_var_pos_dist_max_construct( ptr ); return ptr; } inline void event_var_pos_dist_max_construct( const event_var_pos_dist_max & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_dist_max_destroy( const event_var_pos_dist_max & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_dist_max_delete( const event_var_pos_dist_max & ptr ) { event_var_pos_dist_max_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_var_pos_dist_max_type( const event_var_pos_dist_max & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_var_pos_dist_max_type( const event_var_pos_dist_max & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float event_var_pos_dist_max_pos_dist_max( const event_var_pos_dist_max & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_var_pos_dist_max_pos_dist_max( const event_var_pos_dist_max & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } // cls type event_callback inline event_callback event_callback_new( block * p_memory ) { event_callback ptr = (event_callback) block_alloc( p_memory, 64, "event_callback" ) ; event_callback_construct( ptr ); return ptr; } inline void event_callback_construct( const event_callback & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_callback_destroy( const event_callback & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_callback_delete( const event_callback & ptr ) { event_callback_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_callback_type( const event_callback & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_callback_type( const event_callback & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline void event_callback_callback_name( const event_callback & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ), p_string, len ); } inline void event_callback_callback_name( const event_callback & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), p_string ); } // cls type event_logic_and inline event_logic_and event_logic_and_new( block * p_memory ) { event_logic_and ptr = (event_logic_and) block_alloc( p_memory, 64, "event_logic_and" ) ; event_logic_and_construct( ptr ); return ptr; } inline void event_logic_and_construct( const event_logic_and & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); sequence_event_ref_array_construct( pointer_templ< _sequence_event_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_logic_and_destroy( const event_logic_and & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); sequence_event_ref_array_destroy( pointer_templ< _sequence_event_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_logic_and_delete( const event_logic_and & ptr ) { event_logic_and_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_logic_and_type( const event_logic_and & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_logic_and_type( const event_logic_and & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const sequence_event_ref_array event_logic_and_events( const event_logic_and & ptr) { return pointer_templ< _sequence_event_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ); } // cls type event_logic_or inline event_logic_or event_logic_or_new( block * p_memory ) { event_logic_or ptr = (event_logic_or) block_alloc( p_memory, 64, "event_logic_or" ) ; event_logic_or_construct( ptr ); return ptr; } inline void event_logic_or_construct( const event_logic_or & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); sequence_event_ref_array_construct( pointer_templ< _sequence_event_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_logic_or_destroy( const event_logic_or & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); sequence_event_ref_array_destroy( pointer_templ< _sequence_event_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_logic_or_delete( const event_logic_or & ptr ) { event_logic_or_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 event_logic_or_type( const event_logic_or & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_logic_or_type( const event_logic_or & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const sequence_event_ref_array event_logic_or_events( const event_logic_or & ptr) { return pointer_templ< _sequence_event_ref_array>( ptr.memory( ), ptr.offset( ) + 32 ); } // cls type event_logic_repeat inline event_logic_repeat event_logic_repeat_new( block * p_memory ) { event_logic_repeat ptr = (event_logic_repeat) block_alloc( p_memory, 128, "event_logic_repeat" ) ; event_logic_repeat_construct( ptr ); return ptr; } inline void event_logic_repeat_construct( const event_logic_repeat & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); sequence_event_ref_construct( pointer_templ< _sequence_event_ref>( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void event_logic_repeat_destroy( const event_logic_repeat & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); sequence_event_ref_destroy( pointer_templ< _sequence_event_ref>( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void event_logic_repeat_delete( const event_logic_repeat & ptr ) { event_logic_repeat_destroy( ptr ); block_free( ptr, 128 ); } inline uint32 event_logic_repeat_type( const event_logic_repeat & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void event_logic_repeat_type( const event_logic_repeat & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline uint32 event_logic_repeat_min_times( const event_logic_repeat & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void event_logic_repeat_min_times( const event_logic_repeat & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline uint32 event_logic_repeat_max_times( const event_logic_repeat & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void event_logic_repeat_max_times( const event_logic_repeat & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } inline const sequence_event event_logic_repeat_event_ref( const event_logic_repeat & ptr) { return (sequence_event) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void event_logic_repeat_event_ref( const event_logic_repeat & ptr, const sequence_event & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), ptr_item ); } // cls type play_region_action inline play_region_action play_region_action_new( block * p_memory ) { play_region_action ptr = (play_region_action) block_alloc( p_memory, 96, "play_region_action" ) ; play_region_action_construct( ptr ); return ptr; } inline void play_region_action_construct( const play_region_action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void play_region_action_destroy( const play_region_action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void play_region_action_delete( const play_region_action & ptr ) { play_region_action_destroy( ptr ); block_free( ptr, 96 ); } inline uint32 play_region_action_type( const play_region_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void play_region_action_type( const play_region_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const region play_region_action_region_ref( const play_region_action & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void play_region_action_region_ref( const play_region_action & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } inline uint32 play_region_action_region_resume_type( const play_region_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void play_region_action_region_resume_type( const play_region_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } // cls type push_region_action inline push_region_action push_region_action_new( block * p_memory ) { push_region_action ptr = (push_region_action) block_alloc( p_memory, 128, "push_region_action" ) ; push_region_action_construct( ptr ); return ptr; } inline void push_region_action_construct( const push_region_action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void push_region_action_destroy( const push_region_action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void push_region_action_delete( const push_region_action & ptr ) { push_region_action_destroy( ptr ); block_free( ptr, 128 ); } inline uint32 push_region_action_type( const push_region_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void push_region_action_type( const push_region_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const region push_region_action_region_ref( const push_region_action & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void push_region_action_region_ref( const push_region_action & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } inline uint32 push_region_action_target_region_resume_type( const push_region_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void push_region_action_target_region_resume_type( const push_region_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } inline uint32 push_region_action_current_region_resume_type( const push_region_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void push_region_action_current_region_resume_type( const push_region_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), value ); } // cls type pop_region_action inline pop_region_action pop_region_action_new( block * p_memory ) { pop_region_action ptr = (pop_region_action) block_alloc( p_memory, 64, "pop_region_action" ) ; pop_region_action_construct( ptr ); return ptr; } inline void pop_region_action_construct( const pop_region_action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_construct( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void pop_region_action_destroy( const pop_region_action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); region_ref_destroy( pointer_templ< _region_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void pop_region_action_delete( const pop_region_action & ptr ) { pop_region_action_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 pop_region_action_type( const pop_region_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void pop_region_action_type( const pop_region_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const region pop_region_action_region_ref( const pop_region_action & ptr) { return (region) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void pop_region_action_region_ref( const pop_region_action & ptr, const region & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } // cls type start_layer_action inline start_layer_action start_layer_action_new( block * p_memory ) { start_layer_action ptr = (start_layer_action) block_alloc( p_memory, 64, "start_layer_action" ) ; start_layer_action_construct( ptr ); return ptr; } inline void start_layer_action_construct( const start_layer_action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void start_layer_action_destroy( const start_layer_action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void start_layer_action_delete( const start_layer_action & ptr ) { start_layer_action_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 start_layer_action_type( const start_layer_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void start_layer_action_type( const start_layer_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline void start_layer_action_layer_name( const start_layer_action & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ), p_string, len ); } inline void start_layer_action_layer_name( const start_layer_action & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), p_string ); } // cls type stop_layer_action inline stop_layer_action stop_layer_action_new( block * p_memory ) { stop_layer_action ptr = (stop_layer_action) block_alloc( p_memory, 64, "stop_layer_action" ) ; stop_layer_action_construct( ptr ); return ptr; } inline void stop_layer_action_construct( const stop_layer_action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void stop_layer_action_destroy( const stop_layer_action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); string_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void stop_layer_action_delete( const stop_layer_action & ptr ) { stop_layer_action_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 stop_layer_action_type( const stop_layer_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void stop_layer_action_type( const stop_layer_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline void stop_layer_action_layer_name( const stop_layer_action & ptr, char * p_string, unsigned int len) { string_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ), p_string, len ); } inline void stop_layer_action_layer_name( const stop_layer_action & ptr, const char * p_string ) { string_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), p_string ); } // cls type rand_state_action inline rand_state_action rand_state_action_new( block * p_memory ) { rand_state_action ptr = (rand_state_action) block_alloc( p_memory, 64, "rand_state_action" ) ; rand_state_action_construct( ptr ); return ptr; } inline void rand_state_action_construct( const rand_state_action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); state_ref_construct( pointer_templ< _state_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void rand_state_action_destroy( const rand_state_action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); state_ref_destroy( pointer_templ< _state_ref>( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void rand_state_action_delete( const rand_state_action & ptr ) { rand_state_action_destroy( ptr ); block_free( ptr, 64 ); } inline uint32 rand_state_action_type( const rand_state_action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void rand_state_action_type( const rand_state_action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline const state rand_state_action_state_ref( const rand_state_action & ptr) { return (state) ref_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void rand_state_action_state_ref( const rand_state_action & ptr, const state & ptr_item ) { ref_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), ptr_item ); } // cls type audio_format inline audio_format audio_format_new( block * p_memory ) { audio_format ptr = (audio_format) block_alloc( p_memory, 128, "audio_format" ) ; audio_format_construct( ptr ); return ptr; } inline void audio_format_construct( const audio_format & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void audio_format_destroy( const audio_format & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void audio_format_delete( const audio_format & ptr ) { audio_format_destroy( ptr ); block_free( ptr, 128 ); } inline uint32 audio_format_encoding( const audio_format & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void audio_format_encoding( const audio_format & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline uint32 audio_format_channels( const audio_format & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void audio_format_channels( const audio_format & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline uint32 audio_format_bit_resolution( const audio_format & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void audio_format_bit_resolution( const audio_format & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } inline uint32 audio_format_sampling_rate( const audio_format & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void audio_format_sampling_rate( const audio_format & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), value ); } // cls type tempo_track inline tempo_track tempo_track_new( block * p_memory ) { tempo_track ptr = (tempo_track) block_alloc( p_memory, 128, "tempo_track" ) ; tempo_track_construct( ptr ); return ptr; } inline void tempo_track_construct( const tempo_track & ptr ) { float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void tempo_track_destroy( const tempo_track & ptr ) { float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); float_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void tempo_track_delete( const tempo_track & ptr ) { tempo_track_destroy( ptr ); block_free( ptr, 128 ); } inline float tempo_track_bpm( const tempo_track & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void tempo_track_bpm( const tempo_track & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } inline float tempo_track_start_beat( const tempo_track & ptr) { return float_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 32 ) ); } inline void tempo_track_start_beat( const tempo_track & ptr, float value ) { float_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 32 ), value ); } inline uint32 tempo_track_time_sig_numerator( const tempo_track & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 64 ) ); } inline void tempo_track_time_sig_numerator( const tempo_track & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 64 ), value ); } inline uint32 tempo_track_time_sig_denominator( const tempo_track & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 96 ) ); } inline void tempo_track_time_sig_denominator( const tempo_track & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 96 ), value ); } // cls type sequence_event inline sequence_event sequence_event_new( block * p_memory ) { sequence_event ptr = (sequence_event) block_alloc( p_memory, 32, "sequence_event" ) ; sequence_event_construct( ptr ); return ptr; } inline void sequence_event_construct( const sequence_event & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void sequence_event_destroy( const sequence_event & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void sequence_event_delete( const sequence_event & ptr ) { sequence_event_destroy( ptr ); block_free( ptr, 32 ); } inline uint32 sequence_event_type( const sequence_event & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void sequence_event_type( const sequence_event & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } // cls type beat_set inline beat_set beat_set_new( block * p_memory ) { beat_set ptr = (beat_set) block_alloc( p_memory, 32, "beat_set" ) ; beat_set_construct( ptr ); return ptr; } inline void beat_set_construct( const beat_set & ptr ) { float_array_construct( pointer_templ< _float_array>( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void beat_set_destroy( const beat_set & ptr ) { float_array_destroy( pointer_templ< _float_array>( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void beat_set_delete( const beat_set & ptr ) { beat_set_destroy( ptr ); block_free( ptr, 32 ); } inline const float_array beat_set_beats( const beat_set & ptr) { return pointer_templ< _float_array>( ptr.memory( ), ptr.offset( ) + 0 ); } // cls type action inline action action_new( block * p_memory ) { action ptr = (action) block_alloc( p_memory, 32, "action" ) ; action_construct( ptr ); return ptr; } inline void action_construct( const action & ptr ) { uint32_instance_construct( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void action_destroy( const action & ptr ) { uint32_instance_destroy( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void action_delete( const action & ptr ) { action_destroy( ptr ); block_free( ptr, 32 ); } inline uint32 action_type( const action & ptr) { return uint32_instance_read( pointer( ptr.memory( ), ptr.offset( ) + 0 ) ); } inline void action_type( const action & ptr, uint32 value ) { uint32_instance_write( pointer( ptr.memory( ), ptr.offset( ) + 0 ), value ); } // // type safe dereferencing functions // //----------------------------------------------------------------------------- // group_ref //----------------------------------------------------------------------------- #ifndef group_ref_DEFINED #define group_ref_DEFINED inline void group_ref_construct( const group_ref & ptr ) { ref_instance_construct( ptr ); } inline void group_ref_destroy( const group_ref & ptr ) { ref_instance_destroy( ptr ); } inline group deref( const group_ref & ptr ) { return pointer_templ< _group>( block_read_reference( ptr ) ); } #endif // group_ref_DEFINDED //----------------------------------------------------------------------------- // rsd_file_ref //----------------------------------------------------------------------------- #ifndef rsd_file_ref_DEFINED #define rsd_file_ref_DEFINED inline void rsd_file_ref_construct( const rsd_file_ref & ptr ) { ref_instance_construct( ptr ); } inline void rsd_file_ref_destroy( const rsd_file_ref & ptr ) { ref_instance_destroy( ptr ); } inline rsd_file deref( const rsd_file_ref & ptr ) { return pointer_templ< _rsd_file>( block_read_reference( ptr ) ); } #endif // rsd_file_ref_DEFINDED //----------------------------------------------------------------------------- // sequence_event_ref //----------------------------------------------------------------------------- #ifndef sequence_event_ref_DEFINED #define sequence_event_ref_DEFINED inline void sequence_event_ref_construct( const sequence_event_ref & ptr ) { ref_instance_construct( ptr ); } inline void sequence_event_ref_destroy( const sequence_event_ref & ptr ) { ref_instance_destroy( ptr ); } inline sequence_event deref( const sequence_event_ref & ptr ) { return pointer_templ< _sequence_event>( block_read_reference( ptr ) ); } #endif // sequence_event_ref_DEFINDED //----------------------------------------------------------------------------- // stream_ref //----------------------------------------------------------------------------- #ifndef stream_ref_DEFINED #define stream_ref_DEFINED inline void stream_ref_construct( const stream_ref & ptr ) { ref_instance_construct( ptr ); } inline void stream_ref_destroy( const stream_ref & ptr ) { ref_instance_destroy( ptr ); } inline stream deref( const stream_ref & ptr ) { return pointer_templ< _stream>( block_read_reference( ptr ) ); } #endif // stream_ref_DEFINDED //----------------------------------------------------------------------------- // clip_ref //----------------------------------------------------------------------------- #ifndef clip_ref_DEFINED #define clip_ref_DEFINED inline void clip_ref_construct( const clip_ref & ptr ) { ref_instance_construct( ptr ); } inline void clip_ref_destroy( const clip_ref & ptr ) { ref_instance_destroy( ptr ); } inline clip deref( const clip_ref & ptr ) { return pointer_templ< _clip>( block_read_reference( ptr ) ); } #endif // clip_ref_DEFINDED //----------------------------------------------------------------------------- // region_ref //----------------------------------------------------------------------------- #ifndef region_ref_DEFINED #define region_ref_DEFINED inline void region_ref_construct( const region_ref & ptr ) { ref_instance_construct( ptr ); } inline void region_ref_destroy( const region_ref & ptr ) { ref_instance_destroy( ptr ); } inline region deref( const region_ref & ptr ) { return pointer_templ< _region>( block_read_reference( ptr ) ); } #endif // region_ref_DEFINDED //----------------------------------------------------------------------------- // state_ref //----------------------------------------------------------------------------- #ifndef state_ref_DEFINED #define state_ref_DEFINED inline void state_ref_construct( const state_ref & ptr ) { ref_instance_construct( ptr ); } inline void state_ref_destroy( const state_ref & ptr ) { ref_instance_destroy( ptr ); } inline state deref( const state_ref & ptr ) { return pointer_templ< _state>( block_read_reference( ptr ) ); } #endif // state_ref_DEFINDED //----------------------------------------------------------------------------- // action_ref //----------------------------------------------------------------------------- #ifndef action_ref_DEFINED #define action_ref_DEFINED inline void action_ref_construct( const action_ref & ptr ) { ref_instance_construct( ptr ); } inline void action_ref_destroy( const action_ref & ptr ) { ref_instance_destroy( ptr ); } inline action deref( const action_ref & ptr ) { return pointer_templ< _action>( block_read_reference( ptr ) ); } #endif // action_ref_DEFINDED //----------------------------------------------------------------------------- // event_matrix_ref //----------------------------------------------------------------------------- #ifndef event_matrix_ref_DEFINED #define event_matrix_ref_DEFINED inline void event_matrix_ref_construct( const event_matrix_ref & ptr ) { ref_instance_construct( ptr ); } inline void event_matrix_ref_destroy( const event_matrix_ref & ptr ) { ref_instance_destroy( ptr ); } inline event_matrix deref( const event_matrix_ref & ptr ) { return pointer_templ< _event_matrix>( block_read_reference( ptr ) ); } #endif // event_matrix_ref_DEFINDED //----------------------------------------------------------------------------- // layer_ref //----------------------------------------------------------------------------- #ifndef layer_ref_DEFINED #define layer_ref_DEFINED inline void layer_ref_construct( const layer_ref & ptr ) { ref_instance_construct( ptr ); } inline void layer_ref_destroy( const layer_ref & ptr ) { ref_instance_destroy( ptr ); } inline layer deref( const layer_ref & ptr ) { return pointer_templ< _layer>( block_read_reference( ptr ) ); } #endif // layer_ref_DEFINDED //----------------------------------------------------------------------------- // sequence_ref //----------------------------------------------------------------------------- #ifndef sequence_ref_DEFINED #define sequence_ref_DEFINED inline void sequence_ref_construct( const sequence_ref & ptr ) { ref_instance_construct( ptr ); } inline void sequence_ref_destroy( const sequence_ref & ptr ) { ref_instance_destroy( ptr ); } inline sequence deref( const sequence_ref & ptr ) { return pointer_templ< _sequence>( block_read_reference( ptr ) ); } #endif // sequence_ref_DEFINDED // // type safe array functions // //----------------------------------------------------------------------------- // group_array //----------------------------------------------------------------------------- #ifndef group_array_DEFINED #define group_array_DEFINED inline unsigned int group_array_num_items( const group_array & ptr ) { return array_instance_num_items( ptr ); } inline void group_array_construct( const group_array & ptr ) { array_instance_construct( ptr, 224 ); } inline const group group_array_item_at( const group_array & ptr, unsigned int index ) { return pointer_templ< _group>( array_instance_item_at( ptr, 224, index ) ); } inline const group group_array_add_item( const group_array & ptr ) { group ptr_new_item = (group) array_instance_add_item( ptr, 224 ); group_construct( ptr_new_item ); return ptr_new_item; } inline void group_array_destroy( const group_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { group ptr_item = (group) array_instance_item_at( ptr, 224, i ); group_destroy( ptr_item ); } array_instance_destroy( ptr, 224 ); } inline void group_array_remove_item( const group_array & ptr, unsigned int index) { group ptr_item = (group) array_instance_item_at( ptr, 224, index ); group_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 224, index ); } #endif // group_array_DEFINED //----------------------------------------------------------------------------- // fade_transition_array //----------------------------------------------------------------------------- #ifndef fade_transition_array_DEFINED #define fade_transition_array_DEFINED inline unsigned int fade_transition_array_num_items( const fade_transition_array & ptr ) { return array_instance_num_items( ptr ); } inline void fade_transition_array_construct( const fade_transition_array & ptr ) { array_instance_construct( ptr, 224 ); } inline const fade_transition fade_transition_array_item_at( const fade_transition_array & ptr, unsigned int index ) { return pointer_templ< _fade_transition>( array_instance_item_at( ptr, 224, index ) ); } inline const fade_transition fade_transition_array_add_item( const fade_transition_array & ptr ) { fade_transition ptr_new_item = (fade_transition) array_instance_add_item( ptr, 224 ); fade_transition_construct( ptr_new_item ); return ptr_new_item; } inline void fade_transition_array_destroy( const fade_transition_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { fade_transition ptr_item = (fade_transition) array_instance_item_at( ptr, 224, i ); fade_transition_destroy( ptr_item ); } array_instance_destroy( ptr, 224 ); } inline void fade_transition_array_remove_item( const fade_transition_array & ptr, unsigned int index) { fade_transition ptr_item = (fade_transition) array_instance_item_at( ptr, 224, index ); fade_transition_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 224, index ); } #endif // fade_transition_array_DEFINED //----------------------------------------------------------------------------- // stitch_transition_array //----------------------------------------------------------------------------- #ifndef stitch_transition_array_DEFINED #define stitch_transition_array_DEFINED inline unsigned int stitch_transition_array_num_items( const stitch_transition_array & ptr ) { return array_instance_num_items( ptr ); } inline void stitch_transition_array_construct( const stitch_transition_array & ptr ) { array_instance_construct( ptr, 96 ); } inline const stitch_transition stitch_transition_array_item_at( const stitch_transition_array & ptr, unsigned int index ) { return pointer_templ< _stitch_transition>( array_instance_item_at( ptr, 96, index ) ); } inline const stitch_transition stitch_transition_array_add_item( const stitch_transition_array & ptr ) { stitch_transition ptr_new_item = (stitch_transition) array_instance_add_item( ptr, 96 ); stitch_transition_construct( ptr_new_item ); return ptr_new_item; } inline void stitch_transition_array_destroy( const stitch_transition_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { stitch_transition ptr_item = (stitch_transition) array_instance_item_at( ptr, 96, i ); stitch_transition_destroy( ptr_item ); } array_instance_destroy( ptr, 96 ); } inline void stitch_transition_array_remove_item( const stitch_transition_array & ptr, unsigned int index) { stitch_transition ptr_item = (stitch_transition) array_instance_item_at( ptr, 96, index ); stitch_transition_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 96, index ); } #endif // stitch_transition_array_DEFINED //----------------------------------------------------------------------------- // event_array //----------------------------------------------------------------------------- #ifndef event_array_DEFINED #define event_array_DEFINED inline unsigned int event_array_num_items( const event_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_array_construct( const event_array & ptr ) { array_instance_construct( ptr, 96 ); } inline const event event_array_item_at( const event_array & ptr, unsigned int index ) { return pointer_templ< _event>( array_instance_item_at( ptr, 96, index ) ); } inline const event event_array_add_item( const event_array & ptr ) { event ptr_new_item = (event) array_instance_add_item( ptr, 96 ); event_construct( ptr_new_item ); return ptr_new_item; } inline void event_array_destroy( const event_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event ptr_item = (event) array_instance_item_at( ptr, 96, i ); event_destroy( ptr_item ); } array_instance_destroy( ptr, 96 ); } inline void event_array_remove_item( const event_array & ptr, unsigned int index) { event ptr_item = (event) array_instance_item_at( ptr, 96, index ); event_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 96, index ); } #endif // event_array_DEFINED //----------------------------------------------------------------------------- // event_matrix_array //----------------------------------------------------------------------------- #ifndef event_matrix_array_DEFINED #define event_matrix_array_DEFINED inline unsigned int event_matrix_array_num_items( const event_matrix_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_matrix_array_construct( const event_matrix_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const event_matrix event_matrix_array_item_at( const event_matrix_array & ptr, unsigned int index ) { return pointer_templ< _event_matrix>( array_instance_item_at( ptr, 32, index ) ); } inline const event_matrix event_matrix_array_add_item( const event_matrix_array & ptr ) { event_matrix ptr_new_item = (event_matrix) array_instance_add_item( ptr, 32 ); event_matrix_construct( ptr_new_item ); return ptr_new_item; } inline void event_matrix_array_destroy( const event_matrix_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_matrix ptr_item = (event_matrix) array_instance_item_at( ptr, 32, i ); event_matrix_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } inline void event_matrix_array_remove_item( const event_matrix_array & ptr, unsigned int index) { event_matrix ptr_item = (event_matrix) array_instance_item_at( ptr, 32, index ); event_matrix_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 32, index ); } #endif // event_matrix_array_DEFINED //----------------------------------------------------------------------------- // state_array //----------------------------------------------------------------------------- #ifndef state_array_DEFINED #define state_array_DEFINED inline unsigned int state_array_num_items( const state_array & ptr ) { return array_instance_num_items( ptr ); } inline void state_array_construct( const state_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const state state_array_item_at( const state_array & ptr, unsigned int index ) { return pointer_templ< _state>( array_instance_item_at( ptr, 64, index ) ); } inline const state state_array_add_item( const state_array & ptr ) { state ptr_new_item = (state) array_instance_add_item( ptr, 64 ); state_construct( ptr_new_item ); return ptr_new_item; } inline void state_array_destroy( const state_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { state ptr_item = (state) array_instance_item_at( ptr, 64, i ); state_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void state_array_remove_item( const state_array & ptr, unsigned int index) { state ptr_item = (state) array_instance_item_at( ptr, 64, index ); state_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // state_array_DEFINED //----------------------------------------------------------------------------- // rsd_file_array //----------------------------------------------------------------------------- #ifndef rsd_file_array_DEFINED #define rsd_file_array_DEFINED inline unsigned int rsd_file_array_num_items( const rsd_file_array & ptr ) { return array_instance_num_items( ptr ); } inline void rsd_file_array_construct( const rsd_file_array & ptr ) { array_instance_construct( ptr, 192 ); } inline const rsd_file rsd_file_array_item_at( const rsd_file_array & ptr, unsigned int index ) { return pointer_templ< _rsd_file>( array_instance_item_at( ptr, 192, index ) ); } inline const rsd_file rsd_file_array_add_item( const rsd_file_array & ptr ) { rsd_file ptr_new_item = (rsd_file) array_instance_add_item( ptr, 192 ); rsd_file_construct( ptr_new_item ); return ptr_new_item; } inline void rsd_file_array_destroy( const rsd_file_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { rsd_file ptr_item = (rsd_file) array_instance_item_at( ptr, 192, i ); rsd_file_destroy( ptr_item ); } array_instance_destroy( ptr, 192 ); } inline void rsd_file_array_remove_item( const rsd_file_array & ptr, unsigned int index) { rsd_file ptr_item = (rsd_file) array_instance_item_at( ptr, 192, index ); rsd_file_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 192, index ); } #endif // rsd_file_array_DEFINED //----------------------------------------------------------------------------- // stream_array //----------------------------------------------------------------------------- #ifndef stream_array_DEFINED #define stream_array_DEFINED inline unsigned int stream_array_num_items( const stream_array & ptr ) { return array_instance_num_items( ptr ); } inline void stream_array_construct( const stream_array & ptr ) { array_instance_construct( ptr, 232 ); } inline const stream stream_array_item_at( const stream_array & ptr, unsigned int index ) { return pointer_templ< _stream>( array_instance_item_at( ptr, 232, index ) ); } inline const stream stream_array_add_item( const stream_array & ptr ) { stream ptr_new_item = (stream) array_instance_add_item( ptr, 232 ); stream_construct( ptr_new_item ); return ptr_new_item; } inline void stream_array_destroy( const stream_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { stream ptr_item = (stream) array_instance_item_at( ptr, 232, i ); stream_destroy( ptr_item ); } array_instance_destroy( ptr, 232 ); } inline void stream_array_remove_item( const stream_array & ptr, unsigned int index) { stream ptr_item = (stream) array_instance_item_at( ptr, 232, index ); stream_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 232, index ); } #endif // stream_array_DEFINED //----------------------------------------------------------------------------- // clip_array //----------------------------------------------------------------------------- #ifndef clip_array_DEFINED #define clip_array_DEFINED inline unsigned int clip_array_num_items( const clip_array & ptr ) { return array_instance_num_items( ptr ); } inline void clip_array_construct( const clip_array & ptr ) { array_instance_construct( ptr, 224 ); } inline const clip clip_array_item_at( const clip_array & ptr, unsigned int index ) { return pointer_templ< _clip>( array_instance_item_at( ptr, 224, index ) ); } inline const clip clip_array_add_item( const clip_array & ptr ) { clip ptr_new_item = (clip) array_instance_add_item( ptr, 224 ); clip_construct( ptr_new_item ); return ptr_new_item; } inline void clip_array_destroy( const clip_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { clip ptr_item = (clip) array_instance_item_at( ptr, 224, i ); clip_destroy( ptr_item ); } array_instance_destroy( ptr, 224 ); } inline void clip_array_remove_item( const clip_array & ptr, unsigned int index) { clip ptr_item = (clip) array_instance_item_at( ptr, 224, index ); clip_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 224, index ); } #endif // clip_array_DEFINED //----------------------------------------------------------------------------- // region_array //----------------------------------------------------------------------------- #ifndef region_array_DEFINED #define region_array_DEFINED inline unsigned int region_array_num_items( const region_array & ptr ) { return array_instance_num_items( ptr ); } inline void region_array_construct( const region_array & ptr ) { array_instance_construct( ptr, 160 ); } inline const region region_array_item_at( const region_array & ptr, unsigned int index ) { return pointer_templ< _region>( array_instance_item_at( ptr, 160, index ) ); } inline const region region_array_add_item( const region_array & ptr ) { region ptr_new_item = (region) array_instance_add_item( ptr, 160 ); region_construct( ptr_new_item ); return ptr_new_item; } inline void region_array_destroy( const region_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { region ptr_item = (region) array_instance_item_at( ptr, 160, i ); region_destroy( ptr_item ); } array_instance_destroy( ptr, 160 ); } inline void region_array_remove_item( const region_array & ptr, unsigned int index) { region ptr_item = (region) array_instance_item_at( ptr, 160, index ); region_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 160, index ); } #endif // region_array_DEFINED //----------------------------------------------------------------------------- // sequence_array //----------------------------------------------------------------------------- #ifndef sequence_array_DEFINED #define sequence_array_DEFINED inline unsigned int sequence_array_num_items( const sequence_array & ptr ) { return array_instance_num_items( ptr ); } inline void sequence_array_construct( const sequence_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const sequence sequence_array_item_at( const sequence_array & ptr, unsigned int index ) { return pointer_templ< _sequence>( array_instance_item_at( ptr, 64, index ) ); } inline const sequence sequence_array_add_item( const sequence_array & ptr ) { sequence ptr_new_item = (sequence) array_instance_add_item( ptr, 64 ); sequence_construct( ptr_new_item ); return ptr_new_item; } inline void sequence_array_destroy( const sequence_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { sequence ptr_item = (sequence) array_instance_item_at( ptr, 64, i ); sequence_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void sequence_array_remove_item( const sequence_array & ptr, unsigned int index) { sequence ptr_item = (sequence) array_instance_item_at( ptr, 64, index ); sequence_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // sequence_array_DEFINED //----------------------------------------------------------------------------- // layer_array //----------------------------------------------------------------------------- #ifndef layer_array_DEFINED #define layer_array_DEFINED inline unsigned int layer_array_num_items( const layer_array & ptr ) { return array_instance_num_items( ptr ); } inline void layer_array_construct( const layer_array & ptr ) { array_instance_construct( ptr, 136 ); } inline const layer layer_array_item_at( const layer_array & ptr, unsigned int index ) { return pointer_templ< _layer>( array_instance_item_at( ptr, 136, index ) ); } inline const layer layer_array_add_item( const layer_array & ptr ) { layer ptr_new_item = (layer) array_instance_add_item( ptr, 136 ); layer_construct( ptr_new_item ); return ptr_new_item; } inline void layer_array_destroy( const layer_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { layer ptr_item = (layer) array_instance_item_at( ptr, 136, i ); layer_destroy( ptr_item ); } array_instance_destroy( ptr, 136 ); } inline void layer_array_remove_item( const layer_array & ptr, unsigned int index) { layer ptr_item = (layer) array_instance_item_at( ptr, 136, index ); layer_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 136, index ); } #endif // layer_array_DEFINED //----------------------------------------------------------------------------- // event_clip_array //----------------------------------------------------------------------------- #ifndef event_clip_array_DEFINED #define event_clip_array_DEFINED inline unsigned int event_clip_array_num_items( const event_clip_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_clip_array_construct( const event_clip_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_clip event_clip_array_item_at( const event_clip_array & ptr, unsigned int index ) { return pointer_templ< _event_clip>( array_instance_item_at( ptr, 64, index ) ); } inline const event_clip event_clip_array_add_item( const event_clip_array & ptr ) { event_clip ptr_new_item = (event_clip) array_instance_add_item( ptr, 64 ); event_clip_construct( ptr_new_item ); return ptr_new_item; } inline void event_clip_array_destroy( const event_clip_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_clip ptr_item = (event_clip) array_instance_item_at( ptr, 64, i ); event_clip_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_clip_array_remove_item( const event_clip_array & ptr, unsigned int index) { event_clip ptr_item = (event_clip) array_instance_item_at( ptr, 64, index ); event_clip_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_clip_array_DEFINED //----------------------------------------------------------------------------- // event_stream_array //----------------------------------------------------------------------------- #ifndef event_stream_array_DEFINED #define event_stream_array_DEFINED inline unsigned int event_stream_array_num_items( const event_stream_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_stream_array_construct( const event_stream_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_stream event_stream_array_item_at( const event_stream_array & ptr, unsigned int index ) { return pointer_templ< _event_stream>( array_instance_item_at( ptr, 64, index ) ); } inline const event_stream event_stream_array_add_item( const event_stream_array & ptr ) { event_stream ptr_new_item = (event_stream) array_instance_add_item( ptr, 64 ); event_stream_construct( ptr_new_item ); return ptr_new_item; } inline void event_stream_array_destroy( const event_stream_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_stream ptr_item = (event_stream) array_instance_item_at( ptr, 64, i ); event_stream_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_stream_array_remove_item( const event_stream_array & ptr, unsigned int index) { event_stream ptr_item = (event_stream) array_instance_item_at( ptr, 64, index ); event_stream_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_stream_array_DEFINED //----------------------------------------------------------------------------- // event_silence_array //----------------------------------------------------------------------------- #ifndef event_silence_array_DEFINED #define event_silence_array_DEFINED inline unsigned int event_silence_array_num_items( const event_silence_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_silence_array_construct( const event_silence_array & ptr ) { array_instance_construct( ptr, 96 ); } inline const event_silence event_silence_array_item_at( const event_silence_array & ptr, unsigned int index ) { return pointer_templ< _event_silence>( array_instance_item_at( ptr, 96, index ) ); } inline const event_silence event_silence_array_add_item( const event_silence_array & ptr ) { event_silence ptr_new_item = (event_silence) array_instance_add_item( ptr, 96 ); event_silence_construct( ptr_new_item ); return ptr_new_item; } inline void event_silence_array_destroy( const event_silence_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_silence ptr_item = (event_silence) array_instance_item_at( ptr, 96, i ); event_silence_destroy( ptr_item ); } array_instance_destroy( ptr, 96 ); } inline void event_silence_array_remove_item( const event_silence_array & ptr, unsigned int index) { event_silence ptr_item = (event_silence) array_instance_item_at( ptr, 96, index ); event_silence_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 96, index ); } #endif // event_silence_array_DEFINED //----------------------------------------------------------------------------- // event_var_volume_array //----------------------------------------------------------------------------- #ifndef event_var_volume_array_DEFINED #define event_var_volume_array_DEFINED inline unsigned int event_var_volume_array_num_items( const event_var_volume_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_volume_array_construct( const event_var_volume_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_volume event_var_volume_array_item_at( const event_var_volume_array & ptr, unsigned int index ) { return pointer_templ< _event_var_volume>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_volume event_var_volume_array_add_item( const event_var_volume_array & ptr ) { event_var_volume ptr_new_item = (event_var_volume) array_instance_add_item( ptr, 64 ); event_var_volume_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_volume_array_destroy( const event_var_volume_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_volume ptr_item = (event_var_volume) array_instance_item_at( ptr, 64, i ); event_var_volume_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_volume_array_remove_item( const event_var_volume_array & ptr, unsigned int index) { event_var_volume ptr_item = (event_var_volume) array_instance_item_at( ptr, 64, index ); event_var_volume_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_volume_array_DEFINED //----------------------------------------------------------------------------- // event_var_pitch_array //----------------------------------------------------------------------------- #ifndef event_var_pitch_array_DEFINED #define event_var_pitch_array_DEFINED inline unsigned int event_var_pitch_array_num_items( const event_var_pitch_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_pitch_array_construct( const event_var_pitch_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_pitch event_var_pitch_array_item_at( const event_var_pitch_array & ptr, unsigned int index ) { return pointer_templ< _event_var_pitch>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_pitch event_var_pitch_array_add_item( const event_var_pitch_array & ptr ) { event_var_pitch ptr_new_item = (event_var_pitch) array_instance_add_item( ptr, 64 ); event_var_pitch_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_pitch_array_destroy( const event_var_pitch_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_pitch ptr_item = (event_var_pitch) array_instance_item_at( ptr, 64, i ); event_var_pitch_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_pitch_array_remove_item( const event_var_pitch_array & ptr, unsigned int index) { event_var_pitch ptr_item = (event_var_pitch) array_instance_item_at( ptr, 64, index ); event_var_pitch_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_pitch_array_DEFINED //----------------------------------------------------------------------------- // event_var_volume_rand_min_array //----------------------------------------------------------------------------- #ifndef event_var_volume_rand_min_array_DEFINED #define event_var_volume_rand_min_array_DEFINED inline unsigned int event_var_volume_rand_min_array_num_items( const event_var_volume_rand_min_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_volume_rand_min_array_construct( const event_var_volume_rand_min_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_volume_rand_min event_var_volume_rand_min_array_item_at( const event_var_volume_rand_min_array & ptr, unsigned int index ) { return pointer_templ< _event_var_volume_rand_min>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_volume_rand_min event_var_volume_rand_min_array_add_item( const event_var_volume_rand_min_array & ptr ) { event_var_volume_rand_min ptr_new_item = (event_var_volume_rand_min) array_instance_add_item( ptr, 64 ); event_var_volume_rand_min_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_volume_rand_min_array_destroy( const event_var_volume_rand_min_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_volume_rand_min ptr_item = (event_var_volume_rand_min) array_instance_item_at( ptr, 64, i ); event_var_volume_rand_min_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_volume_rand_min_array_remove_item( const event_var_volume_rand_min_array & ptr, unsigned int index) { event_var_volume_rand_min ptr_item = (event_var_volume_rand_min) array_instance_item_at( ptr, 64, index ); event_var_volume_rand_min_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_volume_rand_min_array_DEFINED //----------------------------------------------------------------------------- // event_var_volume_rand_max_array //----------------------------------------------------------------------------- #ifndef event_var_volume_rand_max_array_DEFINED #define event_var_volume_rand_max_array_DEFINED inline unsigned int event_var_volume_rand_max_array_num_items( const event_var_volume_rand_max_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_volume_rand_max_array_construct( const event_var_volume_rand_max_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_volume_rand_max event_var_volume_rand_max_array_item_at( const event_var_volume_rand_max_array & ptr, unsigned int index ) { return pointer_templ< _event_var_volume_rand_max>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_volume_rand_max event_var_volume_rand_max_array_add_item( const event_var_volume_rand_max_array & ptr ) { event_var_volume_rand_max ptr_new_item = (event_var_volume_rand_max) array_instance_add_item( ptr, 64 ); event_var_volume_rand_max_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_volume_rand_max_array_destroy( const event_var_volume_rand_max_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_volume_rand_max ptr_item = (event_var_volume_rand_max) array_instance_item_at( ptr, 64, i ); event_var_volume_rand_max_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_volume_rand_max_array_remove_item( const event_var_volume_rand_max_array & ptr, unsigned int index) { event_var_volume_rand_max ptr_item = (event_var_volume_rand_max) array_instance_item_at( ptr, 64, index ); event_var_volume_rand_max_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_volume_rand_max_array_DEFINED //----------------------------------------------------------------------------- // event_var_pitch_rand_min_array //----------------------------------------------------------------------------- #ifndef event_var_pitch_rand_min_array_DEFINED #define event_var_pitch_rand_min_array_DEFINED inline unsigned int event_var_pitch_rand_min_array_num_items( const event_var_pitch_rand_min_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_pitch_rand_min_array_construct( const event_var_pitch_rand_min_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_pitch_rand_min event_var_pitch_rand_min_array_item_at( const event_var_pitch_rand_min_array & ptr, unsigned int index ) { return pointer_templ< _event_var_pitch_rand_min>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_pitch_rand_min event_var_pitch_rand_min_array_add_item( const event_var_pitch_rand_min_array & ptr ) { event_var_pitch_rand_min ptr_new_item = (event_var_pitch_rand_min) array_instance_add_item( ptr, 64 ); event_var_pitch_rand_min_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_pitch_rand_min_array_destroy( const event_var_pitch_rand_min_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_pitch_rand_min ptr_item = (event_var_pitch_rand_min) array_instance_item_at( ptr, 64, i ); event_var_pitch_rand_min_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_pitch_rand_min_array_remove_item( const event_var_pitch_rand_min_array & ptr, unsigned int index) { event_var_pitch_rand_min ptr_item = (event_var_pitch_rand_min) array_instance_item_at( ptr, 64, index ); event_var_pitch_rand_min_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_pitch_rand_min_array_DEFINED //----------------------------------------------------------------------------- // event_var_pitch_rand_max_array //----------------------------------------------------------------------------- #ifndef event_var_pitch_rand_max_array_DEFINED #define event_var_pitch_rand_max_array_DEFINED inline unsigned int event_var_pitch_rand_max_array_num_items( const event_var_pitch_rand_max_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_pitch_rand_max_array_construct( const event_var_pitch_rand_max_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_pitch_rand_max event_var_pitch_rand_max_array_item_at( const event_var_pitch_rand_max_array & ptr, unsigned int index ) { return pointer_templ< _event_var_pitch_rand_max>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_pitch_rand_max event_var_pitch_rand_max_array_add_item( const event_var_pitch_rand_max_array & ptr ) { event_var_pitch_rand_max ptr_new_item = (event_var_pitch_rand_max) array_instance_add_item( ptr, 64 ); event_var_pitch_rand_max_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_pitch_rand_max_array_destroy( const event_var_pitch_rand_max_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_pitch_rand_max ptr_item = (event_var_pitch_rand_max) array_instance_item_at( ptr, 64, i ); event_var_pitch_rand_max_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_pitch_rand_max_array_remove_item( const event_var_pitch_rand_max_array & ptr, unsigned int index) { event_var_pitch_rand_max ptr_item = (event_var_pitch_rand_max) array_instance_item_at( ptr, 64, index ); event_var_pitch_rand_max_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_pitch_rand_max_array_DEFINED //----------------------------------------------------------------------------- // event_var_aux_gain_array //----------------------------------------------------------------------------- #ifndef event_var_aux_gain_array_DEFINED #define event_var_aux_gain_array_DEFINED inline unsigned int event_var_aux_gain_array_num_items( const event_var_aux_gain_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_aux_gain_array_construct( const event_var_aux_gain_array & ptr ) { array_instance_construct( ptr, 96 ); } inline const event_var_aux_gain event_var_aux_gain_array_item_at( const event_var_aux_gain_array & ptr, unsigned int index ) { return pointer_templ< _event_var_aux_gain>( array_instance_item_at( ptr, 96, index ) ); } inline const event_var_aux_gain event_var_aux_gain_array_add_item( const event_var_aux_gain_array & ptr ) { event_var_aux_gain ptr_new_item = (event_var_aux_gain) array_instance_add_item( ptr, 96 ); event_var_aux_gain_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_aux_gain_array_destroy( const event_var_aux_gain_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_aux_gain ptr_item = (event_var_aux_gain) array_instance_item_at( ptr, 96, i ); event_var_aux_gain_destroy( ptr_item ); } array_instance_destroy( ptr, 96 ); } inline void event_var_aux_gain_array_remove_item( const event_var_aux_gain_array & ptr, unsigned int index) { event_var_aux_gain ptr_item = (event_var_aux_gain) array_instance_item_at( ptr, 96, index ); event_var_aux_gain_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 96, index ); } #endif // event_var_aux_gain_array_DEFINED //----------------------------------------------------------------------------- // event_var_positional_array //----------------------------------------------------------------------------- #ifndef event_var_positional_array_DEFINED #define event_var_positional_array_DEFINED inline unsigned int event_var_positional_array_num_items( const event_var_positional_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_positional_array_construct( const event_var_positional_array & ptr ) { array_instance_construct( ptr, 40 ); } inline const event_var_positional event_var_positional_array_item_at( const event_var_positional_array & ptr, unsigned int index ) { return pointer_templ< _event_var_positional>( array_instance_item_at( ptr, 40, index ) ); } inline const event_var_positional event_var_positional_array_add_item( const event_var_positional_array & ptr ) { event_var_positional ptr_new_item = (event_var_positional) array_instance_add_item( ptr, 40 ); event_var_positional_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_positional_array_destroy( const event_var_positional_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_positional ptr_item = (event_var_positional) array_instance_item_at( ptr, 40, i ); event_var_positional_destroy( ptr_item ); } array_instance_destroy( ptr, 40 ); } inline void event_var_positional_array_remove_item( const event_var_positional_array & ptr, unsigned int index) { event_var_positional ptr_item = (event_var_positional) array_instance_item_at( ptr, 40, index ); event_var_positional_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 40, index ); } #endif // event_var_positional_array_DEFINED //----------------------------------------------------------------------------- // event_var_pos_fall_off_array //----------------------------------------------------------------------------- #ifndef event_var_pos_fall_off_array_DEFINED #define event_var_pos_fall_off_array_DEFINED inline unsigned int event_var_pos_fall_off_array_num_items( const event_var_pos_fall_off_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_pos_fall_off_array_construct( const event_var_pos_fall_off_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_pos_fall_off event_var_pos_fall_off_array_item_at( const event_var_pos_fall_off_array & ptr, unsigned int index ) { return pointer_templ< _event_var_pos_fall_off>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_pos_fall_off event_var_pos_fall_off_array_add_item( const event_var_pos_fall_off_array & ptr ) { event_var_pos_fall_off ptr_new_item = (event_var_pos_fall_off) array_instance_add_item( ptr, 64 ); event_var_pos_fall_off_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_pos_fall_off_array_destroy( const event_var_pos_fall_off_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_pos_fall_off ptr_item = (event_var_pos_fall_off) array_instance_item_at( ptr, 64, i ); event_var_pos_fall_off_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_pos_fall_off_array_remove_item( const event_var_pos_fall_off_array & ptr, unsigned int index) { event_var_pos_fall_off ptr_item = (event_var_pos_fall_off) array_instance_item_at( ptr, 64, index ); event_var_pos_fall_off_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_pos_fall_off_array_DEFINED //----------------------------------------------------------------------------- // event_var_pos_dist_min_array //----------------------------------------------------------------------------- #ifndef event_var_pos_dist_min_array_DEFINED #define event_var_pos_dist_min_array_DEFINED inline unsigned int event_var_pos_dist_min_array_num_items( const event_var_pos_dist_min_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_pos_dist_min_array_construct( const event_var_pos_dist_min_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_pos_dist_min event_var_pos_dist_min_array_item_at( const event_var_pos_dist_min_array & ptr, unsigned int index ) { return pointer_templ< _event_var_pos_dist_min>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_pos_dist_min event_var_pos_dist_min_array_add_item( const event_var_pos_dist_min_array & ptr ) { event_var_pos_dist_min ptr_new_item = (event_var_pos_dist_min) array_instance_add_item( ptr, 64 ); event_var_pos_dist_min_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_pos_dist_min_array_destroy( const event_var_pos_dist_min_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_pos_dist_min ptr_item = (event_var_pos_dist_min) array_instance_item_at( ptr, 64, i ); event_var_pos_dist_min_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_pos_dist_min_array_remove_item( const event_var_pos_dist_min_array & ptr, unsigned int index) { event_var_pos_dist_min ptr_item = (event_var_pos_dist_min) array_instance_item_at( ptr, 64, index ); event_var_pos_dist_min_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_pos_dist_min_array_DEFINED //----------------------------------------------------------------------------- // event_var_pos_dist_max_array //----------------------------------------------------------------------------- #ifndef event_var_pos_dist_max_array_DEFINED #define event_var_pos_dist_max_array_DEFINED inline unsigned int event_var_pos_dist_max_array_num_items( const event_var_pos_dist_max_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_var_pos_dist_max_array_construct( const event_var_pos_dist_max_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_var_pos_dist_max event_var_pos_dist_max_array_item_at( const event_var_pos_dist_max_array & ptr, unsigned int index ) { return pointer_templ< _event_var_pos_dist_max>( array_instance_item_at( ptr, 64, index ) ); } inline const event_var_pos_dist_max event_var_pos_dist_max_array_add_item( const event_var_pos_dist_max_array & ptr ) { event_var_pos_dist_max ptr_new_item = (event_var_pos_dist_max) array_instance_add_item( ptr, 64 ); event_var_pos_dist_max_construct( ptr_new_item ); return ptr_new_item; } inline void event_var_pos_dist_max_array_destroy( const event_var_pos_dist_max_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_var_pos_dist_max ptr_item = (event_var_pos_dist_max) array_instance_item_at( ptr, 64, i ); event_var_pos_dist_max_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_var_pos_dist_max_array_remove_item( const event_var_pos_dist_max_array & ptr, unsigned int index) { event_var_pos_dist_max ptr_item = (event_var_pos_dist_max) array_instance_item_at( ptr, 64, index ); event_var_pos_dist_max_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_var_pos_dist_max_array_DEFINED //----------------------------------------------------------------------------- // event_callback_array //----------------------------------------------------------------------------- #ifndef event_callback_array_DEFINED #define event_callback_array_DEFINED inline unsigned int event_callback_array_num_items( const event_callback_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_callback_array_construct( const event_callback_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_callback event_callback_array_item_at( const event_callback_array & ptr, unsigned int index ) { return pointer_templ< _event_callback>( array_instance_item_at( ptr, 64, index ) ); } inline const event_callback event_callback_array_add_item( const event_callback_array & ptr ) { event_callback ptr_new_item = (event_callback) array_instance_add_item( ptr, 64 ); event_callback_construct( ptr_new_item ); return ptr_new_item; } inline void event_callback_array_destroy( const event_callback_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_callback ptr_item = (event_callback) array_instance_item_at( ptr, 64, i ); event_callback_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_callback_array_remove_item( const event_callback_array & ptr, unsigned int index) { event_callback ptr_item = (event_callback) array_instance_item_at( ptr, 64, index ); event_callback_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_callback_array_DEFINED //----------------------------------------------------------------------------- // event_logic_and_array //----------------------------------------------------------------------------- #ifndef event_logic_and_array_DEFINED #define event_logic_and_array_DEFINED inline unsigned int event_logic_and_array_num_items( const event_logic_and_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_logic_and_array_construct( const event_logic_and_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_logic_and event_logic_and_array_item_at( const event_logic_and_array & ptr, unsigned int index ) { return pointer_templ< _event_logic_and>( array_instance_item_at( ptr, 64, index ) ); } inline const event_logic_and event_logic_and_array_add_item( const event_logic_and_array & ptr ) { event_logic_and ptr_new_item = (event_logic_and) array_instance_add_item( ptr, 64 ); event_logic_and_construct( ptr_new_item ); return ptr_new_item; } inline void event_logic_and_array_destroy( const event_logic_and_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_logic_and ptr_item = (event_logic_and) array_instance_item_at( ptr, 64, i ); event_logic_and_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_logic_and_array_remove_item( const event_logic_and_array & ptr, unsigned int index) { event_logic_and ptr_item = (event_logic_and) array_instance_item_at( ptr, 64, index ); event_logic_and_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_logic_and_array_DEFINED //----------------------------------------------------------------------------- // event_logic_or_array //----------------------------------------------------------------------------- #ifndef event_logic_or_array_DEFINED #define event_logic_or_array_DEFINED inline unsigned int event_logic_or_array_num_items( const event_logic_or_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_logic_or_array_construct( const event_logic_or_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const event_logic_or event_logic_or_array_item_at( const event_logic_or_array & ptr, unsigned int index ) { return pointer_templ< _event_logic_or>( array_instance_item_at( ptr, 64, index ) ); } inline const event_logic_or event_logic_or_array_add_item( const event_logic_or_array & ptr ) { event_logic_or ptr_new_item = (event_logic_or) array_instance_add_item( ptr, 64 ); event_logic_or_construct( ptr_new_item ); return ptr_new_item; } inline void event_logic_or_array_destroy( const event_logic_or_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_logic_or ptr_item = (event_logic_or) array_instance_item_at( ptr, 64, i ); event_logic_or_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void event_logic_or_array_remove_item( const event_logic_or_array & ptr, unsigned int index) { event_logic_or ptr_item = (event_logic_or) array_instance_item_at( ptr, 64, index ); event_logic_or_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // event_logic_or_array_DEFINED //----------------------------------------------------------------------------- // event_logic_repeat_array //----------------------------------------------------------------------------- #ifndef event_logic_repeat_array_DEFINED #define event_logic_repeat_array_DEFINED inline unsigned int event_logic_repeat_array_num_items( const event_logic_repeat_array & ptr ) { return array_instance_num_items( ptr ); } inline void event_logic_repeat_array_construct( const event_logic_repeat_array & ptr ) { array_instance_construct( ptr, 128 ); } inline const event_logic_repeat event_logic_repeat_array_item_at( const event_logic_repeat_array & ptr, unsigned int index ) { return pointer_templ< _event_logic_repeat>( array_instance_item_at( ptr, 128, index ) ); } inline const event_logic_repeat event_logic_repeat_array_add_item( const event_logic_repeat_array & ptr ) { event_logic_repeat ptr_new_item = (event_logic_repeat) array_instance_add_item( ptr, 128 ); event_logic_repeat_construct( ptr_new_item ); return ptr_new_item; } inline void event_logic_repeat_array_destroy( const event_logic_repeat_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { event_logic_repeat ptr_item = (event_logic_repeat) array_instance_item_at( ptr, 128, i ); event_logic_repeat_destroy( ptr_item ); } array_instance_destroy( ptr, 128 ); } inline void event_logic_repeat_array_remove_item( const event_logic_repeat_array & ptr, unsigned int index) { event_logic_repeat ptr_item = (event_logic_repeat) array_instance_item_at( ptr, 128, index ); event_logic_repeat_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 128, index ); } #endif // event_logic_repeat_array_DEFINED //----------------------------------------------------------------------------- // play_region_action_array //----------------------------------------------------------------------------- #ifndef play_region_action_array_DEFINED #define play_region_action_array_DEFINED inline unsigned int play_region_action_array_num_items( const play_region_action_array & ptr ) { return array_instance_num_items( ptr ); } inline void play_region_action_array_construct( const play_region_action_array & ptr ) { array_instance_construct( ptr, 96 ); } inline const play_region_action play_region_action_array_item_at( const play_region_action_array & ptr, unsigned int index ) { return pointer_templ< _play_region_action>( array_instance_item_at( ptr, 96, index ) ); } inline const play_region_action play_region_action_array_add_item( const play_region_action_array & ptr ) { play_region_action ptr_new_item = (play_region_action) array_instance_add_item( ptr, 96 ); play_region_action_construct( ptr_new_item ); return ptr_new_item; } inline void play_region_action_array_destroy( const play_region_action_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { play_region_action ptr_item = (play_region_action) array_instance_item_at( ptr, 96, i ); play_region_action_destroy( ptr_item ); } array_instance_destroy( ptr, 96 ); } inline void play_region_action_array_remove_item( const play_region_action_array & ptr, unsigned int index) { play_region_action ptr_item = (play_region_action) array_instance_item_at( ptr, 96, index ); play_region_action_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 96, index ); } #endif // play_region_action_array_DEFINED //----------------------------------------------------------------------------- // push_region_action_array //----------------------------------------------------------------------------- #ifndef push_region_action_array_DEFINED #define push_region_action_array_DEFINED inline unsigned int push_region_action_array_num_items( const push_region_action_array & ptr ) { return array_instance_num_items( ptr ); } inline void push_region_action_array_construct( const push_region_action_array & ptr ) { array_instance_construct( ptr, 128 ); } inline const push_region_action push_region_action_array_item_at( const push_region_action_array & ptr, unsigned int index ) { return pointer_templ< _push_region_action>( array_instance_item_at( ptr, 128, index ) ); } inline const push_region_action push_region_action_array_add_item( const push_region_action_array & ptr ) { push_region_action ptr_new_item = (push_region_action) array_instance_add_item( ptr, 128 ); push_region_action_construct( ptr_new_item ); return ptr_new_item; } inline void push_region_action_array_destroy( const push_region_action_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { push_region_action ptr_item = (push_region_action) array_instance_item_at( ptr, 128, i ); push_region_action_destroy( ptr_item ); } array_instance_destroy( ptr, 128 ); } inline void push_region_action_array_remove_item( const push_region_action_array & ptr, unsigned int index) { push_region_action ptr_item = (push_region_action) array_instance_item_at( ptr, 128, index ); push_region_action_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 128, index ); } #endif // push_region_action_array_DEFINED //----------------------------------------------------------------------------- // pop_region_action_array //----------------------------------------------------------------------------- #ifndef pop_region_action_array_DEFINED #define pop_region_action_array_DEFINED inline unsigned int pop_region_action_array_num_items( const pop_region_action_array & ptr ) { return array_instance_num_items( ptr ); } inline void pop_region_action_array_construct( const pop_region_action_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const pop_region_action pop_region_action_array_item_at( const pop_region_action_array & ptr, unsigned int index ) { return pointer_templ< _pop_region_action>( array_instance_item_at( ptr, 64, index ) ); } inline const pop_region_action pop_region_action_array_add_item( const pop_region_action_array & ptr ) { pop_region_action ptr_new_item = (pop_region_action) array_instance_add_item( ptr, 64 ); pop_region_action_construct( ptr_new_item ); return ptr_new_item; } inline void pop_region_action_array_destroy( const pop_region_action_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { pop_region_action ptr_item = (pop_region_action) array_instance_item_at( ptr, 64, i ); pop_region_action_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void pop_region_action_array_remove_item( const pop_region_action_array & ptr, unsigned int index) { pop_region_action ptr_item = (pop_region_action) array_instance_item_at( ptr, 64, index ); pop_region_action_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // pop_region_action_array_DEFINED //----------------------------------------------------------------------------- // start_layer_action_array //----------------------------------------------------------------------------- #ifndef start_layer_action_array_DEFINED #define start_layer_action_array_DEFINED inline unsigned int start_layer_action_array_num_items( const start_layer_action_array & ptr ) { return array_instance_num_items( ptr ); } inline void start_layer_action_array_construct( const start_layer_action_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const start_layer_action start_layer_action_array_item_at( const start_layer_action_array & ptr, unsigned int index ) { return pointer_templ< _start_layer_action>( array_instance_item_at( ptr, 64, index ) ); } inline const start_layer_action start_layer_action_array_add_item( const start_layer_action_array & ptr ) { start_layer_action ptr_new_item = (start_layer_action) array_instance_add_item( ptr, 64 ); start_layer_action_construct( ptr_new_item ); return ptr_new_item; } inline void start_layer_action_array_destroy( const start_layer_action_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { start_layer_action ptr_item = (start_layer_action) array_instance_item_at( ptr, 64, i ); start_layer_action_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void start_layer_action_array_remove_item( const start_layer_action_array & ptr, unsigned int index) { start_layer_action ptr_item = (start_layer_action) array_instance_item_at( ptr, 64, index ); start_layer_action_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // start_layer_action_array_DEFINED //----------------------------------------------------------------------------- // stop_layer_action_array //----------------------------------------------------------------------------- #ifndef stop_layer_action_array_DEFINED #define stop_layer_action_array_DEFINED inline unsigned int stop_layer_action_array_num_items( const stop_layer_action_array & ptr ) { return array_instance_num_items( ptr ); } inline void stop_layer_action_array_construct( const stop_layer_action_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const stop_layer_action stop_layer_action_array_item_at( const stop_layer_action_array & ptr, unsigned int index ) { return pointer_templ< _stop_layer_action>( array_instance_item_at( ptr, 64, index ) ); } inline const stop_layer_action stop_layer_action_array_add_item( const stop_layer_action_array & ptr ) { stop_layer_action ptr_new_item = (stop_layer_action) array_instance_add_item( ptr, 64 ); stop_layer_action_construct( ptr_new_item ); return ptr_new_item; } inline void stop_layer_action_array_destroy( const stop_layer_action_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { stop_layer_action ptr_item = (stop_layer_action) array_instance_item_at( ptr, 64, i ); stop_layer_action_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void stop_layer_action_array_remove_item( const stop_layer_action_array & ptr, unsigned int index) { stop_layer_action ptr_item = (stop_layer_action) array_instance_item_at( ptr, 64, index ); stop_layer_action_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // stop_layer_action_array_DEFINED //----------------------------------------------------------------------------- // rand_state_action_array //----------------------------------------------------------------------------- #ifndef rand_state_action_array_DEFINED #define rand_state_action_array_DEFINED inline unsigned int rand_state_action_array_num_items( const rand_state_action_array & ptr ) { return array_instance_num_items( ptr ); } inline void rand_state_action_array_construct( const rand_state_action_array & ptr ) { array_instance_construct( ptr, 64 ); } inline const rand_state_action rand_state_action_array_item_at( const rand_state_action_array & ptr, unsigned int index ) { return pointer_templ< _rand_state_action>( array_instance_item_at( ptr, 64, index ) ); } inline const rand_state_action rand_state_action_array_add_item( const rand_state_action_array & ptr ) { rand_state_action ptr_new_item = (rand_state_action) array_instance_add_item( ptr, 64 ); rand_state_action_construct( ptr_new_item ); return ptr_new_item; } inline void rand_state_action_array_destroy( const rand_state_action_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { rand_state_action ptr_item = (rand_state_action) array_instance_item_at( ptr, 64, i ); rand_state_action_destroy( ptr_item ); } array_instance_destroy( ptr, 64 ); } inline void rand_state_action_array_remove_item( const rand_state_action_array & ptr, unsigned int index) { rand_state_action ptr_item = (rand_state_action) array_instance_item_at( ptr, 64, index ); rand_state_action_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 64, index ); } #endif // rand_state_action_array_DEFINED //----------------------------------------------------------------------------- // stream_ref_array //----------------------------------------------------------------------------- #ifndef stream_ref_array_DEFINED #define stream_ref_array_DEFINED inline unsigned int stream_ref_array_num_items( const stream_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void stream_ref_array_construct( const stream_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const stream stream_ref_array_item_at( const stream_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (stream) block_read_reference( ptr_item ); } inline void stream_ref_array_add_item( const stream_ref_array & ptr, const stream & ptr_item ) { stream_ref ptr_new_item = (stream_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void stream_ref_array_destroy( const stream_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { stream_ref ptr_item = (stream_ref) array_instance_item_at( ptr, 32, i ); stream_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // stream_ref_array_DEFINED //----------------------------------------------------------------------------- // clip_ref_array //----------------------------------------------------------------------------- #ifndef clip_ref_array_DEFINED #define clip_ref_array_DEFINED inline unsigned int clip_ref_array_num_items( const clip_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void clip_ref_array_construct( const clip_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const clip clip_ref_array_item_at( const clip_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (clip) block_read_reference( ptr_item ); } inline void clip_ref_array_add_item( const clip_ref_array & ptr, const clip & ptr_item ) { clip_ref ptr_new_item = (clip_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void clip_ref_array_destroy( const clip_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { clip_ref ptr_item = (clip_ref) array_instance_item_at( ptr, 32, i ); clip_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // clip_ref_array_DEFINED //----------------------------------------------------------------------------- // region_ref_array //----------------------------------------------------------------------------- #ifndef region_ref_array_DEFINED #define region_ref_array_DEFINED inline unsigned int region_ref_array_num_items( const region_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void region_ref_array_construct( const region_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const region region_ref_array_item_at( const region_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (region) block_read_reference( ptr_item ); } inline void region_ref_array_add_item( const region_ref_array & ptr, const region & ptr_item ) { region_ref ptr_new_item = (region_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void region_ref_array_destroy( const region_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { region_ref ptr_item = (region_ref) array_instance_item_at( ptr, 32, i ); region_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // region_ref_array_DEFINED //----------------------------------------------------------------------------- // state_ref_array //----------------------------------------------------------------------------- #ifndef state_ref_array_DEFINED #define state_ref_array_DEFINED inline unsigned int state_ref_array_num_items( const state_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void state_ref_array_construct( const state_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const state state_ref_array_item_at( const state_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (state) block_read_reference( ptr_item ); } inline void state_ref_array_add_item( const state_ref_array & ptr, const state & ptr_item ) { state_ref ptr_new_item = (state_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void state_ref_array_destroy( const state_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { state_ref ptr_item = (state_ref) array_instance_item_at( ptr, 32, i ); state_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // state_ref_array_DEFINED //----------------------------------------------------------------------------- // action_ref_array //----------------------------------------------------------------------------- #ifndef action_ref_array_DEFINED #define action_ref_array_DEFINED inline unsigned int action_ref_array_num_items( const action_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void action_ref_array_construct( const action_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const action action_ref_array_item_at( const action_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (action) block_read_reference( ptr_item ); } inline void action_ref_array_add_item( const action_ref_array & ptr, const action & ptr_item ) { action_ref ptr_new_item = (action_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void action_ref_array_destroy( const action_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { action_ref ptr_item = (action_ref) array_instance_item_at( ptr, 32, i ); action_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // action_ref_array_DEFINED //----------------------------------------------------------------------------- // action_ref_array_array //----------------------------------------------------------------------------- #ifndef action_ref_array_array_DEFINED #define action_ref_array_array_DEFINED inline unsigned int action_ref_array_array_num_items( const action_ref_array_array & ptr ) { return array_instance_num_items( ptr ); } inline void action_ref_array_array_construct( const action_ref_array_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const action_ref_array action_ref_array_array_item_at( const action_ref_array_array & ptr, unsigned int index ) { return pointer_templ< _action_ref_array>( array_instance_item_at( ptr, 32, index ) ); } inline const action_ref_array action_ref_array_array_add_item( const action_ref_array_array & ptr ) { action_ref_array ptr_new_item = (action_ref_array) array_instance_add_item( ptr, 32 ); action_ref_array_construct( ptr_new_item ); return ptr_new_item; } inline void action_ref_array_array_destroy( const action_ref_array_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { action_ref_array ptr_item = (action_ref_array) array_instance_item_at( ptr, 32, i ); action_ref_array_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } inline void action_ref_array_array_remove_item( const action_ref_array_array & ptr, unsigned int index) { action_ref_array ptr_item = (action_ref_array) array_instance_item_at( ptr, 32, index ); action_ref_array_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 32, index ); } #endif // action_ref_array_array_DEFINED //----------------------------------------------------------------------------- // string_array //----------------------------------------------------------------------------- #ifndef string_array_DEFINED #define string_array_DEFINED inline unsigned int string_array_num_items( const string_array & ptr ) { return array_instance_num_items( ptr ); } inline void string_array_construct( const string_array & ptr ) { array_instance_construct( ptr, 32 ); } inline void string_array_item_at( const string_array & ptr, unsigned int index, char * p_string, unsigned int len ) { return string_instance_read( array_instance_item_at( ptr, 32, index ), p_string, len ); } inline void string_array_item_at( const string_array & ptr, unsigned int index, const char * p_new_val ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); string_instance_destroy( ptr_item ); string_instance_construct( ptr_item ); string_instance_write( ptr_item, p_new_val ); } inline void string_array_add_item( const string_array & ptr, const char * p_string ) { pointer ptr_new_item = array_instance_add_item( ptr, 32 ); string_instance_construct( ptr_new_item ); string_instance_write( ptr_new_item, p_string ); } inline void string_array_remove_item( const string_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); string_instance_destroy( ptr_item ); ptr_item = pointer_null; array_instance_remove_item( ptr, 32, index ); } inline void string_array_destroy( const string_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { pointer ptr_item = array_instance_item_at( ptr, 32, i ); string_instance_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // string_array_DEFINED //----------------------------------------------------------------------------- // layer_ref_array //----------------------------------------------------------------------------- #ifndef layer_ref_array_DEFINED #define layer_ref_array_DEFINED inline unsigned int layer_ref_array_num_items( const layer_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void layer_ref_array_construct( const layer_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const layer layer_ref_array_item_at( const layer_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (layer) block_read_reference( ptr_item ); } inline void layer_ref_array_add_item( const layer_ref_array & ptr, const layer & ptr_item ) { layer_ref ptr_new_item = (layer_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void layer_ref_array_destroy( const layer_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { layer_ref ptr_item = (layer_ref) array_instance_item_at( ptr, 32, i ); layer_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // layer_ref_array_DEFINED //----------------------------------------------------------------------------- // float_array //----------------------------------------------------------------------------- #ifndef float_array_DEFINED #define float_array_DEFINED inline unsigned int float_array_num_items( const float_array & ptr ) { return array_instance_num_items( ptr ); } inline void float_array_construct( const float_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const float float_array_item_at( const float_array & ptr, unsigned int index ) { return float_instance_read( array_instance_item_at( ptr, 32, index ) ); } inline void float_array_add_item( const float_array & ptr, float item ) { float_instance_write( array_instance_add_item( ptr, 32 ), item ); } inline void float_array_destroy( const float_array & ptr ) { array_instance_destroy( ptr, 32 ); } #endif // float_array_DEFINED //----------------------------------------------------------------------------- // sequence_event_ref_array //----------------------------------------------------------------------------- #ifndef sequence_event_ref_array_DEFINED #define sequence_event_ref_array_DEFINED inline unsigned int sequence_event_ref_array_num_items( const sequence_event_ref_array & ptr ) { return array_instance_num_items( ptr ); } inline void sequence_event_ref_array_construct( const sequence_event_ref_array & ptr ) { array_instance_construct( ptr, 32 ); } inline const sequence_event sequence_event_ref_array_item_at( const sequence_event_ref_array & ptr, unsigned int index ) { pointer ptr_item = array_instance_item_at( ptr, 32, index ); return (sequence_event) block_read_reference( ptr_item ); } inline void sequence_event_ref_array_add_item( const sequence_event_ref_array & ptr, const sequence_event & ptr_item ) { sequence_event_ref ptr_new_item = (sequence_event_ref) array_instance_add_item( ptr, 32 ); block_write_reference( ptr_new_item, ptr_item ); } inline void sequence_event_ref_array_destroy( const sequence_event_ref_array & ptr ) { unsigned int items = array_instance_num_items( ptr ); for(unsigned int i = 0; i < items; i ++ ) { sequence_event_ref ptr_item = (sequence_event_ref) array_instance_item_at( ptr, 32, i ); sequence_event_ref_destroy( ptr_item ); } array_instance_destroy( ptr, 32 ); } #endif // sequence_event_ref_array_DEFINED } #endif
65cb77bf66f802b1cdf8c1e4fa1ac2a4b0bdb7eb
cc85f1bf6879b4c427f3ac62e09f280cf53566dd
/scripts/DSLinkedList.h
0155b050e6cc957318faa14e12a6631ca7e4e8a2
[]
no_license
MagicKey23/Search-Engine
b37d6b68c43f1003c1788f9b52366f018444f763
7b3b7c47355c61d6c982999945d6a03090b05445
refs/heads/main
2023-04-22T01:56:41.272386
2021-05-18T03:59:53
2021-05-18T03:59:53
367,250,012
0
0
null
null
null
null
UTF-8
C++
false
false
6,700
h
DSLinkedList.h
#ifndef DLLINKEDLIST_H #define DLLINKEDLIST_H #include <iostream> using namespace std; template <typename T> class DLListNode { public: DLListNode() { next = prev = nullptr; } DLListNode(const T& el, DLListNode *n = nullptr, DLListNode *p = nullptr) { data = el; next = n; prev = p; } T data; DLListNode *next, *prev; }; template <typename T> class DSLinkedList //linked list of DLListNode objects { public: DSLinkedList(){ head = tail = nullptr; } DSLinkedList(const DSLinkedList<T>& other) = delete; DSLinkedList(DSLinkedList<T>&& other) = delete; ~DSLinkedList(); void print(); //prints the contents of the linked list DLListNode<T>* search(T); //searches for a value in the linked list and returns the point to object that contains that value T back(); T front(); int getSize(); void pop(); T peek(); void push_front(T); //inserts new DLListNode before the first DLListNode in the list void push_back(T); //inserts new DLListNode after the last DLListNode in the list\ //OverLoad DSLinkedList<T>& operator=(const DSLinkedList<T>& other) = delete; DSLinkedList<T>& operator=(DSLinkedList<T>&& other) = delete; // Inner class Iterator class Iterator { friend class DSLinkedList; private: DLListNode<T> *DLListNodePtr; // The constructor is private, so only our friends // can create instances of Iterators. Iterator(DLListNode<T> *newPtr) : DLListNodePtr(newPtr) {} public: Iterator() : DLListNodePtr(nullptr) {} // Overload for the comparison operator != bool operator!=(const Iterator& itr) const { return DLListNodePtr != itr.DLListNodePtr; } // Overload for the dereference operator * T& operator*() const { return DLListNodePtr->data; } // Overload for the postincrement operator ++ Iterator operator++(int) { Iterator temp = *this; DLListNodePtr = DLListNodePtr->next; return temp; } }; // End of inner class Iterator Iterator begin() const { return Iterator(head); } Iterator end() const { return Iterator(nullptr); } private: DLListNode<T> *head; //stores the pointer of first object in the linked list DLListNode<T> *tail; //stored the pointer of the last object in the linked list bool isEmpty(); //utility functions used to see if the list contains no elements int size = 0; }; template <typename T> DSLinkedList<T>::~DSLinkedList() { if ( !isEmpty() ) // List is not empty { DLListNode<T> *currentPtr = head; DLListNode<T> *tempPtr; while ( currentPtr != 0 ) // delete remaining DLListNodes { tempPtr = currentPtr; currentPtr = currentPtr->next; delete tempPtr; } } } template <typename T> bool DSLinkedList<T>::isEmpty() { if(head == nullptr && tail == nullptr) //if the start pointer and end pointer are NULL then the list is empty return true; else return false; } template <typename T> void DSLinkedList<T>::push_front(T dataIn) { if(isEmpty()) //if the list is empty create first element of the list { DLListNode<T> * newPtr = new DLListNode<T>(dataIn); //creates new DLListNode head = newPtr; //head and tail pointer are same becuase there is only one object in list tail = newPtr; }else //if DLListNode(s) exist in list insert additional object before the first { DLListNode<T> * newPtr = new DLListNode<T>(dataIn); newPtr->next = head; //the next pointer of the new DLListNode points to the DLListNode that was previously first head = newPtr; //the pointer for the new DLListNode is now the starting DLListNode head->next->prev = newPtr; // the next pointer in the front of head now point to head as prev DLListNode } size++; } template <typename T> void DSLinkedList<T>::push_back(T dataIn) { if(isEmpty()) //if the list is empty create first element of the list (same as first case in insert at begin) { DLListNode<T> * newPtr = new DLListNode<T>(dataIn); head = newPtr; tail = newPtr; }else //if DLListNode(s) exist in the list then insert new DLListNode at the end of the list { DLListNode<T> * newPtr = new DLListNode<T>(dataIn); newPtr->prev = tail; tail->next = newPtr; //the current last DLListNode's next pointer points to the new DLListNode tail = newPtr; //the new DLListNode is now the last DLListNode in the list } size++; } template <typename T> void DSLinkedList<T>::print() { if(isEmpty()) { cout << "List is Empty" << endl; }else { DLListNode<T> * currentPtr = head; cout << "List datas: "; while(currentPtr != nullptr) //prints until the end of the list is reached { cout << currentPtr->data << ' '; currentPtr = currentPtr->next; //moves to next DLListNode in list } cout << endl; } } template <typename T> DLListNode<T>* DSLinkedList<T>::search(T key) //search functions that searches for DLListNode that contains data equal to the key { DLListNode<T>* currentNode; bool found = false; currentNode = head; while((!found) && (currentNode != nullptr)) //runs through list until data is found within a DLListNode or end of list is reached { if(currentNode->data == key) //if the DLListNode's data equals the key then the DLListNode has been found found = true; else currentNode = currentNode->next; //moves to next DLListNode in list } return currentNode; //returns pointer to the DLListNode that contains data equal to key (NULL if not found) } template <typename T> T DSLinkedList<T>::back(){ return tail->data; } template <typename T> T DSLinkedList<T>::front(){ return head->data; } template <typename T> int DSLinkedList<T>::getSize(){ return size; } template <typename T> void DSLinkedList<T>::pop(){ if(size == 1){ DLListNode <T> *temp; temp = head; head = nullptr; tail = nullptr; delete temp; }else if(!isEmpty()) { DLListNode <T> *temp; temp = tail; tail = tail->prev; delete temp; }else{ cout << "no data" << endl; } size--; } template <typename T> T DSLinkedList<T>::peek() { if (!isEmpty()) { return head->getData(); } else { cout << "no data" << endl; } } #endif
801058e075d5f6639e32bc9d3281a44bb8dbb204
4aa341a8f6da468b1887aaf89aa5a91c03a2e6ef
/kernel/modules/sysinfo/CpuSpeedEstimator.h
a3433ccb685bbf00270e1a573579b7f9eeaa2b24
[]
no_license
GNUDimarik/OsDev-3
a7e978394b339c3a471648140c89315c1e66afc2
f7c00aa98637a4a6c0228552eb08a57c8a7647b6
refs/heads/master
2022-01-18T14:13:45.737169
2019-07-13T13:57:26
2019-07-13T13:57:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
452
h
CpuSpeedEstimator.h
/* * CpuSpeedEstimator.h * * Created on: Dec 21, 2018 * Author: Mateusz Midor */ #ifndef KERNEL_MODULES_SYSINFO_CPUSPEEDESTIMATOR_H_ #define KERNEL_MODULES_SYSINFO_CPUSPEEDESTIMATOR_H_ #include "kstd.h" #include "Optional.h" namespace sysinfo { namespace cpuspeedestimator { cstd::Optional<u32> estimate_peak_mhz(); } /* namespace cpuspeedestimator */ } /* namespace sysinfo */ #endif /* KERNEL_MODULES_SYSINFO_CPUSPEEDESTIMATOR_H_ */
0c54c503b9527bc8dc3a3788ea275dee9b870c49
b6879a9bb5e0966d4ef9a112ec2b1af6cdaaeec0
/gettimeofday.cpp
fa3df077d70df9473ce75fc1f208a22c9765dc34
[]
no_license
shino-312/TimeOnPosixSample
da513846cca5e990730df8f7dc8ac26080d15511
0f7ac5e454e5a9edce6bc5925e7605ea882220e6
refs/heads/master
2020-06-01T17:26:36.418114
2019-06-08T10:50:52
2019-06-08T10:50:52
190,865,126
0
0
null
null
null
null
UTF-8
C++
false
false
460
cpp
gettimeofday.cpp
#include <iostream> #include <cassert> #include <sys/time.h> int main(void) { struct timeval tv; // Success: Returns 0 // Failure: Returns -1 // Second arg should be always NULL (see man page) int ret = gettimeofday(&tv, NULL); assert(ret == 0); std::cout << "Seconds : " << tv.tv_sec << std::endl << "Micro seconds : " << tv.tv_usec << std::endl; // Seconds : 1559984525 // Micro seconds : 593563 return 0; }
92a3f634a15a764bf16f21a6329e20c9987664f0
4a0c500e3f95828275b7ffe07ea373ba492b0b14
/2518.cpp
fea353d811d36d0fdd7e9e07d699328bbbcb7204
[]
no_license
Ezekieldor/Problems-URI
af720a8e8a1db6b753724b01eeca1b6cf5aec1f8
5ad24acd7967456a673b67d8a71ccccc237095c0
refs/heads/master
2020-03-25T06:09:24.161403
2019-10-15T00:31:34
2019-10-15T00:31:34
143,485,991
0
0
null
null
null
null
UTF-8
C++
false
false
245
cpp
2518.cpp
#include <bits/stdc++.h> using namespace std; int main () { int n, h, c, l; while (scanf ("%d", &n) != EOF) { scanf ("%d%d%d", &h, &c, &l); double H = (sqrt (c * c + h * h)) * n; printf ("%.4f\n", ((double)l * H) / 10000); } }
bedb5efdd834159803259b88992cde5fca0e9b8e
b5dce5523723e8cd7b1d1c8ecaeae1593574d073
/c小练习/100例/92.cpp
75b6aa9c9d8925fbe6122ccc6d4472d93b9f48d1
[]
no_license
Silvia-man/test-
f19c428ef9983eab185c69f3531a98cee7f48bd4
8159c368a4d8c37a69e80a6046e0e000ebbb1fd2
refs/heads/master
2023-08-10T10:13:58.205128
2023-07-25T12:59:12
2023-07-25T12:59:12
164,847,443
0
0
null
null
null
null
GB18030
C++
false
false
395
cpp
92.cpp
//92. 题目:如何组合1、2、5这三个数使其和为100. #include<stdio.h> int main() { int record=0; int x,y,z; for(x=1;x<=100;x++) //注意,x从1开始,不是0 for(y=1;y<=50;y++) //注意,y从1开始,不是0 for(z=1;z<=20;z++) //注意,z从1开始,不是0 if(x+2*y+5*z==100) record++; printf("1、2、5构成100,总共有%d种方法\n",record); return 0; }
5e80a54de8e713bedf26ed20e6d215c42927f934
2aa493a7012909b3908e9cd232c91355218eaec1
/src/BlockRegister.cpp
c2f49b13ca41358e08ce19b5df9a6ee3fee7cb8a
[]
no_license
CheeseSoftware/Cheese_Multiplayer_Fix
4f7308e7aca4e35d45c5fbfef9ad3b9a7a3a6ffa
d7765745a81f1e512bc258f28a8935ae32adb89a
refs/heads/master
2016-09-06T20:08:00.146531
2014-04-23T16:47:33
2014-04-23T16:47:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,132
cpp
BlockRegister.cpp
#include "BlockRegister.h" #include "ITextureContainer.h" #include "Block.h" #include "BlockSolid.h" #include "BlockBackground.h" #include "BlockGravity.h" #include "BlockChest.h" #include "Stone.h" #include "Dirt.h" #include <typeinfo> #include <iostream> #ifdef CLIENT #include "App.h" #endif BlockRegister::BlockRegister() { std::cout << this << std::endl; //RegisterBlock(nullptr, 0); unsigned short i = 0; blockTypeList.push_back(nullptr); blockList.push_back(nullptr); RegisterBlock(new BlockSolid(), typeid(BlockSolid).hash_code()); i++; RegisterBlock(new BlockBackground(), typeid(BlockBackground).hash_code()); i++; RegisterBlock(new BlockGravity(), typeid(BlockGravity).hash_code()); i++; RegisterBlock(new BlockChest(), typeid(BlockChest).hash_code()); i++; RegisterBlock(new Stone(), typeid(Stone).hash_code()); i++; RegisterBlock(new Dirt(), typeid(Dirt).hash_code()); i++; } void BlockRegister::RegisterBlock(Block *block, const size_t typeId) { std::cout << blockTypeList.size() << std::endl; blockList.push_back(block); blockIdMap.emplace(typeId, blockTypeList.size()); blockTypeList.push_back(block->RegisterBlock(blockTypeList.size())); } #ifdef CLIENT void BlockRegister::RegisterBlockTextures(ITextureContainer *Tc) { blockTextureList.reserve(blockTypeList.size()); blockTextureList.push_back(nullptr); for (int i = 1; i < blockTypeList.size(); i++) { blockTextureList.push_back(Tc->getTextures(blockList[i]->getTextureName())); } } #endif Block *BlockRegister::getBlockType(const unsigned short id) { if (id == 0) return nullptr; if(id == 4) { Block *block = new BlockChest(); return block; } return (id >= blockTypeList.size()) ? nullptr : blockTypeList[id](0); } #ifdef CLIENT sf::Sprite **BlockRegister::getBlockTextures(const Block *block) { return blockTextureList[getBlockIdByTypeId(typeid(*block).hash_code())]; } #endif unsigned short BlockRegister::getBlockIdByTypeId(const size_t typeId) { auto it = blockIdMap.find(typeId);//blockIdMapfind(typeId); //std::cout << it->second << " " << typeId << std::endl; return (it == blockIdMap.end()) ? 0 : it->second; }
cef23ce245378c7e2ecb9892bbc7151b27b2b0e5
fb03995d5807509a66d35a2f3e366849f4184f05
/OOP/Quiz1/main.cpp
c0c79444dbebb84673a7e21a87eda2cd016d8c44
[ "MIT" ]
permissive
calee0219/Course
2b641c6d4c6fa49e87c1d600ea3927a96b8b5252
10bd72fcb57aae34a7ee99b0daf8c2efbd29d8dc
refs/heads/master
2021-01-23T20:57:06.353586
2018-03-27T15:15:59
2018-03-27T15:15:59
90,666,096
3
1
null
null
null
null
UTF-8
C++
false
false
203
cpp
main.cpp
#include <iostream> #include "quiz1.hpp" int main(){ std::vector<float> Pa({1, 2, 3}); std::vector<float> Pb({4, 5, 6}); std::cout << quiz1::EuclideanDistance(Pa, Pb) << std::endl; return 0; }
a082416c7aa3e2eecbd4fb0850fd66734d0db613
64bb79337ab4da58a45bbfb322f054f196825b4f
/Special___Competitive Programming/XOR/Finding___Single_number.cpp
62c3474b1402f2e67f26ac558b1486f63c46ac7f
[]
no_license
kokfahad/Problems-Solving-
08f2caa9344e53f0aab10af121563c43207c0ab6
4e0eca18c6b609d8d9eb13d2bb6591b425e58fa2
refs/heads/main
2023-06-07T15:57:51.366088
2021-05-28T17:30:33
2021-05-28T17:30:33
371,772,636
1
0
null
null
null
null
UTF-8
C++
false
false
339
cpp
Finding___Single_number.cpp
//Finding single number from array from other double repititive number #include<bits/stdc++.h> using namespace std; int main() { int n,arr[1000]; cin>>n; for(int i=0;i<n;i++) { cin>>arr[i]; } int z=0; for(int i=0;i<n;i++) { z=z^arr[i]; } cout<<"The Single Occured Num: "<<z<<endl; }
a97c5ef7d4a8b108d9e2a2eca0a5d95dc73fc3ca
cb7dfeafa6b6e8288c9e08e08908bf610622bbb7
/napiLCD/distancewidget.h
1bdc93621187dc33e1daf01cf8c4d9cbb0b6e840
[]
no_license
levanhong05/NapiEmbedded
d0d4186346c3c5b4b459937adee1ef45bfd17d32
8f365fb927c17e1bd3e5d839b79cad6c3aafafb3
refs/heads/master
2021-01-12T17:38:25.977610
2016-11-01T08:32:26
2016-11-01T08:32:26
71,622,005
0
0
null
null
null
null
UTF-8
C++
false
false
467
h
distancewidget.h
#ifndef DISTANCEWIDGET_H #define DISTANCEWIDGET_H #include <QWidget> #include <QDialog> namespace Ui { class DistanceWidget; } class DistanceWidget : public QDialog { Q_OBJECT public: explicit DistanceWidget(QWidget *parent = 0); ~DistanceWidget(); public slots: void setHorizotalDistance(QString value); void setVerticalDistance(QString value); private: Ui::DistanceWidget *ui; }; #endif // DISTANCEWIDGET_H
9262ed03b2a76284b217c736f1ca61bae33ad1c9
b7cd4872d7d4eee37475451f4ffdb43342f52a28
/SpecializationAndInstantiate/specialization_test.cc
123d3c3afb2ae0d4fc0b18b5a248295d547ab147
[]
no_license
MarkRepo/CppTemplate
7046ce4da61bfb8a91050c9675dfa253a6d86369
f307fef1649731cdd139bec184f57d62a946358a
refs/heads/master
2021-03-21T03:59:44.144507
2020-04-06T03:55:36
2020-04-06T03:55:36
247,261,432
0
0
null
null
null
null
UTF-8
C++
false
false
570
cc
specialization_test.cc
// // Created by markfqwu on 2020-02-08. // #include "gtest/gtest.h" #include "SpecializationAndInstantiate/specialization.h" using namespace tpl::specialization; TEST(SpecializationTest, MapCmp){ Compare_test(); } TEST(SpecializationTest, tplarg){ tplarg_test(); } TEST(SpecializationTest, LessTest){ int a = 1, b=2; Less(a,b); Less1(a,b); Less2(a,b); const char* a1 = "aaa"; const char* b1 = "bbb"; Less(a1, b1); Less1(a1, b1); Less2(a1, b1); ASSERT_EQ(max_value<int>(), 1); ASSERT_EQ(max_value<char>(),'a'); }
a396477ff181502b061bb4b3b44dd2b930c6d1f8
bebdef83edff1cc8255785369e140ce84d43350a
/Codes/2231_Decomposition_Sum.cpp
adf6922ad4010e5f77416ecb141377b18d7032c8
[]
no_license
SayYoungMan/BaekJoon_OJ_Solutions
027fe9603c533df74633386dc3f7e15d5b465a00
b764ad1a33dc7c522e044eb0406903937fe8e4cc
refs/heads/master
2023-07-05T13:47:43.260574
2021-08-26T11:42:21
2021-08-26T11:42:21
387,247,523
0
0
null
null
null
null
UTF-8
C++
false
false
389
cpp
2231_Decomposition_Sum.cpp
#include <iostream> int main() { long int n, sum, tmp; std::cin >> n; for (long int i = 1; i<n; i++) { tmp = i; sum = i; while(tmp > 10) { sum += tmp % 10; tmp /= 10; } sum += tmp; if (sum == n) { std::cout << i; return 0; } } std::cout << '0'; return 0; }
7aaf32d1d6b3e1767321676eb2209f09b343ffcf
5a7832ebfd2b8bc8ad7eb7c91bd03ea197b19cd9
/CommandHandler.h
e55279db52b0e57b4bd6694198dd7bd65c6dac2b
[ "MIT" ]
permissive
Noele/Cherri
fbcdf3363872c57389afed092f01f82bbcbb032f
f840ce99bc35e97777205f200dc5dca154b03b74
refs/heads/main
2023-02-03T17:51:53.283101
2020-12-22T23:23:19
2020-12-22T23:23:19
320,363,151
3
0
MIT
2020-12-13T16:27:27
2020-12-10T18:57:23
C++
UTF-8
C++
false
false
229
h
CommandHandler.h
#include "Response.h" #include "sleepy_discord/sleepy_discord.h" #include <fmt/core.h> #include "Toolbox.h" class CommandHandler { public: static Response avatar(SleepyDiscord::Message message, SleepyDiscord::User user); };
7da5d3802eff328c99e103703170eacca22cc951
1ea801dd4704e160c75bac3bc88b8df9c2f36368
/translator/src/instructions/inc.h
7be6e5513523cfb47643a0bc3512caa21c2a04ad
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
fcccode/xbyak_translator_aarch64
e37e02038c9737564bff0319f7e1f514390c1452
11e976d859e519d94a62acb245902e57ba4f39c8
refs/heads/main
2023-04-22T02:12:28.889408
2021-05-14T11:16:17
2021-05-14T11:16:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,260
h
inc.h
/******************************************************************************* * Copyright 2020 FUJITSU 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. *******************************************************************************/ void Xbyak::CodeGenerator::translateINC(xed_decoded_inst_t *p) { namespace xa = Xbyak_aarch64; struct xt_a64fx_operands_struct_t a64; xt_construct_a64fx_operands(p, &a64); /* 2020/03/11 21:20 */ bool isValid = false; /* Col=S103*/ if (false || (a64.dstWidth == 8 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 8 && a64.dstType == A64_OP_MEM && true) || (a64.dstWidth == 16 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 16 && a64.dstType == A64_OP_MEM && true) || (a64.dstWidth == 32 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 32 && a64.dstType == A64_OP_MEM && true) || (a64.dstWidth == 64 && a64.dstType == A64_OP_MEM && true)) { XT_UNIMPLEMENTED; } /* Col=AA103*/ if (false || (a64.dstWidth == 32 && a64.dstType == A64_OP_MEM && true)) { xa_->ldr(W_TMP_0, xa::ptr(X_TMP_ADDR)); } /* Col=AB103*/ if (false || (a64.dstWidth == 64 && a64.dstType == A64_OP_MEM && true)) { xa_->ldr(X_TMP_0, xa::ptr(X_TMP_ADDR)); } /* Col=AG103*/ if (false || (a64.dstWidth == 32 && a64.dstType == A64_OP_REG && true)) { xa_->add(xa::WReg(a64.dstIdx), xa::WReg(a64.dstIdx), 1); } /* Col=AH103*/ if (false || (a64.dstWidth == 32 && a64.dstType == A64_OP_MEM && true)) { xa_->add(W_TMP_0, W_TMP_0, 1); } /* Col=AI103*/ if (false || (a64.dstWidth == 64 && a64.dstType == A64_OP_REG && true)) { xa_->add(xa::XReg(a64.dstIdx), xa::XReg(a64.dstIdx), 1); } /* Col=AJ103*/ if (false || (a64.dstWidth == 64 && a64.dstType == A64_OP_MEM && true)) { xa_->add(X_TMP_0, X_TMP_0, 1); } /* Col=AN103*/ if (false || (a64.dstWidth == 32 && a64.dstType == A64_OP_MEM && true)) { xa_->str(W_TMP_0, xa::ptr(X_TMP_ADDR)); } /* Col=AO103*/ if (false || (a64.dstWidth == 64 && a64.dstType == A64_OP_MEM && true)) { xa_->str(X_TMP_0, xa::ptr(X_TMP_ADDR)); } /* Col=BC103*/ if (false || (a64.dstWidth == 8 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 8 && a64.dstType == A64_OP_MEM && true) || (a64.dstWidth == 16 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 16 && a64.dstType == A64_OP_MEM && true) || (a64.dstWidth == 32 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 32 && a64.dstType == A64_OP_MEM && true) || (a64.dstWidth == 64 && a64.dstType == A64_OP_REG && true) || (a64.dstWidth == 64 && a64.dstType == A64_OP_MEM && true)) { XT_VALID_CHECK; } XT_VALID_CHECK_IF }
125fbc2e76b3cc51321e400af3d306bc5b63c2bc
0e268cfe31ca712edbd8990403f9dcd25d9e5d31
/ParmDB/Box.cc
a93d93e0e13109d0fb9e27f5a98f79839d296835
[]
no_license
drhpc/DP3
6bd4d61e06a4d8c7e9696951f082984d5de9d2b4
6d66554bcd1e6fbd0362d6805ccc0f0ca19e518d
refs/heads/master
2022-10-05T12:00:28.232024
2020-06-09T15:32:41
2020-06-09T15:35:48
267,670,874
0
0
null
2020-05-28T18:52:46
2020-05-28T18:52:46
null
UTF-8
C++
false
false
2,794
cc
Box.cc
//# Box.cc: //# //# Copyright (C) 2008 //# ASTRON (Netherlands Institute for Radio Astronomy) //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands //# //# This file is part of the LOFAR software suite. //# The LOFAR software suite 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. //# //# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. //# //# $Id: Box.cc 16977 2010-12-20 08:40:36Z diepen $ #include "Box.h" #include <iostream> namespace DP3 { namespace BBS { Box::Box (double x1, double x2, double y1, double y2, bool asStartEnd) { if (!asStartEnd) { x1 -= x2 * 0.5; x2 += x1; y1 -= y2 * 0.5; y2 += y1; } itsStart = Point(x1,y1); itsEnd = Point(x2,y2); } Box unite (const Box& lhs, const Box& rhs) { Point start(std::min(lhs.lowerX(), rhs.lowerX()), std::min(lhs.lowerY(), rhs.lowerY())); Point end(std::max(lhs.upperX(), rhs.upperX()), std::max(lhs.upperY(), rhs.upperY())); return Box(start, end); } Box intersect (const Box& lhs, const Box& rhs) { Point start(std::max(lhs.lowerX(), rhs.lowerX()), std::max(lhs.lowerY(), rhs.lowerY())); Point end(std::min(lhs.upperX(), rhs.upperX()), std::min(lhs.upperY(), rhs.upperY())); if(start.first < end.first && !casacore::near(start.first, end.first) && start.second < end.second && !casacore::near(start.second, end.second)) { return Box(start, end); } return Box(); } Box::Box (const std::vector<double>& values) { double stx = -1e30; double sty = -1e30; double enx = 1e30; double eny = 1e30; int sz = values.size(); if (sz > 4) sz=4; switch (sz) { case 4: eny = values[3]; case 3: enx = values[2]; case 2: sty = values[1]; case 1: stx = values[0]; break; default: break; } assert (stx <= enx); assert (sty <= eny); itsStart = Point(stx, sty); itsEnd = Point(enx, eny); } void Box::print() const { std::cout << itsStart.first << "\t" << itsStart.second << "\t" << itsEnd.first << "\t" << itsEnd.second << '\n'; } } //# namespace BBS } //# namespace LOFAR
c92481d848c466e770e806ee6a19adae2f1c9e1a
8bd2e73aedd84de2a935c5b7f4b0a7c7fab83330
/lib/Core/ExternalDispatcher.h
931cabad858a370eadf751af43c03928d79876d6
[ "NCSA" ]
permissive
srg-imperial/klee-float
c6208a158b3904105346e1b9f0b7c95d7b6e3cb8
aa907655cd9ec030036424acf88d9cb41a93a93b
refs/heads/tool_exchange_03.05.2017_rebase_extra_bug_fixes
2022-03-12T20:19:41.514369
2021-12-08T06:42:47
2022-02-15T13:59:55
55,293,904
18
14
NOASSERTION
2022-02-15T13:59:56
2016-04-02T12:43:01
C++
UTF-8
C++
false
false
1,511
h
ExternalDispatcher.h
//===-- ExternalDispatcher.h ------------------------------------*- C++ -*-===// // // The KLEE Symbolic Virtual Machine // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef KLEE_EXTERNALDISPATCHER_H #define KLEE_EXTERNALDISPATCHER_H #include <map> #include <string> #include <stdint.h> namespace llvm { class ExecutionEngine; class Instruction; class LLVMContext; class Function; class FunctionType; class Module; } namespace klee { class ExternalDispatcher { private: typedef std::map<const llvm::Instruction*,llvm::Function*> dispatchers_ty; dispatchers_ty dispatchers; llvm::Module *dispatchModule; llvm::ExecutionEngine *executionEngine; std::map<std::string, void*> preboundFunctions; llvm::Function *createDispatcher(llvm::Function *f, llvm::Instruction *i); bool runProtectedCall(llvm::Function *f, uint64_t *args); public: ExternalDispatcher(llvm::LLVMContext &ctx); ~ExternalDispatcher(); /* Call the given function using the parameter passing convention of * ci with arguments in args[1], args[2], ... and writing the result * into args[0]. */ bool executeCall(llvm::Function *function, llvm::Instruction *i, uint64_t *args, int roundingMode); void *resolveSymbol(const std::string &name); }; } #endif
329b1a04cd9af7674d3195fb4d3d77141a4c6f71
cf701f7909661b5ab89babef3535b263b8b0ddd4
/SubCategory.cpp
4d939c1f710113f538b51e3271d7e1e0bc380d34
[]
no_license
simuowCSCI222a7/GroupA7_A2
25881b7e8747b92b3b7f39528ca6ace9a2612c0a
6bbb44e305fadc077bcd6b5539954e612d5efdab
refs/heads/master
2021-04-30T00:55:05.274494
2018-02-14T12:53:12
2018-02-14T12:53:12
121,468,560
0
0
null
null
null
null
UTF-8
C++
false
false
1,266
cpp
SubCategory.cpp
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: SubCategory.cpp * Author: vmw_ubuntu * * Created on February 14, 2018, 11:46 AM */ #include "SubCategory.h" // default constructor SubCategory::SubCategory() { this -> subCatName = ""; this -> totalStockNo = 0; } // copy constructor SubCategory::SubCategory(const SubCategory& orig) { this -> subCatName = orig.subCatName; for (int i = 0; i < orig.totalStockNo; i++) { this -> stock[i] = orig.stock[i]; } this -> totalStockNo = orig.totalStockNo; } // deconstructor SubCategory::~SubCategory() { } // accessor functions string SubCategory::getSubCatName() const { return this -> subCatName; } Stock SubCategory::getStock(int index) const { return this -> stock[index]; } int SubCategory::getTotalStockNo() const { return this -> totalStockNo; } // mutator functions void SubCategory::setSubCatName(string scatName) { this -> subCatName = scatName; } void SubCategory::setStock(int index, Stock s) { this -> stock[index] = s; } void setTotalStockNo() { // definition to be added }
bb9e2839a6de2f2dbf06b5043bc3496c98c325ae
eb34128b8b8f8ec04724c440b50f942fd69baa5e
/LCS.cpp
acdc8be1ccf99f2387ce5d9e396f41425c0faf9d
[]
no_license
ashish-254/C-Codes
18ac8d155328d3ab0f9e9fb6f19fa6307e3800cc
8ecea1c0c7ff0ba52789191bc028444aca701477
refs/heads/master
2023-08-31T05:48:57.433260
2021-09-28T14:54:23
2021-09-28T14:54:23
411,322,435
0
0
null
null
null
null
UTF-8
C++
false
false
692
cpp
LCS.cpp
//use of associative array or vector #include<iostream> #include <vector> using namespace std; int p=0; //global int p=0; typedef struct values { int v; const char *s; } data; //struct values data; vector<data>stack; //vector<stack>stack2; void tekeinput() { //struct values ashish,sagar; ashish.v=4; ashish.s="|"; stack.push_back(ashish); sagar.v=7; sagar.s="<"; stack.push_back(sagar); } void giveoutput() { cout<<"\n output is :"<<endl; cout<<stack[0].v<<" "<<stack[0].s<<endl; cout<<stack[1].v<<" "<<stack[1].s<<endl; } int main() { p=4; cout<<p<<endl; tekeinput(); giveoutput(); p=5; cout<<p<<endl; }
7fdbe7505536a31ba0f236f8c5031c0254a966b0
4cff56cfb609a712003fbd09e8fc6cde520a9147
/sln/Biu/src/biu/src/Runtime/scmm.cpp
b177e2effa39d7ff88823b5b00aa488e005463b3
[]
no_license
teerta/Biu
19fb29c8ab14ae2fdabad784e87d85f0c3fbd074
7fc55d7aed902ea208412552b2c965f819d53961
refs/heads/master
2020-12-03T03:45:35.479530
2017-06-29T18:38:53
2017-06-29T18:38:53
95,769,553
1
0
null
null
null
null
UTF-8
C++
false
false
7,816
cpp
scmm.cpp
#include "stdafx.h" #include "bscm.h" using namespace Biu; #define SCMM_ARG_INS_SERVICE _T("-Service") BSCMManager::BSCMManager() : m_hSCM(NULL) , m_hService(NULL) , m_strServiceName("") { } BSCMManager::~BSCMManager() { ServiceClose(); CloseSCM(); } bool BSCMManager::OpenSCM(DWORD rights) { m_dwRights = rights; m_hSCM = OpenSCManager(NULL, NULL, rights); return m_hSCM != NULL; } void BSCMManager::CloseSCM() { if (m_hSCM) { CloseServiceHandle(m_hSCM); m_hSCM = NULL; } } bool BSCMManager::ServiceStop() { if (!m_hSCM || !m_hService) { return false; } SERVICE_STATUS_PROCESS ssStatus; ULONGLONG ullStartTime = GetTickCount64(); DWORD dwBytesNeeded; DWORD dwTimeout = 30000; if (!QueryServiceStatusEx(m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded )) { return false; } if (ssStatus.dwCurrentState == SERVICE_STOPPED) { return true; } while (ssStatus.dwCurrentState == SERVICE_STOP_PENDING) { Sleep(ssStatus.dwWaitHint); if (!QueryServiceStatusEx( m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS),&dwBytesNeeded)) { return false; } if (ssStatus.dwCurrentState == SERVICE_STOPPED) { return true; } if (GetTickCount64() - ullStartTime > dwTimeout) { OutputDebugString(_T("[XSCMM] Service stop timed out\r\n")); return false; } } StopDependentServices(); if (!ControlService(m_hService, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS) &ssStatus)) { return false; } while (ssStatus.dwCurrentState != SERVICE_STOPPED) { Sleep(ssStatus.dwWaitHint); if (!QueryServiceStatusEx( m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS),&dwBytesNeeded)) { return false; } if (ssStatus.dwCurrentState == SERVICE_STOPPED) { break; } if (GetTickCount64() - ullStartTime > dwTimeout) { OutputDebugString(_T("[XSCMM] Wait timed out\r\n")); return false; } } return true; } bool BSCMManager::ServiceStart() { if (!m_hSCM || !m_hService) { return false; } SERVICE_STATUS_PROCESS ssStatus; DWORD dwOldCheckPoint; ULONGLONG ullStartTickCount; DWORD dwWaitTime; DWORD dwBytesNeeded; if (!QueryServiceStatusEx(m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded )) { return false; } if (ssStatus.dwCurrentState != SERVICE_STOPPED && ssStatus.dwCurrentState != SERVICE_STOP_PENDING) { return true; } while (ssStatus.dwCurrentState == SERVICE_STOP_PENDING) { ullStartTickCount = GetTickCount64(); dwOldCheckPoint = ssStatus.dwCheckPoint; dwWaitTime = ssStatus.dwWaitHint / 10; if (dwWaitTime < 1000) { dwWaitTime = 1000; } else if (dwWaitTime > 10000) { dwWaitTime = 10000; } Sleep(dwWaitTime); if (!QueryServiceStatusEx( m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS),&dwBytesNeeded)) { return false; } if (ssStatus.dwCheckPoint > dwOldCheckPoint) { ullStartTickCount = GetTickCount64(); dwOldCheckPoint = ssStatus.dwCheckPoint; } else { if(GetTickCount64() - ullStartTickCount > ssStatus.dwWaitHint) { OutputDebugString(_T("[XSCMM] Timeout waiting for service to stop\r\n")); return false; } } } if (!StartService(m_hService, 0, NULL)) { OutputDebugString(_T("[XSCMM] StartService failed\r\n")); return false; } if (!QueryServiceStatusEx(m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded)) { return false; } ullStartTickCount = GetTickCount64(); dwOldCheckPoint = ssStatus.dwCheckPoint; while (ssStatus.dwCurrentState == SERVICE_START_PENDING) { dwWaitTime = ssStatus.dwWaitHint / 10; if (dwWaitTime < 1000) { dwWaitTime = 1000; } else if (dwWaitTime > 10000) { dwWaitTime = 10000; } Sleep(dwWaitTime); if (!QueryServiceStatusEx( m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE) &ssStatus, sizeof(SERVICE_STATUS_PROCESS),&dwBytesNeeded)) { break; } if (ssStatus.dwCheckPoint > dwOldCheckPoint) { ullStartTickCount = GetTickCount64(); dwOldCheckPoint = ssStatus.dwCheckPoint; } else { if(GetTickCount64() - ullStartTickCount > ssStatus.dwWaitHint) { break; } } } return ssStatus.dwCurrentState == SERVICE_RUNNING; } bool BSCMManager::ServiceOpen(LPCTSTR lpszServiceName, DWORD rights) { if (!m_hSCM) { return false; } ServiceClose(); m_strServiceName = lpszServiceName; m_dwServiceRights = rights; m_hService = OpenService(m_hSCM, lpszServiceName, rights); return m_hService != NULL; } void BSCMManager::ServiceClose() { if (m_hService) { CloseServiceHandle(m_hService); m_hService = NULL; } } bool BSCMManager::StopDependentServices() { DWORD i; DWORD dwBytesNeeded; DWORD dwCount; LPENUM_SERVICE_STATUS lpDependencies = NULL; ENUM_SERVICE_STATUS ess; SC_HANDLE hDepService; SERVICE_STATUS_PROCESS ssp; ULONGLONG ullStartTime = GetTickCount64(); DWORD dwTimeout = 30000; if (EnumDependentServices(m_hService, SERVICE_ACTIVE, lpDependencies, 0, &dwBytesNeeded, &dwCount)) { // If the Enum call succeeds, then there are no dependent services, so do nothing. return true; } else { if (GetLastError() != ERROR_MORE_DATA) { return false; // Unexpected error } lpDependencies = (LPENUM_SERVICE_STATUS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBytesNeeded); if (!lpDependencies) { return false; } __try { if (!EnumDependentServices(m_hService, SERVICE_ACTIVE, lpDependencies, dwBytesNeeded, &dwBytesNeeded, &dwCount)) { return false; } for (i = 0; i < dwCount; i++) { ess = *(lpDependencies + i); hDepService = OpenService(m_hSCM, ess.lpServiceName, SERVICE_STOP | SERVICE_QUERY_STATUS); if (!hDepService) { return false; } __try { if (!ControlService(hDepService, SERVICE_CONTROL_STOP, (LPSERVICE_STATUS)&ssp)) { return false; } while (ssp.dwCurrentState != SERVICE_STOPPED) { Sleep(ssp.dwWaitHint); if (!QueryServiceStatusEx(hDepService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssp, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded)) { return false; } if (ssp.dwCurrentState == SERVICE_STOPPED) { break; } if (GetTickCount64() - ullStartTime > dwTimeout) { return false; } } } __finally { CloseServiceHandle(hDepService); } } } __finally { HeapFree(GetProcessHeap(), 0, lpDependencies); } } return true; } void BSCMManager::ServiceInstallSelf(LPCTSTR lpszBinPath) { ShellExecute(NULL, _T("open"), lpszBinPath, SCMM_ARG_INS_SERVICE, NULL, SW_HIDE); } bool BSCMManager::ServiceTryOpen(LPCTSTR lpszServiceName, LPCTSTR lpszBinPath) { static const int Total_Solution = 1; bool bRet = false; int nCounter = 0; bRet = ServiceOpen(lpszServiceName); while (!bRet) { switch (nCounter) { case 0: ServiceInstallSelf(lpszBinPath); break; //case 1: // break; default: bRet = true; break; } nCounter++; if (!bRet) { Sleep(1000); bRet = ServiceOpen(lpszServiceName); } } if (nCounter > Total_Solution) { bRet = false; } return bRet; } bool BSCMManager::IsServiceRunning() { if (!m_hSCM || !m_hService) { return false; } SERVICE_STATUS_PROCESS ssStatus; //DWORD dwOldCheckPoint; //DWORD dwStartTickCount; //DWORD dwWaitTime; DWORD dwBytesNeeded; if (!QueryServiceStatusEx(m_hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&ssStatus, sizeof(SERVICE_STATUS_PROCESS), &dwBytesNeeded)) { return false; } return ssStatus.dwCurrentState == SERVICE_RUNNING; }
c214f9fa40812212e999a36bec17aff5a4bffbc9
6ed319c8af7836e36b4ac622a9a8215b62aaa595
/Code/Chapter-13/reflection.cpp
9b526ca573e49f9837042d6fc2a804bbf36f4028
[ "MIT" ]
permissive
steps3d/graphics-book
de8ef40a120711962015d90597c8fbba32878bc0
c19c7caf415dc59397d7ea6f459f52b57704f9b9
refs/heads/master
2023-03-09T10:49:46.444654
2023-03-08T15:46:56
2023-03-08T15:46:56
66,971,146
24
8
MIT
2022-05-03T16:26:10
2016-08-30T19:28:32
C
UTF-8
C++
false
false
4,279
cpp
reflection.cpp
// // Planar reflection example // // Author: Alexey Boreskov <steps3d@gmail.com>, <steps3d@narod.ru> // #include "GlutCameraWindow.h" #include "Program.h" #include "BasicMesh.h" #include "Texture.h" #include "Framebuffer.h" class ReflectionWindow : public GlutCameraWindow { Program program, program2; Texture decalMap; Texture stoneMap; Texture knotMap; FrameBuffer fb; float angle = 0; BasicMesh * box1 = nullptr; BasicMesh * box2 = nullptr; BasicMesh * knot = nullptr; BasicMesh * w = nullptr; // water mesh glm::mat4 mirrorMat; public: ReflectionWindow () : GlutCameraWindow ( 200, 200, 800, 600, "Planar reflection" ) { fb.create ( getWidth (), getHeight (), FrameBuffer::depth24 ); fb.bind (); Texture * image = fb.createColorTexture ( GL_RGBA, GL_RGBA8, GL_CLAMP_TO_EDGE, 0 ); if ( !fb.attachColorTexture ( image ) ) exit ( "buffer error with color attachment\n"); if ( !fb.isOk () ) exit ( "Error with framebuffer\n" ); fb.unbind (); if ( !program.loadProgram ( "reflection-1.glsl" ) ) exit ( "Error loading shader: %s\n", program.getLog ().c_str () ); program.bind (); program.setTexture ( "image", 0 ); program.unbind (); if ( !program2.loadProgram ( "reflection-2.glsl" ) ) exit ( "Error loading shader: %s\n", program2.getLog ().c_str () ); program2.bind (); program2.setTexture ( "image", 0 ); program2.unbind (); box1 = createBox ( glm::vec3 ( -6, -2, -6 ), glm::vec3 ( 12, 5, 12 ) ); box2 = createBox ( glm::vec3 ( -1.5, 1, -0.5 ), glm::vec3 ( 1, 2, 2 ) ); knot = createKnot ( 1, 4, 120, 30 ); w = createQuad ( glm::vec3 ( -6, 0, -6 ), glm::vec3 ( 12, 0, 0 ), glm::vec3 ( 0, 0, 12 ) ); decalMap.load2D ( "../../Textures/oak.jpg" ); stoneMap.load2D ( "../../Textures/block.jpg" ); knotMap.load2D ( "../../Textures/Oxidated.jpg" ); } void redisplay () override { mv = getModelView (); proj = getProjection (); renderToBuffer (); glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); mv = getModelView (); proj = getProjection (); program.bind (); program.setUniformMatrix ( "proj", proj ); program.setUniformMatrix ( "mv", mv ); displayBoxes (); program.unbind (); renderWater (); } void idle () override { angle = 4 * getTime (); glutPostRedisplay (); } private: void displayBoxes () { decalMap.bind (); box1 -> render (); decalMap.unbind (); stoneMap.bind (); box2 -> render (); stoneMap.unbind (); glm::mat4 m = mv * glm::translate ( glm::mat4 (1), glm::vec3 ( 2, 0, 1 ) ) * glm::rotate ( glm::mat4 (1), angle * 0.3f, glm::vec3 ( 1,0,0 ) ) * glm::rotate ( glm::mat4 (1), angle * 0.07f, glm::vec3 ( 0,1,0 ) ) * glm::scale ( glm::mat4 (1), glm::vec3 ( 0.3f ) ); program.setUniformMatrix ( "mv", m ); knotMap.bind (); knot -> render (); knotMap.unbind (); } void renderToBuffer () { fb.bind (); glClearColor ( 0, 0, 1, 1 ); glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glm::vec3 up = camera.getUpDir (); glm::vec3 view = camera.getViewDir (); glm::vec3 pos = camera.getPos (); up.y = -up.y; // reflect camera vectors view.y = -view.y; pos.y = -pos.y; mv = glm::lookAt ( pos, pos + view, up ); mirrorMat = glm::translate ( glm::mat4 (1), glm::vec3 ( 0.5, 0.5, 0 ) ) * glm::scale ( glm::mat4 (1), glm::vec3 ( 0.5, 0.5, 1 ) ) * proj * mv; program.bind (); program.setUniformMatrix ( "proj", getProjection () ); program.setUniformMatrix ( "mv", mv ); displayBoxes (); fb.unbind (); } void renderWater () { fb.getColorBuffer () -> bind (); program2.bind (); program2.setUniformMatrix ( "proj", proj ); program2.setUniformMatrix ( "mv", mv ); program2.setUniformMatrix ( "mirrorMat", mirrorMat ); program2.setUniformFloat ( "time", getTime () ); w -> render (); program2.unbind (); fb.getColorBuffer () -> unbind (); } }; int main ( int argc, char * argv [] ) { GlutWindow::init ( argc, argv ); ReflectionWindow win; return GlutWindow::run (); }
a668c3c4bf2e751ffe8ff09769e5e9132eec7e78
de7e771699065ec21a340ada1060a3cf0bec3091
/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.h
bc2ae42cf17e8fff211eea278d30ea8213e2511a
[]
no_license
sraihan73/Lucene-
0d7290bacba05c33b8d5762e0a2a30c1ec8cf110
1fe2b48428dcbd1feb3e10202ec991a5ca0d54f3
refs/heads/master
2020-03-31T07:23:46.505891
2018-12-08T14:57:54
2018-12-08T14:57:54
152,020,180
7
0
null
null
null
null
UTF-8
C++
false
false
6,779
h
SimpleGeoPolygonRelationshipsTest.h
#pragma once #include "stringhelper.h" #define _USE_MATH_DEFINES #include <cmath> #include <iostream> #include <memory> #include <deque> // C++ NOTE: Forward class declarations: #include "core/src/java/org/apache/lucene/spatial3d/geom/GeoPolygon.h" #include "core/src/java/org/apache/lucene/spatial3d/geom/GeoShape.h" /* * Licensed to the Syed Mamun Raihan (sraihan.com) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * sraihan.com licenses this file to You under GPLv3 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 * * https://www.gnu.org/licenses/gpl-3.0.en.html * * 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. */ namespace org::apache::lucene::spatial3d::geom { // C++ TODO: The Java 'import static' statement cannot be converted to C++: // import static org.junit.Assert.assertEquals; // C++ TODO: The Java 'import static' statement cannot be converted to C++: // import static org.junit.Assert.assertTrue; /** * Check relationship between polygon and GeoShapes of basic polygons. Normally * we construct the convex, concave counterpart and the convex polygon as a * complex polygon. */ class SimpleGeoPolygonRelationshipsTest : public std::enable_shared_from_this<SimpleGeoPolygonRelationshipsTest> { GET_CLASS_NAME(SimpleGeoPolygonRelationshipsTest) /** * Test with two shapes with no crossing edges and no points in common in * convex case. */ public: // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygon1() virtual void testGeoSimplePolygon1(); /** * Test with two shapes with crossing edges and some points inside in convex * case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygon2() virtual void testGeoSimplePolygon2(); /** * Test with two shapes with no crossing edges and all points inside in convex * case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygon3() virtual void testGeoSimplePolygon3(); /** * Test with two shapes with crossing edges and no points inside in convex * case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygon4() virtual void testGeoSimplePolygon4(); /** * Test with two shapes with no crossing edges and polygon in hole in convex * case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithHole1() virtual void testGeoSimplePolygonWithHole1(); /** * Test with two shapes with crossing edges in hole and some points inside in * convex case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithHole2() virtual void testGeoSimplePolygonWithHole2(); /** * Test with two shapes with crossing edges and some points inside in convex * case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithHole3() virtual void testGeoSimplePolygonWithHole3(); /** * Test with two shapes with no crossing edges and all points inside in convex * case. */ // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithHole4() virtual void testGeoSimplePolygonWithHole4(); // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithCircle() virtual void testGeoSimplePolygonWithCircle(); // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithBBox() virtual void testGeoSimplePolygonWithBBox(); // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testGeoSimplePolygonWithComposite() virtual void testGeoSimplePolygonWithComposite(); // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testDegeneratedPointIntersectShape() virtual void testDegeneratedPointIntersectShape(); // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testDegeneratedPointInPole() virtual void testDegeneratedPointInPole(); // C++ TODO: Most Java annotations will not have direct C++ equivalents: // ORIGINAL LINE: @Test public void testDegeneratePathShape() virtual void testDegeneratePathShape(); private: std::shared_ptr<GeoPolygon> buildConvexGeoPolygon(double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double lon4, double lat4); std::shared_ptr<GeoPolygon> buildConcaveGeoPolygon(double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double lon4, double lat4); std::shared_ptr<GeoPolygon> buildComplexGeoPolygon(double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double lon4, double lat4); std::shared_ptr<GeoPolygon> buildConvexGeoPolygonWithHole( double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double lon4, double lat4, std::shared_ptr<GeoPolygon> hole); std::shared_ptr<GeoPolygon> buildConcaveGeoPolygonWithHole( double lon1, double lat1, double lon2, double lat2, double lon3, double lat3, double lon4, double lat4, std::shared_ptr<GeoPolygon> hole); std::shared_ptr<GeoShape> getCompositeShape(); }; } // #include "core/src/java/org/apache/lucene/spatial3d/geom/
c464726afec0405671b9ed35e39915fe6ce57f8e
b1d074d3c904fcc71897a9249640c032217a4de6
/Observer.h
5d0777f925bfc5b33ab22c79b0b8df0a1ab7b280
[]
no_license
Deste-user/Project_List
07aa95a6e6aeef0ec0e943ae710dfefaf7a7fe1a
e3744453d7b9a4db18fd0124cb1cf286e308840a
refs/heads/master
2023-06-26T06:11:50.872676
2021-07-28T16:04:55
2021-07-28T16:04:55
382,081,583
0
0
null
null
null
null
UTF-8
C++
false
false
266
h
Observer.h
// // Created by Marco De Stefano on 15/04/21. // #ifndef LISTA_OBSERVER_H #define LISTA_OBSERVER_H #include <memory> class Subject; class Observer : public enable_shared_from_this<Observer> { public: virtual void update() = 0; }; #endif //LISTA_OBSERVER_H
706176672d82cc56df9dbd2006f45e31d538aaac
041fb0422422342f3408feb2733cba58c79d03a9
/lib/suloki_interface.h
057d529da9b4a50df92fd9c1c5bd38e93e71c29d
[ "MIT" ]
permissive
suloki/suloki_urc_github
364201d561b5a539bc23f1e12b75f38983fd169c
53310568185fda3cb9f1e8c31b26ce94b7ed4858
refs/heads/master
2022-11-07T23:31:50.109794
2019-12-24T07:53:03
2019-12-24T07:53:03
229,897,735
0
2
NOASSERTION
2022-10-04T23:55:25
2019-12-24T07:54:08
C++
UTF-8
C++
false
false
6,593
h
suloki_interface.h
#ifndef _SULOKI_ESF_INTERFACE_H_ #define _SULOKI_ESF_INTERFACE_H_ #ifdef SULOKI_WINDOWS_OS_SULOKI #define SULOKI_STDCALL __stdcall #else #define SULOKI_STDCALL #endif #define SULOKI_IN #define SULOKI_OUT #define SULOKI_INOUT #include "suloki.pb.h" //about proto buffer define //business id const long SULOKI_SYSTEM_BISINESSID_PROTO = 0;//some system level bussiness const long SULOKI_URC_BISINESSID_PROTO = 1;//about urc bussiness const long SULOKI_USER_BISINESSID_PROTO = 1024;//user define business id must >= SULOKI_USER_BISINESSID_PROTO //message id //SULOKI_SYSTEM_BISINESSID_PROTO const long SULOKI_TEST_MESSAGEID_SYSTEM_PROTO = 0; const long SULOKI_HEARTBEAT_MESSAGEID_SYSTEM_PROTO = 1; const long SULOKI_INIT_MESSAGEID_SYSTEM_PROTO = 2; const long SULOKI_START_MESSAGEID_SYSTEM_PROTO = 3; const long SULOKI_STOP_MESSAGEID_SYSTEM_PROTO = 4; const long SULOKI_CLEAR_MESSAGEID_SYSTEM_PROTO = 5; const long SULOKI_TIMEOUT_MESSAGEID_SYSTEM_PROTO = 6; const long SULOKI_TOKEN_MESSAGEID_SYSTEM_PROTO = 7;//auth //SULOKI_URC_BISINESSID_PROTO const long SULOKI_ADD_MESSAGEID_URC_PROTO = 0; const long SULOKI_DEL_MESSAGEID_URC_PROTO = 1; const long SULOKI_UPDATE_MESSAGEID_URC_PROTO = 2; const long SULOKI_GET_MESSAGEID_URC_PROTO = 3; const long SULOKI_REGSERVICE_MESSAGEID_URC_PROTO = 4;//used system inside const long SULOKI_UNREGSERVICE_MESSAGEID_URC_PROTO = 5;//used system inside const long SULOKI_OBTAINSTATES_MESSAGEID_URC_PROTO = 6;//used system inside, get all service's state in group const long SULOKI_SQL_MESSAGEID_URC_PROTO = 1024; typedef long SulokiRet; //urc obj base class class BaseRoot { public: BaseRoot(){} virtual ~BaseRoot(){} private: BaseRoot(BaseRoot& ref){} BaseRoot& operator=(BaseRoot& ref){ return *this; } }; //urc module interface typedef void(SULOKI_STDCALL *SulokiAsyncCb)(SULOKI_IN suloki::SulokiContext* pContextOri, SULOKI_IN std::auto_ptr<suloki::SulokiMessage> msgSmart, SULOKI_IN suloki::SulokiContext& contextNew);//Suloki::Uint pCcontext, Suloki::Uint msgPtr, bool bTimeout) class SulokiUrcModuleInterface { public: virtual ~SulokiUrcModuleInterface(){} // virtual SulokiRet ReqRes(SULOKI_IN std::string strGroupName, SULOKI_IN std::string strServiceName, SULOKI_INOUT suloki::SulokiMessage& req, SULOKI_IN long timeout, SULOKI_IN SulokiAsyncCb asyncCb = NULL, SULOKI_IN std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; //Response virtual SulokiRet Notify(SULOKI_IN std::string strGroupName, SULOKI_IN std::string strServiceName, SULOKI_IN suloki::SulokiMessage& notice) = 0; // virtual SulokiRet PostToMainModule(SULOKI_IN std::auto_ptr<suloki::SulokiMessage> msgSmart) = 0; virtual SulokiRet AddObject(SULOKI_IN std::string strUrName, SULOKI_IN boost::shared_ptr<BaseRoot>& baseSmartPtr) = 0; virtual SulokiRet DelObject(SULOKI_IN std::string strUrName, SULOKI_OUT boost::shared_ptr<BaseRoot>& baseSmartPtr) = 0; virtual SulokiRet GetObject(SULOKI_IN std::string strUrName, SULOKI_OUT boost::shared_ptr<BaseRoot>& baseSmartPtr) = 0; virtual SulokiRet GetSqlData(SULOKI_IN std::string strUrName, SULOKI_INOUT suloki::SulokiMessage& msg, SULOKI_IN long timeout, SULOKI_IN SulokiAsyncCb asyncCb = NULL, SULOKI_IN std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; virtual SulokiRet AddNoSqlData(SULOKI_IN std::string strUrName, SULOKI_IN std::string& data, SULOKI_IN bool bDir = false, SULOKI_IN long timeout = 0, SULOKI_IN SulokiAsyncCb asyncCb = NULL, SULOKI_IN std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; virtual SulokiRet DelNoSqlData(SULOKI_IN std::string strUrName, SULOKI_OUT std::string& data, SULOKI_IN long timeout = 0, SULOKI_IN SulokiAsyncCb asyncCb = NULL, SULOKI_IN std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; virtual SulokiRet UpdateNoSqlData(SULOKI_IN std::string strUrName, SULOKI_INOUT std::string& data, SULOKI_IN long timeout = 0, SULOKI_IN SulokiAsyncCb asyncCb = NULL, SULOKI_IN std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; virtual SulokiRet GetNoSqlData(SULOKI_IN std::string strUrName, SULOKI_OUT std::string& data, SULOKI_IN long timeout = 0, SULOKI_IN SulokiAsyncCb asyncCb = NULL, SULOKI_IN std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; virtual SulokiRet GetUrDirectory(SULOKI_IN std::string strUrPath, SULOKI_OUT std::vector<std::string>& nameVector) = 0;// , long timeout = 0, SulokiAsyncCb asyncCb = NULL, std::auto_ptr<suloki::SulokiContext> contextOriSmart = std::auto_ptr<suloki::SulokiContext>(NULL)) = 0; protected: SulokiUrcModuleInterface(){} private: SulokiUrcModuleInterface(SulokiUrcModuleInterface& ref) {} SulokiUrcModuleInterface& operator=(SulokiUrcModuleInterface& ref) { return *this; } protected: }; //handle module interface,dll/so typedef SulokiRet(SULOKI_STDCALL *IhInit)(SULOKI_IN SulokiUrcModuleInterface* pSulokiUrcModuleInterface, SULOKI_IN std::string groupName, SULOKI_IN std::string serviceName, SULOKI_IN std::string strModuleName, SULOKI_IN std::string strConfig); typedef SulokiRet(SULOKI_STDCALL *IhStart)(void); typedef SulokiRet(SULOKI_STDCALL *IhTestValid)(SULOKI_IN const suloki::SulokiMessage& msg); typedef SulokiRet(SULOKI_STDCALL *IhHandle)(SULOKI_IN std::auto_ptr< suloki::SulokiMessage > msgSmart, SULOKI_IN suloki::SulokiContext& context); typedef SulokiRet(SULOKI_STDCALL *IhStop)(void); typedef SulokiRet(SULOKI_STDCALL *IhClear)(void); class SulokiHandleModuleInterface { public: virtual ~SulokiHandleModuleInterface(){} // virtual SulokiRet Init(SULOKI_IN SulokiUrcModuleInterface* pSulokiUrcModuleInterface, SULOKI_IN std::string groupName, SULOKI_IN std::string serviceName, SULOKI_IN std::string strModuleName, SULOKI_IN std::string strConfig) = 0; virtual SulokiRet Start(void) = 0; virtual SulokiRet TestValid(SULOKI_IN const suloki::SulokiMessage& msg) = 0; virtual SulokiRet Handle(SULOKI_IN std::auto_ptr< suloki::SulokiMessage > msgSmart, SULOKI_IN suloki::SulokiContext& context) = 0; virtual SulokiRet Stop(void) = 0; virtual SulokiRet Clear(void) = 0; // protected: SulokiHandleModuleInterface(){} //explicit SulokiHandleModuleInterface(std::string modulePath){}// throw(Suloki::Exception){} private: SulokiHandleModuleInterface(SulokiHandleModuleInterface& ref) {} SulokiHandleModuleInterface& operator=(SulokiHandleModuleInterface& ref) { return *this; } protected: }; #endif
1c2c94e11b9b254871c92a4b5d5610f2e263f28d
9c9c6b8deca524c9401dd24d19510d3843bebe4b
/ROBOTIS/ROBOTIS-Framework/robotis_device/src/robotis_device/sensor.cpp
ba7bf29aa5e8c1c6a942367f0f96347da49f389d
[ "Apache-2.0", "MIT" ]
permissive
tku-iarc/wrs2020
3f6473c2f3077400527b5e3008ae8a6e88eb00d6
a19d1106206e65f9565fa68ad91887e722d30eff
refs/heads/master
2022-12-12T20:33:10.958300
2021-02-01T10:21:09
2021-02-01T10:21:09
238,463,359
3
8
MIT
2022-12-09T02:09:35
2020-02-05T14:00:16
C++
UTF-8
C++
false
false
1,233
cpp
sensor.cpp
/******************************************************************************* * Copyright 2018 ROBOTIS 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. *******************************************************************************/ /* * sensor.cpp * * Created on: 2016. 5. 11. * Author: zerom */ #include "robotis_device/sensor.h" using namespace robotis_framework; Sensor::Sensor(int id, std::string model_name, float protocol_version) { this->id_ = id; this->model_name_ = model_name; this->port_name_ = ""; this->protocol_version_ = protocol_version; ctrl_table_.clear(); sensor_state_ = new SensorState(); bulk_read_items_.clear(); }
a4d29488e6b6312764e2aaba7ec302fdd5cf674c
eccc7e990f2c3e7a1f6facf96016666ed6910961
/Recursions/subsetsEasy.cpp
887589b985a576bf84dd60859c86d505b1aa475f
[]
no_license
diyamahendru/Data-Structures-Challenges
3617e34306528a0e8993c498958bec38afa1a135
c0445e9a985f4d7b81216f5717f509001ace8b2f
refs/heads/master
2023-01-29T19:48:16.469864
2020-12-09T10:20:09
2020-12-09T10:20:09
265,329,457
1
0
null
null
null
null
UTF-8
C++
false
false
647
cpp
subsetsEasy.cpp
//To print Yes if the sum of any subset is 0. #include<iostream> using namespace std; bool subsets(int *in, int n, int i, int sum, int cnt){ if(i == n){ if(sum == 0 && cnt > 0) return true; else return false; } return subsets(in, n, i+1, sum, cnt) || subsets(in, n, i+1, sum+in[i], cnt+1); } int main(){ int t; cin>>t; while(t--){ int n; cin>>n; int a[n]; for(int i=0; i<n; i++){ cin>>a[i]; } if(subsets(a, n, 0, 0, 0)) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }
84bc376b214944ece777c0526c603d08910884d6
1b6e2624235063cddfef23b9d04dc7f4c5a7925b
/src/Amf.cpp
a076b58625ec45087083d9de56934ebe75576abd
[ "Unlicense" ]
permissive
elnormous/rtmp_relay
a4d0c7a55e10a7f140efbd39c66d707a1a786062
af5446861df763e2dfe68fb8a3114677f6f32d2c
refs/heads/master
2022-12-13T02:33:46.850184
2022-09-24T02:45:20
2022-09-24T02:45:20
52,972,953
68
15
Unlicense
2022-09-22T16:57:06
2016-03-02T15:19:15
C++
UTF-8
C++
false
false
41,090
cpp
Amf.cpp
// // rtmp_relay // #include <iostream> #include "Amf.hpp" #include "Utils.hpp" namespace relay { namespace amf { static const std::string INDENT = " "; static std::string typeToString(Node::Type type) { switch (type) { case Node::Type::Unknown: return "Unknwonw"; case Node::Type::Null: return "Null"; case Node::Type::Integer: return "Integer"; case Node::Type::Double: return "Double"; case Node::Type::Boolean: return "Boolean"; case Node::Type::String: return "String"; case Node::Type::Object: return "Object"; case Node::Type::Undefined: return "Undefined"; case Node::Type::Dictionary: return "Dictionary"; case Node::Type::Array: return "Array"; case Node::Type::Date: return "Date"; case Node::Type::XMLDocument: return "XMLDocument"; case Node::Type::TypedObject: return "TypedObject"; case Node::Type::SwitchToAMF3: return "SwitchToAMF3"; default: return "Invalid"; } return ""; } // decoding // AMF0 and AMF3 static uint32_t readNumber(const std::vector<uint8_t>& buffer, uint32_t offset, double& result) { uint32_t originalOffset = offset; uint32_t ret = decodeDouble(buffer, offset, result); if (ret == 0) { return 0; } offset += ret; return offset - originalOffset; } // AMF3 static uint32_t readInteger(const std::vector<uint8_t>& buffer, uint32_t offset, int32_t& result) { uint32_t originalOffset = offset; uint32_t unsignedValue; uint32_t ret = decodeU29(buffer, offset, unsignedValue); if (ret == 0) { return 0; } offset += ret; result = static_cast<int32_t>(unsignedValue << 3); result >>= 3; return offset - originalOffset; } // AMF0 static uint32_t readBoolean(const std::vector<uint8_t>& buffer, uint32_t offset, bool& result) { uint32_t originalOffset = offset; if (buffer.size() - offset < 1) { return 0; } result = (*(buffer.data() + offset)) > 0; offset += 1; return offset - originalOffset; } // AMF0 static uint32_t readString(const std::vector<uint8_t>& buffer, uint32_t offset, std::string& result) { uint32_t originalOffset = offset; uint16_t length; uint32_t ret = decodeIntBE(buffer, offset, 2, length); if (ret == 0) { return 0; } offset += ret; if (buffer.size() - offset < length) { return 0; } result.assign(reinterpret_cast<const char*>(buffer.data() + offset), length); offset += length; return offset - originalOffset; } // AMF3 static uint32_t readStringAMF3(const std::vector<uint8_t>& buffer, uint32_t offset, std::string& result) { uint32_t originalOffset = offset; uint32_t length; uint32_t ret = decodeU29(buffer, offset, length); if (ret == 0) { return 0; } offset += ret; length >>= 1; // shift out the low bit (reference/literal marker) if (buffer.size() - offset < length) { return 0; } result.assign(reinterpret_cast<const char*>(buffer.data() + offset), length); offset += length; return offset - originalOffset; } // AMF0 static uint32_t readObject(const std::vector<uint8_t>& buffer, uint32_t offset, std::map<std::string, Node>& result) { uint32_t originalOffset = offset; while (true) { std::string key; uint32_t ret = readString(buffer, offset, key); if (ret == 0) { return 0; } offset += ret; if (buffer.size() - offset < 1) { return 0; } AMF0Marker marker = *reinterpret_cast<const AMF0Marker*>(buffer.data() + offset); if (marker == AMF0Marker::ObjectEnd) { offset += 1; break; } else { Node node; ret = node.decode(amf::Version::AMF0, buffer, offset); if (ret == 0) { return 0; } offset += ret; result[key] = node; } } return offset - originalOffset; } // AMF3 static uint32_t readObjectAMF3(const std::vector<uint8_t>& buffer, uint32_t offset, std::map<std::string, Node>& result) { uint32_t originalOffset = offset; while (true) { std::string key; uint32_t ret = readString(buffer, offset, key); if (ret == 0) { return 0; } offset += ret; if (buffer.size() - offset < 1) { return 0; } AMF0Marker marker = *reinterpret_cast<const AMF0Marker*>(buffer.data() + offset); if (marker == AMF0Marker::ObjectEnd) { offset += 1; break; } else { Node node; ret = node.decode(amf::Version::AMF0, buffer, offset); if (ret == 0) { return 0; } offset += ret; result[key] = node; } } return offset - originalOffset; } // AMF0 static uint32_t readECMAArray(const std::vector<uint8_t>& buffer, uint32_t offset, std::map<std::string, Node>& result) { uint32_t originalOffset = offset; uint32_t count; uint32_t ret = decodeIntBE(buffer, offset, 4, count); if (ret == 0) { return 0; } offset += ret; std::string key; uint32_t currentCount = 0; while (true) { key.clear(); ret = readString(buffer, offset, key); if (ret == 0) { return 0; } offset += ret; if (buffer.size() - offset < 1) { return 0; } AMF0Marker marker = *reinterpret_cast<const AMF0Marker*>(buffer.data() + offset); if (marker == AMF0Marker::ObjectEnd) { offset += 1; break; } else { Node node; ret = node.decode(amf::Version::AMF0, buffer, offset); if (ret == 0) { return 0; } offset += ret; result[key] = node; ++currentCount; } } if (count != 0 && count != currentCount) // Wowza sends count 0 for ECMA arrays { return 0; } return offset - originalOffset; } // AMF3 static uint32_t readDictionary(const std::vector<uint8_t>& buffer, uint32_t offset, std::map<std::string, Node>& result) { uint32_t originalOffset = offset; uint32_t count; uint32_t ret = decodeU29(buffer, offset, count); if (ret == 0) { return 0; } offset += ret; // skip the weakly-referenced flag offset += 1; std::string key; while (true) { key.clear(); ret = readStringAMF3(buffer, offset, key); if (ret == 0) { return 0; } offset += ret; if (buffer.size() - offset < 1) { return 0; } Node node; ret = node.decode(amf::Version::AMF3, buffer, offset); if (ret == 0) { return 0; } offset += ret; result[key] = node; } return offset - originalOffset; } // AMF0 static uint32_t readStrictArray(const std::vector<uint8_t>& buffer, uint32_t offset, std::vector<Node>& result) { uint32_t originalOffset = offset; uint32_t count; uint32_t ret = decodeIntBE(buffer, offset, 4, count); if (ret == 0) { return 0; } offset += ret; for (uint32_t i = 0; i < count; ++i) { Node node; ret = node.decode(amf::Version::AMF0, buffer, offset); if (ret == 0) { return 0; } offset += ret; result.push_back(node); } return offset - originalOffset; } // AMF3 static uint32_t readStrictArrayAMF3(const std::vector<uint8_t>& buffer, uint32_t offset, std::vector<Node>& result) { uint32_t originalOffset = offset; uint32_t count; uint32_t ret = decodeIntBE(buffer, offset, 4, count); if (ret == 0) { return 0; } offset += ret; for (uint32_t i = 0; i < count; ++i) { Node node; ret = node.decode(amf::Version::AMF0, buffer, offset); if (ret == 0) { return 0; } offset += ret; result.push_back(node); } return offset - originalOffset; } // AMF0 static uint32_t readDate(const std::vector<uint8_t>& buffer, uint32_t offset, double& ms, uint32_t& timezone) { uint32_t originalOffset = offset; uint32_t ret = decodeDouble(buffer, offset, ms); if (ret == 0) // date in milliseconds from 01/01/1970 { return 0; } offset += ret; ret = decodeIntBE(buffer, offset, 4, timezone); if (ret == 0) // unsupported timezone { return 0; } offset += ret; return offset - originalOffset; } // AMF3 static uint32_t readDateAMF3(const std::vector<uint8_t>& buffer, uint32_t offset, double& ms) { uint32_t originalOffset = offset; uint32_t value; uint32_t ret = decodeU29(buffer, offset, value); if (ret == 0) { return 0; } offset += ret; ret = decodeDouble(buffer, offset, ms); if (ret == 0) // date in milliseconds from 01/01/1970 { return 0; } offset += ret; return offset - originalOffset; } // AMF0 static uint32_t readLongString(const std::vector<uint8_t>& buffer, uint32_t offset, std::string& result) { uint32_t originalOffset = offset; uint32_t length; uint32_t ret = decodeIntBE(buffer, offset, 4, length); if (ret == 0) { return 0; } offset += ret; if (buffer.size() - offset < length) { return 0; } result.assign(reinterpret_cast<const char*>(buffer.data() + offset), length); offset += length; return offset - originalOffset; } // AMF0 static uint32_t readTypedObject(const std::vector<uint8_t>& /* buffer */, uint32_t& /* offset */) { Log(Log::Level::ERR) << "Typed objects are not supported"; return 0; } // encoding // AMF0 and AMF3 static uint32_t writeNumber(std::vector<uint8_t>& buffer, double value) { uint32_t ret = encodeDouble(buffer, value); return ret; } // AMF3 static uint32_t writeInteger(std::vector<uint8_t>& buffer, int32_t value) { uint32_t unsignedValue = static_cast<uint32_t>(value & 0xFFFFFFF); unsignedValue |= (static_cast<uint32_t>(value) & 0x80000000) >> 3; uint32_t ret = encodeU29(buffer, unsignedValue); return ret; } // AMF0 static uint32_t writeBoolean(std::vector<uint8_t>& buffer, bool value) { buffer.push_back(static_cast<uint8_t>(value)); return 1; } // AMF0 static uint32_t writeString(std::vector<uint8_t>& buffer, const std::string& value) { uint32_t ret = encodeIntBE(buffer, 2, value.size()); if (ret == 0) { return 0; } uint32_t size = ret; buffer.insert(buffer.end(), reinterpret_cast<const uint8_t*>(value.data()), reinterpret_cast<const uint8_t*>(value.data()) + value.length()); size += static_cast<uint32_t>(value.length()); return size; } // AMF3 static uint32_t writeStringAMF3(std::vector<uint8_t>& buffer, const std::string& value) { uint32_t ret = encodeU29(buffer, static_cast<uint32_t>(value.size()) << 1 | 1); // add the low bit (string literal marker) uint32_t size = ret; buffer.insert(buffer.end(), reinterpret_cast<const uint8_t*>(value.data()), reinterpret_cast<const uint8_t*>(value.data()) + value.length()); size += static_cast<uint32_t>(value.length()); return size; } // AMF0 static uint32_t writeObject(std::vector<uint8_t>& buffer, const std::map<std::string, Node>& value) { uint32_t size = 0; uint32_t ret; for (const auto& i : value) { ret = writeString(buffer, i.first); if (ret == 0) { return 0; } size += ret; ret = i.second.encode(amf::Version::AMF0, buffer); if (ret == 0) { return 0; } size += ret; } if ((ret = writeString(buffer, "")) == 0) { return 0; } size += ret; AMF0Marker marker = AMF0Marker::ObjectEnd; buffer.push_back(static_cast<uint8_t>(marker)); size += 1; return size; } // AMF3 static uint32_t writeObjectAMF3(std::vector<uint8_t>& buffer, const std::map<std::string, Node>& value) { uint32_t size = 0; uint32_t ret; for (const auto& i : value) { ret = writeString(buffer, i.first); if (ret == 0) { return 0; } size += ret; ret = i.second.encode(amf::Version::AMF0, buffer); if (ret == 0) { return 0; } size += ret; } if ((ret = writeString(buffer, "")) == 0) { return 0; } size += ret; AMF0Marker marker = AMF0Marker::ObjectEnd; buffer.push_back(static_cast<uint8_t>(marker)); size += 1; return size; } // AMF0 static uint32_t writeECMAArray(std::vector<uint8_t>& buffer, const std::map<std::string, Node>& value) { uint32_t size = 0; uint32_t ret = encodeIntBE(buffer, 4, value.size()); if (ret == 0) { return 0; } size += ret; for (const auto& i : value) { ret = writeString(buffer, i.first); if (ret == 0) { return 0; } size += ret; ret = i.second.encode(amf::Version::AMF0, buffer); if (ret == 0) { return 0; } size += ret; } if ((ret = writeString(buffer, "")) == 0) { return 0; } size += ret; AMF0Marker marker = AMF0Marker::ObjectEnd; buffer.push_back(static_cast<uint8_t>(marker)); size += 1; return size; } // AMF3 static uint32_t writeDictionary(std::vector<uint8_t>& buffer, const std::map<std::string, Node>& value) { uint32_t size = 0; uint32_t ret = encodeU29(buffer, static_cast<uint32_t>(value.size()) << 1 | 1); // add the low bit (dictionary literal marker) if (ret == 0) { return 0; } size += ret; buffer.push_back(0x00); // not using weakly-referenced keys size += 1; for (const auto& i : value) { ret = writeStringAMF3(buffer, i.first); if (ret == 0) { return 0; } size += ret; ret = i.second.encode(amf::Version::AMF3, buffer); if (ret == 0) { return 0; } size += ret; } return size; } // AMF0 static uint32_t writeStrictArray(std::vector<uint8_t>& buffer, const std::vector<Node>& value) { uint32_t size = 0; uint32_t ret = encodeIntBE(buffer, 4, value.size()); if (ret == 0) { return 0; } size += ret; for (const auto& i : value) { ret = i.encode(amf::Version::AMF0, buffer); if (ret == 0) { return 0; } size += ret; } return size; } // AMF3 static uint32_t writeStrictArrayAMF3(std::vector<uint8_t>& buffer, const std::vector<Node>& value) { uint32_t size = 0; uint32_t ret = encodeIntBE(buffer, 4, value.size()); if (ret == 0) { return 0; } size += ret; for (const auto& i : value) { ret = i.encode(amf::Version::AMF0, buffer); if (ret == 0) { return 0; } size += ret; } return size; } // AMF0 static uint32_t writeDate(std::vector<uint8_t>& buffer, double ms, uint32_t timezone) { uint32_t size = 0; uint32_t ret = encodeDouble(buffer, ms); if (ret == 0) // date in milliseconds from 01/01/1970 { return 0; } size += ret; ret = encodeIntBE(buffer, 4, timezone); if (ret == 0) // unsupported timezone { return 0; } size += ret; return size; } // AMF3 static uint32_t writeDateAMF3(std::vector<uint8_t>& buffer, double ms) { uint32_t size = 0; uint32_t ret = encodeU29(buffer, 1); if (ret == 0) // date in milliseconds from 01/01/1970 { return 0; } ret = encodeDouble(buffer, ms); if (ret == 0) // date in milliseconds from 01/01/1970 { return 0; } size += ret; return size; } // AMF0 static uint32_t writeLongString(std::vector<uint8_t>& buffer, const std::string& value) { uint32_t ret = encodeIntBE(buffer, 4, value.size()); if (ret == 0) { return 0; } uint32_t size = ret; buffer.insert(buffer.end(), reinterpret_cast<const uint8_t*>(value.data()), reinterpret_cast<const uint8_t*>(value.data()) + value.length()); size += static_cast<uint32_t>(value.length()); return size; } // AMF0 static uint32_t writeXMLDocument(std::vector<uint8_t>& buffer, const std::string& value) { uint32_t ret = encodeIntBE(buffer, 4, value.size()); if (ret == 0) { return 0; } uint32_t size = ret; for (char i : value) { buffer.push_back(static_cast<uint8_t>(i)); size += 1; } return size; } // AMF0 static uint32_t writeTypedObject(std::vector<uint8_t>& /* buffer */) { Log(Log::Level::ERR) << "Typed objects are not supported"; return 0; } uint32_t Node::decode(Version version, const std::vector<uint8_t>& buffer, uint32_t offset) { uint32_t originalOffset = offset; if (version == Version::AMF0) { if (buffer.size() - offset < 1) { return 0; } AMF0Marker marker = *reinterpret_cast<const AMF0Marker*>(buffer.data() + offset); offset += 1; uint32_t ret = 0; switch (marker) { case AMF0Marker::Number: { type = Type::Double; if ((ret = readNumber(buffer, offset, doubleValue)) == 0) { return 0; } break; } case AMF0Marker::Boolean: { type = Type::Boolean; if ((ret = readBoolean(buffer, offset, boolValue)) == 0) { return 0; } break; } case AMF0Marker::String: { type = Type::String; if ((ret = readString(buffer, offset, stringValue)) == 0) { return 0; } break; } case AMF0Marker::Object: { type = Type::Object; if ((ret = readObject(buffer, offset, mapValue)) == 0) { return 0; } break; } case AMF0Marker::Null: type = Type::Null; break; case AMF0Marker::Undefined: type = Type::Undefined; break; case AMF0Marker::ECMAArray: { type = Type::Dictionary; if ((ret = readECMAArray(buffer, offset, mapValue)) == 0) { return 0; } break; } case AMF0Marker::ObjectEnd: break; // should not happen case AMF0Marker::StrictArray: { type = Type::Array; if ((ret = readStrictArray(buffer, offset, vectorValue)) == 0) { return 0; } break; } case AMF0Marker::Date: { type = Type::Date; if ((ret = readDate(buffer, offset, doubleValue, timezone)) == 0) { return 0; } break; } case AMF0Marker::LongString: { type = Type::String; if ((ret = readLongString(buffer, offset, stringValue)) == 0) { return 0; } break; } case AMF0Marker::XMLDocument: { type = Type::XMLDocument; if ((ret = readLongString(buffer, offset, stringValue)) == 0) { return 0; } break; } case AMF0Marker::TypedObject: { type = Type::TypedObject; if ((ret = readTypedObject(buffer, offset)) == 0) { return 0; } break; } case AMF0Marker::SwitchToAMF3: { ret += decode(Version::AMF3, buffer, offset); break; } default: return 0; } offset += ret; } else if (version == Version::AMF3) { AMF3Marker marker = *reinterpret_cast<const AMF3Marker*>(buffer.data() + offset); offset += 1; uint32_t ret = 0; switch (marker) { case AMF3Marker::Undefined: type = Type::Undefined; break; case AMF3Marker::Null: type = Type::Null; break; case AMF3Marker::False: type = Type::Boolean; boolValue = false; break; case AMF3Marker::True: type = Type::Boolean; boolValue = true; break; case AMF3Marker::Integer: type = Type::Integer; if ((ret = readInteger(buffer, offset, intValue)) == 0) { return 0; } break; case AMF3Marker::Double: type = Type::Double; if ((ret = readNumber(buffer, offset, doubleValue)) == 0) { return 0; } break; case AMF3Marker::String: type = Type::String; if ((ret = readStringAMF3(buffer, offset, stringValue)) == 0) { return 0; } break; case AMF3Marker::XMLDocument: type = Type::XMLDocument; if ((ret = readStringAMF3(buffer, offset, stringValue)) == 0) { return 0; } break; case AMF3Marker::Date: type = Type::Date; if ((ret = readDateAMF3(buffer, offset, doubleValue)) == 0) { return 0; } timezone = 0; break; case AMF3Marker::Array: type = Type::Array; if ((ret = readStrictArrayAMF3(buffer, offset, vectorValue)) == 0) { return 0; } break; case AMF3Marker::Object: type = Type::Object; if ((ret = readObjectAMF3(buffer, offset, mapValue)) == 0) { return 0; } break; case AMF3Marker::XML: type = Type::XMLDocument; if ((ret = readStringAMF3(buffer, offset, stringValue)) == 0) { return 0; } break; case AMF3Marker::ByteArray: break; case AMF3Marker::VectorInt: break; case AMF3Marker::VectorDouble: break; case AMF3Marker::VectorObject: break; case AMF3Marker::Dictionary: type = Type::Dictionary; if ((ret = readDictionary(buffer, offset, mapValue)) == 0) { return 0; } break; } offset += ret; } return offset - originalOffset; } uint32_t Node::encode(Version version, std::vector<uint8_t>& buffer) const { uint32_t size = 0; if (version == Version::AMF0) { AMF0Marker marker; switch (type) { case Type::Unknown: return 0; // should not happen case Type::Null: marker = AMF0Marker::Null; break; case Type::Integer: marker = AMF0Marker::Number; break; case Type::Double: marker = AMF0Marker::Number; break; case Type::Boolean: marker = AMF0Marker::Boolean; break; case Type::String: { marker = ((stringValue.length() <= std::numeric_limits<uint16_t>::max()) ? AMF0Marker::String : AMF0Marker::LongString); break; } case Type::Object: marker = AMF0Marker::Object; break; case Type::Undefined: marker = AMF0Marker::Undefined; break; case Type::Dictionary: marker = AMF0Marker::ECMAArray; break; case Type::Array: marker = AMF0Marker::StrictArray; break; case Type::Date: marker = AMF0Marker::Date; break; case Type::XMLDocument: marker = AMF0Marker::XMLDocument; break; case Type::TypedObject: marker = AMF0Marker::TypedObject; break; case Type::SwitchToAMF3: marker = AMF0Marker::SwitchToAMF3; break; default: return 0; } buffer.push_back(static_cast<uint8_t>(marker)); size += 1; uint32_t ret = 0; switch (type) { case Type::Unknown: break; // should not happen case Type::Null: break; case Type::Integer: { ret = writeNumber(buffer, static_cast<double>(intValue)); break; } case Type::Double: { ret = writeNumber(buffer, doubleValue); break; } case Type::Boolean: { ret = writeBoolean(buffer, boolValue); break; } case Type::String: { if (stringValue.length() <= std::numeric_limits<uint16_t>::max()) { ret = writeString(buffer, stringValue); break; } else { ret = writeLongString(buffer, stringValue); break; } break; } case Type::Object: { ret = writeObject(buffer, mapValue); break; } case Type::Undefined: break; case Type::Dictionary: { ret = writeECMAArray(buffer, mapValue); break; } case Type::Array: { ret = writeStrictArray(buffer, vectorValue); break; } case Type::Date: { ret = writeDate(buffer, doubleValue, timezone); break; } case Type::XMLDocument: { ret = writeXMLDocument(buffer, stringValue); break; } case Type::TypedObject: { ret = writeTypedObject(buffer); break; } case Type::SwitchToAMF3: break; } size += ret; } else if (version == Version::AMF3) { AMF3Marker marker; switch (type) { case Type::Unknown: return 0; // should not happen case Type::Null: marker = AMF3Marker::Null; break; case Type::Integer: marker = AMF3Marker::Integer; break; case Type::Double: marker = AMF3Marker::Double; break; case Type::Boolean: marker = (boolValue) ? AMF3Marker::True : AMF3Marker::False; break; case Type::String: marker = AMF3Marker::String; break; case Type::Object: marker = AMF3Marker::Object; break; case Type::Undefined: marker = AMF3Marker::Undefined; break; case Type::Dictionary: marker = AMF3Marker::Dictionary; break; case Type::Array: marker = AMF3Marker::Array; break; case Type::Date: marker = AMF3Marker::Date; break; case Type::XMLDocument: marker = AMF3Marker::XMLDocument; break; case Type::TypedObject: return 0; // typed objects are not supported case Type::SwitchToAMF3: return 0; // switch to AMF3 not supported default: return 0; } buffer.push_back(static_cast<uint8_t>(marker)); size += 1; uint32_t ret = 0; switch (type) { case Type::Unknown: break; // should not happen case Type::Null: break; case Type::Integer: { ret = writeInteger(buffer, intValue); break; } case Type::Double: { ret = writeNumber(buffer, doubleValue); break; } case Type::Boolean: break; case Type::String: { ret = writeStringAMF3(buffer, stringValue); break; } case Type::Object: { ret = writeObjectAMF3(buffer, mapValue); break; } case Type::Undefined: break; case Type::Dictionary: { ret = writeDictionary(buffer, mapValue); break; } case Type::Array: { ret = writeStrictArrayAMF3(buffer, vectorValue); break; } case Type::Date: { ret = writeDateAMF3(buffer, doubleValue); break; } case Type::XMLDocument: { ret = writeStringAMF3(buffer, stringValue); break; } case Type::TypedObject: { break; } case Type::SwitchToAMF3: break; } size += ret; Log(Log::Level::ERR) << "AMF3 not supported"; return 0; } return size; } void Node::dump(Log& log, const std::string& indent) { log << "Type: " << typeToString(type) << "(" << static_cast<uint32_t>(type) << ")"; if (type == Type::Object || type == Type::Array || type == Type::Dictionary) { log << ", values:"; if (type == Type::Array) { for (size_t index = 0; index < vectorValue.size(); index++) { log << "\n" << indent + INDENT << index << ": "; vectorValue[index].dump(log, indent + INDENT); } } else { for (auto i : mapValue) { log << "\n" << indent + INDENT << i.first << ": "; i.second.dump(log, indent + INDENT); } } } else if (type == Type::Integer || type == Type::Double || type == Type::Boolean || type == Type::String || type == Type::Date || type == Type::XMLDocument) { log << ", value: "; switch (type) { case Type::Integer: log << intValue; break; case Type::Double: log << doubleValue; break; case Type::Boolean: log << (boolValue ? "true" : "false"); break; case Type::String: log << stringValue; break; case Type::Date: log << "ms=" << doubleValue << "timezone=" << timezone; break; case Type::XMLDocument: log << stringValue; break; default:break; } } } } }
2589972394e7c3f75437500563f7cfbb40a0851a
905a59f2bf9f0ce2497c33b8688c723e2e98a27a
/build-SkinTemplate-Desktop-Debug/src/Applications/moc_mainwindow.cxx
3e8da57a0281410374a30e97d7ad0bd2c74a3cd1
[]
no_license
VDimovaEdeleva/social_touch_classification_for_artificial_skin
f5e02e3b7b8da086bfd2d20f9f0c4cbc75eb5c73
ad604b35ddf38b689cff28d622907f4f7549c8d0
refs/heads/master
2021-10-14T08:33:25.696630
2019-02-03T10:36:23
2019-02-03T10:36:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,993
cxx
moc_mainwindow.cxx
/**************************************************************************** ** Meta object code from reading C++ file 'mainwindow.h' ** ** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.7) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../../SkinTemplate/src/Applications/mainwindow.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'mainwindow.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 63 #error "This file was generated using the moc from 4.8.7. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_MainWindow[] = { // content: 6, // revision 0, // classname 0, 0, // classinfo 17, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 5, // signalCount // signals: signature, parameters, type, tag, flags 12, 11, 11, 11, 0x05, 23, 11, 11, 11, 0x05, 65, 63, 11, 11, 0x05, 125, 121, 11, 11, 0x05, 147, 11, 11, 11, 0x05, // slots: signature, parameters, type, tag, flags 167, 165, 11, 11, 0x08, 184, 11, 11, 11, 0x08, 199, 11, 11, 11, 0x08, 220, 11, 11, 11, 0x08, 241, 11, 11, 11, 0x08, 267, 11, 11, 11, 0x08, 289, 11, 11, 11, 0x08, 310, 121, 11, 11, 0x08, 332, 11, 11, 11, 0x0a, 348, 339, 11, 11, 0x0a, 395, 389, 11, 11, 0x2a, 436, 432, 11, 11, 0x0a, 0 // eod }; static const char qt_meta_stringdata_MainWindow[] = { "MainWindow\0\0finished()\0" "newDataBunch(QVector<Skin::Cell::Data>)\0" "d\0sampledData(Skin::Reconstruction::AccDataSampler::Data)\0" "num\0startLedFeedback(int)\0stopLedFeedback()\0" "s\0message(QString)\0handleEvents()\0" "dataSamplerStarted()\0dataSamplerStopped()\0" "dataSamplerPoseFinished()\0" "dataSamplerFinished()\0dataSamplingFailed()\0" "newNumberOfCells(int)\0quit()\0color,id\0" "changeLedColor(Skin::Cell::LedColor,int)\0" "color\0changeLedColor(Skin::Cell::LedColor)\0" "org\0newSkinOrganization(QVector<Skin::Cell::Organization>)\0" }; void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Q_ASSERT(staticMetaObject.cast(_o)); MainWindow *_t = static_cast<MainWindow *>(_o); switch (_id) { case 0: _t->finished(); break; case 1: _t->newDataBunch((*reinterpret_cast< QVector<Skin::Cell::Data>(*)>(_a[1]))); break; case 2: _t->sampledData((*reinterpret_cast< Skin::Reconstruction::AccDataSampler::Data(*)>(_a[1]))); break; case 3: _t->startLedFeedback((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: _t->stopLedFeedback(); break; case 5: _t->message((*reinterpret_cast< QString(*)>(_a[1]))); break; case 6: _t->handleEvents(); break; case 7: _t->dataSamplerStarted(); break; case 8: _t->dataSamplerStopped(); break; case 9: _t->dataSamplerPoseFinished(); break; case 10: _t->dataSamplerFinished(); break; case 11: _t->dataSamplingFailed(); break; case 12: _t->newNumberOfCells((*reinterpret_cast< int(*)>(_a[1]))); break; case 13: _t->quit(); break; case 14: _t->changeLedColor((*reinterpret_cast< Skin::Cell::LedColor(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 15: _t->changeLedColor((*reinterpret_cast< Skin::Cell::LedColor(*)>(_a[1]))); break; case 16: _t->newSkinOrganization((*reinterpret_cast< QVector<Skin::Cell::Organization>(*)>(_a[1]))); break; default: ; } } } const QMetaObjectExtraData MainWindow::staticMetaObjectExtraData = { 0, qt_static_metacall }; const QMetaObject MainWindow::staticMetaObject = { { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow, qt_meta_data_MainWindow, &staticMetaObjectExtraData } }; #ifdef Q_NO_DATA_RELOCATION const QMetaObject &MainWindow::getStaticMetaObject() { return staticMetaObject; } #endif //Q_NO_DATA_RELOCATION const QMetaObject *MainWindow::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; } void *MainWindow::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_MainWindow)) return static_cast<void*>(const_cast< MainWindow*>(this)); return QMainWindow::qt_metacast(_clname); } int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 17) qt_static_metacall(this, _c, _id, _a); _id -= 17; } return _id; } // SIGNAL 0 void MainWindow::finished() { QMetaObject::activate(this, &staticMetaObject, 0, 0); } // SIGNAL 1 void MainWindow::newDataBunch(QVector<Skin::Cell::Data> _t1) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 1, _a); } // SIGNAL 2 void MainWindow::sampledData(Skin::Reconstruction::AccDataSampler::Data _t1) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 2, _a); } // SIGNAL 3 void MainWindow::startLedFeedback(int _t1) { void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 3, _a); } // SIGNAL 4 void MainWindow::stopLedFeedback() { QMetaObject::activate(this, &staticMetaObject, 4, 0); } QT_END_MOC_NAMESPACE
fcf885c05f1c594db32c42789d7d34b54b1d425b
95089ad249da8d5f0eab8f69229f4a44d10ff7fb
/src/Interpreter/Scanner.hpp
ecd5319b9b7e928ab32072ddbf07ac98d4ebbbcc
[]
no_license
dydxh/SimpleSQL
b607156c56a3546cff3aab07109cb729e4dd00ad
58cc2e767a66530400d8294c7c5d68888e4dc17d
refs/heads/master
2020-06-01T17:42:24.112377
2019-06-16T10:53:10
2019-06-16T10:53:10
190,868,703
5
1
null
2019-06-10T05:35:28
2019-06-08T09:20:49
C++
UTF-8
C++
false
false
590
hpp
Scanner.hpp
#ifndef minisql_scanner_header #define minisql_scanner_header #ifndef yyFlexLexerOnce #include <FlexLexer.h> #endif #include "Parser.hpp" #include "location.hh" namespace interpreter { class Scanner: public yyFlexLexer { public: Scanner(std::istream* in) : yyFlexLexer(in) {} virtual ~Scanner() {} using FlexLexer::yylex; virtual int yylex(interpreter::Parser::semantic_type* lval, interpreter::Parser::location_type* loc); void CommentError(interpreter::Parser::location_type* loc); private: interpreter::Parser::semantic_type* yylval = nullptr; }; } #endif
dc7c0e2e7f39f767cae0c8b538c41e7be8122ba2
88f1cd9bfa5fc7b3899055485101b6b91ba59152
/src-arduino/selvkj_rende_bil.ino
221d7207f41a4eaa73f7635ab7f0bee7de2a500a
[]
no_license
vetstr14/tof-car
63b692bd1e93cbeeebe25dd410426df28a42be36
9fd36c8ba45e4ec80e2baf221ca046f701873615
refs/heads/master
2020-04-16T18:29:28.119700
2019-01-14T15:57:08
2019-01-14T15:57:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,788
ino
selvkj_rende_bil.ino
/*#include <Servo.h> //Servo Servo styring; const byte styrePin = 9; int styringPos; Servo sensorServo; const byte servoSensor = 44; int sensorPos; //Motor const byte motorPin = 46; int fart = 0; //Sensorer const byte venstreEcho = 7; const byte venstreTrig = 6; float durationV, lengdeV; const byte midtenEcho = 5; const byte midtenTrig = 4; float durationM, lengdeM; const byte hoyreEcho = 3; const byte hoyreTrig = 2; float durationH, lengdeH; void setup() { Serial.begin(9600); //Start servoer styring.attach(styrePin); sensorServo.attach(servoSensor); //Motor pinMode(motorPin, OUTPUT); //Sensorer pinMode(venstreEcho, INPUT); pinMode(venstreTrig, OUTPUT); pinMode(midtenEcho, INPUT); pinMode(midtenTrig, OUTPUT); pinMode(hoyreEcho, INPUT); pinMode(hoyreTrig, OUTPUT); } void loop() { malAvstand(); seEtterHindringer(); digitalWrite(motorPin, fart); Serial.print(lengdeV); Serial.print(" "); Serial.println(lengdeH); Serial.println(styringPos); } void malAvstand() { //Sensorer malMidten(); malVenstre(); malHoyre(); } void seEtterHindringer() { /*if (lengdeM <= 100 || (lengdeH <= 100 && lengdeV <= 100)) { fart = 0; digitalWrite(motorPin, fart); seEtterUtvei(); }*//* else if (lengdeH <= 200 || lengdeV <= 200) { if (lengdeH > lengdeV) { styringPos = (200 - lengdeH) / 2.22222222; } else { styringPos = 50;//(200 - lengdeV) / 2.22222222; } }*//* //Servoer if (lengdeV >= 200 && lengdeH >= 200) { //Rett frem styringPos = 90; } //Sving Høyre else if (lengdeV >= 200 && lengdeH <= 200) { styringPos = map(lengdeH, 200, 20, 90, 0);//(200 - lengdeH) / 2.22222222; } //Sving Venstre else if (lengdeV <= 200 && lengdeH >= 200) { styringPos = map(lengdeV, 200, 20, 90, 180);//(200 - lengdeV) / 2.22222222; }/* else if (lengdeV <= 100 && lengdeH <= 100 && lengdeM <= 100) { seEtterUtvei(); }*//* styring.write(styringPos); } void seEtterUtvei() { sensorServo.write(sensorPos); } void malVenstre() { digitalWrite(venstreTrig, LOW); delayMicroseconds(2); digitalWrite(venstreTrig, HIGH); delayMicroseconds(10); digitalWrite(venstreTrig, LOW); durationV = pulseIn(venstreEcho, HIGH); lengdeV = (durationV*.0343)/2; } void malMidten() { digitalWrite(midtenTrig, LOW); delayMicroseconds(2); digitalWrite(midtenTrig, HIGH); delayMicroseconds(10); digitalWrite(midtenTrig, LOW); durationM = pulseIn(midtenEcho, HIGH); lengdeM = (durationM*.0343)/2; } void malHoyre() { digitalWrite(hoyreTrig, LOW); delayMicroseconds(2); digitalWrite(hoyreTrig, HIGH); delayMicroseconds(10); digitalWrite(hoyreTrig, LOW); durationH = pulseIn(hoyreEcho, HIGH); lengdeH = (durationH*.0343)/2; }*/
5e90d5fbaed5a5750350df1eff908fa5a5be160f
8548f6053cca1c93db90b6f1c80f750a52c76be4
/src/model/source/eventrate/NormallyDistributedSourceEventRate.h
9b7af299d2531c6838937552bccab1a52e44f933
[]
no_license
lukasbm/ECSNeTpp
d6d11cf691babc6c12204bce283f487be77c83e2
913ef5ca7e6dd034c758373b5044aa16003baa1d
refs/heads/master
2023-07-22T07:53:24.583557
2021-08-28T02:00:33
2021-08-28T02:00:33
359,004,021
0
0
null
2021-04-17T23:35:08
2021-04-17T23:35:08
null
UTF-8
C++
false
false
634
h
NormallyDistributedSourceEventRate.h
#ifndef MODEL_SOURCE_EVENTRATE_NORMALLYDISTRIBUTEDSOURCEEVENTRATE_H_ #define MODEL_SOURCE_EVENTRATE_NORMALLYDISTRIBUTEDSOURCEEVENTRATE_H_ #include "omnetpp.h" #include "ISourceEventRateDistribution.h" using namespace omnetpp; namespace ecsnetpp { class NormallyDistributedSourceEventRate : public ISourceEventRateDistribution { protected: double mean; double stddev; protected: virtual void initialize() override; public: virtual double getMessageDelay() override; }; } /* namespace ecsnetpp */ #endif /* MODEL_SOURCE_EVENTRATE_NORMALLYDISTRIBUTEDSOURCEEVENTRATE_H_ */
6107cf5d43a1e298471dc4f1e2d9c286711d9a51
4e3b017d4adb7c1bb556097147b54dde20494215
/OpenFileMessage.h
f5e1f5a354b5ce5bda3aeb734d976876d17afd31
[ "MIT" ]
permissive
DmitrySibert/virtual-folder
627ee09c5e7e2d7d8a4b2f34b62c09aed8efe66a
9016fc2a9f5980f7e201b39494fae6f52f88a9a3
refs/heads/master
2021-01-18T23:08:06.367943
2016-02-02T16:29:36
2016-02-02T16:29:36
44,751,119
4
1
null
null
null
null
WINDOWS-1251
C++
false
false
607
h
OpenFileMessage.h
#pragma once #include "BaseMessage.h" #include <rapidjson\writer.h> #include <rapidjson\stringbuffer.h> using namespace rapidjson; class OpenFileMessage : public BaseMessage { private: string file; protected: //Можно использовать в потомках для получения сериализованной части родительского класа virtual void preSerialize(Writer<StringBuffer> &writer) const; public: OpenFileMessage(const string file, const bool isRequest, const string channelName, const string messageType, const string UUID); ~OpenFileMessage(); };
da8a797f7f7e73bf79b7eb9b3929b121b0e30483
f87fc667217bc1a75d14094bae002e41872ea65f
/st.h
aa8cab2fbea0079e76b953b1e0ec33a37d123283
[]
no_license
kimsh0713/DirectX
2268432de0a584697b6e68f64aa3fcf4d4f59ce4
1d7f346aebe95f82755a03d464d1e2f76c60327a
refs/heads/main
2023-07-17T11:31:18.567498
2021-09-01T05:50:19
2021-09-01T05:50:19
374,978,284
1
0
null
null
null
null
UTF-8
C++
false
false
222
h
st.h
#pragma once template<typename T> class st { public: static T* p; static T* G() { if (!p) p = new T; return p; } static void D() { delete p; p = nullptr; } }; template <typename T> T* st<T>::p = nullptr;
b0a00a7c680d58b38f3956888f80c643228b71d5
e6954e446eeeea366b9b307cc9a27d73d0bdb664
/stadium.hpp
a1b95e77e5b8729c269a70b4afb42147fec570ec
[]
no_license
piotrku91/stadium-system-res
c619126a29cad76a6460b6141fd12ad313d9acb8
28755325e08dea1dce41f83576c9ef8c4208c83d
refs/heads/master
2023-04-26T19:10:29.938003
2021-05-31T19:07:54
2021-05-31T19:07:54
367,417,953
3
2
null
2021-05-26T05:56:29
2021-05-14T16:17:49
C++
UTF-8
C++
false
false
2,417
hpp
stadium.hpp
#pragma once #include <map> #include <vector> #include "person.hpp" #include "seat.hpp" // Main stadium class file - Stadium object should be completely modular and prepared to move to another project or GUI // This class is only demo version - need to be rebuild using TRow = std::vector<std::vector<std::unique_ptr<seat>>>; // short notation of nested vectors class stadium { //Temporary public public: std::shared_ptr<Person> ExampleGuy; // temporary guy for tests private: // Private members size_t m_LineSeats; size_t m_RowSeats; size_t m_Floors; // Map with Prices List std::map<std::string, size_t> ActualPrices; // Black list to implement // Person list to implement std::vector<TRow> wholeObject; // Seats list (m_LineSeats*m_RowSeats*m_Floors) // Private functions void buildVector(); public: stadium(size_t t_SeatsInLine, size_t t_RowsOfLines, size_t t_Floors); // Public functions const std::vector<TRow>& getWholeObject(); // Zero-based numbering getters (index 0 = index 0) const std::vector<std::unique_ptr<seat>>& getLine(size_t t_Row, size_t t_Floor); // Zero-based numbering getter (index 0 = index 0) const std::unique_ptr<seat>& getSeat(size_t t_Seat, size_t t_Row, size_t t_Floor); // Zero-based numbering getter (index 0 = index 0) const std::unique_ptr<seat>& getSeat(size_t t_PosX, size_t t_PosY); // Zero-based numbering getter (index 0 = index 0) const std::unique_ptr<seat>& getSeat(size_t t_Id); // Simple getters size_t getTotalSeats() const; size_t getTotalRows() const; size_t getTotalFloors() const; size_t getCountOfReservedSeats(const std::shared_ptr<Person>& t_pPerson) const; size_t getIdByCoords(size_t t_Seat, size_t t_Row, size_t t_Floor) const; size_t getIdByCoords(size_t t_PosX, size_t t_PosY) const; std::pair<size_t, size_t> getCoordsById(size_t t_Id) const; std::string coordsToStr(std::pair<size_t, size_t> Coords); std::string coordsToStr(size_t t_PosX, size_t t_PosY); // Returns string of X, Y (incremented by 1) // Files bool loadPatternsToMap(const std::string &t_Filename, std::map<size_t, std::string> &t_Content); // Read patterns of type seats from file bool loadPricesToMap(const std::string &t_Filename, std::map<std::string, size_t> &t_Content); // Read actually prices from file };
dd6b0b22956b3583b2881f265949bdb8e1b7b889
3193f5be61e4bacdfa3dfb73a837b475d8dbd6df
/src/solver/convdiffvg.cpp
c98078f2ac5bec0d51be0ab4d986f9700a65d07c
[ "MIT" ]
permissive
BO136775579/aphros
ffd64f9c88a4c64a5680b3479ffc1c4b3ee5979f
db8dfd7ff83ef13d66d2e15e83868d33d4825889
refs/heads/master
2023-02-27T12:40:25.998178
2021-01-29T00:17:14
2021-01-29T00:18:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
444
cpp
convdiffvg.cpp
// Created by Petr Karnakov on 20.11.2019 // Copyright 2019 ETH Zurich #include "convdiffvg.ipp" #include "convdiffe.h" #include "convdiffi.h" using M = MeshStructured<double, 3>; using EB = Embed<M>; template class ConvDiffVectGeneric<M, ConvDiffScalImp<M>>; template class ConvDiffVectGeneric<M, ConvDiffScalExp<M>>; template class ConvDiffVectGeneric<EB, ConvDiffScalImp<EB>>; template class ConvDiffVectGeneric<EB, ConvDiffScalExp<EB>>;
f0fb5d00351241f8202059d1f8001e2822b85be2
49df3f33b58159b410ff82bfa04a1a8eacf5e737
/lib/math/conversions.hpp
2ccb17687fa651fa62499daf5bca7f43c0712a7f
[]
no_license
scryver/scrutils
17d6a6d04a6e203ff28bcdb91284d266ffde286b
c004145af13d8c4c7f7d55edaac240e5387509a8
refs/heads/master
2021-01-22T06:23:01.926616
2017-04-28T23:28:14
2017-04-28T23:28:14
81,754,682
0
0
null
null
null
null
UTF-8
C++
false
false
482
hpp
conversions.hpp
#ifndef SCRYVER_MATH_CONVERSIONS_HPP #define SCRYVER_MATH_CONVERSIONS_HPP #include "Scryver/Math/Constants.hpp" namespace Scryver { namespace Math { template <typename T> constexpr inline T toRadian(const T& degree) { return degree * PI<T>() / static_cast<T>(180.0); } template <typename T> constexpr inline T toDegree(const T& radian) { return radian * static_cast<T>(180.0) / PI<T>(); } } // namespace Math } // namespace Scryver #endif // SCRYVER_MATH_CONVERSIONS_HPP
34746d32d84bcece7da996b329c28aacece87a0c
a794247214443257ab37a69b5f4cb203e6db75c8
/lab3-triangle1
962c170e2ad368820f3d39dd9cb234bc2eb1ac28
[]
no_license
xLOWer/C-projects
1f0982dd25a3d8c9198c939eee7695edfc7997ea
e70e611acda0788c86784cb6ff106577f629af25
refs/heads/master
2021-01-20T11:35:50.895568
2015-09-21T11:46:17
2015-09-21T11:46:17
31,428,003
0
0
null
2017-04-02T15:01:23
2015-02-27T16:22:20
C++
UTF-8
C++
false
false
320
lab3-triangle1
#include <math.h> class __TRIANG{ public: double a, b, c; double _perimeter() { return a + b + c; } double _square() { double p = _perimeter() / 2; return sqrt(p * (p - a) * (p - b) * (p - c)); } bool __triangle(){ if(a + b > c && a + c > b && b + c > a){return true ;}else{return false;} } };
adb046f0ce67de5503d9154dc6ca39587dc07453
21da8e3490769f0062fad806abc119ed0334b7cc
/CodeChef/SEPT16/DIVMAC.cpp
8792ff386f93b35c89cb287e1deba2aa47e2e672
[]
no_license
nikhilhassija/CompetitiveProgramming
d2e0606c1badd3209452d670a99234a3ef0d5d6c
794deb2ef26d03471e78c6fb77f3a72d810d19f1
refs/heads/master
2020-04-05T23:06:20.363385
2017-12-22T21:19:16
2017-12-22T21:19:16
42,791,366
0
0
null
null
null
null
UTF-8
C++
false
false
3,959
cpp
DIVMAC.cpp
#include <bits/stdc++.h> using namespace std; struct node { int offset; int L[20]; }; node T[400005]; int A[100005]; vector <int> P; void init(); void assign(int *, int); void segtree_build(int, int, int); int segtree_query(int, int, int, int, int); void segtree_update(int, int, int, int, int); int main() { ios_base::sync_with_stdio(false); init(); int t; cin >> t; while(t--) { int n,m; cin >> n >> m; for(int i=0;i<n;i++) cin >> A[i]; segtree_build(1, 0, n-1); while(m--) { int q,l,r; cin >> q >> l >> r; l--; r--; if(q) cout << segtree_query(1, 0, n-1, l, r) << " "; else segtree_update(1, 0, n-1, l, r); } cout << '\n'; } } void init() { int n = 1e6 + 5; int L[n]; memset(L,0,sizeof(L)); for(int i=2;i<n;i++) { if(L[i] == 0) { L[i] = i; P.push_back(i); } for(int j=0;j<P.size() && P[j] <= L[i] && i*P[j] < n;j++) L[i*P[j]] = P[j]; } } void assign(int * L, int x) { int k = 0; int p = 0; while(x > 1) { while(x % P[p] == 0) { L[k] = P[p]; x /= P[p]; k++; } p++; } L[k] = 1; } void segtree_build(int node, int l, int r) { if(l == r) { T[node].offset = 0; assign(T[node].L,A[l]); return ; } int m = (l+r)/2; int lnode = 2*node; int rnode = 2*node + 1; segtree_build(lnode, l, m); segtree_build(rnode, m+1, r); T[node].offset = 0; T[node].L[0] = max(T[lnode].L[0],T[rnode].L[0]); for(int i=1;i<20 && T[node].L[i-1] > 1;i++) T[node].L[i] = max(T[lnode].L[i],T[rnode].L[i]); } int segtree_query(int node, int l, int r, int ql, int qr) { if(qr < l || r < ql) return 0; if(T[node].L[T[node].offset] == 1) return 1; if(ql <= l && r <= qr) return T[node].L[T[node].offset]; int lnode = 2*node; int rnode = 2*node + 1; if(T[node].offset) { for(int i=0;i<T[node].offset && T[lnode].L[T[lnode].offset] > 1;i++,T[lnode].offset++); for(int i=0;i<T[node].offset && T[rnode].L[T[rnode].offset] > 1;i++,T[rnode].offset++); T[node].offset = 0; int loff = T[lnode].offset; int roff = T[rnode].offset; int i=0; for(;i<20 && T[lnode].L[loff+i] > 1 && T[rnode].L[roff+i] > 1;i++) T[node].L[i] = max(T[lnode].L[loff+i],T[rnode].L[roff+i]); while(i < 20 && T[lnode].L[loff+i] > 1) { T[node].L[i] = T[lnode].L[loff + i]; i++; } while(i < 20 && T[rnode].L[roff+i] > 1) { T[node].L[i] = T[rnode].L[roff + 1]; i++; } T[node].L[i] = 1; } int m = (l+r)/2; return max( segtree_query(lnode, l, m, ql, qr), segtree_query(rnode, m+1, r, ql, qr) ); } void segtree_update(int node, int l, int r, int ul, int ur) { if(ur < l || r < ul) return ; if(T[node].L[T[node].offset] == 1) return ; if(ul <= l && r <= ur) { T[node].offset++; return ; } int lnode = 2*node; int rnode = 2*node + 1; if(T[node].offset) { for(int i=0;i<T[node].offset && T[lnode].L[T[lnode].offset] > 1;i++,T[lnode].offset++); for(int i=0;i<T[node].offset && T[rnode].L[T[rnode].offset] > 1;i++,T[rnode].offset++); T[node].offset = 0; int loff = T[lnode].offset; int roff = T[rnode].offset; int i=0; for(;i<20 && T[lnode].L[loff+i] > 1 && T[rnode].L[roff+i] > 1;i++) T[node].L[i] = max(T[lnode].L[loff+i],T[rnode].L[roff+i]); while(i < 20 && T[lnode].L[loff+i] > 1) { T[node].L[i] = T[lnode].L[loff + i]; i++; } while(i < 20 && T[rnode].L[roff+i] > 1) { T[node].L[i] = T[rnode].L[roff + 1]; i++; } T[node].L[i] = 1; } int m = (l+r)/2; segtree_update(lnode, l, m, ul, ur); segtree_update(rnode, m+1, r, ul, ur); int loff = T[lnode].offset; int roff = T[rnode].offset; int i=0; for(;i<20 && T[lnode].L[loff+i] > 1 && T[rnode].L[roff+i] > 1;i++) T[node].L[i] = max(T[lnode].L[loff+i],T[rnode].L[roff+i]); while(i < 20 && T[lnode].L[loff+i] > 1) { T[node].L[i] = T[lnode].L[loff + i]; i++; } while(i < 20 && T[rnode].L[roff+i] > 1) { T[node].L[i] = T[rnode].L[roff + 1]; i++; } T[node].L[i] = 1; }
4d017c65044777a31e8e2ce2491c85c519711f5a
332e0c3c2189c73c51a9422ab4f9e07ed7d5134e
/11917.cpp
685bbe81dd8ce0bae568aafd459eb8969ea6db6b
[]
no_license
ksaveljev/UVa-online-judge
352a05c9d12440337c2a0ba5a5f1c8aa1dc72357
006961a966004f744f5780a6a81108c0b79c3c18
refs/heads/master
2023-05-24T23:08:48.502908
2023-05-16T10:37:37
2023-05-16T10:37:37
1,566,701
112
80
null
2017-01-10T14:55:46
2011-04-04T11:43:53
C++
UTF-8
C++
false
false
685
cpp
11917.cpp
#include <iostream> #include <string> #include <map> using namespace std; int main(void) { int t, n, d; string input; map<string,int>::iterator it; cin >> t; for (int c = 0; c < t; c++) { cin >> n; map<string,int> subjects; while (n--) { cin >> input >> d; subjects[input] = d; } cin >> d >> input; it = subjects.find(input); cout << "Case " << c+1 << ": "; if (it != subjects.end() && subjects[input] <= d) { cout << "Yesss" << endl; } else if (it != subjects.end() && subjects[input] <= d + 5) { cout << "Late" << endl; } else { cout << "Do your own homework!" << endl; } } return 0; }
a30cff7402f96d6fd1b18c2af060c350192b0f3b
50fc832396b2a1fe35ba89fd30b3a0988f4b5827
/19. Remove Nth Node From End of List.cpp
6062ee3f5825057ebc083a2fac08a30dd0a9cc53
[]
no_license
peter88037/LeetCode
7feb28f0909da229f496aae82f76a955e3261d5a
1871434bcdd21b075d86bf8f00e349e34ac66be2
refs/heads/master
2020-05-09T22:33:31.116185
2019-04-15T11:46:13
2019-04-15T11:46:13
181,473,368
0
0
null
null
null
null
UTF-8
C++
false
false
661
cpp
19. Remove Nth Node From End of List.cpp
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* removeNthFromEnd(ListNode* head, int n) { ListNode* front=new ListNode(-1); front->next=head; ListNode* rear=front; ListNode* dummy=front; for(int i=0;i<n;i++) { rear=rear->next; } while(rear->next!=NULL) { front=front->next; rear=rear->next; } front->next=front->next->next; return dummy->next; } };
186a06375e7622fc3bc2630a7b8850e62fd6168a
ef307b85663a56accf58544ccb8a27ac3b4353df
/mainMin.cpp
7fdf24ca533bf10e0ba749939edc00775d83f545
[]
no_license
hutchinsonsh/minHeap
ca28e70e57a38bdc3cc5cac8b9f8d2866cb8dc00
c5d3af2e3c1042b762ff264f925406ada1e7282e
refs/heads/master
2022-08-04T12:23:42.055859
2020-05-22T23:41:16
2020-05-22T23:41:16
266,227,765
0
0
null
null
null
null
UTF-8
C++
false
false
1,327
cpp
mainMin.cpp
#include <stdio.h> #include <stdlib.h> #include "heapMin.h" int main() { // creates objects heap and k from heap.cpp struct HEAP heap; struct ELEMENT k; heap = Initilize(10); int arr[10] = {2, 4, 11, 8, 10, 49, 17, 250, 13, 32}; BuildHeap(&heap, arr, 10); printf("Original min heap:"); PrintHeap(heap); // tests if element can be inserted if size = capacity; should cause error printf("\nInsert: 50\n"); Insert(&heap, 50); printf("\n"); // deletes heap except for top 2 elements printf("Deletion/return min value section\n"); while(heap.size > 2) { int min = DeleteMin(&heap); printf("\n"); PrintHeap(heap); printf("Min element deleted: %d\n", min); } // inesertion printf("\n\nDeletion done; insertion section:\n"); Insert(&heap, 10); PrintHeap(heap); Insert(&heap, 20); PrintHeap(heap); Insert(&heap, 40); PrintHeap(heap); Insert(&heap, 20); PrintHeap(heap); printf("\n\nInsertion done; Decrease key section:\n"); PrintHeap(heap); DecreaseKey(&heap, 1, 9); printf("Element 2, from 20 to 9\n"); PrintHeap(heap); DecreaseKey(&heap, 0, 5); printf("Element 1, from 9 to 5\n"); PrintHeap(heap); DecreaseKey(&heap, 5, 10); printf("Element 6, from 49 to 10\n"); PrintHeap(heap); }
85ceff5c8bb57a54626c133014200e676530b02c
26fa522956d199883ab232de3aa09f9082a55b54
/calculate_pi.cpp
17d0ef5c61a5142dc702858bc256848b42a5c287
[]
no_license
marotzke/SuperComputing
9c67c447d715fcffa5a4cb5be54beeb64bf4f528
0b4b911a9b551e39e1177699c302c329d2687706
refs/heads/master
2021-09-21T12:49:48.984655
2018-08-26T22:32:39
2018-08-26T22:32:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,739
cpp
calculate_pi.cpp
/* This program will numerically compute the integral of 4/(1+x*x) from 0 to 1. The value of this integral is pi -- which is great since it gives us an easy way to check the answer. The is the original sequential program. It uses the timer from the OpenMP runtime library History: Written by Tim Mattson, 11/99. Updated by Luciano Soares */ #include <stdio.h> #include <omp.h> double pi_seq(long steps){ double x, pi, sum = 0.0; double step = 1.0/(double) steps; for (int i=1;i<= steps; i++) { x = (i-0.5)*step; sum = sum + 4.0/(1.0+x*x); } pi = step * sum; return pi; } double pi_par1(long steps){ int n = omp_get_max_threads(); double step = 1.0/(double) steps; int chunk_size = (steps/n); double sum_final = 0; #pragma omp parallel { int id = omp_get_thread_num(); long start = chunk_size * id + 1; long end = start+chunk_size; double sum = 0; for (long i= start;i <= end; i++) { double x = (i-0.5)*step; sum += 4.0/(1.0+x*x); } #pragma omp atomic sum_final += sum; } return step * sum_final;; } int main () { static long num_steps = 1000000000; double start_time = omp_get_wtime(); double pi = pi_par1(num_steps); double run_time = omp_get_wtime() - start_time; printf("\n pi with %ld steps is %.12lf in %lf seconds\n ",num_steps,pi,run_time); double start_time_seq = omp_get_wtime(); double pi_seq_value = pi_seq(num_steps); double run_time_seq = omp_get_wtime() - start_time; printf("\n pi with %ld steps is %.12lf in %lf seconds\n ",num_steps,pi_seq_value,run_time_seq); return 0; }
b3a410be2cd409a9564020385a0231f2c4a1275d
affa71d8df4f5a7f882053ad61a69abc77a957d9
/advancedC++/project/inc/outgoingEvent.h
6422f3043a5206a64cefd8f80b23113c0e7bc19e
[]
no_license
sashatim125/Experis-H50
e34396c7f91ee518d90ff04bc380057db5388119
94c834cac93729fe5cf1b3c9a40db2a2a035d4bc
refs/heads/master
2020-04-03T02:04:12.189571
2018-10-27T09:23:36
2018-10-27T09:23:36
154,946,068
0
0
null
null
null
null
UTF-8
C++
false
false
1,452
h
outgoingEvent.h
#ifndef __OUTGOINGEVENT_H__ #define __OUTGOINGEVENT_H__ // // @file outgoingEvent.h // @brief outgoing event (with destination) // // @details see comments // // // @author Alexander Timoshenko sashatim125@gmail.com // // #include "eventsReceiver.h" namespace advcpp { struct OutgoingEvent : public Event { inline OutgoingEvent(Event_sp _event, EventsReceiver& _dest); virtual inline const Timestamp& GetTimestamp() const ; virtual inline const std::string& GetTopic() const; virtual inline const Location& GetLocation() const; virtual inline const std::string& GetSenderID() const; inline EventsReceiver& GetDestination(); inline Event_sp GetEvent(); private: Event_sp m_event; EventsReceiver& m_dest; }; inline OutgoingEvent::OutgoingEvent(Event_sp _event, EventsReceiver& _dest) : m_event(_event) , m_dest(_dest) {} inline const Timestamp& OutgoingEvent::GetTimestamp() const { return m_event->GetTimestamp(); } inline const std::string& OutgoingEvent::GetTopic() const { return m_event->GetTopic(); } inline const Location& OutgoingEvent::GetLocation() const { return m_event->GetLocation(); } inline const std::string& OutgoingEvent::GetSenderID() const { return m_event->GetSenderID(); } inline EventsReceiver& OutgoingEvent::GetDestination() { return m_dest; } inline Event_sp OutgoingEvent::GetEvent() { return m_event; } }//endof namespace advcpp #endif //__OUTGOINGEVENT_H__
de9328b0b99d178d4b01bbd07eb6884fc428d2f7
095b7832c29a9225b83f9f4ff8355ef6a6543b0d
/Graph/MinimumTimeTakenByDAG.cpp
13cca0e45cfda62648e29bec698a176439b6e848
[]
no_license
I-Venkatesh/Data-structures-and-algorithms
a459b2a45fe0b5d2399e4f287bb83ea5d1742fac
0d05ee80d0e6dd5f376b843975f3c70abac1457f
refs/heads/master
2023-08-13T20:19:52.214023
2021-09-11T14:36:30
2021-09-11T14:36:30
323,447,201
0
0
null
null
null
null
UTF-8
C++
false
false
1,670
cpp
MinimumTimeTakenByDAG.cpp
using namespace std; #include<bits/stdc++.h> vector<int> graph[100005]; int inDegree[100005]; int job[100005]; void addEdge(int x,int y) { graph[x].push_back(y); inDegree[y]++; } void topologicalSort(int n,int m) { queue<int> q; for(int i=0;i<=n;i++) { if(inDegree[i]==0) { q.push(i); job[i]=1; } } while(!q.empty()) { int curr=q.front(); // cout<<curr<<"\n"; q.pop(); for(auto i:graph[curr]) { inDegree[i]--; if(job[i]<1+job[curr]) { job[i]=max(job[i],1+job[curr]); } if(inDegree[i]==0) { q.push(i); } } } for(int i=0;i<=n;i++) { cout<<job[i]<<" "; } } int dfs(int i,int visited[],stack<int> &st) { visited[i]=true; for(auto j:graph[i]) { if(!visited[j]) { dfs(j,visited,st); } } st.push(i); } void topologicalUsingStack(int n,int m) { stack<int> st; int visited[100005]; memset(visited,0,sizeof(visited)); for(int i=1;i<=n;i++) { if(!visited[i]) { dfs(i,visited, st); } } while(!st.empty()) { cout<<st.top(); st.pop(); } } int main() { int n=10,m=13; addEdge(1, 3); addEdge(1, 4); addEdge(1, 5); addEdge(2, 3); addEdge(2, 8); addEdge(2, 9); addEdge(3, 6); addEdge(4, 6); addEdge(4, 8); addEdge(5, 8); addEdge(6, 7); addEdge(7, 8); addEdge(8, 10); topologicalSort(n,m); topologicalSort(n,m); }
2cd59a4232dd87b9cfc76b97e25a4b27a8f4cb01
ec55e2cf115c26054ff315b1d406f2b45b38443e
/src/modules/communication/http_client.cpp
c05b5455f78841de7ac79c78d2ec556b2c8aa419
[]
no_license
gruut/enterprise-merger
2007be71fce847560c389272507e7bff0825d8fd
73b849ede88420b7fa4c5ac63c75d2033d602256
refs/heads/develop
2020-04-07T07:32:33.977349
2019-06-03T05:34:08
2019-06-03T05:34:08
158,180,298
6
3
null
2019-07-19T01:07:34
2018-11-19T07:34:56
C++
UTF-8
C++
false
false
2,553
cpp
http_client.cpp
#include "http_client.hpp" #include <iostream> using namespace std; namespace gruut { HttpClient::HttpClient(const string &m_address) : m_address(m_address) { el::Loggers::getLogger("HTTP"); } CURLcode HttpClient::post(const string &packed_msg) { try { m_curl.setOpt(CURLOPT_URL, m_address.data()); m_curl.setOpt(CURLOPT_POST, 1L); m_curl.setOpt(CURLOPT_TIMEOUT, 2L); const auto escaped_field_data = m_curl.escape(packed_msg); const string post_field = getPostField("message", escaped_field_data); CLOG(INFO, "HTTP") << "POST (" << m_address << ", " << post_field.size() << "bytes )"; m_curl.setOpt(CURLOPT_POSTFIELDS, post_field.data()); m_curl.setOpt(CURLOPT_POSTFIELDSIZE, post_field.size()); m_curl.perform(); } catch (curlpp::EasyException &err) { CLOG(ERROR, "HTTP") << err.what(); return err.getErrorId(); } return CURLE_OK; } CURLcode HttpClient::postAndGetReply(const string &msg, json &response_json) { try { m_curl.setOpt(CURLOPT_URL, m_address.data()); m_curl.setOpt(CURLOPT_POST, 1L); const auto escaped_filed_data = m_curl.escape(msg); const string post_field = getPostField("message", escaped_filed_data); CLOG(INFO, "HTTP") << "POST (" << m_address << ", " << post_field.size() << "bytes )"; m_curl.setOpt(CURLOPT_POSTFIELDS, post_field.data()); m_curl.setOpt(CURLOPT_POSTFIELDSIZE, post_field.size()); string http_response; m_curl.setOpt(CURLOPT_WRITEFUNCTION, writeCallback); m_curl.setOpt(CURLOPT_WRITEDATA, &http_response); m_curl.perform(); response_json = json::parse(http_response); } catch (curlpp::EasyException &err) { CLOG(ERROR, "HTTP") << err.what(); return err.getErrorId(); } catch (json::parse_error &err) { CLOG(ERROR, "HTTP") << err.what(); return CURLE_HTTP_POST_ERROR; } return CURLE_OK; } bool HttpClient::checkServStatus() { try { m_curl.setOpt(CURLOPT_URL, m_address.data()); m_curl.setOpt(CURLOPT_FAILONERROR, 1L); m_curl.perform(); } catch (curlpp::EasyException &err) { return false; } return true; } std::string HttpClient::getPostField(const string &key, const string &value) { const string post_field = key + "=" + value; return post_field; } size_t HttpClient::writeCallback(const char *in, size_t size, size_t num, string *out) { const std::size_t total_bytes(size * num); out->append(in, total_bytes); return total_bytes; } } // namespace gruut
202f1cb4721f0fe981df255581c3c817b0915965
1fe5cf3c6966363118b8bbe7042853288b81060a
/习题3-2.cpp
d324daf946785df1762923f8e399e4dfb1237764
[]
no_license
Cccceb/UvaCode
a2c415ca4c09b6ec3b5c03f92175fb06568b829d
75e538b65c60eb49a4dff0f974ce30af580029b7
refs/heads/master
2020-12-18T18:45:04.717896
2020-01-22T03:08:12
2020-01-22T03:08:12
235,487,730
0
0
null
null
null
null
GB18030
C++
false
false
1,208
cpp
习题3-2.cpp
#include<iostream> #include<cstring> #pragma warning(disable:4996) #define LOCAL #ifdef LOCAL FILE *fin = freopen("习题3-2in.txt", "r", stdin); FILE *fout = freopen("习题3-2out.txt", "w", stdout); #endif double xigema(const char a, const int b); int main() { using namespace std; int T; char s[105]; cin >> T; while (T--) { double sum = 0; cin >> s; int mu; for (int i = 0; i < strlen(s); i++) { if (isalpha(s[i])) { //cout << s[i] << endl; //cout << s[i + 1] << endl; if (isalpha(s[i + 1]) || s[i + 1] == '\0') { sum += xigema(s[i], 1); } else if (s[i + 1] <= '9'&&s[i + 1] >= '1') {//下一位为数字 int j = i; mu = 0; while ('1' <= s[i + 1] && s[i + 1] <= '9') {//一定要写等号!!!! //一定要用&&相连接!!! mu = (int(s[i + 1] - '0') + mu * 10); i++; } sum += xigema(s[j], mu); //cout <<"sum: "<< sum << endl; } } } printf("%.3f\n", sum); } } double xigema(const char a, const int n) { //cout << "n = " << n << endl; switch (a) { case 'C':return 12.01*n; case 'H':return 1.008*n; case 'O':return 16.00*n; case 'N':return 14.01*n; defult:return 0.0; } }
ddf61fb918af153d0557649b797c09a5c215dd2b
4fd8ac5f1931df93ffdbe1f568d514e0cc6ca92c
/projet_selimbenaich/afficher_joueur.h
ae7b2b0499648b35c742ed9a655d21d3c4a94a5d
[]
no_license
TheRealSumpark/QT_Project
4b0b5cf92de136be0ff933ba869094f5a81954b2
b58f722806a085d0e2662272fe9f53571f48654d
refs/heads/master
2021-05-21T14:02:17.330330
2020-04-23T14:47:28
2020-04-23T14:47:28
252,674,046
0
0
null
null
null
null
UTF-8
C++
false
false
642
h
afficher_joueur.h
#ifndef AFFICHER_JOUEUR_H #define AFFICHER_JOUEUR_H #include <QDialog> #include <QVariant> #include <QAction> #include <QApplication> #include <QButtonGroup> #include <QDialog> #include <QHeaderView> #include "statclass.h" #include <qcustomplot.h> namespace Ui { class Afficher_joueur; } class Afficher_joueur : public QDialog { Q_OBJECT public: explicit Afficher_joueur(QWidget *parent = nullptr); ~Afficher_joueur(); private slots: void on_pushButton_clicked(); void on_tableView_activated(const QModelIndex &index); private: Ui::Afficher_joueur *ui; StatClass statClass; }; #endif // AFFICHER_JOUEUR_H
658b0e18ed833f9978a557eff8089739e3c1e2a1
a73540d3fd6d41db453a1e9fba40b276722b4476
/src/Viewer/PickHandler.cpp
3acf9cc4ae816e7c80876ab29f994c59f78d01f2
[]
no_license
kapecp/3dsoftviz
2293ab9506e884f175a5f0e868049b87c568dcb9
8d425301eb361d64ad6c67dac91f24412118828f
refs/heads/master
2020-12-25T16:53:34.605091
2016-10-02T17:55:21
2016-10-02T17:55:21
970,455
4
9
null
2018-02-10T10:44:15
2010-10-07T20:23:20
C++
UTF-8
C++
false
false
40,993
cpp
PickHandler.cpp
#include "Viewer/PickHandler.h" #include "Viewer/DataHelper.h" #include "Viewer/CoreGraph.h" #include "Viewer/CameraManipulator.h" #include "Util/ElementSelector.h" #include "Manager/Manager.h" #include "Network/Client.h" #include "Network/Server.h" #include "Core/Core.h" #include "Layout/LayoutThread.h" #include "Layout/FRAlgorithm.h" #include "Layout/Shape_Cube.h" #include "Layout/FRAlgorithm.h" #include "City/Residence.h" #include "Util/ApplicationConfig.h" #include <osg/MatrixTransform> #include <osg/Projection> #include <osg/BlendFunc> #include <osg/ShapeDrawable> #include <osg/ValueObject> #include <osg/Geode> #include <osg/Switch> #include <string> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch-enum" namespace Vwr { PickHandler::PickHandler( Vwr::CameraManipulator* cameraManipulator, Vwr::CoreGraph* coreGraph ) { //vytvorenie timera a vynulovanie premennych timer = new QTimer(); connect( timer,SIGNAL( timeout() ), this, SLOT( mouseTimerTimeout() ) ); eaPush = NULL; eaRel = NULL; aaPush = NULL; aaRel = NULL; this->cameraManipulator = cameraManipulator; this->coreGraph = coreGraph; this->appConf = Util::ApplicationConfig::get(); _mX = _mY = 0; isCtrlPressed = false; isShiftPressed = false; isAltPressed = false; isXPressed = false; isYPressed = false; isZPressed = false; isDrawingSelectionQuad = false; isDragging = false; isManipulatingNodes = false; pickMode = PickMode::NONE; selectionType = SelectionType::ALL; selectionObserver = NULL; isNeighborsSelection = false; } bool PickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { switch ( ea.getEventType() ) { case osgGA::GUIEventAdapter::PUSH: { //vynulovanie premennej pre ulozenie release eventu eaRel = NULL; // ak dojde push a nie je zapnuty timer tak spusti sa timer a ulozia eventy if ( !timer->isActive() ) { Util::ApplicationConfig* appConf = Util::ApplicationConfig::get(); timer->start( appConf->getValue( "Mouse.DoubleClickTime" ).toInt() ); eaPush = &ea; aaPush = &aa; return false; } return handlePush( ea, aa ); } case osgGA::GUIEventAdapter::DOUBLECLICK: { //ak dosiel double click tak vypnut timer timer->stop(); eaRel = NULL; return handleDoubleclick( ea, aa ); } case osgGA::GUIEventAdapter::MOVE: { return handleMove( ea, aa ); } case osgGA::GUIEventAdapter::DRAG: { Network::Client* client = Network::Client::getInstance(); if ( client->isConnected() ) { client -> sendMovedNodesPosition(); } //ak je drag a ide timer tak vypnut timer a vyvolat push //zaruci sa tak spravne spracovany drag if ( timer->isActive() ) { timer->stop(); handlePush( *eaPush, *aaPush ); } //uz kvoli dalsiemu pokracovaniu dragu return handleDrag( ea, aa ); } case osgGA::GUIEventAdapter::RELEASE: { Network::Server* server = Network::Server::getInstance(); if ( server->isListening() ) { server -> sendMoveNodes(); } //ak je release a je timer aktivny tak sa ulozi event a nevyvola sa if ( timer->isActive() ) { eaRel = &ea; aaRel = &aa; return false; } return handleRelease( ea, aa ); } case osgGA::GUIEventAdapter::KEYDOWN: { return handleKeyDown( ea, aa ); } case::osgGA::GUIEventAdapter::KEYUP: { return handleKeyUp( ea, aa ); } case::osgGA::GUIEventAdapter::SCROLL: { return handleScroll( ea, aa ); } default: return false; } } void PickHandler::mouseTimerTimeout() { //ak dobehne timer tak pouzivatel len klikol //takze sa zastavi timer timer->stop(); //vyvola sa push event handlePush( *eaPush, *aaPush ); //v pripade ze bol aj release tak sa vyvola aj release if ( eaRel != NULL ) { handleRelease( *eaRel, *aaRel ); } } bool PickHandler::handleMove( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { // Record mouse location for the button press // and move events. _mX = ea.getX(); _mY = ea.getY(); return false; } bool PickHandler::handleDoubleclick( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { if ( pickedNodes.count() == 1 || pickedEdges.count() == 1 ) { AppCore::Core::getInstance()->getCoreWindow()->centerView( false ); } return false; } bool PickHandler::handleScroll( const osgGA::GUIEventAdapter& ea, GUIActionAdapter& aa ) { if ( selectionType == SelectionType::CLUSTER && !pickedClusters.empty() ) { QLinkedList<osg::ref_ptr<Data::Cluster> >::const_iterator i = pickedClusters.constBegin(); // float scale = appConf->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat(); while ( i != pickedClusters.constEnd() ) { Layout::ShapeGetter_Cube* shapeGetter = ( *i )->getShapeGetter(); if ( shapeGetter != NULL ) { if ( isCtrlPressed ) { // double size = 5; // if( ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP) { // size *= -1; // } // shapeGetter->changeSize(size); // osg::Vec3f vector = shapeGetter->getSurfaceNodeX()->getTargetPosition() - shapeGetter->getCenterNode()->getTargetPosition(); // float length = vector.normalize(); // if (length > 10) { // vector *= length / 5; // } // if( ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP) { // vector *= -1; // } // osg::Vec3f newPosition = shapeGetter->getSurfaceNodeX()->getTargetPosition() + vector / scale; // shapeGetter->getSurfaceNodeX()->setTargetPosition(newPosition); // //shapeGetter->getSurfaceNodeX()->setCntPosition(newPosition); // shapeGetter->getSurfaceNodeX()->getCurrentPosition(true);urre double moveLength = 1; if ( ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP ) { moveLength *= -1; } if ( isXPressed ) { shapeGetter->move( shapeGetter->getDistanceX() / 5.0 * moveLength,0,0 ); } else if ( isYPressed ) { shapeGetter->move( 0,shapeGetter->getDistanceY() / 5 * moveLength,0 ); } else if ( isZPressed ) { shapeGetter->move( 0,0,shapeGetter->getDistanceZ() / 5 * moveLength ); } else { double avgDist = ( shapeGetter->getDistanceX() + shapeGetter->getDistanceY() + shapeGetter->getDistanceZ() ) / 3; shapeGetter->move( avgDist / 5 * moveLength, avgDist / 5 * moveLength, avgDist / 5 * moveLength ); } } } ++i; } AppCore::Core::getInstance()->getLayoutThread()->wakeUp(); } return false; } bool PickHandler::handleKeyUp( const osgGA::GUIEventAdapter& ea, GUIActionAdapter& aa ) { if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_R || ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_L ) { isCtrlPressed = false; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_R ) { isShiftPressed = false; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_R ) { isAltPressed = false; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_X ) { isXPressed = false; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Y ) { isYPressed = false; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Z ) { isZPressed = false; } return false; } bool PickHandler::handleKeyDown( const osgGA::GUIEventAdapter& ea, GUIActionAdapter& aa ) { static unsigned int splitviewMode = 0; if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_R || ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_L ) { isCtrlPressed = true; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_R ) { isShiftPressed = true; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_R ) { isAltPressed = true; } else if ( ea.getKey() == 'q' ) { Data::Graph* currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); Util::ElementSelector::randomElementSelector( currentGraph->getNodes(), currentGraph->getEdges(), appConf->getValue( "Viewer.PickHandler.AutopickedNodes" ).toInt(), this ); } else if ( ea.getKey() == 'w' ) { Data::Graph* currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); Util::ElementSelector::weightedElementSelector( currentGraph->getNodes(), appConf->getValue( "Viewer.PickHandler.AutopickedNodes" ).toInt(), this ); } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_X ) { isXPressed = true; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Y ) { isYPressed = true; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Z ) { isZPressed = true; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_N ) { this->selectAllNeighbors( this->pickedNodes ); } // horvath else if ( ea.getKey() == 'i' || ea.getKey() == 'I' ) { coreGraph->showHud( !coreGraph->isHudDisplayed() ); } //jurik else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_O ) { if ( isCtrlPressed ) { //scale down coreGraph->scaleNodes( false ); } else { //scale up coreGraph->scaleNodes( true ); } } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_P ) { Layout::LayoutThread* layout = AppCore::Core::getInstance()->getLayoutThread(); float distance = layout->getAlg()->getMaxDistance(); if ( isCtrlPressed ) { layout->pause(); coreGraph->setNodesFreezed( true ); layout->getAlg()->setMaxDistance( distance * 0.8f ); coreGraph->scaleGraphToBase(); coreGraph->setNodesFreezed( false ); layout->play(); } else { layout->pause(); coreGraph->setNodesFreezed( true ); layout->getAlg()->setMaxDistance( distance * 1.2f ); coreGraph->scaleGraphToBase(); coreGraph->setNodesFreezed( false ); layout->play(); } } //***** // FULLSCREEN else if ( ea.getKey() == 'l' || ea.getKey() == 'L' ) { bool hideToolbars = ( appConf->getValue( "Viewer.Fullscreen" ).toInt() == 0 ? false : true ); if ( AppCore::Core::getInstance()->getCoreWindow()->isFullScreen() ) { AppCore::Core::getInstance()->getCoreWindow()->menuBar()->show(); AppCore::Core::getInstance()->getCoreWindow()->statusBar()->show(); AppCore::Core::getInstance()->getCoreWindow()->showNormal(); if ( hideToolbars ) { QList<QToolBar*> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar*>(); QListIterator<QToolBar*> i( toolbars ); while ( i.hasNext() ) { i.next()->show(); } } } else { AppCore::Core::getInstance()->getCoreWindow()->menuBar()->hide(); AppCore::Core::getInstance()->getCoreWindow()->statusBar()->hide(); AppCore::Core::getInstance()->getCoreWindow()->showFullScreen(); if ( hideToolbars ) { QList<QToolBar*> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar*>(); QListIterator<QToolBar*> i( toolbars ); while ( i.hasNext() ) { i.next()->hide(); } } } } // toolbars only else if ( ea.getKey() == 't' || ea.getKey() == 'T' ) { static bool toolbars = true; if ( toolbars ) { toolbars = !toolbars; QList<QToolBar*> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar*>(); QListIterator<QToolBar*> i( toolbars ); while ( i.hasNext() ) { i.next()->show(); } } else { toolbars = !toolbars; QList<QToolBar*> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar*>(); QListIterator<QToolBar*> i( toolbars ); while ( i.hasNext() ) { i.next()->hide(); } } } //split stereo 3D else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_G ) { if ( splitviewMode == 0 ) { osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::StereoMode::QUAD_BUFFER ); osg::DisplaySettings::instance()->setStereo( TRUE ); qDebug() << "Turned on quad buffer stereo 3D"; } else if ( splitviewMode == 1 ) { //turn on osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::StereoMode::VERTICAL_SPLIT ); osg::DisplaySettings::instance()->setScreenDistance( Util::ApplicationConfig::get()->getValue( "Display.Settings.Vuzix.Distance" ).toFloat() ); osg::DisplaySettings::instance()->setScreenHeight( Util::ApplicationConfig::get()->getValue( "Display.Settings.Vuzix.Height" ).toFloat() ); osg::DisplaySettings::instance()->setScreenWidth( Util::ApplicationConfig::get()->getValue( "Display.Settings.Vuzix.Width" ).toFloat() ); qDebug() << "Turned on split stereo 3D - vertical split"; } else if ( splitviewMode == 2 ) { osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::StereoMode::HORIZONTAL_SPLIT ); qDebug() << "Turned on split stereo 3D - horizontal split"; } else { //turn off osg::DisplaySettings::instance()->setStereo( FALSE ); //reset to default config osg::DisplaySettings::instance()->setScreenDistance( Util::ApplicationConfig::get()->getValue( "Display.Settings.Default.Distance" ).toFloat() ); osg::DisplaySettings::instance()->setScreenHeight( Util::ApplicationConfig::get()->getValue( "Display.Settings.Default.Height" ).toFloat() ); osg::DisplaySettings::instance()->setScreenWidth( Util::ApplicationConfig::get()->getValue( "Display.Settings.Default.Width" ).toFloat() ); osg::DisplaySettings::instance()->setEyeSeparation( Util::ApplicationConfig::get()->getValue( "Display.Settings.Default.EyeSeparation" ).toFloat() ); qDebug() << "Turned off split stereo 3D"; } splitviewMode = ( splitviewMode + 1 ) % 4; //rotate modes : quad / vertical / horizontal / off } //adjust eye distance, 0.001m change else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_H && ( splitviewMode != 0 ) ) { //- float distance = osg::DisplaySettings::instance()->getEyeSeparation(); distance = distance - 0.001f; osg::DisplaySettings::instance()->setEyeSeparation( distance ); qDebug() << "Eye distance : " << distance; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_J && ( splitviewMode != 0 ) ) { //+ float distance = osg::DisplaySettings::instance()->getEyeSeparation(); distance = distance + 0.001f; osg::DisplaySettings::instance()->setEyeSeparation( distance ); qDebug() << "Eye distance : " << distance; } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_O ) { if ( isCtrlPressed ) { //scale down coreGraph->scaleNodes( false ); } else { //scale up coreGraph->scaleNodes( true ); } } else if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_P ) { Layout::LayoutThread* layout = AppCore::Core::getInstance()->getLayoutThread(); float distance = layout->getAlg()->getMaxDistance(); if ( isCtrlPressed ) { layout->getAlg()->setMaxDistance( distance * 0.8f ); } else { layout->getAlg()->setMaxDistance( distance * 1.2f ); } } return false; } bool PickHandler::handleRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &aa ); if ( !viewer ) { return false; } // If the mouse hasn't moved since the last // button press or move event, perform a // pick. (Otherwise, the trackball // manipulator will handle it.) leftButtonPressed = false; rightButtonPressed = false; initialX = 0; initialY = 0; if ( pickMode == PickMode::MULTI && isDrawingSelectionQuad ) { float x, y, w, h; if ( origin_mX_normalized < ea.getXnormalized() ) { x = origin_mX_normalized; w = ea.getXnormalized(); } else { x = ea.getXnormalized(); w = origin_mX_normalized ; } if ( origin_mY_normalized < ea.getYnormalized() ) { y = origin_mY_normalized; h = ea.getYnormalized(); } else { y = ea.getYnormalized(); h = origin_mY_normalized; } pick( x, y, w, h, viewer ); if ( coreGraph->getCustomNodeList()->contains( group ) ) { coreGraph->getCustomNodeList()->removeOne( group ); } isDrawingSelectionQuad = false; return true; } if ( isManipulatingNodes ) { isManipulatingNodes = false; setSelectedNodesInterpolation( true ); } return false; } bool PickHandler::handleDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { _mX = ea.getX(); _mY = ea.getY(); if ( pickMode == PickMode::MULTI && isDrawingSelectionQuad ) { osg::ref_ptr<osg::Vec3Array> coordinates = new osg::Vec3Array; coordinates->push_back( osg::Vec3( origin_mX, origin_mY, -1 ) ); coordinates->push_back( osg::Vec3( origin_mX, _mY, -1 ) ); coordinates->push_back( osg::Vec3( _mX, _mY, -1 ) ); coordinates->push_back( osg::Vec3( _mX, origin_mY, -1 ) ); selectionQuad->getDrawable( 0 )->asGeometry()->setVertexArray( coordinates ); } else if ( selectionType == SelectionType::CLUSTER && pickMode == PickMode::NONE && leftButtonPressed ) { osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &aa ); if ( !viewer ) { return false; } return dragCluster( viewer ); } else if ( pickMode == PickMode::NONE && leftButtonPressed ) { Network::Client* client = Network::Client::getInstance(); if ( client->isConnected() ) { client -> setNodesExcludedFromUpdate( pickedNodes ); } else { Network::Server* server = Network::Server::getInstance(); server -> setSelectedNodes( pickedNodes ); } if ( !isManipulatingNodes ) { isManipulatingNodes = true; setSelectedNodesInterpolation( false ); toggleSelectedNodesFixedState( true ); } osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &aa ); if ( !viewer ) { return false; } return dragNode( viewer ); } //jurik else if ( rightButtonPressed && coreGraph->isArucoRunning() ) { coreGraph->ratata( initialX,_mX,initialY,_mY ); if ( _mX > initialX+5 || _mX < initialX-5 ) { initialX=_mX; } if ( _mY > initialY+5 || _mY < initialY-5 ) { initialY=_mY; } } //***** return false; } bool PickHandler::handlePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { if ( ea.getButtonMask() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON ) { leftButtonPressed = true; origin_mX = ea.getX(); origin_mY = ea.getY(); origin_mX_normalized = ea.getXnormalized(); origin_mY_normalized = ea.getYnormalized(); if ( pickMode != PickMode::NONE && !isShiftPressed && !isCtrlPressed ) { unselectPickedClusters(); unselectPickedNodes(); unselectPickedEdges(); if ( this->lastAutoMovementNode != NULL ) { this->lastAutoMovementNode->setSelected( false ); } } osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &aa ); if ( !viewer ) { return false; } if ( pickMode == PickMode::MULTI ) { isDrawingSelectionQuad = true; drawSelectionQuad( origin_mX, origin_mY, viewer ); } else { return pick( ea.getXnormalized() - 0.00005f, ea.getYnormalized() - 0.00005f, ea.getXnormalized() + 0.00005f, ea.getYnormalized() + 0.00005f, viewer ); } } if ( ea.getButtonMask() == osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON ) { rightButtonPressed = true; initialX = ea.getX(); initialY = ea.getY(); } _mX = ea.getX(); _mY = ea.getY(); return false; } bool PickHandler::pick( const double xMin, const double yMin, const double xMax, const double yMax, osgViewer::Viewer* viewer ) { if ( !viewer->getSceneData() ) // Nothing to pick. { return false; } osgUtil::PolytopeIntersector* picker = new osgUtil::PolytopeIntersector( osgUtil::Intersector::PROJECTION, xMin, yMin, xMax, yMax ); osgUtil::IntersectionVisitor iv( picker ); viewer->getCamera()->accept( iv ); bool result = false; coreGraph->getHud()->setText( QString() ); if ( picker->containsIntersections() ) { osgUtil::PolytopeIntersector::Intersections intersections = picker->getIntersections(); for ( osgUtil::PolytopeIntersector::Intersections::iterator hitr = intersections.begin(); hitr != intersections.end(); ++hitr ) { if ( !hitr->nodePath.empty() ) { osg::NodePath nodePath = hitr->nodePath; if ( nodePath.size() > 1 ) { if ( !isDrawingSelectionQuad ) { result = doSinglePick( nodePath ); break; } else { bool nodePicked = false; bool edgePicked = false; if ( selectionType == SelectionType::NODE || selectionType == SelectionType::ALL ) { nodePicked = doNodePick( nodePath ); } if ( !nodePicked ) { if ( selectionType == SelectionType::EDGE || selectionType == SelectionType::ALL ) { edgePicked = doEdgePick( nodePath ); } } static int count = 0; if ( !nodePicked && !edgePicked ) { osg::ShapeDrawable* shape = dynamic_cast<osg::ShapeDrawable*>( nodePath[nodePath.size() - 1] ); if ( shape != NULL ) { qDebug()<<"shape shape"<<count++; } } result = result || nodePicked || edgePicked ; } } } } } return result; } SelectionObserver* PickHandler::getSelectionObserver() const { return selectionObserver; } void PickHandler::setSelectionObserver( SelectionObserver* value ) { selectionObserver = value; } bool PickHandler::doSinglePick( osg::NodePath nodePath ) { if ( selectionType == SelectionType::NODE ) { return doNodePick( nodePath ); } else if ( selectionType == SelectionType::EDGE ) { return doEdgePick( nodePath ); } else if ( selectionType == SelectionType::CLUSTER ) { return doClusterPick( nodePath ); } else { return ( doNodePick( nodePath ) || doEdgePick( nodePath ) ); } } bool PickHandler::doNodePick( osg::NodePath nodePath ) { Data::Node* n = nullptr; for ( unsigned int i = 0; i < nodePath.size(); i++ ) { n = dynamic_cast<Data::Node*>( nodePath[i] ); if ( n != NULL ) { break; } } City::Building* b = nullptr; for ( unsigned int i = 0; i < nodePath.size(); i++ ) { b = dynamic_cast<City::Building*>( nodePath[i] ); if ( b != NULL ) { break; } } if ( b != NULL ) { b->select( true ); coreGraph->getHud()->setText( b->getInfo() ); } if ( n != NULL ) { if ( isAltPressed && pickMode == PickMode::NONE && !isShiftPressed ) { cameraManipulator->setCenter( n->targetPosition() ); } else if ( isAltPressed && pickMode == PickMode::NONE && isShiftPressed ) { if ( appConf->getValue( "Viewer.PickHandler.SelectInterestPoints" ).toInt() == 1 ) { Data::Graph* currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); Util::ElementSelector::weightedElementSelector( currentGraph->getNodes(), appConf->getValue( "Viewer.PickHandler.AutopickedNodes" ).toInt(), this ); } bool wasEmpty = false; if ( pickedNodes.isEmpty() ) { pickedNodes.append( n ); wasEmpty = true; } if ( appConf->getValue( "Viewer.Display.CameraPositions" ).toInt() == 1 ) { n->setColor( osg::Vec4( 0, 1, 0, 1 ) ); } if ( this->lastAutoMovementNode != NULL ) { this->lastAutoMovementNode->setSelected( false ); } // select new approaching node in automatic camera movement as yellow node this->lastAutoMovementNode = n; this->lastAutoMovementNode->setSelectedWith( osg::Vec4( 1, 1, 0, 1 ) ); cameraManipulator->setNewPosition( n->getCurrentPosition(), getSelectionCenter( false ), getSelectedNodes()->toStdList(), getSelectedEdges()->toStdList() ); if ( wasEmpty ) { pickedNodes.removeFirst(); } } else if ( pickMode != PickMode::NONE ) { if ( !pickedNodes.contains( n ) ) { pickedNodes.append( n ); n->setSelected( true ); if ( selectionObserver != NULL ) { selectionObserver->onChange(); } } if ( isCtrlPressed ) { unselectPickedNodes( n ); } return true; } } return false; } bool PickHandler::doEdgePick( osg::NodePath nodePath ) { Data::Edge* e = nullptr; for ( unsigned int i = 0; i < nodePath.size(); i++ ) { e = dynamic_cast<Data::Edge*>( nodePath[i] ); if ( e != NULL ) { break; } } if ( e != NULL ) { if ( isAltPressed && pickMode == PickMode::NONE && !isShiftPressed ) { osg::ref_ptr<osg::Vec3Array> coords = e->getCooridnates(); cameraManipulator->setCenter( DataHelper::getMassCenter( coords ) ); cameraManipulator->setDistance( Util::ApplicationConfig::get()->getValue( "Viewer.PickHandler.PickedEdgeDistance" ).toDouble() ); } else if ( isAltPressed && pickMode == PickMode::NONE && isShiftPressed ) { if ( appConf->getValue( "Viewer.PickHandler.SelectInterestPoints" ).toInt() == 1 ) { Data::Graph* currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); Util::ElementSelector::weightedElementSelector( currentGraph->getNodes(), appConf->getValue( "Viewer.PickHandler.AutopickedNodes" ).toInt(), this ); } bool wasEmpty = false; if ( pickedEdges.isEmpty() ) { pickedEdges.append( e ); wasEmpty = true; } osg::Vec3f edgeCenter = ( e->getSrcNode()->getCurrentPosition() + e->getDstNode()->getCurrentPosition() ) / 2; cameraManipulator->setNewPosition( edgeCenter, getSelectionCenter( false ), getSelectedNodes()->toStdList(), getSelectedEdges()->toStdList() ); if ( wasEmpty ) { pickedEdges.removeFirst(); } } else if ( pickMode != PickMode::NONE ) { if ( !pickedEdges.contains( e ) ) { pickedEdges.append( e ); e->setSelected( true ); } if ( isCtrlPressed ) { unselectPickedEdges( e ); } return true; } return true; } return false; } bool PickHandler::doClusterPick( osg::NodePath nodePath ) { std::string clusterIdStr; nodePath[nodePath.size() - 1]->getUserValue( "id", clusterIdStr ); qlonglong clusterId = QString::fromStdString( clusterIdStr ).toLongLong(); osg::ref_ptr<Data::Cluster> cluster = Clustering::Clusterer::getInstance().getClusters().value( clusterId ); if ( cluster != NULL ) { if ( pickMode == PickMode::SINGLE ) { if ( !pickedNodes.contains( cluster->getRandomNode() ) ) { cluster->setSelected( true, &pickedNodes ); pickedClusters.append( cluster ); AppCore::Core::getInstance()->getCoreWindow()->setRepulsiveForceInsideCluster( cluster->getRepulsiveForceInside() ); } if ( isCtrlPressed ) { cluster->setSelected( false, &pickedNodes ); pickedClusters.clear(); AppCore::Core::getInstance()->getCoreWindow()->hideRepulsiveForceSpinBox(); } return true; } } return false; } void PickHandler::selectAllNeighbors( QLinkedList<osg::ref_ptr<Data::Node > > nodes ) { if ( nodes.count() > 0 && !isNeighborsSelection ) { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator i = nodes.constBegin(); while ( i != nodes.constEnd() ) { QMap< qlonglong,osg::ref_ptr<Data::Edge> >::const_iterator iedge = ( *i )->getEdges()->constBegin(); while ( iedge != ( *i )->getEdges()->constEnd() ) { ( *iedge )->setEdgeColor( osg::Vec4( 1, 1, 0, 1 ) ); pickedNeighborsEdges.append( *iedge ); // select as neighbors (yellow color) only nodes which are different from our selected nodes if ( !nodes.contains( ( *iedge )->getSrcNode() ) ) { ( *iedge )->getSrcNode()->setColor( osg::Vec4( 1, 1, 0, 1 ) ); pickedNeighborsNodes.append( ( *iedge )->getSrcNode() ); } if ( !nodes.contains( ( *iedge )->getDstNode() ) ) { ( *iedge )->getDstNode()->setColor( osg::Vec4( 1, 1, 0, 1 ) ); pickedNeighborsNodes.append( ( *iedge )->getDstNode() ); } ++iedge; } ++i; } isNeighborsSelection = true; } else { if ( pickedNeighborsNodes.count() > 0 || pickedNeighborsEdges.count() > 0 ) { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator n = pickedNeighborsNodes.constBegin(); while ( n != pickedNeighborsNodes.constEnd() ) { ( *n )->setDefaultColor(); ++n; } pickedNeighborsNodes.clear(); QLinkedList<osg::ref_ptr<Data::Edge> >::const_iterator e = pickedNeighborsEdges.constBegin(); while ( e != pickedNeighborsEdges.constEnd() ) { ( *e )->setEdgeDefaultColor(); ++e; } pickedNeighborsEdges.clear(); } isNeighborsSelection = false; } } bool PickHandler::dragNode( osgViewer::Viewer* viewer ) { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator i = pickedNodes.constBegin(); osg::Matrixd& viewM = viewer->getCamera()->getViewMatrix(); osg::Matrixd& projM = viewer->getCamera()->getProjectionMatrix(); osg::Matrixd screenM = viewer->getCamera()->getViewport()->computeWindowMatrix(); osg::Matrixd compositeM = viewM*projM*screenM; osg::Matrixd compositeMi = compositeMi.inverse( compositeM ); float scale = appConf->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat(); while ( i != pickedNodes.constEnd() ) { osg::Vec3f screenPoint = ( *i )->targetPositionConstRef() * compositeM; osg::Vec3f newPosition = osg::Vec3f( screenPoint.x() - ( origin_mX - _mX ) / scale, screenPoint.y() - ( origin_mY - _mY ) / scale, screenPoint.z() ); ( *i )->setTargetPosition( newPosition * compositeMi ); ++i; } origin_mX = _mX; origin_mY = _mY; AppCore::Core::getInstance()->getLayoutThread()->wakeUp(); return ( pickedNodes.size() > 0 ); } bool PickHandler::dragCluster( osgViewer::Viewer* viewer ) { QLinkedList<osg::ref_ptr<Data::Cluster> >::const_iterator i = pickedClusters.constBegin(); QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator n = pickedNodes.constBegin(); osg::Matrixd& viewM = viewer->getCamera()->getViewMatrix(); osg::Matrixd& projM = viewer->getCamera()->getProjectionMatrix(); osg::Matrixd screenM = viewer->getCamera()->getViewport()->computeWindowMatrix(); osg::Matrixd compositeM = viewM*projM*screenM; osg::Matrixd compositeMi = compositeMi.inverse( compositeM ); float scale = appConf->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat(); while ( i != pickedClusters.constEnd() ) { Layout::ShapeGetter_Cube* shape = ( *i )->getShapeGetter(); if ( shape != NULL ) { osg::Vec3d screenPoint = shape->getCenterNode()->getTargetPosition() * compositeM; osg::Vec3d newPosition = osg::Vec3d( screenPoint.x() - ( origin_mX - _mX ) / scale, screenPoint.y() - ( origin_mY - _mY ) / scale, screenPoint.z() ); shape->getCenterNode()->setTargetPosition( newPosition * compositeMi ); //shape->getCenterNode()->setCurrentPosition(newPosition * compositeMi); shape->getCenterNode()->getCurrentPosition( true ); screenPoint = shape->getSurfaceNodeX()->getTargetPosition() * compositeM; newPosition = osg::Vec3d( screenPoint.x() - ( origin_mX - _mX ) / scale, screenPoint.y() - ( origin_mY - _mY ) / scale, screenPoint.z() ); shape->getSurfaceNodeX()->setTargetPosition( newPosition * compositeMi ); shape->getSurfaceNodeX()->getCurrentPosition( true ); screenPoint = shape->getSurfaceNodeY()->getTargetPosition() * compositeM; newPosition = osg::Vec3d( screenPoint.x() - ( origin_mX - _mX ) / scale, screenPoint.y() - ( origin_mY - _mY ) / scale, screenPoint.z() ); shape->getSurfaceNodeY()->setTargetPosition( newPosition * compositeMi ); shape->getSurfaceNodeY()->getCurrentPosition( true ); screenPoint = shape->getSurfaceNodeZ()->getTargetPosition() * compositeM; newPosition = osg::Vec3d( screenPoint.x() - ( origin_mX - _mX ) / scale, screenPoint.y() - ( origin_mY - _mY ) / scale, screenPoint.z() ); shape->getSurfaceNodeZ()->setTargetPosition( newPosition * compositeMi ); shape->getSurfaceNodeZ()->getCurrentPosition( true ); } ++i; } // while (n != pickedNodes.constEnd()) // { // osg::Vec3f screenPoint = (*n)->targetPositionConstRef() * compositeM; // osg::Vec3f newPosition = osg::Vec3f(screenPoint.x() - (origin_mX - _mX) / scale, screenPoint.y() - (origin_mY - _mY) / scale, screenPoint.z()); // (*n)->setTargetPosition(newPosition * compositeMi); // (*n)->getCurrentPosition(true); // ++n; // } origin_mX = _mX; origin_mY = _mY; AppCore::Core::getInstance()->getLayoutThread()->wakeUp(); return ( pickedClusters.size() > 0 ); } void PickHandler::drawSelectionQuad( float origin_mX, float origin_mY, osgViewer::Viewer* viewer ) { osg::ref_ptr<osg::StateSet> quadStateSet = new osg::StateSet; quadStateSet->setMode( GL_BLEND,osg::StateAttribute::ON ); quadStateSet->setMode( GL_DEPTH_TEST,osg::StateAttribute::OFF ); quadStateSet->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); quadStateSet->setAttributeAndModes( new osg::BlendFunc, osg::StateAttribute::ON ); quadStateSet->setRenderingHint( osg::StateSet::TRANSPARENT_BIN ); quadStateSet->setRenderBinDetails( 11, "RenderBin" ); osg::ref_ptr<osg::Vec3Array> coordinates = new osg::Vec3Array; osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array; osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry; coordinates->push_back( osg::Vec3( origin_mX, origin_mY, -1 ) ); coordinates->push_back( osg::Vec3( origin_mX, origin_mY, -1 ) ); coordinates->push_back( osg::Vec3( origin_mX, origin_mY, -1 ) ); coordinates->push_back( osg::Vec3( origin_mX, origin_mY, -1 ) ); colors->push_back( osg::Vec4( 0.2f, 0.2f, 1.0f, 0.3f ) ); // color of selection restangle geometry->setVertexArray( coordinates ); geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS,0,4 ) ); geometry->setColorArray( colors ); geometry->setStateSet( quadStateSet ); #ifdef BIND_PER_PRIMITIVE geometry->setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE ); #else geometry->setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE_SET ); #endif selectionQuad = new osg::Geode; selectionQuad->addDrawable( geometry ); osgViewer::ViewerBase::Windows win; viewer->getWindows( win ); int x, y, w, h; win.at( 0 )->getWindowRectangle( x, y, w, h ); osg::ref_ptr<osg::Projection> projectionMatrix = new osg::Projection; projectionMatrix->setMatrix( osg::Matrix::ortho2D( x, w, y, h ) ); osg::ref_ptr<osg::MatrixTransform> modelViewMatrix = new osg::MatrixTransform; modelViewMatrix->setMatrix( osg::Matrix::identity() ); modelViewMatrix->setReferenceFrame( osg::Transform::ABSOLUTE_RF ); group = new osg::Group; group->addChild( projectionMatrix ); projectionMatrix->addChild( modelViewMatrix ); modelViewMatrix->addChild( selectionQuad ); coreGraph->getCustomNodeList()->push_back( group ); } void PickHandler::toggleSelectedNodesFixedState( bool isFixed ) { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator i = pickedNodes.constBegin(); Network::Client* client = Network::Client::getInstance(); Network::Server* server = Network::Server::getInstance(); while ( i != pickedNodes.constEnd() ) { if ( client->isConnected() ) { client->sendFixNodeState( ( *i )->getId(), isFixed ); } else { ( *i )->setFixed( isFixed ); // fixed nodes cannot by draged, layouter don compute new position for them server->sendFixNodeState( ( *i )->getId(), isFixed ); } ++i; } } void PickHandler::unselectPickedClusters() { QLinkedList<osg::ref_ptr<Data::Cluster> >::const_iterator i = pickedClusters.constBegin(); while ( i != pickedClusters.constEnd() ) { ( *i )->setSelected( false, &pickedNodes ); ++i; } AppCore::Core::getInstance()->getCoreWindow()->hideRepulsiveForceSpinBox(); pickedClusters.clear(); } void PickHandler::unselectPickedNodes( osg::ref_ptr<Data::Node> node ) { if ( node == NULL ) { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator i = pickedNodes.constBegin(); while ( i != pickedNodes.constEnd() ) { ( *i )->setSelected( false ); auto r = ( *i )->getResidence(); if ( r ) { r->selectAll( false ); } auto b = ( *i )->getBuilding(); if ( b ) { b->select( false ); } ++i; } bool wasEmpty = pickedNodes.empty(); pickedNodes.clear(); if ( !wasEmpty && selectionObserver != NULL ) { selectionObserver->onChange(); } } else { node->setSelected( false ); pickedNodes.removeOne( node ); } } void PickHandler::unselectPickedEdges( osg::ref_ptr<Data::Edge> edge ) { if ( edge == NULL ) { QLinkedList<osg::ref_ptr<Data::Edge> >::const_iterator i = pickedEdges.constBegin(); while ( i != pickedEdges.constEnd() ) { ( *i )->setSelected( false ); ++i; } pickedEdges.clear(); } else { edge->setSelected( false ); pickedEdges.removeOne( edge ); } } osg::Vec3 PickHandler::getSelectionCenter( bool nodesOnly ) { osg::ref_ptr<osg::Vec3Array> coordinates = new osg::Vec3Array; float scale = appConf->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat(); if ( !nodesOnly ) { QLinkedList<osg::ref_ptr<Data::Edge> >::const_iterator ei = pickedEdges.constBegin(); while ( ei != pickedEdges.constEnd() ) { coordinates->push_back( DataHelper::getMassCenter( ( *ei )->getCooridnates() ) ); ++ei; } } QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator ni = pickedNodes.constBegin(); while ( ni != pickedNodes.constEnd() ) { // MERGE BEGIN // sivak coordinates->push_back( ( *ni )->targetPositionConstRef() ); // plesko-zeler //coordinates->push_back((*ni)->getCurrentPosition()); // povodne //coordinates->push_back((*ni)->getTargetPosition()); // MERGE END ++ni; } osg::Vec3 center; if ( coordinates->size() > 0 ) { center = Vwr::DataHelper::getMassCenter( coordinates ); } return center * scale; } osg::Vec3 PickHandler::getSelectionCenterNnE() { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator i = pickedNodes.constBegin(); QLinkedList<osg::ref_ptr<Data::Edge> >::const_iterator j = pickedEdges.constBegin(); float x = 0; float y = 0; float z = 0; int pickedNodesCount = pickedNodes.count(); int pickedEdgesCount = pickedEdges.count(); //only nodes selection - computes and returns center of nodes selection if ( pickedNodesCount > 0 && pickedEdgesCount == 0 ) { while ( i != pickedNodes.constEnd() ) { x += ( *i )->getCurrentPosition().x(); y += ( *i )->getCurrentPosition().y(); z += ( *i )->getCurrentPosition().z(); ++i; } return osg::Vec3( x/static_cast<float>( pickedNodesCount ),y/static_cast<float>( pickedNodesCount ),z/static_cast<float>( pickedNodesCount ) ); } //only edges selection - computes and returns center of edges selection else if ( pickedNodesCount == 0 && pickedEdgesCount > 0 ) { while ( j != pickedEdges.constEnd() ) { x += ( ( *j )->getSrcNode()->getCurrentPosition().x() + ( *j )->getDstNode()->getCurrentPosition().x() )/2; y += ( ( *j )->getSrcNode()->getCurrentPosition().y() + ( *j )->getDstNode()->getCurrentPosition().y() )/2; z += ( ( *j )->getSrcNode()->getCurrentPosition().z() + ( *j )->getDstNode()->getCurrentPosition().z() )/2; ++j; } return osg::Vec3( x/static_cast<float>( pickedNodesCount ),y/static_cast<float>( pickedNodesCount ),z/static_cast<float>( pickedNodesCount ) ); } //nodes and edges selection - computes and returns center of this selection else if ( pickedNodesCount > 0 && pickedEdgesCount > 0 ) { while ( j != pickedEdges.constEnd() ) { x += ( ( *j )->getSrcNode()->getCurrentPosition().x() + ( *j )->getDstNode()->getCurrentPosition().x() )/2; y += ( ( *j )->getSrcNode()->getCurrentPosition().y() + ( *j )->getDstNode()->getCurrentPosition().y() )/2; z += ( ( *j )->getSrcNode()->getCurrentPosition().z() + ( *j )->getDstNode()->getCurrentPosition().z() )/2; ++j; } while ( i != pickedNodes.constEnd() ) { x += ( *i )->getCurrentPosition().x(); y += ( *i )->getCurrentPosition().y(); z += ( *i )->getCurrentPosition().z(); ++i; } return osg::Vec3( x/static_cast<float>( pickedEdgesCount+pickedNodesCount ),y/static_cast<float>( pickedEdgesCount+pickedNodesCount ),z/static_cast<float>( pickedEdgesCount+pickedNodesCount ) ); } //if are all nodes and edges unselected, returns center of graph else { float scale = appConf->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat(); osg::Vec3 center; return center * scale; } } void PickHandler::setSelectedNodesInterpolation( bool state ) { QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator i = pickedNodes.constBegin(); while ( i != pickedNodes.constEnd() ) { ( *i )->setUsingInterpolation( state ); ++i; } } osg::ref_ptr<Data::Node> PickHandler::getPickedNodeWithMaxEdgeCount() { int maxEdges=0; osg::ref_ptr<Data::Node> rootNode; QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator itNode; for ( itNode = pickedNodes.constBegin(); itNode != pickedNodes.constEnd(); ++itNode ) { int actEdges = ( *itNode )->getEdges()->size(); if ( actEdges>maxEdges ) { rootNode=( *itNode ); maxEdges=actEdges; } } return rootNode; } //volovar zac osg::ref_ptr<Data::Node> PickHandler::getPickedNodeWithMinEdgeCount() { int minEdges=1000; int first = 1; osg::ref_ptr<Data::Node> rootNode = NULL; QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator itNode; for ( itNode = pickedNodes.constBegin(); itNode != pickedNodes.constEnd(); ++itNode ) { int actEdges = ( *itNode )->getEdges()->size(); if ( actEdges < minEdges || first ) { rootNode=( *itNode ); minEdges=actEdges; } first = 0; } return rootNode; } //volovar kon } // namespace Vwr #pragma GCC diagnostic pop
891c622197baf4ca8ee18184588e1f74d560609a
e2631c740dff4cce35b1e0f6dfbeb24aad5b3371
/src/ofEye.hpp
987985a6a4a189b4a812ad07190f7e1857429a3e
[]
no_license
zalavariandris/Greyout
66d9b50c0857f861489050354a35afd7394a8899
9f4802f2072864b6b973b88057f4e8173816ee2e
refs/heads/master
2020-03-14T21:58:22.442222
2018-05-05T15:29:46
2018-05-05T15:29:46
131,810,082
0
0
null
null
null
null
UTF-8
C++
false
false
1,247
hpp
ofEye.hpp
// // Camera.hpp // Greyout // // Created by András Zalavári on 2018. 04. 30.. // #pragma once #include "ofMain.h" #include "ps3eye.h" class ofEye{ public: void setup(); void update(); shared_ptr<ofImage> buffer; // properties bool getAutogain() const; void setAutogain(bool val); bool getAutoWhiteBalance() const; void setAutoWhiteBalance(bool val); uint8_t getGain() const; void setGain(uint8_t val); uint8_t getExposure() const; void setExposure(uint8_t val); uint8_t getSharpness() const; void setSharpness(uint8_t val); uint8_t getContrast() const; void setContrast(uint8_t val); uint8_t getBrightness() const; void setBrightness(uint8_t val); uint8_t getHue() const; void setHue(uint8_t val); uint8_t getRedBalance() const; void setRedBalance(uint8_t val); uint8_t getGreenBalance() const; void setGreenBalance(uint8_t val); uint8_t getBlueBalance() const; void setBlueBalance(uint8_t val); bool getFlipH() const; bool getFlipV() const; void setFlip(bool horizontal=false, bool vertical = false); private: shared_ptr<ofImage> camera_image = make_shared<ofImage>(); ps3eye::PS3EYECam::PS3EYERef device; };
911c67737a404d8f3928bebdeeca464429364661
793c8848753f530aab28076a4077deac815af5ac
/src/dskphone/logic/talk/vqrtcp/src/modvqrtcp.cpp
56fd1207be5b4df430fc168f9382c81b2e8cfaf7
[]
no_license
Parantido/sipphone
4c1b9b18a7a6e478514fe0aadb79335e734bc016
f402efb088bb42900867608cc9ccf15d9b946d7d
refs/heads/master
2021-09-10T20:12:36.553640
2018-03-30T12:44:13
2018-03-30T12:44:13
263,628,242
1
0
null
2020-05-13T12:49:19
2020-05-13T12:49:18
null
UTF-8
C++
false
false
2,532
cpp
modvqrtcp.cpp
#include "vqrtcp_inc.h" #ifdef IF_FEATURE_RTCPXR static LRESULT OnMSGReceive(msgObject& msg) { switch (msg.message) { case TM_TIMER: { return _VQReportManager.OnTimer(msg.wParam); } case IPVP_MSG_AUDIO_VQREPORT: { return _VQReportManager.ProcessVQReportMsg(msg); } case VOICE_VPM_START: { int nRet = ipvp_request_notify(mkGetHandle(), IPVP_MSG_AUDIO_VQREPORT); TALK_INFO("RTCP-XR ipvp_request_notify = %d", nRet); } break; case DSK_MSG_GET_RTP_STATS: { // web 显示rtp stats _VQReportManager.SaveSessionReportDataToWeb(); // web 使用128的数组存储 msg.ReplyMessageEx(1, sizeof(szSessionReportFile) + 1, (void*)szSessionReportFile); } break; case SIP_CALL_REPLACED_BY_REMOTE: { if (msg.GetExtraData() != NULL) { int iSessionID = talklogic_GetSessionIdByCallID(msg.lParam, false); _VQReportManager.OnFocusSessionChange(iSessionID); } } break; default: return FALSE; } return TRUE; } void vqrtcp_Init() { _VQReportManager.Init(); SingleMsgReg(VOICE_VPM_START, OnMSGReceive); SingleMsgReg(IPVP_MSG_AUDIO_VQREPORT, OnMSGReceive); SingleMsgReg(TM_TIMER, OnMSGReceive); SingleMsgReg(DSK_MSG_GET_RTP_STATS, OnMSGReceive); SingleMsgReg(SIP_CALL_REPLACED_BY_REMOTE, OnMSGReceive); } void vqrtcp_UnInit() { } // 获取最后一次通话的语音质量数据 void vqrtcp_RTPStatusGetSessionReport(SVQReportData& sData) { _VQReportManager.GetSessionReportData(sData); } // 获取通话中的语音质量数据 bool vqrtcp_RTPStatusGetCurrentReport(SVQReportData& sData) { int nCallId = _VQReportManager.GetActioveCallId(); _VQReportManager.GetCurrentReportData(nCallId, sData); return true; } bool vqrtcp_IsRTPStatusSwitch() { return _VQReportManager.IsRTPStatusSwitch(); } bool vqrtcp_RTPStatusSwitch() { return _VQReportManager.SwitchRTPStatus(); } #else void vqrtcp_Init() { } void vqrtcp_UnInit() { } // 获取最后一次通话的语音质量数据 void vqrtcp_RTPStatusGetSessionReport(SVQReportData& sData) { } // 获取通话中的语音质量数据 bool vqrtcp_RTPStatusGetCurrentReport(SVQReportData& sData) { return false; } bool vqrtcp_IsRTPStatusSwitch() { return false; } bool vqrtcp_RTPStatusSwitch() { return false; } #endif
e366a0a818848b86a8ff9cb74219817325dadb35
9176fbc27068cf206b2d774fa20929bc0c46c6e9
/Source/Penguin.h
bb195a7de72f025d2dd3a056398aacd74922d0ae
[]
no_license
IsaacMulcahy/PenguinPanic
c42b92a22501105be1e6f8736747e2eaf526b4f1
7b9f48011cba1b50d8d3fd15c6e2e5051292312e
refs/heads/master
2020-03-14T13:27:13.341270
2018-04-25T22:20:11
2018-04-25T22:20:11
131,633,333
0
0
null
null
null
null
UTF-8
C++
false
false
319
h
Penguin.h
#pragma once #include "GameObject.h" class Penguin : public GameObject { public: Penguin() { penguin = std::make_unique<GameObject>(); }; ~Penguin() = default; void setFired(bool value) { fired = value; }; bool getFired() { return fired; }; private: std::unique_ptr<GameObject> penguin; bool fired = false; };
c4a8ed306fbc9459315d92536c16db3226ca864d
0f35faad9616119366fd97c91ca0a1e5ecfdb3e4
/cpp/jsonpack/json_pack_types.h
22bb6d38dfb70c314727a57f495296647a9c52a2
[]
no_license
nonstop/sandbox
374d8dca8809aee1da74f48fc427eb0adf1649bc
43008f6123dfd88c35f9ff42abcd99d21f5119ce
refs/heads/master
2022-05-27T22:40:55.322107
2022-05-01T04:16:33
2022-05-01T04:16:33
123,214
2
0
null
null
null
null
UTF-8
C++
false
false
244
h
json_pack_types.h
#ifndef SERVERLIB_JSON_PACK_TYPES_H #define SERVERLIB_JSON_PACK_TYPES_H #include "json_packer.h" namespace json_spirit { JSON_PACK_UNPACK_DECL(int); JSON_PACK_UNPACK_DECL(unsigned); } // json_spirit #endif /* SERVERLIB_JSON_PACK_TYPES_H */
e6b04c85c205bf3458fdb2c4c0ba5c37f031e375
1ff23a8ab92db305e1f9ee92c92a4c853ab1f05e
/GameTest/Object/Controllable.h
243b0e97bd854e647453020e8b7be60f95ca1804
[]
no_license
kevin791129/Capman
5766c056998379b2247b85283837d1bb656490dc
e4aca706ceb2400ba86ac2ef28ea4dc9af1df516
refs/heads/master
2020-05-09T20:33:17.565709
2019-04-15T04:27:22
2019-04-15T04:27:22
181,411,721
0
0
null
null
null
null
UTF-8
C++
false
false
115
h
Controllable.h
#pragma once class Controllable { public: bool _AIControl; public: void SetControl(bool manualInput); };
3bbace5d7980fb6ac336c0be1dba0873eac20e28
73ace3445303a0f3ee26f798204105ebac407a8f
/src/mlpack/core/optimizers/lrsdp/lrsdp_function.hpp
7eeaf146a236bedcd75f2a88af47c21229dec51e
[ "BSD-3-Clause" ]
permissive
jaskaran1/mlpack
9214f7689994223b3b86a9cdbfc1854f127fe523
53ceb3163539354a19a2de209b4067a514f4b4ba
refs/heads/master
2020-11-30T12:31:25.587276
2015-02-03T09:16:02
2015-02-03T09:16:02
30,118,377
0
0
null
2015-01-31T16:41:47
2015-01-31T16:41:47
null
UTF-8
C++
false
false
5,042
hpp
lrsdp_function.hpp
/** * @file lrsdp_function.hpp * @author Ryan Curtin * @author Abhishek Laddha * * A class that represents the objective function which LRSDP optimizes. */ #ifndef __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP #define __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP #include <mlpack/core.hpp> #include <mlpack/core/optimizers/aug_lagrangian/aug_lagrangian.hpp> namespace mlpack { namespace optimization { /** * The objective function that LRSDP is trying to optimize. */ class LRSDPFunction { public: /** * Construct the LRSDPFunction with the given initial point and number of * constraints. Note n_cols of the initialPoint specifies the rank. * * Set the A_x, B_x, and C_x matrices for each constraint using the A_x(), * B_x(), and C_x() functions, for x in {sparse, dense}. */ LRSDPFunction(const size_t numSparseConstraints, const size_t numDenseConstraints, const arma::mat& initialPoint); /** * Evaluate the objective function of the LRSDP (no constraints) at the given * coordinates. */ double Evaluate(const arma::mat& coordinates) const; /** * Evaluate the gradient of the LRSDP (no constraints) at the given * coordinates. */ void Gradient(const arma::mat& coordinates, arma::mat& gradient) const; /** * Evaluate a particular constraint of the LRSDP at the given coordinates. */ double EvaluateConstraint(const size_t index, const arma::mat& coordinates) const; /** * Evaluate the gradient of a particular constraint of the LRSDP at the given * coordinates. */ void GradientConstraint(const size_t index, const arma::mat& coordinates, arma::mat& gradient) const; //! Get the number of sparse constraints in the LRSDP. size_t NumSparseConstraints() const { return sparseB.n_elem; } //! Get the number of dense constraints in the LRSDP. size_t NumDenseConstraints() const { return denseB.n_elem; } //! Get the total number of constraints in the LRSDP. size_t NumConstraints() const { return NumSparseConstraints() + NumDenseConstraints(); } //! Get the initial point of the LRSDP. const arma::mat& GetInitialPoint() const { return initialPoint; } size_t n() const { return initialPoint.n_rows; } //! Return the sparse objective function matrix (sparseC). const arma::sp_mat& SparseC() const { return sparseC; } //! Modify the sparse objective function matrix (sparseC). arma::sp_mat& SparseC() { hasModifiedSparseObjective = true; return sparseC; } //! Return the dense objective function matrix (denseC). const arma::mat& DenseC() const { return denseC; } //! Modify the dense objective function matrix (denseC). arma::mat& DenseC() { hasModifiedDenseObjective = true; return denseC; } //! Return the vector of sparse A matrices (which correspond to the sparse // constraints). const std::vector<arma::sp_mat>& SparseA() const { return sparseA; } //! Modify the veector of sparse A matrices (which correspond to the sparse // constraints). std::vector<arma::sp_mat>& SparseA() { return sparseA; } //! Return the vector of dense A matrices (which correspond to the dense // constraints). const std::vector<arma::mat>& DenseA() const { return denseA; } //! Modify the veector of dense A matrices (which correspond to the dense // constraints). std::vector<arma::mat>& DenseA() { return denseA; } //! Return the vector of sparse B values. const arma::vec& SparseB() const { return sparseB; } //! Modify the vector of sparse B values. arma::vec& SparseB() { return sparseB; } //! Return the vector of dense B values. const arma::vec& DenseB() const { return denseB; } //! Modify the vector of dense B values. arma::vec& DenseB() { return denseB; } bool hasSparseObjective() const { return hasModifiedSparseObjective; } bool hasDenseObjective() const { return hasModifiedDenseObjective; } //! Return string representation of object. std::string ToString() const; private: //! Sparse objective function matrix c. arma::sp_mat sparseC; //! Dense objective function matrix c. arma::mat denseC; //! If false, sparseC is zero bool hasModifiedSparseObjective; //! If false, denseC is zero bool hasModifiedDenseObjective; //! A_i for each sparse constraint. std::vector<arma::sp_mat> sparseA; //! b_i for each sparse constraint. arma::vec sparseB; //! A_i for each dense constraint. std::vector<arma::mat> denseA; //! b_i for each dense constraint. arma::vec denseB; //! Initial point. arma::mat initialPoint; }; // Declare specializations in lrsdp_function.cpp. template<> double AugLagrangianFunction<LRSDPFunction>::Evaluate( const arma::mat& coordinates) const; template<> void AugLagrangianFunction<LRSDPFunction>::Gradient( const arma::mat& coordinates, arma::mat& gradient) const; }; }; #endif // __MLPACK_CORE_OPTIMIZERS_LRSDP_LRSDP_FUNCTION_HPP
0ff74fa37ae19c7cc83593a21b9c15bebbdb1963
7ca93ff5c2cf84c003a7afe2d5f40711499f992a
/CSV_SEXPEN.cc
b03ec49dd34eb2a68edc1e6ae3fae6976cfbfe6e
[ "MIT" ]
permissive
ycwu1030/CS_GGM
32ed567be8d954cd40f8ceb2dca54848464e8eed
702dabafc5c15f7e395c0af4df9ca6aed93496a6
refs/heads/master
2023-07-31T12:54:38.493550
2021-09-20T02:50:52
2021-09-20T02:50:52
408,291,020
0
0
null
null
null
null
UTF-8
C++
false
false
6,893
cc
CSV_SEXPEN.cc
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> #include "SM_GAC_SEXPEN.h" #include "multinest.h" /******************************************** loglikelihood routine * ****************************************************/ // Now an example, sample an egg box likelihood // Input arguments // ndim = dimensionality (total // number of free parameters) of the problem // npars = total number of free // plus derived parameters // context void pointer, any // additional information // // Input/Output arguments // Cube[npars] = on entry has the ndim // parameters in unit-hypercube // on exit, the physical // parameters plus copy any derived parameters you want to store with the free // parameters // // Output arguments // lnew = loglikelihood // CSVMODEL mymodel(1, 1); void LogLike(double *Cube, int &ndim, int &npars, double &lnew, void *context) { CSVMODEL *mod = (CSVMODEL *)context; double chi = 1.0; lnew = mod->GetLikelihood(Cube); if (lnew > -pow(10, 90)) { mod->Set_PARAMETERS(Cube); } // lnew = -pow((Cube[ndim]-10.0)/0.1,4); } /***********************************************************************************************************************/ /************************************************* dumper routine * ******************************************************/ // The dumper routine will be called every updInt*10 iterations // MultiNest doesn not need to the user to do anything. User can use the // arguments in whichever way he/she wants // // // Arguments: // // nSamples = total number of // samples in posterior distribution nlive = total number of live points nPar = // total number of parameters (free // + derived) // physLive[1][nlive * (nPar + 1)] = 2D array containing // the last set of live points (physical parameters plus derived parameters) // along with their loglikelihood values posterior[1][nSamples * (nPar + 2)] = // posterior distribution containing nSamples points. Each sample has nPar // parameters (physical + derived) along with the their loglike value & // posterior probability paramConstr[1][4*nPar]: paramConstr[0][0] to // paramConstr[0][nPar - 1] = mean values of the parameters // paramConstr[0][nPar] to paramConstr[0][2*nPar - 1] = standard deviation of // the parameters paramConstr[0][nPar*2] to paramConstr[0][3*nPar - 1] = // best-fit (maxlike) parameters paramConstr[0][nPar*4] to paramConstr[0][4*nPar // - 1] = MAP (maximum-a-posteriori) parameters maxLogLike // = maximum loglikelihood value logZ // = log evidence value from the default (non-INS) mode INSlogZ // = log evidence value from the INS mode logZerr // = error on log evidence value context // void pointer, any additional information void dumper(int &nSamples, int &nlive, int &nPar, double **physLive, double **posterior, double **paramConstr, double &maxLogLike, double &logZ, double &INSlogZ, double &logZerr, void *context) { // convert the 2D Fortran arrays to C++ arrays // the posterior distribution // postdist will have nPar parameters in the first nPar columns & loglike // value & the posterior probability in the last two columns int i, j; double postdist[nSamples][nPar + 2]; for (i = 0; i < nPar + 2; i++) for (j = 0; j < nSamples; j++) postdist[j][i] = posterior[0][i * nSamples + j]; // last set of live points // pLivePts will have nPar parameters in the first nPar columns & loglike // value in the last column double pLivePts[nlive][nPar + 1]; for (i = 0; i < nPar + 1; i++) for (j = 0; j < nlive; j++) pLivePts[j][i] = physLive[0][i * nlive + j]; } /***********************************************************************************************************************/ /************************************************** Main program * *******************************************************/ int main(int argc, char *argv[]) { int N5 = atoi(argv[1]); int N6 = atoi(argv[2]); bool GEN = atoi(argv[3]); CSVMODEL mymodel(N5, N6, GEN); // set the MultiNest sampling parameters int IS = 1; // do Nested Importance Sampling? int mmodal = 0; // do mode separation? int ceff = 0; // run in constant efficiency mode? int nlive = 2000; // number of live points double efr = 0.8; // set the required efficiency double tol = 0.5; // tol, defines the stopping criteria int ndims = mymodel.Get_NRandoms(); // dimensionality (no. of free parameters) int nPar = mymodel.Get_NPARAMETERS() + mymodel.Get_NRandoms(); // total no. of parameters including free // & derived parameters int nClsPar = 2; // no. of parameters to do mode separation on int updInt = 1000; // after how many iterations feedback is required & the output // files should be updated note: posterior files are updated & // dumper routine is called after every updInt*10 iterations double Ztol = -1E90; // all the modes with logZ < Ztol are ignored int maxModes = 100; // expected max no. of modes (used only for memory allocation) int pWrap[ndims]; // which parameters to have periodic boundary conditions? for (int i = 0; i < ndims; i++) pWrap[i] = 0; char root[100]; // = "chains/NMCHMLR12-"; // root for // output files sprintf(root, "%s", argv[4]); printf("The Prefix of the analysis is: %s\n", root); int seed = -1; // random no. generator seed, if < 0 then take the seed from // system clock int fb = 1; // need feedback on standard output? int resume = 0; // resume from a previous job? int outfile = 1; // write output files? int initMPI = 1; // initialize MPI routines?, relevant only if compiling with // MPI set it to F if you want your main program to handle // MPI initialization double logZero = -1E90; // points with loglike < logZero will be ignored by MultiNest int maxiter = 0; // max no. of iterations, a non-positive value means // infinity. MultiNest will terminate if either it has done // max no. of iterations or convergence criterion (defined // through tol) has been satisfied void *context = (void *)&mymodel; // not required by MultiNest, any additional // information user wants to pass // calling MultiNest nested::run(IS, mmodal, ceff, nlive, tol, efr, ndims, nPar, nClsPar, maxModes, updInt, Ztol, root, seed, pWrap, fb, resume, outfile, initMPI, logZero, maxiter, LogLike, dumper, context); mymodel.Print_PARAMETERS(); } /***********************************************************************************************************************/
127d30a372514f871a07a8ed5df0addcd5062cb4
14c1096c42544a694d33dcb3a0120f50434a1e4e
/lib/src/histogram.cpp
bacd3a9e775f562f8228018b19bb0929fdf65976
[ "Apache-2.0" ]
permissive
shazam/prometheus-cpp
36e3d7c39a310bacb22b93d3a250fc486c6d8390
8add28a57262bd39fae9bac72b43991cdd799b42
refs/heads/master
2021-01-22T05:47:30.565220
2017-11-30T00:09:53
2017-11-30T00:09:53
103,313,423
3
7
null
null
null
null
UTF-8
C++
false
false
1,646
cpp
histogram.cpp
#include <prometheus/histogram.h> #include <prometheus/check.h> #include <functional> using namespace std; namespace { vector<double> &addPosInf(vector<double> &bounds) { bounds.emplace_back(numeric_limits<double>::infinity()); return bounds; } template<typename Func> prometheus::histogram::bounds make_bounds(Func func, double start, const double stride, const size_t count) { prometheus::histogram::bounds bounds(count); for (size_t i = 0; i < count; ++i) { bounds[i] = start; start = func(start, stride); } return bounds; } } // namespace namespace prometheus { histogram::histogram(histogram::bounds bounds) : boundaries(move(addPosInf(bounds))), counts(boundaries.size()) { PROMETHEUS_CHECK(is_sorted(begin(boundaries), end(boundaries))); } void histogram::observe(const double value) { sum += value; ++count; auto bucket_index = static_cast<size_t>(distance( boundaries.begin(), lower_bound(begin(boundaries), end(boundaries), value) )); ++counts[bucket_index]; } histogram::bounds linear_bounds(const double start, const double width, const size_t count) { PROMETHEUS_CHECK(start >= 0); PROMETHEUS_CHECK(width > 0); PROMETHEUS_CHECK(count > 0); return make_bounds(std::plus<double>(), start, width, count); } histogram::bounds exponential_bounds(const double start, const double factor, const size_t count) { PROMETHEUS_CHECK(start >= 0); PROMETHEUS_CHECK(factor > 1); PROMETHEUS_CHECK(count > 0); return make_bounds(std::multiplies<double>(), start, factor, count); } } // namespace prometheus
fb598347a061dc45fe8c405df4f1b18515cad8ef
e0904d35f0b89fed8ebdeb6e08864c0208006954
/Applications/Utils/GeoTools/MoveGeometry.cpp
d7a971a60458a707dce5d7cd2d1acfd51454eaa9
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
ufz/ogs
e3f7b203ac960eeed81c3ad20e743b2ee2f4753e
073d0b9820efa5149578259c0137999a511cfb4f
refs/heads/master
2023-08-31T07:09:48.929090
2023-08-30T09:24:09
2023-08-30T09:24:09
1,701,384
125
259
BSD-3-Clause
2021-04-22T03:28:27
2011-05-04T14:09:57
C++
UTF-8
C++
false
false
3,256
cpp
MoveGeometry.cpp
/** * \file * \author Karsten Rink * \date 2015-08-04 * \brief A small tool to translate geometries. * * \copyright * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license */ // ThirdParty #include <tclap/CmdLine.h> #ifdef USE_PETSC #include <mpi.h> #endif #include "GeoLib/GEOObjects.h" #include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "InfoLib/GitInfo.h" int main(int argc, char* argv[]) { TCLAP::CmdLine cmd( "Moves the points of a geometry by a given displacement vector\n\n" "OpenGeoSys-6 software, version " + GitInfoLib::GitInfo::ogs_version + ".\n" "Copyright (c) 2012-2023, OpenGeoSys Community " "(http://www.opengeosys.org)", ' ', GitInfoLib::GitInfo::ogs_version); TCLAP::ValueArg<double> z_arg("z", "z", "displacement in z direction", false, 0.0, "z-displacement"); cmd.add(z_arg); TCLAP::ValueArg<double> y_arg("y", "y", "displacement in y direction", false, 0.0, "y-displacement"); cmd.add(y_arg); TCLAP::ValueArg<double> x_arg("x", "x", "displacement in x direction", false, 0.0, "x-displacement"); cmd.add(x_arg); TCLAP::ValueArg<std::string> geo_output_arg( "o", "output", "output geometry file (*.gml)", true, "", "output file"); cmd.add(geo_output_arg); TCLAP::ValueArg<std::string> geo_input_arg( "i", "input", "input geometry file (*.gml)", true, "", "input file"); cmd.add(geo_input_arg); cmd.parse(argc, argv); #ifdef USE_PETSC MPI_Init(&argc, &argv); #endif GeoLib::GEOObjects geo_objects; GeoLib::IO::BoostXmlGmlInterface xml(geo_objects); try { if (!xml.readFile(geo_input_arg.getValue())) { #ifdef USE_PETSC MPI_Finalize(); #endif return EXIT_FAILURE; } } catch (std::runtime_error const& err) { ERR("Failed to read file `{:s}'.", geo_input_arg.getValue()); ERR("{:s}", err.what()); #ifdef USE_PETSC MPI_Finalize(); #endif return EXIT_FAILURE; } Eigen::Vector3d displacement = Eigen::Vector3d::Zero(); if (x_arg.isSet()) { displacement[0] = x_arg.getValue(); } if (y_arg.isSet()) { displacement[1] = y_arg.getValue(); } if (z_arg.isSet()) { displacement[2] = z_arg.getValue(); } auto const geo_name = geo_objects.getGeometryNames()[0]; std::vector<GeoLib::Point*> const* point_vec = geo_objects.getPointVec(geo_name); std::size_t const n_points = point_vec->size(); for (std::size_t i = 0; i < n_points; ++i) { for (std::size_t c = 0; c < 3; ++c) { (*(*point_vec)[i])[c] += displacement[c]; } } xml.export_name = geo_name; BaseLib::IO::writeStringToFile(xml.writeToString(), geo_output_arg.getValue()); #ifdef USE_PETSC MPI_Finalize(); #endif return EXIT_SUCCESS; }
cdf904a94bb524312e36d975196d4a53f9c7d32d
01aabb4a7a36d397b2f4a58255840749227043f1
/Beginner126/b.cpp
e07d7977e6e7a525a972f880204cb189629f8597
[]
no_license
higher68/atcoder
1c8e562a21d043827912d27b032b55b71399e6b6
a089b4a096fde6ca0be28b220af55c48210e7966
refs/heads/master
2021-06-17T04:02:22.189387
2019-09-22T07:36:27
2019-09-22T07:36:27
137,625,434
0
0
null
null
null
null
UTF-8
C++
false
false
801
cpp
b.cpp
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int S_left = atoi(S.substr(0, 2).c_str()); int S_right = atoi(S.substr(2, 2).c_str()); bool left_judge_m = (1 <= S_left) and (S_left <= 12); bool left_judge_y = 0 <= S_left; bool right_judge_m = (1 <= S_right) and (S_right <= 12); bool right_judge_y = 0 <= S_right; bool mmyy = left_judge_m & right_judge_y; bool yymm = left_judge_y & right_judge_m; if (mmyy == true and yymm == true) { cout << "AMBIGUOUS" << endl; } else if (mmyy == true and yymm == false) { cout << "MMYY" << endl; } else if (mmyy == false and yymm == true) { cout << "YYMM" << endl; } else { cout << "NA" << endl; } return 0; }
a84d0d3bf53648c82553112a5dbbe2ef0158b98b
63fadaa93caca22ca6b6546584243daf24e0e3fd
/sangwon/ch24_SegmentTree/24-3.cpp
d2644a05e7252dc5af52dc5a7e1a1decf0da4b78
[]
no_license
snulion-study/algorithm-int
60e69f58d0a94560798881ef98bd7a434c472733
7ac1cefe7b1e77b5ade9a28f302b5db0bb67a427
refs/heads/master
2023-03-14T09:52:47.139136
2021-02-27T05:13:02
2021-02-27T05:13:02
293,447,189
0
5
null
2021-02-27T05:13:03
2020-09-07T06:57:35
C++
UTF-8
C++
false
false
1,021
cpp
24-3.cpp
// 24.3 RMQ 문제를 푸는 구간 트리에서 갱신 연산의 구현 struct RMQ { // array[index]=newValue 로 바뀌었을 때, node를 루트로 하는 // 구간 트리를 갱신하고 노드가 표현하는 구간의 최소치를 반환한다. int update(int index, int newValue, int node, int nodeLeft, int nodeRight) { // index가 노드가 표현하는 구간과 상관없는 경우엔 무시한다. if(index < nodeLeft || nodeRight < index) return rangeMin[node]; // 트리의 리프까지 내려온 경우 if(nodeLeft == nodeRight) return rangeMin[node] = newValue; int mid = (nodeLeft + nodeRight) / 2; return nrangeMin[node] = min( update(index, newValue, node*2, nodeLeft, mid), update(index, newValue, node*2+1, mid+1, nodeRight)); } // update() 를 외부에서 호출하기 위한 인터페이스 int update(int index, int newValue) { return update(index, newValue, 1, 0, n-1); } };
cdab8d7950f39fd27005ac9954fb599126bbe09b
9a55a1ac7ab096bd7c92820f2ccddcda5e0d7977
/Master BT/src/MIMU.cpp
f1d6484712ff80e437b292f6dda2385c6cc47759
[]
no_license
Dom0798/SensorsFIV
aa1b11dece3bb3bc4326cbc1e1f42c522fb47fca
2d4cf4da0aaf2306525818cba51570fb8a5e9487
refs/heads/main
2023-01-14T17:43:29.328784
2020-11-20T02:26:42
2020-11-20T02:26:42
314,423,035
0
0
null
null
null
null
UTF-8
C++
false
false
1,629
cpp
MIMU.cpp
#include <Arduino.h> #include <Wire.h> #include "SparkFun_BNO080_Arduino_Library.h" #include <BluetoothSerial.h> #include <esp_now.h> #include <WiFi.h> typedef struct Hall{ int pos; } Hall; BNO080 myIMU2; //Closed I2C ADR jumper - address 0x4A Hall Pos; BluetoothSerial SerialBT; String payload1; String payload2; void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { memcpy(&Pos, incomingData, sizeof(Pos)); } void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); SerialBT.begin("VenusIMU"); if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } esp_now_register_recv_cb(OnDataRecv); Wire.begin(); Wire.setClock(10000); if (myIMU2.begin(0x4A) == false) { Serial.println("Segundo BNO080 no conectado..."); } //myIMU1.enableRotationVector(50); //Send data update every 50ms myIMU2.enableRotationVector(50); } void loop() { if (myIMU2.dataAvailable() == true) { float roll2 = (myIMU2.getRoll()) * 180.0 / PI; // Convert roll to degrees float pitch2 = (myIMU2.getPitch()) * 180.0 / PI; // Convert pitch to degrees float yaw2 = (myIMU2.getYaw()) * 180.0 / PI; // Convert yaw to degrees int r2 = round(roll2); int p2 = round(pitch2); int y2 = round(yaw2); payload2 = -r2; payload2 += ";"; payload2 += -p2; payload2 += ";"; payload2 += -y2; payload2 += ";"; payload2 += Pos.pos; Serial.println(payload2); SerialBT.println(payload2); SerialBT.flush(); Wire.endTransmission(); } }
109fa4d6f4457b7ac0bb074d89431a99fee2e19d
3cf484db295a891f86e390fb58c33218112834be
/fakeflow/action.hpp
d8ce46a949eab13c94dcd702f07f14a87acc7126
[ "Apache-2.0" ]
permissive
flowgrammable/steve
5aae9706818df107edb03b88929ad6b9e6cd8b86
7057c90a9e2ee422fde4956b114d8ddfc4f8f031
refs/heads/master
2021-01-21T05:03:09.911103
2016-07-29T17:45:25
2016-07-29T17:45:25
39,910,789
2
1
null
2016-07-27T22:06:38
2015-07-29T18:56:08
C++
UTF-8
C++
false
false
5,077
hpp
action.hpp
// Copyright (c) 2015 Flowgrammable.org // All rights reserved #ifndef FP_ACTION_HPP #define FP_ACTION_HPP #include "types.hpp" #include <vector> #include <iostream> namespace fp { struct Context; // Defined address spaces for fields. constexpr int Packet_memory = 0; constexpr int Metadata_memory = 1; // A field defines the offset and length of a value in // memory within some address space. Currently, there // are only two address spaces: packet and metadata. // // If the field refers to packet memory, the offset is // relative to the current header. // // FIXME: Preserve the address space or no? struct Field { std::uint8_t address; std::uint16_t offset; std::uint16_t length; }; // -------------------------------------------------------------------------- // // Actions // // TODO: Define actions for TTL operations, pushing, and // popping headers. // Copies a value into the given field. Note that // value + field.length must be within the range // of memory designated by field.address. struct Set_action { Set_action() : field {0, 0, 0}, value(nullptr) { } Set_action(std::uint8_t addr, std::uint16_t off, std::uint16_t len, Byte* v) : field{addr, off, len}, value(new Byte[len]) { std::copy(v, v + len, value); } Set_action(Set_action const& s) : field(s.field), value(new Byte[s.field.length]) { std::copy(s.value, s.value + s.field.length, value); } ~Set_action() { if (value) delete [] value; } Field field; Byte* value; }; // Copies a field from a source address space to // an offset in the other address space. // // TODO: What if we have >2 address spaces? struct Copy_action { Field field; std::uint16_t offset; }; // Set the output port for the current packet. struct Output_action { std::uint32_t port; }; // Sets the output queue for the current packet. struct Queue_action { std::uint32_t queue; }; // Sets the group action to apply to this packet. struct Group_action { std::uint32_t group; }; // Represents one of a set of actions. Abstactly: // // action ::= set <field> <value> // copy <field> <address> // output <port> // queue <queue> // group <group> struct Action { enum Type : std::uint8_t { SET, COPY, OUTPUT, QUEUE, GROUP, ACTION }; Action() { } Action(Set_action const& s) : value(s), type(SET) { } Action(Copy_action const& c) : value(c), type(COPY) { } Action(Output_action const& o) : value(o), type(OUTPUT) { } Action(Queue_action const& q) : value(q), type(QUEUE) { } Action(Group_action const& g) : value(g), type(GROUP) { } Action(Action const&); ~Action() { clear(); } void clear(); union Action_data { Action_data() { } Action_data(Set_action const& s) : set(s) { } Action_data(Copy_action const& c) : copy(c) { } Action_data(Output_action const& o) : output(o) { } Action_data(Queue_action const& q) : queue(q) { } Action_data(Group_action const& g) : group(g) { } ~Action_data() { } Set_action set; Copy_action copy; Output_action output; Queue_action queue; Group_action group; }; Action_data value; std::uint8_t type; }; inline void Action::clear() { if (type == SET) value.set.~Set_action(); } inline Action::Action(Action const& a) { type = a.type; switch (a.type) { case SET: value = Action_data(a.value.set); break; case COPY: value = Action_data(a.value.copy); break; case OUTPUT: value = Action_data(a.value.output); break; case QUEUE: value = Action_data(a.value.queue); break; case GROUP: value = Action_data(a.value.group); break; } } // A list of actions. using Action_list = std::vector<Action>; // The action set maintains a sequence of instructions // to be executed on a packet (context) prior to egress. // // FIXME: This is a highly structured list of actions, // and the order in which those actions are applied matters. struct Action_set : Action_list { }; inline std::ostream& operator<<(std::ostream& os, Action const& a) { Action::Action_data const& data = a.value; Byte* buf = nullptr; uint32_t val = 10; switch (a.type) { case Action::Type::SET: buf = new Byte[data.set.field.length]; std::fill(std::copy(data.set.value, data.set.value + data.set.field.length, buf), buf + sizeof(uint32_t), 0); val = *reinterpret_cast<uint32_t*>(buf); os << "SET: " << data.set.field.offset << "," << data.set.field.length << "," << val << '\n'; delete [] buf; break; case Action::Type::COPY: os << "COPY\n"; break; case Action::Type::OUTPUT: os << "OUTPUT PORT: " << data.output.port << '\n'; break; case Action::Type::QUEUE: os << "QUEUE\n"; break; case Action::Type::GROUP: os << "GROUP\n"; break; } return os; } } // namespace fp #endif
3e689d6397ffb35ee5b527ad35b00acc163400eb
f154525a08770ab1805e6b72a75422228e04f36a
/taglist.cpp
e365a0ecce5bdddb9bfc3f43c3fb1bb5e0f185b8
[]
no_license
ygorg/Tagulous
4cbbd5e964ccb5dfb3b485e6a49c99d3b813a696
07ca464beabeb51be2423018dcfa6b94d9329efc
refs/heads/master
2021-06-18T01:21:00.363275
2017-05-16T18:43:23
2017-05-16T18:43:23
83,132,047
1
0
null
null
null
null
UTF-8
C++
false
false
2,890
cpp
taglist.cpp
#include "taglist.h" #include <QDebug> TagList::TagList() : QList<Tag *>() {} void TagList::fromXML(QXmlStreamReader *reader) { Tag *currentTag; TagFile *currentFile; bool inFile = false; while (!reader->atEnd()) { reader->readNext(); if (reader->isWhitespace()) { continue; } switch (reader->tokenType()) { case QXmlStreamReader::StartElement: if (reader->name() == "tag") { QString name = reader->attributes().value("name").toString(); QStringList colorValues = reader->attributes().value("color") .toString().split(" "); QColor color(colorValues[0].toInt(), colorValues[1].toInt(), colorValues[2].toInt(), colorValues[3].toInt()); currentTag = new Tag(name); currentTag->setBulletColor(color); } else if (reader->name() == "file") { inFile = true; } break; case QXmlStreamReader::EndElement: if (reader->name() == "tag") { this->append(currentTag); currentTag = nullptr; } else if (reader->name() == "file") { currentTag->append(currentFile); currentFile = nullptr; inFile = false; } break; case QXmlStreamReader::Characters: if (inFile) { QString path = reader->text().toString(); currentFile = TagFile::find(path); } break; default: break; } } } void TagList::toXML(QXmlStreamWriter *writer) { writer->setAutoFormatting(true); writer->writeStartDocument(); writer->writeStartElement("taglist"); for (Tag *tag : *this) { QColor color = tag->getColor(); QString colorStr("%1 %2 %3 %4"); colorStr = colorStr.arg(color.red()).arg(color.green()) .arg(color.blue()).arg(color.alpha()); writer->writeStartElement("tag"); writer->writeAttribute("name", tag->getName()); writer->writeAttribute("color", colorStr); for (TagFile *file : *tag) { QString path = file->getPath(); writer->writeStartElement("file"); writer->writeCharacters(file->getPath()); writer->writeEndElement(); } writer->writeEndElement(); } writer->writeEndElement(); writer->writeEndDocument(); } void TagList::init() { Tag *tag = new Tag("Music"); tag->setBulletColor(QColor(252, 61, 57)); this->append(tag); tag = new Tag("Film"); tag->setBulletColor(QColor(104, 216, 69)); this->append(tag); tag = new Tag("Photos"); tag->setBulletColor(QColor(42, 174, 245)); this->append(tag); }
23e370f5e66d022c26568fd3e2bb8c90c3a41500
ee4f5d10eda69aa44319ad77bda99fbfa6da81b1
/src/format.cpp
f2be1a4a4345afd7a73175030845e9da6674ab5d
[ "MIT" ]
permissive
halogen7/system-monitor
8386b0426b5aeca408aa09b4366183c77cf92ba7
19ef12132f9401ff74a33e1869a996d3ed500081
refs/heads/master
2023-09-01T12:35:22.695821
2021-10-17T17:22:28
2021-10-17T17:22:28
390,564,862
0
0
null
null
null
null
UTF-8
C++
false
false
655
cpp
format.cpp
#include "format.h" #include <iostream> #include <string> using std::string; // Complete this helper function // INPUT: Long int measuring seconds // OUTPUT: HH:MM:SS string Format::ElapsedTime(long seconds) { // Get initial remainder int mod = seconds % 3600; // Get hours, minutes, seconds string hours = std::to_string(seconds / 3600); string minutes = std::to_string(mod / 60); string sec = std::to_string(mod % 60); if (hours.length() < 2) { hours = "0" + hours; } if (minutes.length() < 2) { minutes = "0" + minutes; } if (sec.length() < 2) { sec = "0" + sec; } return hours + ":" + minutes + ":" + sec; }
aa2528d99e851cfd4fce07fb818722b2c2cbcc72
db917eacf28355caddda00fd09613bc54bcca2b3
/src/twister.cpp
24a19f21372c20a6ec8bf3fc928dbb14827b3827
[ "MIT", "BSD-3-Clause" ]
permissive
djmaze/twister-core
758bbbb953183f75266a12b8ca70ea7e8b7d9aed
2d96c08f498ef82a60d3efe447ebf4df639c0063
refs/heads/master
2021-01-18T13:41:52.363008
2014-07-04T15:58:10
2014-07-04T15:58:10
21,539,310
2
0
null
null
null
null
UTF-8
C++
false
false
83,282
cpp
twister.cpp
#include "twister.h" #include "twister_utils.h" #include "dhtproxy.h" #include "main.h" #include "init.h" #include "bitcoinrpc.h" #include "txdb.h" #include "utf8core.h" #include "libtorrent/peer_info.hpp" using namespace json_spirit; using namespace std; #include <boost/shared_ptr.hpp> #include <boost/filesystem.hpp> #ifdef HAVE_BOOST_LOCALE #include <boost/locale.hpp> #endif #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> #include <time.h> twister::twister() { } // ===================== LIBTORRENT & DHT =========================== #include "libtorrent/config.hpp" #include "libtorrent/entry.hpp" #include "libtorrent/bencode.hpp" #include "libtorrent/session.hpp" #include "libtorrent/alert_types.hpp" #define TORRENT_DISABLE_GEO_IP #include "libtorrent/aux_/session_impl.hpp" #define DEBUG_ACCEPT_POST 1 //#define DEBUG_EXPIRE_DHT_ITEM 1 //#define DEBUG_MAINTAIN_DHT_NODES 1 //#define DEBUG_NEIGHBOR_TORRENT 1 using namespace libtorrent; static boost::shared_ptr<session> m_ses; static bool m_shuttingDownSession = false; static bool m_usingProxy; static int num_outstanding_resume_data; static CCriticalSection cs_dhtgetMap; static map<sha1_hash, std::list<alert_manager*> > m_dhtgetMap; static CCriticalSection cs_twister; static map<std::string, bool> m_specialResources; enum ExpireResType { SimpleNoExpire, NumberedNoExpire, PostNoExpireRecent }; static map<std::string, ExpireResType> m_noExpireResources; static map<std::string, torrent_handle> m_userTorrent; static boost::scoped_ptr<CLevelDB> m_swarmDb; static int m_threadsToJoin; static CCriticalSection cs_spamMsg; static std::string m_preferredSpamLang = "[en]"; static std::string m_receivedSpamMsgStr; static std::string m_receivedSpamUserStr; static int64 m_lastSpamTime = 0; static std::map<std::string,UserData> m_users; static CCriticalSection cs_seenHashtags; static std::map<std::string,double> m_seenHashtags; class SimpleThreadCounter { public: SimpleThreadCounter(CCriticalSection *lock, int *counter, const char *name) : m_lock(lock), m_counter(counter), m_name(name) { RenameThread(m_name); LOCK(*m_lock); (*m_counter)++; } ~SimpleThreadCounter() { printf("%s thread exit\n", m_name); LOCK(*m_lock); (*m_counter)--; } private: CCriticalSection *m_lock; int *m_counter; const char *m_name; }; #define USER_DATA_FILE "user_data" #define GLOBAL_DATA_FILE "global_data" void dhtgetMapAdd(sha1_hash &ih, alert_manager *am) { LOCK(cs_dhtgetMap); m_dhtgetMap[ih].push_back(am); } void dhtgetMapRemove(sha1_hash &ih, alert_manager *am) { LOCK(cs_dhtgetMap); std::map<sha1_hash, std::list<alert_manager*> >::iterator mi = m_dhtgetMap.find(ih); if( mi != m_dhtgetMap.end() ) { std::list<alert_manager *> &amList = (*mi).second; amList.remove(am); if( !amList.size() ) { m_dhtgetMap.erase(ih); } } } void dhtgetMapPost(sha1_hash &ih, const alert &a) { LOCK(cs_dhtgetMap); std::map<sha1_hash, std::list<alert_manager*> >::iterator mi = m_dhtgetMap.find(ih); if( mi != m_dhtgetMap.end() ) { std::list<alert_manager *> &amList = (*mi).second; BOOST_FOREACH(alert_manager *am, amList) { am->post_alert(a); } } } torrent_handle startTorrentUser(std::string const &username, bool following) { bool userInTxDb = usernameExists(username); // keep this outside cs_twister to avoid deadlock boost::shared_ptr<session> ses(m_ses); if( !userInTxDb || !ses ) return torrent_handle(); LOCK(cs_twister); if( !m_userTorrent.count(username) ) { sha1_hash ih = dhtTargetHash(username, "tracker", "m"); printf("adding torrent for [%s,tracker]\n", username.c_str()); add_torrent_params tparams; tparams.info_hash = ih; tparams.name = username; boost::filesystem::path torrentPath = GetDataDir() / "swarm"; tparams.save_path= torrentPath.string(); libtorrent::error_code ec; create_directory(tparams.save_path, ec); std::string filename = combine_path(tparams.save_path, to_hex(ih.to_string()) + ".resume"); load_file(filename.c_str(), tparams.resume_data); m_userTorrent[username] = ses->add_torrent(tparams); if( !following ) { m_userTorrent[username].auto_managed(true); } m_userTorrent[username].force_dht_announce(); } if( following ) { m_userTorrent[username].set_following(true); m_userTorrent[username].auto_managed(false); m_userTorrent[username].resume(); } return m_userTorrent[username]; } torrent_handle getTorrentUser(std::string const &username) { LOCK(cs_twister); if( m_userTorrent.count(username) ) return m_userTorrent[username]; else return torrent_handle(); } int torrentLastHave(std::string const &username) { torrent_handle h = getTorrentUser(username); if( !h.is_valid() ) return -1; torrent_status status = h.status(); return status.last_have; } int torrentNumPieces(std::string const &username) { torrent_handle h = getTorrentUser(username); if( !h.is_valid() ) return -1; torrent_status status = h.status(); return status.num_pieces; } int saveGlobalData(std::string const& filename) { LOCK(cs_twister); entry globalDict; globalDict["preferredSpamLang"] = m_preferredSpamLang; globalDict["receivedSpamMsg"] = m_receivedSpamMsgStr; globalDict["receivedSpamUser"] = m_receivedSpamUserStr; globalDict["lastSpamTime"] = m_lastSpamTime; globalDict["sendSpamMsg"] = strSpamMessage; globalDict["sendSpamUser"] = strSpamUser; globalDict["generate"] = GetBoolArg("-gen", false); int genproclimit = GetArg("-genproclimit", -1); if( genproclimit > 0 ) globalDict["genproclimit"] = genproclimit; std::vector<char> buf; bencode(std::back_inserter(buf), globalDict); return save_file(filename, buf); } int loadGlobalData(std::string const& filename) { LOCK(cs_twister); std::vector<char> in; if (load_file(filename, in) == 0) { lazy_entry userDict; libtorrent::error_code ec; if (lazy_bdecode(&in[0], &in[0] + in.size(), userDict, ec) == 0) { if( userDict.type() != lazy_entry::dict_t ) goto data_error; m_preferredSpamLang = userDict.dict_find_string_value("preferredSpamLang"); m_receivedSpamMsgStr = userDict.dict_find_string_value("receivedSpamMsg"); m_receivedSpamUserStr = userDict.dict_find_string_value("receivedSpamUser"); m_lastSpamTime = userDict.dict_find_int_value("lastSpamTime"); string sendSpamMsg = userDict.dict_find_string_value("sendSpamMsg"); if( sendSpamMsg.size() ) strSpamMessage = sendSpamMsg; string sendSpamUser = userDict.dict_find_string_value("sendSpamUser"); if( sendSpamUser.size() ) strSpamUser = sendSpamUser; bool generate = userDict.dict_find_int_value("generate"); int genproclimit = userDict.dict_find_int_value("genproclimit"); if( generate ) { Array params; params.push_back( generate ); if( genproclimit > 0 ) params.push_back( genproclimit ); setgenerate(params, false); } return 0; } } return -1; data_error: printf("loadGlobalData: unexpected bencode type - global_data corrupt!\n"); return -2; } void ThreadWaitExtIP() { SimpleThreadCounter threadCounter(&cs_twister, &m_threadsToJoin, "wait-extip"); std::string ipStr; // wait up to 10 seconds for bitcoin to get the external IP for( int i = 0; i < 20; i++ ) { const CNetAddr paddrPeer("8.8.8.8"); CAddress addr( GetLocalAddress(&paddrPeer) ); if( addr.IsValid() ) { ipStr = addr.ToStringIP(); break; } MilliSleep(500); } libtorrent::error_code ec; boost::filesystem::path swarmDbPath = GetDataDir() / "swarm" / "db"; create_directories(swarmDbPath.string(), ec); m_swarmDb.reset(new CLevelDB(swarmDbPath.string(), 256*1024, false, false)); int listen_port = GetListenPort() + LIBTORRENT_PORT_OFFSET; std::string bind_to_interface = ""; proxyType proxyInfoOut; m_usingProxy = GetProxy(NET_IPV4, proxyInfoOut); printf("Creating new libtorrent session ext_ip=%s port=%d proxy=%s\n", ipStr.c_str(), !m_usingProxy ? listen_port : 0, m_usingProxy ? proxyInfoOut.first.ToStringIPPort().c_str() : ""); m_ses.reset(new session(*m_swarmDb, fingerprint("TW", LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR, 0, 0) , session::add_default_plugins , alert::dht_notification , ipStr.size() ? ipStr.c_str() : NULL , !m_usingProxy ? std::make_pair(listen_port, listen_port) : std::make_pair(0, 0) )); boost::shared_ptr<session> ses(m_ses); if( m_usingProxy ) { proxy_settings proxy; proxy.hostname = proxyInfoOut.first.ToStringIP(); proxy.port = proxyInfoOut.first.GetPort(); proxy.type = HaveNameProxy() ? proxy_settings::socks5 : proxy_settings::socks4; ses->set_proxy(proxy); } // session will be paused until we have an up-to-date blockchain ses->pause(); std::vector<char> in; boost::filesystem::path sesStatePath = GetDataDir() / "ses_state"; if (load_file(sesStatePath.string(), in) == 0) { lazy_entry e; if (lazy_bdecode(&in[0], &in[0] + in.size(), e, ec) == 0) ses->load_state(e); } if( !m_usingProxy ) { if( GetBoolArg("-upnp", true) ) { ses->start_upnp(); ses->start_natpmp(); } ses->listen_on(std::make_pair(listen_port, listen_port) , ec, bind_to_interface.c_str()); if (ec) { fprintf(stderr, "failed to listen%s%s on ports %d-%d: %s\n" , bind_to_interface.empty() ? "" : " on ", bind_to_interface.c_str() , listen_port, listen_port+1, ec.message().c_str()); } dht_settings dhts; // settings to test local connections //dhts.restrict_routing_ips = false; //dhts.restrict_search_ips = false; ses->set_dht_settings(dhts); if( !DhtProxy::fEnabled ) { ses->start_dht(); } else { ses->stop_dht(); } } session_settings settings("twisterd/"+FormatFullVersion()); // settings to test local connections settings.allow_multiple_connections_per_ip = true; //settings.enable_outgoing_utp = false; // (false to see connections in netstat) //settings.dht_announce_interval = 60; // test //settings.min_announce_interval = 60; // test if( !m_usingProxy ) { settings.anonymous_mode = false; // (false => send peer_id, avoid connecting to itself) } else { settings.anonymous_mode = true; settings.force_proxy = true; // DHT won't work } // disable read cache => there is still some bug due to twister piece size changes settings.use_read_cache = false; settings.cache_size = 0; // more connections. less memory per connection. settings.connections_limit = 800; settings.recv_socket_buffer_size = 16*1024; settings.send_socket_buffer_size = 16*1024; settings.max_peerlist_size = 1000; settings.max_paused_peerlist_size = 1000; // reduce timeouts settings.peer_timeout = 60; settings.request_timeout = 20; // more torrents in auto manager settings.active_downloads = 20; settings.active_limit = 25; settings.unchoke_slots_limit = 20; settings.auto_manage_interval = 30; ses->set_settings(settings); printf("libtorrent + dht started\n"); // wait up to 10 seconds for dht nodes to be set for( int i = 0; i < 10; i++ ) { MilliSleep(1000); session_status ss = ses->status(); if( ss.dht_nodes ) break; } boost::filesystem::path globalDataPath = GetDataDir() / GLOBAL_DATA_FILE; loadGlobalData(globalDataPath.string()); std::set<std::string> torrentsToStart; { LOCK(cs_twister); boost::filesystem::path userDataPath = GetDataDir() / USER_DATA_FILE; loadUserData(userDataPath.string(), m_users); printf("loaded user_data for %zd users\n", m_users.size()); // add all user torrents to a std::set (all m_following) std::map<std::string,UserData>::const_iterator i; for (i = m_users.begin(); i != m_users.end(); ++i) { UserData const &data = i->second; BOOST_FOREACH(string username, data.m_following) { torrentsToStart.insert(username); } } } // now restart the user torrents BOOST_FOREACH(string username, torrentsToStart) { startTorrentUser(username, true); } } bool isBlockChainUptodate() { if( !pindexBest ) return false; return (pindexBest->GetBlockTime() > GetTime() - 2 * 60 * 60); } bool yes(libtorrent::torrent_status const&) { return true; } void saveTorrentResumeData() { boost::shared_ptr<session> ses(m_ses); if( ses ){ printf("saving resume data\n"); std::vector<torrent_status> temp; ses->get_torrent_status(&temp, &yes, 0); for (std::vector<torrent_status>::iterator i = temp.begin(); i != temp.end(); ++i) { torrent_status& st = *i; if (!st.handle.is_valid()) { printf(" skipping, invalid handle\n"); continue; } if (!st.has_metadata) { printf(" skipping %s, no metadata\n", st.name.c_str()); continue; } if (!st.need_save_resume) { printf(" skipping %s, resume file up-to-date\n", st.name.c_str()); continue; } // save_resume_data will generate an alert when it's done st.handle.save_resume_data(); ++num_outstanding_resume_data; } } } void lockAndSaveUserData() { LOCK(cs_twister); if( m_users.size() ) { printf("saving user_data (followers and DMs)...\n"); boost::filesystem::path userDataPath = GetDataDir() / USER_DATA_FILE; saveUserData(userDataPath.string(), m_users); } } int getDhtNodes(boost::int64_t *dht_global_nodes) { int dhtNodes = 0; if( dht_global_nodes ) *dht_global_nodes = 0; if( !DhtProxy::fEnabled ) { boost::shared_ptr<session> ses(m_ses); if( ses ) { session_status ss = ses->status(); if( dht_global_nodes ) *dht_global_nodes = ss.dht_global_nodes; dhtNodes = ss.dht_nodes; } } else { LOCK(cs_vNodes); DhtProxy::getRandomDhtProxies(&dhtNodes); } return dhtNodes; } void torrentManualTrackerUpdate(const std::string &username) { printf("torrentManualTrackerUpdate: updating torrent '%s'\n", username.c_str()); Array params; params.push_back(username); params.push_back("tracker"); params.push_back("m"); Array res = dhtget(params, false).get_array(); if( !res.size() ) { printf("torrentManualTrackerUpdate: no tracker response for torrent '%s'\n", username.c_str()); } else { torrent_handle h = getTorrentUser(username); for( size_t i = 0; i < res.size(); i++ ) { if( res.at(i).type() != obj_type ) continue; Object resDict = res.at(i).get_obj(); BOOST_FOREACH(const Pair& item, resDict) { if( item.name_ == "p" && item.value_.type() == obj_type ) { Object pDict = item.value_.get_obj(); BOOST_FOREACH(const Pair& pitem, pDict) { if( pitem.name_ == "v" && pitem.value_.type() == obj_type ) { Object vDict = pitem.value_.get_obj(); BOOST_FOREACH(const Pair& vitem, vDict) { if( vitem.name_ == "values" && vitem.value_.type() == array_type ) { Array values = vitem.value_.get_array(); printf("torrentManualTrackerUpdate: tracker for '%s' returned %zd values\n", username.c_str(), values.size()); for( size_t j = 0; j < values.size(); j++ ) { if( values.at(j).type() != str_type ) continue; size_t inSize = values.at(j).get_str().size(); char const* in = values.at(j).get_str().data(); tcp::endpoint ep; if( inSize == 6 ) { ep = libtorrent::detail::read_v4_endpoint<tcp::endpoint>(in); } #if TORRENT_USE_IPV6 else if ( inSize == 18 ) { ep = libtorrent::detail::read_v6_endpoint<tcp::endpoint>(in); } #endif else { continue; } h.connect_peer(ep); } } } } } } } } } } void ThreadMaintainDHTNodes() { SimpleThreadCounter threadCounter(&cs_twister, &m_threadsToJoin, "maintain-dht-nodes"); while(!m_ses && !m_shuttingDownSession) { MilliSleep(200); } int64 lastSaveResumeTime = GetTime(); int64 lastManualTrackerUpdate = GetTime(); int lastTotalNodesCandidates = 0; while(m_ses && !m_shuttingDownSession) { boost::shared_ptr<session> ses(m_ses); session_status ss = ses->status(); int dht_nodes = ss.dht_nodes; bool nodesAdded = false; int vNodesSize = 0; { LOCK(cs_vNodes); vNodesSize = vNodes.size(); } if( !ses->is_paused() && !DhtProxy::fEnabled ) { vector<CAddress> vAddr = addrman.GetAddr(); int totalNodesCandidates = (int)(vNodesSize + vAddr.size()); if( ((!dht_nodes && totalNodesCandidates) || (dht_nodes < 5 && totalNodesCandidates > 10)) && !m_usingProxy && totalNodesCandidates != lastTotalNodesCandidates) { lastTotalNodesCandidates = totalNodesCandidates; printf("ThreadMaintainDHTNodes: too few dht_nodes, trying to add some...\n"); BOOST_FOREACH(const CAddress &a, vAddr) { std::string addr = a.ToStringIP(); int port = a.GetPort() + LIBTORRENT_PORT_OFFSET; #ifdef DEBUG_MAINTAIN_DHT_NODES printf("Adding dht node (addrman) %s:%d\n", addr.c_str(), port); #endif ses->add_dht_node(std::pair<std::string, int>(addr, port)); nodesAdded = true; } LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { // if !fInbound we created this connection so ip is reachable. // we can't use port number of inbound connection, so try standard port. // only use inbound as last resort (if dht_nodes empty) if( !pnode->fInbound || !dht_nodes ) { std::string addr = pnode->addr.ToStringIP(); int port = (!pnode->fInbound) ? pnode->addr.GetPort() : Params().GetDefaultPort(); port += LIBTORRENT_PORT_OFFSET; #ifdef DEBUG_MAINTAIN_DHT_NODES printf("Adding dht node (%sbound) %s:%d\n", (!pnode->fInbound) ? "out" : "in", addr.c_str(), port); #endif ses->add_dht_node(std::pair<std::string, int>(addr, port)); nodesAdded = true; } } } } if( ses->is_paused() ) { if( vNodesSize && isBlockChainUptodate() ) { printf("BlockChain is now up-to-date: unpausing libtorrent session\n"); ses->resume(); } } else { if( !vNodesSize || !isBlockChainUptodate() ) { printf("Outdated BlockChain detected: pausing libtorrent session\n"); ses->pause(); } } if( nodesAdded ) { MilliSleep(2000); ss = ses->status(); if( ss.dht_nodes > dht_nodes ) { // new nodes were added to dht: force updating peers from dht so torrents may start faster LOCK(cs_twister); BOOST_FOREACH(const PAIRTYPE(std::string, torrent_handle)& item, m_userTorrent) { item.second.force_dht_announce(); } } } if( !vNodesSize && dht_nodes ) { printf("ThreadMaintainDHTNodes: registration network is down, trying to add nodes from DHT...\n"); for( size_t i = 0; i < ss.dht_routing_table.size(); i++ ) { dht_routing_bucket &bucket = ss.dht_routing_table[i]; if( bucket.num_nodes ) { #ifdef DEBUG_MAINTAIN_DHT_NODES printf("DHT bucket [%zd] random node = %s:%d\n", i, bucket.random_node.address().to_string().c_str(), bucket.random_node.port); #endif char nodeStr[64]; sprintf(nodeStr,"%s:%d", bucket.random_node.address().to_string().c_str(), bucket.random_node.port - LIBTORRENT_PORT_OFFSET); CAddress addr; ConnectNode(addr, nodeStr); } } } // if dhtproxy is enabled we may need to manually obtain peer lists from trackers if( DhtProxy::fEnabled && !ses->is_paused() && GetTime() > lastManualTrackerUpdate + 60 ) { list<string> activeTorrents; { LOCK(cs_twister); BOOST_FOREACH(const PAIRTYPE(std::string, torrent_handle)& item, m_userTorrent) { activeTorrents.push_back(item.first); } } BOOST_FOREACH(const std::string &username, activeTorrents) { if( m_shuttingDownSession ) break; torrent_handle h = getTorrentUser(username); if( h.is_valid() ) { torrent_status status = h.status(); if( status.state == torrent_status::downloading && status.connect_candidates < 5 ) { torrentManualTrackerUpdate(username); } } } lastManualTrackerUpdate = GetTime(); } // periodically save resume data. if daemon crashes we don't lose everything. if( GetTime() > lastSaveResumeTime + 15 * 60 ) { lastSaveResumeTime = GetTime(); saveTorrentResumeData(); lockAndSaveUserData(); } ses.reset(); MilliSleep(5000); } } void ThreadSessionAlerts() { static map<sha1_hash, bool> neighborCheck; static map<sha1_hash, int64_t> statusCheck; SimpleThreadCounter threadCounter(&cs_twister, &m_threadsToJoin, "session-alerts"); while(!m_ses && !m_shuttingDownSession) { MilliSleep(200); } while (m_ses && !m_shuttingDownSession) { boost::shared_ptr<session> ses(m_ses); alert const* a = ses->wait_for_alert(seconds(1)); if (a == 0) continue; std::deque<alert*> alerts; ses->pop_alerts(&alerts); std::string now = time_now_string(); for (std::deque<alert*>::iterator i = alerts.begin() , end(alerts.end()); i != end; ++i) { // make sure to delete each alert std::auto_ptr<alert> a(*i); dht_reply_data_alert const* rd = alert_cast<dht_reply_data_alert>(*i); if (rd) { if( rd->m_lst.size() ) { // use first one to recover target entry const *p = rd->m_lst.begin()->find_key("p"); if( p && p->type() == entry::dictionary_t ) { entry const *target = p->find_key("target"); if( target && target->type() == entry::dictionary_t ) { entry const *n = target->find_key("n"); entry const *r = target->find_key("r"); entry const *t = target->find_key("t"); if( n && n->type() == entry::string_t && r && r->type() == entry::string_t && t && t->type() == entry::string_t) { sha1_hash ih = dhtTargetHash(n->string(), r->string(), t->string()); dhtgetMapPost(ih,*rd); DhtProxy::dhtgetPeerReqReply(ih,rd); } } } } continue; } dht_get_data_alert const* gd = alert_cast<dht_get_data_alert>(*i); if (gd) { if( gd->m_possiblyNeighbor ) { entry const *n = gd->m_target.find_key("n"); entry const *r = gd->m_target.find_key("r"); entry const *t = gd->m_target.find_key("t"); if( n && n->type() == entry::string_t && r && r->type() == entry::string_t && t && t->type() == entry::string_t) { // if this is a special resource then start another dhtget to make // sure we are really its neighbor. don't do it needless. if( m_specialResources.count(r->string()) ) { // check if user exists CTransaction txOut; uint256 hashBlock; if( !GetTransaction(n->string(), txOut, hashBlock) ) { printf("Special Resource but username is unknown - ignoring\n"); } else { // now we do our own search to make sure we are really close to this target sha1_hash ih = dhtTargetHash(n->string(), r->string(), t->string()); bool knownTorrent = false; { LOCK(cs_twister); knownTorrent = m_userTorrent.count(n->string()); } if( !knownTorrent ) { if( !neighborCheck.count(ih) ) { #if DEBUG_NEIGHBOR_TORRENT printf("possiblyNeighbor of [%s,%s,%s] - starting a new dhtget to be sure\n", n->string().c_str(), r->string().c_str(), t->string().c_str()); #endif neighborCheck[ih] = false; dhtGetData(n->string(), r->string(), t->string() == "m"); } else if( neighborCheck[ih] ) { sha1_hash ihStatus = dhtTargetHash(n->string(), "status", "s"); if( !statusCheck.count(ihStatus) || statusCheck[ihStatus] + 3600 < GetTime() ) { #if DEBUG_NEIGHBOR_TORRENT printf("known neighbor. starting a new dhtget check of [%s,%s,%s]\n", n->string().c_str(), "status", "s"); #endif statusCheck[ihStatus] = GetTime(); dhtGetData(n->string(), "status", false); } } } } } } } continue; } dht_reply_data_done_alert const* dd = alert_cast<dht_reply_data_done_alert>(*i); if (dd) { #if DEBUG_NEIGHBOR_TORRENT printf("get_data_done [%s,%s,%s] is_neighbor=%d got_data=%d\n", dd->m_username.c_str(), dd->m_resource.c_str(), dd->m_multi ? "m" : "s", dd->m_is_neighbor, dd->m_got_data); #endif sha1_hash ih = dhtTargetHash(dd->m_username, dd->m_resource, dd->m_multi ? "m" : "s"); if( !dd->m_got_data ) { // no data: post alert to return from wait_for_alert in dhtget() dhtgetMapPost(ih,*dd); DhtProxy::dhtgetPeerReqReply(ih,dd); } if( neighborCheck.count(ih) ) { neighborCheck[ih] = dd->m_is_neighbor; if( dd->m_is_neighbor && dd->m_resource == "tracker" ) { #if DEBUG_NEIGHBOR_TORRENT printf("is neighbor. starting a new dhtget check of [%s,%s,%s]\n", dd->m_username.c_str(), "status", "s"); #endif sha1_hash ihStatus = dhtTargetHash(dd->m_username, "status", "s"); statusCheck[ihStatus] = GetTime(); dhtGetData(dd->m_username, "status", false); } } if( statusCheck.count(ih) ) { if( dd->m_got_data ) { startTorrentUser(dd->m_username, false); } } continue; } save_resume_data_alert const* rda = alert_cast<save_resume_data_alert>(*i); if (rda) { num_outstanding_resume_data--; if (!rda->resume_data) continue; torrent_handle h = rda->handle; torrent_status st = h.status(torrent_handle::query_save_path); std::vector<char> out; bencode(std::back_inserter(out), *rda->resume_data); save_file(combine_path(st.save_path, to_hex(st.info_hash.to_string()) + ".resume"), out); } if (alert_cast<save_resume_data_failed_alert>(*i)) { --num_outstanding_resume_data; } } } } void startSessionTorrent(boost::thread_group& threadGroup) { printf("startSessionTorrent (waiting for external IP)\n"); m_specialResources["tracker"] = true; //m_specialResources["swarm"] = true; // these are the resources which shouldn't expire m_noExpireResources["avatar"] = SimpleNoExpire; m_noExpireResources["profile"] = SimpleNoExpire; m_noExpireResources["following"] = NumberedNoExpire; m_noExpireResources["status"] = SimpleNoExpire; m_noExpireResources["post"] = PostNoExpireRecent; DhtProxy::fEnabled = GetBoolArg("-dhtproxy", false); m_threadsToJoin = 0; threadGroup.create_thread(boost::bind(&ThreadWaitExtIP)); threadGroup.create_thread(boost::bind(&ThreadMaintainDHTNodes)); threadGroup.create_thread(boost::bind(&ThreadSessionAlerts)); } void stopSessionTorrent() { if( m_ses ){ m_ses->pause(); saveTorrentResumeData(); printf("\nwaiting for resume data [%d]\n", num_outstanding_resume_data); while (num_outstanding_resume_data > 0) { MilliSleep(100); } m_shuttingDownSession = true; int threadsToJoin = 0; do { MilliSleep(100); LOCK(cs_twister); if( threadsToJoin != m_threadsToJoin ) { threadsToJoin = m_threadsToJoin; printf("twister threads to join = %d\n", threadsToJoin); } } while( threadsToJoin ); printf("\nsaving session state\n"); entry session_state; m_ses->save_state(session_state, session::save_settings | session::save_dht_settings | session::save_dht_state | session::save_encryption_settings | session::save_as_map | session::save_feeds); std::vector<char> out; bencode(std::back_inserter(out), session_state); boost::filesystem::path sesStatePath = GetDataDir() / "ses_state"; save_file(sesStatePath.string(), out); m_ses->stop_dht(); m_ses.reset(); } boost::filesystem::path globalDataPath = GetDataDir() / GLOBAL_DATA_FILE; saveGlobalData(globalDataPath.string()); lockAndSaveUserData(); printf("libtorrent + dht stopped\n"); } std::string createSignature(std::string const &strMessage, CKeyID &keyID) { if (pwalletMain->IsLocked()) { printf("createSignature: Error please enter the wallet passphrase with walletpassphrase first.\n"); return std::string(); } CKey key; if (!pwalletMain->GetKey(keyID, key)) { printf("createSignature: private key not available for given keyid.\n"); return std::string(); } CHashWriter ss(SER_GETHASH, 0); ss << strMessageMagic; ss << strMessage; vector<unsigned char> vchSig; if (!key.SignCompact(ss.GetHash(), vchSig)) { printf("createSignature: sign failed.\n"); return std::string(); } return std::string((const char *)&vchSig[0], vchSig.size()); } std::string createSignature(std::string const &strMessage, std::string const &strUsername) { if (pwalletMain->IsLocked()) { printf("createSignature: Error please enter the wallet passphrase with walletpassphrase first.\n"); return std::string(); } CKeyID keyID; if( !pwalletMain->GetKeyIdFromUsername(strUsername, keyID) ) { printf("createSignature: user '%s' unknown.\n", strUsername.c_str()); return std::string(); } return createSignature( strMessage, keyID ); } bool getUserPubKey(std::string const &strUsername, CPubKey &pubkey, int maxHeight) { CTransaction txOut; uint256 hashBlock; if( !GetTransaction(strUsername, txOut, hashBlock, maxHeight) ) { //printf("getUserPubKey: user unknown '%s'\n", strUsername.c_str()); return false; } std::vector< std::vector<unsigned char> > vData; if( !txOut.pubKey.ExtractPushData(vData) || vData.size() < 1 ) { printf("getUserPubKey: broken pubkey for user '%s'\n", strUsername.c_str()); return false; } pubkey = CPubKey(vData[0]); if( !pubkey.IsValid() ) { printf("getUserPubKey: invalid pubkey for user '%s'\n", strUsername.c_str()); return false; } return true; } bool verifySignature(std::string const &strMessage, std::string const &strUsername, std::string const &strSign, int maxHeight) { CPubKey pubkey; if( !getUserPubKey(strUsername, pubkey, maxHeight) ) { printf("verifySignature: no pubkey for user '%s'\n", strUsername.c_str()); return false; } vector<unsigned char> vchSig((const unsigned char*)strSign.data(), (const unsigned char*)strSign.data() + strSign.size()); CHashWriter ss(SER_GETHASH, 0); ss << strMessageMagic; ss << strMessage; CPubKey pubkeyRec; if (!pubkeyRec.RecoverCompact(ss.GetHash(), vchSig)) return false; return (pubkeyRec.GetID() == pubkey.GetID()); } bool processReceivedDM(lazy_entry const* post) { lazy_entry const* dm = post->dict_find_dict("dm"); if( dm ) { ecies_secure_t sec; sec.key = dm->dict_find_string_value("key"); sec.mac = dm->dict_find_string_value("mac"); sec.orig = dm->dict_find_int_value("orig"); sec.body = dm->dict_find_string_value("body"); LOCK(pwalletMain->cs_wallet); BOOST_FOREACH(const PAIRTYPE(CKeyID, CKeyMetadata)& item, pwalletMain->mapKeyMetadata) { CKey key; if (!pwalletMain->GetKey(item.first, key)) { printf("acceptSignedPost: private key not available trying to decrypt DM.\n"); } else { std::string textOut; if( key.Decrypt(sec, textOut) ) { /* this printf is good for debug, but bad for security. printf("Received DM for user '%s' text = '%s'\n", item.second.username.c_str(), textOut.c_str()); */ std::string n = post->dict_find_string_value("n"); StoredDirectMsg stoDM; stoDM.m_fromMe = false; stoDM.m_text = textOut; stoDM.m_utcTime = post->dict_find_int_value("time");; LOCK(cs_twister); // store this dm in memory list, but prevent duplicates std::vector<StoredDirectMsg> &dmsFromToUser = m_users[item.second.username].m_directmsg[n]; std::vector<StoredDirectMsg>::iterator it; for( it = dmsFromToUser.begin(); it != dmsFromToUser.end(); ++it ) { if( stoDM.m_utcTime == (*it).m_utcTime && stoDM.m_text == (*it).m_text ) { break; } if( stoDM.m_utcTime < (*it).m_utcTime && !(*it).m_fromMe) { dmsFromToUser.insert(it, stoDM); break; } } if( it == dmsFromToUser.end() ) { dmsFromToUser.push_back(stoDM); } return true; } } } } return false; } bool acceptSignedPost(char const *data, int data_size, std::string username, int seq, std::string &errmsg, boost::uint32_t *flags) { bool ret = false; char errbuf[200]=""; if( flags ) *flags = 0; lazy_entry v; int pos; libtorrent::error_code ec; if (data_size <= 0 || data_size > 2048 ) { sprintf(errbuf,"bad bencoded post size"); } else if (lazy_bdecode(data, data + data_size, v, ec, &pos) == 0) { if( v.type() == lazy_entry::dict_t ) { lazy_entry const* post = v.dict_find_dict("userpost"); std::string sig = v.dict_find_string_value("sig_userpost"); if( !post || !sig.size() ) { sprintf(errbuf,"missing post or signature."); } else { std::string n = post->dict_find_string_value("n"); std::string msg = post->dict_find_string_value("msg"); int msgUtf8Chars = utf8::num_characters(msg.begin(), msg.end()); int k = post->dict_find_int_value("k",-1); int height = post->dict_find_int_value("height",-1); if( n != username ) { sprintf(errbuf,"expected username '%s' got '%s'", username.c_str(),n.c_str()); } else if( k != seq ) { sprintf(errbuf,"expected piece '%d' got '%d'", seq, k); } else if( !validatePostNumberForUser(username, k) ) { sprintf(errbuf,"too much posts from user '%s' rejecting post", username.c_str()); } else if( height < 0 || (height > getBestHeight()+1 && getBestHeight() > 0) ) { sprintf(errbuf,"post from future not accepted (height: %d > %d)", height, getBestHeight()); } else if( msgUtf8Chars < 0 ) { sprintf(errbuf,"invalid utf8 string"); } else if( msgUtf8Chars > 140 ) { sprintf(errbuf,"msg too big (%d > 140)", msgUtf8Chars); } else { std::pair<char const*, int> postbuf = post->data_section(); ret = verifySignature( std::string(postbuf.first,postbuf.second), username, sig, height); if( !ret ) { sprintf(errbuf,"bad post signature"); } else { lazy_entry const* rt = post->dict_find_dict("rt"); std::string sig_rt = post->dict_find_string_value("sig_rt"); if( rt ) { if( flags ) (*flags) |= USERPOST_FLAG_RT; std::string username_rt = rt->dict_find_string_value("n"); int height_rt = rt->dict_find_int_value("height",-1); std::pair<char const*, int> rtbuf = rt->data_section(); ret = verifySignature( std::string(rtbuf.first,rtbuf.second), username_rt, sig_rt, height_rt); if( !ret ) { sprintf(errbuf,"bad RT signature"); } } lazy_entry const* dm = post->dict_find_dict("dm"); if( dm && flags ) { (*flags) |= USERPOST_FLAG_DM; processReceivedDM(post); } } } } } } errmsg = errbuf; #ifdef DEBUG_ACCEPT_POST if( !ret ) { printf("acceptSignedPost: %s\n",errbuf); } #endif return ret; } bool validatePostNumberForUser(std::string const &username, int k) { CTransaction txOut; uint256 hashBlock; if( !GetTransaction(username, txOut, hashBlock) ) { printf("validatePostNumberForUser: username is unknown\n"); return false; } CBlockIndex* pblockindex = mapBlockIndex[hashBlock]; if( k < 0 ) return false; if( getBestHeight() > 0 && k > 2*(getBestHeight() - pblockindex->nHeight) + 20) return false; return true; } bool usernameExists(std::string const &username) { CTransaction txOut; uint256 hashBlock; return GetTransaction(username, txOut, hashBlock); } /* "userpost" : { "n" : username, "k" : seq number, "t" : "post" / "dm" / "rt" "msg" : message (post/rt) "time" : unix utc "height" : best height at user "dm" : encrypted message (dm) -opt "rt" : original userpost - opt "sig_rt" : sig of rt - opt "reply" : - opt { "n" : reference username "k" : reference k } } "sig_userpost" : signature by userpost.n */ bool createSignedUserpost(entry &v, std::string const &username, int k, std::string const &msg, // either msg.size() or entry const *rt, entry const *sig_rt, // rt != NULL or entry const *dm, // dm != NULL. std::string const &reply_n, int reply_k ) { entry &userpost = v["userpost"]; // userpost["n"] = username; userpost["k"] = k; userpost["time"] = GetAdjustedTime(); userpost["height"] = getBestHeight() - 1; // be conservative if( msg.size() ) { //userpost["t"] = "post"; userpost["msg"] = msg; } else if ( rt != NULL && sig_rt != NULL ) { //userpost["t"] = "rt"; userpost["rt"] = *rt; userpost["sig_rt"] = *sig_rt; } else if ( dm != NULL ) { //userpost["t"] = "dm"; userpost["dm"] = *dm; } else { printf("createSignedUserpost: unknown type\n"); return false; } if( reply_n.size() ) { entry &reply = userpost["reply"]; reply["n"]=reply_n; reply["k"]=reply_k; } // std::vector<char> buf; bencode(std::back_inserter(buf), userpost); std::string sig = createSignature(std::string(buf.data(),buf.size()), username); if( sig.size() ) { v["sig_userpost"] = sig; return true; } else { return false; } } bool createDirectMessage(entry &dm, std::string const &to, std::string const &msg) { CPubKey pubkey; if( !getUserPubKey(to, pubkey) ) { printf("createDirectMessage: no pubkey for user '%s'\n", to.c_str()); return false; } ecies_secure_t sec; bool encrypted = pubkey.Encrypt(msg, sec); if( encrypted ) { dm["key"] = sec.key; dm["mac"] = sec.mac; dm["orig"] = sec.orig; dm["body"] = sec.body; } return encrypted; } int getBestHeight() { return nBestHeight; } bool shouldDhtResourceExpire(std::string resource, bool multi, int height) { if ((height + BLOCK_AGE_TO_EXPIRE_DHT_ENTRY) < getBestHeight() ) { if( multi ) { #ifdef DEBUG_EXPIRE_DHT_ITEM printf("shouldDhtResourceExpire: expiring resource multi '%s'\n", resource.c_str()); #endif return true; } // extract basic resource string (without numbering) std::string resourceBasic; for(size_t i = 0; i < resource.size() && isalpha(resource.at(i)); i++) { resourceBasic.push_back(resource.at(i)); } int resourceNumber = -1; if( resource.length() > resourceBasic.length() ) { // make sure it is a valid number following (all digits) if( resource.at(resourceBasic.length()) == '0' && resource.size() > resourceBasic.length() + 1 ){ // leading zeros not allowed } else { size_t i; for(i = resourceBasic.length(); i < resource.size() && isdigit(resource.at(i)); i++) { } if(i == resource.size()) { resourceNumber = atoi( resource.c_str() + resourceBasic.length() ); } } } if( !m_noExpireResources.count(resourceBasic) ) { // unknown resource. expire it. #ifdef DEBUG_EXPIRE_DHT_ITEM printf("shouldDhtResourceExpire: expiring non-special resource '%s'\n", resource.c_str()); #endif return true; } else { if( m_noExpireResources[resourceBasic] == SimpleNoExpire && resource.length() > resourceBasic.length() ) { // this resource admits no number. expire it! #ifdef DEBUG_EXPIRE_DHT_ITEM printf("shouldDhtResourceExpire: expiring resource with unexpected numbering '%s'\n", resource.c_str()); #endif return true; } if( m_noExpireResources[resourceBasic] == NumberedNoExpire && (resourceNumber < 0 || resourceNumber > 200) ) { // try keeping a sane number here, otherwise expire it! #ifdef DEBUG_EXPIRE_DHT_ITEM printf("shouldDhtResourceExpire: expiring numbered resource with no sane number '%s'\n", resource.c_str()); #endif return true; } if( m_noExpireResources[resourceBasic] == PostNoExpireRecent && resourceNumber < 0 ) { #ifdef DEBUG_EXPIRE_DHT_ITEM printf("shouldDhtResourceExpire: expiring post with invalid numbering '%s'\n", resource.c_str()); #endif return true; } if( m_noExpireResources[resourceBasic] == PostNoExpireRecent && (height + BLOCK_AGE_TO_EXPIRE_DHT_POSTS) < getBestHeight() ) { #ifdef DEBUG_EXPIRE_DHT_ITEM printf("shouldDhtResourceExpire: expiring old post resource '%s' (height %d cur %d)\n", resource.c_str(), height, getBestHeight()); #endif return true; } } } return false; } void receivedSpamMessage(std::string const &message, std::string const &user) { LOCK(cs_spamMsg); bool hasSingleLangCode = (message.find("[") == message.rfind("[")); bool hasPreferredLang = m_preferredSpamLang.length(); bool isSameLang = hasPreferredLang && hasSingleLangCode && message.find(m_preferredSpamLang) != string::npos; bool currentlyEmpty = !m_receivedSpamMsgStr.length(); if( currentlyEmpty || (isSameLang && rand() < (RAND_MAX/2)) ) { m_receivedSpamMsgStr = message; m_receivedSpamUserStr = user; } } void updateSeenHashtags(std::string &message, int64_t msgTime) { if( message.find('#') == string::npos ) return; boost::int64_t curTime = GetAdjustedTime(); if( msgTime > curTime ) msgTime = curTime; double vote = 1.0; if( msgTime + (2*3600) < curTime ) { double timeDiff = (curTime - msgTime); timeDiff /= (2*3600); vote /= timeDiff; } // split and look for hashtags vector<string> tokens; set<string> hashtags; boost::algorithm::split(tokens,message,boost::algorithm::is_any_of(" \n\t.,:/?!;'\"()[]{}*"), boost::algorithm::token_compress_on); BOOST_FOREACH(string const& token, tokens) { if( token.length() >= 2 ) { string word = token.substr(1); #ifdef HAVE_BOOST_LOCALE word = boost::locale::to_lower(word); #else boost::algorithm::to_lower(word); #endif if( token.at(0) == '#') { hashtags.insert(word); } } } if( hashtags.size() ) { LOCK(cs_seenHashtags); BOOST_FOREACH(string const& word, hashtags) { if( m_seenHashtags.count(word) ) { m_seenHashtags[word] += vote; } else { m_seenHashtags[word] = vote; } } } } entry formatSpamPost(const string &msg, const string &username, uint64_t utcTime = 0, int height = 0) { entry v; entry &userpost = v["userpost"]; userpost["n"] = username; userpost["k"] = height ? height : 1; userpost["time"] = utcTime ? utcTime : GetAdjustedTime(); userpost["height"] = height ? height : getBestHeight(); userpost["msg"] = msg; unsigned char vchSig[65]; RAND_bytes(vchSig,sizeof(vchSig)); v["sig_userpost"] = HexStr( string((const char *)vchSig, sizeof(vchSig)) ); return v; } void dhtGetData(std::string const &username, std::string const &resource, bool multi) { if( DhtProxy::fEnabled ) { printf("dhtGetData: not allowed - using proxy (bug!)\n"); return; } boost::shared_ptr<session> ses(m_ses); if( !ses ) { printf("dhtGetData: libtorrent session not ready\n"); return; } ses->dht_getData(username,resource,multi); } void dhtPutData(std::string const &username, std::string const &resource, bool multi, entry const &value, std::string const &sig_user, boost::int64_t timeutc, int seq) { // construct p dictionary and sign it entry p; entry& target = p["target"]; target["n"] = username; target["r"] = resource; target["t"] = (multi) ? "m" : "s"; if (seq >= 0 && !multi) p["seq"] = seq; p["v"] = value; p["time"] = timeutc; int height = getBestHeight()-1; // be conservative p["height"] = height; std::vector<char> pbuf; bencode(std::back_inserter(pbuf), p); std::string str_p = std::string(pbuf.data(),pbuf.size()); std::string sig_p = createSignature(str_p, sig_user); if( !sig_p.size() ) { printf("dhtPutData: createSignature error for user '%s'\n", sig_user.c_str()); return; } if( !DhtProxy::fEnabled ) { dhtPutDataSigned(username,resource,multi,p,sig_p,sig_user, true); } else { DhtProxy::dhtputRequest(username,resource,multi,str_p,sig_p,sig_user); } } void dhtPutDataSigned(std::string const &username, std::string const &resource, bool multi, libtorrent::entry const &p, std::string const &sig_p, std::string const &sig_user, bool local) { if( DhtProxy::fEnabled ) { printf("dhtputDataSigned: not allowed - using proxy (bug!)\n"); return; } boost::shared_ptr<session> ses(m_ses); if( !ses ) { printf("dhtPutData: libtorrent session not ready\n"); return; } ses->dht_putDataSigned(username,resource,multi,p,sig_p,sig_user, local); } Value dhtput(const Array& params, bool fHelp) { if (fHelp || params.size() < 5 || params.size() > 6) throw runtime_error( "dhtput <username> <resource> <s(ingle)/m(ulti)> <value> <sig_user> <seq>\n" "Store resource in dht network"); EnsureWalletIsUnlocked(); string strUsername = params[0].get_str(); string strResource = params[1].get_str(); string strMulti = params[2].get_str(); entry value = jsonToEntry(params[3]); // value is already "p":"v": contents, so post may be unhexcaped directly unHexcapePost(value); string strSigUser = params[4].get_str(); // Test for private key here to avoid going into dht CKeyID keyID; if( !pwalletMain->GetKeyIdFromUsername(strSigUser, keyID) ) throw JSONRPCError(RPC_WALLET_INVALID_ACCOUNT_NAME, "Error: no sig_user in wallet"); CKey key; if (!pwalletMain->GetKey(keyID, key)) throw JSONRPCError(RPC_WALLET_ERROR, "Private key of sig_user not available"); bool multi = (strMulti == "m"); if( !multi && params.size() != 6 ) throw JSONRPCError(RPC_WALLET_ERROR, "Seq parameter required for single"); int seq = -1; if( params.size() == 6 ) seq = params[5].get_int(); if( !multi && strUsername != strSigUser ) throw JSONRPCError(RPC_WALLET_ERROR, "Username must be the same as sig_user for single"); boost::int64_t timeutc = GetAdjustedTime(); dhtPutData(strUsername, strResource, multi, value, strSigUser, timeutc, seq); return Value(); } Value dhtget(const Array& params, bool fHelp) { if (fHelp || params.size() < 3 || params.size() > 6) throw runtime_error( "dhtget <username> <resource> <s(ingle)/m(ulti)> [timeout_ms] [timeout_multi_ms] [min_multi]\n" "Get resource from dht network"); boost::shared_ptr<session> ses(m_ses); if( !ses ) return Array(); string strUsername = params[0].get_str(); string strResource = params[1].get_str(); string strMulti = params[2].get_str(); bool multi = (strMulti == "m"); time_duration timeToWait = seconds(10); time_duration timeToWaitMulti = milliseconds(100); int minMultiReplies = 3; int lastSeq = -1; if( params.size() > 3 ) timeToWait = milliseconds(params[3].get_int()); if( params.size() > 4 ) timeToWaitMulti = milliseconds(params[4].get_int()); if( params.size() > 5 ) minMultiReplies = params[5].get_int(); alert_manager am(10, alert::dht_notification); sha1_hash ih = dhtTargetHash(strUsername,strResource,strMulti); vector<CNode*> dhtProxyNodes; if( !DhtProxy::fEnabled ) { dhtgetMapAdd(ih, &am); dhtGetData(strUsername, strResource, multi); } else { DhtProxy::dhtgetMapAdd(ih, &am); dhtProxyNodes = DhtProxy::dhtgetStartRequest(strUsername, strResource, multi); } Array ret; std::set<std::string> uniqueSigPs; int repliesReceived = 0; while( am.wait_for_alert(timeToWait) ) { std::auto_ptr<alert> a(am.get()); dht_reply_data_alert const* rd = alert_cast<dht_reply_data_alert>(&(*a)); if( rd ) { entry::list_type dhtLst = rd->m_lst; entry::list_type::iterator it; for( it = dhtLst.begin(); it != dhtLst.end(); ++it ) { libtorrent::entry &e = *it; hexcapeDht( e ); string sig_p = safeGetEntryString(e, "sig_p"); int seq = (multi) ? 0 : safeGetEntryInt( safeGetEntryDict(e,"p"), "seq" ); bool acceptEntry = (multi) ? (!sig_p.length() || !uniqueSigPs.count(sig_p)) : (seq > lastSeq); if( acceptEntry ) { if( !multi) { ret.clear(); } ret.push_back( entryToJson(e) ); lastSeq = seq; if( sig_p.length() ) { uniqueSigPs.insert(sig_p); } } } //printf("dhtget: got %zd entries %zd unique\n", dhtLst.size(), uniqueSigPs.size()); } else { // cast failed => dht_reply_data_done_alert => no data break; } if( repliesReceived++ < minMultiReplies ) { timeToWait = timeToWaitMulti; //printf("dhtget: wait again repliesReceived=%d lastSeq=%d\n", repliesReceived, lastSeq); } else { break; } } if( !DhtProxy::fEnabled ) { dhtgetMapRemove(ih,&am); } else { DhtProxy::dhtgetMapRemove(ih,&am); DhtProxy::dhtgetStopRequest(dhtProxyNodes, strUsername, strResource, multi); } return ret; } int findLastPublicPostLocalUser( std::string strUsername ) { int lastk = -1; torrent_handle h = getTorrentUser(strUsername); if( h.is_valid() ){ std::vector<std::string> pieces; int max_id = std::numeric_limits<int>::max(); int since_id = -1; h.get_pieces(pieces, 1, max_id, since_id, USERPOST_FLAG_RT); if( pieces.size() ) { string const& piece = pieces.front(); lazy_entry v; int pos; libtorrent::error_code ec; if (lazy_bdecode(piece.data(), piece.data()+piece.size(), v, ec, &pos) == 0) { lazy_entry const* post = v.dict_find_dict("userpost"); lastk = post->dict_find_int_value("k",-1); } } } return lastk; } Value newpostmsg(const Array& params, bool fHelp) { if (fHelp || (params.size() != 3 && params.size() != 5)) throw runtime_error( "newpostmsg <username> <k> <msg> [reply_n] [reply_k]\n" "Post a new message to swarm"); EnsureWalletIsUnlocked(); string strUsername = params[0].get_str(); int k = params[1].get_int(); string strK = boost::lexical_cast<std::string>(k); string strMsg = params[2].get_str(); string strReplyN, strReplyK; int replyK = 0; if( params.size() == 5 ) { strReplyN = params[3].get_str(); replyK = params[4].get_int(); strReplyK = boost::lexical_cast<std::string>(replyK); } entry v; // [MF] Warning: findLastPublicPostLocalUser requires that we follow ourselves int lastk = findLastPublicPostLocalUser(strUsername); if( lastk >= 0 ) v["userpost"]["lastk"] = lastk; if( !createSignedUserpost(v, strUsername, k, strMsg, NULL, NULL, NULL, strReplyN, replyK) ) throw JSONRPCError(RPC_INTERNAL_ERROR,"error signing post with private key of user"); vector<char> buf; bencode(std::back_inserter(buf), v); std::string errmsg; if( !acceptSignedPost(buf.data(),buf.size(),strUsername,k,errmsg,NULL) ) throw JSONRPCError(RPC_INVALID_PARAMS,errmsg); torrent_handle h = startTorrentUser(strUsername, true); if( h.is_valid() ) { // if member of torrent post it directly h.add_piece(k,buf.data(),buf.size()); } else { // TODO: swarm resource forwarding not implemented dhtPutData(strUsername, "swarm", false, v, strUsername, GetAdjustedTime(), 1); } // post to dht as well dhtPutData(strUsername, string("post")+strK, false, v, strUsername, GetAdjustedTime(), 1); dhtPutData(strUsername, string("status"), false, v, strUsername, GetAdjustedTime(), k); // is this a reply? notify if( strReplyN.length() ) { dhtPutData(strReplyN, string("replies")+strReplyK, true, v, strUsername, GetAdjustedTime(), 0); } // split and look for mentions and hashtags vector<string> tokens; boost::algorithm::split(tokens,strMsg,boost::algorithm::is_any_of(" \n\t.,:/?!;'\"()[]{}*"), boost::algorithm::token_compress_on); BOOST_FOREACH(string const& token, tokens) { if( token.length() >= 2 ) { string word = token.substr(1); #ifdef HAVE_BOOST_LOCALE word = boost::locale::to_lower(word); #else boost::algorithm::to_lower(word); #endif if( token.at(0) == '#') { dhtPutData(word, "hashtag", true, v, strUsername, GetAdjustedTime(), 0); } else if( token.at(0) == '@') { dhtPutData(word, "mention", true, v, strUsername, GetAdjustedTime(), 0); } } } hexcapePost(v); return entryToJson(v); } Value newdirectmsg(const Array& params, bool fHelp) { if (fHelp || params.size() != 4) throw runtime_error( "newdirectmsg <from> <k> <to> <msg>\n" "Post a new dm to swarm"); EnsureWalletIsUnlocked(); string strFrom = params[0].get_str(); int k = params[1].get_int(); string strTo = params[2].get_str(); string strMsg = params[3].get_str(); entry dm; if( !createDirectMessage(dm, strTo, strMsg) ) throw JSONRPCError(RPC_INTERNAL_ERROR, "error encrypting to pubkey of destination user"); entry v; if( !createSignedUserpost(v, strFrom, k, "", NULL, NULL, &dm, std::string(""), 0) ) throw JSONRPCError(RPC_INTERNAL_ERROR,"error signing post with private key of user"); std::vector<char> buf; bencode(std::back_inserter(buf), v); std::string errmsg; if( !acceptSignedPost(buf.data(),buf.size(),strFrom,k,errmsg,NULL) ) throw JSONRPCError(RPC_INVALID_PARAMS,errmsg); { StoredDirectMsg stoDM; stoDM.m_fromMe = true; stoDM.m_text = strMsg; stoDM.m_utcTime = v["userpost"]["time"].integer(); LOCK(cs_twister); m_users[strFrom].m_directmsg[strTo].push_back(stoDM); } torrent_handle h = startTorrentUser(strFrom, true); h.add_piece(k,buf.data(),buf.size()); hexcapePost(v); return entryToJson(v); } Value newrtmsg(const Array& params, bool fHelp) { if (fHelp || (params.size() != 3)) throw runtime_error( "newrtmsg <username> <k> <rt_v_object>\n" "Post a new RT to swarm"); EnsureWalletIsUnlocked(); string strUsername = params[0].get_str(); int k = params[1].get_int(); string strK = boost::lexical_cast<std::string>(k); entry vrt = jsonToEntry(params[2].get_obj()); unHexcapePost(vrt); entry const *rt = vrt.find_key("userpost"); entry const *sig_rt= vrt.find_key("sig_userpost"); entry v; // [MF] Warning: findLastPublicPostLocalUser requires that we follow ourselves int lastk = findLastPublicPostLocalUser(strUsername); if( lastk >= 0 ) v["userpost"]["lastk"] = lastk; if( !createSignedUserpost(v, strUsername, k, "", rt, sig_rt, NULL, std::string(""), 0) ) throw JSONRPCError(RPC_INTERNAL_ERROR,"error signing post with private key of user"); vector<char> buf; bencode(std::back_inserter(buf), v); std::string errmsg; if( !acceptSignedPost(buf.data(),buf.size(),strUsername,k,errmsg,NULL) ) throw JSONRPCError(RPC_INVALID_PARAMS,errmsg); torrent_handle h = startTorrentUser(strUsername, true); if( h.is_valid() ) { // if member of torrent post it directly h.add_piece(k,buf.data(),buf.size()); } else { // TODO: swarm resource forwarding not implemented dhtPutData(strUsername, "swarm", false, v, strUsername, GetAdjustedTime(), 1); } // post to dht as well dhtPutData(strUsername, string("post")+strK, false, v, strUsername, GetAdjustedTime(), 1); dhtPutData(strUsername, string("status"), false, v, strUsername, GetAdjustedTime(), k); // notification to keep track of RTs of the original post if( rt ) { string rt_user = rt->find_key("n")->string(); string rt_k = boost::lexical_cast<std::string>(rt->find_key("k")->integer()); dhtPutData(rt_user, string("rts")+rt_k, true, v, strUsername, GetAdjustedTime(), 0); } hexcapePost(v); return entryToJson(v); } Value getposts(const Array& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 3) throw runtime_error( "getposts <count> '[{\"username\":username,\"max_id\":max_id,\"since_id\":since_id},...]' [flags]\n" "get posts from users\n" "max_id and since_id may be omited"); int count = params[0].get_int(); Array users = params[1].get_array(); int flags = (params.size() > 2) ? params[2].get_int() : USERPOST_FLAG_RT; std::multimap<int64,entry> postsByTime; for( unsigned int u = 0; u < users.size(); u++ ) { Object user = users[u].get_obj(); string strUsername; int max_id = std::numeric_limits<int>::max(); int since_id = -1; for (Object::const_iterator i = user.begin(); i != user.end(); ++i) { if( i->name_ == "username" ) strUsername = i->value_.get_str(); if( i->name_ == "max_id" ) max_id = i->value_.get_int(); if( i->name_ == "since_id" ) since_id = i->value_.get_int(); } torrent_handle h = getTorrentUser(strUsername); if( h.is_valid() ){ std::vector<std::string> pieces; h.get_pieces(pieces, count, max_id, since_id, flags); BOOST_FOREACH(string const& piece, pieces) { lazy_entry v; int pos; libtorrent::error_code ec; if (lazy_bdecode(piece.data(), piece.data()+piece.size(), v, ec, &pos) == 0) { lazy_entry const* post = v.dict_find_dict("userpost"); int64 time = post->dict_find_int_value("time",-1); entry vEntry; vEntry = v; hexcapePost(vEntry); postsByTime.insert( pair<int64,entry>(time, vEntry) ); } } } } Array ret; std::multimap<int64,entry>::reverse_iterator rit; for (rit=postsByTime.rbegin(); rit!=postsByTime.rend() && (int)ret.size() < count; ++rit) { ret.push_back( entryToJson(rit->second) ); } { LOCK(cs_spamMsg); // we must agree on an acceptable level here // what about one every eight hours? (not cumulative) if( m_receivedSpamMsgStr.length() && GetAdjustedTime() > m_lastSpamTime + (8*3600) ) { m_lastSpamTime = GetAdjustedTime(); entry v = formatSpamPost(m_receivedSpamMsgStr, m_receivedSpamUserStr); ret.insert(ret.begin(),entryToJson(v)); m_receivedSpamMsgStr = ""; m_receivedSpamUserStr = ""; } } return ret; } Value getdirectmsgs(const Array& params, bool fHelp) { if (fHelp || params.size() != 3) throw runtime_error( "getdirectmsgs <localuser> <count_per_user> '[{\"username\":username,\"max_id\":max_id,\"since_id\":since_id},...]'\n" "get (locally stored) decrypted direct messages sent/received by user <localuser>\n" "max_id and since_id may be omited. up to <count_per_user> are returned for each remote user."); string strUsername = params[0].get_str(); int count = params[1].get_int(); Array remoteusers = params[2].get_array(); Object ret; for( unsigned int u = 0; u < remoteusers.size(); u++ ) { Object remoteUser = remoteusers[u].get_obj(); string remoteUsername; int max_id = std::numeric_limits<int>::max(); int since_id = -1; for (Object::const_iterator i = remoteUser.begin(); i != remoteUser.end(); ++i) { if( i->name_ == "username" ) remoteUsername = i->value_.get_str(); if( i->name_ == "max_id" ) max_id = i->value_.get_int(); if( i->name_ == "since_id" ) since_id = i->value_.get_int(); } LOCK(cs_twister); if( remoteUsername.size() && m_users.count(strUsername) && m_users[strUsername].m_directmsg.count(remoteUsername) ){ std::vector<StoredDirectMsg> &dmsFromToUser = m_users[strUsername].m_directmsg[remoteUsername]; max_id = std::min( max_id, (int)dmsFromToUser.size()-1); since_id = std::max( since_id, max_id - count ); Array userMsgs; for( int i = std::max(since_id+1,0); i <= max_id; i++) { Object dmObj; dmObj.push_back(Pair("id",i)); dmObj.push_back(Pair("time",dmsFromToUser.at(i).m_utcTime)); dmObj.push_back(Pair("text",dmsFromToUser.at(i).m_text)); dmObj.push_back(Pair("fromMe",dmsFromToUser.at(i).m_fromMe)); userMsgs.push_back(dmObj); } if( userMsgs.size() ) { ret.push_back(Pair(remoteUsername,userMsgs)); } } } return ret; } Value setspammsg(const Array& params, bool fHelp) { if (fHelp || (params.size() != 2)) throw runtime_error( "setspammsg <username> <msg>\n" "Set spam message attached to generated blocks"); string strUsername = params[0].get_str(); string strMsg = params[1].get_str(); int spamMsgUtf8Size = utf8::num_characters(strMsg.begin(), strMsg.end()); if (spamMsgUtf8Size < 0) throw JSONRPCError(RPC_INTERNAL_ERROR, "spam message invalid utf8"); if (spamMsgUtf8Size == 0) throw JSONRPCError(RPC_INTERNAL_ERROR, "empty spam message"); if (spamMsgUtf8Size > MAX_SPAM_MSG_SIZE) throw JSONRPCError(RPC_INTERNAL_ERROR, "spam message too big"); strSpamUser = strUsername; strSpamMessage = strMsg; return Value(); } Value getspammsg(const Array& params, bool fHelp) { if (fHelp || (params.size() != 0)) throw runtime_error( "getspammsg\n" "get spam message attached to generated blocks"); Array ret; ret.push_back(strSpamUser); ret.push_back(strSpamMessage); return ret; } Value follow(const Array& params, bool fHelp) { if (fHelp || (params.size() != 2)) throw runtime_error( "follow <username> [follow_username1,follow_username2,...]\n" "start following users"); string localUser = params[0].get_str(); Array users = params[1].get_array(); for( unsigned int u = 0; u < users.size(); u++ ) { string username = users[u].get_str(); torrent_handle h = startTorrentUser(username, true); if( h.is_valid() ) { LOCK(cs_twister); m_users[localUser].m_following.insert(username); } } return Value(); } Value unfollow(const Array& params, bool fHelp) { if (fHelp || (params.size() != 2)) throw runtime_error( "unfollow <username> [unfollow_username1,unfollow_username2,...]\n" "stop following users"); string localUser = params[0].get_str(); Array users = params[1].get_array(); LOCK(cs_twister); for( unsigned int u = 0; u < users.size(); u++ ) { string username = users[u].get_str(); if( m_users.count(localUser) && m_users[localUser].m_following.count(username) ) { m_users[localUser].m_following.erase(username); } } return Value(); } Value getfollowing(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "getfollowing <username>\n" "get list of users we follow"); string localUser = params[0].get_str(); Array ret; LOCK(cs_twister); if( m_users.count(localUser) ) { BOOST_FOREACH(string username, m_users[localUser].m_following) { ret.push_back(username); } } return ret; } Value getlasthave(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "getlasthave <username>\n" "get last 'have' (higher post number) of each user user we follow"); string localUser = params[0].get_str(); std::set<std::string> following; { LOCK(cs_twister); if( m_users.count(localUser) ) following = m_users[localUser].m_following; } Object ret; BOOST_FOREACH(string username, following) { ret.push_back(Pair(username,torrentLastHave(username))); } return ret; } Value getnumpieces(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "getnumpieces <username>\n" "get number of posts already downloaded for each user user we follow"); string localUser = params[0].get_str(); std::set<std::string> following; { LOCK(cs_twister); if( m_users.count(localUser) ) following = m_users[localUser].m_following; } Object ret; BOOST_FOREACH(string username, following) { ret.push_back(Pair(username,torrentNumPieces(username))); } return ret; } Value listusernamespartial(const Array& params, bool fHelp) { if (fHelp || (params.size() < 2 || params.size() > 3)) throw runtime_error( "listusernamespartial <username_starts_with> <count> [exact_match=false]\n" "get list of usernames starting with"); string userStartsWith = params[0].get_str(); size_t count = params[1].get_int(); bool exact_match = false; if( params.size() > 2 ) exact_match = params[2].get_bool(); set<string> retStrings; // priorize users in following list { LOCK(pwalletMain->cs_wallet); BOOST_FOREACH(const PAIRTYPE(CKeyID, CKeyMetadata)& item, pwalletMain->mapKeyMetadata) { LOCK(cs_twister); BOOST_FOREACH(const string &user, m_users[item.second.username].m_following) { if( (exact_match && userStartsWith.size() != user.size()) || userStartsWith.size() > user.size() ) { continue; } int toCompare = userStartsWith.size(); if( memcmp( user.data(), userStartsWith.data(), toCompare ) == 0 ) retStrings.insert( user ); if( retStrings.size() >= count ) break; } } } pblocktree->GetNamesFromPartial(userStartsWith, retStrings, count); Array ret; BOOST_FOREACH(string username, retStrings) { ret.push_back(username); } return ret; } Value rescandirectmsgs(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "rescandirectmsgs <username>\n" "rescan all streams of users we follow for new and old directmessages"); string localUser = params[0].get_str(); std::set<std::string> following; { LOCK(cs_twister); following = m_users[localUser].m_following; } BOOST_FOREACH(string username, following) { torrent_handle h = getTorrentUser(username); if( h.is_valid() ){ h.recheck_pieces(USERPOST_FLAG_DM); } } return Value(); } Value recheckusertorrent(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "recheckusertorrent <username>\n" "recheck all posts in a given torrent. this may be useful if\n" "post validation rules became stricter"); string localUser = params[0].get_str(); torrent_handle h = getTorrentUser(localUser); if( h.is_valid() ){ h.force_recheck(); } return Value(); } Value gettrendinghashtags(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "gettrendinghashtags <count>\n" "obtain list of trending hashtags"); size_t count = params[0].get_int(); std::map<double,std::string> sortedHashtags; { LOCK(cs_seenHashtags); BOOST_FOREACH(const PAIRTYPE(std::string,double)& item, m_seenHashtags) { sortedHashtags[item.second]=item.first; } } Array ret; BOOST_REVERSE_FOREACH(const PAIRTYPE(double, std::string)& item, sortedHashtags) { if( ret.size() >= count ) break; ret.push_back(item.second); } return ret; } Value getspamposts(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 3) throw runtime_error( "getspamposts <count> [max_id] [since_id]\n" "get spam posts from blockchain\n" "max_id and since_id may be omited (or -1)"); int count = params[0].get_int(); int max_id = getBestHeight(); if (params.size() > 1 && params[1].get_int() != -1) max_id = std::min(params[1].get_int(), max_id); int since_id = -1; if (params.size() > 2) since_id = std::max(params[2].get_int(), since_id); Array ret; std::string lastMsg; for( int height = max_id; height > since_id && (int)ret.size() < count; height-- ) { CBlockIndex* pblockindex = FindBlockByHeight(height); CBlock block; ReadBlockFromDisk(block, pblockindex); const CTransaction &tx = block.vtx[0]; if( tx.IsSpamMessage() ) { std::string spamMessage = tx.message.ExtractPushDataString(0); std::string spamUser = tx.userName.ExtractPushDataString(0); // remove consecutive duplicates if( spamMessage == lastMsg) continue; lastMsg = spamMessage; entry v = formatSpamPost(spamMessage, spamUser, block.GetBlockTime(), height); ret.insert(ret.begin(),entryToJson(v)); } } return ret; } Value torrentstatus(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1)) throw runtime_error( "torrentstatus <username>\n" "report torrent status"); string localUser = params[0].get_str(); torrent_handle h = getTorrentUser(localUser); if( !h.is_valid() ){ return Value(); } torrent_status status = h.status(); Object result; result.push_back(Pair("state", status.state)); result.push_back(Pair("paused", status.paused)); result.push_back(Pair("auto_managed", status.auto_managed)); result.push_back(Pair("num_peers", status.num_peers)); result.push_back(Pair("list_peers", status.list_peers)); result.push_back(Pair("connect_candidates", status.connect_candidates)); result.push_back(Pair("num_connections", status.num_connections)); result.push_back(Pair("num_complete", status.num_complete)); result.push_back(Pair("num_pieces", status.num_pieces)); string bitfield; for(std::size_t i = 0; i < status.pieces.size(); i++) { bitfield.append( status.pieces[i]?"1":"0" ); } result.push_back(Pair("bitfield", bitfield)); result.push_back(Pair("has_incoming", status.has_incoming)); result.push_back(Pair("priority", status.priority)); result.push_back(Pair("queue_position", status.queue_position)); Array peers; std::vector<peer_info> peerInfos; h.get_peer_info(peerInfos); BOOST_FOREACH(const peer_info &p, peerInfos) { Object info; info.push_back(Pair("addr", p.ip.address().to_string() + ":" + boost::lexical_cast<std::string>(p.ip.port()))); char flags[10]; sprintf(flags,"0x%x",p.flags); info.push_back(Pair("flags",flags)); info.push_back(Pair("connection_type", p.connection_type)); info.push_back(Pair("download_queue_length", p.download_queue_length)); info.push_back(Pair("failcount", p.failcount)); bitfield = ""; for(std::size_t i = 0; i < p.pieces.size(); i++) { bitfield.append( p.pieces[i]?"1":"0" ); } info.push_back(Pair("bitfield", bitfield)); peers.push_back(info); } result.push_back(Pair("peers", peers)); return result; }
92f1a647dadc984f97c782714ee436e93104b9d4
157c466d9577b48400bd00bf4f3c4d7a48f71e20
/Source/ProjectR/UI/DeckManagement/UP_DeckManager_CS.cpp
c395147bac37245980e8bf6afeb5dd9f8203fa26
[]
no_license
SeungyulOh/OverlordSource
55015d357297393c7315c798f6813a9daba28b15
2e2339183bf847663d8f1722ed0f932fed6c7516
refs/heads/master
2020-04-19T16:00:25.346619
2019-01-30T06:41:12
2019-01-30T06:41:12
168,291,223
8
1
null
null
null
null
UTF-8
C++
false
false
12,913
cpp
UP_DeckManager_CS.cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "ProjectR.h" #include "UP_DeckManager_CS.h" #include "Global/RGameInstance.h" #include "Global/RealTimeModManager.h" #include "Network/HttpRequestClient.h" #include "Network/RTSManager.h" #include "UI/Common/ScrollView/UP_HeroScrollView_Bottom.h" #include "UI/Common/Renewal_BaseHeroIcon.h" #include "UtilFunctionIntegrated.h" #include "UP_GenericScrollview.h" #include "UC_HeroDeck.h" const int32 Stamina = 5; void UUP_DeckManager_CS::NativeConstruct() { Super::NativeConstruct(); /*Blackboard Setting Start*/ Blackboard = &(UUIFunctionLibrary::GetGenericScrollview()->Blackboard); Blackboard->SelectedHeroUDs.Init(TEXT(""), MAX_DECKCOUNT); Blackboard->OnBBStateChanged.AddDynamic(this, &UUP_DeckManager_CS::Update_FromBlackboard); Blackboard->TargetWidgetArray.Empty(); for (size_t i = 0; i < Variables.MyGroupDeck->Decks.Num(); ++i) { URBaseDeckWidget* BaseDeckWidget = Cast<URBaseDeckWidget>(Variables.MyGroupDeck->Decks[i]); if (BaseDeckWidget) { Blackboard->TargetWidgetArray.Emplace(BaseDeckWidget); } } /*Blackboard Setting End*/ /*StateController Setting Start*/ StateController = &(UUIFunctionLibrary::GetGenericScrollview()->StateController); /*StateController Setting End*/ /*Renderer*/ Renderer.blackboard = Blackboard; Renderer.StateController = StateController; Renderer.variables = &Variables; Renderer.Prepare(); Renderer.Render(); URGameInstance* RGameInstance = RGAMEINSTANCE(this); for (auto& Element : RGameInstance->RealTimeModManager->RTSPlayerList) { Render_First(Element.Value.kId); } /*Renderer End*/ RGAMEINSTANCE(GEngine)->ColosseumManager->OnUpdateColosseumTeamAvatar.RemoveDynamic(this, &UUP_DeckManager_CS::Render_First); RGAMEINSTANCE(GEngine)->ColosseumManager->OnUpdateColosseumTeamAvatar.AddDynamic(this, &UUP_DeckManager_CS::Render_First); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnReceiveCSDeckSelect.RemoveDynamic(this, &UUP_DeckManager_CS::Render_EnemyDeck); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnReceiveCSDeckSelect.AddDynamic(this, &UUP_DeckManager_CS::Render_EnemyDeck); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnCSDeckSelectTime.RemoveDynamic(this, &UUP_DeckManager_CS::Render_Time); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnCSDeckSelectTime.AddDynamic(this, &UUP_DeckManager_CS::Render_Time); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnCSStepAndGo.RemoveDynamic(this, &UUP_DeckManager_CS::OnStepGo); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnCSStepAndGo.AddDynamic(this, &UUP_DeckManager_CS::OnStepGo); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnReceiveCSReady.RemoveDynamic(this, &UUP_DeckManager_CS::OnReceiveReady); RGAMEINSTANCE(GEngine)->RealTimeModManager->OnReceiveCSReady.AddDynamic(this, &UUP_DeckManager_CS::OnReceiveReady); if (IsValid(Variables.Button_QuickStart)) { Variables.Button_QuickStart->OnClicked.Clear(); Variables.Button_QuickStart->OnClicked.AddDynamic(this, &UUP_DeckManager_CS::AutoSettings); } if (IsValid(Variables.Button_SelectHero)) { Variables.Button_SelectHero->OnClicked.Clear(); Variables.Button_SelectHero->OnClicked.AddDynamic(this, &UUP_DeckManager_CS::OnClick_Start); } if (IsValid(Variables.Button_DeselectAll)) { Variables.Button_DeselectAll->OnClicked.Clear(); Variables.Button_DeselectAll->OnClicked.AddDynamic(this, &UUP_DeckManager_CS::DeselectAll); } if (IsValid(Variables.Button_Back)) { Variables.Button_Back->OnClicked.Clear(); Variables.Button_Back->OnClicked.AddDynamic(this, &UUP_DeckManager_CS::Onclick_BackButton); } IsReady = false; } void UUP_DeckManager_CS::NativeDestruct() { Blackboard->OnBBStateChanged.RemoveDynamic(this, &UUP_DeckManager_CS::Update_FromBlackboard); UUP_GenericScrollview* GenericScrollview = UUIFunctionLibrary::GetGenericScrollview(); if (GenericScrollview) { GenericScrollview->Appear(false); } Super::NativeDestruct(); } void UUP_DeckManager_CS::Update_FromBlackboard() { Renderer.Render(); } void UUP_DeckManager_CS::Render_First(int32 UserKID) { URGameInstance* RGameInstance = RGAMEINSTANCE(this); FRTS_PLAYER* Player = RGameInstance->RealTimeModManager->Get_RTS_Player(UserKID); if (Player) { if (RGameInstance->HttpClient->GetKID() == UserKID) { if (IsValid(Variables.LAvatarNameText)) Variables.LAvatarNameText->SetText(FText::FromString(Player->nick)); if (IsValid(Variables.LGuildName)) Variables.LGuildName->SetText(FText::FromString(Player->guild)); if (IsValid(Variables.LAvatarLevel)) Variables.LAvatarLevel->SetText(FText::FromString(FString::FromInt(Player->level))); } else { if (IsValid(Variables.RAvatarNameText)) Variables.RAvatarNameText->SetText(FText::FromString(Player->nick)); if (IsValid(Variables.RGuildName)) Variables.RGuildName->SetText(FText::FromString(Player->guild)); if (IsValid(Variables.RAvatarLevel)) Variables.RAvatarLevel->SetText(FText::FromString(FString::FromInt(Player->level))); } } } void UUP_DeckManager_CS::Render_EnemyDeck(FCSDeckSelected InDeckSelected) { if (RGAMEINSTANCE(GEngine)->HttpClient->IsValidKID(InDeckSelected.kId)) return; int32 idx = InDeckSelected.crewNo - 1; if (Variables.EnemyGroupDeck->Decks.IsValidIndex(idx)) { UUC_Colosseum_Deck_New* deck = Cast<UUC_Colosseum_Deck_New>(Variables.EnemyGroupDeck->Decks[idx]); if (deck && deck->HeroIcon) { if (!InDeckSelected.heroId.IsEmpty()) deck->SelectingSwitcher->SetActiveWidgetIndex(1); else deck->SelectingSwitcher->SetActiveWidgetIndex(0); deck->HeroIcon->SetHeroIcon(InDeckSelected.heroId, InDeckSelected.level); } else { UUC_HeroDeck* herodeck = Cast<UUC_HeroDeck>(Variables.EnemyGroupDeck->Decks[idx]); if (herodeck) { herodeck->SetHeroWithID(InDeckSelected.heroId); } } } } void UUP_DeckManager_CS::Render_Time(int32 Time) { FString MinText, SecText; UDescriptionFunctionLibrary::GetTimeStr((float)Time, MinText, SecText); if (IsValid(Variables.TextBlock_PickTimer)) Variables.TextBlock_PickTimer->SetText(FText::Format(FText::FromString(TEXT("{0}")), FText::AsNumber(Time))); } void UUP_DeckManager_CS::OnClick_Start() { /*Enough Stamina ?*/ /*Leader selected ?*/ auto CheckStartCondition = [=]() -> bool { if (!Blackboard->SelectedHeroUDs[ROLE_LEADER_INDEX].IsEmpty()) return true; else { UUIFunctionLibrary::ShowCommonPopup( UUtilFunctionLibrary::GetLocalizedString(EStringTableType::VE_UI, COMMONSTRING_WARNING), UUtilFunctionLibrary::GetLocalizedString(EStringTableType::VE_SystemMessage, TEXT("Confirm_Message_000045")) , ECommonPopupType::VE_OK); } return false; }; if (CheckStartCondition()) { /*Rearrange*/ if (Blackboard->SelectedHeroUDs[ROLE_CREW1_BATTLE_INDEX].IsEmpty() && !Blackboard->SelectedHeroUDs[ROLE_CREW1_REST_INDEX].IsEmpty()) { Swap<FString>(Blackboard->SelectedHeroUDs[ROLE_CREW1_BATTLE_INDEX], Blackboard->SelectedHeroUDs[ROLE_CREW1_REST_INDEX]); } if (Blackboard->SelectedHeroUDs[ROLE_CREW2_BATTLE_INDEX].IsEmpty() && !Blackboard->SelectedHeroUDs[ROLE_CREW2_REST_INDEX].IsEmpty()) { Swap<FString>(Blackboard->SelectedHeroUDs[ROLE_CREW2_BATTLE_INDEX], Blackboard->SelectedHeroUDs[ROLE_CREW2_REST_INDEX]); } /**/ for (size_t i = 0; i < Blackboard->SelectedHeroUDs.Num(); ++i) StateController->SendSelectPacket(i); URTSManager::GetInstancePtr()->REQ_CS_DECK_SELECT_READY(true); } } void UUP_DeckManager_CS::OnStepGo(int32 Sequence) { if (!IsReady) { AutoSettings(); URTSManager::GetInstancePtr()->REQ_CS_DECK_SELECT_READY(true); } URTSManager::GetInstancePtr()->ACK_STEP_AND_GO(Sequence); } void UUP_DeckManager_CS::OnReceiveReady(int32 InKid, bool InReady) { URGameInstance* RGameInstance = RGAMEINSTANCE(this); if (RGameInstance->HttpClient->GetKID() == InKid) { IsReady = InReady; if (IsReady) { Variables.Text_Ready->SetText(UUtilFunctionLibrary::GetLocalizedString(EStringTableType::VE_UI, FName(TEXT("UP_Guild_Management_Menu36")))); URScrollView* Scrollview = UUIFunctionLibrary::GetGenericScrollview()->Variables.ScrollView; Scrollview->IsSelectEnable = false; for (size_t i = 0; i < Variables.MyGroupDeck->Decks.Num(); ++i) { UUC_Colosseum_Deck_New* deck = Cast<UUC_Colosseum_Deck_New>(Variables.MyGroupDeck->Decks[i]); if (IsValid(deck)) deck->InputButton->OnClicked.Clear(); } } else Variables.Text_Ready->SetText(UUtilFunctionLibrary::GetLocalizedString(EStringTableType::VE_UI, FName(TEXT("UI_Colosseum_Complete")))); } } void UUP_DeckManager_CS::AutoSettings() { Blackboard->WaitingList.clear(); StateController->SetState(EUserBehaviorState::AUTOSETTING_ALL); Blackboard->OnBBStateChanged.Broadcast(); } void UUP_DeckManager_CS::DeselectAll() { Blackboard->WaitingList.clear(); StateController->SetState(EUserBehaviorState::DESELECT_ALL); Blackboard->OnBBStateChanged.Broadcast(); } void UUP_DeckManager_CS::Onclick_BackButton() { URTSManager::GetInstancePtr()->REQ_MATCH_CANCEL(); RGAMEINSTANCE(this)->RWidgetManager->ChangeUIPage(EUIPageEnum::UIPage_ColosseumLobby); } void FRenderer_CSDeckManager::Prepare() { variables->MyGroupDeck->TeamSwitcher->SetActiveWidgetIndex(0); variables->EnemyGroupDeck->TeamSwitcher->SetActiveWidgetIndex(1); } void FRenderer_CSDeckManager::Render() { EUserBehaviorState UserState = StateController->UserState; switch (UserState) { case EUserBehaviorState::IDLE: { auto HideAvailableImage = [](TArray<URBaseDeckWidget*> InArray) { for (size_t i = 0; i < InArray.Num(); ++i) { if (InArray.IsValidIndex(i)) { InArray[i]->SetAvailable(false); InArray[i]->SetSelecting(false); } } }; HideAvailableImage(variables->MyGroupDeck->Decks); HideAvailableImage(variables->EnemyGroupDeck->Decks); for (int32 i = 0; i < MAX_DECKCOUNT; ++i) { FString heroUD = blackboard->SelectedHeroUDs[i]; if (variables->MyGroupDeck->Decks.IsValidIndex(i)) variables->MyGroupDeck->Decks[i]->SetHero(heroUD); } break; } case EUserBehaviorState::SELECTING_START: { auto FindAvailableDeck = [](TArray<URBaseDeckWidget *> InArray, int32 Targetidx) { for (size_t i = 0; i < InArray.Num(); ++i) { if (InArray.IsValidIndex(i)) { if(i==Targetidx) InArray[i]->SetSelecting(true); } } }; UUserWidget *widget = blackboard->WaitingList.front(); URBaseDeckWidget *Waiting_Deck = Cast<URBaseDeckWidget>(widget); if (Waiting_Deck) { int32 iIdx = blackboard->TargetWidgetArray.Find(Waiting_Deck); if (iIdx != INDEX_NONE) FindAvailableDeck(variables->MyGroupDeck->Decks, iIdx); } break; } case EUserBehaviorState::CHANGING_START: { if (blackboard->WaitingList.size() == 1) { URBaseDeckWidget *heroDeck = Cast<URBaseDeckWidget>(blackboard->WaitingList.front()); if (heroDeck) { int32 iIdx = variables->MyGroupDeck->Decks.Find(heroDeck); if (iIdx != INDEX_NONE) { auto FindAvailableDeck = [=](TArray<URBaseDeckWidget *> InArray) { for (size_t i = 0; i < InArray.Num(); ++i) { if (i == iIdx) { InArray[i]->SetSelecting(true); continue; } if (InArray.IsValidIndex(i)) InArray[i]->SetAvailable(true); } }; FindAvailableDeck(variables->MyGroupDeck->Decks); } } } break; } } } void UUC_Colosseum_GroupDeck::NativeConstruct() { Super::NativeConstruct(); } void UUC_Colosseum_GroupDeck::NativeDestruct() { Super::NativeDestruct(); } void UUC_Colosseum_Deck_New::NativeConstruct() { Super::NativeConstruct(); SelectingSwitcher->SetActiveWidgetIndex(0); HeroIcon->SetVisibility(ESlateVisibility::Collapsed); if (IsValid(InputButton)) { InputButton->OnClicked.Clear(); InputButton->OnClicked.AddDynamic(this, &UUC_Colosseum_Deck_New::OnClick_Deck); } } void UUC_Colosseum_Deck_New::NativeDestruct() { Super::NativeDestruct(); } void UUC_Colosseum_Deck_New::SetAvailable(bool inAvailable) { if (inAvailable) PlayAni(TEXT("Deck_Available") , false, 0); else StopAni(TEXT("Deck_Available")); } void UUC_Colosseum_Deck_New::SetSelecting(bool bSelecting) { if (bSelecting) { Image_Selecting->SetVisibility(ESlateVisibility::HitTestInvisible); UWidgetAnimation* Anim = GetWidgetAnimFromName(TEXT("Deck_Selecting")); PlayAnimation(Anim, 0.f, 0); } else { Image_Selecting->SetVisibility(ESlateVisibility::Collapsed); } } void UUC_Colosseum_Deck_New::SetHero(FString heroUD) { CurHeroUD = heroUD; if (!heroUD.IsEmpty()) { SelectingSwitcher->SetActiveWidgetIndex(1); HeroIcon->SetVisibility(ESlateVisibility::SelfHitTestInvisible); HeroIcon->SetHeroIconInfoWithUD(heroUD , EHeroOwnershipType::VE_Me); } else { SelectingSwitcher->SetActiveWidgetIndex(0); HeroIcon->SetVisibility(ESlateVisibility::Collapsed); } }
5661322ce15847aa407ca7861ee321d1baa2b6fe
bd019e187f56dc637dd5b695ed1c6fc36547d403
/cMouseCursor.cpp
0b6a18a70532fabc1266e02b85c317f2ae15ffea
[]
no_license
JaeHyunKim02/-Change-clothes
48fa3d8f12b9ff7bd576e03f1a66a56bb84e8475
dc5a8a25197b5cda5de20df9b984d4d24a08a496
refs/heads/master
2021-04-16T10:18:00.395404
2020-03-23T06:14:38
2020-03-23T06:14:38
249,349,433
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
cpp
cMouseCursor.cpp
#include "stdafx.h" #include "cMouseCursor.h" cMouseCursor::cMouseCursor() { g_MNomal = IMAGE->FindImage("MouseCursor_nomal"); g_MOnCursor = IMAGE->FindImage("MouseCursor_onclick"); g_MClick = IMAGE->FindImage("MouseCursor_upclick"); //x = INPUT->GetMousePos().x; //y = INPUT->GetMousePos().y; } cMouseCursor::~cMouseCursor() { } void cMouseCursor::Init() { } bool cMouseCursor::Update(Point pos) { pos.x = INPUT->GetMousePos().x; pos.y = INPUT->GetMousePos().y; if (INPUT->MouseLPress() || INPUT->MouseRPress()) { state = mDown; } else if (INPUT->MouseLUp() || INPUT->MouseRUp()){ state = mUp; } else { state = mNomal; } return false; } void cMouseCursor::Render(Point pos) { if (state == mNomal) { IMAGE->Render(g_MNomal, pos, false, RGB(255, 0, 255));//g_MPos } else if (state == mDown) { IMAGE->Render(g_MOnCursor, pos, false, RGB(255, 0, 255)); } else if (state == mUp) { IMAGE->Render(g_MClick, pos, false, RGB(255, 0, 255)); } } void cMouseCursor::Release() { } bool cMouseCursor::isClickDown(int x, int y) { return false; } bool cMouseCursor::isOver() { return false; }
f74522c04dbca42d9c0a3e04a209ada91da1c034
d5688d21d8084a628446d8101ba3dee571a6ac30
/src/item.h
c7d299424875650ec1bbcc2c582d29884735c9d3
[ "CC-BY-ND-4.0", "MIT" ]
permissive
hiro-dot-exe/super-morio-bros
959c6dcd34b1e90cb0f0432d13d47e78e32c27a4
0ec6b54350a3ebe0c055f346d797d13ded5dc248
refs/heads/master
2022-07-27T01:54:15.798475
2020-05-18T19:35:37
2020-05-18T19:35:37
265,028,035
0
0
MIT
2020-05-18T18:46:02
2020-05-18T18:35:39
C++
UTF-8
C++
false
false
879
h
item.h
//----------------------------------------------------------------------------- // Copyright (c) 2013 @hirodotexe. All rights reserved. //----------------------------------------------------------------------------- #ifndef SUPER_MORIO_BROS_ITEM_H_ #define SUPER_MORIO_BROS_ITEM_H_ #include "moving_object.h" class Item : public MovingObject { public: enum State { kStored, kPushedOut, kMoving, }; Item(Type type, int id_x, int id_y) : MovingObject(type, 32, 32, id_x, id_y) {} virtual void Reset() { MovingObject::Reset(); is_vanished_ = true; state_ = kStored; } State state() const { return state_; } void set_state(State state) { state_ = state; } void appear() { is_vanished_ = false; } private: virtual void CalculateForce(); State state_; }; #endif // SUPER_MORIO_BROS_ITEM_H_
b79f178694a145af248bc4bd903cd1f1b102202a
259329665605d26dd12e3e99896d20a46ff6ae8b
/Capter02/0206.cpp
7a41a0add3ab7779ef0f5f2835d0179b8140ff8f
[]
no_license
wada811/MeikaiClangNyumon
55cc45ae9411347d6d57d176dab3946db2f17a0f
b68a426a783654ca0a5f5c7b5676321f751dcbc6
refs/heads/master
2021-01-20T11:25:21.724263
2012-02-23T14:18:32
2012-02-23T14:18:32
3,524,224
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
497
cpp
0206.cpp
/* 演習2-6:右に示すように、新調を整数値として読み込んで、標準体重を実数で表示するプログラムを作成せよ。 標準体重は(身長-100)×0.9によって求め、その小数点以下は、1桁だけ表示すること。 */ #include <stdio.h> int main(void){ int tall; printf("身長を入力してください:"); scanf("%d", &tall); printf("標準体重は%.1fです。\n", (double)(tall - 100) * 0.9); return (0); }
08744686acfb1e3369676c81fd9f58d5d8afdf05
e96afcf8a6a90066c47df4409b85a9dadb88dad6
/lab9/task_B.cpp
102bd58ce636e6b41e45cce116d84f1b36266d43
[]
no_license
Pronomuos/Algorithms_and_DS_ITMO
26ec80902f6a338e5e98599d56d343a481a08786
80c23ccc8cac7af16574d1c6ebd07d974cf8ef23
refs/heads/master
2023-03-11T18:16:38.326199
2021-02-21T20:03:50
2021-02-21T20:03:50
294,238,623
0
0
null
null
null
null
UTF-8
C++
false
false
1,665
cpp
task_B.cpp
#include <iostream> #include <fstream> #include <vector> using namespace std; void dfs (int v, vector<int> &used, vector<vector<int>> &g, bool &cycle, vector<int> &p, int &cycle_end, int &cycle_start) { used[v] = 1; for (int to : g[v]) { if (used[to] == 0) { p[to] = v; dfs(to, used, g, cycle, p, cycle_end, cycle_start); } else if (used[to] == 1) { cycle = true; cycle_end = v; cycle_start = to; } } used[v] = 2; } int main() { ifstream input_file ("cycle.in"); ofstream output_file ("cycle.out"); int ver, edges; input_file >> ver >> edges; vector<vector<int>> g (ver); vector<int> used (ver); vector<int> p (ver); vector<int> q; bool cycle = false; int cycle_end = 0; int cycle_start = 0; for (int i = 0; i < edges; i++) { int ver1, ver2; input_file >> ver1 >> ver2; ver1--; ver2--; g[ver1].push_back(ver2); } for (int i=0; i < ver; ++i) { if (!cycle && !used[i]) dfs(i, used, g, cycle, p, cycle_end, cycle_start); } if (cycle) { q.push_back(cycle_start); int k = cycle_end; while (k!=cycle_start) { q.push_back(k); k = p[k]; } output_file << "YES\n"; for (int i = q.size()-1; i>=0; i--) output_file << q[i]+1 << " "; } else output_file << "NO"; input_file.close(); output_file.close(); return 0; }
b3ac1caaba19138cb0ba808e26f3c1de8bd68c7a
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/chrome/browser/sharing/sharing_device_source.h
6d1537f0b32a9f219881f5a4c3196d5a43f77ba5
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
1,745
h
sharing_device_source.h
// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_SHARING_SHARING_DEVICE_SOURCE_H_ #define CHROME_BROWSER_SHARING_SHARING_DEVICE_SOURCE_H_ #include <memory> #include <string> #include <vector> #include "base/functional/callback_forward.h" #include "components/sync/protocol/device_info_specifics.pb.h" namespace syncer { class DeviceInfo; } // namespace syncer class SharingDeviceSource { public: SharingDeviceSource(); SharingDeviceSource(const SharingDeviceSource&) = delete; SharingDeviceSource& operator=(const SharingDeviceSource&) = delete; virtual ~SharingDeviceSource(); // Returns if the source is ready. Calling GetAllDevices before this is true // returns an empty list. virtual bool IsReady() = 0; // Returns the device matching |guid|, or nullptr if no match was found. virtual std::unique_ptr<syncer::DeviceInfo> GetDeviceByGuid( const std::string& guid) = 0; // Returns all device candidates for |required_feature|. Internally filters // out older devices and returns them in (not strictly) decreasing order of // last updated timestamp. virtual std::vector<std::unique_ptr<syncer::DeviceInfo>> GetDeviceCandidates( sync_pb::SharingSpecificFields::EnabledFeatures required_feature) = 0; // Adds a callback to be run when the SharingDeviceSource is ready. If a // callback is added when it is already ready, it will be run immediately. void AddReadyCallback(base::OnceClosure callback); protected: void MaybeRunReadyCallbacks(); private: std::vector<base::OnceClosure> ready_callbacks_; }; #endif // CHROME_BROWSER_SHARING_SHARING_DEVICE_SOURCE_H_
47008dd9a4b01182777be82652073f8ab8a5bc12
5ad3ef3e114cf13f3e4c3cf5e9883a72d83a62ef
/include/gvki/Logger.h
849c2065a5e6381fb580e3fd4577653e4b0d7a10
[ "BSD-3-Clause" ]
permissive
giuliojiang/gvki-giulio-p
1cce78d61431dcfec0acfe20b1da1e92980f8d97
b6aca081bca5ae9e7e4cd93878ff2a3a04c8b7ed
refs/heads/master
2016-09-06T17:35:51.180949
2015-07-27T09:27:56
2015-07-27T09:27:56
38,763,943
0
0
null
null
null
null
UTF-8
C++
false
false
2,826
h
Logger.h
#ifndef SHADOW_CONTEXT_H #define SHADOW_CONTEXT_H #include "gvki/opencl_header.h" #include <map> #include <string> #include <vector> #include <fstream> namespace gvki { struct BufferInfo { size_t size; void* data; cl_mem_flags flags; BufferInfo() : size(0), data(0), flags(0) {} }; struct ImageInfo { // TODO: Add more fields describing the image cl_mem_flags flags; cl_mem_object_type type; }; struct SamplerInfo { cl_bool normalized_coords; cl_addressing_mode addressing_mode; cl_filter_mode filter_mode; }; // Information about where in the host code the "something" was created struct HostAPICallInfo { const char* compilationUnit; unsigned int lineNumber; const char* hostCodeFunctionCalled; HostAPICallInfo() : compilationUnit(0), lineNumber(0), hostCodeFunctionCalled(0) { } bool hasHostCodeInfo() const { return compilationUnit != 0 && hostCodeFunctionCalled !=0 && lineNumber > 0; } }; struct ProgramInfo : public HostAPICallInfo { std::vector<std::string> sources; std::string compileFlags; }; struct ArgInfo { const void* argValue; size_t argSize; ArgInfo() : argValue(0), argSize(0) { } }; struct KernelInfo : public HostAPICallInfo { cl_program program; std::string entryPointName; std::vector<ArgInfo> arguments; size_t dimensions; std::vector<size_t> globalWorkOffset; std::vector<size_t> globalWorkSize; std::vector<size_t> localWorkSize; bool localWorkSizeIsUnconstrained; bool loggedAlready; }; struct ProgramInfoCacheCompare { bool operator() (const ProgramInfo& lhs, const ProgramInfo& rhs) const; }; typedef std::map<ProgramInfo, std::string, ProgramInfoCacheCompare> ProgCacheMapTy; class Logger { public: std::map<cl_mem, BufferInfo> buffers; std::map<cl_mem, ImageInfo> images; std::map<cl_sampler, SamplerInfo> samplers; std::map<cl_program, ProgramInfo> programs; std::map<cl_kernel, KernelInfo> kernels; std::string directory; void openLog(); void closeLog(); Logger(); ~Logger(); void dump(cl_kernel k); BufferInfo * tryGetBuffer(ArgInfo &ai); static Logger& Singleton(); private: // FIXME: Use std::unique_ptr<> instead std::ofstream* output; unsigned arrayDataCounter; Logger(const Logger& that); /* = delete; */ void initDirectoryNumbered(); void initDirectoryManual(const char* rootDir); void printJSONArray(std::vector<size_t>& array); void printJSONKernelArgumentInfo(ArgInfo& ai); void printJSONHostCodeInvocationInfo(HostAPICallInfo& info); std::string dumpKernelSource(KernelInfo& ki); ProgCacheMapTy WrittenKernelFileCache; }; } #endif
ee08b88dbc1272db8bb6791c11a903f50e6beafd
717d5d687221c642bb1f74a276976033499ab453
/backend/inst-selec/tree-match-graphs/src/lib/rules.cc
ecae3cc54b925c9106ecd15fd3d162d9340f2a79
[ "MIT" ]
permissive
obs145628/cle
1dbb4f9c99366cb2376c10a2115312f7443b9879
4a4a18b2ab5a6fbf26629f6845147541edabd7c9
refs/heads/master
2023-02-08T00:21:54.944759
2020-12-30T14:17:41
2020-12-30T14:17:41
288,396,897
0
0
null
null
null
null
UTF-8
C++
false
false
4,255
cc
rules.cc
#include "rules.hh" #include <fstream> #include <iostream> #include <logia/md-gfm-doc.hh> #include <logia/program.hh> #include <utils/cli/err.hh> #include <utils/str/format-string.hh> #include <utils/str/str.hh> namespace { constexpr const char *DEFAULT_RULES = "" "@b ; __block__ ; 0 ; |\n" "@c ; __const__ ; 0 ; |\n" "@r ; __reg__ ; 0 ; |\n"; } std::ostream &operator<<(std::ostream &os, const Rule &r) { os << " " << r.idx << ": " << r.name << " ; "; for (const auto &s : r.pat) os << s << " "; for (const auto &p : r.props) os << ":" << p.first << "=" << p.second << " "; os << "; "; os << r.cost << " ; "; for (const auto &ins : r.code) { for (const auto &s : ins) os << s << " "; os << "| "; } return os; } Rules::Rules(const std::string &path) { std::ifstream is(path); PANIC_IF(!is.good(), FMT_OSS("Invalid rules file `" << path << "'")); // Parse rules file std::string l; while (std::getline(is, l)) { l = utils::str::trim(l); if (!l.empty()) _parse_rule(l); } // Parse default rules for (auto l : utils::str::split(DEFAULT_RULES, '\n')) { l = utils::str::trim(l); if (!l.empty()) _parse_rule(l); } _extend(); for (std::size_t i = 0; i < _rules.size(); ++i) _rules[i].idx = i; auto doc = logia::Program::instance().add_doc<logia::MdGfmDoc>( "Tree-Matching Rules"); auto ch = doc->code(); ch.os() << *this; check(); } void Rules::check() const { for (const auto &r : _rules) { if (r.name[0] == '@') PANIC(FMT_OSS("Rule " << r.name << ": is an alias")); for (std::size_t i = 1; i < r.pat.size(); ++i) { const auto &s = r.pat[i]; if (s[0] == '@') PANIC(FMT_OSS("Rule " << r.name << ": use alias " << s)); if (s[0] == '*') continue; bool found = false; for (const auto &r : _rules) if (r.name == s) { found = true; break; } if (!found) PANIC(FMT_OSS("Rule " << r.name << ": use undefined rule " << s)); } } } void Rules::_parse_rule(const std::string &l) { auto args = utils::str::split(l, ';'); PANIC_IF(args.size() != 4, FMT_OSS("Invalid nummber of arguments in rule `" << l << "'")); Rule rule; rule.name = utils::str::trim(args[0]); for (auto arg : utils::str::split(utils::str::trim(args[1]), ' ')) { if (arg[0] == ':') { // property auto prop = utils::str::split(arg.substr(1), '='); PANIC_IF(prop.size() != 2, FMT_OSS("Invalid property " << arg << " in rule `" << l << "'")); rule.props.emplace(prop[0], prop[1]); } else { rule.pat.push_back(arg); } } rule.cost = utils::str::parse_long(utils::str::trim(args[2])); for (auto ins : utils::str::split(utils::str::trim(args[3]), '|')) { auto args = utils::str::split(utils::str::trim(ins), ' '); if (!args.empty()) rule.code.push_back(args); } _rules.push_back(rule); } void Rules::_extend() { // Extend to get the real set of rules for (std::size_t i = 0; i < _rules.size(); ++i) { const auto &r = _rules[i]; if (r.pat.size() == 1 && r.pat[0][0] == '@') { _extend_alias(r); // Remove alias _rules.erase(_rules.begin() + i); --i; } } // Remove all aliases rules std::vector<Rule> new_rules; for (const auto &r : _rules) if (r.name[0] != '@') new_rules.push_back(r); _rules = new_rules; } void Rules::_extend_alias(const Rule &ar) { const auto &alias = ar.pat[0]; std::vector<Rule> new_rules; for (const auto &r : _rules) { if (r.name != alias) continue; Rule new_rule; new_rule.name = ar.name; new_rule.pat = r.pat; new_rule.props = ar.props; new_rule.cost = r.cost + ar.cost; new_rule.code = r.code; new_rule.code.insert(new_rule.code.end(), ar.code.begin(), ar.code.end()); new_rules.push_back(new_rule); } _rules.insert(_rules.end(), new_rules.begin(), new_rules.end()); } std::ostream &operator<<(std::ostream &os, const Rules &rules) { for (const auto &r : rules.rules()) os << r << "\n"; return os; }
3d09319205e565085142bb02aa8ed345bdde75ed
9da8e84a6d6df1e64f8ee3355a2580e43f5dc752
/Server/server.cpp
ab2296e379b28b0e554a0a7feb620f54afe1dc6c
[]
no_license
game-works/Hangman
3adad126a7511031efa956d04fe4a44574fe313d
43167d9d6f7e182fa39d91b9b2dd5bfe8d966f7b
refs/heads/master
2020-05-09T15:00:23.955917
2019-04-08T21:11:37
2019-04-08T21:11:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
21,149
cpp
server.cpp
#include <sys/types.h> // socket, bind #include <sys/socket.h> // socket, bind, listen, inet_ntoa #include <netinet/in.h> // htonl, htons, inet_ntoa #include <arpa/inet.h> // inet_ntoa #include <netdb.h> // gethostbyname #include <unistd.h> // read, write, close, usleep #include <strings.h> // bzero #include <netinet/tcp.h> // SO_REUSEADDR #include <sys/uio.h> // writev #include <stdlib.h> // atoi #include <stdio.h> /* printf, fgets */ #include <iostream> // IO #include <fstream> // File Stream #include <pthread.h> // pthread #include <stdexcept> //Excpetions #include <sys/time.h> // time #include <vector> #include <iostream> #include <string> #include <map> #include <mutex> #include "user.h" #include "room.h" #include "player.h" #include "constants.h" #include "packet.h" // Ardalan Ahanchi // CSS 432 // Hangman #define PORT 21754 #define MAX_CONNECTIONS 30 #define REFRESH_TIME 2000 #define MIN_PASSWORD_LENGTH 8 #define PACKET_LIMIT 512 using namespace std; //Forward declarations void* connected(void* args); int readPacket(Packet &p, int fd); int writePacket(Packet &p, int fd); int writeStat(char status, int fd); void disconnected(int fd); //Variables. pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; map<int, Room> rooms; map<string, User> users; int roomIdCounter; void startServer() { roomIdCounter = 1; sockaddr_in socketAddress; //Create a socket address. bzero((char*) &socketAddress, sizeof(socketAddress)); socketAddress.sin_family = AF_INET; socketAddress.sin_addr.s_addr = htonl(INADDR_ANY); socketAddress.sin_port = htons(PORT); int serverFd = -1; serverFd = socket(AF_INET, SOCK_STREAM, 0); //Initialize socket if(serverFd < 0) // socket is opened cerr << "ERROR: Cannot open socket" << endl; const int on = 1; setsockopt(serverFd, SOL_SOCKET, SO_REUSEADDR, (char*) &on, sizeof(int)); // Set the SO_REUSEADDR option. bind(serverFd, (sockaddr * ) & socketAddress, sizeof(socketAddress)); // Bind this socket to its local address. listen(serverFd, MAX_CONNECTIONS); //Looping for new clients attemping to connect while (true) { sockaddr_in clientAddr; // Create a client socket. socklen_t clientAddrSize = sizeof(clientAddr); int clientFd = accept(serverFd, (sockaddr*) &clientAddr, &clientAddrSize); // Wait for a connection. int* args = new int[1] {clientFd}; // Create an arguments array. pthread_t clientThread; pthread_create(&clientThread, NULL, connected, (void*) args); // Start a thread for the client. } close(serverFd); } void disconnected(int fd) { cerr << "Client Disconnected." << endl; close(fd); pthread_cancel(pthread_self()); } //Returns a packet which it read from the fd. int readPacket(Packet &p, int fd) { //Read from buffer while there is data to read. char buffer[PACKET_LIMIT]; if(read(fd, &buffer, PACKET_LIMIT) < 1) { disconnected(fd); return S_ERROR; } vector<char> serialized; for(char c: buffer) serialized.push_back(c); p = Packet(serialized); return S_OK; } //Writes the packet p to the fd. int writePacket(Packet &p, int fd) { vector<char> serialized; p.serialize(serialized); if(write(fd, &serialized[0] , serialized.size()) < 1) { disconnected(fd); return S_ERROR; } return S_OK; } //Write the status to the fd. int writeStat(char status, int fd) { Packet toSend(status); return writePacket(toSend, fd); } // A function which runs when client gets connected. void* connected(void* args) { cerr << "New Client Connected." << endl; int* arr = (int*) args; int fd = arr[0]; //Get the Fd. string user; bool loggedOut = false; while(!loggedOut) { usleep(REFRESH_TIME); cerr << "I come to pre readOp" << endl; Packet request; readPacket(request, fd); char opCode = request.getOpCode(); cerr << "THe requested opcode is : " << opCode << endl; if(opCode < 0) disconnected(fd); switch(opCode) { //If we're creating an account. case OP_CREATE_ACT: { string userInput = ""; string passInput = ""; if(request.getNumArgs() >= 2) { userInput = request.getArg(0); //Read the strings from client. passInput = request.getArg(1); } cerr << "Username is: " << userInput << endl; cerr << "Passcode is: " << passInput << endl; char status = S_OK; if(userInput == "") { status = S_REG_INVALID_USER; //If username is empty. } else if (passInput.length() < MIN_PASSWORD_LENGTH) { status = S_REG_INVALID_PASS; //If password is invalid. } else { //pthread_mutex_lock(&mtx); if (users.find(userInput) == users.end() ) //If its a new user. { cerr << "Creating a new account: Username = " << userInput << endl; User newUser(userInput, passInput); users[userInput] = newUser; } else //If its an existing user. { cerr << "Username existed, Not Creating Account." << endl; status = S_REG_USERNAME_EXISTS; } //pthread_mutex_unlock(&mtx); } writeStat(status, fd); break; } //If we're logging in. case OP_LOGIN: { string userInput = ""; string passInput = ""; if(request.getNumArgs() >= 2) { userInput = request.getArg(0); //Read the strings from client. passInput = request.getArg(1); } int status = S_OK; if(userInput == "" || passInput == "") //Check for empty user/pass status = S_AUTH_INVALID_USER; //pthread_mutex_lock(&mtx); if(users.count(userInput)) //If the username exists { if(users[userInput].auth(userInput, passInput)) //Check password. { users[userInput].login(); //If right, login the user. user.append(userInput); } else { status = S_AUTH_INVALID_PASS; //If password is wrong. } } else { status = S_AUTH_INVALID_USER; //If the username is not registerd. } //pthread_mutex_unlock(&mtx); writeStat(status, fd); break; } //If there are any other opcodes (The rest of them require the user to be logged in.) default: { if(!users[user].isLoggedIn()) //If the user is not logged in. { cerr << "I get to not logged in somehow for user " << user << endl; writeStat(S_NOT_LOGGED_IN, fd); } //If the user is logged in. else { //pthread_mutex_lock(&mtx); switch(opCode) { case OP_LOGOUT: { users[user].logout(); //logout the user. users[user].left(); //Leave from the rooms. loggedOut = true; writeStat(S_OK, fd); break; } case OP_UNREGISTER: { users[user].logout(); //logout the user. users[user].left(); //Leave from the rooms. loggedOut = true; users.erase(users.find(user)); //Remove from users. writeStat(S_OK, fd); break; } case OP_JOIN: { cerr << "I get to joining the new player " << endl ; //If no rooms exist, create one. if(rooms.size() == 0) { rooms[roomIdCounter] = Room(roomIdCounter++); cerr << "New room Created with roomID : " << (roomIdCounter - 1) << endl; } //Find the room with the minimum of players. int minRoomId = 1; for(auto r: rooms) { if(r.second.getNumPlayers() < rooms[minRoomId].getNumPlayers()) minRoomId = r.second.getRoomId(); } cerr << "I get to joining the new player " << endl ; //Join the player in that room. Player newPlayer(user); rooms[minRoomId].addPlayer(newPlayer); Packet toSend(S_OK); //Create a room and a response. toSend.addArg(to_string(minRoomId)); //Add arguments to packet. writePacket(toSend, fd); //Send. break; } case OP_JOIN_RID: { if(request.getNumArgs() != 1) cerr << "ERROR: Not one argument." << endl; int roomId = stoi(request.getArg(0)); if (rooms.find(roomId) == rooms.end() ) //If the room doesnt exist. { writeStat(S_INVALID_ROOM_ID, fd); break; } //Join the player in that room. Player newPlayer(user); rooms[roomId].addPlayer(newPlayer); Packet toSend(S_OK); //Join the room and send response. writePacket(toSend, fd); //Send. break; } case OP_HOST: { Packet toSend(S_OK); //Create a room and a response. rooms[roomIdCounter] = Room(roomIdCounter); toSend.addArg(to_string(roomIdCounter++)); //Add arguments to packet. writePacket(toSend, fd); //Send. cerr << "New room Created with roomID : " << (roomIdCounter - 1) << endl; break; } case OP_CHECK_GAMEOVER: { if(request.getNumArgs() != 1) cerr << "ERROR: Not one argument." << endl; int roomId = stoi(request.getArg(0)); if (rooms.find(roomId) == rooms.end() ) //If the room doesnt exist. { writeStat(S_INVALID_ROOM_ID, fd); break; } if(rooms[roomId].isOver()) //If game is over return GAME_OVER. { writeStat(S_GAME_OVER, fd); break; } else { writeStat(S_OK, fd); //If not, return OK. break; } break; } case OP_WON: { if(request.getNumArgs() != 1) cerr << "ERROR: Not one argument." << endl; int roomId = stoi(request.getArg(0)); if (rooms.find(roomId) == rooms.end() ) //If the room doesnt exist. { writeStat(S_INVALID_ROOM_ID, fd); break; } //Join the player in that room. Player newPlayer(user); rooms[roomId].won(newPlayer); Packet toSend(S_OK); //Join the room and send response. writePacket(toSend, fd); //Send. break; } case OP_LOST: { if(request.getNumArgs() != 1) cerr << "ERROR: Not one argument." << endl; int roomId = stoi(request.getArg(0)); if (rooms.find(roomId) == rooms.end() ) //If the room doesnt exist. { writeStat(S_INVALID_ROOM_ID, fd); break; } //Join the player in that room. Player newPlayer(user); rooms[roomId].lost(newPlayer); Packet toSend(S_OK); //Join the room and send response. writePacket(toSend, fd); //Send. break; } case OP_LEAVE: { Packet toSend(S_OK); //Create a response //pthread_mutex_lock(&mtx); for(auto r: rooms) { Player p(user); r.second.removePlayer(p); //Leave from all the joined rooms. } writePacket(toSend, fd); //Send. break; } case OP_GET_WORD: { if(request.getNumArgs() == 1) { Packet toSend(S_OK); //Create a response toSend.addArg(rooms[stoi(request.getArg(0))].getWord()); //Add arguments to packet. writePacket(toSend, fd); //Send. } else { writeStat(S_ERROR, fd); //Write an error if the args are invalid. } break; } case OP_GET_BOARD: { if(request.getNumArgs() == 1) { Packet toSend(S_OK); //Create a response toSend.addArg(rooms[stoi(request.getArg(0))].getPlayerBoard()); //Add arguments to packet. writePacket(toSend, fd); //Send. } else { writeStat(S_ERROR, fd); //Write an error if the args are invalid. } break; } case OP_UPDATE: { Packet toSend(S_OK); //Create a response Player p; p.deserialize(toSend.getArg(0)); //pthread_mutex_lock(&mtx); for(auto r: rooms) { Player p(user); r.second.update(p); //Leave from all the joined rooms. } writePacket(toSend, fd); //Send. break; } case OP_GET_ROOMS: { Packet toSend(S_OK); //Create a response //pthread_mutex_lock(&mtx); for(auto r: rooms) { toSend.addArg(to_string(r.second.getRoomId())); //Add arguments to packet. //toSend.addArg(to_string(r.second.getNumPlayers())); } writePacket(toSend, fd); //Send. //pthread_mutex_unlock(&mtx); break; } case OP_GET_PLAYER_COUNT: { if(request.getNumArgs() == 1) { Packet toSend(S_OK); //Create a response toSend.addArg(to_string(rooms[stoi(request.getArg(0))].getNumPlayers())); //Add arguments to packet. writePacket(toSend, fd); //Send. } else { writeStat(S_ERROR, fd); //Write an error if the args are invalid. } break; } //If its an unIdentified Operation. default: cerr << "I get to unidentified opcode." << endl; writeStat(S_ERROR, fd); break; } } } break; } } cerr << "Client Left." << endl; delete[] arr; shutdown(fd, SHUT_RDWR); close(fd); return 0; } int main(int argc, char *argv[]) { cerr << "Starting the Hangman Server" << endl; startServer(); }
67755ada66e182fd820ae62a3bbf4524abc1ff21
6799592f780197259b8217c70c7f905da233a2ed
/misc/fexcept/execdump/xxlib/Std/std_mem.cpp
470579196a253decd42b1d7aa728f6e0c4fbc849
[ "BSD-3-Clause" ]
permissive
FarGroup/FarManager
22b1f754a4cf4bcc6e1822a6ce66408fabf140d5
da34b0c6da3e03518b8ce7e53783e9fda518bac4
refs/heads/master
2023-08-20T04:52:54.443453
2023-08-12T20:53:56
2023-08-12T20:53:56
107,807,404
1,691
228
BSD-3-Clause
2023-09-14T20:07:19
2017-10-21T18:55:45
C++
UTF-8
C++
false
false
870
cpp
std_mem.cpp
#include <all_lib.h> #pragma hdrstop #if defined(__MYPACKAGE__) #pragma package(smart_init) #endif #if defined(__GUARD_MEMORY__) #define CHK(v) TraceAssert( _HeapCheck() && v ); #else #define CHK(v) #endif LPVOID MYRTLEXP MemSet( LPVOID Buff, BYTE Val, size_t sz ) { if ( !Buff || !sz ) return Buff; CHK( "Before memset" ) LPVOID rc = memset( Buff,Val,sz ); CHK( "After memset" ) return rc; } LPVOID MYRTLEXP MemMove( LPVOID dest, const void *src, size_t n) { if ( !dest || !src || !n ) return dest; CHK( "Before memmove" ) LPVOID rc = memmove( dest,src,n ); CHK( "After memmove" ) return rc; } LPVOID MYRTLEXP MemCpy( LPVOID dest, const void *src, size_t n) { if ( !dest || !src || !n ) return dest; CHK( "Before memcpy" ) LPVOID rc = memcpy( dest,src,n ); CHK( "After memcpy" ) return rc; }
161d940d6e1439195af7cf119c19e7bd3d38c521
cb93344d0495fbe889e4f97a8cbf9e296cfd2ae4
/Algo/1937_욕심쟁이판다.cpp
8f62c22d50ec9093d690bb086f033f45fe69cbad
[]
no_license
jason967/algorithm
30e101a7bf9cb1d30ac2c3703f843893b1cc08e7
840fb5b8804fa6b0a5dcc2b31f4dae7c0683be8f
refs/heads/master
2023-02-16T23:45:38.263806
2021-01-10T15:09:12
2021-01-10T09:51:32
282,450,660
0
0
null
null
null
null
UTF-8
C++
false
false
792
cpp
1937_욕심쟁이판다.cpp
#include<cstdio> using namespace std; int A[500][500], d[500][500]; int N,ans; int dy[] = { 0,0,1,-1 }; int dx[] = { 1,-1,0,0 }; bool oob(int y, int x) { return y < 0 || y >= N || x < 0 || x >= N; } int dfs(int y,int x) { if (d[y][x] != 0) return d[y][x]; d[y][x] = 1; for (int i = 0; i < 4; i++) { int ny = y + dy[i]; int nx = x + dx[i]; if (oob(ny, nx)) continue; if (A[y][x] < A[ny][nx]) { int res = dfs(ny, nx)+1; if (res > d[y][x]) d[y][x] = res; } } if (ans < d[y][x]) ans = d[y][x]; return d[y][x]; } int main() { scanf("%d", &N); for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) scanf("%d", &A[i][j]);; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (d[i][j] == 0) { dfs(i, j); } } } printf("%d", ans); }
f69ec29edddbdc4054653dc5a7851f733aabe766
ec78819541307aecce7b38dc8f3c711a595864cb
/Assignment 10/persistency/basket_file_repo.cpp
e60eadf090d7ae76cd2efa19cc95a3015bba6ab5
[]
no_license
BVlad917/Object-Oriented-Programming
8c35fcd48a6e4cdddd596718b488480681ec719b
2506bd59e2e3c2b04a7c551ac329ac00256f9835
refs/heads/main
2023-07-28T23:22:22.287290
2021-09-20T19:54:23
2021-09-20T19:54:23
408,197,159
0
0
null
null
null
null
UTF-8
C++
false
false
1,460
cpp
basket_file_repo.cpp
// // Created by VladB on 17-Apr-21. // #include <fstream> #include <algorithm> #include "basket_file_repo.h" #include "../errors/exceptions.h" BasketFileRepo::BasketFileRepo(std::string &file_name) : FileRepo(file_name) { std::ofstream fout(this->file_name); if (!fout.is_open()) { throw RepositoryException("\nERROR: The file could not be opened.\n"); } fout << ""; fout.close(); }; void BasketFileRepo::add_trench_to_repo(const TrenchCoat &t) { this->read_from_file(); if (this->count_same_coat_in_repo(t) == t.get_trench_quantity()) { throw RepositoryException("\nCannot add to the shopping cart. Not enough coats in the store.\n"); } auto position = std::find(this->trench_coats.begin(), this->trench_coats.end(), t); this->trench_coats.insert(position, t); this->write_to_file(); } void BasketFileRepo::update_all(TrenchCoat &t) { this->read_from_file(); for (auto it = this->trench_coats.begin(); it != this->trench_coats.end(); it++) { if ((*it) == t) { this->trench_coats.at(it - this->trench_coats.begin()) = t; } } this->write_to_file(); } int BasketFileRepo::count_same_coat_in_repo(const TrenchCoat &t) { this->read_from_file(); int cnt = 0; for (auto & trench_coat : this->trench_coats) { if (trench_coat == t) { cnt += 1; } } return cnt; }
6ccb858226ef63e06ca3113ae67ddbb41f3d176f
df22b3e68eb70d60164c43e9b951cdc3b5ad1dc4
/code/types.hpp
d7d50de8dfeee8229eb80885a259a43e6bd0e9cf
[]
no_license
shellpicker/Simple-Pascal-Language-SPL-compiler
e0e4b44f24be47838aa4ea67b08f6a0be968b9cd
8b8762e5d23b0cb516730129f159f09ef8dbc550
refs/heads/master
2020-06-03T13:51:11.622716
2019-06-19T04:17:20
2019-06-19T04:17:20
191,592,677
1
0
null
null
null
null
UTF-8
C++
false
false
1,179
hpp
types.hpp
#ifndef TYPES_H_ #define TYPES_H_ #include <vector> #include <string> enum Type_t {e_integer, e_char, e_boolean, e_real, e_enum, e_subrange, e_array, e_record, e_userdefined}; class BasicType{ public: enum Type_t type; BasicType(enum Type_t type = e_integer) : type(type){} }; class EnumType : public BasicType { public: std::vector<std::string> names; EnumType(enum Type_t type = e_enum) : BasicType(type){} }; class SubrangeType : public BasicType { public: int isEnum; int i_start, i_end; std::string s_start, s_end; SubrangeType(enum Type_t type = e_subrange) : BasicType(type){} }; class ArrayType : public BasicType { public: BasicType * myType; int start, end; ArrayType(enum Type_t type = e_array) : BasicType(type){} }; class RecordType : public BasicType { public: std::vector<BasicType*> myTypes; std::vector<std::string> names; RecordType(enum Type_t type = e_record) : BasicType(type){} }; class UserDefinedType : public BasicType { public: std::string name; UserDefinedType(enum Type_t type = e_userdefined) : BasicType(type){} }; #endif
4478b9c0790bf50831552eed0eb949874b01825d
6a5096e93b14ab9e00e55cc28980d5d896a1185e
/RFIDoor/RFIDoor.ino
a8080d9a2ddbe823959a33490f0f455b84664089
[]
no_license
JochiPochi/RFID-Door
525930471fc7603eccc5ba350204929a6989f78c
b33fd9036f5b4c43ff7f7600bcb38e96f69148c7
refs/heads/master
2016-09-09T23:12:43.999811
2015-03-11T13:19:25
2015-03-11T13:19:25
32,018,258
0
0
null
null
null
null
UTF-8
C++
false
false
3,508
ino
RFIDoor.ino
/******************************************************* * Code for the RFID door lock Mechanism * Author: John R Aleman * Version: 1.0 * Notes: This piece of code saves roomates cards into the EEPROM, useful for initialization * *******************************************************/ #include <SPI.h> #include <RFID.h> #include <EEPROM.h> #define SS_PIN 10 #define RST_PIN 9 RFID rfid(SS_PIN, RST_PIN); //Last card read uint8_t serNum[4]; //One card: struct CardUnit { uint8_t hexID[5]; uint8_t checksumByte; }; int sssss = 0; uint32_t addr=0; void setup(){ Serial.begin(9600); SPI.begin(); rfid.init(); } void loop(){ while (sssss == 0){ CardUnit defaultcard; defaultcard.hexID[0]= 0xB0; defaultcard.hexID[1]= 0x76; defaultcard.hexID[2]= 0x84; defaultcard.hexID[3]= 0x7c; defaultcard.hexID[4]= 0x3e; uint8_t checksum = 0; for (int i=0;i<5;i++){ checksum += defaultcard.hexID[i]; } defaultcard.checksumByte = 0xff-checksum; uint8_t numberOfCards = 4; EEPROM.write(addr,numberOfCards); addr++; EEPROM.write(addr,0xFA); addr++; for (int i=0;i<5;i++){ EEPROM.write(addr,defaultcard.hexID[i]); addr++; } EEPROM.write(addr,defaultcard.checksumByte); addr++; //##################################### Eke defaultcard.hexID[0]= 0x1a; defaultcard.hexID[1]= 0xD2; defaultcard.hexID[2]= 0x2C; defaultcard.hexID[3]= 0xD9; defaultcard.hexID[4]= 0x3D; checksum = 0; for (int i=0;i<5;i++){ checksum += defaultcard.hexID[i]; } defaultcard.checksumByte = 0xff-checksum; EEPROM.write(addr,0xFA); addr++; for (int i=0;i<5;i++){ EEPROM.write(addr,defaultcard.hexID[i]); addr++; } EEPROM.write(addr,defaultcard.checksumByte); addr++; //##################################### Eke 2 defaultcard.hexID[0]= 0x24; defaultcard.hexID[1]= 0x21; defaultcard.hexID[2]= 0x5F; defaultcard.hexID[3]= 0x23; defaultcard.hexID[4]= 0x79; checksum = 0; for (int i=0;i<5;i++){ checksum += defaultcard.hexID[i]; } defaultcard.checksumByte = 0xff-checksum; EEPROM.write(addr,0xFA); addr++; for (int i=0;i<5;i++){ EEPROM.write(addr,defaultcard.hexID[i]); addr++; } EEPROM.write(addr,defaultcard.checksumByte); addr++; //##################################### Ben defaultcard.hexID[0]= 0xb0; defaultcard.hexID[1]= 0xa1; defaultcard.hexID[2]= 0x70; defaultcard.hexID[3]= 0x7f; defaultcard.hexID[4]= 0x1e; checksum = 0; for (int i=0;i<5;i++){ checksum += defaultcard.hexID[i]; } defaultcard.checksumByte = 0xff-checksum; EEPROM.write(addr,0xFA); addr++; for (int i=0;i<5;i++){ EEPROM.write(addr,defaultcard.hexID[i]); addr++; } EEPROM.write(addr,defaultcard.checksumByte); addr++; //##################################### Maria defaultcard.hexID[0]= 0x9A; defaultcard.hexID[1]= 0xcd; defaultcard.hexID[2]= 0x7a; defaultcard.hexID[3]= 0x0e; defaultcard.hexID[4]= 0x23; checksum = 0; for (int i=0;i<5;i++){ checksum += defaultcard.hexID[i]; } defaultcard.checksumByte = 0xff-checksum; EEPROM.write(addr,0xFA); addr++; for (int i=0;i<5;i++){ EEPROM.write(addr,defaultcard.hexID[i]); addr++; } EEPROM.write(addr,defaultcard.checksumByte); addr++; sssss = 1; } }
42221a72f7eda6daec229cb6348ac537a52c7eab
373417d6a94399c53836328af870b305b8e9521c
/LaplacianSmoother/src/MayaEigen.cpp
bb42ce320a17a75d882bd4199a0dfbe9fdc91377
[ "MIT" ]
permissive
tody411/MayaPluginSamples
e3ef6cc03aa7a485d72557af22888cf7e134fc6a
785f1b1425e202f42d77622290c3faf80d7bd06f
refs/heads/master
2021-01-25T05:35:01.457697
2015-12-17T05:13:32
2015-12-17T05:13:32
40,001,402
2
0
null
null
null
null
UTF-8
C++
false
false
1,471
cpp
MayaEigen.cpp
#include "MayaEigen.h" #include <maya/MFnMesh.h> #include <maya/MPointArray.h> #include <maya/MFloatVectorArray.h> //! Returns the position matrix P of the target mesh. const Eigen::MatrixXd MayaEigen::getPositionMatrix ( MObject& mesh ) { MFnMesh meshFn ( mesh ); MPointArray vertexArray; meshFn.getPoints ( vertexArray ); Eigen::MatrixXd P ( vertexArray.length(), 3 ); for ( int i = 0; i < vertexArray.length(); i++ ) { for ( int j = 0; j < 3; j++ ) { P ( i, j ) = vertexArray[i][j]; } } return P; } //! Returns the normal matrix N of the target mesh. const Eigen::MatrixXd MayaEigen::getNormalMatrix ( MObject& mesh ) { MFnMesh meshFn ( mesh ); MFloatVectorArray normalArray; meshFn.getVertexNormals ( true, normalArray ); Eigen::MatrixXd N ( normalArray.length(), 3 ); for ( int i = 0; i < normalArray.length(); i++ ) { for ( int j = 0; j < 3; j++ ) { N ( i, j ) = normalArray[i][j]; } } return N; } //! Set the position matrix P for the target mesh. void MayaEigen::setPositions ( MObject& mesh, const Eigen::MatrixXd& P ) { MFnMesh meshFn ( mesh ); if ( meshFn.numVertices() != P.rows() ) return; MPointArray vertexArray ( P.rows() ); for ( int i = 0; i < P.rows(); i++ ) { vertexArray[i] = MPoint ( P ( i, 0 ), P ( i, 1 ), P ( i, 2 ) ); } meshFn.setPoints ( vertexArray ); }
6f73ec98aa279cb67dc055a948ecce51854173de
d78cea93f8eb92d5f89800a09edcaa0778b3894e
/bazar.cpp
a3c520ec50504a6c8623205210ceb67a6a5a5b8b
[]
no_license
trueVrael/old_university_projects
4fe4de55e58a569757f781ad2ac9be4ac5d7f054
18654325c3fc15d63f044512d1f643dbdf3116d1
refs/heads/master
2020-07-10T15:29:40.760455
2019-08-25T13:45:03
2019-08-25T13:45:03
204,298,970
0
0
null
null
null
null
UTF-8
C++
false
false
2,639
cpp
bazar.cpp
#include <iostream> #include <cstdio> using namespace std; const int N = 1000000; int par[N+7][2]; //tab[][0] najwieksze od lewej, tab[][1] najmniejsze od prawej int npar[N+7][2]; long long int bazar[N+7]; int main(){ ios_base::sync_with_stdio(0); long long int suma,tmp1,tmp2; int n,j,k,m,p,x; j = 0; k = 0; cin >> n; cin >> bazar[0]; if (bazar[0]%2 == 1){ npar[0][0] = bazar[0]; par[0][0] = -1; } else{ npar[0][0] = -1; par[0][0] = bazar[0]; } //obliczanie potrzebnych struktur for (int i=1; i<n; i++){ cin >> x; bazar[i] = bazar[i-1] + x; if (x%2 == 1) { npar[i][0] = x; par[i][0] = par[i-1][0]; } else{ par[i][0] = x; npar[i][0] = npar[i-1][0]; } } if ((bazar[n-1] - bazar[n-2])%2 == 1){ npar[n-1][1] = bazar[n-1] - bazar[n-2]; par[n-1][1] = -1; } else{ npar[n-1][1] = -1; par[n-1][1] = bazar[n-1] - bazar[n-2]; } for (int i=n-2; i>=1; i--){ if ((bazar[i] - bazar[i-1])%2 == 1){ npar[i][1] = bazar[i] - bazar[i-1]; par[i][1] = par[i+1][1]; } else{ npar[i][1] = npar[i+1][1]; par[i][1] = bazar[i] - bazar[i-1]; } } if (bazar[0]%2 == 1){ npar[0][1] = bazar[0]; par[0][1] = par[1][1]; } else{ npar[0][1] = npar[1][1]; par[0][1] = bazar[0]; } //zapytania cin >> m; for (int t=0; t<m; t++){ suma = -1; tmp1 = -1; tmp2 = -1; cin >> p; if (n != p) suma = bazar[n-1] - bazar[n-p-1]; else suma = bazar[n-1]; if (suma%2 == 1) printf("%lld\n", suma); else if (n != p){ if( (par[n-p][1] == -1) || (npar[n-p-1][0] == -1)) tmp1 = -1; else tmp1 = suma - par[n-p][1] + npar[n-p-1][0]; if( (npar[n-p][1] == -1) || (par[n-p-1][0] == -1)) tmp2 = -1; else tmp2 = suma - npar[n-p][1] + par[n-p-1][0]; if ((tmp1 == tmp2) && (tmp1 == -1)) printf("%lld\n", tmp1); else if (tmp1 >= tmp2) printf("%lld\n", tmp1); else printf("%lld\n", tmp2); } else printf("-1\n"); } return 0; }
c7582c76b5059121610914a8116acafb6f68533b
8d8b618bed48595e2475cfef3ddc502810024026
/Array/Rotate_Matrix_90_Degrees.cpp
a14ec6de839ef19a9055ec7a3687eebe276b4275
[ "MIT" ]
permissive
AABHINAAV/InterviewPrep
acef002b69be61ca1ff0858559f1b4bd24ce2203
22a7574206ddc63eba89517f7b68a3d2f4d467f5
refs/heads/master
2022-01-09T20:06:41.828170
2019-05-21T09:33:52
2019-05-21T09:33:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,243
cpp
Rotate_Matrix_90_Degrees.cpp
//Given a Matrix of NXN .Rotate it by 90 degrees #include<iostream> #include<vector> using namespace std; template <class T> void disp(T arr){ for (int i = 0; i < arr.size(); ++i) { for(int j =0; j<arr.size(); j++) cout<<arr[i][j]<<" "; cout<<endl; } cout<<endl; } //rotates the matrix by 90 degrees /* Work on on the elements of the edges only.Swapping one by one the values */ void rotateMatrix( vector< vector<int> > &arr,int x,int y,int n){ int t1 = 0,t2 = 0; if(n<1) return; for(int i = 0; i<n-1; i++){ //store the 2nd value t1 = arr[i+x][y+ n-1]; //swap the second value with the first one arr[i+x][y+ n-1] = arr[x][y+i]; //store the 3rd value t2 = arr[x+n-1][y +(n-1) -i]; //swap the value of 3rd with 2nd arr[x +n-1][y +(n-1)-i] = t1; //store the value of 4th value t1 = arr[x+(n-1)-i][y]; //swap the 4th value with the 3rd arr[x+(n-1)-i][y] = t2; //swap the value of 1st with 4th arr[x][y+ i] = t1; rotateMatrix(arr,x+1,y+1,n-2); } } main(){ vector< vector<int> > arr = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}, }; cout<<"Original:\n"; disp(arr); rotateMatrix(arr,0,0,4); cout<<"\n\nAfter rotation:\n"; disp(arr); }
b2de0a6882e33d993d69ade9806e9d8fb9978e5b
8cf8bb79464a7d8d1d4a84b3eab4613fbc98149f
/3dtest/src/App.cpp
db9a19446f8d537268650a933dfdd97feacaadb7
[]
no_license
nikki93/spe
52910a06d89635902bb834b96977ca5e4453bf59
d4070bb54f9400ce0865680c0b6a5af99248a8b4
refs/heads/master
2021-01-22T23:26:21.230055
2012-07-13T18:33:39
2012-07-13T18:33:39
4,665,178
0
0
null
null
null
null
UTF-8
C++
false
false
5,356
cpp
App.cpp
#include "App.h" #include <ofGraphics.h> #include <of3dUtils.h> #include <ofAppRunner.h> #include "Frame.h" #include "Settings.h" #include "GUI.h" static void drawQuad(const ofVec2f &start, const ofVec2f &size, const ofVec2f &texSize) { ofVec2f end = start + size; glBegin(GL_QUADS); glTexCoord2f(0, 0 ); glVertex3f(start.x, start.y, 0); glTexCoord2f(texSize.x, 0 ); glVertex3f(end.x, start.y, 0); glTexCoord2f(texSize.x, texSize.y); glVertex3f(end.x, end.y, 0); glTexCoord2f(0, texSize.y); glVertex3f(start.x, end.y, 0); glEnd(); } //-------------------------------------------------------------- App::App() { } //-------------------------------------------------------------- void App::setup() { // gui _gui = new GUI(*this); // renderer setup _frame = new Frame(*this); _timer = 0.5; _timerSet = true; // camera _cam.setPosition(ofVec3f(80, 100, 80)); _cam.lookAt(ofVec3f(0, 50, 0)); // light _light.enable(); _light.setPointLight(); _light.setDiffuseColor(ofFloatColor(0.8, 0.5, 0.1)); _light.setPosition(40, 40, 40); // models //Model *m = new Model("data/models/dolphin/dolphin_000001.obj", 1, //ofMatrix4x4::newScaleMatrix(20, 20, 20)); ofDisableArbTex(); Model *m = new Model("data/models/ram/ram.obj", 1, ofMatrix4x4::newScaleMatrix(75, 75, 75)); _tex.loadImage("models/ram/ram.jpg"); m->tex = &(_tex.getTextureReference()); m->pos = ofVec3f(0, 10, 0); _models.push_back(m); // floor _floorTex.loadImage("floor.jpg"); } //-------------------------------------------------------------- void App::update() { if (_timer <= 0) { if (Settings::autoUpdate) newFrame(); } else if (_timerSet) _timer -= ofGetLastFrameTime(); else { // brush rendering bool more = _frame->moveBrushes(); _frame->drawBrushes(); _frame->combineFrame(); if (!more) { _timer = Settings::updateTime; _timerSet = true; } } } //-------------------------------------------------------------- void App::stepScene(float elapsed) { // camera rotation ofVec3f camPos = _cam.getPosition(); camPos.rotate(30 * elapsed, ofVec3f(0, 1, 0)); _cam.setPosition(camPos); _cam.lookAt(ofVec3f(0, 50, 0)); // model animation for (std::vector<Model *>::iterator i = _models.begin(); i != _models.end(); ++i) (*i)->update(elapsed); } //-------------------------------------------------------------- void App::draw() { _frame->debugDraw(); ofSetColor(ofColor::black); } //-------------------------------------------------------------- void App::drawScene() { _cam.begin(); glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT); // clear glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); ofDisableAlphaBlending(); ofEnableLighting(); ofBackground(ofColor::white); // axis /* ofSetColor(ofColor::gray); ofSphere(2); ofDrawAxis(20); */ // models, balls for (std::vector<Model *>::iterator i = _models.begin(); i != _models.end(); ++i) (*i)->draw(); // floor /* _floorTex.getTextureReference().bind(); glBegin(GL_QUADS); glTexCoord2f(1, 1); glNormal3f(0, 1, 0); glVertex3f( 100, 0, 100); glTexCoord2f(1, 0); glNormal3f(0, 1, 0); glVertex3f( 100, 0, -100); glTexCoord2f(0, 0); glNormal3f(0, 1, 0); glVertex3f(-100, 0, -100); glTexCoord2f(0, 1); glNormal3f(0, 1, 0); glVertex3f(-100, 0, 100); glEnd(); _floorTex.getTextureReference().unbind(); */ glPopAttrib(); _cam.end(); } //-------------------------------------------------------------- void App::exit() { // remove gui delete _gui; // remove models while (!_models.empty()) { delete _models.back(); _models.pop_back(); } } //-------------------------------------------------------------- void App::newFrame() { static int count = 0; _frame->writeToFile("vid/img" + ofToString(count++) + ".jpg"); _frame->endFrame(); _frame->newFrame(); _frame->createBrushes(); stepScene(0.03); _timerSet = false; _timer = Settings::updateTime; } //-------------------------------------------------------------- void App::keyPressed(int key) { switch (key) { case 'n': newFrame(); break; } } //-------------------------------------------------------------- void App::keyReleased(int key) { } //-------------------------------------------------------------- void App::mouseMoved(int x, int y ) { } //-------------------------------------------------------------- void App::mouseDragged(int x, int y, int button) { } //-------------------------------------------------------------- void App::mousePressed(int x, int y, int button) { } //-------------------------------------------------------------- void App::mouseReleased(int x, int y, int button) { } //-------------------------------------------------------------- void App::windowResized(int w, int h) { } //--------------------------------------------------------------
df80ee10025a028e2743b3bd41923b6f22e92b2b
906ee1ad46a9315216527fa844b004ba46605d4a
/PS2_touchpad_controlled_model_railroad.ino
3a17347fdc029d45be48d31951e4aa444356bb48
[]
no_license
KushagraK7/ArduinoTouchpadModelRailroad
4849d65f44fea5c95cd321b69ffb66588282a9e4
3c363563f45876b523287bbcb7555837234ba248
refs/heads/main
2023-06-09T09:45:36.675980
2021-07-06T05:53:32
2021-07-06T05:53:32
383,354,886
0
0
null
null
null
null
UTF-8
C++
false
false
3,772
ino
PS2_touchpad_controlled_model_railroad.ino
/* * Arduino code to control a model railroad layout using a PS/2 touchpad. * * Using a tochpad, three turnouts and one track power can be controlled. * The code can be modified to control more than one track power at a cost of a turnout. * * Watch the video:-https://youtu.be/CZaF_8HFH-k * * Made by Tech Build:-https://www.youtube.com/channel/UCNy7DyfhSD9jsQEgNwETp9g?sub_confirmation=1 * * Feel free to modify the code to adapt it to your application. */ #include<Adafruit_MotorShield.h> #include<ps2.h> Adafruit_MotorShield AFMS = Adafruit_MotorShield(); Adafruit_DCMotor *loco = AFMS.getMotor(1); Adafruit_DCMotor *turnoutA = AFMS.getMotor(2); Adafruit_DCMotor *turnoutB = AFMS.getMotor(3); Adafruit_DCMotor *turnoutC = AFMS.getMotor(4); PS2 mouse(6, 5);//PS2 mouse(Clock, Data); #define statLED 13//LED on pin 13 will light up whenever touchpad registers any difference in reading. char mstat; char mx; char my; int m, x, y; int s = 0; int sp; int limit = 1020;//Value proportional to the maximum value of the duty cycle of PWM waves //for track power(255). void loco_run() { if (sp > 0) { loco->setSpeed(sp); loco->run(FORWARD); } if (sp < 0) { loco->setSpeed(-sp); loco->run(BACKWARD); } if (sp == 0) { loco->setSpeed(sp); loco->run(RELEASE); } } void turnoutA_straight() { turnoutA->run(FORWARD); delay(25); turnoutA->run(RELEASE); } void turnoutA_side() { turnoutA->run(BACKWARD); delay(25); turnoutA->run(RELEASE); } void turnoutB_straight() { turnoutB->run(FORWARD); delay(25); turnoutB->run(RELEASE); } void turnoutB_side() { turnoutB->run(BACKWARD); delay(25); turnoutB->run(RELEASE); } void turnoutC_straight() { turnoutC->run(FORWARD); delay(25); turnoutC->run(RELEASE); } void turnoutC_side() { turnoutC->run(BACKWARD); delay(25); turnoutC->run(RELEASE); } void Read()//Function to read data from touchpad. { mouse.write(0xeb); // give me data! mouse.read(); // ignore ack mstat = mouse.read(); mx = mouse.read(); my = mouse.read(); m = (int)mstat; x = (int)mx; y = (int)my; } void setup() { // put your setup code here, to run once: AFMS.begin(960); pinMode(statLED, OUTPUT); //Initializing the PS/2 touchpad mouse.write(0xff); // reset mouse.read(); // ack byte mouse.read(); // blank */ mouse.read(); // blank */ mouse.write(0xf0); // remote mode mouse.read(); // ack delayMicroseconds(100); turnoutA->setSpeed(255); turnoutB->setSpeed(255); turnoutC->setSpeed(255); } void loop() { // put your main code here, to run repeatedly: Read(); if (m != 8) digitalWrite(statLED, HIGH); else digitalWrite(statLED, LOW); sp = map(s, -limit, limit, -255, 255); if (x > 0 && y > -4 && y < 4 && s < limit) s++; if (x < 0 && y > -4 && y < 4 && s > -limit) s--; if (y > 20 && x > -4 && x < 4) turnoutA_side(); if (y < -20 && x > -4 && x < 4) turnoutA_straight(); if (x > 20 && y > 20) turnoutB_side(); if (x < -20 && y < -20) turnoutB_straight(); if (x > 20 && y < -20) turnoutC_side(); if (x < -20 && y > 20) turnoutC_straight(); loco_run(); if (m == 9) { if (s > 0) for (s = s; s != 0; s--) { Read(); if(m != 8) break; sp = map(s, -limit, limit, -255, 255); loco_run(); delay(20); } if (s < 0) for (s = s; s != 0; s++) { Read(); if(m != 8) break; sp = map(s, -limit, limit, -255, 255); loco_run(); delay(20); } } }
570d1a9fea459017381acc481fa29cc623b2907e
8066845f914355359e18e8b664a78077e13942f8
/hw2/gcd.cpp
369bbbe30e6cea0255d3a02413c841d4f0dbbdd1
[]
no_license
danielpclin/NCU_Algo_HW
e99cd57c689217f8456bd09bf9b8467dd916221e
512657a5424445956019cccef10aaa38233f5fd8
refs/heads/master
2023-06-01T07:01:46.236408
2021-06-20T18:00:37
2021-06-20T18:00:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
365
cpp
gcd.cpp
#include <iostream> int main() { int T; std::cin >> T; for (int t = 1; t <= T; t++){ int first, second; std::cin >> first >> second; int temp; while (second != 0){ temp = second; second = first%second; first = temp; } std::cout << first << "\n"; } return 0; }
587a5539db694b6a35a7e88cba1069600219a43e
e6429c1e23f60002a1f8f4cddfb5d94db9954d97
/server/StreamLog.cpp
660d48dd41d6f8571a5f42033610fb8848e7cbce
[]
no_license
datalinkE/yet-another-server
aed3ff8e292488c1bd8c406797b3ab04572c527f
782f768ab70b5494b7409c3ede15d8025b3fc7f9
refs/heads/master
2021-01-22T14:45:01.097811
2013-11-20T14:33:55
2013-11-20T14:33:55
14,475,102
1
0
null
null
null
null
UTF-8
C++
false
false
844
cpp
StreamLog.cpp
#include "StreamLog.h" #include <cstring> using namespace std; StreamLog::StreamLog(::string ident, int facility) { _facility = facility; _priority = LOG_DEBUG; ::strncpy(_ident, ident.c_str(), sizeof(_ident)); _ident[sizeof(_ident)-1] = '\0'; openlog(_ident, LOG_PID, _facility); } int StreamLog::sync() { if (_buffer.length()) { syslog(_priority, _buffer.c_str()); _buffer.erase(); _priority = LOG_DEBUG; // default to debug for each message } return 0; } int StreamLog::overflow(int c) { if (c != EOF) { _buffer += static_cast<char>(c); } else { sync(); } return c; } ::ostream& operator<< (::ostream& os, const LogPriority& log_priority) { static_cast<StreamLog *>(os.rdbuf())->_priority = (int)log_priority; return os; }
e333b16c666a1406fe2ab7e321e3fa344151d74b
149a20eaaa0aff24daed7f3ad5d80b39a048eff0
/Tarea3/include/Nodo_Actividad.h
47e83e8e9b8757af0256e8aa83a3315a170dcc6c
[]
no_license
SelvinLP/EDD2019
88aee9df57a73dca3dc1448fdb689c80ddeb6c82
eb81cb6dd1e39e6c32d0285874edde18ba65760b
refs/heads/master
2022-02-23T18:04:33.531169
2019-09-06T23:08:07
2019-09-06T23:08:07
198,132,789
1
0
null
null
null
null
UTF-8
C++
false
false
209
h
Nodo_Actividad.h
#ifndef NODO_ACTIVIDAD_H #define NODO_ACTIVIDAD_H class Nodo_Actividad { public: Nodo_Actividad(); virtual ~Nodo_Actividad(); protected: private: }; #endif // NODO_ACTIVIDAD_H
4c2e68bbada0212bffb3f3c2363eb3e4ab62a1ec
c7c0ece47912c77f919241537b2a7b3a9347b862
/Lab 3/OutputResults.cpp
145d1495d159561546cc7123a964a528405fcb4e
[]
no_license
KermiteO/CS1D
b06d27002b910307d797a6618e3cd17ab42b2be0
0335fcef3d2b3c9872125a890f059c2aea121475
refs/heads/master
2021-01-01T10:56:48.704473
2020-02-09T05:54:46
2020-02-09T05:54:46
239,248,153
0
0
null
null
null
null
UTF-8
C++
false
false
1,572
cpp
OutputResults.cpp
/********************************************************************** * AUTHOR : Kermite & User * Lab #3 : Supplement: Coin Flip * CLASS : CS1B * SECTION : MW 8:00a - 11:50a * DUE DATE : 2/3/15 *********************************************************************/ #include "HeaderFile.h" /********************************************************************** * FUNCTION OutputResults * ___________________________________________________________________ * This function outputs the results of the game/program. * ___________________________________________________________________ * PRE-CONDITIONS * sumCount: the total times the coin was flipped * averageHead: the average # of times heads was flipped * headCount: the # of times heads was flipped * averageTotal: used to call function that calc's the averageHead * * POST-CONDITIONS * This function outputs the results of the game/program *********************************************************************/ void OuputResults(int &sumCount, //IN/OUT - the sum count int &averageHead, //CALC/OUT - the average # of head // flips int &headCount, //IN - the # of instances of // heads int averageTotal) //IN/CALC - the average total { cout << endl; cout << "It took you " << sumCount << " tosses to get 3 heads in a row.\n"; averageTotal = AvgCalc(sumCount, averageHead, headCount); cout << "On average you flipped heads " << averageTotal << "% of the time."; }
ec9e2782c993dbb80bbf22ade7b1473ee328fd4f
7e523ebd21dd89488b1b8c8e058874d9d013bc29
/sem 2/segtrees, range queries/TaskJ.cpp
e0e6263c9d75803c074e1ad1564442faa9ebf30e
[ "MIT" ]
permissive
greenIrina/ITMO-algo-labs
151736f5458396b106e0baf3d895ec681387a890
30517a91cf5b9231aa6bbc93db60df6186cd01d1
refs/heads/main
2023-01-04T10:40:23.245489
2020-10-20T17:49:21
2020-10-20T17:49:21
305,187,738
0
0
null
null
null
null
UTF-8
C++
false
false
2,641
cpp
TaskJ.cpp
#include <iostream> #include <vector> #include <unordered_set> #include <unordered_map> #include <set> #include <limits> using namespace std; #define mp make_pair typedef long long ll; class SegmentTree { public: int n, x; ll inf = numeric_limits<ll>::max(); vector<pair<ll, int>> t; vector<ll> d; void build() { x = 1; while (x < n) { x <<= 1; } for (int i = 0; i < n; i++) { t[x + i - 1] = {0, i}; } int j = x - 2; while (j > -1) { t[j] = min(t[2 * j + 1], t[2 * j + 2]); j--; } } void push(int v) { if (d[v] == -1) { return; } apply(v, 1); apply(v, 2); d[v] = -1; } void apply(int v, int u) { if (t[2 * v + u].first < d[v]) { t[2 * v + u].first = d[v]; d[2 * v + u] = d[v]; } } void update(int v, int l, int r, int a, int b, ll val, string& s) { if ((l > b) || (r < a)) { return; } if ((l >= a) && (r <= b)) { if (t[v].first < val) { d[v] = val; t[v].first = val; } return; } push(v); int m = (l + r) / 2; update(2 * v + 1, l, m, a, b, val, s); update(2 * v + 2, m + 1, r, a, b, val, s); t[v] = min(t[2 * v + 1], t[2 * v + 2]); } pair<ll, int> query(int v, int l, int r, int a, int b) { if ((l > b) || (r < a)) { return {inf, -1}; } if ((l >= a) && (r <= b)) { return t[v]; } push(v); int m = (l + r) / 2; auto x = min(query(2 * v + 1, l, m, a, b), query(2 * v + 2, m + 1, r, a, b)); t[v] = min(t[2 * v + 1], t[2 * v + 2]); return x; } explicit SegmentTree(int n) : n(n), t(), d(), x() { t.resize(static_cast<unsigned int>(n * 4), mp(inf, -1)); d.resize(static_cast<unsigned int>(n * 4), -1); build(); } }; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; SegmentTree sg(n); vector<ll> a; string s = "set"; for (int i = 0; i < m; i++) { int l, r, x; string type; cin >> type; cin >> l >> r; if (type == "defend") { cin >> x; sg.update(0, 0, sg.x - 1, l - 1, r - 1, x, s); continue; } auto ans = sg.query(0, 0, sg.x - 1, l - 1, r - 1); cout << ans.first << ' ' << (ans.second + 1) << endl; } return 0; }
d6cea1e9602da71a72ca798ffa195e316b3dbb5d
0a3a0da7358c55ebbfc3e1904e53409c6397ec1a
/Excel/mainwindow.h
b0dbb19b2fa1f868bdab313b186f8ddfd0bdc054
[]
no_license
Sokolov-Dmitriy/RPM
ab7aeb65153b9216b70b7828143a2f843ae301ca
7bb72026c5840b672608e62957d2707c441b7065
refs/heads/master
2022-11-15T05:17:26.327354
2020-07-07T09:32:30
2020-07-07T09:32:30
275,368,052
0
0
null
null
null
null
UTF-8
C++
false
false
2,699
h
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "QHBoxLayout" #include "QVBoxLayout" #include "QWidget" #include "QTableWidget" #include "QPushButton" #include "QString" #include "QFileDialog" #include <ActiveQt/qaxobject.h> #include <ActiveQt/qaxbase.h> class MainWindow : public QMainWindow { Q_OBJECT public: /** * @brief excel - указатель на Excel */ QAxObject* excel; /** * @brief workbooks - указатель на книги */ QAxObject* workbooks; /** * @brief workbook - указатель на директорию, откуда грузить книг */ QAxObject* workbook; /** * @brief sheets - указатель на список листов */ QAxObject* sheets; /** * @brief sheet - указатель на рабочий лист */ QAxObject* sheet ; /** * @brief tableWidget - указатель на таблицу */ QTableWidget* tableWidget; /** * @brief vLayout - общий layout */ QVBoxLayout* vLayout; /** * @brief widjet - указатель на главный QWidjet */ QWidget* widjet; /** * @brief rowCount - кол-во строк */ int rowCount=1; /** * @brief columnCount - кол-во столбцов */ int columnCount=1; /** * @brief link - путь до excel файла */ QString link; /** * @brief MainWindow - конструктор главного окна * @param parent - указатель на родительский объект */ MainWindow(QWidget *parent = nullptr); /** * @brief openExcel - функция открытия excel файла */ void openExcel(); /** * @brief writeInExcel - функция записи в excel файл */ void writeInExcel(); /** * @brief closeExcel - функция закрытия и сохранения excel файла */ void closeExcel(); //деструктор главного окна ~MainWindow(); public slots: /** * @brief addColumn - слот добавления новой колонки в таблицу */ void addColumn(); /** * @brief addRow - слот добавления новой строки в таблицу */ void addRow(); /** * @brief save - слот сохранени данных excel файл */ void save(); /** * @brief clean - слот очистки выделенных ячеек */ void clean(); private: }; #endif // MAINWINDOW_H
5a98749c51e85fd581e664251bf75034f5372b8e
ac2c7256e7b2f65a214ed92becf208283c6a34c8
/[DP]AmericanFootball.cpp
f4086d13084d0ecbf26d2f86a6fa1e196e6407d6
[ "MIT" ]
permissive
alchemz/mission-peace
6681e945c81b6f2be5e144aa86986f162f8f6faf
59a44b1e7a8fdfdf1f6743c0e6965b49e5291326
refs/heads/master
2020-03-15T23:07:34.260933
2018-06-29T15:44:39
2018-06-29T15:44:39
132,387,519
0
0
null
null
null
null
UTF-8
C++
false
false
828
cpp
[DP]AmericanFootball.cpp
/* American football game safety: 2 pts filed goal: 3 pts touchdown: 7 pts Write a program that takes a final score, and returns the number of combo */ #include<iostream> #include<vector> #include<algorithm> using namespace std; int NumComb(int score, const vector<int> &plays){ int size_ = plays.size(); vector<vector<int>> all_comb(size_, vector<int>(score+1, 0)); for(int i=0; i<size_; i++){ all_comb[i][0]=1;//0分 for(int j=1; j<=score; j++){ int without_play= i>=1 ? all_comb[i-1][j]:0; //above int with_play = j>=plays[i] ? all_comb[i][j-plays[i]]:0;//left all_comb[i][j]=without_play + with_play; } } return all_comb.back().back();//all_comb[size_-1][score] } int main(){ vector<int> plays={2,3,7}; cout<<NumComb(12, plays); return 0; } //time: O(sn) space:O(sn)