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
752853d668583d1ced83fd299ed3459a25004f02
19924b4dfb05af88ddbad69411097fc94ed3d2ef
/src/ECS/entitysystem.h
c528fdd1ba5f32f575e7931992dd36eaf1622c55
[]
no_license
Gallasko/BasicLibrary
faac8bfdc34680989f5c7353529cd7c7a31a74d8
00ffb3c83750ef0261a1e585e8718355fa8b39d5
refs/heads/master
2023-02-24T09:17:47.219935
2021-01-25T03:17:54
2021-01-25T03:17:54
325,675,001
0
0
null
null
null
null
UTF-8
C++
false
false
16,256
h
entitysystem.h
#pragma once #include <unordered_map> #include <string> #include <vector> class EntitySystem { public: EntitySystem() {}; struct GenericComponent { unsigned int entityId; GenericComponent *prev; GenericComponent *next; void *data; }; class Entity { friend class EntitySystem; public: Entity(unsigned int id, Entity *previousEntity) : id(id), previousEntity(previousEntity), nextEntity(nullptr) {} template <typename Component> inline bool has() const { return has(typeid(Component).name()); } template <typename Component> inline Component* get() { return has<Component>() ? static_cast<Component* >(componentList[typeid(Component).name()]->data) : nullptr; } protected: inline bool has(std::string id) const { return componentList.find(id) != componentList.end(); } template <typename Component> inline EntitySystem::GenericComponent* getComponent() { return has<Component>() ? componentList[typeid(Component).name()] : nullptr; } inline EntitySystem::GenericComponent* getComponent(std::string id) { return has(id) ? componentList[id] : nullptr; } unsigned int id; Entity *previousEntity; Entity *nextEntity; std::unordered_map<std::string, EntitySystem::GenericComponent*> componentList; }; template <typename Component> class ComponentList { public: ComponentList(EntitySystem::GenericComponent *componentNodes) : head(componentNodes), tail(nullptr) {} ComponentList() : head(nullptr), tail(nullptr) {} class Iterator { friend class EntitySystem; friend class ComponentList; public: Iterator() : node(nullptr) {} //Pre Increment inline Iterator& operator++() { node = node->next; return *this; } //Post Increment inline Iterator operator++(int) { Iterator old = *this; node = node->next; return old; } inline bool operator==(const Iterator& rhs) const { return node == rhs.node; } inline bool operator!=(const Iterator& rhs) const { return node != rhs.node; } inline Component& operator*() const { return *(static_cast<Component* >(node->data)); } protected: Iterator(EntitySystem::GenericComponent *componentNodes) : node(componentNodes) {} private: EntitySystem::GenericComponent *node; }; inline Iterator begin() { return head; } inline Iterator end() { return tail; } private: Iterator head; Iterator tail; }; class GroupList { friend class EntitySystem; public: class GroupItem { friend class EntitySystem; friend class GroupList; public: GroupItem(unsigned int id) : entityId(id) { } inline bool has(std::string id) const { return componentList.find(id) != componentList.end(); } template <typename Component> inline bool has() const { return has(typeid(Component).name()); } template <typename Component> inline Component* get() { return has<Component>() ? static_cast<Component* >(componentList[typeid(Component).name()]->data) : nullptr; } private: unsigned int entityId; std::unordered_map<std::string, EntitySystem::GenericComponent*> componentList; GroupItem *next = nullptr; }; class Iterator { friend class GroupList; public: Iterator() : node(nullptr) {} Iterator(const EntitySystem::GroupList::Iterator& copy) : node(copy.node) {} //Pre Increment inline Iterator& operator++() { node = node->next; return *this; } //Post Increment inline Iterator operator++(int) { Iterator old = *this; node = node->next; return old; } inline bool operator==(const Iterator& rhs) const { return node == rhs.node; } inline bool operator!=(const Iterator& rhs) const { return node != rhs.node; } inline GroupList::GroupItem& operator*() const { return *node; } protected: Iterator(GroupList::GroupItem *componentNodes) : node(componentNodes) {} inline void deleteNode() { delete node; } private: EntitySystem::GroupList::GroupItem *node; }; GroupList() : head(nullptr), tail(nullptr), nbElement(0) {} GroupList(EntitySystem::GroupList::GroupItem *first, unsigned int nbElement) : head(first), tail(nullptr), nbElement(nbElement) {} GroupList(const GroupList& copy) : head(copy.head), tail(copy.tail), nbElement(copy.nbElement) {} inline Iterator begin() { return head; } inline Iterator end() { return tail; } inline unsigned int size() const { return nbElement; } inline bool isEmpty() const { return nbElement == 0; } inline void append(EntitySystem::GroupList::GroupItem *item) { item->next = head.node; head.node = item; nbElement++; }; void erase(unsigned int entityId); bool changeId(unsigned int idToBeChanged, unsigned int newId); bool find(unsigned int entityId); inline bool find(EntitySystem::Entity *entity) { return find(entity->id); } private: Iterator head; Iterator tail; unsigned int nbElement; }; inline EntitySystem::Entity* createEntity() { EntitySystem::Entity *newEntity = new EntitySystem::Entity {nbEntity++, lastEntity}; if(lastEntity != nullptr) { lastEntity->nextEntity = newEntity; } lastEntity = newEntity; return newEntity; } void removeEntity(EntitySystem::Entity* entity); template <typename Component> Component* attach(EntitySystem::Entity *entity, const Component& component); template <typename Component> void dettach(EntitySystem::Entity *entity); template <typename Component> EntitySystem::ComponentList<Component> view(); template <typename Component, typename... Group> EntitySystem::GroupList* registerGroup(); template <typename Component, typename... Group> EntitySystem::GroupList group(); //template <typename FirstComponent, typename... RestComponent> //std::vector<Entity* > group(); private: template <typename Component, typename... Args> auto typeToId() -> typename std::enable_if<(sizeof...(Args) == 0), std::string>::type { return std::string(typeid(Component).name()) + std::string(";"); } template <typename First, typename... Next> auto typeToId() -> typename std::enable_if<(sizeof...(Next) > 0), std::string>::type { return typeToId<First>() + typeToId<Next...>(); } template <typename Component, typename... Args> auto addViewToVector(std::vector<EntitySystem::GenericComponent *> *vec) -> typename std::enable_if<(sizeof...(Args) == 0), bool>::type { auto id = typeid(Component).name(); if(componentMap.find(id) != componentMap.end()) { vec->push_back(componentMap[id]); return true; } else return false; } template <typename First, typename... Next> auto addViewToVector(std::vector<EntitySystem::GenericComponent *> *vec) -> typename std::enable_if<(sizeof...(Next) > 0), bool>::type { return addViewToVector<First>(vec) && addViewToVector<Next...>(vec); } bool inline isGroupRegistered(std::string id) { return groupList.find(id) == groupList.end() ? false : true; } std::unordered_map<std::string, EntitySystem::GenericComponent* >::iterator dettach(EntitySystem::Entity *entity, std::string id, std::unordered_map<std::string, EntitySystem::GenericComponent* >::iterator it); void moveBack(EntitySystem::Entity *entity, std::string id, EntitySystem::GenericComponent *component); bool isEntityInGroup(EntitySystem::Entity *entity, std::string groupName); unsigned int nbEntity = 0; Entity *lastEntity = nullptr; std::unordered_map<std::string, EntitySystem::GenericComponent*> componentMap; std::unordered_map<std::string, EntitySystem::GroupList*> groupList; std::unordered_map<std::string, std::vector<std::string>> groupNameSpliceList; }; template <typename Component> Component* EntitySystem::attach(EntitySystem::Entity *entity, const Component& component) { auto id = typeid(Component).name(); Component *cmp = new Component(component); if(entity->has<Component>()) { entity->componentList[id]->data = cmp; } else { if(componentMap.find(id) == componentMap.end()) { EntitySystem::GenericComponent *cp = new EntitySystem::GenericComponent {entity->id, nullptr, nullptr, cmp}; componentMap[id] = cp; entity->componentList[id] = cp; } else { if(componentMap[id]->prev == nullptr) { EntitySystem::GenericComponent *cp = new EntitySystem::GenericComponent {entity->id, componentMap[id], nullptr, cmp}; componentMap[id]->prev = cp; componentMap[id]->next = cp; entity->componentList[id] = cp; moveBack(entity, id, cp); } else { EntitySystem::GenericComponent *cp = new EntitySystem::GenericComponent {entity->id, componentMap[id]->prev, nullptr, cmp}; componentMap[id]->prev->next = cp; componentMap[id]->prev = cp; entity->componentList[id] = cp; moveBack(entity, id, cp); } } for(auto it : groupList) { if(isEntityInGroup(entity, it.first)) { if(!it.second->find(entity)) { auto item = new EntitySystem::GroupList::GroupItem(entity->id); for(auto it2 : groupNameSpliceList[it.first]) item->componentList[it2] = entity->getComponent(it2); it.second->append(item); } } } } return cmp; } template <typename Component> void EntitySystem::dettach(EntitySystem::Entity *entity) { auto id = typeid(Component).name(); if(componentMap.find(id) != componentMap.end()) { EntitySystem::GenericComponent* component = entity->getComponent<Component>(); if(component != nullptr) { // if prev is nullptr it means that it was the only element of the list if(component->prev != nullptr) { if(component->next == nullptr) // if component is the last element of the list { component->prev->next = nullptr; if(component->prev == componentMap[id]) { componentMap[id]->prev = nullptr; } else { componentMap[id]->prev = component->prev; } } else { if(component->prev != component->next) // if prev == next it means that there are only 2 elements in the list; { if(component->prev->next == nullptr) // it means that the current component is the first one { componentMap[id] = component->next; } else { component->prev->next = component->next; } component->next->prev = component->prev; } else { componentMap[id] = component->next; component->next->prev = nullptr; } } } else { componentMap.erase(id); } entity->componentList.erase(id); delete component; for(auto it : groupList) { if(it.first.find(id) != std::string::npos) it.second->erase(entity->id); } } } } template <typename Component> EntitySystem::ComponentList<Component> EntitySystem::view() { auto id = typeid(Component).name(); if(componentMap.find(id) != componentMap.end()) return EntitySystem::ComponentList<Component>(componentMap[id]); else return EntitySystem::ComponentList<Component>(); } template <typename Component, typename... Group> EntitySystem::GroupList* EntitySystem::registerGroup() { auto groupId = typeToId<Component, Group...>(); if(!isGroupRegistered(groupId)) groupList[groupId] = new EntitySystem::GroupList(group<Component, Group...>()); return groupList[groupId]; } template <typename Component, typename... Group> EntitySystem::GroupList EntitySystem::group() { auto groupId = typeToId<Component, Group...>(); if(isGroupRegistered(groupId)) { return *groupList[groupId]; } else { std::vector<EntitySystem::GenericComponent *> idList; auto groupName = groupId; std::vector<std::string> idNames; std::string delimiter = ";"; size_t pos = 0; while ((pos = groupId.find(delimiter)) != std::string::npos) { idNames.push_back(groupId.substr(0, pos)); groupId.erase(0, pos + delimiter.length()); } groupNameSpliceList[groupName] = idNames; if(addViewToVector<Component, Group...>(&idList)) { unsigned int currentEntityId = 0; unsigned int nbElement = 0; EntitySystem::GroupList::GroupItem *currentItem = nullptr; EntitySystem::GroupList::GroupItem *firstItem = nullptr; bool isFirstItem = true; bool sameEntityId = false; bool end = false; do { do { for (auto& node : idList) { if(!end) { while(node->entityId < currentEntityId && node->next != nullptr) node = node->next; if(node->next == nullptr && node->entityId < currentEntityId) end = true; if(node->entityId > currentEntityId) currentEntityId = node->entityId; } } sameEntityId = true; for (auto& node : idList) if(node->entityId != currentEntityId) sameEntityId = false; } while ( !end && !sameEntityId ); if(!end) { if(isFirstItem) { firstItem = new EntitySystem::GroupList::GroupItem(currentEntityId); currentItem = firstItem; isFirstItem = false; } else { currentItem->next = new EntitySystem::GroupList::GroupItem(currentEntityId); currentItem = currentItem->next; } for (int x = 0; x < static_cast<int>(idNames.size()); x++) currentItem->componentList[idNames[x]] = idList[x]; nbElement++; currentEntityId++; } } while (!end); return EntitySystem::GroupList(firstItem, nbElement); } else { return EntitySystem::GroupList(); } } return EntitySystem::GroupList(); }
770e9cfb6a2954f772dfd66cde8ae44bf1f8a4df
709001130bed2c061d8340dd7133fef3fe4a99c5
/WinServer/NetWork/Connector.cpp
605bb6a71abb40f2969ca42f69e3a3e6af5d3d5f
[]
no_license
zh423328/WinServer
c4de29e13b83920a391747ce9248a7b7797ea514
66e7373eba594bd7ab998184b9df320a6cd1933e
refs/heads/master
2021-01-23T13:47:47.242336
2015-04-27T13:53:42
2015-04-27T13:53:42
33,388,988
1
0
null
null
null
null
GB18030
C++
false
false
1,832
cpp
Connector.cpp
#include "Session.h" #include "SessionList.h" #include "Connector.h" #include "TcpServer.h" DWORD WINAPI CConnector::_ConnectThread( LPVOID lpParam ) { CConnector *pConnector = (CConnector*)lpParam; if (pConnector) { while (!pConnector->m_bShutDown) { xe_uint32 dwRet = WaitForSingleObject(pConnector->m_hEvent,INFINITE); if(dwRet == WAIT_OBJECT_0) { while(!pConnector->m_pConnectList->empty()) { //触发读取一个数据 pConnector->m_pConnectList->Lock(); CSession *pSession = pConnector->m_pConnectList->front(); pConnector->m_pConnectList->pop_front(); pConnector->m_pConnectList->UnLock(); if (pSession == NULL) continue; xe_uint32 nRetConnect = connect(pSession->GetSocket(),(SOCKADDR*)pSession->GetSockAddr(),sizeof(SOCKADDR_IN)); if (nRetConnect == SOCKET_ERROR) { pConnector->m_pParent->AddConnectSuccessList(pSession); } else { pConnector->AddConnectList(pSession); //插入 } } } } return 1; } return 0; } CConnector::CConnector( cIocpServer *pParent ) { m_pParent = pParent; m_pConnectList = new CSessionList(); m_hEvent = CreateEvent(NULL,TRUE,FALSE,NULL); m_hThread = INVALID_HANDLE_VALUE; } CConnector::~CConnector() { Stop(); CloseHandle(m_hEvent); CloseHandle(m_hThread); } void CConnector::AddConnectList( CSession *pSession ) { m_pConnectList->Lock(); m_pConnectList->push_back(pSession); m_pConnectList->UnLock(); SetEvent(m_hEvent); } bool CConnector::Start() { m_bShutDown = false; //创建一条线程 DWORD dwThread; m_hThread = CreateThread(NULL,0,_ConnectThread,this,0,&dwThread); return m_hThread != INVALID_HANDLE_VALUE; } void CConnector::Stop() { m_bShutDown = true; SetEvent(m_hEvent); WaitForSingleObject(m_hThread,INFINITE); }
ce3ea644a1892b854918685c19b346e79337b527
64aca0dda6624b956cac6d22d892d6416476e814
/Binary Tree/diameterOfTree(BottomUp).cpp
2cc695a13f62971c2c199225a896074f1bb53350
[]
no_license
Darkknight1299/C-plus-plus
c772331a87ab36fb01036703370b1108d8aff901
0255dfa1609401234eb627463f1e7d0a3058b684
refs/heads/main
2023-06-24T11:05:55.068853
2021-07-20T12:59:48
2021-07-20T12:59:48
344,157,787
0
0
null
null
null
null
UTF-8
C++
false
false
1,346
cpp
diameterOfTree(BottomUp).cpp
#include<bits/stdc++.h> using namespace std; class node{ public: int data; node* left; node* right; node(int d){ data=d; left=NULL; right=NULL; } }; node* buildtree(){ int d; cin>>d; if(d==-1){ return NULL; } node* root=new node(d); root->left=buildtree(); root->right=buildtree(); return root; } void print(node* root){ if(root=NULL){ return; } //Print root first and then children cout<<root->data<<" "; print(root->left); print(root->right); } int height(node* root){ //Base case if(root==NULL){ return 0; } //rec case int left_h=height(root->left); int right_h=height(root->right); return max(left_h,right_h)+1; } class Pair{ public: int height; int diameter; }; Pair fastDiameter(node* root){ Pair p; if(root==NULL){ p.diameter=p.height=0; return p; } Pair left=fastDiameter(root->left); Pair right=fastDiameter(root->right); p.height=max(left.height,right.height)+1; p.diameter=max(left.height+right.height,max(left.diameter,right.diameter)); return p; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // code starts node* root=buildtree(); print(root); }
2553452f86f87911955c6af30feb36d2fc9fe2fd
2f069daa0e42d523014593013c296fd3734ff475
/alpha6124/CMyLib.cpp
9b98d34568813de9d296bf47a0262687802e23a8
[]
no_license
fangyang86/alpha6124
b1ed2ecefba2b6da215fece124c5b0353bfc1194
93de118c6c3af28585afff57cb2fdc6d9364d8b7
refs/heads/master
2021-09-04T08:26:50.522206
2018-01-17T09:38:05
2018-01-17T09:38:05
113,480,876
0
0
null
null
null
null
UTF-8
C++
false
false
840
cpp
CMyLib.cpp
#include "stdafx.h" #include <direct.h> #include <stdio.h> #include <stdlib.h> #include "CMyLib.h" CMyLib::CMyLib() { } CMyLib::~CMyLib() { } void CMyLib::initGPS() { m_gps.nState = 0; m_gps.nField = 0; m_gps.nLen = 0; m_gps.nValidChar = 0; m_gps.x = 0.; m_gps.y = 0.; } int CMyLib::gpsParse1(char c) { return 0; } int CMyLib::gpsParse(char *fn) { FILE *fp; int c; initGPS(); fp = fopen(fn, "rt"); if (fp == NULL) return -1; printf(" open gps txt OK\n"); while (!feof(fp)) { c = fgetc(fp); //printf("%c", c); } fclose(fp); gpsPrint(); return 0; } int CMyLib::gpsPrint() { char buf[200]; getcwd(buf, 100); buf[199] = 0; printf("current dir: %s\n", buf); printf("state:%d \n", m_gps.nState); printf(" x: %.4f y: %.4f \n", m_gps.x, m_gps.y); return 0; } int CMyLib::test(int n) { return n+1; }
6c88722283ccdcd23c8b7222fb4b09bc81702523
6f9ca9684edca7c507062744c9cbcbf91d8a9f02
/src/common_ui/KPosComboBoxSimple.cpp
22a15d45904691c8608a673c4ec3303a853bacee
[]
no_license
yangchenglin815/kmis
e039a32c42965ccfc8a6b4396f6264eec24a2e76
d06bafa60c9a87b5ed5617adc0a39a82ec0c89d7
refs/heads/master
2020-05-04T06:39:25.653287
2019-07-25T03:14:03
2019-07-25T03:14:03
179,011,069
2
2
null
null
null
null
UTF-8
C++
false
false
1,872
cpp
KPosComboBoxSimple.cpp
#include "KPosComboBoxSimple.h" #include <QPainter> KPosComboBoxSimple::KPosComboBoxSimple(QWidget *parent) : QWidget(parent) , m_sContent("") , m_sOutLineColor("#ea8852") , m_bHasOutline(true) , m_nFontSize(14) { } void KPosComboBoxSimple::setContent(QString content) { m_sContent = content; update(); } void KPosComboBoxSimple::setFontSize(int nFontSize) { m_nFontSize = nFontSize; } void KPosComboBoxSimple::paintEvent(QPaintEvent *event) { QWidget::paintEvent(event); QPainter painter(this); int nWidth = this->width(); int nHeight = this->height(); // 区域颜色 QRect rect(0, 0, nWidth, nHeight); if (m_bHasOutline) { painter.setPen(QPen(QBrush(QColor(m_sOutLineColor)), 2, Qt::SolidLine));//设置画笔形式 } else { painter.setPen(QPen(QBrush(QColor(m_sOutLineColor)), 2, Qt::NoPen));//设置画笔形式 } painter.setBrush(QBrush("#ffffff"));//设置画刷形式 painter.drawRect(rect); // 区域文字 int nXPos = 12; int nYPos = 0; QFont font; font.setPixelSize(m_nFontSize); font.setFamily("微软雅黑"); painter.setFont(font); QPen pen; pen.setColor("#666666"); painter.setPen(pen); QRect textRect(nXPos, nYPos, nWidth, nHeight); painter.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, m_sContent); // 勾选 int nArrowWidth = 9; int nArrowHeight = 9; int nRightSpace = 6; nXPos = nWidth - nArrowWidth - nRightSpace; nYPos = (nHeight - nArrowHeight)/2; QPixmap selectedPixmap(":/kPosSetImage/dropDownArrow.png"); QRect selectedRect(nXPos, nYPos, nArrowWidth, nArrowHeight); painter.drawPixmap(selectedRect, selectedPixmap); } void KPosComboBoxSimple::mousePressEvent(QMouseEvent *event) { QWidget::mousePressEvent(event); emit sigClicked(); }
e7c9f1b3f1e21b3b2f9db3dd692e5c825ec2604e
e99594290d471bb57b5601773e0badf49ecdb71c
/engine/MyGUI/MyPlatform.h
cd4e3b1d09804fc95d70130a3697d13d577679b5
[]
no_license
chenxiaobin3000/xengine
0c08805a1b675f4ba90d7fef36baa74aaf15beaa
8f8def65692e4b58b1167f96012d767f6c620e80
refs/heads/master
2021-01-15T15:31:30.486855
2016-09-20T07:14:43
2016-09-20T07:14:43
51,683,277
0
0
null
null
null
null
UTF-8
C++
false
false
650
h
MyPlatform.h
/** * desc: * auth: chenxiaobin * data: 2016-01-25 */ #ifndef _MY_PLATFORM_H_ #define _MY_PLATFORM_H_ #include "MyGUI_Prerequest.h" #include "MyGUI_LogManager.h" #include "MyRenderManager.h" #include "MyDataManager.h" namespace MyGUI { class MyPlatform { public: MyPlatform(); ~MyPlatform(); void initialise(const std::string& _logName = "MyGUI.log"); void shutdown(); MyRenderManager* getRenderManagerPtr(); MyDataManager* getDataManagerPtr(); private: bool mIsInitialise; MyRenderManager* mRenderManager; MyDataManager* mDataManager; LogManager* mLogManager; }; } // namespace MyGUI #endif // _MY_PLATFORM_H_
73e1df77a24f6430107410c48b7a9dfe9556c4ae
69c317338c02622c77c3e9b8add6a115ec2774d2
/61HW9Q2.cpp
eb4a1739cb9da660f19804bc38c31e51d75f495d
[]
no_license
sunbun99/Schoolwork-Practice
9416265e99b27fc29d2504b53a3b3542e112d694
059b01173cdd25a2ef65d105a01fdc48b966572b
refs/heads/master
2021-09-21T06:35:15.837661
2018-08-21T18:11:27
2018-08-21T18:11:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,457
cpp
61HW9Q2.cpp
#include <iostream> #include <fstream> #include <vector> #include <cstdlib> #include <string> #include "graph.h" using namespace std; int main() { ifstream instream; instream.open("knuth.txt"); if(instream.fail()) { cout << "Input file opening failed." << endl; exit(1); } vector<string> v; graph g; string str; while(instream >> str) { g.add_vertex(str); v.push_pack(str); string str2; for(size_t i = 0; i < v.size(); i++) { str2[i] = v[i]; size_t count = 0; for(size_t j = 0; j < str.size(); j++) { if(str[j] != str2[j]) { count++; } if(count == 1) { g.add_edge(str, str2); } } } } vector<string> one {"black", "tears", "small", "stone", "angel", "amino", "angel"}; vector<string> two {"white", "smile", "giant", "money", "devil", "right", "signs"}; vector<strign>::iterator iter; for(size_t k = 0; k < one.size(); k++) { vector<string> three = g.path(one[k], two[k]); cout << one[i] << " - " << two[i] << " : "; for(iter = three.end(); iter != three.begin(); iter++) { cout << *iter << " " } cout << endl; } return 0; }
49370c57cd062c5cd9d74de50904b690045e4850
33b567f6828bbb06c22a6fdf903448bbe3b78a4f
/opencascade/Prs3d_ToolDisk.hxx
7b4fea28dff6505e6e075d5c65fb8e50f79611f0
[ "Apache-2.0" ]
permissive
CadQuery/OCP
fbee9663df7ae2c948af66a650808079575112b5
b5cb181491c9900a40de86368006c73f169c0340
refs/heads/master
2023-07-10T18:35:44.225848
2023-06-12T18:09:07
2023-06-12T18:09:07
228,692,262
64
28
Apache-2.0
2023-09-11T12:40:09
2019-12-17T20:02:11
C++
UTF-8
C++
false
false
3,507
hxx
Prs3d_ToolDisk.hxx
// Created on: 2016-02-04 // Created by: Anastasia BORISOVA // Copyright (c) 2016 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _Prs3d_ToolDisk_HeaderFile #define _Prs3d_ToolDisk_HeaderFile #include <Prs3d_ToolQuadric.hxx> //! Standard presentation algorithm that outputs graphical primitives for disk surface. class Prs3d_ToolDisk : public Prs3d_ToolQuadric { public: //! Generate primitives for 3D quadric surface. //! @param theInnerRadius [in] inner disc radius //! @param theOuterRadius [in] outer disc radius //! @param theNbSlices [in] number of slices within U parameter //! @param theNbStacks [in] number of stacks within V parameter //! @param theTrsf [in] optional transformation to apply //! @return generated triangulation Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theInnerRadius, const Standard_Real theOuterRadius, const Standard_Integer theNbSlices, const Standard_Integer theNbStacks, const gp_Trsf& theTrsf); public: //! Initializes the algorithm creating a disk. //! @param theInnerRadius [in] inner disk radius //! @param theOuterRadius [in] outer disk radius //! @param theNbSlices [in] number of slices within U parameter //! @param theNbStacks [in] number of stacks within V parameter Standard_EXPORT Prs3d_ToolDisk (const Standard_Real theInnerRadius, const Standard_Real theOuterRadius, const Standard_Integer theNbSlices, const Standard_Integer theNbStacks); //! Set angle range in radians [0, 2*PI] by default. //! @param theStartAngle [in] Start angle in counter clockwise order //! @param theEndAngle [in] End angle in counter clockwise order void SetAngleRange (Standard_Real theStartAngle, Standard_Real theEndAngle) { myStartAngle = theStartAngle; myEndAngle = theEndAngle; } protected: //! Computes vertex at given parameter location of the surface. Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE; //! Computes normal at given parameter location of the surface. virtual gp_Dir Normal (const Standard_Real , const Standard_Real ) const Standard_OVERRIDE { return gp_Dir (0.0, 0.0, -1.0); } protected: Standard_Real myInnerRadius; //!< Inner disk radius Standard_Real myOuterRadius; //!< Outer disk radius Standard_Real myStartAngle; //!< Start angle in counter clockwise order Standard_Real myEndAngle; //!< End angle in counter clockwise order }; #endif
776bec05be433bc52bcb39f9029892eb9ab79c96
ee6b1fb4345b2a9c05618d0a9fa3d24660b902ca
/image-editor/h/Image.h
37a1232d9b2a6a701d790cac2bd4fb4ccaa6d8d9
[]
no_license
maslarevicolga/image-editor
6ffdfd66f2a0cf7ab028964d30fb1df0928c20f1
25f1983eadbe6761cafa0109765b01d03308163e
refs/heads/master
2022-12-21T15:53:00.737061
2020-10-01T10:17:21
2020-10-01T10:17:21
300,222,959
0
0
null
null
null
null
UTF-8
C++
false
false
1,179
h
Image.h
#ifndef _IMAGE_H #define _IMAGE_H #include "ImageSelections.h" #include "ImageLayers.h" #include "Image_Operation.h" #include "Formater.h" class Image { //singleton class ImageSelections selections; ImageLayers layers; Image_Operation operation; Formater* formater = nullptr; static Image* instance; Image(); public: static Image* createInstance(); const ImageSelections& getSelectionObject() const{ return selections; } const ImageLayers& getLayerObject() const{ return layers; } const Image_Operation& getOperationObject() const{ return operation; } ImageSelections& getSelectionObject() { return selections; } ImageLayers& getLayerObject() { return layers; } Image_Operation& getOperationObject() { return operation; } void fill(std::string& name, std::tuple<int, int, int>); //fill selection with given rgb color void readFromFile(const std::string&); void writeToFile(const std::string&); void saveProject(const std::string&); void loadProject(const std::string&); void loadFun(const std::string&); void execute(const std::string, int = _DEFAULT_PARAM); void applyOperation(const std::string&); void drawOnConsole() const; }; #endif
67ada20f09bbb189baf8f3606d0c662de459ea86
2c171bed180cb207bc17e7fe2f97f473868d0120
/Sphere.h
73347c9ef04fe47d0829f69c48cc5a940ea76374
[]
no_license
guptapiyush8871/BasicRayTracer
5c8d3a29e1ad97c3c1a97e0926c5a2b5ca79234d
706ecc158985f4fc27d7fd7660f342a28f9584b1
refs/heads/master
2020-04-03T12:46:06.774871
2018-12-09T13:33:32
2018-12-09T13:33:32
155,263,205
0
0
null
null
null
null
UTF-8
C++
false
false
578
h
Sphere.h
#ifndef SPHERE_H #define SPHERE_H #include "Shape.h" #include "Vertex3f.h" class Sphere : public Shape { public: Sphere(); Sphere(const Vertex3f iCenter, const RGBAColor iColor, const float iRadius); Sphere(const Sphere& iSphere); virtual ~Sphere(); virtual void SetColor(const RGBAColor& iColor); virtual RGBAColor GetColor() const; virtual const Shape* GetShape() const; virtual void Hit(const Ray& iRay, Sample& oSample) const; float GetRadius() const; private: Vertex3f m_Center; RGBAColor m_Color; float m_Radius; }; #endif
fb8b1bb70aefb3418e941c0a22f311fba66e5ac0
ceaeacda04d25169b55814ed19e658b7d1e443c6
/main.cpp
84d334337cdcb8e0b8cf7827ff8cce48def3686e
[]
no_license
Huy1996/CMPE-126-Project
01040a8b0fe1217b09230ed43e08fa1d59833f49
e695ceec4a81d9fd9f8396f9b3467995a43d5ab6
refs/heads/main
2023-01-12T10:43:25.160097
2020-11-21T06:25:55
2020-11-21T06:25:55
311,329,085
0
0
null
null
null
null
UTF-8
C++
false
false
886
cpp
main.cpp
// // Created by minhh on 10/29/2020. // #include "school.h" int main() { cout << "Nguyen Minh Huy Duong\n"; cout << "014701349\n"; bool valid = true; do { cout << "\nWhich page do you want to access?\n"; cout << "(1) Professor.\n(2) Student.\n(3) Exit.\n"; cout << "Your choice: "; string choice; getline(cin, choice); if(choice == "1" && valid) { teacher professor; valid = professor.login(); } else if(choice == "1" && !valid) cout << "Professor page have been locked.\n"; else if(choice == "2") { access stu; stu.student_command(); } else if(choice == "3") { return 0; } else cout << "Invalid input. Please try again.\n\n"; } while(true); }
298daf9443db6983359b8530dbb8492178f1e5ef
4689a9333948eb4f6ac5977820d98d5ea5cf03bd
/src/elliptic/amgSolver/parAlmond/utils.hpp
352c5a7c076dda1231bc6c11744ed280b1120db5
[ "BSD-3-Clause" ]
permissive
spatel81/nekRS
95315d455687c781f268a290353079a9c5aadb3a
8ee9c381f86f5f70867d942616e585ee726a8ca1
refs/heads/master
2023-05-24T03:31:00.650283
2022-05-13T09:31:06
2022-05-13T09:31:06
280,201,246
0
0
NOASSERTION
2020-07-16T16:18:55
2020-07-16T16:18:54
null
UTF-8
C++
false
false
2,895
hpp
utils.hpp
/* The MIT License (MIT) Copyright (c) 2017 Tim Warburton, Noel Chalmers, Jesse Chan, Ali Karakus, Rajesh Gandham Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef PARALMOND_UTILS_HPP #define PARALMOND_UTILS_HPP namespace parAlmond { //scratch space extern size_t scratchSpaceBytes; extern void *scratch; extern occa::memory o_scratch; extern size_t pinnedScratchSpaceBytes; extern void *pinnedScratch; extern occa::memory o_pinnedScratch; extern size_t reductionScratchBytes; extern void *reductionScratch; extern occa::memory o_reductionScratch; void allocateScratchSpace(size_t requiredBytes, occa::device device); void allocatePinnedScratchSpace(size_t requiredBytes, occa::device device); void freeScratchSpace(); void freePinnedScratchSpace(); struct parallelId_t { dlong localId; hlong globalId; dlong newId; }; struct parallelAggregate_t { dlong fineId; hlong coarseId; hlong newCoarseId; int originRank; int ownerRank; }; struct nonzero_t { hlong row; hlong col; dfloat val; }; int CompareGlobalId(const void *a, const void *b); int CompareLocalId(const void *a, const void *b); int compareOwner(const void *a, const void *b); int compareAgg(const void *a, const void *b); int compareOrigin(const void *a, const void *b); int compareNonZeroByRow(const void *a, const void *b); bool customLess(int smax, dfloat rmax, hlong imax, int s, dfloat r, hlong i); extern "C"{ void dgetrf_(int* M, int *N, double* A, int* lda, int* IPIV, int* INFO); void dgetri_(int* N, double* A, int* lda, int* IPIV, double* WORK, int* lwork, int* INFO); void dgeev_(char *JOBVL, char *JOBVR, int *N, double *A, int *LDA, double *WR, double *WI, double *VL, int *LDVL, double *VR, int *LDVR, double *WORK, int *LWORK, int *INFO ); } void eig(const int Nrows, double *A, double *WR, double *WI); void matrixInverse(int N, dfloat *A); } //namespace parAlmond #endif
a773c01385a8475e0bff33912a8dea42fc6f28fa
d676dcbb13cf19404b7575982bd5658ea975c360
/STL/六大组件测试.cpp
8e677d4f923445d4fa3934756fa8c39f596f7b5c
[]
no_license
Liny927/CppLearning
5c6a9966f27b21593d106e9bfc5315025fba6c1c
27050812cd272c76c315bf1da691cf14f9cecd45
refs/heads/master
2021-05-21T09:20:57.562826
2020-04-09T15:58:29
2020-04-09T15:58:29
252,635,203
0
0
null
null
null
null
GB18030
C++
false
false
732
cpp
六大组件测试.cpp
/* * @Author: Hellcat * @Date: 2020-03-31 10:50:39 */ #include <iostream> #include <vector> #include <functional> #include <algorithm> using namespace std; int main() { int a[6] = { 11, 26, 46, 54, 77, 89 }; vector<int, allocator<int> > v(a, a + 6); // cout<<*v.end()<<endl; Error 为"前闭后开"区间 for(auto it = v.begin(); it != v.end(); it++) // iterator实质上为泛化的指针 cout<<*it<<endl; cout<<count_if(v.begin(), v.end(), // iterator not1(bind2nd(less<int> (), 70)))<<endl; // 大于等于70 // bind2nd在(C++11 中弃用) (C++17 中移除) // lambda表达式 cout<<count_if(v.begin(), v.end(), [](int i) { return i % 3 == 0; })<<endl; return 0; }
577e806cdf3b2240f22db83899e72c56513bc3c1
3a55b41e640c288cc6c7a831aeb441ef4ceac415
/Sources/AreaEffect.cpp
d87923f465c9e0abe3797c9202fddc94135d77c3
[]
no_license
Ianuarius/KnightBrawl
8c03bb7e02ad0e02bbc82a9fd435147cc62e4c16
0ca26183f32b2a4a14e05a2919c5604263005d33
refs/heads/master
2016-08-12T21:15:29.048597
2015-09-23T15:03:11
2015-09-23T15:03:11
36,217,437
0
0
null
null
null
null
UTF-8
C++
false
false
238
cpp
AreaEffect.cpp
/** * AreaEffect.cpp * */ #include "AreaEffect.h" AreaEffect::AreaEffect(): Entity(), executing(false), state(0), hitbox(0, 0, 0, 0) { } void AreaEffect::defineAnimation(Animation *new_animation) { animation = new_animation; }
10aea4300236de1c655ba46042603c7af7f58b2a
5d83739af703fb400857cecc69aadaf02e07f8d1
/Archive2/a2/6c8159bd82bedc/main.cpp
49f7a05ea75afe1600db9949b6be235e577588b6
[]
no_license
WhiZTiM/coliru
3a6c4c0bdac566d1aa1c21818118ba70479b0f40
2c72c048846c082f943e6c7f9fa8d94aee76979f
refs/heads/master
2021-01-01T05:10:33.812560
2015-08-24T19:09:22
2015-08-24T19:09:22
56,789,706
3
0
null
null
null
null
UTF-8
C++
false
false
603
cpp
main.cpp
// inner block scopes #include <iostream> using namespace std; int main () { // Initialize two int variables in this outer scope of main() int x{10}; int y{20}; { // Inner block's scope begins here int{x}; // new 'x' initialization ok, we're inside main()'s inner scope y = 50; // assign new value to outer scope's 'y' cout << "\n inner block scope \n"; cout << "x: " << x << endl; cout << "y: " << y << endl; } // Inner block's scope ends here cout << "\n outer block scope \n"; cout << "x: " << x << endl; cout << "y: " << y << endl; }
fb6701a702f5d85f3af85cbdaf294ab3ce6e272f
5bf674b772c39086764615661f53d70e802d225e
/src/edit_body_view.cpp
f58bffe21c176d32399405ac020d3b71dc772482
[ "MIT" ]
permissive
pozitiffcat/rester
512e635f9e3500407c231ba8817b4189d84f9b14
e930a833910ea93180bacbedf1b1be23f45ee4da
refs/heads/master
2020-12-02T10:04:47.923807
2017-07-12T13:44:53
2017-07-12T13:44:53
96,689,326
1
0
null
null
null
null
UTF-8
C++
false
false
30
cpp
edit_body_view.cpp
#include "edit_body_view.hpp"
2067a1d5ae89c3346ff066b26445c64efdb2ce6f
7ab5c79d2716bc56c2fc2be9bf1cdcb8530379a4
/c++/Contests/olimpiada/subiecte/oji2012/oji2012/Solutii5_8/Solutii5_8/OJI_7_2012/sol/arme/arme_Adrian.cpp
e79a726cf8af38c5f6ccfb3f63d02e4af30d3b29
[]
no_license
TeoPaius/Projects
dfd8771199cd8a0e2df07e18dd165bf63ad08292
ced149ecf1243da2aa97bb1f0e4cd37140bd2d2d
refs/heads/master
2021-09-24T02:10:52.220320
2018-10-01T16:29:01
2018-10-01T16:29:01
104,876,094
1
0
null
null
null
null
UTF-8
C++
false
false
436
cpp
arme_Adrian.cpp
//Pintea Adrian #include <iostream> #include <fstream> using namespace std; ifstream fin("arme.in"); ofstream fout("arme.out"); int n,m,i,j,p[2001],aux,rezultat; int main(){ fin>>n>>m; for(i=0;i<n;i++) fin>>p[i]; for(i=n;i<n+m;i++) fin>>p[i]; rezultat=0; for(i=0;i<n;i++) { for(j=i+1;j<n+m;j++) { if (p[i]<p[j]) { aux=p[i]; p[i]=p[j]; p[j]=aux; } } rezultat+=p[i]; } fout<<rezultat<<"\n"; fout.close(); return 0; }
c482eabed78ae9609e82956f40f4e80768833b0d
227ba1b19a1fef1fc8169ec3dee2d088b962b613
/cpp/7.cpp
604dd0ca112aae3c21b374daf48a51ea92c6f387
[]
no_license
LuYanFCP/Leetcode
abd52a315ee9b800a661e21fec72b3a8482fe69a
dee3a087724d874049650ec875d9770e03740be4
refs/heads/master
2021-06-28T17:36:47.436590
2021-01-14T14:28:53
2021-01-14T14:28:53
207,544,216
5
1
null
null
null
null
UTF-8
C++
false
false
1,388
cpp
7.cpp
#include <cmath> #include <iostream> #include <climits> using std::abs; using std::cout; using std::endl; // using std::MAX_INI; class Solution { public: int reverse(int x) { if (x == 0 || x == INT_MIN) // 因为int的范围[-2^31, 2^31 - 1],如果x == -2^31使用abs之后会溢出。 return 0; bool signal = x > 0; // 如果signal=true的时候为正数 int x_abs = abs(x); int stack[32]; int pos = -1; // 先全部入栈 /*123456*/ /* * div = 12345, mod = 6 * div = 1234, mod = 5 * div = 123, mod = 4 * div = 12, mod = 3 * div = 1, mod = 2 * div = 0, mod = 1 */ int div = x_abs / 10, mod = x_abs % 10; while (div != 0 || mod != 0) { // stack[++pos] = mod; mod = div % 10; div = div / 10; } long ans = 0, base = 1; while (pos != -1) { ans += base * stack[pos--]; if (ans > INT_MAX) // 如果ans大于INT_MAX,则另一部分溢出 return 0; base *= 10; } if (!signal) ans *= -1; return ans; } }; int main() { Solution s; cout << s.reverse(123) << endl; cout << INT_MIN << endl; }
ad76720ed0a4bf41d35c7ef9bc7b84e484e86871
5a7f87804265b0da0ede53b3a31f8f1219c5204b
/kinesis-video-gstreamer-plugin/demo/kvs_producer_plugin_rtsp_demo.cpp
f68a1e6465cea50702e11310940fa704f7a068fd
[ "Apache-2.0" ]
permissive
billcai/amazon-kinesis-video-streams-producer-sdk-cpp
41bb679a0c9e27a6fcaadf744105854359308e28
fb958f7d182980d41bdaa5b040894ebb03ae1e7e
refs/heads/master
2021-01-15T04:14:18.876156
2020-04-30T06:02:11
2020-04-30T06:02:11
242,874,424
0
2
Apache-2.0
2020-02-25T00:32:51
2020-02-25T00:32:50
null
UTF-8
C++
false
false
6,249
cpp
kvs_producer_plugin_rtsp_demo.cpp
#include <gst/gst.h> #include <cstring> #include <Logger.h> #include "KinesisVideoProducer.h" #include <gst/rtsp/gstrtsptransport.h> using namespace std; using namespace com::amazonaws::kinesis::video; #ifdef __cplusplus extern "C" { #endif int gstreamer_init(int, char **); #ifdef __cplusplus } #endif #define MAX_URL_LENGTH 65536 typedef struct _CustomData { GstElement *pipeline, *source, *depay, *kvsproducer, *filter, *target_for_source; GstBus *bus; GMainLoop *main_loop; bool h264_stream_supported; } CustomData; /* This function is called when an error message is posted on the bus */ static void error_cb(GstBus *bus, GstMessage *msg, CustomData *data) { GError *err; gchar *debug_info; /* Print error details on the screen */ gst_message_parse_error(msg, &err, &debug_info); g_printerr("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), err->message); g_printerr("Debugging information: %s\n", debug_info ? debug_info : "none"); g_clear_error(&err); g_free(debug_info); g_main_loop_quit(data->main_loop); } /* callback when each RTSP stream has been created */ static void cb_rtsp_pad_created(GstElement *element, GstPad *pad, CustomData *data) { gchar *pad_name = gst_pad_get_name(pad); g_print("New RTSP source found: %s\n", pad_name); if (gst_element_link_pads(data->source, pad_name, data->target_for_source, "sink")) { g_print("Source linked.\n"); } else { g_print("Source link FAILED\n"); } g_free(pad_name); const char *name; char *padCapsName; GstCaps *padCaps = gst_pad_get_current_caps(pad); GstStructure *gststructureforcaps = gst_caps_get_structure(padCaps, 0); GST_INFO ("structure is %" GST_PTR_FORMAT, gststructureforcaps); name = gst_structure_get_name(gststructureforcaps); g_debug("name of caps struct string: %s", name); padCapsName = gst_caps_to_string(padCaps); g_debug("name of rtsp caps string: %s", padCapsName); if (gst_structure_has_field(gststructureforcaps, "a-framerate")) { gint numerator, denominator; gst_structure_get_fraction(gststructureforcaps, "a-framerate", &numerator, &denominator); g_debug("frame rate range %d / %d", numerator, denominator); } g_free(padCapsName); } int gstreamer_init(int argc, char *argv[]) { CustomData data; GstStateChangeReturn ret; char rtsp_url[MAX_URL_LENGTH]; SNPRINTF(rtsp_url, MAX_URL_LENGTH, "%s", argv[1]); char stream_name[MAX_STREAM_NAME_LEN]; SNPRINTF(stream_name, MAX_STREAM_NAME_LEN, "%s", argv[2]); char protocol[4]; SNPRINTF(protocol, 4, "%s", argv[3]); /* init data struct */ memset(&data, 0, sizeof(data)); /* init GStreamer */ gst_init(&argc, &argv); /* create the elements */ // kvssink element data.kvsproducer = gst_element_factory_make("kvssink", "kvsproducer"); // rtph264depay: Converts rtp data to raw h264 data.depay = gst_element_factory_make("rtph264depay", "depay"); // RTSP source component data.source = gst_element_factory_make("rtspsrc", "source"); data.filter = gst_element_factory_make("capsfilter", "encoder_filter"); //h264 format avc with au GstCaps *h264_caps = gst_caps_new_simple("video/x-h264", "stream-format", G_TYPE_STRING, "avc", "alignment", G_TYPE_STRING, "au", NULL); g_object_set(G_OBJECT (data.filter), "caps", h264_caps, NULL); gst_caps_unref(h264_caps); /* create an rtspsource to kvssink pipeline */ data.pipeline = gst_pipeline_new("rtsp-kinesis-pipeline"); if (!data.pipeline || !data.source || !data.depay || !data.filter || !data.kvsproducer) { if (!data.filter) { g_printerr("capsfilter element could not be created.\n"); } if (!data.depay) { g_printerr("h264depay element could not be created.\n"); } if (!data.source) { g_printerr("h264parse elements could not be created.\n"); } if (!data.kvsproducer) { g_printerr("kvsproducersink element could not be created.\n"); } g_printerr("Not all elements could be created.\n"); return 1; } g_object_set(G_OBJECT (data.kvsproducer), "stream-name", stream_name, "storage-size", 128, NULL); g_object_set(G_OBJECT (data.source), "location", rtsp_url, "short-header", true, // Necessary for target camera "protocols", strcmp(protocol, "udp") == 0 ? GST_RTSP_LOWER_TRANS_UDP : GST_RTSP_LOWER_TRANS_TCP, NULL); g_signal_connect(data.source, "pad-added", G_CALLBACK(cb_rtsp_pad_created), &data); /* build the pipeline */ gst_bin_add_many(GST_BIN (data.pipeline), data.source, data.depay, data.filter, data.kvsproducer, NULL); if (!gst_element_link_many(data.depay, data.filter, data.kvsproducer, NULL)) { g_printerr("Elements could not be linked.\n"); gst_object_unref(data.pipeline); return 1; } data.target_for_source = data.depay; /* Instruct the bus to emit signals for each received message, and connect to the interesting signals */ data.bus = gst_element_get_bus(data.pipeline); gst_bus_add_signal_watch(data.bus); g_signal_connect (G_OBJECT(data.bus), "message::error", (GCallback) error_cb, &data); gst_object_unref(data.bus); /* start streaming */ ret = gst_element_set_state(data.pipeline, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { g_printerr("Unable to set the pipeline to the playing state.\n"); gst_object_unref(data.pipeline); return 1; } data.main_loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(data.main_loop); /* free resources */ gst_element_set_state(data.pipeline, GST_STATE_NULL); gst_object_unref(data.pipeline); return 0; } int main(int argc, char *argv[]) { return gstreamer_init(argc, argv); }
6f20499fc699eefa5b71b10310426c74e38f03d1
9d87d93adf445dff5bb174e72872efd053e14c07
/manhattan_magnets/main.cpp
3e58970b9cdd612ff29e514956586cbe2d23d4e5
[]
no_license
smhx/dmoj
c1064ab32d9609483bd3a072d09efa6b9bf254b1
c4bb7cc5ac59427718ad08325b760b139c7c9487
refs/heads/master
2021-09-17T05:15:28.702218
2018-06-28T10:19:43
2018-06-28T10:19:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,712
cpp
main.cpp
#include <cstdio> #include <algorithm> #include <cstdlib> #include <vector> using namespace std; typedef pair<int, int> ii; const int MAXN = 100005, INF = 1000000000;//, EXTRA_X = 8000, EXTRA_Y = 12000; int N, M, metalx[MAXN], metaly[MAXN], magx[MAXN], magy[MAXN], d[MAXN]; vector<pair<ii, int> > tmp_diff, diff; vector<int> compressX, compressY; bool cmpy(const pair<ii,int>& a, const pair<ii,int>&b ) {return a.first.second != b.first.second ? a.first.second < b.first.second : a.first.first < b.first.first;} inline int compressedIndex(const vector<int>& a, int b) {return lower_bound(begin(a), end(a), b) - begin(a);} int main() { freopen("data.txt", "r", stdin); scanf("%d", &M); for (int i = 1; i <= M; ++i) scanf("%d%d", magx+i, magy+i); scanf("%d", &N); for (int i = 1; i <= N; ++i) { scanf("%d%d", metalx+i, metaly+i); d[i] = INF; for (int j = 1; j <= M; ++j) d[i] = min(d[i], abs(metalx[i]-magx[j]) + abs(metaly[i] - magy[j]) ); --d[i]; } for (int i = 1; i <= N; ++i) { int x = metalx[i], y = metaly[i]; int xlo = x-d[i]+y; int xhi = x+d[i]+y; int ylo = y-x-d[i]; int yhi = y-x+d[i]; tmp_diff.push_back({{xlo, ylo}, 1}); tmp_diff.push_back({ {xhi+1, yhi+1}, 1}); tmp_diff.push_back({{xlo, yhi+1}, -1}); tmp_diff.push_back({{xhi+1, ylo}, -1}); } sort(begin(tmp_diff), end(tmp_diff)); diff.push_back(tmp_diff[0]); for (int i = 1; i < tmp_diff.size(); ++i) { if (tmp_diff[i].first != diff.back().first) diff.push_back({tmp_diff[i].first, 0}); diff.back().second += tmp_diff[i].second; } compressX.push_back(diff[0].first.first); for (int i = 1; i < diff.size(); ++i) if (diff[i].first.first != compressX.back() ) compressX.push_back(diff[i].first.first); sort(begin(diff), end(diff), cmpy); compressY.push_back(diff[0].first.first); for (int i = 1; i < diff.size(); ++i) if (diff[i].first.second != compressY.back() ) compressY.push_back(diff[i].first.second); int nx = compressX.size(), ny = compressY.size(); vector<int> slide[2]; slide[0] = vector<int>(nx); slide[1] = vector<int>(nx); int ans = 0, idx = 0, add = 0; int curRow, curCol; curRow = compressedIndex(compressY, diff[idx].first.second); curCol = compressedIndex(compressX, diff[idx].first.first); for (int r = 0; r < ny; ++r) { for (int c = 0; c < nx; ++c) { if (r==curRow && c==curCol) { add += diff[idx].second; ++idx; int newRow = compressedIndex(compressY, diff[idx].first.second); if (newRow != curRow) { add = 0; curRow = newRow; } curCol = compressedIndex(compressX, diff[idx].first.first); } slide[r&1][c] = add; if (r) slide[r&1][c] += slide[(r-1)&1][c]; ans = max(ans, slide[r&1][c]); } } printf("%d\n", ans); }
b8c3a03fdcfb320137971b7163588893742a40f4
83d9d89aad2fefab165be4f9ded9bab88f83f8d6
/bin/android_app/openframeworks-openFrameworks-53dd099/apps/iPhoneAddonsExamples/opencvExample/src/testApp.h
b02057d77550b45f0468b2dc2c827975efd8df4b
[ "Apache-2.0" ]
permissive
OESF/TreasureHuntingRobot
6531a22212077330436ef522cd23b711bb4ed7d0
88d06dcada6e220fbd97430fc068e63d8365c5db
refs/heads/master
2016-09-15T17:55:30.628203
2012-04-16T08:43:04
2012-04-16T08:43:04
3,972,744
4
8
null
null
null
null
UTF-8
C++
false
false
832
h
testApp.h
#pragma once #include "ofMain.h" #include "ofxiPhone.h" #include "ofxiPhoneExtras.h" //ON IPHONE NOTE INCLUDE THIS BEFORE ANYTHING ELSE #include "ofxOpenCv.h" class testApp : public ofxiPhoneApp{ public: void setup(); void update(); void draw(); void touchDown(ofTouchEventArgs &touch); void touchMoved(ofTouchEventArgs &touch); void touchUp(ofTouchEventArgs &touch); void touchDoubleTap(ofTouchEventArgs &touch); void touchCancelled(ofTouchEventArgs &touch); ofVideoGrabber vidGrabber; ofVideoPlayer vidPlayer; ofTexture tex; ofxCvColorImage colorImg; ofxCvGrayscaleImage grayImage; ofxCvGrayscaleImage grayBg; ofxCvGrayscaleImage grayDiff; float capW, capH; ofxCvContourFinder contourFinder; int threshold; bool bLearnBakground; };
52412337f1a893358120bd8ea59f47fe106c5346
1c82507a16248eda1b6ba4056e5e97df2fc8425b
/table.cpp
4e28786813d1ddcba1be4344649fbc3e67f7a7cd
[]
no_license
HuskieCat/Homework-1
b75b7937325b4f91e0f7788729adc0fc2b47a349
6fa44ee553bd11fa092e2a7d42e2b6f64a9e93d1
refs/heads/master
2023-08-15T00:42:21.785487
2021-09-16T01:43:02
2021-09-16T01:43:02
404,115,083
0
0
null
null
null
null
UTF-8
C++
false
false
4,930
cpp
table.cpp
/** * Implementation file for table * * Author: Bradley Henderson */ #include <cstdlib> #include <iostream> #include "table.h" template<typename T> ostream& operator<<(ostream& out, const Table<T>& table) { //out.width(); const int width = out.width(); if(table.rowCount == 0) return out << "null"; else if(table.columnCount == 0) return out << "null"; for(int row = 0; row < table.rowCount; row++) { for(int column = 0; column < table.columnCount; column++) { out << setw(width) << table.pTable[row][column]; } out<<endl; } return out; } template<typename T> Table<T> operator+(const Table<T>& oldTable, T (*f)(T)) { Table<T> newTable(oldTable.rowCount, oldTable.columnCount); for(int row = 0; row < newTable.rowCount; row++) { for(int column = 0; column < newTable.columnCount; column++) { newTable.qTable[row][column] = f; } } return newTable; } template<typename T> Table<T>::Table(const int row, const int column) { rowCount = row; columnCount = column; pTable = new T*[row]; for(int i = 0; i < row; i++) pTable[i] = new T[column]; } template<typename T> Table<T>::Table(int dimensions) { rowCount = dimensions; columnCount = dimensions; pTable = new T*[dimensions]; for(int i = 0; i < dimensions; i++) pTable[i] = new T[dimensions]; } template<typename T> Table<T>::Table(Table<T>& newTable) { pTable = new T*[newTable.rowCount]; for(int row = 0; row < newTable.rowCount; row++) { pTable[row] = new T[newTable.columnCount]; for(int column = 0; column < newTable.columnCount; column++) { pTable[row][column] = newTable.pTable[row][column]; } } rowCount = newTable.rowCount; columnCount = newTable.columnCount; } template<typename T> Table<T>& Table<T>::operator=(const Table<T>& newTable) { //Erase the table for(int row = 0; row < rowCount; row++) delete[] pTable[row]; delete[] pTable; pTable = new T*[newTable.rowCount]; for(int row = 0; row < newTable.rowCount; row++) { pTable[row] = new T[newTable.columnCount]; for(int column = 0; column < newTable.columnCount; column++) { pTable[row][column] = newTable.pTable[row][column]; } } rowCount = newTable.rowCount; columnCount = newTable.columnCount; return *this; } template<typename T> Table<T>::~Table() { for(int row = 0; row < rowCount; row++) delete[] pTable[row]; delete[] pTable; rowCount = 0; columnCount = 0; } template<typename T> int Table<T>::get_rows() { return rowCount; } template<typename T> int Table<T>::get_cols() { return columnCount; } template<typename T> Table<T> Table<T>::append_rows(const Table<T>& oldTable) { Table<T> newTable(rowCount + oldTable.rowCount, columnCount); int secondIndex = 0; for(int row = 0; row < newTable.rowCount; row++) { for(int column = 0; column < newTable.columnCount; column++) { if(row < rowCount) { newTable.pTable[row][column] = pTable[row][column]; } else { newTable.pTable[row][column] = oldTable.pTable[secondIndex][column]; } } if(row > rowCount) secondIndex++; } return newTable; } template<typename T> Table<T> Table<T>::append_cols(const Table<T>& oldTable) { Table<T> newTable(rowCount, columnCount + oldTable.columnCount); for(int row = 0; row < newTable.rowCount; row++) { int secondIndex = 0; for(int column = 0; column < newTable.columnCount; column++) { if(column < columnCount) { newTable.pTable[row][column] = pTable[row][column]; } else { newTable.pTable[row][column] = oldTable.pTable[row][secondIndex]; secondIndex++; } } } return newTable; } template<typename T> T& Table<T>::operator()(int row, int column) { return pTable[row][column]; } template<typename T> Table<T> Table<T>::operator()(int row1, int column1, int row2, int column2) { int newRowCount = abs(row1-row2)+1; int newColumnCount = abs(column1-column2)+1; Table<T> newTable(newRowCount, newColumnCount); cout<<"New Table size "<<newRowCount<<":"<<newColumnCount<<endl; int biggerRow = row2; int smallerRow = row1; int biggerColumn = column2; int smallerColumn = column1; if(row1 > row2) { biggerRow = row1; smallerRow = row2; } if(column1 > column2) { biggerColumn = column1; smallerColumn = column2; } for(int row = smallerRow; row < biggerRow+1; row++) { for(int column = smallerColumn; column < biggerColumn+1; column++) { newTable.pTable[row-smallerRow][column-smallerColumn] = pTable[row][column]; } } return newTable; }
4901df0cdbb3897c0d60bc4101a94f1f39e1799a
a6a098fa21ddb7882b9f863187d503ca199458b4
/blade/core/math/Vec4-inl.h
97f123e285070cc520463fd4edc6db18ac63d636
[]
no_license
WOODNOTWOODY/LearnOpenGL
fb5321f73b0562719884672796679ebfc5066db2
59139e9ab2ef73146fede638721d325de7913fdc
refs/heads/master
2020-03-25T16:59:56.632662
2018-10-08T02:05:00
2018-10-08T02:05:00
143,958,288
2
0
null
null
null
null
UTF-8
C++
false
false
3,959
h
Vec4-inl.h
template <typename T> inline Vec4T<T>::Vec4T() { } template <typename T> inline Vec4T<T>::Vec4T(const T _x, const T _y, const T _z, const T _w) : x(_x) , y(_y) , z(_z) , w(_w) { } template <typename T> inline Vec4T<T>::Vec4T(const Vec3T<T> &vec, T _w) : x(vec.x) , y(vec.y) , z(vec.z) , w(_w) { } template <typename T> inline Vec4T<T>& Vec4T<T>::operator += (const Vec4T<T>& rhs) { x += rhs.x; y += rhs.y; z += rhs.z; w += rhs.w; return *this; } template <typename T> inline Vec4T<T>& Vec4T<T>::operator -= (const Vec4T<T>& rhs) { x -= rhs.x; y -= rhs.y; z -= rhs.z; w -= rhs.w; return *this; } template <typename T> inline Vec4T<T>& Vec4T<T>::operator *= (const T value) { x *= value; y *= value; z *= value; w *= value; return *this; } template <typename T> inline Vec4T<T>& Vec4T<T>::operator /= (const T value) { x /= value; y /= value; z /= value; w /= value; return *this; } template <typename T> inline T& Vec4T<T>::operator [] (int index) { assert(index >= 0 && index < 4); return m[index]; } template <typename T> inline const T& Vec4T<T>::operator [] (int index) const { assert(index >= 0 && index < 4); return m[index]; } template <typename T> inline bool Vec4T<T>::operator < (const Vec4T<T>& rhs) const { return (x < rhs.x && y < rhs.y && z < rhs.z &7 w < rhs.w); } template <typename T> inline bool Vec4T<T>::operator <= (const Vec4T<T>& rhs) const { return (x <= rhs.x && y <= rhs.y && z <= rhs.z &7 w <= rhs.w); } template <typename T> inline bool Vec4T<T>::operator >(const Vec4T<T>& rhs) const { return (x > rhs.x && y > rhs.y && z > rhs.z && w > rhs.w); } template <typename T> inline bool Vec4T<T>::operator >= (const Vec4T<T>& rhs) const { return (x >= rhs.x && y >= rhs.y && z >= rhs.z && w > rhs.w); } template <typename T> inline T Vec4T<T>::dot(const Vec4T<T>& rhs) const { return (x * rhs.x + y * rhs.y + z * rhs.z + w * rhs.w); } template <typename T> inline T Vec4T<T>::length() const { return std::sqrt(x * x + y * y + z * z + w * w); } template <typename T> inline T Vec4T<T>::lengthSqr() const { return (x * x + y * y + z * z + w * w); } template <typename T> inline void Vec4T<T>::normalize() { T len = length(); x /= len; y /= len; z /= len; w /= len; } template <typename T> inline T Vec4T<T>::Dot(const Vec4T<T>& lhs, const Vec4T<T>& rhs) { return (lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z + lhs.w * rhs.w); } template <typename T> inline bool operator == (const Vec4T<T>& lhs, const Vec4T<T>& rhs) { return (Math::IsEqual(lhs.x, rhs.x) && Math::IsEqual(lhs.y, rhs.y) && Math:IsEqual(lhs.z, rhs.z) && Math : IsEqual(lhs.w, rhs.w)); } template <typename T> inline bool operator != (const Vec4T<T>& lhs, const Vec4T<T>& rhs) { return (Math::IsNotEqual(lhs.x, rhs.x) || Math::IsNotEqual(lhs.y, rhs.y) || Math::IsNotEqual(lhs.z, rhs.z) || Math::IsNotEqual(lhs.w, rhs.w)); } template <typename T> inline Vec4T<T> operator + (const Vec4T<T> &rhs) { return rhs; } template <typename T> inline Vec4T<T> operator - (const Vec4T<T> &rhs) { return Vec4T<T>(-rhs.x, -rhs.y, -rhs.z, -rhs.w); } template <typename T> inline Vec4T<T> operator + (const Vec4T<T> &a, const Vec4T<T> &b) { return Vec4T<T>(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); } template <typename T> inline Vec4T<T> operator - (const Vec4T<T> &a, const Vec4T<T> &b) { return Vec4T<T>(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); } template <typename T> inline Vec4T<T> operator * (const T f, const Vec4T<T> &v) { return Vec4T<T>(f * v.x, f * v.y, f * v.z, f * v.w); } template <typename T> inline Vec4T<T> operator * (const Vec4T<T> &v, const T f) { return Vec4T<T>(f * v.x, f * v.y, f * v.z, f * v.w); } template <typename T> inline Vec4T<T> operator / (const Vec4T<T> &a, const T f) { return Vec4T<T>(a.x / f, a.y / f, a.z / f, a.w / f); } template <typename T> inline Vec4T<T> operator / (const T f, const Vec4T<T> &a) { return Vec4T<T>(f / a.x, f / a.y, f / a.z, f / a.w); }
ab1bd8f1d0198114b94150aa7991510ba3bde79b
37fb4433ce96ca36b374fe959dfaa7b5285660ac
/src/mapcellset.cc
ff0aa4e47785ec660cefde78a78b1e4c11615d74
[]
no_license
sdhuerta/Prob-rob-projects
17174c70efb385e68a10978bed2b6f7d04a17bb9
ca812cdc6440dcee5241530d7e27a213abbc7c7c
refs/heads/master
2021-01-21T13:21:01.341276
2016-05-02T04:36:18
2016-05-02T04:36:18
52,019,455
1
0
null
null
null
null
UTF-8
C++
false
false
7,671
cc
mapcellset.cc
#include <mapcellset.h> #define MAX(x,y) (x<y?y:x) /*********************************************************/ /* The CellTree class holds a balanced binary tree of */ /* MapCell structs */ class CellTree{ private: MapCell cell; int height; CellTree *left, *right; int refs; static int getHeight(CellTree *node); static int getBalance(CellTree *node); static CellTree* rotate_left(CellTree* rt); static CellTree* rotate_right(CellTree* rt); public: CellTree(MapCoord newcell, double newvalue); ~CellTree(); void add_ref(){refs++;} int del_ref(){return --refs;} static CellTree* insert(CellTree *root, CellTree *node); static CellTree* find(CellTree *root, MapCoord cell); void setValue(double b){cell.value=b;} double getValue(){return cell.value;} typedef CellTreeIterator iterator; iterator begin() { return iterator(this); } iterator end() { return iterator(NULL); } friend class CellTreeIterator; void dump() { int i; if(left != NULL) left->dump(); for(i=0;i<height;i++) printf(" "); print(); if(right!=NULL) right->dump(); } void print(){printf("%d %d %d %lf\n", cell.coord.row, cell.coord.col, cell.coord.angle, cell.value);} }; CellTree::CellTree(MapCoord newcell,double newvalue) { cell.coord=newcell; cell.value=newvalue; left = NULL; right = NULL; height = 1; refs = 1; } CellTree::~CellTree() { if(left != NULL) delete left; if(left != NULL) delete right; } /*********************************************************/ /* find is used to search the tree of cells. It */ /* returns a pointer to the treenode. If the cell is */ /* not in the tree, then it returns NULL. */ CellTree* CellTree::find(CellTree *root, MapCoord cell) { if(root != NULL) { if(cell.key < root->cell.coord.key) root = find(root->left,cell); else if(cell.key > root->cell.coord.key) root = find(root->right,cell); } return root; } /**********************************************************/ /* tn_height finds the height of a node and returns */ /* zero if the pointer is NULL. */ int CellTree::getHeight(CellTree *node) { if(node == NULL) return 0; return node->height; } /**********************************************************/ /* find the balance factor of a node. */ /* returns zero if the pointer is NULL. */ int CellTree::getBalance(CellTree *node) { if (node == NULL) return 0; return getHeight(node->left) - getHeight(node->right); } /**********************************************************/ /* rotate_left rotates counterclockwise */ CellTree* CellTree::rotate_left(CellTree* rt) { CellTree* nrt = rt->right; rt->right = nrt->left; nrt->left = rt; nrt->refs = rt->refs; rt->refs = 1; rt->height = MAX(getHeight(rt->left),getHeight(rt->right)) + 1; nrt->height = MAX(getHeight(nrt->left),getHeight(nrt->right)) + 1; return nrt; } /**********************************************************/ /* rotate_right rotates clockwise */ CellTree* CellTree::rotate_right(CellTree* rt) { CellTree* nrt = rt->left; rt->left = nrt->right; nrt->right = rt; nrt->refs = rt->refs; rt->refs = 1; rt->height = MAX(getHeight(rt->left),getHeight(rt->right)) + 1; nrt->height = MAX(getHeight(nrt->left),getHeight(nrt->right)) + 1; return nrt; } /**********************************************************/ /* insert performs a tree insertion and re-balances */ CellTree * CellTree::insert(CellTree *root, CellTree *node) { int bf; if (root == NULL) /* handle case where tree is empty, or we reached a leaf */ root = node; else { /* Recursively search for insertion point, and perform the insertion. */ if(node->cell.coord.key < root->cell.coord.key) root->left = insert(root->left, node); else root->right = insert(root->right, node); /* As we return from the recursive calls, recalculate the heights and perform rotations as necessary to re-balance the tree */ root->height = MAX(getHeight(root->left), getHeight(root->right)) + 1; /* Calculate the balance factor */ bf = getBalance(root); if (bf > 1) { /* the tree is deeper on the left than on the right) */ if(node->cell.coord.key <= root->left->cell.coord.key) root = rotate_right(root); else { root->left = rotate_left(root->left); root = rotate_right(root); }; } else if(bf < -1) { /* the tree is deeper on the right than on the left) */ if(node->cell.coord.key >= root->right->cell.coord.key) root = rotate_left(root); else { root->right = rotate_right(root->right); root = rotate_left(root); } } } return root; } int CellTreeIterator::fillptrs(CellTree *root,vector<CellTree*> &ptrs,int pos) { if(root==NULL) return pos; pos = fillptrs(root->left,ptrs,pos); ptrs[pos++] = root; pos = fillptrs(root->right,ptrs,pos); return pos; } CellTreeIterator::CellTreeIterator() { nptrs=0; currptr=0; rptr = NULL; } CellTreeIterator::CellTreeIterator(CellTree *root) { if(root==NULL) { nptrs=0; currptr=0; rptr=NULL; } else { nptrs = 1<<(root->height); currptr = 0; ptrs.resize(nptrs); nptrs=fillptrs(root,ptrs,0); rptr=&(ptrs[0]->cell); } } // prefix case CellTreeIterator &CellTreeIterator::operator ++() { ++currptr; if(currptr >= nptrs) rptr=NULL; else rptr=&(ptrs[currptr]->cell); return *this; } // postfix case CellTreeIterator CellTreeIterator::operator ++(int) { CellTreeIterator clone(*this); // clone is a shallow copy ++currptr; if(currptr >= nptrs) rptr=NULL; else rptr=&(ptrs[currptr]->cell); return clone; } MapCellSet::MapCellSet(MapCellSet &o) { nitems = o.nitems; tree=o.tree; tree->add_ref(); } MapCellSet::~MapCellSet() { if(tree!=NULL && tree->del_ref() == 0) delete tree; } double MapCellSet::getValue(MapCoord cell, double default_value) { CellTree *node; if(tree == NULL) return default_value; if((node = CellTree::find(tree,cell)) == NULL) return default_value; return node->getValue(); } void MapCellSet::setValue(MapCoord cell, double value) { CellTree *node; if(tree == NULL) tree = new CellTree(cell,value); else if((node = CellTree::find(tree,cell)) == NULL) { node = new CellTree(cell,value); tree = CellTree::insert(tree,node); nitems++; } else node->setValue(value); } void MapCellSet::clear() { if(tree!=NULL && tree->del_ref() == 0) delete tree; tree = NULL; nitems = 0; } MapCellSet &MapCellSet::operator =(MapCellSet &r) { nitems = r.nitems; tree = r.tree; tree->add_ref(); return *this; } MapCellSet::iterator MapCellSet::begin() { return tree->begin(); } MapCellSet::iterator MapCellSet::end() { return tree->end(); } // #include <time.h> // int main() // { // MapCellSet cellset; // int i; // uint32_t x,y,theta; // MapCoord cell; // srand(time(NULL)); // for(i=0;i<100;i++) // { // cell.row=rand() & 0x1FFF; // cell.col=rand() & 0x1FFF; // cell.angle=rand() & 0x3F; // cellset.setValue(cell,0.0); // } // MapCellSet::iterator iter; // for(iter=cellset.begin();iter != cellset.end();iter++) // { // (*iter).print(); // } // return 0; // }
25e38ae1e2838e022ea4f75d20d2008fa40fe6a0
e6e60ef257a7a3999ea5d58b86ae025f5840fc11
/GridCell.h
31f85c6843ae70cbd238785c4af43867db5211d3
[]
no_license
KongHyunWook/TickTack_Bingo
876259fbad0c99af0baca339fe2e1acdbd74ab63
67c1f397179e495fbc24d1ae4333912b3082fa0b
refs/heads/master
2020-12-30T15:54:31.365343
2017-05-13T15:09:59
2017-05-13T15:09:59
91,182,458
0
0
null
null
null
null
UTF-8
C++
false
false
960
h
GridCell.h
// GridCell.h: interface for the CGridCell class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_GRIDCELL_H__3BFEC235_1797_4232_AB30_3F8C8A1F06EB__INCLUDED_) #define AFX_GRIDCELL_H__3BFEC235_1797_4232_AB30_3F8C8A1F06EB__INCLUDED_ #include "Type.h" #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CGridCell { public: CGridCell(); virtual ~CGridCell(); public: BOOL m_bClick; int m_nW, m_nH, m_nPointR, m_nPointC; CType type; public: void SetType(CType::Value value); CType GetType(); void GetPosition(int &nW, int &nH, int &nPointR, int &nPointC); void SetPosition(int Width, int Height, int startR, int startC); void SetClick(bool bClick); BOOL GetClick(); BOOL isClick(CPoint point); void DrawCell(CDC * pDC); void DrawCellFromType(CDC * pDC, int left, int top, int right, int bottom); }; #endif // !defined(AFX_GRIDCELL_H__3BFEC235_1797_4232_AB30_3F8C8A1F06EB__INCLUDED_)
6d13074e1096a9b68013622990856e5b48f049fb
a3ad000cc7dd58cdb04b64acea01b42719099923
/10-34-37.cpp
0727ff9a42504472c15120ab1d6c5c0cf2b5aa38
[]
no_license
zheLee1019/C-primer
af64572aa159a311e41eccd4c27bade91dccf293
57392782772acd19dba252c2d94710246e153b22
refs/heads/master
2020-12-30T13:40:02.411926
2018-01-10T12:11:46
2018-01-10T12:11:46
91,241,875
0
0
null
null
null
null
UTF-8
C++
false
false
692
cpp
10-34-37.cpp
#include<algorithm> #include<iostream> #include<fstream> #include<iterator> #include<vector> #include<list> using namespace std; int main() { vector<int> vec{0,1,2,3,4,5,6,7,8,9,10};//10-34 ostream_iterator<int> out(cout," "); copy(vec.crbegin(),vec.crend(),out); cout<<endl; for(auto i=vec.end()-1;i!=vec.begin()-1;--i){//10-35 cout<<*i<<" "; } cout<<endl; list<int> lst{1,2,3,4,0,5,6,7,8,0,9};//10-36 auto find_0=find(lst.crbegin(),lst.crend(),0); cout<<distance(find_0,lst.crend())<<endl; list<int> rlist; copy(vec.cbegin()+4,vec.cbegin()+7,front_inserter(rlist));//10-37 copy(rlist.cbegin(),rlist.cend(),out); return 0; }
a5cc25b2812247f61026e50ec8f52f800fe51844
55c102b4c78a00ea3cd8697b0614524de9ae0533
/CloudBuilder/GUIPlayerContainer.cpp
d1e5dceb89435654226dd61a7d161734bc3aebea
[]
no_license
cgdb3742/CloudBuilder
851a612e4f4d5761f48ee83ceee926c1789edb66
82785b2f53314dac5239a499f85c04d671ab741d
refs/heads/master
2021-01-16T20:20:39.302931
2017-09-23T15:12:48
2017-09-23T15:12:48
100,199,760
1
0
null
null
null
null
UTF-8
C++
false
false
2,266
cpp
GUIPlayerContainer.cpp
#include "GUIPlayerContainer.h" GUIPlayerContainer::GUIPlayerContainer(GameContext& gameContext, InstructionPlayer& player): GameEntity(gameContext) { mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdPause, Enums::eInstructionPlayerCommand::CmdPlay, Enums::eInstructionPlayerCommand::CmdPlay, sf::Vector2f(0.2f,0.25f))); //Play/Pause mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdStep, sf::Vector2f(0.4f, 0.25f))); //Play step mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdStop, Enums::eInstructionPlayerCommand::CmdStop, Enums::eInstructionPlayerCommand::CmdUnknown, sf::Vector2f(0.6f, 0.25f))); //Stop mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdSpeedSlow, sf::Vector2f(0.2f, 0.75f))); //Speed : slow mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdSpeedMedium, sf::Vector2f(0.4f, 0.75f))); //Speed : medium mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdSpeedFast, sf::Vector2f(0.6f, 0.75f))); //Speed : fast mButtons.push_back(GUIPlayerButton(gameContext, player, Enums::eInstructionPlayerCommand::CmdSpeedInstant, sf::Vector2f(0.8f, 0.75f))); //Speed : instant } GUIPlayerContainer::~GUIPlayerContainer() { } void GUIPlayerContainer::drawCurrent(sf::RenderTarget & target) { sf::RectangleShape background(mBoundingBox); background.setPosition(mTopLeftCorner); background.setFillColor(sf::Color(0, 0, 191, 127)); target.draw(background); } void GUIPlayerContainer::setPositionChilds(sf::Vector2f minCorner, sf::Vector2f maxBox) { float minSize = std::min(maxBox.x / 4.0f, maxBox.y / 2.0f); float margin = minSize * 0.1f; sf::Vector2f size(minSize - 2.0f * margin, minSize - 2.0f * margin); //TODO set square size for (GUIPlayerButton& button : mButtons) { button.setBoundingBoxCurrent(size); button.setPositionAll(minCorner + sf::Vector2f(margin, margin), maxBox - 2.0f * sf::Vector2f(margin, margin)); } } void GUIPlayerContainer::updateChildsVector() { mChilds.clear(); for (GUIPlayerButton& button : mButtons) { mChilds.push_back(button); } }
b7ea36c857a15c35289be4a3407e2a6b7e48dca2
9d512bf2ba2d27cc044b0d53e0cac339e7eaf573
/src/row_propagate.cc
ee9cdffc6bd7e5414be5083c60d9bb4635a856d7
[]
no_license
whiker/whstereov
a17b2f25951b8b3cf47f063ca0f8e7fa5a72684e
33673ef1aedfbadd3cc1685f797baf2ec1b997f9
refs/heads/master
2021-01-17T18:52:37.782434
2016-06-03T12:30:41
2016-06-03T12:30:41
60,345,969
2
0
null
null
null
null
UTF-8
C++
false
false
5,099
cc
row_propagate.cc
#include <cmath> #include <memory.h> #include "global.h" #include "image.h" #include "cost.h" #include "sift_cost.h" #include "filter.h" #include "row_propagate.h" using namespace std; #ifdef RowPropagateCensus const int ColorDiffMax = 20; const int LineMax = 17; const double DisparReilable = 1.1; #else const int ColorDiffMax = 30; const int LineMax = 20; const double DisparReilable = 1.1; #endif int lineLeft[Row][Col], lineRigh[Row][Col]; int rineLeft[Row][Col], rineRigh[Row][Col]; int seed[Row][Col], dispar_t[Row][Col]; bool nonRelia[Row][Col]; void rowPropagate() { calcRowline(); calcRowrine(); calcSeed(); /* propagate(); //vote(); doFilter(); //*/ } void calcRowline() { int xMin, xMax; int x, y, i; double r, g, b; for (x = 0; x < Col; x++) { xMin = max(0, x-LineMax); xMax = min(Col1, x+LineMax); for (y = 0; y < Row; y++) { r = r1[y][x], g = g1[y][x], b = b1[y][x]; i = x-1; while (i>=xMin && similarColor(i, y, r, g, b)) i--; lineLeft[y][x] = i+1; // 左边界 i = x+1; while (i<=xMax && similarColor(i, y, r, g, b)) i++; lineRigh[y][x] = i-1; // 右边界 } } } void calcRowrine() { int xMin, xMax; int x, y, i; int r, g, b; for (x = 0; x < Col; x++) { xMin = max(0, x-LineMax); xMax = min(Col1, x+LineMax); for (y = 0; y < Row; y++) { r = r2[y][x], g = g2[y][x], b = b2[y][x]; i = x-1; while (i>=xMin && similarColorR(i, y, r, g, b)) i--; rineLeft[y][x] = i+1; // 左边界 i = x+1; while (i<=xMax && similarColorR(i, y, r, g, b)) i++; rineRigh[y][x] = i-1; // 右边界 } } } void calcSeed() { int costs[DisparNum], costMin; int x, y, d, dsel; double costMin_r, cost_r; int dsel_r; for (y = RowMin; y <= RowMax; y++) for (x = ColMin; x <= ColMax; x++) { // 计算出视差估计值, 并默认设成非可靠点 costMin = Int32Max; for (d = 0; d < DisparNum; d++) { costs[d] = lineCombine(x, y, d); if (costs[d] < costMin) { costMin = costs[d]; dsel = d; } } dispar_t[y][x] = dsel; nonRelia[y][x] = true; // 可靠点的条件1, costMin有足够优势 for (d = 0; d < DisparNum; d++) { if (d != dsel && costs[d] < costMin * DisparReilable) break; // 非可靠点 } if (d < DisparNum) continue; // 可靠点的条件2, 左右一致性 // 把左图[x-dsel, x-dsel+DisparNum-1]的点与右图(x-dsel)点比较 // g_cost_fn(x1,y1,d)是比较左图的(x1,y1)和右图的(x1-d,y1) costMin_r = Int32Max; for (d = 0; d < DisparNum; d++) { cost_r = lineCombine(x-dsel+d, y, d); if (cost_r < costMin_r) { costMin_r = cost_r; dsel_r = d; } } if (dsel_r == dsel) nonRelia[y][x] = false; } // 种子图 int i, i_max; memset(seed, 0, Row * Col * sizeof(int)); for (y = RowMin; y <= RowMax; y++) for (x = ColMin; x <= ColMax; ) { i_max = lineRigh[y][x]; for (i=x; i<=i_max && nonRelia[y][i]; i++); if (i<=i_max) seed[y][i] = dispar_t[y][i]; x = i_max + 1; } saveDepth("ret/depth_1.png", dispar_t); saveDepth("ret/seed.png", seed); } void propagate() { int x, y, i1, i2, i_min, i_max; for (y = RowMin; y <= RowMax; y++) for (x = ColMin; x <= ColMax; x++) { if (seed[y][x] > 0) { dispar_t[y][x] = seed[y][x]; continue; } // 找到左边和右边的一个种子点 i_min = lineLeft[y][x], i_max = lineRigh[y][x]; for (i1 = x-1; i1>=i_min && seed[y][i1]==0; i1--); for (i2 = x+1; i2<=i_max && seed[y][i2]==0; i2++); if (i1 >= i_min && i2 <= i_max) dispar_t[y][x] = seed[y][x] = min(seed[y][i1], seed[y][i2]); else if (i1 >= i_min && i2 > i_max) dispar_t[y][x] = seed[y][x] = seed[y][i1]; else if (i1 < i_min && i2 <= i_max) dispar_t[y][x] = seed[y][x] = seed[y][i2]; } saveDepth("ret/depth_2.png", dispar_t); } void vote() { const int size = 4; int* hist = new int[DisparNum]; int histMax, dsel, x, y, i, j; for (y = RowMin; y <= RowMax; y++) for (x = ColMin; x <= ColMax; x++) { if (!nonRelia[y][x]) { dispar[y][x] = dispar_t[y][x]; continue; } memset(hist, 0, DisparNum * sizeof(int)); for (j = y-size; j <= y+size; j++) hist[dispar_t[j][x]]++; histMax = hist[0], dsel = 0; for (i = 1; i < DisparNum; i++) { if (hist[i] > histMax) { histMax = hist[i]; dsel = i; } } dispar[y][x] = dsel; } delete[] hist; } void doFilter(int type) { memcpy(dispar, dispar_t, Row*Col*sizeof(4)); filter(type); } bool similarColor(int x, int y, int r, int g, int b) { return ( max(max(abs(r1[y][x]-r), abs(g1[y][x]-g)), abs(b1[y][x]-b)) < ColorDiffMax ); } bool similarColorR(int x, int y, int r, int g, int b) { return ( max(max(abs(r2[y][x]-r), abs(g2[y][x]-g)), abs(b2[y][x]-b)) < ColorDiffMax ); } double lineCombine(int x, int y, int d) { double cost = 0.0; int i_max = lineRigh[y][x]; for (int i = lineLeft[y][x]; i <= i_max; i++) { #ifdef RowPropagateCensus cost += min(adCost(i, y, d), 60) + censusCost(i, y, d); #else cost += min(adCost(i, y, d), 80); #endif } #ifndef RowPropagateCensus cost = cost*15 + siftCost(x, y, d); #endif return cost; }
443d333cadc84001f4075f615f49c5656fdfc204
d9192c7d2d70d26367613b9ec587ad9a42d40c9b
/make_binary.cpp
9af5f02f3bcd14385288457e85e756e59fef8139
[]
no_license
kailashlimba/zb-solutions
770f58bc444b50ef41524711ab8d83c85a0076f3
5d8da4b2ba7a5327c1905e4a877419f1b9f0d5f3
refs/heads/master
2022-07-03T23:25:48.232192
2020-05-09T14:24:55
2020-05-09T14:24:55
262,537,425
0
0
null
null
null
null
UTF-8
C++
false
false
799
cpp
make_binary.cpp
TreeNode* buildnewTree(vector<int>&A,vector<int> &B,int iStart,int iEnd,unordered_map<int,int>&map,int &postIndex){ if(iStart>iEnd)return NULL; int rootVal = B[postIndex]; postIndex--; TreeNode* root = new TreeNode(rootVal); int index =map[rootVal]; root->right = buildnewTree(A,B,index+1,iEnd,map,postIndex); root->left = buildnewTree(A,B,iStart,index-1,map,postIndex); return root; } TreeNode* memorySet(vector<int>&A, vector<int>&B){ unordered_map<int,int>map; int len = A.size(); for(int i =0;i<len;i++){ map[A[i]]=i; } int postIndex = len-1; return buildnewTree(A,B,0,len-1,map,postIndex); } TreeNode* Solution::buildTree(vector<int> &A, vector<int> &B) { struct TreeNode* root = memorySet(A,B); return root; }
3361a8e2a1194b535d9490edc3cdf1e485b5356f
6607904990da958bb4115a4486eaaa829cf4d4eb
/ex03/Amateria.hpp
366e4a99912a0a822043576871e50ac78978586e
[]
no_license
dinar095/cpp_module04
0cce252300b1d896ed279c273184ddf543cf54d0
3792c13411bc0a4fed9a9eb2998551b4941482eb
refs/heads/master
2023-08-17T07:49:12.589199
2021-09-27T07:06:43
2021-09-27T07:06:43
409,585,465
0
0
null
null
null
null
UTF-8
C++
false
false
479
hpp
Amateria.hpp
#ifndef CPP_MODULE04_AMATERIA_HPP #define CPP_MODULE04_AMATERIA_HPP #include <iostream> #include "Icharacter.hpp" using std::cout; using std::endl; using std::string; class AMateria { protected: string type; public: AMateria(std::string const & type); AMateria(); virtual ~AMateria() {}; std::string const & getType() const; //Returns the materia type virtual AMateria* clone() const = 0; virtual void use(ICharacter& target); }; #endif //CPP_MODULE04_AMATERIA_HPP
2510a0d80569524869f8b67ce25254ac168311b7
caa112d7ada674b043288df8057bb2046b65304e
/Tree/Tree/Tree/Trav.cpp
45cf3a3b328c1e6a23405cbe96b7a59609c732a7
[]
no_license
Cycrypto/DataStructure
f8710b3755ed419b01376bd889251bad0879d1ac
896030c58781db0d10ab8857e4e54b1e7aeb8c5e
refs/heads/master
2023-05-30T15:39:44.652671
2021-06-14T08:09:32
2021-06-14T08:09:32
350,749,484
0
0
null
null
null
null
UHC
C++
false
false
1,716
cpp
Trav.cpp
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> typedef char element; typedef struct _node { element data; struct _node *left, *right; }Node; Node* initNode(char item) { Node* n = (Node*)malloc(sizeof(Node)); n->data = item; n->left = n->right = NULL; return n; } // 노드 생성 Node* searchTree(Node* n, char item) { if (n != NULL) { if (n->data == item) { return n; } else{ Node* temp = searchTree(n->left, item); if (temp != NULL) return temp; else return searchTree(n->right, item); } } return NULL; } // 트리 전체 순회 void inputData(Node* n, char d1, char d2, char d3) { n->data = d1; if (d2 != '.') n->left = initNode(d2); if (d3 != '.') n->right = initNode(d3); } void preorder(Node* root) { //printf("pre"); if (root != NULL) { printf("%c", root->data); preorder(root->left); preorder(root->right); } } void inorder(Node* root) { //printf("in"); if (root != NULL) { inorder(root->left); printf("%c", root->data); inorder(root->right); } } void postorder(Node* root) { //printf("post"); if (root != NULL) { postorder(root->left);// 왼쪽서브트리 순회 postorder(root->right);// 오른쪽서브트리순회 printf("%c", root->data); // 노드 방문 } } int main(void) { int iter = 0; Node* root = initNode(NULL); Node* temp; scanf("%d", &iter); for (int i = 0; i < iter; i++) { char ch1,ch2,ch3 = 0; scanf("%c %c %c", &ch1, &ch2, &ch3); getchar(); temp = searchTree(root, ch1); if (temp != NULL) inputData(temp, ch1, ch2, ch3); else inputData(root, ch1, ch2, ch3); } preorder(root); printf("\n"); inorder(root); printf("\n"); postorder(root); printf("\n"); }
c8a8f25bb981d5348e929b6bcef817b7fd4c1f55
d8b9f0c050319480ecaec18cba73f8fd347eccb5
/Source/CompressorComponent.cpp
e7a454fb4845c2d955aab95d6dd2c3425734df44
[ "MIT" ]
permissive
jadujoel/audio-compressor
9100445f82cc06ab087eea7c8de88e8a638470b5
c6636573d19fe175580d8b8649007ce17ed3e46b
refs/heads/main
2023-05-31T08:14:58.340353
2021-06-18T15:20:04
2021-06-18T15:20:04
378,166,652
0
0
null
null
null
null
UTF-8
C++
false
false
5,500
cpp
CompressorComponent.cpp
/* ============================================================================== CompressorComponent.cpp Created: 13 Aug 2020 8:25:07pm Author: admin ============================================================================== */ #include <JuceHeader.h> #include "CompressorComponent.h" //============================================================================== CompressorComponent::CompressorComponent(DHDCompressorAudioProcessor& p) : processor(p) { // attackLabel.setColour(Label::ColourIds::textColourId, labelColor) // Colourspace // auto grey = Colour(67,68,61); auto green = Colour(150,210,76); auto black = Colour(33,35,22); auto white = Colour(206, 202, 192); // Settings // auto bgColor = grey; auto sliderColor = Colours::lightblue; auto labelColor = white; //Colours::white.darker(); auto textColor = green; //Colours::limegreen; auto textBoxBackgroundColour = black; //Colours::black; auto sliderStyle = Slider::SliderStyle::RotaryVerticalDrag; LAF.setDefaultSansSerifTypeface(dottyFontPtr); LAF.setColour(Label::ColourIds::textColourId, labelColor); LAF.setColour(Slider::ColourIds::thumbColourId, sliderColor); LAF.setColour(Slider::ColourIds::textBoxTextColourId, textColor); LAF.setColour(Slider::ColourIds::textBoxBackgroundColourId, textBoxBackgroundColour); LAF.setColour(Slider::ColourIds::textBoxOutlineColourId, textBoxBackgroundColour); LAF.setDefaultLookAndFeel(&LAF); const int multi = 2; float fontSize = 20.0f; auto labelJust = Justification::centredTop; auto notif = NotificationType::dontSendNotification; auto textBoxPos = Slider::TextBoxBelow; int textBoxWidth = 40 * multi; int textBoxHeight = 20 * multi; bool isOnLeft = false; // juce::Font(const String &typefaceName, const String &typefaceStyle, float fontHeight)) // attackLabel.setFont(fontSize); // attackLabel.setFont(dottyFont); // attackLabel.setLookAndFeel(&LAF); attackLabel.setFont(fontSize); releaseLabel.setFont(fontSize); thresholdLabel.setFont(fontSize); ratioLabel.setFont(fontSize); makeupGainLabel.setFont(fontSize); attackLabel.setText("ATTACK" , notif); releaseLabel.setText("RELEASE" , notif); thresholdLabel.setText("THRESHOLD" , notif); ratioLabel.setText("RATIO" , notif); makeupGainLabel.setText("OUTPUT GAIN" , notif); attackLabel.setJustificationType(labelJust); releaseLabel.setJustificationType(labelJust); thresholdLabel.setJustificationType(labelJust); ratioLabel.setJustificationType(labelJust); makeupGainLabel.setJustificationType(labelJust); attackLabel.attachToComponent(&attackSlider, isOnLeft); releaseLabel.attachToComponent(&releaseSlider, isOnLeft); thresholdLabel.attachToComponent(&thresholdSlider, isOnLeft); ratioLabel.attachToComponent(&ratioSlider, isOnLeft); makeupGainLabel.attachToComponent(&makeupGainSlider, isOnLeft); attackSlider.setSliderStyle(sliderStyle); releaseSlider.setSliderStyle(sliderStyle); thresholdSlider.setSliderStyle(sliderStyle); ratioSlider.setSliderStyle(sliderStyle); makeupGainSlider.setSliderStyle(sliderStyle); attackSlider.setTextBoxStyle(textBoxPos, false, textBoxWidth, textBoxHeight); releaseSlider.setTextBoxStyle(textBoxPos, false, textBoxWidth, textBoxHeight); thresholdSlider.setTextBoxStyle(textBoxPos, false, textBoxWidth, textBoxHeight); ratioSlider.setTextBoxStyle(textBoxPos, false, textBoxWidth, textBoxHeight); makeupGainSlider.setTextBoxStyle(textBoxPos, false, textBoxWidth, textBoxHeight); addAndMakeVisible(&thresholdSlider); addAndMakeVisible(&ratioSlider); addAndMakeVisible(&makeupGainSlider); addAndMakeVisible(&attackSlider); addAndMakeVisible(&releaseSlider); attackAttachment = std::make_unique<AudioProcessorValueTreeState::SliderAttachment>(processor.getAPVTS(), "ATTACK", attackSlider); releaseAttachment = std::make_unique<AudioProcessorValueTreeState::SliderAttachment>(processor.getAPVTS(), "RELEASE", releaseSlider); thresholdAttachment = std::make_unique<AudioProcessorValueTreeState::SliderAttachment>(processor.getAPVTS(), "THRESHOLD", thresholdSlider); makeupGainAttachment = std::make_unique<AudioProcessorValueTreeState::SliderAttachment>(processor.getAPVTS(), "OUTPUT_GAIN", makeupGainSlider); ratioAttachment = std::make_unique<AudioProcessorValueTreeState::SliderAttachment>(processor.getAPVTS(), "RATIO", ratioSlider); } CompressorComponent::~CompressorComponent(){} void CompressorComponent::paint (Graphics& g) { g.fillAll(Colour(67,68,61)); } void CompressorComponent::resized() { const auto startX = 0.0f; const auto startY = 0.25f; const auto dialWidth = 0.2f; const auto dialHeight = 0.5f; thresholdSlider.setBoundsRelative(startX+(dialWidth*0), startY, dialWidth, dialHeight); ratioSlider.setBoundsRelative(startX+(dialWidth*1), startY, dialWidth, dialHeight); attackSlider.setBoundsRelative(startX+(dialWidth*2), startY, dialWidth, dialHeight); releaseSlider.setBoundsRelative(startX+(dialWidth*3), startY, dialWidth, dialHeight); makeupGainSlider.setBoundsRelative(startX+(dialWidth*4), startY, dialWidth, dialHeight); }
51570347b5797cb309a8045cbd84a80e3379a29a
aca8c9d3a8db53fee7e990f83c6a4becd5fe354d
/src/data/TemporalComposite.cpp
217ed79c024b9aedbb6d4c2e24f2bdc2045988a8
[ "Apache-2.0" ]
permissive
MatthieuHernandez/StraightforwardNeuralNetwork
9e797bb663981da7d9153493c168815570c18149
50afbd964f382eb1571084d52c5f443c807054f9
refs/heads/master
2023-04-13T13:31:27.030369
2023-04-01T17:14:10
2023-04-01T17:14:10
171,761,481
20
3
Apache-2.0
2023-04-01T17:14:11
2019-02-20T22:49:42
C++
UTF-8
C++
false
false
545
cpp
TemporalComposite.cpp
#include "TemporalComposite.hpp" using namespace std; using namespace snn; using namespace internal; TemporalComposite::TemporalComposite(Set sets[2]) { this->sets = sets; } void TemporalComposite::unshuffle() { this->sets[training].shuffledIndexes.resize(this->sets[training].size); for (int i = 0; i < static_cast<int>(this->sets[training].shuffledIndexes.size()); ++i) this->sets[training].shuffledIndexes[i] = i; } int TemporalComposite::isValid() { if (this->sets == nullptr) return 402; return 0; }
4ce19691664e558a0340400913343995a3d885c5
0d9ba54015ca52e9c249c15cd475bcfd44ebf37f
/Capstone_ToxicOasis/Source/Capstone_ToxicOasis/GameObjects/Players/PlayerCharacter.cpp
4f8f5331aee5bd9b67ffa0596219597d5084fc6c
[]
no_license
Iberlos/Capstone-Project-Psycosis
0af4d875aab5c63e746d32044b2389dd7fb14fbb
a526cad93bdd93f995617a604bfcdbe1bdf13701
refs/heads/master
2022-11-16T20:58:11.405652
2020-06-30T12:03:03
2020-06-30T12:03:03
275,454,146
0
0
null
null
null
null
UTF-8
C++
false
false
24,491
cpp
PlayerCharacter.cpp
// Fill out your copyright notice in the Description page of Project Settings. //Header include #include "PlayerCharacter.h" //Custom Engine Includes #include "Kismet/GameplayStatics.h" #include "Components/CapsuleComponent.h" #include "Components/SkeletalMeshComponent.h" #include "Camera/CameraComponent.h" #include "Net/UnrealNetwork.h" #include "Engine.h" #include "Engine/World.h" #include "GameFramework/GameStateBase.h" //Custom Project Includes #include "GameObjects/Interactables/Pickups/Weapons/WeaponPickup.h" #include "GameObjects/Interactables/InteractableActor.h" #include "Custom_Components/InventoryComponent.h" #include "Custom_Components/ObjectHealthComponent.h" #include "GameInstance/CapstoneGameInstance.h" APlayerCharacter::APlayerCharacter() { GetCapsuleComponent()->SetCollisionProfileName("PlayerCollision1"); //bind collision GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &APlayerCharacter::OnHit); // Create a CameraComponent m_FPSCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FPS Camera")); m_FPSCameraComponent->SetupAttachment(RootComponent); m_FPSCameraComponent->bUsePawnControlRotation = true; // Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn) m_FPSSkeletalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP SMesh")); m_FPSSkeletalMeshComponent->SetOnlyOwnerSee(true); m_FPSSkeletalMeshComponent->SetupAttachment(m_FPSCameraComponent); m_FPSSkeletalMeshComponent->bCastDynamicShadow = false; m_FPSSkeletalMeshComponent->CastShadow = false; // Modify the main mesh so the Owner can't see it GetMesh()->SetOnlyOwnerSee(false); GetMesh()->SetOwnerNoSee(true); //Add sound and particles related to the player character m_soundCues.Add("Jump"); m_particleFXs.Add("Jump"); //Add animation montages related to Player Character m_animationMontages_FPM.Add("Discard"); m_animationMontages_FPM.Add("Draw"); m_animationMontages_FPM.Add("Hoster"); m_animationMontages_FPM.Add("Interact"); m_animationMontages_FPM.Add("Shoot"); TArray<FName> keys; m_animationMontages_FPM.GetKeys(keys); for (FName key : keys) { for (int i = 0; i < (int)WeaponTypeEnum::WTE_Invalid; i++) { m_animationMontages_FPM[key].m_montages.Add(nullptr); } } m_animationMontages_TPM.Add("Discard"); m_animationMontages_TPM.Add("Draw"); m_animationMontages_TPM.Add("Hoster"); m_animationMontages_TPM.Add("Interact"); m_animationMontages_TPM.Add("Shoot"); m_animationMontages_TPM.GetKeys(keys); for (FName key : keys) { for (int i = 0; i < (int)WeaponTypeEnum::WTE_Invalid; i++) { m_animationMontages_TPM[key].m_montages.Add(nullptr); } } //Add lerped values related to the Player Character class m_lerpedValues.Add("FOV"); m_lerpedValues.Add("Recoil"); //Setup Replication bAlwaysRelevant = true; NetPriority = 5; m_playerIndex_r = -1; m_FOVLerpDurantion = 0.5f; } void APlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); // Bind Movement Inputs PlayerInputComponent->BindAxis("MoveForward", this, &APlayerCharacter::MoveForward); PlayerInputComponent->BindAxis("MoveRight", this, &APlayerCharacter::MoveSideways); // Mouse Camera Rotation PlayerInputComponent->BindAxis("Turn", this, &APlayerCharacter::MouseInputHorizontal); PlayerInputComponent->BindAxis("LookUp", this, &APlayerCharacter::MouseInputVertical); // Bind jumping input PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &APlayerCharacter::PlayerJump); //Inventory and pickup related bindings PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &APlayerCharacter::InteractWithFocused); PlayerInputComponent->BindAction("ShowInventory", IE_Pressed, this, &APlayerCharacter::ShowInventory); PlayerInputComponent->BindAction("ShowInventory", IE_Released, this, &APlayerCharacter::HideInventory); PlayerInputComponent->BindAction("UsePickup", IE_Pressed, this, &APlayerCharacter::UseSelected); PlayerInputComponent->BindAction("DropPickup", IE_Pressed, this, &APlayerCharacter::DropSelected); //Weapon related binds (Use the UsePickup bind to equip a new weapon) PlayerInputComponent->BindAction("Fire1", IE_Pressed, this, &APlayerCharacter::StartFiring); PlayerInputComponent->BindAction("Fire1", IE_Released, this, &APlayerCharacter::StopFiring); PlayerInputComponent->BindAction("Fire2", IE_Pressed, this, &APlayerCharacter::StartAiming); PlayerInputComponent->BindAction("Fire2", IE_Released, this, &APlayerCharacter::StopAiming); PlayerInputComponent->BindAction("Reload", IE_Released, this, &APlayerCharacter::Reload); } void APlayerCharacter::BeginPlay() { Super::BeginPlay(); SetInputEnabled(false); if (GetLocalRole() ==ROLE_Authority) { //setup frindly fire mechanic. UCapstoneGameInstance* gameInstance = Cast<UCapstoneGameInstance>(GetGameInstance()); m_isFriendlyFire = gameInstance->GetIsFriendlyFire(); if (m_isFriendlyFire) { if (m_playerIndex_r == -1) { TArray<APlayerState*> players = GetWorld()->GetAuthGameMode()->GameState->PlayerArray; m_playerIndex_r = players.Num(); //doing this here is pretty bad, but it works... FString profileName = "PlayerCollision"; profileName.AppendInt(m_playerIndex_r); GetCapsuleComponent()->SetCollisionProfileName(*profileName); //end } FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::CLIENT_SetCollisionForFriendlyFire, 3.0f, false); } //setup fall back to world timer FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::CheckForGround, 1.0f, true); //setup default weapon if (m_defaultWeaponTemplate) { AWeaponPickup* defaultWeapon = GetWorld()->SpawnActor<AWeaponPickup>(m_defaultWeaponTemplate); m_inventoryComponent->SetDefaultWeapon(defaultWeapon); defaultWeapon->CompleteWeaponAssembly(); defaultWeapon->Interact(this); } //setup enable on start timer FTimerHandle t2; GetWorldTimerManager().SetTimer(t2, this, &APlayerCharacter::EnableOnLevelStart, 3.0f, false); } //save the initial FOV to allow aiming m_lerpedValues["FOV"].Init(m_FPSCameraComponent->FieldOfView, m_FPSCameraComponent->FieldOfView - 30, 0.05f, 0, 0/*, &(m_FPSCameraComponent->FieldOfView)*/); if (GetLocalRole() == ROLE_AutonomousProxy || GetLocalRole() == ROLE_Authority) { //setup raycast to focused FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::RayCastToFocused, 0.1f, true); } } void APlayerCharacter::Tick(float DeltaTime) { Super::Tick(DeltaTime); if (GetLocalRole() == ROLE_AutonomousProxy || GetLocalRole() == ROLE_Authority) { //Interaction setUp //RayCastToFocused(); //Debug messages for equipped weapon //if (GetLocalRole() == ROLE_Authority) //{ // if (m_equippedWeapon_r) // { // GEngine->AddOnScreenDebugMessage(2, 1.f, FColor::Red, FString::Printf(TEXT("Ammo in magazine: %f"), m_equippedWeapon_r->GetAmmoInMagazine())); // GEngine->AddOnScreenDebugMessage(3, 1.f, FColor::Red, FString::Printf(TEXT("\nWEAPON STATS:\nRarity:%d\nDamage:%f\nAcc:%f\nFireRate:%f\nRecoil:%f\nMagSize:%f\nWeight:%f"), (int)m_equippedWeapon_r->GetWeaponRarity(), m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_Damage), m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_Accuracy), m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_FireRate), m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_Recoil), m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_MagazineSize), m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_Weight))); // } //} m_FPSCameraComponent->SetFieldOfView(m_lerpedValues["FOV"].Get()); //This might change, ideally the lerped values would update whatever function is linked to them LookVertical(-m_lerpedValues["Recoil"].Get()); //This might change, ideally the lerped values would update whatever function is linked to them LookHorizontal(m_lerpedValues["Recoil"].Get() * 0.1f); //This might change, ideally the lerped values would update whatever function is linked to them } } float APlayerCharacter::PlayAnimationMontage(FName a_key, int a_index) { if (m_animationMontages_FPM.Contains(a_key) && m_animationMontages_FPM[a_key].m_montages.IsValidIndex(a_index) && m_animationMontages_FPM[a_key].m_montages[a_index] != nullptr) { SERVER_PlayAnimationMontage(a_key, a_index); return m_animationMontages_FPM[a_key].m_montages[a_index]->GetPlayLength(); } return 0.0f; } void APlayerCharacter::NET_PlayAnimationMontage(FName a_key, int a_index) { if (m_animationMontages_TPM.Contains(a_key) && m_animationMontages_TPM[a_key].m_montages.IsValidIndex(a_index) && m_animationMontages_TPM[a_key].m_montages[a_index] != nullptr) { UAnimInstance* animInstance = GetMesh()->GetAnimInstance(); if (animInstance) { animInstance->Montage_Play(m_animationMontages_TPM[a_key].m_montages[a_index], 1.0f); } } if (m_animationMontages_FPM.Contains(a_key) && m_animationMontages_FPM[a_key].m_montages.IsValidIndex(a_index) && m_animationMontages_FPM[a_key].m_montages[a_index] != nullptr) { UAnimInstance* animInstance = m_FPSSkeletalMeshComponent->GetAnimInstance(); if (animInstance) { animInstance->Montage_Play(m_animationMontages_FPM[a_key].m_montages[a_index], 1.0f); } } } void APlayerCharacter::FallBackIntoLevel() { SERVER_FallBackIntoLevel(); } void APlayerCharacter::SERVER_FallBackIntoLevel_Implementation() { SetInputEnabled(false); m_isFallingBackToLevel_r = true; ApplyDamage(m_fallBackDamagePercentage, true); StopFiring(); StopAiming(); CLIENT_FallBackIntoLevel(); } void APlayerCharacter::CLIENT_FallBackIntoLevel_Implementation() { GetMovementComponent()->StopMovementImmediately(); SetActorRotation(m_lastValidStepRotation_r); SetActorLocation(m_lastValidStepLocation_r + m_fallBackHight * FVector::UpVector, false, nullptr, ETeleportType::ResetPhysics); } void APlayerCharacter::ApplyRecoil(float a_recoilAmmount) { CLIENT_ApplyRecoil(a_recoilAmmount); } void APlayerCharacter::CLIENT_ApplyRecoil_Implementation(float a_recoilAmmount) { m_lerpedValues["Recoil"].Init(a_recoilAmmount, 0, 0.15f, 0, 3, true); } void APlayerCharacter::TrashWeapon() { SERVER_TrashWeapon(); } void APlayerCharacter::SERVER_TrashWeapon_Implementation() { if (m_equippedWeapon_r) { //SHOULD PROBABLY SET A CAN SHOOT AND A CAN OPEN INVENTORY HERE TO AVOID GLITCHES PlayAnimationMontage("Discard", (int)(m_equippedWeapon_r->GetWeaponType())); } } void APlayerCharacter::FinalizeServerThrashWeapon() { if (GetLocalRole() == ROLE_Authority) { if (m_equippedWeapon_r) { AWeaponPickup* trashWeapon = m_equippedWeapon_r; InventoryTabEnum typeOfWeapon = trashWeapon->GetPickupType(); DropEquipped(); trashWeapon->DestroySelf(); m_inventoryComponent->EquipAnyWeapon(typeOfWeapon); //SHOULD PROBABLY SET A CAN SHOOT AND A CAN OPEN INVENTORY HERE TO AVOID GLITCHES } } } void APlayerCharacter::NotifyHolster() { if (m_tempReferenceToWeaponBeingEquipped) { m_equippedWeapon_r->FinalizeUnequip(); m_tempReferenceToWeaponBeingEquipped->FinalizeEquip(); } } void APlayerCharacter::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) { if (m_isFallingBackToLevel_r) { SetInputEnabled(true); m_isFallingBackToLevel_r = false; } } APickupInteractable* APlayerCharacter::GetDefaultWeapon() { return m_inventoryComponent->GetDefaultWeapon(); } void APlayerCharacter::Die() { Super::Die(); SetInputEnabled(false); StopFiring(); StopAiming(); FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::Respawn, m_respawnDelay); } void APlayerCharacter::Respawn() { Super::Respawn(); SetInputEnabled(true); m_healthComponent->SetHealth(m_healthComponent->GetMaxHealth()); if (m_currentCheckpoint_r) { CLIENT_Respawn(); } else { GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Red, TEXT("I DO NOT HAVE A SPAWN POINT")); } } void APlayerCharacter::CLIENT_Respawn_Implementation() { SetActorLocation(m_currentCheckpoint_r->GetActorLocation(), false, nullptr, ETeleportType::ResetPhysics); } void APlayerCharacter::UpdateCameraRotation() { if (GetLocalRole() == ROLE_AutonomousProxy || GetLocalRole() == ROLE_Authority) { SERVER_UpdateCameraRotation(GetViewRotation()); } } void APlayerCharacter::SERVER_UpdateCameraRotation_Implementation(FRotator a_viewRotation) { if (m_FPSCameraComponent) { NET_UpdateCameraRotation(a_viewRotation); } } void APlayerCharacter::NET_UpdateCameraRotation_Implementation(FRotator a_viewRotation) { m_FPSCameraComponent->SetWorldRotation(a_viewRotation); } void APlayerCharacter::MoveForward(float a_val) { if (a_val != 0.0f) { // add movement in that direction AddMovementInput(GetActorForwardVector(), a_val * m_baseMoveSpeed* GetWorld()->GetDeltaSeconds()); } } void APlayerCharacter::MoveSideways(float a_val) { if (a_val != 0.0f) { // add movement in that direction AddMovementInput(GetActorRightVector(), a_val * m_baseMoveSpeed* GetWorld()->GetDeltaSeconds()); } } void APlayerCharacter::MouseInputHorizontal(float a_val) { if (GetInventoryComponent()->GetIsDisplayingInventory()) { GetInventoryComponent()->MouseInputHorizontal(a_val); } else { LookHorizontal(a_val); } } void APlayerCharacter::MouseInputVertical(float a_val) { if (GetInventoryComponent()->GetIsDisplayingInventory()) { GetInventoryComponent()->MouseInputVertical(a_val); } else { LookVertical(a_val); } } void APlayerCharacter::LookVertical(float a_val) { float sensitivity = Cast<UCapstoneGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))->m_sensitivity; float turnRate = (m_equippedWeapon_r != nullptr) ? (m_maxWeaponWeight - m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_Weight)) / m_maxWeaponWeight : 1; turnRate *= m_baseTurnRate; turnRate *= sensitivity; if (Cast<UCapstoneGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))->m_invertCamera) { turnRate *= -1; } AddControllerPitchInput(a_val * turnRate * GetWorld()->GetDeltaSeconds()); if (!m_updateCameraRotationTimer.IsValid() && GetController() && GetController()->IsLocalController()) { GetWorldTimerManager().SetTimer(m_updateCameraRotationTimer, this, &APlayerCharacter::UpdateCameraRotation, 0.1f, true); } } void APlayerCharacter::LookHorizontal(float a_val) { float sensitivity = Cast<UCapstoneGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))->m_sensitivity; float turnRate = (m_equippedWeapon_r !=nullptr) ? (m_maxWeaponWeight - m_equippedWeapon_r->GetAttributeTotal(WeaponAttributeEnum::WAE_Weight))/m_maxWeaponWeight : 1; turnRate *= m_baseTurnRate; turnRate *= sensitivity; if (Cast<UCapstoneGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))->m_invertCamera) { turnRate *= -1; } AddControllerYawInput(a_val * turnRate * GetWorld()->GetDeltaSeconds()); } void APlayerCharacter::PlayerJump() { if (GetMovementComponent()->IsJumpAllowed()) { PlayParticle("Jump"); PlaySound("Jump", true); } Jump(); } void APlayerCharacter::StartFiring() { SERVER_StartFiring(this); } void APlayerCharacter::SERVER_StartFiring_Implementation(AActor* a_actor) { if (m_equippedWeapon_r) m_equippedWeapon_r->StartFiring(a_actor, m_isFriendlyFire); } void APlayerCharacter::StopFiring() { SERVER_StopFiring(); } void APlayerCharacter::SERVER_StopFiring_Implementation() { if (m_equippedWeapon_r) m_equippedWeapon_r->StopFiring(); } void APlayerCharacter::StartAiming() { if (m_equippedWeapon_r) { m_lerpedValues["FOV"].SetTargetAlpha(1.0f); SERVER_StartAiming(this); } } void APlayerCharacter::SERVER_StartAiming_Implementation(AActor* a_actor) { if (m_equippedWeapon_r) { m_equippedWeapon_r->SetIsAiming(true); } } void APlayerCharacter::StopAiming() { if (m_equippedWeapon_r) { m_lerpedValues["FOV"].SetTargetAlpha(0.0f); SERVER_StopAiming(); } } void APlayerCharacter::SERVER_StopAiming_Implementation() { if (m_equippedWeapon_r) { m_equippedWeapon_r->SetIsAiming(false); } } void APlayerCharacter::Reload() { SERVER_Reload(); } void APlayerCharacter::SERVER_Reload_Implementation() { if (m_equippedWeapon_r) m_equippedWeapon_r->Reload(); } void APlayerCharacter::RayCastToFocused() { SERVER_RayCastToFocused(); } void APlayerCharacter::SERVER_RayCastToFocused_Implementation() { if (m_FPSCameraComponent) { //Save the previous interactable focused for later comparison m_focusedInteractible[1] = m_focusedInteractible[0]; //Raycast FHitResult OutHit; FVector Start = m_FPSCameraComponent->GetComponentLocation(); FVector ForwardVector = m_FPSCameraComponent->GetForwardVector(); FVector End = ((ForwardVector * m_interactDistance) + Start); FCollisionQueryParams CollisionParams; CollisionParams.AddIgnoredActor(this); GetWorld()->SweepSingleByChannel(OutHit,Start,End,FQuat(), ECC_PhysicsBody,FCollisionShape::MakeSphere(m_interactRadius), CollisionParams); if (OutHit.bBlockingHit) DrawDebugLine(GetWorld(), Start, OutHit.ImpactPoint, FColor().Red, false, 0.05, 0, 1); //Set the focusedInteractable even if its null m_focusedInteractible[0] = Cast<AInteractableActor>(OutHit.GetActor()); CLIENT_RayCastToFocused(); } } void APlayerCharacter::CLIENT_RayCastToFocused_Implementation() { if (GetLocalRole() != ROLE_Authority) //if you are the autority you already did this on the SERVER version { //Save the previous interactable focused for later comparison m_focusedInteractible[1] = m_focusedInteractible[0]; //Raycast FHitResult OutHit; FVector Start = m_FPSCameraComponent->GetComponentLocation(); FVector ForwardVector = m_FPSCameraComponent->GetForwardVector(); FVector End = ((ForwardVector * m_interactDistance) + Start); FCollisionQueryParams CollisionParams; CollisionParams.AddIgnoredActor(this); GetWorld()->SweepSingleByChannel(OutHit, Start, End, FQuat(), ECC_PhysicsBody, FCollisionShape::MakeSphere(m_interactRadius), CollisionParams); if(OutHit.bBlockingHit) DrawDebugLine(GetWorld(), Start, OutHit.ImpactPoint, FColor().Green, false, 0.05, 0, 1); //Set the focusedInteractable even if its null m_focusedInteractible[0] = Cast<AInteractableActor>(OutHit.GetActor()); } //compare the previous and current focusedInteractible and fucus and unfocus if necessary if (m_focusedInteractible[0] != m_focusedInteractible[1]) { if (m_focusedInteractible[0]) { m_focusedInteractible[0]->Focus(); } if (m_focusedInteractible[1]) { m_focusedInteractible[1]->Unfocus(); } } } void APlayerCharacter::InteractWithFocused() { SERVER_InteractWithFocused(); } void APlayerCharacter::SERVER_InteractWithFocused_Implementation() { if (m_focusedInteractible[0]) { if (m_focusedInteractible[0]->Interact(this)) { if (m_equippedWeapon_r) { PlayAnimationMontage("Interact", (int)(m_equippedWeapon_r->GetWeaponType())); } } } } void APlayerCharacter::ShowInventory() { SERVER_ShowInventory(); } void APlayerCharacter::SERVER_ShowInventory_Implementation() { m_inventoryComponent->DisplayInventory(true); } void APlayerCharacter::HideInventory() { SERVER_HideInventory(); } void APlayerCharacter::SERVER_HideInventory_Implementation() { m_inventoryComponent->DisplayInventory(false); } void APlayerCharacter::DropSelected() { SERVER_DropSelected(); } void APlayerCharacter::SERVER_DropSelected_Implementation() { m_inventoryComponent->DropSelected(this); } void APlayerCharacter::DropEquipped() { SERVER_DropEquipped(); } void APlayerCharacter::SERVER_DropEquipped_Implementation() { if (m_equippedWeapon_r != nullptr) { m_inventoryComponent->DropPickup(this, m_equippedWeapon_r); } return; } void APlayerCharacter::UseSelected() { SERVER_UseSelected(); } void APlayerCharacter::SERVER_UseSelected_Implementation() { m_inventoryComponent->UseSelected(this); } void APlayerCharacter::UseAt(InventoryTabEnum a_tab, int a_tabIndex) { SERVER_UseAt(a_tab,a_tabIndex); } void APlayerCharacter::SERVER_UseAt_Implementation(InventoryTabEnum a_tab, int a_tabIndex) { m_inventoryComponent->UseAt(this, a_tab,a_tabIndex); } void APlayerCharacter::CheckForGround() { /*Initializing the variables needed for the raycast */ FHitResult OutHitDown; /*Start of the ray is the location of the Muzzle*/ FVector Start = GetActorLocation() + GetActorForwardVector() * 100; /*The end of the ray uses the forward vector of the The Weapon */ FVector Direction = FVector::DownVector; //If using projectiles in the future the accuracy would be used in much the same way to set the direction of the movement. FVector End = ((Direction * 300.0f) + Start);//could have a range variable for this /*Setting the collision parameters to ignore the player when the ray is fired*/ FCollisionQueryParams CollisionParams; CollisionParams.AddIgnoredActor(this); if (GetWorld()->LineTraceSingleByChannel(OutHitDown, Start, End, ECC_WorldStatic, CollisionParams)) //Raycast down looking for ground { if (OutHitDown.Actor != nullptr) //if the hit actor is not fucking brush { if (!OutHitDown.Actor->ActorHasTag("MovingPlatform") && !OutHitDown.Actor->ActorHasTag("FallBackTrigger")) //if its not a moving platform { /*Initializing the variables needed for the raycast */ FHitResult OutHitUp; Start = GetActorLocation(); Direction = FVector::UpVector; End = ((Direction * m_fallBackHight) + Start); if (!GetWorld()->LineTraceSingleByChannel(OutHitUp, Start, End, ECC_WorldStatic, CollisionParams)) //if there are no objects up to 10 meters above { m_lastValidStepLocation_r = OutHitDown.ImpactPoint - GetActorForwardVector() * 100; //valid step position to use later m_lastValidStepRotation_r = GetActorRotation(); } } } } } void APlayerCharacter::SetCollisionForFriendlyFire() { UCapstoneGameInstance* gameInstance = Cast<UCapstoneGameInstance>(GetGameInstance()); if (gameInstance->GetInstanceIndex() == -1) //if the instance still doesn't have an index { if (m_playerIndex_r == -1) //if the player index was not replicated yet { FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::SetCollisionForFriendlyFire, 1.0f, false); return; } else { gameInstance->SetInstanceIndex(m_playerIndex_r); FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::SetCollisionForFriendlyFire, 1.0f, false); return; } } else { SERVER_SetCollisionForFriendlyFire(gameInstance->GetInstanceIndex()); } } void APlayerCharacter::CLIENT_SetCollisionForFriendlyFire_Implementation() { FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::SetCollisionForFriendlyFire, 1.0f, false); } void APlayerCharacter::SERVER_SetCollisionForFriendlyFire_Implementation(int a_playerIndex) { NET_SetCollisionForFriendlyFire(a_playerIndex); } void APlayerCharacter::NET_SetCollisionForFriendlyFire_Implementation(int a_playerIndex) { m_playerIndex_r = a_playerIndex; FString profileName = "PlayerCollision"; profileName.AppendInt(m_playerIndex_r); GetCapsuleComponent()->SetCollisionProfileName(*profileName); } void APlayerCharacter::EnableOnLevelStart() { TArray<APlayerState*> players = GetWorld()->GetAuthGameMode()->GameState->PlayerArray; for (APlayerState* playerState : players) { AMyCharacter* character = Cast<AMyCharacter>(playerState->GetPawn()); if (!character->GetHasTickedOnce()) { FTimerHandle t; GetWorldTimerManager().SetTimer(t, this, &APlayerCharacter::EnableOnLevelStart, 3.0f, false); return; } } SetInputEnabled(true); InitiateFadeFromBlack(this); } void APlayerCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME(APlayerCharacter, m_currentCheckpoint_r) DOREPLIFETIME(APlayerCharacter, m_equippedWeapon_r) DOREPLIFETIME(APlayerCharacter, m_lastValidStepLocation_r) DOREPLIFETIME(APlayerCharacter, m_lastValidStepRotation_r) DOREPLIFETIME(APlayerCharacter, m_playerIndex_r) DOREPLIFETIME(APlayerCharacter, m_isFallingBackToLevel_r) }
c47e3ccaee4446c46999d9f959f3ce73d4ba1dba
d343a0190e9ac356cd9c54f3bd394db74dab5338
/custom.hpp
20e413974123daea5e2ee0e9cd492963b54b599b
[]
no_license
wfay/qtst
0430b5c616a73d2d49abe7b63b12e1c53d855f9e
00f5d4a9bcf66c302b948de1e69854d30aa76e77
refs/heads/master
2021-01-25T05:35:53.179842
2015-08-31T11:58:13
2015-08-31T11:58:13
41,628,310
0
0
null
null
null
null
UTF-8
C++
false
false
5,110
hpp
custom.hpp
#if !defined(CUSTOM_H) #define CUSTOM_H #include <stdlib.h> #include <string> #include <ctype.h> #include <iostream> #include <QDir> #include <QGuiApplication> #include <QQmlEngine> #include <QQmlFileSelector> #include <QQmlContext> #include <QQuickView> #include <QObject> #include <QQuickWindow> #include <QDebug> #include "USTPFtdcUserApiDataType.h" extern void * OrderFunc(void *pParam); extern int g_choose; extern TUstpFtdcDirectionType g_direction; extern TUstpFtdcOffsetFlagType g_offsetflag; extern TUstpFtdcOrderPriceTypeType g_pricetype; extern TUstpFtdcHedgeFlagType g_hedgeflag; extern TUstpFtdcTimeConditionType g_timecondition; extern TUstpFtdcPriceType g_limitprice; extern TUstpFtdcVolumeType g_volume; extern TUstpFtdcVolumeConditionType g_volume_condition; extern bool ordered; extern TUstpFtdcOrderSysIDType g_drop_OrderSysID; extern TUstpFtdcInstrumentIDType g_instrumentID; typedef struct{ float ask[45000]; float bid[45000]; int idx; }price_data; enum TradeType{ BUY=1, SALE, EVEN, }; class MyClass : public QObject { Q_OBJECT Q_PROPERTY(double ask READ ask WRITE setask NOTIFY askvalueChanged) Q_PROPERTY(double bid READ bid WRITE setbid NOTIFY bidvalueChanged) Q_PROPERTY(double curr READ curr WRITE setcurr NOTIFY currvalueChanged) Q_PROPERTY(int data_count_1 READ data_count_1 WRITE setdata_count_1 NOTIFY data_countvalueChanged_1) public: char current_show[31]; double data[4]; // price_data IF1509; // price_data IF1512; int data_idx; MyClass() { setask(10); setbid(10); strcpy(current_show,"\n"); // printf("pshow:%s\n",current_show); data_idx=0; } QObject *object; int TType; /* Q_INVOKABLE float nextAsk(int idx) { return IF1509.ask[idx]; } Q_INVOKABLE float nextBid(int idx) { return IF1509.bid[idx]; } */ Q_INVOKABLE bool set_limitprice(QString limitprice) { g_limitprice=limitprice.toDouble(); // qDebug()<<g_limitprice; } Q_INVOKABLE void getSelect(const QString &msg) { memcpy(current_show,msg.toStdString().c_str(),7); memcpy(g_instrumentID,current_show,31); } Q_INVOKABLE void getTType(int t) { TType=t; char* msg; if(t==1) {msg="buy";} else if(t==2) { msg="sale"; } else if(t==3) { msg="even"; } qDebug()<<"Trade Type:"<<msg<<" "<<TType; } Q_INVOKABLE bool set_g_choose(int idx) { g_choose=idx; } Q_INVOKABLE bool set_volume(QString volume) { g_volume=volume.toDouble(); } Q_INVOKABLE bool set_volume_condition(int volume_condition) { g_volume_condition='3'; if(volume_condition==1) { g_volume_condition='1'; } else if(volume_condition==2) { g_volume_condition='2'; } } Q_INVOKABLE bool set_offset(int offset) { g_offsetflag='1'; if(offset==0) { g_offsetflag='0'; } } Q_INVOKABLE bool set_direction(int direction) { g_direction='1'; if(direction==0) { g_direction='0'; } } Q_INVOKABLE bool set_drop_num(QString num) { strcpy(g_drop_OrderSysID,num.toStdString().c_str()); } Q_INVOKABLE bool set_pricetype(int type) { g_pricetype='1'; if(type==2) { g_pricetype='2'; } } Q_INVOKABLE bool set_hedge(int type) { g_hedgeflag='3'; if(type==1) { g_hedgeflag='1'; } else if(type==2) { g_hedgeflag='2'; } } Q_INVOKABLE bool set_timeCon(int type) { g_timecondition='3'; if(type==1) { g_timecondition='1'; } else if(type==2) { g_timecondition='2'; } } double ask(){return current_ask;} /*! * Sets the value. */ void setask(double i) { current_ask=i; emit askvalueChanged(i); } void setcurr(double i) { current_data=i; emit currvalueChanged(i); } double curr(){return current_data;} double bid(){return current_bid;} int data_count_1(){return current_data_count_1;} /*! * Sets the value. */ void setbid(double i) { current_bid=i; emit bidvalueChanged(i); } void setdata_count_1(int i) { current_data_count_1=i; emit data_countvalueChanged_1(i); } signals: /*! * Emitted when the value changes. */ void askvalueChanged(double); void bidvalueChanged(double); void currvalueChanged(double); void data_countvalueChanged_1(int); public slots: void cppSlot(int number) { std::cout << "Called the C++ slot with" << number; } private: double current_ask; double current_bid; double current_data; double current_data_count_1; }; #endif
38ce3ae64972390d4636bdb9f3c300649c5ec1df
a611ff29bdf36cd333864c650bd9cd3bdf29d376
/Bitcoin/le.cpp
8e57717f0913099dcbeb0996d0bd074afb2f2171
[ "MIT" ]
permissive
vincenzopalazzo/clboss
c00ba244afa5e10035a3ba5dc8c5c5e8fe85776f
ef5c41612da0d544b0ed1f3e986b4b07126723a1
refs/heads/master
2023-09-01T01:12:49.252499
2023-03-09T17:42:48
2023-08-19T03:56:57
422,625,045
0
0
MIT
2023-08-17T13:02:24
2021-10-29T15:26:42
C++
UTF-8
C++
false
false
3,470
cpp
le.cpp
#include"Bitcoin/le.hpp" std::ostream& operator<<(std::ostream& os, Bitcoin::Detail::Le16Const o) { os << char((o.v >> 0) & 0xFF) << char((o.v >> 8) & 0xFF) ; return os; } std::istream& operator>>(std::istream& is, Bitcoin::Detail::Le16 o) { char c[2]; is.get(c[0]).get(c[1]); o.v = (std::uint16_t(std::uint8_t(c[0])) << 0) | (std::uint16_t(std::uint8_t(c[1])) << 8) ; return is; } std::ostream& operator<<(std::ostream& os, Bitcoin::Detail::Le32Const o) { os << char((o.v >> 0) & 0xFF) << char((o.v >> 8) & 0xFF) << char((o.v >> 16) & 0xFF) << char((o.v >> 24) & 0xFF) ; return os; } std::istream& operator>>(std::istream& is, Bitcoin::Detail::Le32 o) { char c[4]; is.get(c[0]).get(c[1]).get(c[2]).get(c[3]); o.v = (std::uint32_t(std::uint8_t(c[0])) << 0) | (std::uint32_t(std::uint8_t(c[1])) << 8) | (std::uint32_t(std::uint8_t(c[2])) << 16) | (std::uint32_t(std::uint8_t(c[3])) << 24) ; return is; } std::ostream& operator<<(std::ostream& os, Bitcoin::Detail::Le64Const o) { os << char((o.v >> 0) & 0xFF) << char((o.v >> 8) & 0xFF) << char((o.v >> 16) & 0xFF) << char((o.v >> 24) & 0xFF) << char((o.v >> 32) & 0xFF) << char((o.v >> 40) & 0xFF) << char((o.v >> 48) & 0xFF) << char((o.v >> 56) & 0xFF) ; return os; } std::istream& operator>>(std::istream& is, Bitcoin::Detail::Le64 o) { char c[8]; is.get(c[0]).get(c[1]).get(c[2]).get(c[3]) .get(c[4]).get(c[5]).get(c[6]).get(c[7]) ; o.v = (std::uint64_t(std::uint8_t(c[0])) << 0) | (std::uint64_t(std::uint8_t(c[1])) << 8) | (std::uint64_t(std::uint8_t(c[2])) << 16) | (std::uint64_t(std::uint8_t(c[3])) << 24) | (std::uint64_t(std::uint8_t(c[4])) << 32) | (std::uint64_t(std::uint8_t(c[5])) << 40) | (std::uint64_t(std::uint8_t(c[6])) << 48) | (std::uint64_t(std::uint8_t(c[7])) << 56) ; return is; } std::ostream& operator<<(std::ostream& os, Bitcoin::Detail::LeAmountConst o) { auto sats = o.v.to_sat(); os << Bitcoin::le(sats); return os; } std::istream& operator>>(std::istream& is, Bitcoin::Detail::LeAmount o) { auto sats = std::uint64_t(); is >> Bitcoin::le(sats); o.v = Ln::Amount::sat(sats); return is; } namespace Bitcoin { Detail::Le16 le(std::uint16_t& v) { return Detail::Le16(v); } Detail::Le16Const le(std::uint16_t const& v) { return Detail::Le16Const(v); } Detail::Le16 le(std::int16_t& v) { return Detail::Le16(reinterpret_cast<std::uint16_t&>(v)); } Detail::Le16Const le(std::int16_t const& v) { return Detail::Le16Const(reinterpret_cast<std::uint16_t const&>(v)); } Detail::Le32 le(std::uint32_t& v) { return Detail::Le32(v); } Detail::Le32Const le(std::uint32_t const& v) { return Detail::Le32Const(v); } Detail::Le32 le(std::int32_t& v) { return Detail::Le32(reinterpret_cast<std::uint32_t&>(v)); } Detail::Le32Const le(std::int32_t const& v) { return Detail::Le32Const(reinterpret_cast<std::uint32_t const&>(v)); } Detail::Le64 le(std::uint64_t& v) { return Detail::Le64(v); } Detail::Le64Const le(std::uint64_t const& v) { return Detail::Le64Const(v); } Detail::Le64 le(std::int64_t& v) { return Detail::Le64(reinterpret_cast<std::uint64_t&>(v)); } Detail::Le64Const le(std::int64_t const& v) { return Detail::Le64Const(reinterpret_cast<std::uint64_t const&>(v)); } Detail::LeAmount le(Ln::Amount& v) { return Detail::LeAmount(v); } Detail::LeAmountConst le(Ln::Amount const& v) { return Detail::LeAmountConst(v); } }
0c2d43be511dee1a2b8ca8410437e2b812703a4d
1dbf007249acad6038d2aaa1751cbde7e7842c53
/drs/include/huaweicloud/drs/v3/model/TransformationInfo.h
ec1ff4b64981a1c6f70972066608dba9fa7c69b6
[]
permissive
huaweicloud/huaweicloud-sdk-cpp-v3
24fc8d93c922598376bdb7d009e12378dff5dd20
71674f4afbb0cd5950f880ec516cfabcde71afe4
refs/heads/master
2023-08-04T19:37:47.187698
2023-08-03T08:25:43
2023-08-03T08:25:43
324,328,641
11
10
Apache-2.0
2021-06-24T07:25:26
2020-12-25T09:11:43
C++
UTF-8
C++
false
false
1,786
h
TransformationInfo.h
#ifndef HUAWEICLOUD_SDK_DRS_V3_MODEL_TransformationInfo_H_ #define HUAWEICLOUD_SDK_DRS_V3_MODEL_TransformationInfo_H_ #include <huaweicloud/drs/v3/DrsExport.h> #include <huaweicloud/core/utils/ModelBase.h> #include <huaweicloud/core/http/HttpResponse.h> #include <string> namespace HuaweiCloud { namespace Sdk { namespace Drs { namespace V3 { namespace Model { using namespace HuaweiCloud::Sdk::Core::Utils; using namespace HuaweiCloud::Sdk::Core::Http; /// <summary> /// 数据加工信息 /// </summary> class HUAWEICLOUD_DRS_V3_EXPORT TransformationInfo : public ModelBase { public: TransformationInfo(); virtual ~TransformationInfo(); ///////////////////////////////////////////// /// ModelBase overrides void validate() override; web::json::value toJson() const override; bool fromJson(const web::json::value& json) override; ///////////////////////////////////////////// /// TransformationInfo members /// <summary> /// - 生成加工规则值为contentConditionalFilter - 生成配置规则值为configConditionalFilter /// </summary> std::string getTransformationType() const; bool transformationTypeIsSet() const; void unsettransformationType(); void setTransformationType(const std::string& value); /// <summary> /// 过滤条件,生成加工规则值为sql条件语句,生成配置规则值为config。长度限制256。 /// </summary> std::string getValue() const; bool valueIsSet() const; void unsetvalue(); void setValue(const std::string& value); protected: std::string transformationType_; bool transformationTypeIsSet_; std::string value_; bool valueIsSet_; }; } } } } } #endif // HUAWEICLOUD_SDK_DRS_V3_MODEL_TransformationInfo_H_
554a25f9fe38090702d2817ddcfb2fd4062f2636
fd748e6ff6267fc692c02b185a176d6d18435e53
/C++/Sorting16.cpp
eb0ef3447f6559fb14a777395d0f070b30c97eaf
[]
no_license
manhtung001/cpp_PTIT
cc6485313621ef6f4c822a0d3e779f0a10af34f7
e09437e7299a70c90f2af4b46f22e658204fce0d
refs/heads/master
2023-06-02T13:40:04.107629
2021-06-23T04:21:17
2021-06-23T04:21:17
345,133,561
1
0
null
null
null
null
UTF-8
C++
false
false
497
cpp
Sorting16.cpp
#include<bits/stdc++.h> using namespace std; struct data{ int a,b; }; int n; bool cmp(data x, data y){ if(x.b<y.b) return false; if(x.b==y.b && x.a>y.a) return false; return true; } int main(){ int t; cin>>t; while(t--){ cin>>n; vector<data>v(n+5); // v.clear(); int d[100005]={0}; for(int i=0;i<n;i++){ cin>>v[i].a; d[v[i].a]++; } for(int i=0;i<n;i++){ v[i].b=d[v[i].a]; } sort(v.begin(),v.end(),cmp); for(int i=0;i<n;i++) cout<<v[i].a<<" "; cout<<endl; } }
4c9328f6583d32c483028f0d39f620dfcb7d49a0
46b3e4c5a56738328295aba73bb015189832ae8b
/Converter/Converters/include/Converters/Output/conversionoutput.h
ae7788542e3a1a98962f36d3c26b4033a8ec9910
[]
no_license
GrognardsFromHell/EvilTemple-Native
e2d28c7dfac1ac10f91875bd2bef016c6852de16
cb88b65ba54c9d4edf8c6519d8b1e14074de4aa3
refs/heads/master
2020-05-07T11:26:01.422835
2011-07-17T14:33:17
2011-07-17T14:33:17
35,892,196
0
0
null
null
null
null
UTF-8
C++
false
false
316
h
conversionoutput.h
#ifndef CONVERSIONOUTPUT_H #define CONVERSIONOUTPUT_H #include <QtCore/QString> #include <QtCore/QByteArray> class IConversionOutput { public: virtual void writeFile(const QString &path, const QByteArray &data, bool compress = true) = 0; virtual ~IConversionOutput() {} }; #endif // CONVERSIONOUTPUT_H
ee082418e5ad8bd1b6b3f4407ab632adb66a8047
ac0bfaf381d9b307e02ef08faa8f5cf572d27e02
/src/Devices/LoRaWAN-Client-DraginoShield-IoTHub/BME280.h
da3cb018433dccbe3b3bed2e62897951ed50106b
[]
no_license
IgniaAustralia/savethebees
b88203c458a35f5c9e6446a75c0dc67a3d580f2a
88b2cf55b61e8c921cfc87f92fbe2b5a76dc694a
refs/heads/master
2021-07-25T03:33:15.191439
2018-12-18T07:18:12
2018-12-18T07:18:12
153,857,242
0
0
null
2018-12-18T07:18:13
2018-10-20T01:03:04
C++
UTF-8
C++
false
false
6,674
h
BME280.h
//============================================================================== // E - R A D I O N I C A . C O M, H.Kolomana 6/A, Djakovo 31400, Croatia //============================================================================== // Project : BME280 Arduino Library (V1.0) // File : BME280.h // Author : e-radionica.com 2017 // Licence : Open-source ! //============================================================================== //============================================================================== // Use with any BME280 I2C breakout. Check ours: // // If any questions, // just contact techsupport@e-radionica.com //============================================================================== #ifndef __BME280_H__ #define __BME280_H__ #if ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif #include <Wire.h> #include <stdint.h> //****************************************************************************// //Register names: //****************************************************************************// #define BME280_DIG_T1_LSB_REG 0x88 #define BME280_DIG_T1_MSB_REG 0x89 #define BME280_DIG_T2_LSB_REG 0x8A #define BME280_DIG_T2_MSB_REG 0x8B #define BME280_DIG_T3_LSB_REG 0x8C #define BME280_DIG_T3_MSB_REG 0x8D #define BME280_DIG_P1_LSB_REG 0x8E #define BME280_DIG_P1_MSB_REG 0x8F #define BME280_DIG_P2_LSB_REG 0x90 #define BME280_DIG_P2_MSB_REG 0x91 #define BME280_DIG_P3_LSB_REG 0x92 #define BME280_DIG_P3_MSB_REG 0x93 #define BME280_DIG_P4_LSB_REG 0x94 #define BME280_DIG_P4_MSB_REG 0x95 #define BME280_DIG_P5_LSB_REG 0x96 #define BME280_DIG_P5_MSB_REG 0x97 #define BME280_DIG_P6_LSB_REG 0x98 #define BME280_DIG_P6_MSB_REG 0x99 #define BME280_DIG_P7_LSB_REG 0x9A #define BME280_DIG_P7_MSB_REG 0x9B #define BME280_DIG_P8_LSB_REG 0x9C #define BME280_DIG_P8_MSB_REG 0x9D #define BME280_DIG_P9_LSB_REG 0x9E #define BME280_DIG_P9_MSB_REG 0x9F #define BME280_DIG_H1_REG 0xA1 #define BME280_CHIP_ID_REG 0xD0 //Chip ID #define BME280_RST_REG 0xE0 //Softreset Reg #define BME280_DIG_H2_LSB_REG 0xE1 #define BME280_DIG_H2_MSB_REG 0xE2 #define BME280_DIG_H3_REG 0xE3 #define BME280_DIG_H4_MSB_REG 0xE4 #define BME280_DIG_H4_LSB_REG 0xE5 #define BME280_DIG_H5_MSB_REG 0xE6 #define BME280_DIG_H6_REG 0xE7 #define BME280_CTRL_HUMIDITY_REG 0xF2 //Ctrl Humidity Reg #define BME280_STAT_REG 0xF3 //Status Reg #define BME280_CTRL_MEAS_REG 0xF4 //Ctrl Measure Reg #define BME280_CONFIG_REG 0xF5 //Configuration Reg #define BME280_PRESSURE_MSB_REG 0xF7 //Pressure MSB #define BME280_PRESSURE_LSB_REG 0xF8 //Pressure LSB #define BME280_PRESSURE_XLSB_REG 0xF9 //Pressure XLSB #define BME280_TEMPERATURE_MSB_REG 0xFA //Temperature MSB #define BME280_TEMPERATURE_LSB_REG 0xFB //Temperature LSB #define BME280_TEMPERATURE_XLSB_REG 0xFC //Temperature XLSB #define BME280_HUMIDITY_MSB_REG 0xFD //Humidity MSB #define BME280_HUMIDITY_LSB_REG 0xFE //Humidity LSB //****************************************************************************// //****************************************************************************// //Used to hold the calibration constants. These are used //by the driver as measurements are being taking //****************************************************************************// struct SensorCalibration { public: uint16_t dig_T1; int16_t dig_T2; int16_t dig_T3; uint16_t dig_P1; int16_t dig_P2; int16_t dig_P3; int16_t dig_P4; int16_t dig_P5; int16_t dig_P6; int16_t dig_P7; int16_t dig_P8; int16_t dig_P9; uint8_t dig_H1; int16_t dig_H2; uint8_t dig_H3; int16_t dig_H4; int16_t dig_H5; uint8_t dig_H6; }; //****************************************************************************// //****************************************************************************// //This is the man operational class of the driver //****************************************************************************// class BME280 { //****************************************************************************// public: //Calibration SensorCalibration calibration; //****************************************************************************// //Constructor //****************************************************************************// BME280(void); BME280(uint8_t baseAddress); //****************************************************************************// //settings //****************************************************************************// uint8_t address; uint8_t mode; uint8_t standby; uint8_t filter; uint8_t temp_overSample; uint8_t humi_overSample; uint8_t pres_overSample; //****************************************************************************// //****************************************************************************// void settings(uint8_t _address, uint8_t _mode, uint8_t _standby, uint8_t _filter, uint8_t _temp_overSample, uint8_t _humi_overSample, uint8_t _pres_overSample); //****************************************************************************// //Call to change default setting //Call before begin //****************************************************************************// //****************************************************************************// uint8_t begin(void); //****************************************************************************// //Call to apply settings //****************************************************************************// //****************************************************************************// void reset( void ); //****************************************************************************// //Call to reset //****************************************************************************// //****************************************************************************// float readPressure( void ); float readAltitude( void ); float readHumidity( void ); float readTemp( void ); //****************************************************************************// //return float values of sensor readings //****************************************************************************// //****************************************************************************// private: //Global variable for temp int32_t t_fine; //Private functions void readRegisterRegion(uint8_t*, uint8_t, uint8_t ); uint8_t readRegister(uint8_t); int16_t readRegisterInt16( uint8_t offset ); void writeRegister(uint8_t, uint8_t); }; #endif
f7a3f6be141d0f0ee2ec2c3535831a8c7708966e
4360326fcaad7f6d8349b676dc5f00cdf29f7144
/src/simulator/discrete_simulator.h
b7ec344fca8885a4d127b6696a2475e359bd43d0
[]
no_license
raxter/WSN_SWEB_sim
04cfddaaaed05fed17822dcabb27dd2196744de8
545e7d1727d913d8b6b90990bda7023fbdd6370f
refs/heads/master
2020-04-05T23:44:14.001375
2009-05-25T02:10:36
2009-05-25T02:10:36
199,714
2
1
null
null
null
null
UTF-8
C++
false
false
2,694
h
discrete_simulator.h
#ifndef __WSN_SIMULATOR_DISCRETESIMULATOR__ #define __WSN_SIMULATOR_DISCRETESIMULATOR__ #include "sensor_network.h" #include "nodes/base_node.h" #include "packets/init.h" #include "packets/energy_req.h" #include "packets/data_req.h" #include <QSet> #include <QThread> #include <QVector> #include <QMutex> #include <QHash> #include <QMetaType> #include <iostream> namespace WSN { namespace Simulator { struct Signal { Node::BaseNode * src; Node::BaseNode * dst; double pos [4]; int amountSent; const BasePacket * finishedPacket; PacketTypes::Type type; Signal(Node::BaseNode * src = 0, Node::BaseNode * dst = 0, int amountSent = -1, const BasePacket * finishedPacket = 0, PacketTypes::Type type = PacketTypes::NoType) : src(src), dst(dst), amountSent (amountSent), finishedPacket(finishedPacket), type(type) { //std::cout << "finishedPacket " << finishedPacket << std::endl; if (src) { pos[0] = src->x(); pos[1] = src->y(); } if (dst) { pos[2] = dst->x(); pos[3] = dst->y(); } } }; class DiscreteSimulator : public QThread { Q_OBJECT public: /* class specific */ ///Constructors/Destructors DiscreteSimulator(SensorNetwork * sensorNetwork); ~DiscreteSimulator(); signals: void logEvent( const QString & event ); void finishedTimeStep (const QVector<Simulator::Signal>& list); void tick( ); void clearSignals(); void timeUpdated ( int time ); public slots: //void lock(); //void unlock(); void setSpeed( int sp ); void limitedTimeSimulation( int ms); void startSimulation(); void stopSimulation(); private slots: void incrementTimeStep(); public: /* methods */ double getAverageBatteryLife(); void requestStopRunning(); unsigned long currentTime(); //const QVector<Signal>& getSignalList() const; private: /* methods */ void run(); void timeStepCompleted(); // notification that a time step has been completed TODO should this be in SensorNetwork? void incrementTimeStep(Node::DiscreteSim * node); private: /* variables */ bool doSimulation; bool doLimitedSimulation; QVector<Signal> signalList; QHash<int, Node::BaseNode *> idToNode; QHash<int, QList<Node::BaseNode *> > groupIdToNodeList; QHash<int, QList<Node::BaseNode *> > sectorIdToNodeList; /* Thread */ bool running; QMutex control; int speed; /* ms/s */ int stepsToRun; /* ms */ SensorNetwork * sensorNetwork; QVector<Node::DiscreteSim *> nodes; unsigned long _currentTime;// in milliseconds }; } /* end of namespace Simulator */ } /* end of namespace WSN */ #endif
44b8f07dea09d79a1056dc85601be699548a7305
877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a
/app/src/main/cpp/dir35435/dir35536/dir38742/file38809.cpp
3febc6ff53fa651a2595b3723fc87b82fa001be6
[]
no_license
tgeng/HugeProject
829c3bdfb7cbaf57727c41263212d4a67e3eb93d
4488d3b765e8827636ce5e878baacdf388710ef2
refs/heads/master
2022-08-21T16:58:54.161627
2020-05-28T01:54:03
2020-05-28T01:54:03
267,468,475
0
0
null
null
null
null
UTF-8
C++
false
false
115
cpp
file38809.cpp
#ifndef file38809 #error "macro file38809 must be defined" #endif static const char* file38809String = "file38809";
9dd241f174d48ddbc01335c4ca9ea16496f6cb41
1c0938f635fc86f266214e80fa4cf947baa346bf
/chase_lobby/MLN_Utils.cpp
e96f9fa7c52f58a43c9a6fbd42b1d62c21a4b2b5
[ "MIT" ]
permissive
chaseYLC/chase_lobby
6d92dc4e532bfe0d2c20c514f682de306926abfd
f359a635d00b9338ae6a490ae23c250e3904a443
refs/heads/master
2020-03-28T12:03:13.881895
2018-09-21T10:45:54
2018-09-21T10:45:54
148,266,762
1
0
null
null
null
null
UTF-8
C++
false
false
1,533
cpp
MLN_Utils.cpp
#include "stdafx.h" #include "MLN_Utils.h" namespace MLN_Utils { int64_t getLocalTimeSec() { namespace pt = boost::posix_time; pt::ptime now = boost::posix_time::second_clock::local_time(); static boost::posix_time::ptime time_t_epoch(boost::gregorian::date(1970, 1, 1)); boost::posix_time::time_duration diff = now - time_t_epoch; return diff.total_seconds(); } std::string MB2UTF8(const char *mbString) { wchar_t strUnicode[256] = { 0, }; int nLen = MultiByteToWideChar(CP_ACP, 0, mbString, (int)strlen(mbString), NULL, NULL); MultiByteToWideChar(CP_ACP, 0, mbString, (int)strlen(mbString), strUnicode, nLen); char strUtf8[256] = { 0, }; nLen = WideCharToMultiByte(CP_UTF8, 0, strUnicode, lstrlenW(strUnicode), NULL, 0, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, strUnicode, lstrlenW(strUnicode), strUtf8, nLen, NULL, NULL); return strUtf8; } std::string & toLowerCase(std::string &src) { std::transform(src.begin(), src.end(), src.begin(), ::tolower); return src; } std::string & trim(std::string& s) { s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end()); s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace)))); return s; } int getRandomNumber(const int min, const int max) { std::random_device rn; std::mt19937_64 rnd(rn()); std::uniform_int_distribution<int> range(min, max); return range(rnd); } }
885115343042d111e96385c22ed834dc4988f881
0065cefdd3a4f163e92c6499c4f36feb584d99b7
/rogue/custom/custom.hh
876fa06ec62e3865edeac89cf200ba0665ddcc4c
[]
no_license
YMY1666527646/Rogue_Company_hack
ecd8461fc6b25a0adca1a6ef09ee57e59181bc84
2a19c81c5bf25b6e245084c073ad7af895a696e4
refs/heads/main
2023-08-20T06:07:14.660871
2021-10-21T20:33:53
2021-10-21T20:33:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
594
hh
custom.hh
#pragma once #define IMGUI_DEFINE_MATH_OPERATORS #define use(x) using namespace x; #include "../gui/imgui.h" #include "../gui/imgui_internal.h" #include <Windows.h> #include <map> struct c_custom { auto tab(const char* label, bool selected, ImVec2 size_arg) -> bool; auto child(const char* label, ImVec2 size_arg) -> void; auto end_child() -> void; auto keybind(const char* label, int* k, const ImVec2& size_arg) -> bool; auto color(int r, int g, int b, int a = 255) { return ImVec4(r / 255.f, g / 255.f, b / 255.f, a / 255.f); }; }; inline auto custom = new c_custom;
830b5fdaae118e7ec0052e636ffc7c30633430ed
c17e42186a4932fbbbbf45cb3cc5f63eea06c78d
/CSE-106 LAB_Works/201714018 LAB-007/Problem_004.cpp
66db5b4ebefc0998bd3ba09d9eb917449362c6b3
[]
no_license
royayon/C
746757bfed9478594682a1934608c0580820f467
3c273ec9c13a5f679336020af7fea190cb1613d6
refs/heads/master
2020-03-28T09:46:09.968326
2018-09-09T19:35:26
2018-09-09T19:35:26
148,058,592
2
0
null
null
null
null
UTF-8
C++
false
false
614
cpp
Problem_004.cpp
//Remove a char from a str #include<stdio.h> #include<string.h> #define pf printf #define sf scanf int main() { char str[1000]; char c; gets(str); sf("%c",&c); int j; for(int i=0;str[i]!='\0';i++) { while(str[i]==c) //pashapashi onekgula aaaaaaa ba ekoi char thakar karone while lagbe ekhane ekarone if kaj kore naa! { //if diye korle while er jaygay if and while er seshe i-- likhte hbe! for(j=i;str[j]!='\0';++j) { str[j]=str[j+1]; } str[j]='\0'; } } puts(str); }
b27c579c753ce3fd2369c5a5c9de9f0c573be77d
86fcd1fe1fe0b1313fcb4af050f7c00bee24df4d
/phaser_rd.cpp
54429c552c91c01c117991c549915d7a0f319d28
[]
no_license
andrewpeck/alct_vme_test
e6526df9516887172b65cb849da2d728b18cced7
42ce57c501b5d0c7b07325a66147bdb27a2b4714
refs/heads/master
2022-03-22T19:43:57.038621
2019-12-20T00:07:06
2019-12-20T00:07:06
116,048,511
0
0
null
2019-12-20T00:07:07
2018-01-02T19:16:49
C++
UTF-8
C++
false
false
5,135
cpp
phaser_rd.cpp
//------------------------------------------------------------------------------ // Reads DCM Digital Phase Shift VME register // // 06/15/09 Initial // 06/29/09 Added posneg bit // 06/30/09 Add phase delta // 08/14/09 Add cfeb phaser banks //------------------------------------------------------------------------------ // Headers //------------------------------------------------------------------------------ #include <stdio.h> #include <iostream> using namespace std; //------------------------------------------------------------------------------ // Common //------------------------------------------------------------------------------ extern FILE *log_file; //------------------------------------------------------------------------------ // Debug print mode //------------------------------------------------------------------------------ // #define debug 1 // comment this line to turn off debug print #ifdef debug #define dprintf fprintf #else #define dprintf // #endif //------------------------------------------------------------------------------ // Prototypes //------------------------------------------------------------------------------ long int vme_read (unsigned long &adr, unsigned short &rd_data); void pause (string s); //------------------------------------------------------------------------------ // Function phaser_rd(base_adr, phaser_bank, phaser_delta) returns phaser_delay //------------------------------------------------------------------------------ int phaser_rd(unsigned long &base_adr, const string phaser_bank, const int &phaser_delta) //------------------------------------------------------------------------------ // base_adr = VME base address for this TMB // phaser_bank = "alct_txd" or "alct_rxd" // phaser_delta = scale factor for phaser_delay // returns = current phaser_delay=0-to-255 clock phase //------------------------------------------------------------------------------ { // VME addresses const unsigned long phaser0_adr = 0x00010E; const unsigned long phaser1_adr = 0x000110; const unsigned long phaser2_adr = 0x000112; const unsigned long phaser3_adr = 0x000114; const unsigned long phaser4_adr = 0x000116; const unsigned long phaser5_adr = 0x000118; const unsigned long phaser6_adr = 0x00011A; // VME calls unsigned long adr; unsigned short rd_data; long status; // Local unsigned long phaser_adr; int phaser_delay; // Phaser register int fire; int reset; int busy; int lock; int sm_vec; int posneg; int phase; int qcycle; int hcycle; // Phaser machine states const string sm_dsp[8] = { "init ", "wait_tmb ", "wait_dcm ", "init_dps ", "inc_dec ", "wait_dps ", "unfire ", "undefined" }; //------------------------------------------------------------------------------ // Read phase delay value for selected DCM //------------------------------------------------------------------------------ // Determine phaser bank VME address if (phaser_bank.compare("alct_rxd" )==0) {phaser_adr=phaser0_adr; goto begin;} else if (phaser_bank.compare("alct_txd" )==0) {phaser_adr=phaser1_adr; goto begin;} else if (phaser_bank.compare("cfeb_rxd_0")==0) {phaser_adr=phaser2_adr; goto begin;} else if (phaser_bank.compare("cfeb_rxd_1")==0) {phaser_adr=phaser3_adr; goto begin;} else if (phaser_bank.compare("cfeb_rxd_2")==0) {phaser_adr=phaser4_adr; goto begin;} else if (phaser_bank.compare("cfeb_rxd_3")==0) {phaser_adr=phaser5_adr; goto begin;} else if (phaser_bank.compare("cfeb_rxd_4")==0) {phaser_adr=phaser6_adr; goto begin;} else {printf("\nPhaser bank unknown: %s",phaser_bank.c_str()); pause ("<cr>");} // Get current phaser status begin: adr = base_adr+phaser_adr; status = vme_read(adr,rd_data); fire = (rd_data >> 0) & 0x1; reset = (rd_data >> 1) & 0x1; busy = (rd_data >> 2) & 0x1; lock = (rd_data >> 3) & 0x1; sm_vec = (rd_data >> 4) & 0x7; posneg = (rd_data >> 7) & 0x1; phase = (rd_data >> 8) & 0x3F; qcycle = (rd_data >> 14) & 0x1; hcycle = (rd_data >> 15) & 0x1; phaser_delay = phase | (qcycle << 6) | (hcycle << 7); // Display status dprintf(log_file,"\n"); dprintf(log_file,"Phaser Call: phaser_bank=%s phaser_delay=%3i phaser_delta=%3i\n",phaser_bank.c_str(),phaser_delay, phaser_delta); dprintf(log_file,"fire = %3i\n",fire); dprintf(log_file,"reset = %3i\n",reset); dprintf(log_file,"busy = %3i\n",busy); dprintf(log_file,"lock = %3i\n",lock); dprintf(log_file,"sm_vec = %3i %s\n",sm_vec,sm_dsp[sm_vec].c_str()); dprintf(log_file,"posneg = %3i\n",posneg); dprintf(log_file,"phase = %3i\n",phase); dprintf(log_file,"qcycle = %3i\n",qcycle); dprintf(log_file,"hcycle = %3i\n",hcycle); dprintf(log_file,"\n"); // Beam me up, Scotty return phaser_delay/phaser_delta; } //------------------------------------------------------------------------------------------ // End phaser_rd //------------------------------------------------------------------------------------------
64eff0bbb9f497cef4521cc776a92d2b8b1b361c
587fad9076c0fabcd5d06db4d6ef0451f619cf44
/include/mul/matrixMul.hpp
c54bc15d82c7bbac7466424e6ac72ce9f53970e1
[]
no_license
bobo0892/cudaMatrix
07831639587ab0e96b44625c42489891cc62242c
08fcb1015982aa4ffdae5ec06f975328a1f40e72
refs/heads/master
2021-01-10T14:15:57.083015
2015-10-14T12:01:43
2015-10-14T12:01:43
44,231,789
0
0
null
null
null
null
UTF-8
C++
false
false
1,234
hpp
matrixMul.hpp
#ifndef _MATRIX_MUL_H_ #define _MATRIX_MUL_H_ #include "cuda_helper.hpp" // naive matrix multipy template <typename DataType> void matrix_mul_naive(int device, cudaStream_t stream, const size_t M, const size_t N, const size_t K, const DataType *__restrict__ A, const DataType *__restrict__ B, DataType *__restrict__ C, const DataType alpha, const DataType beta) ; // shared matrix multipy template <typename DataType> void matrix_mul_shared(int device, cudaStream_t stream, const size_t M, const size_t N, const size_t K, const DataType *__restrict__ A, const DataType *__restrict__ B, DataType *__restrict__ C, const DataType alpha, const DataType beta); template <typename DataType> void matrix_mul_4vector(int device, cudaStream_t stream, const size_t M, const size_t N, const size_t K, const DataType *__restrict__ A, const DataType *__restrict__ B, DataType *__restrict__ C, const DataType alpha, const DataType beta) ; template <typename DataType> void matrix_mul_32x8(int device, cudaStream_t stream, const size_t M, const size_t N, const size_t K, const DataType *__restrict__ A, const DataType *__restrict__ B, DataType *__restrict__ C, const DataType alpha, const DataType beta) ; #endif
698eb17aa070739f54db44e1438b4c87348ed980
57fae97888d4dcecc426f964eeea09e5f4a9426c
/include/ThermalDetonator.h
3e95690538105929102bef7c20ed7ecc81a1cc33
[]
no_license
MausTec/thermal-detonator-prop
d0dd03623981e87784529dc3ddf2b1ab6124e76b
6e59404489397eb9612355abe861ed1613ad8744
refs/heads/master
2023-02-01T12:23:56.378928
2020-12-19T01:44:13
2020-12-19T01:44:13
293,344,825
0
0
null
null
null
null
UTF-8
C++
false
false
2,491
h
ThermalDetonator.h
#ifndef __THERMAL_DETONATOR_h #define __THERMAL_DETONATOR_h #include <Arduino.h> #include <OneButton.h> #include "../config.h" #include "ThermalLights.h" #ifdef SD_AUDIO #include "ThermalSound.h" #endif #ifdef USE_WIRELESS #include "ThermalWireless.h" #endif /** * State Constants */ #define TD_IDLE 0 #define TD_STARTUP 1 #define TD_LOOP 2 #define TD_SHUTDOWN 3 #define TD_WX_PAIR 4 #define TD_BATTERY 5 /** * Core management class for the Thermal Detonator prop. * This class handles state information and transitions, but delegates other * control functions down to child classes. * * See: * - ThermalLights * - ThermalSound * - ThermalWireless * */ class ThermalDetonator { public: void init(); void tick(); /**** * State Machine Events */ void doLeverOpen(); void doLeverClose(); void doSinglePress(); void doDoublePress(); void doLongPress(); /** * Step through the lazy state machine, doing whatever is logically * the next correct thing to do. */ void nextState(); /** * Go forth unto thine startup sequence. Plays a sound and violently * flashes the enable button. This should happen when the lever opens. */ void goStartup(); /** * Arms the prop, playing the loop sound and stepping through the lumen * sequence. This should happen when the button is pushed. */ void goArm(); /** * Returns the prop to idle, playing the shutdown sound IF the prop was * previously armed. */ void goIdle(); #ifndef ATTINY /** * Plays an easter egg sound. If the prop was armed, this shuts it down * with a Moira voice line. If the prop was idle, this will drop some sick * beats, yo. */ void goEasterEgg(); /** * Displays the current battery level on the LEDs. */ void goBatteryLevel(); #endif /** * Halts program and outputs an error code on the Blinkenlights. * @param errorCode 4-bits only, plz. */ static void halt(uint8_t errorCode); /** * Step down the volume. */ void stepVolumeDown(); private: uint8_t state = TD_IDLE; ThermalLights Lights = ThermalLights(); #ifdef SD_AUDIO ThermalSound Sound = ThermalSound(); #endif #ifdef USE_WIRELESS ThermalWireless Wireless = ThermalWireless(); /** * Handles available data on the wireless receiver. */ void handleWireless(uint8_t data); #endif OneButton Enable; #ifdef MASTER_SW_PIN OneButton Lever; #endif }; extern ThermalDetonator TD; #endif
73752e32406e3ca53e80476acf99fa12b02f8084
ddb2870ac22217c7f58e02ecb9b4e12e06ac3034
/Client/Code/Loading.cpp
33e947b34252b16bdf51d6171638c9a25d6f04e5
[]
no_license
jw96118/Little-NightMare
b147159c4948cd9528882cad08e9c9c253e29d7d
7c56a4ceb0bf411f6bd4a10c2b834f3d262ba198
refs/heads/main
2023-07-04T09:37:46.257693
2021-08-16T04:29:28
2021-08-16T04:29:28
396,616,425
0
0
null
null
null
null
UHC
C++
false
false
7,001
cpp
Loading.cpp
#include "stdafx.h" #include "Loading.h" #define LOAD_MAX 28 CLoading::CLoading(LPDIRECT3DDEVICE9 pGraphicDev) : m_pGraphicDev(pGraphicDev) , m_bFinish(false) { ZeroMemory(m_szLoading, sizeof(_tchar) * 256); m_pGraphicDev->AddRef(); } CLoading::~CLoading(void) { } LOADINGID CLoading::Get_LoadingID(void) const { return m_eLoading; } CRITICAL_SECTION* CLoading::Get_Crt(void) { return &m_Crt; } _bool CLoading::Get_Finish(void) const { return m_bFinish; } const _tchar* CLoading::Get_LoadString(void) { return m_szLoading; } _uint CALLBACK CLoading::Thread_Main(void* pArg) { CLoading* pLoading = (CLoading*)pArg; _uint iFlag = 0; EnterCriticalSection(pLoading->Get_Crt()); switch (pLoading->Get_LoadingID()) { case LOADING_STAGE: iFlag = pLoading->Loading_ForStage(); break; case LOADING_BOSS: break; } LeaveCriticalSection(pLoading->Get_Crt()); _endthreadex(0); return iFlag; } HRESULT CLoading::Ready_Loading(LOADINGID eLoading) { InitializeCriticalSection(&m_Crt); m_hThread = (HANDLE)_beginthreadex(NULL, 0, Thread_Main, this, 0, NULL); m_eLoading = eLoading; return S_OK; } _uint CLoading::Loading_ForStage(void) { int i = 0; float temp = 100.f; //int i = 0; if (m_pLoadCount != nullptr) { // buffer FAILED_CHECK_RETURN(Engine::Ready_Buffer(m_pGraphicDev, RESOURCE_STATIC, L"Buffer_TerrainTex", Engine::BUFFER_TERRAINTEX, VTXCNTX, VTXCNTZ, VTXITV), E_FAIL); FAILED_CHECK_RETURN(Engine::Ready_Buffer(m_pGraphicDev, RESOURCE_STATIC, L"Buffer_TerrainCol", Engine::BUFFER_TERRAINCOL, VTXCNTX, VTXCNTZ, VTXITV), E_FAIL); FAILED_CHECK_RETURN(Engine::Ready_Buffer(m_pGraphicDev, RESOURCE_STATIC, L"Buffer_CubeTex", Engine::BUFFER_CUBETEX), E_FAIL); //lstrcpy(m_szLoading, L"Texture Loading............................."); // 텍스쳐 FAILED_CHECK_RETURN(Engine::Ready_Texture(m_pGraphicDev, RESOURCE_STAGE, L"Texture_Effect_Blood", Engine::TEX_NORMAL, L"../Bin/Resource/LittleNightMare/Resources/Textures/Blood/Blood_0%d.png", 32), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Texture(m_pGraphicDev, RESOURCE_STAGE, L"Texture_Effect_Fire", Engine::TEX_NORMAL, L"../Bin/Resource/LittleNightMare/Resources/Textures/Fire/TEX_LighterFlame.tga", 1), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, L"Mesh_Player", Engine::TYPE_DYNAMIC, L"../Bin/Resource/Mesh/DynamicMesh/Player/Six/", L"Six.X"), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, L"Mesh_Lighter", Engine::TYPE_DYNAMIC, L"../Bin/Resource/Mesh/DynamicMesh/Player_Lighter/", L"Lighter.X"), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, L"Mesh_LighterFrame", Engine::TYPE_STATIC, L"../Bin/Resource/Mesh/DynamicMesh/Player_LighterFlame/", L"LighterFlame.X"), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, L"Mesh_Leech", Engine::TYPE_DYNAMIC, L"../Bin/Resource/Mesh/DynamicMesh/Leech/", L"Leech.X"), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, L"Mesh_Janitor", Engine::TYPE_DYNAMIC, L"../Bin/Resource/Mesh/DynamicMesh/Janitor/", L"Janitor.X"), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, L"Mesh_Janitor_Arm", Engine::TYPE_DYNAMIC, L"../Bin/Resource/Mesh/DynamicMesh/Janitor_Arm/", L"Janitor_Arm.X"), E_FAIL); *m_pLoadCount += temp / LOAD_MAX; //lstrcpy(m_szLoading, L"Loading Complete!!!"); //lstrcpy(m_szLoading, L"스테이지 로딩............................."); vector<wstring> vecFolderList; Start_Load(Engine::TYPE_STATIC, vecFolderList, "../../Client/Bin/Resource/Mesh/StaticMesh/Stage", "../../Client/Bin/Resource/Mesh/StaticMesh/Stage/"); Start_Load(Engine::TYPE_STATIC, vecFolderList, "../../Client/Bin/Resource/Mesh/Object", "../../Client/Bin/Resource/Mesh/Object/"); FAILED_CHECK_RETURN(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STAGE, L"Mesh_Navi", Engine::TYPE_NAVI, NULL, NULL), E_FAIL); //lstrcpy(m_szLoading, L"로딩 끝............................."); m_bFinish = true; } return 0; } CLoading* CLoading::Create(LPDIRECT3DDEVICE9 pGraphicDev, LOADINGID eLoading, float* pLoadCount) { CLoading* pInstance = new CLoading(pGraphicDev); pInstance->m_pLoadCount = pLoadCount; if (FAILED(pInstance->Ready_Loading(eLoading))) Safe_Release(pInstance); return pInstance; } void CLoading::Free(void) { WaitForSingleObject(m_hThread, INFINITE); CloseHandle(m_hThread); DeleteCriticalSection(&m_Crt); Engine::Safe_Release(m_pGraphicDev); } void CLoading::GetfileList(string path, const char * option, vector<wstring>& filelist) { intptr_t h_file; char search_Path[100]; FILE_SEARCH file_search; sprintf_s(search_Path, option, path.c_str()); if ((h_file = _findfirst(search_Path, &file_search)) == -1L) { printf("No files in current directory!\n"); } else { while (true) { string tempstr = file_search.name; if (tempstr != "." && tempstr != "..") { wstring temp; temp.assign(tempstr.begin(), tempstr.end()); filelist.push_back(temp); } if (_findnext(h_file, &file_search) != 0) { break; } } _findclose(h_file); } } HRESULT CLoading::Load_Mesh(Engine::MESHTYPE meshType, string path, wstring filename) { wstring cFilePath; wstring cFileName; cFileName = filename.substr(0, filename.length() - 2); cFilePath.assign(path.begin(), path.end()); if (FAILED(Engine::Ready_Meshes(m_pGraphicDev, RESOURCE_STATIC, cFileName.c_str(), meshType, cFilePath.c_str(), filename.c_str()))) { return E_FAIL; } *m_pLoadCount += 100.f / LOAD_MAX; return S_OK; } HRESULT CLoading::Start_Load(Engine::MESHTYPE meshType, vector<wstring>& filelist, string path1, string path2) { vector<wstring> tempString; if (filelist.size() <= 0) { GetfileList(path1, "%s/*", filelist); } if (filelist.size() > 0) { for (int i = 0; i < filelist.size(); i++) { string tempPath; tempPath.assign(filelist[i].begin(), filelist[i].end()); string tempdynamic = tempPath; tempPath = path2 + tempPath + "/"; GetfileList(tempPath, "%s*.x", tempString); for (int j = 0; j < tempString.size(); j++) { if (tempdynamic.find("Dynamic") != string::npos) { if(FAILED(Load_Mesh(Engine::TYPE_DYNAMIC, tempPath, tempString[j]))) return E_FAIL; } else { if (FAILED(Load_Mesh(meshType, tempPath, tempString[j]))) { return E_FAIL; } } } tempString.clear(); } filelist.clear(); } }
fe0155e08e7bd170c9e1717e153aec02608af455
5ca24c9a1fb9b233242fad82fc8be29537629a6b
/placer.cpp
25bad546968afaa52c96d5e71bc6def208579003
[]
no_license
tunsanty/Placer-and-router-software-for-VLSI
45a65c4a8ed5ecd7a8b4c25b77c581d786c3e6e6
389a59d5088082b2a1d36408102d0da79ab61838
refs/heads/master
2022-05-31T07:44:06.875857
2020-05-01T09:44:57
2020-05-01T09:44:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,336
cpp
placer.cpp
#include <iostream> #include <fstream> #include <valarray> #include <vector> #include "solver.h" using namespace std; #define infname "../benchmarks/3QP/toy1" #define ofname "./outputs/placer_outputs/toy1" class Gate{ public : double x,y; int gate_id; Gate(int id){ gate_id=id; } vector<int> net_ids; }; int is_connected(Gate* a,Gate *b){ for(int i=0;i<a->net_ids.size();i++){ for(int j=0;j<b->net_ids.size();j++) if(a->net_ids[i]==b->net_ids[j]) return a->net_ids[i]; } return -1; } bool sortx(const Gate* a,const Gate* b){ return (100000*a->x+a->y)<(100000*b->x+b->y); } bool sorty(const Gate* a,const Gate* b){ return (100000*a->y+a->x)<(100000*b->y+b->x); } bool sortid(const Gate* a,const Gate* b){ return a->gate_id<b->gate_id; } void print_gates(vector<Gate*> gates){ for(auto g:gates) cout<<g->gate_id <<" "<<g->x<<" "<<g->y<<endl; } void quad_placement(vector<Gate*>& gates,double weigh[],vector<vector<int> > pad_net,vector<double> pad_x,vector<double> pad_y ){ int n=gates.size(); if(n==1)return; vector<int> vr; vector <int> vc; vector <double> vw; double div_arr[n]={0}; int pad_total=pad_net.size(); for(int i=0;i<n-1;i++){ for(int j=i+1;j<n;j++){ int ny=is_connected(gates[i],gates[j]); if(ny!=-1){ double div=weigh[ny]; vr.push_back(i); vc.push_back(j); vw.push_back(-div); vr.push_back(j); vc.push_back(i); vw.push_back(-div); div_arr[i]+=div; div_arr[j]+=div; } } } valarray<double> b_x(n),b_y(n); for(int j=0;j<n;j++){ for(auto nt: gates[j]->net_ids){ for(int i=0;i<pad_total;i++){ for(int o=0;o<pad_net[i].size();o++){ double div=weigh[pad_net[i][o]]; if(nt==pad_net[i][o]){ b_x[j]+=pad_x[i]*div; b_y[j]+=pad_y[i]*div; div_arr[j]+=div; // break; } } } } } for(int i=0;i<n;i++){ vr.push_back(i); vc.push_back(i); vw.push_back(div_arr[i]); } int ro[vr.size()]; int co[vc.size()]; double dao[vw.size()]; copy(vr.begin(),vr.end(),ro); copy(vc.begin(), vc.end(), co); copy(vw.begin(), vw.end(), dao); coo_matrix A; A.n= n; A.nnz= vr.size(); A.row.resize(A.nnz); A.col.resize(A.nnz); A.dat.resize(A.nnz); A.row = valarray<int>(ro, A.nnz); A.col = valarray<int>(co, A.nnz); A.dat = valarray<double>(dao, A.nnz); valarray <double> x_q1(A.n), y_q1(A.n); A.solve(b_x,x_q1); A.solve(b_y,y_q1); // print_valarray(A.dat); for(int i=0;i<n;i++){ if(x_q1[i]<0)x_q1[i]=0; if(y_q1[i]<0)y_q1[i]=0; gates[i]->x=x_q1[i]; gates[i]->y=y_q1[i]; } } void contain_x(vector<Gate*> gates,vector <vector <int> > pad_net, vector<double> pad_x,vector<double> pad_y,double x_min,double x_max){ for(int i=0;i<gates.size();i++){ pad_net.push_back(gates[i]->net_ids); pad_x.push_back(gates[i]->x); pad_y.push_back(gates[i]->y); } int n=pad_net.size(); for(int i=0;i<n;i++){ if(pad_x[i]>x_max) pad_x[i]=x_max; if(pad_x[i]<x_min) pad_x[i]=x_min; } } void contain_y(vector<Gate*> gates,vector <vector <int> > pad_net, vector<double> pad_x,vector<double> pad_y,double y_min,double y_max){ for(int i=0;i<gates.size();i++){ pad_net.push_back(gates[i]->net_ids); pad_x.push_back(gates[i]->x); pad_y.push_back(gates[i]->y); } int n=pad_net.size(); for(int i=0;i<n;i++){ if(pad_y[i]>y_max) pad_y[i]=y_max; if(pad_y[i]<y_min) pad_y[i]=y_min; } } void quad_placement_nxn(vector<Gate*> gates,double weigh[],vector<vector<int> > pad_net,vector<double> pad_x,vector<double> pad_y,double x_min,double x_max,double y_min,double y_max,int n){ // Horizontal Assignment if((n&n-1)){ cout<<"n is not a power of 2"; return; } if(n==1||gates.size()<=1) return; int m=gates.size(); sort(gates.begin(),gates.end(),sortx); vector<Gate *> l_gates(gates.begin(),gates.begin()+1+(m-1)/2); vector<Gate *> r_gates(gates.begin()+(m-1)/2+1,gates.end()); // Containment vector<vector<int> > l_pad_net(pad_net),r_pad_net(pad_net); vector<double> l_pad_x(pad_x),r_pad_x(pad_x); vector<double> l_pad_y(pad_y),r_pad_y(pad_x); contain_x(r_gates,l_pad_net,l_pad_x,l_pad_y,x_min,x_max); contain_x(l_gates,r_pad_net,r_pad_x,r_pad_y,x_min,x_max); // 2 QP quad_placement(l_gates,weigh,l_pad_net,l_pad_x,l_pad_y); print_gates(l_gates); cout<<endl; // 3 QP quad_placement(r_gates,weigh,r_pad_net,r_pad_x,r_pad_y); print_gates(r_gates); cout<<endl; // Vertical Assigment 1 // Left Assignment m=l_gates.size(); sort(l_gates.begin(),l_gates.end(),sorty); vector<Gate *> ld_gates(l_gates.begin(),l_gates.begin()+1+(m-1)/2); vector<Gate *> lu_gates(l_gates.begin()+(m-1)/2+1,l_gates.end()); // L Up Down Containment vector<vector<int> > ld_pad_net(l_pad_net),lu_pad_net(l_pad_net); vector<double> ld_pad_x(l_pad_x),lu_pad_x(l_pad_x); vector<double> ld_pad_y(l_pad_y),lu_pad_y(l_pad_x); contain_y(lu_gates,ld_pad_net,ld_pad_x,ld_pad_y,y_min,y_max); contain_y(ld_gates,lu_pad_net,lu_pad_x,lu_pad_y,y_min,y_max); // 2 QP quad_placement(ld_gates,weigh,ld_pad_net,ld_pad_x,ld_pad_y); print_gates(ld_gates); cout<<endl; // 3 QP quad_placement(lu_gates,weigh,lu_pad_net,lu_pad_x,lu_pad_y); print_gates(lu_gates); cout<<endl; // Vertical Assigment 2 // Right Assignment m=r_gates.size(); sort(r_gates.begin(),r_gates.end(),sorty); vector<Gate *> rd_gates(r_gates.begin(),r_gates.begin()+1+(m-1)/2); vector<Gate *> ru_gates(r_gates.begin()+(m-1)/2+1,r_gates.end()); // R Up Down Containment vector<vector<int> > rd_pad_net(r_pad_net),ru_pad_net(r_pad_net); vector<double> rd_pad_x(r_pad_x),ru_pad_x(r_pad_x); vector<double> rd_pad_y(r_pad_y),ru_pad_y(r_pad_x); contain_y(ru_gates,rd_pad_net,rd_pad_x,rd_pad_y,y_min,y_max); contain_y(rd_gates,ru_pad_net,ru_pad_x,ru_pad_y,y_min,y_max); // 2 QP quad_placement(rd_gates,weigh,rd_pad_net,rd_pad_x,rd_pad_y); print_gates(rd_gates); cout<<endl; // 3 QP quad_placement(ru_gates,weigh,ru_pad_net,ru_pad_x,ru_pad_y); print_gates(ru_gates); cout<<endl; double x_mid=(x_min+x_max)/2; double y_mid=(y_min+y_max)/2; quad_placement_nxn(lu_gates,weigh,lu_pad_net,lu_pad_x,lu_pad_y,x_min,x_mid,y_mid,y_max,n/2); quad_placement_nxn(ld_gates,weigh,ld_pad_net,ld_pad_x,ld_pad_y,x_min,x_mid,y_min,y_mid,n/2); quad_placement_nxn(ru_gates,weigh,ru_pad_net,ru_pad_x,ru_pad_y,x_mid,x_max,y_mid,y_max,n/2); quad_placement_nxn(rd_gates,weigh,rd_pad_net,rd_pad_x,rd_pad_y,x_mid,x_max,y_min,y_mid,n/2); } int main(){ ifstream fin(infname); if(!fin.is_open()){ cout<<"Unable to open File"<<endl; return -1; } int n,nnz,gate_no,net_no,n_id; int pad_id,pad_total; // Number of gates , Number of nets fin >> n >>nnz; vector < vector<Gate*> > nets(nnz+1);// list of nets vector <Gate*> gates; //Input format Gate number #nets Net numbers for (int j=0;j<n;j++){ //Gate number, TOTAL nets -> List of nets fin >> gate_no >>net_no; Gate* tmp =new Gate(gate_no); gates.push_back(tmp); for (int i=0;i<net_no ;i++){ fin >> n_id;//net number k nets[n_id].push_back(tmp); tmp->net_ids.push_back(n_id); } } fin>> pad_total ; bool pad_present[nnz+1]={0}; vector<vector <int> > pad_net(pad_total,vector<int>(1)); vector<double> pad_x(pad_total),pad_y(pad_total); for (int pad_i=0 ; pad_i<pad_total; pad_i++){ fin >> pad_id; fin >> pad_net[pad_id-1][0] >> pad_x[pad_id-1] >> pad_y[pad_id-1]; pad_present[pad_net[pad_id-1][0]]=true; } fin.close(); double weigh[nnz+1]; for(int i=1;i<=nnz;i++){ weigh[i]=(pad_present[i])?1.0/nets[i].size():1.0/(nets[i].size()-1); } // 1 Qudratic Placement quad_placement(gates,weigh,pad_net,pad_x,pad_y); print_gates(gates); cout<<endl; quad_placement_nxn(gates,weigh,pad_net,pad_x,pad_y,0,100,0,100,2); // Print output to a file sort(gates.begin(),gates.end(),sortid); ofstream fout(ofname); fout<< n <<endl; for(int i=0;i<n;i++){ fout<< gates[i]->gate_id <<" "<< gates[i]->x <<" "<<gates[i]->y <<endl ; } return 0; }
90096b42733bd0d6f2b84acda012ef2c5310a302
25bc2b60aa6bbb5abbc862ec3cc9f9b6226e564f
/joint_mapping-master-9f5a96103477f48c4abcca0a7157f4201f62c4cd/include/joint_mapping/Matcher3D.h
cfef566b9f6d3651f412635ecb814c719cd4ec99
[]
no_license
jaehobang/drone_tragectory_display
b0043d2eee4f918cbc5dc74fe798823a3c70337c
1988021c4d4fbd062ac26d63a8dbf911d055e699
refs/heads/master
2021-01-20T21:13:11.719462
2016-07-18T20:33:18
2016-07-18T20:33:18
63,634,301
1
0
null
null
null
null
UTF-8
C++
false
false
11,187
h
Matcher3D.h
#ifndef MATCHER #define MATCHER #include <ros/ros.h> #include <sensor_msgs/PointCloud2.h> #include <geometry_msgs/PoseStamped.h> #include <geometry_msgs/PoseWithCovarianceStamped.h> #include <parameter_utils/ParameterUtils.h> //#include <sensor_msgs/point_cloud_conversion.h> #include <pcl_conversions/pcl_conversions.h> #include <pcl_ros/point_cloud.h> #include <pcl_ros/transforms.h> #include <pcl/conversions.h> #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl/kdtree/kdtree_flann.h> #include <flann/flann.hpp> #include <pcl/features/normal_3d.h> #include <pcl/features/pfh.h> #include <pcl/features/fpfh.h> #include <pcl/keypoints/sift_keypoint.h> #include <pcl/keypoints/iss_3d.h> #include <pcl/registration/transforms.h> #include <pcl/registration/icp.h> #include <pcl/registration/sample_consensus_prerejective.h> #include <pcl/segmentation/sac_segmentation.h> #include <pcl/filters/crop_box.h> #include <boost/shared_ptr.hpp> #include <boost/pointer_cast.hpp> #include <joint_mapping/Agent_Definitions.h> #include <gtsam/nonlinear/NonlinearFactorGraph.h> #include <gtsam/geometry/Pose3.h> #include <joint_mapping/Logger.h> #include <joint_mapping/Matcher2D.h> namespace comap { typedef pcl::PointXYZ PointT; typedef pcl::PointXYZI PointI; typedef pcl::PointXYZRGBA PointCT; typedef pcl::PointNormal PointNT; typedef pcl::PointWithScale PointWST; typedef pcl::PointCloud<PointT> PointCloudT; typedef pcl::PointCloud<PointI> PointCloudI; typedef pcl::PointCloud<PointNT> PointCloudNT; typedef pcl::PointCloud<PointCT> PointCloudCT; typedef pcl::PointCloud<PointWST> PointCloudWST; //typedef pcl::FPFHSignature125 FeatureT; //typedef pcl::FPFHEstimationOMP<PointNT,PointNT,FeatureT> FeatureEstimationT; typedef pcl::PFHSignature125 FeatureT; typedef pcl::FPFHSignature33 FastFeatureT; typedef pcl::PFHEstimation<PointT,PointNT,FeatureT> FeatureEstimationT; typedef pcl::PointCloud<FeatureT> FeatureCloudT; typedef pcl::PointCloud<FastFeatureT> FastFeatureCloudT; struct Matcher3DSetting { // PCL filter parameters float voxel_grid_leaf_size; float match_grid_leaf_size; float normal_radius; float min_scale; int n_octaves; int n_scales_per_octave; float min_contrast; float feature_radius; int max_iterations; int feature_max_iterations; int n_samples; int correspondence_rand; float sim_threshold; float max_correspondence_dist; float feature_max_correspondence_dist; float inlier_fraction; float flann_radius; float support_radius; float nms_radius; float min_sample_distance; float convergence_threshold; float error_threshold; bool visualize_scan_matching; bool feature_align; std::string world_frame; size_t tree_nr; size_t min_cache_size; size_t K; float z_range; size_t peak_threshold; bool sensor_inverted; // Used in pass through filter to limit size of scan Eigen::Vector4f max_pt; Eigen::Vector4f min_pt; Eigen::Vector4f max_pt_slice; Eigen::Vector4f min_pt_slice; Eigen::Vector4f max_pt_col; Eigen::Vector4f min_pt_col; }; struct LoopResult { // if scan_idx = -1, match didn't work bool success; size_t scan_idx; gtsam::Pose3 delta_pose; }; struct PCLPointCloudStamped { std_msgs::Header header; PointCloudT points; }; // Wrapper class that class Matcher3D { private: size_t trained_scan_count_; // Maps from pose_count_ to filtered/down-sampled point cloud std::map<size_t, sensor_msgs::PointCloud2> local_scan_cache_; std::map<size_t, PointCloudT::Ptr> local_pcl_cache_; std::map<size_t, PointCloudNT::Ptr> local_normals_cache_; std::map<size_t, PointCloudWST::Ptr> local_keypoints_cache_; std::map<size_t, FeatureCloudT::Ptr> local_descriptors_cache_; std::vector<size_t> point_to_idx_; std::vector<size_t> scan_idx_; std::map<size_t, PoseD> pose_cache_; Eigen::Affine3f base_to_sensor; std::string robot_name_; typedef flann::Index<flann::L2<float> > MatcherType; typedef boost::shared_ptr<MatcherType> MatcherType_Ptr; typedef boost::shared_ptr<const MatcherType> MatcherType_ConstPtr; bool flann_init_; MatcherType_Ptr pmatcher_; // FeatureCloudT::Ptr feature_cloud_; std::vector<size_t> point_idx_to_pose_count_; //geometry_msgs::PoseWithCovarianceStamped::ConstPtr getIncrementalEstimate(); //geometry_msgs::PoseStamped::ConstPtr getIntegratedEstimate(); // Supply these PCL wrappers publicly; this class can be used for its utilities as well void voxelGridDownsample(const PointCloudT::Ptr& in, PointCloudT::Ptr& out, float leaf_size); void twoDSlice(PointCloudT::Ptr in, PointCloudT::Ptr out); void computeSurfaceNormals(const PointCloudT::Ptr& in, PointCloudNT::Ptr& out); void detectKeyPoints(const PointCloudT::Ptr& in, const PointCloudNT::Ptr& normals, PointCloudWST::Ptr& out); void detectKeyPoints(const PointCloudI::Ptr& in, PointCloudI::Ptr& out); void detectISSKeyPoints(const PointCloudT::Ptr& in, const PointCloudI::Ptr& out); void computePFHFeatures(const PointCloudT::Ptr& in_surface, const PointCloudT::Ptr& in_points, const PointCloudNT::Ptr& in_normals, FeatureCloudT::Ptr& out_descriptors); void computeFPFHFeatures(const PointCloudT::Ptr& in_surface, const PointCloudT::Ptr& in_points, const PointCloudNT::Ptr& in_normals, const FastFeatureCloudT::Ptr& out_descriptors); void findFeatureCorrespondences(const FeatureCloudT::Ptr& source_descriptors, const FeatureCloudT::Ptr& target_descriptors, std::vector<int>& correspondences_out, std::vector<float>& correspondence_scores_out); void computeFPFHFeaturePoints(PointCloudT::Ptr downsampled_in, PointCloudWST::Ptr keypoints_out, FastFeatureCloudT::Ptr descriptors_out); void computePFHFeaturePoints(PointCloudT::Ptr downsampled_in, PointCloudNT::Ptr normals_out, PointCloudWST::Ptr keypoints_out, FeatureCloudT::Ptr descriptors_out); bool findGICPTransform(const PointCloudT::Ptr& input, const PointCloudT::Ptr& target, const PointCloudT::Ptr& aligned, Eigen::Matrix4f& final_transform); LoopResult consensusRegistration(const PointCloudT::Ptr& target_points, const PointCloudT::Ptr& reference_points, const PointCloudWST::Ptr& source_keypoints, const PointCloudWST::Ptr& target_keypoints, const FeatureCloudT::Ptr& target_descriptors, const FeatureCloudT::Ptr& reference_descriptors); void cropBox(const PointCloudT::Ptr in, const PointCloudT::Ptr out, Eigen::Vector4f min_pt, Eigen::Vector4f max_pt); std::vector<size_t> getPotentialMatches(std::vector<unsigned int> query_result_hist, size_t search_size); flann::Matrix<float> transDescriptors2Matrix(FeatureCloudT::Ptr descriptors); std_msgs::Header getDownsampledFromROS(const sensor_msgs::PointCloud2& scan_cloud, PointCloudT::Ptr downsampled); void ROSToPCL(const sensor_msgs::PointCloud2& in, PCLPointCloudStamped& out); void PCLToROS(const PointCloudT& in, std_msgs::Header header, sensor_msgs::PointCloud2& out); /* geometry_msgs::PoseWithCovarianceStamped::Ptr incremental_estimate; geometry_msgs::PoseStamped::Ptr integrated_estimate; std::string name; bool cloud_set; */ public: Matcher3D(); ~Matcher3D(){} Matcher3DSetting setting_; Matcher2D::Ptr matcher2d_; Matcher3D(Matcher3DSetting setting, std::string name) : setting_(setting), trained_scan_count_(0), flann_init_(false), pmatcher_(), robot_name_(name){ base_to_sensor = Eigen::Affine3f::Identity(); float pitch = 0; if (setting.sensor_inverted) pitch = 1.5707; base_to_sensor.rotate (Eigen::AngleAxisf (pitch, Eigen::Vector3f::UnitY())); } void initialize(Matcher3DSetting setting, std::string name, const PointMatcherSetting icp_config, const LoopClosureDetectorSetting loop_detect_setting, const LoopClosureMatcherSetting loop_match_setting) { setting_ = setting; trained_scan_count_ = 0; flann_init_ = false; robot_name_ = name; matcher2d_ = boost::shared_ptr<Matcher2D>(new Matcher2D(icp_config, loop_detect_setting, loop_match_setting, setting.min_cache_size)); } /* Meant for local scans (these are the keyframes essentially) 1. Decompose scan into keypoints and descriptors 2. Store descriptors into octree for fast search later on */ sensor_msgs::PointCloud2::Ptr addLocalScan(sensor_msgs::PointCloud2& scan, PoseD pose, size_t pose_count); sensor_msgs::PointCloud2::Ptr addLocalScan2D(sensor_msgs::PointCloud2& scan, PoseD pose, size_t pose_count); /* Given scan from foreign agent (or new local scan) 1. Decompose into key points and descriptors for those points 2. Search in octree for k nearest scans for each keypoint -> histogram 3. Pick scan at peaks of histogram and try align with those scans 4. Return the index of the scan query matched with and the relative pose between them. */ std::vector<LoopResult> findLoopClosure(sensor_msgs::PointCloud2 query, std::string foreign_name, size_t foreign_pose_count); std::vector<LoopResult> findLoopClosure2D(sensor_msgs::PointCloud2 query, std::string foreign_name, size_t foreign_pose_count, PoseD foreign_pose); size_t get_num_trained_scan() { return trained_scan_count_; } sensor_msgs::PointCloud2 crop_z( sensor_msgs::PointCloud2& scan, PoseD pose ); sensor_msgs::PointCloud2 project( sensor_msgs::PointCloud2& scan, PoseD robot_pose, PoseD relative_pose); gtsam::NonlinearFactorGraph findLocalLoopClosure( const PoseD slam_pose, comap::Scan& scan); }; typedef Matcher3D Matcher; } #endif
96afa966920a4014ee6f4cfa1813d44d0a0c51f4
c5843992e233b92e90b53bd8a90a9e68bfc1f6d6
/code/msvis/MSVis/GroupWorker.h
9a213d48be9cb4477604fd9b15e5007ef0f55ec5
[]
no_license
pkgw/casa
17662807d3f9b5c6b57bf3e36de3b804e202c8d3
0f676fa7b080a9815a0b57567fd4e16cfb69782d
refs/heads/master
2021-09-25T18:06:54.510905
2017-08-16T21:53:54
2017-08-16T21:53:54
100,752,745
2
1
null
2020-02-24T18:50:59
2017-08-18T21:51:10
C++
UTF-8
C++
false
false
6,691
h
GroupWorker.h
//# GroupWorker.h: Base classes for objects that process VisBuffGroups //# as fed to them by GroupProcessor. //# Copyright (C) 2011 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library 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 Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# #ifndef MSVIS_GROUPWORKER_H #define MSVIS_GROUPWORKER_H #include <casa/aips.h> #include <ms/MeasurementSets/MeasurementSet.h> #include <ms/MeasurementSets/MSColumns.h> #include <msvis/MSVis/VisibilityIterator.h> #include <msvis/MSVis/VisBufferComponents.h> #include <msvis/MSVis/VBRemapper.h> namespace casa { //# NAMESPACE CASA - BEGIN //# forward decl class VisBuffGroup; //<summary>Abstract base class for GroupWorkers</summary> // // <use visibility=export> // // <reviewed reviewer="" date="" tests="" demos=""> // <prerequisite> // <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto> // <li> <linkto class="GroupProcessor">GroupProcessor</linkto> // </prerequisite> // // <etymology> // A GroupWorker works on VisBuffGroups. // </etymology> // //<synopsis> // This class cannot be directly used, but it defines an interface so that its // derived classes may be called by // <linkto class="GroupProcessor">GroupProcessor</linkto>. // // The interface used by GroupProcessor is process(VisBuffGroup&), which // derived classes would define to use or process the given VisBuffGroup. // Any information that process(VisBuffGroup&) needs which is not included // in the VisBuffGroup must be given to the derived class before c'ting the // GroupProcessor. //</synopsis> // //<todo> // <li> //</todo> class GroupWorkerBase { public: // Create empty GroupWorkerBase you can assign to or attach. GroupWorkerBase() {} //// Copy construct //GroupWorkerBase(const GroupWorkerBase& other) {} // Destructor virtual ~GroupWorkerBase() {} //// Assignment //virtual GroupWorkerBase& operator=(const GroupWorkerBase& gw) {} // // Returns which columns need to be prefetched for process to work. virtual const asyncio::PrefetchColumns *prefetchColumns() const; // This is where all the work gets done! virtual casacore::Bool process(VisBuffGroup& vbg) = 0; protected: asyncio::PrefetchColumns prefetchColumns_p; }; //<summary>ROGroupWorkers process VisBuffGroups without modifying the input casacore::MS(es)</summary> // // <use visibility=export> // // <reviewed reviewer="" date="" tests="" demos=""> // <prerequisite> // <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto> // <li> <linkto class="GroupProcessor">GroupProcessor</linkto> // </prerequisite> // // <etymology> // ROGroupWorker works on VisBuffGroups and is readonly W.R.T. the input casacore::MS(es). // </etymology> // //<synopsis> // This class cannot be directly used, but it defines an interface so that its // derived classes may be called by // <linkto class="GroupProcessor">GroupProcessor</linkto>. // // Essentially an alias for GroupWorkerBase, since it is also RO. //</synopsis> // //<todo> // <li> //</todo> class ROGroupWorker : public GroupWorkerBase { }; //<summary>A base class for GroupWorkers that can modify their input MS.</summary> // // <use visibility=export> // // <reviewed reviewer="" date="" tests="" demos=""> // <prerequisite> // <li> <linkto class="ROGroupWorker">ROGroupWorker</linkto> // </prerequisite> // // <etymology> // Its derived classes work on VisBuffGroups. // </etymology> // //<synopsis> // This class cannot be directly used, but it provides a starting point for // derived GroupWorkers. //</synopsis> // //<todo> // <li> //</todo> class GroupWorker : public GroupWorkerBase { public: GroupWorker(const ROVisibilityIterator& invi); //// Copy construct //GroupWorker(const GroupWorker& gw) {} // Destructor virtual ~GroupWorker() {} //// Assignment //virtual GroupWorker& operator=(const GroupWorker& gw) {} protected: ROVisibilityIterator invi_p; VisibilityIterator outvi_p; private: // Disable default c'tor. GroupWorker() {} }; //<summary>A base class for ROGroupWorkers that write to a new MS.</summary> // // <use visibility=export> // // <reviewed reviewer="" date="" tests="" demos=""> // <prerequisite> // <li> <linkto class="ROGroupWorker">ROGroupWorker</linkto> // </prerequisite> // // <etymology> // Its derived classes are ROGroupWorkers that write to a new MS. // </etymology> // //<synopsis> // This class cannot be directly used, but it provides a starting point for // derived ROGroupWorkers that write to a new MS. //</synopsis> // //<todo> // <li> //</todo> class GroupWriteToNewMS : public GroupWorkerBase { public: GroupWriteToNewMS(casacore::MeasurementSet& outms, casacore::MSColumns *msc, const VBRemapper& remapper); //GroupWriteToNewMS(GroupWriteToNewMS& other); virtual ~GroupWriteToNewMS() {} // Writes vb to outms/msc, and returns the number of rows in outms afterwards. // vb's ID columns may be remapped by remapper. // rowsdone: How many rows have been done so far. // doFC: do FLAG_CATEGORY? // doFloat: do FLOAT_DATA? // doSpWeight: do WEIGHT_SPECTRUM? static casacore::uInt write(casacore::MeasurementSet& outms, casacore::MSColumns *msc, VisBuffer& vb, casacore::uInt rowsdone, const VBRemapper& remapper, const casacore::Bool doFC, const casacore::Bool doFloat, const casacore::Bool doSpWeight); protected: casacore::MeasurementSet outms_p; casacore::MSColumns *msc_p; VBRemapper remapper_p; casacore::uInt rowsdone_p; // how many rows have been written. private: // Disable default construction. GroupWriteToNewMS(); }; } //# NAMESPACE CASA - END #endif
0164f31ef5fb9d8f9a5c87a1dae4343c73aaecfc
4afc6182476e8e381ea0913f7b1205edf384a029
/.build/iOS-Debug/include/app/Uno.Collections.Dictionary__char__Uno_Content_Fonts_RenderedGlyph.h
b2714db464bb3cc484cf2eeb50cb23d6410a1958
[]
no_license
noircynical/soscon_demoproject
45a4b5594582447001c2895e24cf2e6566095a63
aab19822fb8bc46715e6b41ac785faf7a128d9e7
refs/heads/master
2021-01-10T05:41:33.994651
2015-10-28T04:27:43
2015-10-28T04:27:43
45,085,497
0
0
null
null
null
null
UTF-8
C++
false
false
3,491
h
Uno.Collections.Dictionary__char__Uno_Content_Fonts_RenderedGlyph.h
// This file was generated based on '/usr/local/share/uno/Packages/UnoCore/0.13.2/Source/Uno/Collections/$.uno'. // WARNING: Changes might be lost if you edit this file directly. #ifndef __APP_UNO_COLLECTIONS_DICTIONARY__CHAR__UNO_CONTENT_FONTS_RENDERED_GLYPH_H__ #define __APP_UNO_COLLECTIONS_DICTIONARY__CHAR__UNO_CONTENT_FONTS_RENDERED_GLYPH_H__ #include <app/Uno.Collections.Dictionary2_Bucket__char__Uno_Content_Fonts_Ren-26fd1cb9.h> #include <app/Uno.Object.h> #include <Uno.h> namespace app { namespace Uno { namespace Collections { struct Dictionary2_Enumerator__char__Uno_Content_Fonts_RenderedGlyph; } } } namespace app { namespace Uno { namespace Content { namespace Fonts { struct RenderedGlyph; } } } } namespace app { namespace Uno { namespace Collections { struct Dictionary__char__Uno_Content_Fonts_RenderedGlyph; struct Dictionary__char__Uno_Content_Fonts_RenderedGlyph__uType : ::uClassType { }; Dictionary__char__Uno_Content_Fonts_RenderedGlyph__uType* Dictionary__char__Uno_Content_Fonts_RenderedGlyph__typeof(); void Dictionary__char__Uno_Content_Fonts_RenderedGlyph___ObjInit_1(Dictionary__char__Uno_Content_Fonts_RenderedGlyph* __this); void Dictionary__char__Uno_Content_Fonts_RenderedGlyph__Add(Dictionary__char__Uno_Content_Fonts_RenderedGlyph* __this, ::uChar key, ::app::Uno::Content::Fonts::RenderedGlyph value); bool Dictionary__char__Uno_Content_Fonts_RenderedGlyph__ContainsKey(Dictionary__char__Uno_Content_Fonts_RenderedGlyph* __this, ::uChar key); int Dictionary__char__Uno_Content_Fonts_RenderedGlyph__get_Count(Dictionary__char__Uno_Content_Fonts_RenderedGlyph* __this); ::app::Uno::Collections::Dictionary2_Enumerator__char__Uno_Content_Fonts_RenderedGlyph Dictionary__char__Uno_Content_Fonts_RenderedGlyph__GetEnumerator(Dictionary__char__Uno_Content_Fonts_RenderedGlyph* __this); Dictionary__char__Uno_Content_Fonts_RenderedGlyph* Dictionary__char__Uno_Content_Fonts_RenderedGlyph__New_1(::uStatic* __this); void Dictionary__char__Uno_Content_Fonts_RenderedGlyph__Rehash(Dictionary__char__Uno_Content_Fonts_RenderedGlyph* __this); struct Dictionary__char__Uno_Content_Fonts_RenderedGlyph : ::uObject { int _count; int _dummies; ::uStrong< ::uArray*> _buckets; int _version; void _ObjInit_1() { Dictionary__char__Uno_Content_Fonts_RenderedGlyph___ObjInit_1(this); } void Add(::uChar key, ::app::Uno::Content::Fonts::RenderedGlyph value); bool ContainsKey(::uChar key) { return Dictionary__char__Uno_Content_Fonts_RenderedGlyph__ContainsKey(this, key); } int Count() { return Dictionary__char__Uno_Content_Fonts_RenderedGlyph__get_Count(this); } ::app::Uno::Collections::Dictionary2_Enumerator__char__Uno_Content_Fonts_RenderedGlyph GetEnumerator(); void Rehash() { Dictionary__char__Uno_Content_Fonts_RenderedGlyph__Rehash(this); } }; }}} #include <app/Uno.Collections.Dictionary2_Enumerator__char__Uno_Content_Fonts-4ed8c79f.h> #include <app/Uno.Content.Fonts.RenderedGlyph.h> namespace app { namespace Uno { namespace Collections { inline void Dictionary__char__Uno_Content_Fonts_RenderedGlyph::Add(::uChar key, ::app::Uno::Content::Fonts::RenderedGlyph value) { Dictionary__char__Uno_Content_Fonts_RenderedGlyph__Add(this, key, value); } inline ::app::Uno::Collections::Dictionary2_Enumerator__char__Uno_Content_Fonts_RenderedGlyph Dictionary__char__Uno_Content_Fonts_RenderedGlyph::GetEnumerator() { return Dictionary__char__Uno_Content_Fonts_RenderedGlyph__GetEnumerator(this); } }}} #endif
e452699d4fe9080a40363965fa4cbbcdc918b1aa
9c9735d9c101289db966c6a1879b5a38e17b3f9e
/test/TestRef.cpp
ffffb41276c0fe47249dee7ec39269e2caaabf4f
[ "MIT" ]
permissive
gidapataki/serial
592f3f324977ba6d5c9a2356ea883c8909749b5b
27e9d8d9432f545e4b0e73ee6d5cf43333dba733
refs/heads/master
2020-04-24T12:45:02.983224
2019-04-16T13:53:01
2019-04-16T13:53:01
171,965,372
0
0
null
null
null
null
UTF-8
C++
false
false
3,413
cpp
TestRef.cpp
#include "gtest/gtest.h" #include "serial/Ref.h" #include "serial/Referable.h" using namespace serial; namespace { struct A : Referable<A> { int value = 5; static constexpr auto kTypeName = "a"; template<typename S, typename V> static void AcceptVisitor(S&, V&) {} }; struct B : Referable<B> { std::string value = "hello"; static constexpr auto kTypeName = "b"; template<typename S, typename V> static void AcceptVisitor(S&, V&) {} }; struct C : Referable<C> { static constexpr auto kTypeName = "c"; template<typename S, typename V> static void AcceptVisitor(S&, V&) {} }; } // namespace TEST(RefTest, Ctor) { A a; B b; Ref<A> ref1; Ref<A> ref2(nullptr); Ref<A> ref3(&a); EXPECT_EQ(nullptr, ref1.Get()); EXPECT_EQ(nullptr, ref2.Get()); EXPECT_EQ(&a, ref3.Get()); const auto& ref4 = ref3; EXPECT_EQ(&a, ref4.Get()); Ref<A, B> ref5(&b); Ref<A, B> ref6(ref5); EXPECT_EQ(&b, ref5.Get()); EXPECT_EQ(&b, ref6.Get()); Ref<A, B> ref7(std::move(ref6)); EXPECT_EQ(&b, ref7.Get()); } TEST(RefTest, Assign) { A a; B b; Ref<A, B> ref1; Ref<A, B> ref2; ref1 = &a; ref2 = &b; EXPECT_EQ(&a, ref1.Get()); EXPECT_EQ(&b, ref2.Get()); ref1 = nullptr; EXPECT_EQ(nullptr, ref1.Get()); ref1 = ref2; EXPECT_EQ(&b, ref1.Get()); } TEST(RefTest, Eq) { A a; B b; Ref<A, B> ref0; Ref<A, B> ref1; Ref<A, B> ref2(&b); EXPECT_FALSE(ref1); EXPECT_TRUE(ref2); EXPECT_TRUE(ref0 == ref1); EXPECT_FALSE(ref0 == ref2); EXPECT_FALSE(ref1 == ref2); EXPECT_FALSE(ref0 != ref1); ref1 = &b; EXPECT_TRUE(ref1 == ref2); EXPECT_FALSE(ref1 != ref2); EXPECT_TRUE(ref0 != ref1); ref1 = &a; EXPECT_FALSE(ref1 == ref2); } TEST(RefTest, IsAs) { A a; B b; Ref<A, B> ref1; Ref<A, B> ref2; EXPECT_FALSE(ref1.Is<A>()); EXPECT_FALSE(ref2.Is<A>()); ref1 = &a; ref2 = &b; EXPECT_TRUE(ref1.Is<A>()); EXPECT_FALSE(ref2.Is<A>()); EXPECT_FALSE(ref1.Is<B>()); EXPECT_TRUE(ref2.Is<B>()); EXPECT_EQ(&a, &ref1.As<A>()); EXPECT_EQ(&b, &ref2.As<B>()); const Ref<A, B> ref3 = ref2; const Ref<A, B> ref4 = ref1; EXPECT_EQ(&b, &ref3.As<B>()); EXPECT_EQ(&a, &ref4.As<A>()); } TEST(RefTest, Resolve) { A a; B b; C c; Ref<A, B> ref1; EXPECT_FALSE(ref1.Resolve(0, nullptr)); EXPECT_FALSE(ref1.Resolve(0, &c)); EXPECT_EQ(nullptr, ref1.Get()); EXPECT_TRUE(ref1.Resolve(0, &a)); EXPECT_EQ(&a, ref1.Get()); EXPECT_FALSE(ref1.Resolve(0, &c)); EXPECT_EQ(&a, ref1.Get()); EXPECT_FALSE(ref1.Resolve(0, nullptr)); EXPECT_EQ(&a, ref1.Get()); } TEST(RefTest, WhichIndex) { A a; B b; C c; using Rx = Ref<A, B, C>; Rx ref; EXPECT_EQ(Rx::Index(-1), ref.Which()); ref = &a; EXPECT_EQ(Rx::IndexOf<A>(), ref.Which()); EXPECT_NE(Rx::Index(-1), ref.Which()); int count = 0; switch(ref.Which()) { case Rx::IndexOf<B>(): count |= 1; break; case Rx::IndexOf<C>(): count |= 2; break; default: count |= 4; break; } EXPECT_EQ(4, count); ref = nullptr; EXPECT_EQ(Rx::Index(-1), ref.Which()); ref = &b; EXPECT_EQ(Rx::IndexOf<B>(), ref.Which()); ref = &c; EXPECT_EQ(Rx::IndexOf<C>(), ref.Which()); } TEST(RefTest, SingleType) { A a; Ref<A> ref; const auto& cref = ref; ref = &a; ref->value = 13; EXPECT_EQ(13, cref->value); EXPECT_EQ(13, (*ref).value); EXPECT_EQ(13, (*cref).value); } TEST(RefTest, From) { A a; A* ptr = &a; const A* cptr = &a; Ref<A, B, C> ref = Ref<A, B, C>::From(ptr); const Ref<A, B, C> cref = Ref<A, B, C>::From(cptr); }
0833601c258b6f0a0dac7b9f814f2aa8caccf083
071c0682f51e9f8983a86031e0d1122c15523171
/ex04/Lemon.h
0fa67694d1a06baf417fb4d7397334c23772c153
[]
no_license
wswatsonws/piscine_cpp_d08
673ee6cb54a169f063c0d231518d789253b39ff1
3c74850232bb23f1e391a4a4fca5faecd2fdd637
refs/heads/master
2020-03-22T19:22:09.830418
2018-07-11T13:29:43
2018-07-11T13:29:43
140,523,328
0
1
null
null
null
null
UTF-8
C++
false
false
308
h
Lemon.h
/* Watson */ /* This is my copyright. Please don not copy it */ /* Please don not copy it */ #ifndef LEMON_H_ #define LEMON_H_ #include "Fruit.h" class Lemon : public Fruit { public: Lemon(); protected: Lemon(std::string name, int vitamins); }; #endif /* Watson */ /* Watson */ /* My own copyright */
10dbcddb68fb47b3c9e40ab68c17132b0267581b
cdbea19ba85553c130592fbef2c3aafa979d07ff
/Number Theory/Linear Diophantine With N Unknowns and Two Equations.cpp
33310b3700dddde2f39bf18eaa848734789a463a
[ "MIT" ]
permissive
alokkiitd1729/code-library
e5251cc6bd3770b9a8ce038ed01f85e83655af65
e6746f0627dc1f6c51d8c511e75c8fa6c2ff8397
refs/heads/master
2023-08-17T14:42:12.645470
2021-10-01T22:27:22
2021-10-01T22:27:22
406,870,622
0
0
MIT
2021-09-15T17:45:11
2021-09-15T17:45:10
null
UTF-8
C++
false
false
1,947
cpp
Linear Diophantine With N Unknowns and Two Equations.cpp
#include<bits/stdc++.h> using namespace std; using ll = long long; /** given are a[i], b[i], p and q: sum(x[i] * a[i]) = p --- (i) sum(x[i] * b[i]) = q --- (ii) x[i]s can only be integers. does a solution exist? **/ ll extended_euclid(ll a, ll b, ll& x, ll& y) { if (b == 0) { x = 1; y = 0; return a; } ll x1, y1; ll d = extended_euclid(b, a % b, x1, y1); x = y1; y = x1 - y1 * (a / b); return d; } ll a, b, coeff; // possible points that can be generated are of the form (a * m, b * m + k * coeff) // add (a[i], b[i]) void add(ll c, ll d) { if (c == 0 and d == 0) return; if (a == 0 and b == 0) { a = c; b = d; return; } ll x0, y0; // a * x0 + c * y0 = m * gcd(a, c) // all solutions are of the form (x0 + k * (c / g), y0 - k * (a / g)) ll g = extended_euclid(a, c, x0, y0); // replace (x, y) to the equation b * x + d * y = z ll tmp_m = b * x0 + d * y0; ll tmp_coeff = abs(b * (c / g) - d * (a / g)); coeff = __gcd(coeff, tmp_coeff); a = g; b = tmp_m % coeff; } // check if solution exists for some (p, q) bool can(ll x, ll y) { if (x == 0 and y == 0) return true; if (coeff == 0) { if (a == 0 or x % a) return false; if (b == 0 or y % b) return false; return x / a == y / b; } if (a == 0 or x % a) return false; return (y - (x / a) * b) % coeff == 0; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int t, cs = 0; cin >> t; while (t--) { int q; cin >> q; a = b = coeff = 0; ll ans = 0; while (q--) { int ty; cin >> ty; if (ty == 1) { ll c, d; cin >> c >> d; add(c, d); } else { ll x, y, w; cin >> x >> y >> w; if (can(x, y)) { ans += w; } } } cout << "Case #" << ++cs << ": " << ans << '\n'; } return 0; } // https://codeforces.com/gym/102769/problem/I
f14b48115248c1ce128207ab8aa505da90e87515
5d92eb061b75172e5e02e27787d9a3758c32bd90
/lab34/lab34.cpp
3ca0d5b3dc673cd453b82e06e1c11fd9b5241a9a
[]
no_license
nleeseely/nleeseely-CSCI20-Fall2017
8adace5acf0b4eda39a3c201f84cfcfda83579db
c4e765833cd1de6bf7138cfbf51604457918b841
refs/heads/master
2021-08-28T20:25:06.433099
2017-12-13T04:04:07
2017-12-13T04:04:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
735
cpp
lab34.cpp
// This program reads in a letter and reports whether // it is an uppercase letter, a lowercase letter, or neither. // it should continue reading in values until the user enters a -1. #include <iostream> using namespace std; int main() { // Read a character in char ch; while (ch != -1){ cout << "Please enter a character: "; cin >> ch; if ((ch >= 'A') && (ch <= 'Z')) { cout << "Yes, that is a uppercase letter." << endl; } else if ((ch >= 'a') && (ch <= 'z')) { cout << "Yes, that is a lowercase letter" << endl; } else { cout << "Not a letter" << endl; } } return 0; }
fb64c7e1dc7bb147e404e464a4a1b98b39f04467
5d4326fcb3dd47ca4b3d14a939b2b293e1a754cb
/src/containers/haplotype_set.cpp
cbdc58758e44ac8d6cecbe35e066c928ca27a711
[ "MIT" ]
permissive
shajoezhu/shapeit4
9245816f860a564f2b67298de0f8bb50bd2874bf
4ae17509c38c6659704d42bdfa23789e71e7eacd
refs/heads/master
2020-06-01T16:55:39.291139
2018-12-14T08:08:48
2018-12-14T08:08:48
190,856,993
0
0
MIT
2020-04-20T03:49:35
2019-06-08T07:07:55
C++
UTF-8
C++
false
false
9,735
cpp
haplotype_set.cpp
//////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2018 Olivier Delaneau, University of Lausanne // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #include <containers/haplotype_set.h> haplotype_set::haplotype_set() { n_site = 0; n_hap = 0; n_ind = 0; n_save = 0; } haplotype_set::~haplotype_set() { n_site = 0; n_hap = 0; n_ind = 0; n_save = 0; curr_clusters.clear(); save_clusters.clear(); dist_clusters.clear(); abs_indexes.clear(); rel_indexes.clear(); } void haplotype_set::updateMapping() { rel_indexes.clear(); int rint = rng.getInt(mod); for (int l = 0 ; l < abs_indexes.size() ; l ++) rel_indexes.push_back(((l%mod == rint)?(l/mod):(-1))); } void haplotype_set::allocate(variant_map & V, int _mod, int _depth) { mod = _mod; depth = _depth; for (int al = 0, rl = 0 ; al < n_site ; al ++) if (V.vec_pos[al]->getMAC() >= 2) { abs_indexes.push_back(al); rel_indexes.push_back(((rl%mod)?(-1):(rl/mod))); rl++; } n_save = (abs_indexes.size() / mod) + (abs_indexes.size() % mod != 0); save_clusters = vector < int > ((depth+1) * (unsigned long)n_save * n_ind * 2UL, 0); curr_clusters = vector < int > (2 * n_hap, 0); dist_clusters = vector < int > (2 * n_hap, 0); } void haplotype_set::update(genotype_set & G, bool first_time) { tac.clock(); for (unsigned int i = 0 ; i < G.n_ind ; i ++) { for (unsigned int v = 0 ; v < n_site ; v ++) { if (first_time || (VAR_GET_AMB(MOD2(v), G.vecG[i]->Variants[DIV2(v)]))) { bool a0 = VAR_GET_HAP0(MOD2(v), G.vecG[i]->Variants[DIV2(v)]); bool a1 = VAR_GET_HAP1(MOD2(v), G.vecG[i]->Variants[DIV2(v)]); H_opt_hap.set(2*i+0, v, a0); H_opt_hap.set(2*i+1, v, a1); } } } vrb.bullet("HAP update (" + stb.str(tac.rel_time()*1.0/1000, 2) + "s)"); } void haplotype_set::transposeH2V(bool full) { tac.clock(); if (!full) H_opt_hap.transpose(H_opt_var, 2*n_ind, n_site); else H_opt_hap.transpose(H_opt_var, n_hap, n_site); vrb.bullet("H2V transpose (" + stb.str(tac.rel_time()*1.0/1000, 2) + "s)"); } void haplotype_set::transposeV2H(bool full) { tac.clock(); if (!full) H_opt_var.transpose(H_opt_hap, n_site, 2*n_ind); else H_opt_var.transpose(H_opt_hap, n_site, n_hap); vrb.bullet("V2H transpose (" + stb.str(tac.rel_time()*1.0/1000, 2) + "s)"); } void haplotype_set::transposeC2H() { tac.clock(); int block = 32; unsigned long addr_tar, addr_src; unsigned long addr_offset = n_save * (unsigned long)n_ind * 2UL; for (int d = 0; d < depth ; d ++) { for (int s = 0; s < n_save ; s += block) { for(int h = 0; h < n_ind * 2; ++h) { for(int b = 0; b < block && s + b < n_save; ++b) { addr_tar = depth * addr_offset + ((unsigned long)h)*n_save + s + b; addr_src = d * addr_offset + (s + b)*((unsigned long)n_ind)*2 + h; save_clusters[addr_tar] = save_clusters[addr_src]; } } } std::copy(save_clusters.begin() + depth * addr_offset , save_clusters.end(), save_clusters.begin() + d * addr_offset ); } vrb.bullet("C2H transpose (" + stb.str(tac.rel_time()*1.0/1000, 2) + "s)"); } void haplotype_set::select() { tac.clock(); updateMapping(); int iprev = 1, inext = 0, i_added = 0; unsigned long addr_offset = n_save * (unsigned long)n_ind * 2UL; vector < int > B = vector < int >(n_hap, 0); vector < int > D = vector < int >(n_hap, 0); for (int l = 0 ; l < abs_indexes.size() ; l ++) { int u = 0, v = 0, p = l, q = l; int curr_block = abs_indexes[l] / lengthIBD2; int poffset = n_hap*(l%2), coffset = n_hap-poffset; iprev = inext; inext = 1 - iprev; for (int h = 0 ; h < n_hap ; h ++) { int alookup = l?curr_clusters[poffset+h]:h; int dlookup = l?dist_clusters[poffset+h]:0; if (dlookup > p) p = dlookup; if (dlookup > q) q = dlookup; if (!H_opt_var.get(abs_indexes[l], alookup)) { curr_clusters[coffset+u] = alookup; dist_clusters[coffset+u] = p; p = 0; u++; } else { B[v] = alookup; D[v] = q; q = 0; v++; } } std::copy(B.begin(), B.begin()+v,curr_clusters.begin()+coffset+u); std::copy(D.begin(), D.begin()+v,dist_clusters.begin()+coffset+u); if (rel_indexes[l] >= 0) { for (int h = 0 ; h < n_hap ; h ++) { int chap = curr_clusters[coffset+h]; int cind = chap / 2; if (cind < n_ind) { unsigned long tar_idx = ((unsigned long)rel_indexes[l])*2*n_ind + chap; int offset0 = 1, offset1 = 1, lmatch0 = -1, lmatch1 = -1; bool add0 = false, add1 = false; for (int n_added = 0 ; n_added < depth ; ) { if ((h-offset0)>=0) { lmatch0 = max(dist_clusters[coffset+h-offset0+1], lmatch0); add0 = (curr_clusters[coffset+h-offset0]/2!=cind); if (flagIBD2[curr_block][cind]) add0 = (add0 && !banned(curr_block, cind, curr_clusters[coffset+h-offset0]/2)); } else { add0 = false; lmatch0 = l; } if ((h+offset1)<n_hap) { lmatch1 = max(dist_clusters[coffset+h+offset1], lmatch1); add1 = (curr_clusters[coffset+h+offset1]/2!=cind); if (flagIBD2[curr_block][cind]) add1 = (add1 && !banned(curr_block, cind, curr_clusters[coffset+h+offset1]/2)); } else { add1 = false; lmatch1 = l; } if (add0 && add1) { if (lmatch0 < lmatch1) { save_clusters[n_added*addr_offset+tar_idx] = curr_clusters[coffset+h-offset0]; offset0++; n_added++; } else if (lmatch0 > lmatch1) { save_clusters[n_added*addr_offset+tar_idx] = curr_clusters[coffset+h+offset1]; offset1++; n_added++; } else if (rng.flipCoin()) { save_clusters[n_added*addr_offset+tar_idx] = curr_clusters[coffset+h-offset0]; offset0++; n_added++; } else { save_clusters[n_added*addr_offset+tar_idx] = curr_clusters[coffset+h+offset1]; offset1++; n_added++; } } else if (add0) { save_clusters[n_added*addr_offset+tar_idx] = curr_clusters[coffset+h-offset0]; offset0++; n_added++; } else if (add1) { save_clusters[n_added*addr_offset+tar_idx] = curr_clusters[coffset+h+offset1]; offset1++; n_added++; } else { offset0++; offset1++; } } } } } vrb.progress(" * PBWT selection", (l+1)*1.0/abs_indexes.size()); } vrb.bullet("PBWT selection (" + stb.str(tac.rel_time()*1.0/1000, 2) + "s)"); } void haplotype_set::searchIBD2(int _lengthIBD2) { tac.clock(); lengthIBD2 = _lengthIBD2; flagIBD2 = vector < vector < bool > > (n_site / lengthIBD2 + 1, vector < bool > (n_ind, false)); idxIBD2 = vector < vector < pair < int, int > > > (n_site / lengthIBD2 + 1, vector < pair < int, int > > ()); int nBan = 0; vector < int > a0 = vector < int >(n_ind, 0); vector < int > a1 = vector < int >(n_ind, 0); vector < int > a2 = vector < int >(n_ind, 0); vector < int > d0 = vector < int >(n_ind, 0); vector < int > d1 = vector < int >(n_ind, 0); vector < int > d2 = vector < int >(n_ind, 0); vector < int > ban = vector < int >(n_ind, -1); for (int l = 0 ; l < n_site ; l ++) { int curr_block = l / lengthIBD2; int u = 0, v = 0, w = 0, p = l+1, q = l+1, r = l+1; for (int i = 0 ; i < n_ind ; i ++) { int alookup = l?a0[i]:i; int dlookup = l?d0[i]:0; if (dlookup > p) p = dlookup; if (dlookup > q) q = dlookup; if (dlookup > r) r = dlookup; unsigned char genotype = H_opt_var.get(l, 2*alookup+0) + H_opt_var.get(l, 2*alookup+1); switch (genotype) { case 0: a0[u] = alookup; d0[u] = p; p = 0; u++; break; case 1: a1[v] = alookup; d1[v] = q; q = 0; v++; break; case 2: a2[w] = alookup; d2[w] = r; r = 0; w++; break; } } copy(a1.begin(), a1.begin()+v,a0.begin()+u); copy(a2.begin(), a2.begin()+w,a0.begin()+u+v); copy(d1.begin(), d1.begin()+v,d0.begin()+u); copy(d2.begin(), d2.begin()+w,d0.begin()+u+v); if ((l%lengthIBD2) == (lengthIBD2 - 1)) { for (int i = 1 ; i < n_ind ; i ++) { int offset = 1; while (((i-offset)>=0) && ((l-d0[i-offset+1]+1)>=lengthIBD2)) { int ind0 = a0[i]; int ind1 = a0[i-offset]; flagIBD2[curr_block][ind0] = true; flagIBD2[curr_block][ind1] = true; idxIBD2[curr_block].push_back(pair <int, int > (min(ind0, ind1), max(ind0, ind1))); offset ++; } } sort(idxIBD2[curr_block].begin(), idxIBD2[curr_block].end()); idxIBD2[curr_block].erase(unique(idxIBD2[curr_block].begin(), idxIBD2[curr_block].end()), idxIBD2[curr_block].end()); nBan += idxIBD2[curr_block].size(); } vrb.progress(" * IBD2 mask", (l+1)*1.0/n_site); } vrb.bullet("IBD2 mask [l=" + stb.str(lengthIBD2) + " / n=" + stb.str(nBan) + "] (" + stb.str(tac.rel_time()*1.0/1000, 2) + "s)"); }
34bc9e5a4d8f7f628455a11a2740663bf874f203
b95ff5dd181ed0e87a5dcaf266c0a1c80eba59d0
/cppsrc/oldSrc/ModelBPR.h
f58f7cded496c5edecdabc9101df1cff934c1003
[]
no_license
mohit-shrma/setrec
715d66d8b698de0f485cdcb0d7707076fd764097
eb1a811aa0cb3ed1d00b0b89817688bef52e8011
refs/heads/master
2020-12-31T00:18:39.950466
2017-03-29T05:16:30
2017-03-29T05:16:30
86,540,691
0
0
null
null
null
null
UTF-8
C++
false
false
667
h
ModelBPR.h
#ifndef _MODEL_BPR_H_ #define _MODEL_BPR_H_ #include "Model.h" class ModelBPR: public Model { public: ModelBPR(const Params& params):Model(params) {} virtual float estItemRating(int user, int item); virtual void train(const Data& data, const Params& params, Model& bestModel); bool isTerminatePrecisionModel(Model& bestModel, const Data& data, int iter, int& bestIter, float& bestValRecall, float& prevValRecall); bool isTerminatePrecisionModel(Model& bestModel, const Data& data, std::vector<std::vector<std::pair<int, float>>> testRatings, int iter, int& bestIter, float& bestValRecall, float& prevValRecall); }; #endif
97f0d318c8a3852cb8f954528b61d8abd7a9e69d
d8627a5cd16d9b59e9acb2f981e6d225247619cc
/Sem2/Object Oriented Programming/Assignment8-9/project/main.cpp
1c3e9dd1f7d6837988993d8627e6593c272061d8
[]
no_license
nicovlad16/Babes-Bolyai-University-Projects
0b76b73194e63cc8e9e5210c2bf2383d7066d227
457ff25dc4f916dd7865d7825db5be38c092f301
refs/heads/master
2020-05-03T15:12:05.184362
2019-03-31T14:37:49
2019-03-31T14:37:49
178,699,635
0
0
null
null
null
null
UTF-8
C++
false
false
3,925
cpp
main.cpp
#include <iostream> #include "tests/tests.h" #include "repo/file_repository.h" #include "service/ctrl.h" #include "ui/console.h" int main() { // Tests::test_all(); Repository<Dog> repo("../dogs"); Controller ctrl(repo); UI ui(ctrl); ui.choose_output_filetype(); ui.initialize_repo(); ui.run(); } /* * @startuml package ui <<Folder>> { class UI { -ctrl: Controller +run() +initialize_repo() +choose_output_filetype() -run_administrator_mode() -{static}print_menu() -add_dog_shelter() -show_all_dogs_shelter() -{static}print_user_mode_menu() -{static}print_view_mode_menu() -{static}print_admin_mode_menu() -run_user_mode() -remove_dog_shelter() -update_dog_shelter() -view_all_dogs() -view_dogs_by_age_and_breed() -void see_adopted_dogs() -read_number(): int -read_string(string: txt): string -show_dog_list() -save_doglist_to_file() -see_adopted_dogs_file() } } package controller <<Folder>> { class Controller { -repo: Repository<Dog> -dogs: FileDogList -adopted: vector<Dog> +Controller(Repository<Dog>: repo) +add_dog_to_shelter(string: breed, string: name, int: age, string: photo) +adopt_dog() +view_all_dogs() +view_filtered_dogs(string: breed, int: age) +get_all_dogs_shelter(): vector<Dog> +remove_dog_from_shelter(string: breed, string: name, int: age, string: photo) +update_dog_shelter(string: old_breed, string: old_name, int: old_age, string: old_photo, string: new_breed, string: new_name, int: new_age, string: new_photo) +get_all_adopted_dogs(): vector<Dog> +start_view_dogs(); +next_dog(); +get_dog_list(): vector<Dog> +get_current_dog_from_list(): Dog; +set_adopted_file(FileDogList *pList) +save_doglist(string: filename) +get_doglist(): FileDogList* +get_current_file(): string +see_adopted_file() } } package repository <<Folder>> { class Repository { -elems: vector -filename: filename -read_from_file() -write_to_file() +Repository(string: filename) +add(elem) +get_all(): vector +get_length(): int +find(elem): bool +remove(elem) +update(old_elem, new_elem) } } package domain <<Folder>> { class DogValidator { +{static}validate(Dog: dog) } class Dog { -breed: breed -name: string -age: int -photo: string +Dog() +~Dog() +Dog(string: breed, string: name, int: age, string: photo) +get_breed(): string +set_breed(string: breed) +get_name(): string +set_name(string: name) +get_age(): int +set_age(int: age) +get_photo(): string +set_photo(string: photo) +view_photo() +operator==(Dog: rhs): bool +operator!=(Dog: rhs) bool +operator<<(ostream: os, Dog: dog): ostream +operator>>(istream: is, Dog: dog): istream } class FileDogList { #dogs: vector<Dog> #current: int #filename: string +FileDogList() +~FileDogList() +add(Dog: dog); +get_current_dog(): Dog +view() +next() +remove(Dog: dog) +clear_list(); +get_all(): vector<Dog> +{abstract}set_filename(string: filename) +{abstract}write_to_file(vector<Dog>: adopted) +{abstract}display_doglist() +get_filename(): string } class CSVDogList { } class HTMLDogList { } FileDogList <|-- CSVDogList : extends FileDogList <|-- HTMLDogList : extends } mix_actor User mix_actor Admin User --> AppCoordinator Admin --> AppCoordinator AppCoordinator .> Repository : creates AppCoordinator .> Controller : creates AppCoordinator .> UI : creates UI *-- Controller : has a UI .> FileDogList : creates Controller *-- Repository : has a Controller *-- FileDogList : has a Controller *-- DogValidator : has a Controller .> DogValidator : creates Controller .> Dog : creates Repository .. Dog : of DogValidator .. Dog * @enduml */
3e5dd166616e9dcde8ca41d0230b3bb6aed814fc
243ab679ab815644de31453089e8ded2d212dd61
/bishoppawnmodel.h
e01d23436ad98f8ae8d3378c1b5cbdf90889c00c
[ "MIT" ]
permissive
mdziubich/chessGame_cpp
ecf7c861a2127c820be797be2466822677955003
80ff8adc17d6fa72441400e80a715f516e5b2989
refs/heads/master
2020-06-17T20:20:40.035214
2019-09-03T21:46:52
2019-09-03T22:52:12
196,041,829
7
2
null
null
null
null
UTF-8
C++
false
false
400
h
bishoppawnmodel.h
#ifndef BISHOPPAWNMODEL_H #define BISHOPPAWNMODEL_H #include "basepawnmodel.h" class BishopPawnModel: public BasePawnModel { public: BishopPawnModel(BoardPosition position, PlayerType owner, PawnType type, QString imagePath); bool validateMove(BoardPosition positionToMove, BasePawnModel *pawnOnPositionToMove, BoardPosition *requestedActivePawnPosition); }; #endif // BISHOPPAWNMODEL_H
be27553bb2a288d8e070ed0fc67db15ad78b8ec6
50383e4df50c34975d501485f01d662a3fedd625
/size.cpp
93540e7b6d6153db58a636666387eae6c0511e3f
[]
no_license
sinewc/CE-boostup
a1cac1a3429391df49da34c7268f2dd905e2efff
bc85401e3d189fb5ded1208e5b2538bf56cf9db7
refs/heads/master
2023-04-25T23:52:00.646284
2021-06-06T17:40:26
2021-06-06T17:40:26
374,424,420
0
0
null
null
null
null
UTF-8
C++
false
false
374
cpp
size.cpp
#include<stdio.h> void square(int n){ int i=1; for(int i=1;i<=n;i++) { for(int j=0;j<=n;j++) { if(i>j) printf("%d",i); else printf("*"); } printf("\n"); } } int main() { int n; scanf("%d",&n); square(n); return 0 ; }
6c2eb9b09996342e9facf6c1f165aa273442440d
1afd08984761b44ef9a9b478da97191befdfa109
/ThermistorModuleFirmware/src/main.cpp
124bf17738b6033ab58c93b9803dfbe17c06f94b
[ "CC-BY-4.0" ]
permissive
ArrosciaFabLab/TemperatureFirmware
430338ef4319fe55cf444e0d7fccde0cfe71aac0
f5afad76334cde40e112657cc52e665081efff15
refs/heads/master
2020-04-05T05:03:55.064955
2018-11-15T17:06:45
2018-11-15T17:06:45
156,579,160
0
0
null
null
null
null
UTF-8
C++
false
false
1,744
cpp
main.cpp
#include "ThermistorModule.hpp" // Libreria di gestione del modulo di temperatura #include <Arduino.h> // Su un file .ino non è necessario /* Schetch di test sul modulo di temperatura con il termistore */ // PIN a cui è collegato il il modulo di temperatura con il termistore (analogico) #define INPUT_TEMP_PIN A0 double dTemp = 0; double dLastTemp = 0; // La dichiarazione delle funzioni non è necessaria nel file .ino void DebugSetup(); // Setup inizale di Arduino void setup() { // Inizializzo il logging sul monitor seriale DebugSetup(); Serial.println( "--- Sto inizializzando la scheda Arduino" ); // Configurazione iniziale del modulo di temperatura ThermistorModuleSetup( INPUT_TEMP_PIN, TEMP_CELSIUS_MODE ); Serial.println( "--- Ho finito di inizializzare la scheda Arduino" ); } // Loop standard di Arduino void loop() { Serial.println( "--- Inizio il loop principale della scheda Arduino" ); // Leggo il valore del sensore in unità Celsius dTemp = ThermistorModuleGetTemp( INPUT_TEMP_PIN ); if ( dTemp == dLastTemp ) { Serial.println( "Il valore della temperatura letto dal modulo non è cambiato" ); } else if ( dTemp > dLastTemp ) { Serial.println( "Il valore della temperatura letto dal modulo è aumentato: " + (String)dTemp + "° C" ); } else if ( dTemp < dLastTemp ) { Serial.println( "Il valore della temperatura letto dal modulo è diminuito: " + (String)dTemp + "° C" ); } dLastTemp = dTemp; delay( 5000 ); } void DebugSetup() { Serial.begin( 9600 ); Serial.println( "--- Ho inizializzato il debug su monitor seriale"); }
8867e6058725bb8956f491c8be81a4240d9f7c20
a841ecaf6f9c5207fe6947235b44c4ec6d5acf89
/Section 2 - Triple X - Write Pure C++/Main.cc
0cab9dc8be606750761e9d306e4e30f8ee7695b1
[ "Apache-2.0" ]
permissive
JeJoProjects/Unreal-Udemy
4bd58f75c809a6fc1bdb12e7671bfeab03a6f70d
cef0671bcc815b7f66c70c861fa5809cbc837d2c
refs/heads/master
2021-04-11T11:24:17.207622
2020-11-11T22:25:49
2020-11-11T22:25:49
249,015,493
0
0
null
null
null
null
UTF-8
C++
false
false
1,831
cc
Main.cc
#include <iostream> #include <ctime> #include <cstdlib> void playGame(int& levelDifficulty, const int maxDifficulty) noexcept { std::cout << "\n\nYou are a secret agent breaking in to a level " << levelDifficulty; std::cout << " secure server room....\nEnter the correct code to continue...\n \n"; const int codeA{ std::rand() % levelDifficulty + levelDifficulty }; const int codeB{ std::rand() % levelDifficulty + levelDifficulty }; const int codeC{ std::rand() % levelDifficulty + levelDifficulty }; const int codeSum{ codeA + codeB + codeC }; const int codeProduct{ codeA * codeB * codeC }; // print the code sum and code product to the terminal std::cout << "+ There are 3 numbers in the code"; std::cout << "\n+ The codes add-up to: " << codeSum; std::cout << "\n+ The codes multiplies to: " << codeProduct << "\n"; // store player guess int guessA{}, guessB{}, guessC{}; std::cin >> guessA >> guessB >> guessC; const int guessSum{ guessA + guessB + guessC }; const int guessProduct{ guessA * guessB * guessC }; if (codeSum != guessSum || codeProduct != guessProduct) { std::cout << "\nYou lost!\n"; return; } std::cout << "\nYou won!\n"; // level incrementing and validating the completeness ++levelDifficulty <= maxDifficulty ? std::cout << "You are now entering to the " << levelDifficulty << "th level\n" : std::cout << "\n*** Great work agent! You got all the files! Now get out of there! ***\n"; } int main() { // create new random sequence based on time of day std::srand(std::time(nullptr)); int levelDifficulty{ 1 }; const int maxDifficulty{ 5 }; // Loop game until all levels completed while (levelDifficulty <= 5) { ::playGame(levelDifficulty, maxDifficulty); std::cin.clear(); // clears any errors std::cin.ignore(); // discards the buffer } return 0; }
943930b02124d590d5dac52b71c55ff5223e2bc2
a7e2a5614c3918b006f43388d9f1d4771cf2a8f2
/tool.cpp
e0f56aa95281aec9ec5b9c8c0251c296f0bcd4b4
[]
no_license
JanMod/Qt
ddf6c42f95b27bb2cbe3064b2cbbca671ccb5ed7
e750533b5b7811aa4d44aeadf3be1c91e10e0d71
refs/heads/master
2021-07-07T03:07:28.079045
2017-10-04T19:54:52
2017-10-04T19:54:52
105,485,486
0
0
null
null
null
null
UTF-8
C++
false
false
713
cpp
tool.cpp
#include "tool.h" Tool* Tool::m_instance=0; Tool::eTool Tool::m_currentTool=Tool::Circle; Tool *Tool::getInstance() { if(!m_instance){ m_instance = new Tool(); } return m_instance; } Tool::Tool() { } QColor Tool::getBorderColor() const { return m_borderColor; } void Tool::setBorderColor(const QColor &borderColor) { m_borderColor = borderColor; } QColor Tool::getFillColor() const { return m_fillColor; } void Tool::setFillColor(const QColor &fillColor) { m_fillColor = fillColor; } Tool::eTool Tool::getCurrentTool() { return m_currentTool; } void Tool::setCurrentTool(const eTool &currentTool) { qDebug()<<currentTool; m_currentTool = currentTool; }
638df11333729af70e415cdf4c0a9fb58251f59c
c0b577f881c8f7a9bcea05aaad364a7e82bdec8a
/Source/Core/Source/System/VPLC/PLCFileMgr/CInstrSettings.cpp
756de3ad1bec4db9309befb5444e22e53b130a5d
[]
no_license
15831944/GPATS-Compare
7e6c8495bfb2bb6f5f651e9886a50cf23809399f
d467c68381d4011f7c699d07467cbccef6c8ed9a
refs/heads/main
2023-08-14T09:15:18.986272
2021-09-23T16:56:13
2021-09-23T16:56:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,346
cpp
CInstrSettings.cpp
//----------------------------------------------------------------------------- // File: CInstrSettings.cpp // Contains: Class for managing instrument settings //-----------------------------------------------------------------------------/ //-----------------------------------------------------------------------------/ // History //-----------------------------------------------------------------------------/ // Date Eng PCR Description // -------- --- --- -------------------------------------------------------- // 06/22/05 AJP Initial creation //-----------------------------------------------------------------------------/ #include "CInstrSettings.hpp" CInstrSettings::CInstrSettings() : mp_File(NULL) { } CInstrSettings::CInstrSettings (const char * FileName) { mp_File = NULL; SetFileName(FileName); } CInstrSettings::~CInstrSettings() { if (mp_File != NULL) delete [] mp_File; } bool CInstrSettings::SetFileName(const char * FileName) { if (mp_File != NULL) delete [] mp_File; mp_File = new char [strlen(FileName) + 1]; strcpy(mp_File,FileName); return true; } bool CInstrSettings::SetFileName(std::string FileName) { if (mp_File != NULL) delete [] mp_File; mp_File = new char [FileName.size()]; // allocate memory for mp_File //mp_File = FileName.c_str(); FileName.copy(mp_File, FileName.size(), 0); mp_File[FileName.size()] = 0; // add null to the end return true; } bool CInstrSettings::getFileSize(long &fileSize) { long lPosition; FILE *stream; if (mp_File == NULL) return false; if (mp_File == NULL) return false; if ( (stream = fopen( mp_File, "r+b" )) == NULL ){ return false; } if (fseek(stream, 0, SEEK_SET) != 0){ fclose( stream ); return false; } lPosition = ftell(stream); if (fseek(stream, 0, SEEK_END) != 0){ fclose( stream ); return false; } fileSize = ftell(stream) - lPosition; fclose(stream); return true; } /* bool CInstrSettings::SaveInstrSettingsST(T_ClientData InstrSet) { FILE *stream; if (mp_File == NULL) return false; if ( (stream = fopen( mp_File, "w+b" )) != NULL ) { fwrite( &InstrSet, sizeof(InstrSet), 1, stream ); fclose( stream ); } else { //StoreErrors.SetError(NO_RFID_ERROR, "call to fopen () failed in CRFMa::SaveInstrSettings"); return false; } return true; }; */
38c38638ad028864fa824fdc4b9ed8b5c42942f0
96f3e2fc82536e5963bda2445035f8f4fb71aabc
/win-client/include/Modules/IMessageModule.h
4d6afce448de7496c46034840b92b88a48142381
[ "BSD-2-Clause", "Apache-2.0" ]
permissive
jdtsg/TeamTalk
5266083f9fcfc901aec287235969d7a9b99e97ff
69fe6ac5a64f0679f61b81f8c77e01aca8716155
refs/heads/master
2020-03-21T12:25:03.406263
2018-06-25T09:04:04
2018-06-25T09:04:04
138,551,294
1
0
Apache-2.0
2018-06-25T06:16:41
2018-06-25T06:16:41
null
GB18030
C++
false
false
1,750
h
IMessageModule.h
/******************************************************************************* * @file IHitoryMsgModule.h 2014\8\3 11:10:16 $ * @author 快刀<kuaidao@mogujie.com> * @brief 历史消息DB相关接口 ******************************************************************************/ #ifndef IHITORYMSGMODULE_D042F2F2_05B0_45E6_9746_344A76279AE8_H__ #define IHITORYMSGMODULE_D042F2F2_05B0_45E6_9746_344A76279AE8_H__ #include "GlobalDefine.h" #include "Modules/ModuleDll.h" #include "MessageEntity.h" #include <list> /******************************************************************************/ class MessageEntity; class TransferFileEntity; NAMESPACE_BEGIN(module) /** * The class <code>历史消息DB相关接口</code> * */ class MODULE_API IMessageModule { public: /**@name 历史消息相关*/ //@{ virtual BOOL getHistoryMessage(IN const std::string& sId, IN UInt32 nMsgCount ,IN BOOL scrollBottom, OUT std::vector<MessageEntity>& msgList) = 0; virtual void setSessionTopMsgId(IN const std::string& sId,IN UInt32 msgId) = 0; //@} /**@name 运行时消息相关*/ //@{ /** * 断线重连的情况下要清理消息 * * @param const std::string & sId * @return void * @exception there is no any exception to throw. */ virtual void removeMessageBySId(IN const std::string& sId) = 0; virtual void removeAllMessage() = 0; virtual BOOL pushMessageBySId(IN const std::string& sId,IN MessageEntity& msg) = 0; virtual UInt32 getTotalUnReadMsgCount(void) = 0; //@} }; MODULE_API IMessageModule* getMessageModule(); NAMESPACE_END(module) /******************************************************************************/ #endif// IHITORYMSGMODULE_D042F2F2_05B0_45E6_9746_344A76279AE8_H__
0de2d98ced79696aee8005c79b16167e45720bef
98cd0dcec1bb3db5ba483758a5337521d6b5f9df
/old/Multiply Strings/Multiply Strings/main.cpp
f923f6ec8d70b595043ba835f8494951aa671ae5
[ "Apache-2.0" ]
permissive
betallcoffee/leetcode
ff09853caef704dff39bb193483d149e89172092
b21588bda21a464af7c18a3e8155c53af76b263f
refs/heads/master
2021-01-19T11:17:37.086034
2020-03-01T09:19:14
2020-03-01T09:41:31
26,198,774
0
1
null
null
null
null
UTF-8
C++
false
false
4,430
cpp
main.cpp
// // main.cpp // Multiply Strings // // Created by liang on 8/1/15. // Copyright (c) 2015 tina. All rights reserved. // Problem: https://leetcode.com/problems/multiply-strings/ //Given two numbers represented as strings, return multiplication of the numbers as a string. // //Note: The numbers can be arbitrarily large and are non-negative. #include <iostream> #include <string> #include <vector> using namespace std; class Solution { public: string multiply(string num1, string num2) { if (num1.length() == 0 || num2.length() == 0) { return "0"; } vector<char> multiply; vector<char> temp; int digit1 = 1; string::reverse_iterator iter1 = num1.rbegin(); for (; iter1 != num1.rend(); iter1++) { char c1 = *iter1; int multiplier = (c1 - '0'); temp.clear(); for (int i = 1; i < digit1; i++) { temp.push_back('0'); } int result = 0; int carry = 0; int digit2 = 1; string::reverse_iterator iter2 = num2.rbegin(); for (; iter2 != num2.rend(); iter2++) { char c2 = *iter2; int multipicand = (c2 - '0'); result = multipicand * multiplier + carry; int remainder = result % 10; carry = result / 10; temp.push_back('0' + remainder); digit2++; } while (carry) { int remainder = carry % 10; carry = carry / 10; temp.push_back('0' + remainder); } multiply = add(multiply, temp); digit1++; } return removeZero(multiply); } string removeZero(vector<char> num) { string ret; if (num.size() > 1) { vector<char>::reverse_iterator iter = num.rbegin(); while (iter != num.rend() && *iter == '0') { iter++; } if (iter == num.rend()) { ret = "0"; } else { ret.assign(iter, num.rend()); } } else { ret.assign(num.rbegin(), num.rend()); } return ret; } vector<char> add(vector<char> num1, vector<char> num2) { string n1; n1.assign(num1.rbegin(), num1.rend()); string n2; n2.assign(num2.rbegin(), num2.rend()); string str = add(n1, n2); vector<char> ret; ret.assign(str.rbegin(), str.rend()); return ret; } string add(string num1, string num2) { vector<char> add; int carry = 0; string max; string min; if (num1.length() >= num2.length()) { max = std::move(num1); min = std::move(num2); } else { max = std::move(num2); min = std::move(num1); } int length1 = (int)min.length(); int length2 = (int)max.length(); for (int i = 0; i < length1; i++) { char c1 = min[length1 - 1 - i]; int n1 = (c1 - '0'); char c2 = max[length2 - 1 - i]; int n2 = (c2 - '0'); int temp = n1 + n2 + carry; int remainder = temp % 10; carry = temp / 10; add.push_back('0' + remainder); } for (int i = length1; i < length2; i++) { char c2 = max[length2 - 1 - i]; int n2 = (c2 - '0'); int temp = n2 + carry; int remainder = temp % 10; carry = temp / 10; add.push_back('0' + remainder); } while (carry) { int remainder = carry % 10; carry = carry / 10; add.push_back('0' + remainder); } string ret; ret.assign(add.rbegin(), add.rend()); return ret; } }; int main(int argc, const char * argv[]) { Solution s; cout << s.multiply("9", "99") << endl; cout << s.multiply("99", "9") << endl; cout << s.multiply("1", "12") << endl; cout << s.multiply("0", "13") << endl; cout << s.multiply("1000", "44") << endl; cout << s.multiply("444", "100000") << endl; cout << s.multiply("", "44") << endl; return 0; }
59779e6d27609275730db5c5ac8668aad8c0ad74
55d3f3102008d206ff7c72b8baf35164277ca3d4
/test/src/destroy_test_type.cpp
a35714e4a1173cf29f71a7e8f36cba79efb3aec3
[ "Unlicense" ]
permissive
CppPhil/philslib
8e96a4bcb59aff1d8b8cd5a818bfac665eb3d5a4
6143c2b46dc1abf4534c402991624ee940585e20
refs/heads/master
2022-11-19T21:46:37.402245
2022-11-19T13:22:58
2022-11-19T13:22:58
82,369,222
3
3
Unlicense
2019-06-17T14:49:07
2017-02-18T07:19:31
C++
UTF-8
C++
false
false
1,822
cpp
destroy_test_type.cpp
/* This is free and unencumbered software released into the public domain. * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the benefit * of the public at large and to the detriment of our heirs and * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * For more information, please refer to <http://unlicense.org/> */ #include "../include/destroy_test_type.hpp" namespace pl { namespace test { destroy_test_type::destroy_test_type(bool* p) : m_p{p} { } destroy_test_type::destroy_test_type(const destroy_test_type&) = default; destroy_test_type& destroy_test_type::operator=(const destroy_test_type&) = default; destroy_test_type::~destroy_test_type() { // replace the previous value (should be false) of the bool with true. // this way a test can observe this destructor having been called. *m_p = true; } } // namespace test } // namespace pl
21caa676b6bb3f6ccd0aa187babdef84d49f8716
87780771d77a8e9a22182ad0fadaf223eaca1eeb
/src/Cromossomo.cpp
33def842265689df9871f8efa182bad6321804b7
[]
no_license
leandronishijima/algoritmo-genetico-sequencial
3958cb11a367e70b1ca7d8e260b84c1932e12822
20453f67a1e36b59e36b0f42ee3ef779d444af3e
refs/heads/master
2021-01-19T11:32:56.578455
2014-11-12T04:21:41
2014-11-12T04:21:41
24,351,419
0
1
null
null
null
null
UTF-8
C++
false
false
631
cpp
Cromossomo.cpp
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "Cromossomo.h" #include "Vertice.h" #include "Grafo.h" Cromossomo::Cromossomo() { srand(time(NULL)); } Cromossomo::Cromossomo(Grafo grafo) { this->grafo = grafo; } void Cromossomo::randomizaCorVertice() { int qtdVertices = grafo.getQuantidadeVertices() - 1; int verticeRandom = rand() % qtdVertices + 1; int corRandom = rand() % 4; grafo.randomizaCorVerticeSeguindoHeuristica(verticeRandom, corRandom); } int Cromossomo::getAvaliacao() { return grafo.getAvaliacao(); } int Cromossomo::getQuantidadeDeArestas() { return grafo.getQuantidadeAresta(); }
06a7fe19ec49311add20ad04939df88ce279cc50
9844200fd5e108c966f5fce8824788284aa16b80
/impact_time/src/impact_time.cpp
c3cd890ed4a8c5c748d3f6926d8458ca61a457eb
[]
no_license
lnewmeye/robotic_vision
b2e21d3915804555d0c6248433842d26bea7235f
434683503047fba910e14dd9651e47b8a9aeee98
refs/heads/master
2021-01-21T09:24:05.664083
2017-12-22T19:21:15
2017-12-22T19:21:15
91,652,215
0
0
null
null
null
null
UTF-8
C++
false
false
1,711
cpp
impact_time.cpp
// EcEn 672 - Robotic Vision // Assigment 7 - Main file // Luke Newmeyer #include <iostream> #include <opencv2/core.hpp> #include <opencv2/videoio.hpp> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> #include "ImpactDetector.hpp" // Image sequence parameters #define IMAGE_SEQUENCE "data/T%01d.jpg" // Display window parameters #define DISPLAY_WINDOW "Display Window" #define DISPLAY_TIME_FAST 0 // Standard namespaces used using std::cout; using std::endl; // OpenCV namespaces used using cv::VideoCapture; using cv::Mat; int main() { // Create display window cv::namedWindow(DISPLAY_WINDOW, CV_WINDOW_AUTOSIZE); // Open image sequence VideoCapture image_sequence; image_sequence.open(IMAGE_SEQUENCE); // Declare variables for main loop Mat image, display; char keypress; ImpactDetector impact_detector; // Read in first image and set as initial image image_sequence >> image; cv::cvtColor(image, image, CV_BGR2GRAY); impact_detector.setInitial(image, display); // Display output from first image imshow(DISPLAY_WINDOW, display); keypress = cv::waitKey(DISPLAY_TIME_FAST); double impact_frames; // read in next image image_sequence >> image; // Read in image data, convert color, process, and display while(!image.empty() && keypress != 'q') { // Convert image color to gray scale and process cv::cvtColor(image, image, CV_BGR2GRAY); impact_frames = impact_detector.detectImpact(image, display); //cout << "impact_frames = " << impact_frames << endl; cout << impact_frames << endl; // Display image cv::imshow(DISPLAY_WINDOW, display); keypress = cv::waitKey(DISPLAY_TIME_FAST); // Load next image image_sequence >> image; } return 0; }
da9356e0f77731fb46dcac56ef812978772c1acd
db84bf6382c21920c3649b184f20ea48f54c3048
/mjdemonstrator/mjdemonstrator/MJSTCThermalAssemblyThin.hh
44b1d687e679ed9e3d98189d1babf9e5c0af0185
[]
no_license
liebercanis/MaGeLAr
85c540e3b4c5a48edea9bc0520c9d1a1dcbae73c
aa30b01f3c9c0f5de0f040d05681d358860a31b3
refs/heads/master
2020-09-20T12:48:38.106634
2020-03-06T18:43:19
2020-03-06T18:43:19
224,483,424
2
0
null
null
null
null
UTF-8
C++
false
false
3,325
hh
MJSTCThermalAssemblyThin.hh
//---------------------------------------------------------------------------// //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// // // // MaGe Simulation // // // // This code implementation is the intellectual property of the // // MAJORANA and Gerda Collaborations. It is based on Geant4, an // // intellectual property of the RD44 GEANT4 collaboration. // // // // ********************* // // // // Neither the authors of this software system, nor their employing // // institutes, nor the agencies providing financial support for this // // work make any representation or warranty, express or implied, // // regarding this software system or assume any liability for its use. // // By copying, distributing or modifying the Program (or any work based // // on on the Program) you indicate your acceptance of this statement, // // and all its terms. // // // //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// //---------------------------------------------------------------------------// // // // CLASS IMPLEMENTATION: MJSTCThermalAssemblyThin.hh // //---------------------------------------------------------------------------// /** * SPECIAL NOTES: * * */ // //---------------------------------------------------------------------------// /** * AUTHOR: Chris O'Shaughnessy * CONTACT: chriso@unc.edu * FIRST SUBMISSION: Thursday November 14 2013 * * REVISION: * 09-28-2016, Created, C. O'Shaughnessy * */ //---------------------------------------------------------------------------// // //---------------------------------------------------------------------------// #ifndef _MJSTCTHERMALASSEMBLYTHIN_HH #define _MJSTCTHERMALASSEMBLYTHIN_HH //---------------------------------------------------------------------------// #include "mjdemonstrator/MJVDemoAssembly.hh" #include "mjdemonstrator/MJVDemoPart.hh" class G4LogicalVolume; class MJSTCThermalAlFoil; class MJSTCThermalIRShield; using namespace std; //---------------------------------------------------------------------------// class MJSTCThermalAssemblyThin: public MJVDemoAssembly { public: MJSTCThermalAssemblyThin(G4String, G4String); MJSTCThermalAssemblyThin(const MJSTCThermalAssemblyThin &); ~MJSTCThermalAssemblyThin(); MJSTCThermalIRShield* GetIRShield() {return fIRShieldPtr;} MJSTCThermalAlFoil* GetAlFoil() {return fAlFoilPtr;} void Place(G4ThreeVector* assemPosition, G4RotationMatrix* assemRotation, G4LogicalVolume* motherLogical); private: MJSTCThermalIRShield* fIRShieldPtr; MJSTCThermalAlFoil* fAlFoilPtr; }; // #endif
197cccb783a1e7d353f75e39afe6816941678962
f89d4c9ae28c9418633bf3e461bce6ed2b37f6ba
/include/linalg/lapack/blaze.hpp
a4c69378b5da8587a53d3cba39d1b37ac40a0108
[]
no_license
hrhill/linalg
d8079f3d8df02e4f55a46a2e4719771c288bddfb
66a466fa6553766665f0ebbd1a950eaab100fd73
refs/heads/master
2021-01-19T05:43:57.107114
2017-07-27T15:34:36
2017-07-27T15:34:36
23,926,698
2
1
null
2016-11-28T17:20:25
2014-09-11T16:42:06
C++
UTF-8
C++
false
false
2,668
hpp
blaze.hpp
#ifndef LINALG_LAPACK_BLAZE_HPP_ #define LINALG_LAPACK_BLAZE_HPP_ #include <blaze/Math.h> namespace linalg { template <template <typename, bool> class Matrix, typename T, bool SO> int potrf(Matrix<T, SO>& a) { const int n(a.rows()); const int lda(a.spacing()); int info = 0; blaze::potrf('L', n, a.data(), lda, &info); return info; } template <template <typename, bool> class Matrix, typename T, bool SO> int potrs(Matrix<T, SO>& a, Matrix<T, SO>& b) { const int n(a.rows()); const int nrhs(b.columns()); const int lda(a.spacing()); const int ldb(b.spacing()); int info = 0; blaze::potrs('L', n, nrhs, a.data(), lda, b.data(), ldb, &info); return info; } template <template <typename, bool> class Matrix, typename T, bool SO> int potri(Matrix<T, SO>& a) { const int m(a.rows()); const int lda(a.spacing()); int info = 0; blaze::potri('L', m, a.data(), lda, &info); return info; } template <template <typename, bool> class MatrixA, template <typename, bool> class MatrixB, typename TA, bool SOA, typename TB, bool SOB> int posv(MatrixA<TA, SOA>& a, MatrixB<TB, SOB>& b) { const int n(a.rows()); const int nrhs(b.columns()); const int lda(a.spacing()); const int ldb(b.spacing()); int info = 0; blaze::posv('L', n, nrhs, a.data(), lda, b.data(), ldb, &info); return info; } template <template <typename, bool> class Matrix, typename T, bool SO> int getrf(Matrix<T, SO>& a, std::vector<int>& ipiv) { const int m(a.rows()); const int n(a.columns()); const int lda(a.spacing()); int info = 0; blaze::getrf(m, n, a.data(), lda, ipiv.data(), &info); return info; } template <template <typename, bool> class Matrix, typename T, bool SO> int getri(Matrix<T, SO>& a, std::vector<int>& ipiv) { const int m(a.rows()); const int lda(a.spacing()); // Calculate workspace first std::vector<double> work{0}; int info = 0; blaze::getri(m, a.data(), lda, ipiv.data(), work.data(), -1, &info); if (info == 0) { work.resize(work[0]); } blaze::getri( m, a.data(), lda, ipiv.data(), work.data(), work.size(), &info); return info; } template <template <typename, bool> class Matrix, typename T, bool SO> int getrs(Matrix<T, SO>& a, std::vector<int>& ipiv, Matrix<T, SO>& b) { const int n(a.rows()); const int nrhs(b.columns()); const int lda(a.spacing()); const int ldb(b.spacing()); int info = 0; blaze::getrs( 'N', n, nrhs, a.data(), lda, ipiv.data(), b.data(), ldb, &info); return info; } } // ns linalg #endif
1d49e8f422d50e3358926813c24cdf1d0412a84b
94304ae0875d0c6164922de503a12b13add2d2d1
/inst/cpp/edf_interface.cpp
818d192bd33bb56dbb70d723b21e1ebaa3063a44
[]
no_license
alexander-pastukhov/eyelinkReader
279482e7de0ef456bfde2b8fda56b27370eee385
e915798bb56b2ce46883536a379d4127812fef8b
refs/heads/master
2022-10-19T22:09:20.088415
2022-09-27T08:53:41
2022-09-27T08:53:41
134,551,196
9
2
null
2023-09-05T15:58:07
2018-05-23T10:10:00
R
UTF-8
C++
false
false
33,452
cpp
edf_interface.cpp
#include <sstream> #include <math.h> #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::depends(RcppProgress)]] #include <progress.hpp> namespace edfapi { #include "edf.h" } const float FLOAT_NAN = nanf(""); //' @title Status of compiled library //' @description Return status of compiled library //' @return logical //' @export //' @examples //' compiled_library_status() //[[Rcpp::export]] bool compiled_library_status(){ // the other version, compiled at installation returns false return(true); } // ------------------ data structures, as defined in EDF C API user manual ------------------ typedef struct TRIAL_EVENTS { std::vector <unsigned int> trial_index; std::vector <edfapi::UINT32> time; std::vector <edfapi::INT16> type; std::vector <edfapi::UINT16> read; std::vector <edfapi::UINT32> sttime; std::vector <edfapi::UINT32> sttime_rel; std::vector <edfapi::UINT32> entime; std::vector <edfapi::UINT32> entime_rel; std::vector <float> hstx; std::vector <float> hsty; std::vector <float> gstx; std::vector <float> gsty; std::vector <float> sta; std::vector <float> henx; std::vector <float> heny; std::vector <float> genx; std::vector <float> geny; std::vector <float> ena; std::vector <float> havx; std::vector <float> havy; std::vector <float> gavx; std::vector <float> gavy; std::vector <float> ava; std::vector <float> avel; std::vector <float> pvel; std::vector <float> svel; std::vector <float> evel; std::vector <float> supd_x; std::vector <float> eupd_x; std::vector <float> supd_y; std::vector <float> eupd_y; std::vector <edfapi::INT16> eye; std::vector <edfapi::UINT16> status; std::vector <edfapi::UINT16> flags; std::vector <edfapi::UINT16> input; std::vector <edfapi::UINT16> buttons; std::vector <edfapi::UINT16> parsedby; std::vector <std::string> message; } TRIAL_EVENTS; // please note that byte type were replaced with UINT16 for compatibility reasons typedef struct TRIAL_RECORDINGS{ std::vector <unsigned int> trial_index; std::vector <edfapi::UINT32> time; std::vector <edfapi::UINT32> time_rel; std::vector <float> sample_rate; std::vector <edfapi::UINT16> eflags; std::vector <edfapi::UINT16> sflags; std::vector <edfapi::UINT16> state; std::vector <edfapi::UINT16> record_type; std::vector <edfapi::UINT16> pupil_type; std::vector <edfapi::UINT16> recording_mode; std::vector <edfapi::UINT16> filter_type; std::vector <edfapi::UINT16> pos_type; std::vector <edfapi::UINT16> eye; } TRIAL_RECORDINGS; typedef struct TRAIL_SAMPLES{ std::vector <unsigned int> trial_index; std::vector <edfapi::UINT32> time; std::vector <edfapi::UINT32> time_rel; std::vector <unsigned int> eye; // NumericVector pxL; // NumericVector pxR; std::vector <float> pxL; std::vector <float> pxR; std::vector <float> pyL; std::vector <float> pyR; std::vector <float> hxL; std::vector <float> hxR; std::vector <float> hyL; std::vector <float> hyR; std::vector <float> paL; std::vector <float> paR; std::vector <float> gxL; std::vector <float> gxR; std::vector <float> gyL; std::vector <float> gyR; std::vector <float> rx; std::vector <float> ry; std::vector <float> gxvelL; std::vector <float> gxvelR; std::vector <float> gyvelL; std::vector <float> gyvelR; std::vector <float> hxvelL; std::vector <float> hxvelR; std::vector <float> hyvelL; std::vector <float> hyvelR; std::vector <float> rxvelL; std::vector <float> rxvelR; std::vector <float> ryvelL; std::vector <float> ryvelR; std::vector <float> fgxvelL; std::vector <float> fgxvelR; std::vector <float> fgyvelL; std::vector <float> fgyvelR; std::vector <float> fhxvelL; std::vector <float> fhxvelR; std::vector <float> fhyvelL; std::vector <float> fhyvelR; std::vector <float> frxvelL; std::vector <float> frxvelR; std::vector <float> fryvelL; std::vector <float> fryvelR; std::vector <edfapi::INT16> hdata_1; std::vector <edfapi::INT16> hdata_2; std::vector <edfapi::INT16> hdata_3; std::vector <edfapi::INT16> hdata_4; std::vector <edfapi::INT16> hdata_5; std::vector <edfapi::INT16> hdata_6; std::vector <edfapi::INT16> hdata_7; std::vector <edfapi::INT16> hdata_8; std::vector <edfapi::UINT16> flags; std::vector <edfapi::UINT16> input; std::vector <edfapi::UINT16> buttons; std::vector <edfapi::INT16> htype; std::vector <edfapi::UINT16> errors; } TRIAL_SAMPLES; //' @title Converts a float value to an explicit NaN, if necessary //' @param value float //' @return float //' @export //' @keywords internal inline float float_or_nan(float value) { if ((value <= MISSING_DATA) || (value >= 1e8)) return FLOAT_NAN; return value; } // ------------------ EDF API interface ------------------ //' @title Version of the EDF API library //' @description Returns version of the EDF API library used to interface an EDF file. //' @export //' @examples //' eyelinkReader::library_version() //[[Rcpp::export]] CharacterVector library_version(){ Rcpp::StringVector version_info(1); version_info[0] = edfapi::edf_get_version(); return version_info; } // @title Opens EDF file, throws exception on error // @description Opens EDF file for reading, throws exception and prints error message if fails. // @param std::string filename, name of the EDF file // @param int consistency, consistency check control (for the time stamps of the start // and end events, etc). 0, no consistency check. 1, check consistency and report. // 2, check consistency and fix. // @param int loadevents, load/skip loading events 0, do not load events. 1, load events. // @param int loadsamples, load/skip loading of samples 0, do not load samples. 1, load samples. // @return pointer to the EDF file // @keywords internal edfapi::EDFFILE* safely_open_edf_file(std::string filename, int consistency, int loadevents, int loadsamples){ // opening the edf file int ReturnValue; edfapi::EDFFILE* edfFile = edfapi::edf_open_file(filename.c_str(), consistency, loadevents, loadsamples, &ReturnValue); // throwing an exception, if things go pear shaped if (ReturnValue != 0){ std::stringstream error_message_stream; error_message_stream << "Error opening file '" << filename << "', error code: " << ReturnValue; ::Rf_error(error_message_stream.str().c_str()); } return edfFile; } //' @title Reads preamble of the EDF file as a single string. //' @description Reads preamble of the EDF file as a single string. //' Please, do not use this function directly. Instead, call \code{\link{read_preamble}} function //' that provides a more consistent interface. //' @return string with the preamble //' @export //' @keywords internal //' @examples //' \donttest{ //' read_preamble(system.file("extdata", "example.edf", package = "eyelinkReader")) //' } //[[Rcpp::export]] std::string read_preamble_str(std::string filename){ edfapi::EDFFILE* edfFile = safely_open_edf_file(filename, 2, 0, 0); // getting preable int ReturnValue; char preamble_buffer[2048]; ReturnValue = edfapi::edf_get_preamble_text(edfFile, preamble_buffer, 2048); if (ReturnValue != 0) { std::stringstream error_message_stream; error_message_stream << "Error reading preable for file '" << filename << "', error code: " << ReturnValue; ::Rf_error(error_message_stream.str().c_str()); } std::string preamble(preamble_buffer); // closing file edfapi::edf_close_file(edfFile); return preamble; } //' @title Sets trial navigation for EDF API //' @description Sets trial navigation via the markers for the start and the end of the trial. //' @param EDFFILE* edfFile, pointer to the EDF file //' @param std::string start_marker_string, event that marks trial start. Defaults to "TRIALID", if empty. //' @param std::string end_marker_string, event that marks trial end //' @seealso safely_open_edf_file //' @keywords internal void set_trial_navigation_up(edfapi::EDFFILE* edfFile, std::string start_marker_string, std::string end_marker_string){ // converting strings to char buffers char * start_marker_char = new char[start_marker_string.size() + 1]; std::copy(start_marker_string.begin(), start_marker_string.end(), start_marker_char); start_marker_char[start_marker_string.size()] = '\0'; char * end_marker_char = new char[end_marker_string.size() + 1]; std::copy(end_marker_string.begin(), end_marker_string.end(), end_marker_char); end_marker_char[end_marker_string.size()] = '\0'; // setting the trial identifier if (edf_set_trial_identifier(edfFile, start_marker_char, end_marker_char)){ ::Rf_error("Error while setting up trial navigation identifier"); } // cleaning up delete[] start_marker_char; delete[] end_marker_char; } //' @title Jumps to the i-th trial //' @description Jumps to the i-th trial, throws an exception and prints an error message, if fails. //' @param EDFFILE* edfFile, pointer to the EDF file //' @param int iTrial, index of the desired trial //' @seealso safely_open_edf_file, set_trial_navigation_up //' @keywords internal void jump_to_trial(edfapi::EDFFILE* edfFile, int iTrial){ if (edfapi::edf_jump_to_trial(edfFile, iTrial) != 0){ std::stringstream error_message_stream; error_message_stream << "Error jumping to trial " << iTrial+1; ::Rf_error(error_message_stream.str().c_str()); } } //' @title Prepare matrix for trial headers //' @description Prepare matrix for trial headers. //' @param int total_trials, total number of trials, i.e. number of rows in the matrix //' @return NumericMatrix total_trials (rows) x 15 (columns) //' @keywords internal NumericMatrix prepare_trial_headers(int total_trials){ // row names NumericVector row_index(total_trials); for(int iTrial= 0; iTrial< total_trials; iTrial++) { row_index[iTrial] = iTrial+1; }; // column names CharacterVector col_names= CharacterVector::create("trial", "duration", "starttime", "endtime", "rec_time", "rec_sample_rate", "rec_eflags", "rec_sflags", "rec_state", "rec_record_type", "rec_pupil_type", "rec_recording_mode", "rec_filter_type", "rec_pos_type", "rec_eye"); // create the matrix NumericMatrix trial_headers= NumericMatrix(total_trials, col_names.size()); trial_headers.attr("dimnames") = List::create(row_index, col_names); return (trial_headers); } //' @title Read header for the i-th trial //' @description Read head and store it in the i-th row of the headers matrix //' @param EDFFILE* edfFile, pointer to the EDF file //' @param NumericMatrix &trial_headers, reference to the trial header matrix //' @param int iTrial, the row in which the header will be stored. //' Functions assumes that the correct trial within the EDF file was already navigated to. //' @return modifes trial_headers i-th row in place //' @keywords internal void read_trial_header(edfapi::EDFFILE* edfFile, NumericMatrix &trial_headers, int iTrial){ // obtaining the trial header edfapi::TRIAL current_header; if (edf_get_trial_header(edfFile, &current_header) != 0){ std::stringstream error_message_stream; error_message_stream << "Error obtaining the header for the trial " << iTrial+1; ::Rf_error(error_message_stream.str().c_str()); } // copying it over trial_headers(iTrial, 0) = iTrial+1; trial_headers(iTrial, 1) = current_header.duration; trial_headers(iTrial, 2) = current_header.starttime; trial_headers(iTrial, 3) = current_header.endtime; trial_headers(iTrial, 4) = current_header.rec->time; trial_headers(iTrial, 5) = current_header.rec->sample_rate ; trial_headers(iTrial, 6) = current_header.rec->eflags; trial_headers(iTrial, 7) = current_header.rec->sflags; trial_headers(iTrial, 8) = current_header.rec->state; trial_headers(iTrial, 9) = current_header.rec->record_type; trial_headers(iTrial,10) = current_header.rec->pupil_type; trial_headers(iTrial,11) = current_header.rec->recording_mode; trial_headers(iTrial,12) = current_header.rec->filter_type; trial_headers(iTrial,13) = current_header.rec->pos_type; trial_headers(iTrial,14) = current_header.rec->eye; } //' @title Appends event to the even structure //' @description Appends a new event to the even structure and copies all the data //' @param TRIAL_EVENTS &events, reference to the trial events structure //' @param FEVENT new_event, structure with event info, as described in the EDF API manual //' @param int iTrial, the index of the trial the event belongs to //' @param UINT32 trial_start, the timestamp of the trial start. //' Is used to compute event time relative to it. //' @return modifies events structure //' @keywords internal void append_event(TRIAL_EVENTS &events, edfapi::FEVENT new_event, unsigned int iTrial, edfapi::UINT32 trial_start){ events.trial_index.push_back(iTrial); events.time.push_back(new_event.time); events.type.push_back(new_event.type); events.read.push_back(new_event.read); events.sttime.push_back(new_event.sttime); events.sttime_rel.push_back(new_event.sttime-trial_start); events.entime.push_back(new_event.entime); if (new_event.entime>0){ events.entime_rel.push_back(new_event.entime-trial_start); } else { events.entime_rel.push_back(new_event.entime); } events.hstx.push_back(new_event.hstx); events.hsty.push_back(new_event.hsty); events.gstx.push_back(new_event.gstx); events.gsty.push_back(new_event.gsty); events.sta.push_back(new_event.sta); events.henx.push_back(new_event.henx); events.heny.push_back(new_event.heny); events.genx.push_back(new_event.genx); events.geny.push_back(new_event.geny); events.ena.push_back(new_event.ena); events.havx.push_back(new_event.havx); events.havy.push_back(new_event.havy); events.gavx.push_back(new_event.gavx); events.gavy.push_back(new_event.gavy); events.ava.push_back(new_event.ava); events.avel.push_back(new_event.avel); events.pvel.push_back(new_event.pvel); events.svel.push_back(new_event.svel); events.evel.push_back(new_event.evel); events.supd_x.push_back(new_event.supd_x); events.eupd_x.push_back(new_event.eupd_x); events.supd_y.push_back(new_event.supd_y); events.eupd_y.push_back(new_event.eupd_y); events.eye.push_back(new_event.eye); events.status.push_back(new_event.status); events.flags.push_back(new_event.flags); events.input.push_back(new_event.input); events.buttons.push_back(new_event.buttons); events.parsedby.push_back(new_event.parsedby); // special case: LSTRING message edfapi::LSTRING* message_ptr = ((edfapi::LSTRING*)new_event.message); if (message_ptr == 0 || message_ptr == NULL){ events.message.push_back(""); } else{ char* message_char = new char[message_ptr->len]; strncpy(message_char, &(message_ptr->c), message_ptr->len); events.message.push_back(message_char); delete[] message_char; } } //' @title Appends recording to the recording structure //' @description Appends a new recording to the recordings structure and copies all the data //' @param TRIAL_RECORDINGS &recordings, reference to the trial recording structure //' @param RECORDINGS new_rec, structure with recordiong info, as described in the EDF API manual //' @param int iTrial, the index of the trial the event belongs to //' @param UINT32 trial_start, the timestamp of the trial start. //' Is used to compute event time relative to it. //' @return modifies recordings structure //' @keywords internal void append_recording(TRIAL_RECORDINGS &recordings, edfapi::RECORDINGS new_rec, unsigned int iTrial, edfapi::UINT32 trial_start){ recordings.trial_index.push_back(iTrial+1); recordings.time.push_back(new_rec.time); recordings.time_rel.push_back(new_rec.time-trial_start); recordings.sample_rate.push_back(new_rec.sample_rate); recordings.eflags.push_back(new_rec.eflags); recordings.sflags.push_back(new_rec.sflags); recordings.state.push_back(new_rec.state); recordings.record_type.push_back(new_rec.record_type); recordings.pupil_type.push_back(new_rec.pupil_type); recordings.recording_mode.push_back(new_rec.recording_mode); recordings.filter_type.push_back(new_rec.filter_type); recordings.pos_type.push_back(new_rec.pos_type); recordings.eye.push_back(new_rec.eye); } //' @title Appends sample to the samples structure //' @description Appends a new sample to the samples structure and copies all the data //' @param TRIAL_SAMPLES &samples, reference to the trial samples structure //' @param FSAMPLE new_sample, structure with sample info, as described in the EDF API manual //' @param int iTrial, the index of the trial the event belongs to //' @param UINT32 trial_start, the timestamp of the trial start. Is used to compute event time relative to it. //' @param LogicalVector sample_attr_flag, boolean vector that indicates which sample fields are to be stored //' @return modifies samples structure //' @keywords internal void append_sample(TRIAL_SAMPLES &samples, edfapi::FSAMPLE new_sample, unsigned int iTrial, edfapi::UINT32 trial_start, LogicalVector sample_attr_flag) { samples.trial_index.push_back(iTrial+1); if (new_sample.flags & SAMPLE_LEFT) { if (new_sample.flags & SAMPLE_RIGHT) { samples.eye.push_back(2); } else { samples.eye.push_back(0); } } else { samples.eye.push_back(1); } if (sample_attr_flag[0]){ samples.time.push_back(new_sample.time); samples.time_rel.push_back(new_sample.time - trial_start); } if (sample_attr_flag[1]){ samples.pxL.push_back(float_or_nan(new_sample.px[0])); samples.pxR.push_back(float_or_nan(new_sample.px[1])); } if (sample_attr_flag[2]){ samples.pyL.push_back(float_or_nan(new_sample.py[0])); samples.pyR.push_back(float_or_nan(new_sample.py[1])); } if (sample_attr_flag[3]){ samples.hxL.push_back(float_or_nan(new_sample.hx[0])); samples.hxR.push_back(float_or_nan(new_sample.hx[1])); } if (sample_attr_flag[4]){ samples.hyL.push_back(float_or_nan(new_sample.hy[0])); samples.hyR.push_back(float_or_nan(new_sample.hy[1])); } if (sample_attr_flag[5]){ samples.paL.push_back(float_or_nan(new_sample.pa[0])); samples.paR.push_back(float_or_nan(new_sample.pa[1])); } if (sample_attr_flag[6]){ samples.gxL.push_back(float_or_nan(new_sample.gx[0])); samples.gxR.push_back(float_or_nan(new_sample.gx[1])); } if (sample_attr_flag[7]){ samples.gyL.push_back(float_or_nan(new_sample.gy[0])); samples.gyR.push_back(float_or_nan(new_sample.gy[1])); } if (sample_attr_flag[8]){ samples.rx.push_back(float_or_nan(new_sample.rx)); } if (sample_attr_flag[9]){ samples.ry.push_back(float_or_nan(new_sample.ry)); } if (sample_attr_flag[10]){ samples.gxvelL.push_back(float_or_nan(new_sample.gxvel[0])); samples.gxvelR.push_back(float_or_nan(new_sample.gxvel[1])); } if (sample_attr_flag[11]){ samples.gyvelL.push_back(float_or_nan(new_sample.gyvel[0])); samples.gyvelR.push_back(float_or_nan(new_sample.gyvel[1])); } if (sample_attr_flag[12]){ samples.hxvelL.push_back(float_or_nan(new_sample.hxvel[0])); samples.hxvelR.push_back(float_or_nan(new_sample.hxvel[1])); } if (sample_attr_flag[13]){ samples.hyvelL.push_back(float_or_nan(new_sample.hyvel[0])); samples.hyvelR.push_back(float_or_nan(new_sample.hyvel[1])); } if (sample_attr_flag[14]){ samples.rxvelL.push_back(float_or_nan(new_sample.rxvel[0])); samples.rxvelR.push_back(float_or_nan(new_sample.rxvel[1])); } if (sample_attr_flag[15]){ samples.ryvelL.push_back(float_or_nan(new_sample.ryvel[0])); samples.ryvelR.push_back(float_or_nan(new_sample.ryvel[1])); } if (sample_attr_flag[16]){ samples.fgxvelL.push_back(float_or_nan(new_sample.fgxvel[0])); samples.fgxvelR.push_back(float_or_nan(new_sample.fgxvel[1])); } if (sample_attr_flag[17]){ samples.fgyvelL.push_back(float_or_nan(new_sample.fgyvel[0])); samples.fgyvelR.push_back(float_or_nan(new_sample.fgyvel[1])); } if (sample_attr_flag[18]){ samples.fhxvelL.push_back(float_or_nan(new_sample.fhxvel[0])); samples.fhxvelR.push_back(float_or_nan(new_sample.fhxvel[1])); } if (sample_attr_flag[19]){ samples.fhyvelL.push_back(float_or_nan(new_sample.fhyvel[0])); samples.fhyvelR.push_back(float_or_nan(new_sample.fhyvel[1])); } if (sample_attr_flag[20]){ samples.frxvelL.push_back(float_or_nan(new_sample.frxvel[0])); samples.frxvelR.push_back(float_or_nan(new_sample.frxvel[1])); } if (sample_attr_flag[21]){ samples.fryvelL.push_back(float_or_nan(new_sample.fryvel[0])); samples.fryvelR.push_back(float_or_nan(new_sample.fryvel[1])); } if (sample_attr_flag[22]){ samples.hdata_1.push_back(new_sample.hdata[0]); samples.hdata_2.push_back(new_sample.hdata[1]); samples.hdata_3.push_back(new_sample.hdata[2]); samples.hdata_4.push_back(new_sample.hdata[3]); samples.hdata_5.push_back(new_sample.hdata[4]); samples.hdata_6.push_back(new_sample.hdata[5]); samples.hdata_7.push_back(new_sample.hdata[6]); samples.hdata_8.push_back(new_sample.hdata[7]); } if (sample_attr_flag[23]){ samples.flags.push_back(new_sample.flags); } if (sample_attr_flag[24]){ samples.input.push_back(new_sample.input); } if (sample_attr_flag[25]){ samples.buttons.push_back(new_sample.buttons); } if (sample_attr_flag[26]){ samples.htype.push_back(new_sample.htype); } if (sample_attr_flag[27]){ samples.errors.push_back(new_sample.errors); } } // Internal function that reads EDF file // //' @title Internal function that reads EDF file //' @description Reads EDF file into a list that contains events, samples, and recordings. //' DO NOT call this function directly. Instead, use read_edf function that implements //' parameter checks and additional postprocessing. //' @param std::string filename, full name of the EDF file //' @param int consistency, consistency check control (for the time stamps of the start //' and end events, etc). 0, no consistency check. 1, check consistency and report. //' 2, check consistency and fix. //' @param bool import_events, load/skip loading events. //' @param bool import_recordings, load/skip loading recordings. //' @param bool import_samples, load/skip loading of samples. //' @param LogicalVector sample_attr_flag, boolean vector that indicates which sample fields are to be stored //' @param std::string start_marker_string, event that marks trial start. Defaults to "TRIALID", if empty. //' @param std::string end_marker_string, event that marks trial end //' @param verbose, whether to show progressbar and report number of trials //' @export //' @keywords internal //' @return List, contents of the EDF file. Please see read_edf for details. //[[Rcpp::export]] List read_edf_file(std::string filename, int consistency, bool import_events, bool import_recordings, bool import_samples, LogicalVector sample_attr_flag, std::string start_marker_string, std::string end_marker_string, bool verbose){ // data storage TRIAL_EVENTS all_events; TRIAL_SAMPLES all_samples; TRIAL_RECORDINGS all_recordings; // collecting all message before the first recording // should contain service information, such as DISPLAY_COORDS edfapi::EDFFILE* edfFile = safely_open_edf_file(filename, consistency, 1, 0); for(bool keep_looking = true; keep_looking; ){ int DataType = edfapi::edf_get_next_data(edfFile); edfapi::ALLF_DATA* current_data = edfapi::edf_get_float_data(edfFile); switch(DataType){ case MESSAGEEVENT: append_event(all_events, current_data->fe, 0, 0); break; case RECORDING_INFO: // the recording has started, done with preliminaries keep_looking = false; break; } } edfapi::edf_close_file(edfFile); // opening the edf file to load info trial by trial edfFile = safely_open_edf_file(filename, consistency, import_events, import_samples); // set the trial navigation up set_trial_navigation_up(edfFile, start_marker_string, end_marker_string); // figure out, just how many trials we have unsigned int total_trials = edfapi::edf_get_trial_count(edfFile); if (verbose){ ::Rprintf("Trials count: %d\n", total_trials); } // creating headers, events, and samples NumericMatrix trial_headers = prepare_trial_headers(total_trials); // looping over the trials Progress trial_counter(total_trials, verbose); for(unsigned int iTrial = 0; iTrial< total_trials; iTrial++){ // visuals and interaction if (verbose){ if (Progress::check_abort() ){ break; } trial_counter.increment(); } jump_to_trial(edfFile, iTrial); // read headers read_trial_header(edfFile, trial_headers, iTrial); // read trial edfapi::ALLF_DATA* current_data; edfapi::UINT32 trial_start_time = trial_headers(iTrial, 2); edfapi::UINT32 trial_end_time = trial_headers(iTrial, 3); if (trial_end_time <= trial_start_time){ ::warning("Skipping trial %d due to zero or negative duration.", iTrial+1); continue; } bool TrialIsOver = false; edfapi::UINT32 data_timestamp = 0; for(int DataType = edfapi::edf_get_next_data(edfFile); (DataType != NO_PENDING_ITEMS) && !TrialIsOver; DataType = edfapi::edf_get_next_data(edfFile)){ // obtaining next data piece current_data = edfapi::edf_get_float_data(edfFile); switch(DataType){ case SAMPLE_TYPE: data_timestamp = current_data->fs.time; if (import_samples){ append_sample(all_samples, current_data->fs, iTrial, trial_start_time, sample_attr_flag); } break; case STARTPARSE: case ENDPARSE: case BREAKPARSE: case STARTBLINK: case ENDBLINK: case STARTSACC: case ENDSACC: case STARTFIX: case ENDFIX: case FIXUPDATE: case MESSAGEEVENT: case STARTSAMPLES: case ENDSAMPLES: case STARTEVENTS: case ENDEVENTS: case BUTTONEVENT: case INPUTEVENT: case LOST_DATA_EVENT: data_timestamp = current_data->fe.sttime; if (data_timestamp > trial_end_time) { TrialIsOver = true; break; } if (import_events){ append_event(all_events, current_data->fe, iTrial + 1, trial_start_time); } break; case RECORDING_INFO: data_timestamp = current_data->fe.time; if (import_recordings){ append_recording(all_recordings, current_data->rec, iTrial, trial_start_time); } break; case NO_PENDING_ITEMS: break; } // end of trial check if (data_timestamp > trial_end_time) break; } } // closing file edfapi::edf_close_file(edfFile); // returning data List edf_recording; edf_recording["headers"] = trial_headers; // converting structure of vectors into a data frame if (import_events){ DataFrame events; events["trial"] = all_events.trial_index; events["time"] = all_events.time; events["type"] = all_events.type; events["read"] = all_events.read; events["sttime"] = all_events.sttime; events["entime"] = all_events.entime; events["sttime_rel"] = all_events.sttime_rel; events["entime_rel"] = all_events.entime_rel; events["hstx"] = all_events.hstx; events["hsty"] = all_events.hsty; events["gstx"] = all_events.gstx; events["gsty"] = all_events.gsty; events["sta"] = all_events.sta; events["henx"] = all_events.henx; events["heny"] = all_events.heny; events["genx"] = all_events.genx; events["geny"] = all_events.geny; events["ena"] = all_events.ena; events["havx"] = all_events.havx; events["havy"] = all_events.havy; events["gavx"] = all_events.gavx; events["gavy"] = all_events.gavy; events["ava"] = all_events.ava; events["avel"] = all_events.avel; events["pvel"] = all_events.pvel; events["svel"] = all_events.svel; events["evel"] = all_events.evel; events["supd_x"] = all_events.supd_x; events["eupd_x"] = all_events.eupd_x; events["supd_y"] = all_events.supd_y; events["eupd_y"] = all_events.eupd_y; events["eye"] = all_events.eye; events["status"] = all_events.status; events["flags"] = all_events.flags; events["input"] = all_events.input; events["buttons"] = all_events.buttons; events["parsedby"] = all_events.parsedby; events["message"] = all_events.message; edf_recording["events"] = events; } if (import_recordings){ DataFrame recordings; recordings["trial_index"] = all_recordings.trial_index; recordings["time"] = all_recordings.time; recordings["time_rel"] = all_recordings.time_rel; recordings["sample_rate"] = all_recordings.sample_rate; recordings["eflags"] = all_recordings.eflags; recordings["sflags"] = all_recordings.sflags; recordings["state"] = all_recordings.state; recordings["record_type"] = all_recordings.record_type; recordings["pupil_type"] = all_recordings.pupil_type; recordings["recording_mode"] = all_recordings.recording_mode; recordings["filter_type"] = all_recordings.filter_type; recordings["pos_type"] = all_recordings.pos_type; recordings["eye"] = all_recordings.eye; edf_recording["recordings"] = recordings; } if (import_samples){ DataFrame samples; samples["trial"] = all_samples.trial_index; samples["eye"] = all_samples.eye; if (sample_attr_flag[0]){ samples["time"] = all_samples.time; samples["time_rel"] = all_samples.time_rel; } if (sample_attr_flag[1]){ samples["pxL"] = all_samples.pxL; samples["pxR"] = all_samples.pxR; } if (sample_attr_flag[2]){ samples["pyL"] = all_samples.pyL; samples["pyR"] = all_samples.pyR; } if (sample_attr_flag[3]){ samples["hxL"] = all_samples.hxL; samples["hxR"] = all_samples.hxR; } if (sample_attr_flag[4]){ samples["hyL"] = all_samples.hyL; samples["hyR"] = all_samples.hyR; } if (sample_attr_flag[5]){ samples["paL"] = all_samples.paL; samples["paR"] = all_samples.paR; } if (sample_attr_flag[6]){ samples["gxL"] = all_samples.gxL; samples["gxR"] = all_samples.gxR; } if (sample_attr_flag[7]){ samples["gyL"] = all_samples.gyL; samples["gyR"] = all_samples.gyR; } if (sample_attr_flag[8]){ samples["rx"] = all_samples.rx; } if (sample_attr_flag[9]){ samples["ry"] = all_samples.ry; } if (sample_attr_flag[10]){ samples["gxvelL"] = all_samples.gxvelL; samples["gxvelR"] = all_samples.gxvelR; } if (sample_attr_flag[11]){ samples["gyvelL"] = all_samples.gyvelL; samples["gyvelR"] = all_samples.gyvelR; } if (sample_attr_flag[12]){ samples["hxvelL"] = all_samples.hxvelL; samples["hxvelR"] = all_samples.hxvelR; } if (sample_attr_flag[13]){ samples["hyvelL"] = all_samples.hyvelL; samples["hyvelR"] = all_samples.hyvelR; } if (sample_attr_flag[14]){ samples["rxvelL"] = all_samples.rxvelL; samples["rxvelR"] = all_samples.rxvelR; } if (sample_attr_flag[15]){ samples["ryvelL"] = all_samples.ryvelL; samples["ryvelR"] = all_samples.ryvelR; } if (sample_attr_flag[16]){ samples["fgxvelL"] = all_samples.fgxvelL; samples["fgxvelR"] = all_samples.fgxvelR; } if (sample_attr_flag[17]){ samples["fgyvelL"] = all_samples.fgyvelL; samples["fgyvelR"] = all_samples.fgyvelR; } if (sample_attr_flag[18]){ samples["fhxvelL"] = all_samples.fhxvelL; samples["fhxvelR"] = all_samples.fhxvelR; } if (sample_attr_flag[19]){ samples["fhyvelL"] = all_samples.fhyvelL; samples["fhyvelR"] = all_samples.fhyvelR; } if (sample_attr_flag[20]){ samples["frxvelL"] = all_samples.frxvelL; samples["frxvelR"] = all_samples.frxvelR; } if (sample_attr_flag[21]){ samples["fryvelL"] = all_samples.fryvelL; samples["fryvelR"] = all_samples.fryvelR; } if (sample_attr_flag[22]){ samples["hdata_1"] = all_samples.hdata_1; samples["hdata_2"] = all_samples.hdata_2; samples["hdata_3"] = all_samples.hdata_3; samples["hdata_4"] = all_samples.hdata_4; samples["hdata_5"] = all_samples.hdata_5; samples["hdata_6"] = all_samples.hdata_6; samples["hdata_7"] = all_samples.hdata_7; samples["hdata_8"] = all_samples.hdata_8; } if (sample_attr_flag[23]){ samples["flags"] = all_samples.flags; } if (sample_attr_flag[24]){ samples["input"] = all_samples.input; } if (sample_attr_flag[25]){ samples["buttons"] = all_samples.buttons; } if (sample_attr_flag[26]){ samples["htype"] = all_samples.htype; } if (sample_attr_flag[27]){ samples["errors"] = all_samples.errors; } edf_recording["samples"] = samples; } edf_recording.attr("class") = "edf"; return (edf_recording); }
a4c60fa3a6032ab85929948ef52db4bda9aba342
bf0fc2c649e63ec18407430e8706aaa4ade16d35
/Projects/МШП/ParallProg/future.cpp
811d568a3aca74e5c00b6e7c271aeebcda039a8e
[]
no_license
TheZaychik/TheZaychikArchive
f43d3b95733f5c60179796a1b6ff1de4a9dab151
9dbfb0b753103488d0066db566f374be15077927
refs/heads/master
2021-05-07T00:09:29.138101
2021-02-04T14:58:55
2021-02-04T14:58:55
110,042,519
2
1
null
null
null
null
UTF-8
C++
false
false
548
cpp
future.cpp
#include <iostream> #include <thread> #include <future> bool isPrime(int x){ for(int i = 2; i<=x/2; i++){ if(x% i == 0){ return false; } } return true; } int main(){ std::packaged_task<bool(int)> task(isPrime); //task(5); std::future<bool> future = task.get_future(); std::thread t(std::move(task),121); t.detach(); bool res = future.get(); if(res){ std::cout << "is prime" << std::endl; } else { std::cout << "not prime" << std::endl; } return 0; };
ea61e02b4e14a32f6d0772707e13421763dbc356
9aaa228f886f2267b7b2de34a664e56c85440cf9
/Clase/sobrecarga_operadores.cpp
aeda93747049a7bdff40f2edc2af3074a3acb8ae
[]
no_license
Losnen/AEDA
4b08ed183676509800ccf8f76a04a41fb4d852df
e24a3c2942862eac0c3aeef597a9d2fec9b21119
refs/heads/master
2020-04-09T12:19:22.671017
2016-05-11T07:49:48
2016-05-11T07:49:48
52,212,012
1
0
null
null
null
null
UTF-8
C++
false
false
2,762
cpp
sobrecarga_operadores.cpp
//Sobrecarga de operador [] para el vector TDATO& operator[](void) { return v_[pos]; } TDATO& operator[](void) const //Procedimiento para vectores constantes. { return v_[pos]; } //Sobrecarga de operador * TDATO operator*(const vector_t& v) { TDATO prod = 0; for(int i = 0; i < sz_; i++) { prod+= v_[i] * v[i] } return prod; } //Sobrecarga del operador + TDATO operator+(const vector_t& v) { vector_t aux(sz_); for(int i = 0; i < sz_; i++) { aux[i] = v_[i] + v[i] } return prod; } //Sobrecarga del operador < bool operator<(const vector& v) { bool menor = true; int i = 0; while((i< sz_) && menor) { menor = v_[i] < v[i]; i++; } return menor; } class matrix_t { private: TDATO* M_; int m_; int n_; public: matrix_t(void); matrix_t(int n, int m); int pos(int i, int j); void redimensiona(int i, int j); void crear_matrix(void); void destruye_matrix(void); TDATO& operator()(int i, int j) //Operador () similar al operador [], () Permite varias declaraciones. { return M_[pos(i,j)]; } TDATO& operator()(int i, int j) const { return M_[pos(i,j)]; } /* int main (void) { matrix_t A(10,10); A(1,1) = 25; A(1,2) = 36; A(1,3) = 49; } */ ostream& operator <<(ostream& os) { for(int i = 1; i<=m_; i++) { for(int i = 1; i<=m_; i++) { os << setw(10) << fixed << setprecision(4) << M_[pos(i,j)]; } os << endl; } return os; } istream& operator >>(istream& is) { is >> m_ >> n_; redimensiona(n_,m_); for(int i = 1; i<=m_; i++) { is >> M_[i]; } return is; } //Las sobrecargas de operadores se pueden hacer en la clase o mediante funciones friend por fuera de la clase matrix_t operator A(const matrix_t& M) { matrix_t Aux(m_,M_.get_n()); for(int i = 1; i<=m_; i++) { for(int i = 1; i<=m_; i++) { TDATO aux1 = 0; for(int k = i; k<=n_; k++) { aux1+= M_[pos(i,k)]; Aux(i,j) = aux1; } } } return Aux; } };
73669d925ee7e1acbc4f946702bb660b744daf58
c28939feb2193929b27f9c0ddf2a03d20b4067b3
/Source/ZombieHomeInvasion/ZombieGameModeBase.h
d66972fe79cb255dd3df83b9f446aca9c2ff99da
[]
no_license
alnye655321/ZombieHomeInvasionVR
f2c1a4703f466527fe78fa0a45bc66fe33b8dfde
886b74dd5545b133230a724461df6d13e083b6dc
refs/heads/master
2021-01-09T06:52:04.819558
2017-02-06T17:08:17
2017-02-06T17:08:17
81,108,639
0
1
null
null
null
null
UTF-8
C++
false
false
1,117
h
ZombieGameModeBase.h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "GameFramework/GameModeBase.h" #include "ZombieGameModeBase.generated.h" /** * */ UCLASS() class ZOMBIEHOMEINVASION_API AZombieGameModeBase : public AGameModeBase { GENERATED_BODY() public: AZombieGameModeBase(); virtual void Tick(float DeltaTime) override; UFUNCTION(BlueprintCallable, Category = "Game State") void SetGameOver(bool bGameOver); // function to end the game, can be called in blueprints // state of zombie windows UFUNCTION(BlueprintCallable, Category = "Game State") void SetZombieWindowDeath(bool ZombieWindowStatus); UFUNCTION(BlueprintCallable, Category = "Game State") bool GetZombieWindowDeath(); bool GetGameIsOver(); // check if game is over float Time = 0.f; UFUNCTION() float GetGameTime(); FString ConvertTime(); private: int32 Score = 0; int32 TargetsShot = 0; int32 PointsToFinish = 0; bool bGameIsOver = true; // default game is over, until player starts it bool bZombieWindowsDestroyed; // used to trigger zombies seeking player };
b3daef64ed269970708c102e8718d34a529ab191
530484f29dd881501aa0cc6549af507568079ae3
/Tenkici.cpp
ee9b4ae7ef0bf157c9d59323c223d9d291958cd3
[]
no_license
marko1597/Programming-competitions
c89500b7d9747290247e95268727bafa947a7b50
192574924fee8c2a5b2e229ad23c8e8c02d7fc66
refs/heads/master
2016-08-09T21:03:53.044305
2015-11-07T16:40:34
2015-11-07T16:40:34
44,918,803
0
0
null
null
null
null
UTF-8
C++
false
false
2,289
cpp
Tenkici.cpp
#include <cstdio> #include <cstring> #include <iostream> #include <math.h> #include <string> #include <sstream> #include <iomanip> #include <stdio.h> #include <stdlib.h> #include <ctime> #include <time.h> #include <string.h> #include <algorithm> #include <queue> #include <stack> #include <vector> #include <map> #include <set> using namespace std; const int maxn = 550; int id = 0; struct point{ int x, y, ind; point(){ x = y = ind = -1; } point( int a, int b ){ x = a, y = b; } void ucitaj(){ scanf("%d %d", &x, &y); ind = id++; } }; bool inds( point a, point b ){ return a.ind < b.ind; } point niz[maxn]; int ans = 0, tx[maxn], ty[maxn]; int abss( int n ){ if( n < 0 ) return -n; return n; } int main(){ int n, dd, pp; scanf("%d", &n); for( int x = 0; x < n; x++ ) niz[x].ucitaj(); for( int x = 0; x < n; x++ ){ dd = 1 << 30; pp = 0; for( int i = x; i < n; i++ ){ if( dd > abss( x +1 - niz[i].x ) ){ dd = abss( x +1 - niz[i].x ); pp = i; } } swap( niz[x], niz[pp] ); } for( int x = 0; x < n; x++ ) tx[ niz[x].ind ] = x +1; for( int x = 0; x < n; x++ ){ dd = 1 << 30; pp = 0; for( int i = x; i < n; i++ ){ if( dd > abss( x +1 - niz[i].y ) ){ dd = abss( x +1 - niz[i].y ); pp = i; } } swap( niz[x], niz[pp] ); } for( int x = 0; x < n; x++ ) ty[ niz[x].ind ] = x +1; sort( niz, niz + n, inds ); for( int x = 0; x < n; x++ ) ans += abss( niz[x].x - tx[x] ) + abss( niz[x].y - ty[x] ); printf("%d\n", ans); for( int x = 0; x < n; x++ ){ if( niz[x].x - tx[x] >= 0 ) for( int i = 0; i < niz[x].x - tx[x]; i++ ) printf("%d L\n", x +1 ); else for( int i = 0; i < -niz[x].x + tx[x]; i++ ) printf("%d R\n", x +1 ); if( niz[x].y - ty[x] >= 0 ) for( int i = 0; i < niz[x].y - ty[x]; i++ ) printf("%d U\n", x +1 ); else for( int i = 0; i < -niz[x].y + ty[x]; i++ ) printf("%d D\n", x +1 ); } }
16ed98885b462a8f01908431dccde33349b552a0
9006cf2da93332cf3b5eb8cc9f43b1a7413bb6ad
/atomSim/include/AtomWrapper.h
a955c41723735c7b5be0b7dd841ca437d266ba2f
[]
no_license
ErikEckenberg/AtomSim
22a7fe2c6febc9281cfb20e6e959c7483d653baa
75b0947af2c17483ff4dc6f6133824f5ea42a6d5
refs/heads/master
2020-12-08T05:12:27.688145
2020-01-09T20:11:53
2020-01-09T20:11:53
232,895,538
0
0
null
null
null
null
UTF-8
C++
false
false
1,009
h
AtomWrapper.h
#ifndef ATOMWRAPPER_H #define ATOMWRAPPER_H #include <vector> #include <utility> #include <iostream> #include <SFML/Graphics.hpp> #include "atom.h" class atom; class AtomWrapper { public: AtomWrapper(); AtomWrapper(int, sf::RenderWindow*); void create(int, sf::RenderWindow*); virtual ~AtomWrapper(); void tick(sf::Time, sf::RenderWindow*); void mouseRepel(sf::Time, sf::RenderWindow*, float); void mouseAttract(sf::Time, sf::RenderWindow*, float); void setResistance(float r){resistance = r;}; void resetResistance(){resistance = baseResistance;}; void updateThread(const sf::Time*, sf::RenderWindow*, int i); protected: private: float resistance; //natural slowdown of atoms due to float baseResistance; std::vector<atom> atomVec; std::pair<int, int> factors(int); }; #endif // ATOMWRAPPER_H
c9dc23c411cf22d04239eb39674673a14f4407bf
7f62f204ffde7fed9c1cb69e2bd44de9203f14c8
/DboClient/Lib/NtlSimulation/NtlSobWorldItemProxy.cpp
513a88bcbbf00075384546f73741190541f99b5d
[]
no_license
4l3dx/DBOGLOBAL
9853c49f19882d3de10b5ca849ba53b44ab81a0c
c5828b24e99c649ae6a2953471ae57a653395ca2
refs/heads/master
2022-05-28T08:57:10.293378
2020-05-01T00:41:08
2020-05-01T00:41:08
259,094,679
3
3
null
2020-04-29T17:06:22
2020-04-26T17:43:08
null
UHC
C++
false
false
5,672
cpp
NtlSobWorldItemProxy.cpp
#include "precomp_ntlsimulation.h" #include "NtlSobWorldItemProxy.h" // shared #include "ItemTable.h" #include "TableContainer.h" #include "DragonBallTable.h" // core #include "NtlMath.h" //// presentation #include "NtlPLSceneManager.h" #include "NtlPLItem.h" // simulation #include "NtlSLEvent.h" #include "NtlSob.h" #include "NtlSobWorldItem.h" #include "NtlSobWorldItemAttr.h" #include "NtlSLLogic.h" #include "NtlSLApi.h" #define WORLDITEM_MODELNAME_NORMAL "I_DRP_01" #define WORLDITEM_MODELNAME_SUPERIOR "I_DRP_02" #define WORLDITEM_MODELNAME_EXCELLENT "I_DRP_07" #define WORLDITEM_MODELNAME_RARE "I_DRP_03" #define WORLDITEM_MODELNAME_LEGENDARY "I_DRP_04" #define WORLDITEM_MODELNAME_ETC "I_DRP_05" #define WORLDITEM_MODELNAME_UNIDENTIFIED "I_DRP_06" #define WORLDITEM_MODELNAME_MONEY_SMALL "I_DRP_11" #define WORLDITEM_MODELNAME_MONEY_NORMAL "I_DRP_12" #define WORLDITEM_MODELNAME_MONEY_BIG "I_DRP_13" #define WORLDITEM_MODELNAME_DRANGONBALL_BASIC "I_DRP_21" #define WORLDITEM_MODELNAME_DRANGONBALL_NORMAL "I_DRP_22" DEFINITION_MEMORY_POOL( CNtlSobWorldItemProxy ) CNtlSobWorldItemProxy::CNtlSobWorldItemProxy() { m_pWorldItem = NULL; } CNtlSobWorldItemProxy::~CNtlSobWorldItemProxy() { } RwBool CNtlSobWorldItemProxy::Create(RwUInt32 uiCompType) { CNtlSobProxy::Create(uiCompType); return TRUE; } /*Human_Male*/ VOID CNtlSobWorldItemProxy::Destroy(VOID) { DeletePLWorldItem(); CNtlSobProxy::Destroy(); } VOID CNtlSobWorldItemProxy::HandleEvents( RWS::CMsg &pMsg ) { if( pMsg.Id == g_EventSobCreate ) { CreatePLWorldItem( pMsg ); } else if(pMsg.Id == g_EventSobGotFocus) { m_pWorldItem->SetAddColor(40, 40, 40); } else if(pMsg.Id == g_EventSobLostFocus) { m_pWorldItem->SetAddColor(0, 0, 0); } } VOID CNtlSobWorldItemProxy::CreatePLWorldItem( RWS::CMsg& msg ) { NTL_FUNCTION("CNtlSobWorldItemProxy::CreatePLWorldItem"); RwChar* szModelName = NULL; CNtlSobWorldItemAttr* pAttr = reinterpret_cast<CNtlSobWorldItemAttr*>( m_pSobObj->GetSobAttr() ); if( pAttr->IsItem() ) { if( pAttr->IsIdentified() ) { if( pAttr->IsDragonBall() ) { // 드래곤볼 타입을 판단한다. sITEM_TBLDAT* pTblDat = pAttr->GetItemTbl(); if(!pTblDat) return; CDragonBallTable* pDBTable = API_GetTableContainer()->GetDragonBallTable(); if(!pDBTable) return; eDRAGON_BALL_TYPE byType = pDBTable->GetDropItemType(pTblDat->tblidx); // NTL_ASSERT(byType != DRAGON_BALL_TYPE_NONE, __FUNCTION__ << "DragonBall Drop Type Invalid" ); if (byType == DRAGON_BALL_TYPE_NONE) // by daneos { szModelName = WORLDITEM_MODELNAME_DRANGONBALL_BASIC; } else if (byType == DRAGON_BALL_TYPE_BASIC) { szModelName = WORLDITEM_MODELNAME_DRANGONBALL_BASIC; } else if(byType == DRAGON_BALL_TYPE_NORMAL) { szModelName = WORLDITEM_MODELNAME_DRANGONBALL_NORMAL; } else { szModelName = WORLDITEM_MODELNAME_DRANGONBALL_NORMAL; // to do: set model-name depending on the amount of db stars } } else { switch( pAttr->GetRank() ) { case ITEM_RANK_NOTHING: szModelName = WORLDITEM_MODELNAME_ETC; break; case ITEM_RANK_NORMAL: szModelName = WORLDITEM_MODELNAME_NORMAL; break; case ITEM_RANK_SUPERIOR: szModelName = WORLDITEM_MODELNAME_SUPERIOR; break; case ITEM_RANK_EXCELLENT: szModelName = WORLDITEM_MODELNAME_EXCELLENT; break; case ITEM_RANK_RARE: szModelName = WORLDITEM_MODELNAME_RARE; break; case ITEM_RANK_LEGENDARY: szModelName = WORLDITEM_MODELNAME_LEGENDARY; break; } } } else { szModelName = WORLDITEM_MODELNAME_UNIDENTIFIED; } } else if( pAttr->IsMoney() ) { if( pAttr->GetMoney() < 101 ) { szModelName = WORLDITEM_MODELNAME_MONEY_SMALL; } else if( pAttr->GetMoney() < 301 ) { szModelName = WORLDITEM_MODELNAME_MONEY_NORMAL; } else { szModelName = WORLDITEM_MODELNAME_MONEY_BIG; } } else NTL_ASSERTFAIL( "World Item type is worng" ); m_pWorldItem = static_cast<CNtlPLItem*>( GetSceneManager()->CreateEntity( PLENTITY_ITEM, szModelName ) ); NTL_ASSERT( m_pWorldItem, "world item proxy is NULL : " << szModelName ); if(!m_pWorldItem) NTL_RETURNVOID(); m_pWorldItem->SetSerialID( m_pSobObj->GetSerialID() ); NTL_RETURNVOID(); } VOID CNtlSobWorldItemProxy::DeletePLWorldItem(VOID) { // pl character destroy if( m_pWorldItem ) { GetSceneManager()->DeleteEntity( m_pWorldItem ); m_pWorldItem = NULL; } } void CNtlSobWorldItemProxy::AddWorld(void) { if(m_pWorldItem) m_pWorldItem->AddWorld(); } void CNtlSobWorldItemProxy::RemoveWorld(void) { if(m_pWorldItem) m_pWorldItem->RemoveWorld(); } void CNtlSobWorldItemProxy::SetBaseAnimation(RwUInt32 uiAnimKey, RwBool bLoop /*= TRUE*/, RwReal fStartTime /*= 0.0f*/) { if(m_pWorldItem) m_pWorldItem->SetAnimation(uiAnimKey, fStartTime, bLoop); } VOID CNtlSobWorldItemProxy::SetPosition(const RwV3d *pPos) { if(m_pWorldItem) { m_pWorldItem->SetPosition(pPos); } } VOID CNtlSobWorldItemProxy::SetDirection(const RwV3d *pDir) { if(m_pWorldItem) { RwReal fAngle = CNtlMath::LineToAngleY(pDir); m_pWorldItem->SetRotate( 0.0f, fAngle, 0.0f ); } } VOID CNtlSobWorldItemProxy::SetAngleY(RwReal fAngle) { if(m_pWorldItem) { m_pWorldItem->SetRotate( 0.0f, fAngle, 0.0f ); } } VOID CNtlSobWorldItemProxy::EnableVisible(RwBool bEnable) { CNtlSobProxy::EnableVisible(bEnable); if( m_pWorldItem ) { m_pWorldItem->SetVisible( bEnable ); } }
e6ea90120e76b5912dee390eea929b08b3d245f9
857c93453823f95a2460d854ac79c0ac69f7c976
/include/envvars/MissingRequiredEnvVarImpls.hpp
7a419d5b2d9cb9b7d729ae27ca60eb95a948881c
[]
no_license
gspatace/genapputils
84cc1a312f19a47d79c4b3addb7d37ff9c456bd7
45b77eddff1f009f785a0322ff9f952e467ac2dd
refs/heads/develop
2021-08-03T03:09:53.746595
2020-02-21T20:03:58
2020-02-21T20:45:31
162,253,554
0
0
null
2020-04-06T19:31:24
2018-12-18T08:14:14
C++
UTF-8
C++
false
false
927
hpp
MissingRequiredEnvVarImpls.hpp
#pragma once #include <iostream> #include <sstream> #include "IMissingRequiredEnvVarStrategy.hpp" template<typename ExType> class ExceptionThrowerMissingRequiredHandler : public IMissingRequiredEnvVarStrategy { public: virtual void HandleMissingRequiredEnvVar(const std::string& EnvVarName) override { std::ostringstream oss; oss << "Environment Variable <"; oss << EnvVarName; oss << "> was registred as Required, but is missing."; throw ExType(oss.str()); } }; class StdErrLoggerMissingRequiredEnvVarHandler : public IMissingRequiredEnvVarStrategy { public: virtual void HandleMissingRequiredEnvVar(const std::string& EnvVarName) override { std::ostringstream oss; oss << "Environment Variable <"; oss << EnvVarName; oss << "> was registred as Required, but is missing."; std::cerr << oss.str() << std::endl; } };
b1f20ad464aea61683e3268f304df349bafe62cd
fd155c9bcbb6550264fb6d1ef19a882122f7845e
/CheckFrequency.cpp
cfafb36d51a7b3e58fd0de3bf8e21cabb7b0f3d6
[]
no_license
KenlyBerkowitz/burma-training
dbc12faf3765328bc67a05e8870abd9a693a1c0f
fc4545d75ef5a2c9845d4801cc6217500531f412
refs/heads/master
2021-04-23T06:55:57.718491
2020-04-12T21:52:53
2020-04-12T21:52:53
249,907,649
1
0
null
null
null
null
UTF-8
C++
false
false
1,244
cpp
CheckFrequency.cpp
#include "CheckFrequency.h" #include <iostream> #include <string> using namespace std; CheckFrequency::CheckFrequency(struct MenuItems anItem[], int size) { initArr(anItem, size); } CheckFrequency::~CheckFrequency() { delete [] arrFreq; //deletes memory and frees pointer arrFreq = nullptr; } //initializes the dynamically allocated array to zeros and 5 to dishes with no name void CheckFrequency::initArr(struct MenuItems anItem[], int size) { arrFreq = new int[size]; for(int i = 0; i < size; i++) { arrFreq[i] = 0; if(anItem[i].dishName == "No Dish Name") arrFreq[i] = 5; } } bool CheckFrequency::checkFreq(struct MenuItems anItem[], int num, int size) { int i = 0; bool flag = true; //checks whether the item num index is less than 5 and if it is not, Return true to keep looping through random number generator if(arrFreq[num] < 5) { arrFreq[num]++; while(i < size) { if(arrFreq[i] < 5) flag = false; i++; } if(flag == true) //if all numbers is equal to 5, flag is true and the memory from arrFreq is deleted and reinitialize the array { delete [] arrFreq; initArr(anItem, size); } return false; } else return true; }
23689795c6062decd61637ea0a0608bdd2eb13f8
2153c572a578bd13aec501a34ebcbef9d31aa187
/Baseclass/ScopeGuard.h
7da2350a5a1da7b968ad78a655af32434cd2c64f
[]
no_license
ZcHuer/LMPlayer
e579f0718e61789cc15d77b4976379276813085c
da2fe595a8121b3d3c2feec91c461a38d9909bca
refs/heads/master
2022-04-09T22:07:15.900773
2020-03-17T08:10:19
2020-03-17T08:10:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
403
h
ScopeGuard.h
#ifndef __SCOPE_GUARD_H__ #define __SCOPE_GUARD_H__ #pragma once #include <functional> class ScopeGuard { public: ScopeGuard(std::function<void(void)> func) : m_func(func), m_dismissed(false) {}; ~ScopeGuard() { if (!m_dismissed && m_func) { m_func(); } } void Dismiss() const { m_dismissed = true; } private: mutable bool m_dismissed; std::function<void(void)> m_func; }; #endif
484afdb5c4ad866c45fa4ea3a958a271c8125aa4
722df9e9edb92b28e6f63531189afebc86b748bf
/LNKWallet/guard/GuardKeyManagePage.cpp
864d3ae245a13fd098b11bc0014bd6778b372517
[ "MIT" ]
permissive
HcashOrg/hx-indicator
96669156e9b948f312f1e86acaa2939a0fa4e7e8
55b6b23ca5bf720c253a9da36cec3a73c489f308
refs/heads/master
2021-07-06T19:01:00.705155
2020-08-05T07:15:49
2020-08-05T07:15:49
137,836,449
8
7
null
null
null
null
UTF-8
C++
false
false
13,410
cpp
GuardKeyManagePage.cpp
#include "GuardKeyManagePage.h" #include "ui_GuardKeyManagePage.h" #include "wallet.h" #include "control/AssetIconItem.h" #include "showcontentdialog.h" #include "ToolButtonWidget.h" #include "GuardKeyUpdatingInfoDialog.h" #include "dialog/checkpwddialog.h" #include "commondialog.h" #include "dialog/TransactionResultDialog.h" #include "dialog/ErrorResultDialog.h" #include "AssetChangeHistoryWidget.h" #include "ChangeCrosschainAddressDialog.h" #include "ColdKeyPathDialog.h" static const int ROWNUMBER = 7; GuardKeyManagePage::GuardKeyManagePage(QWidget *parent) : QWidget(parent), ui(new Ui::GuardKeyManagePage) { ui->setupUi(this); connect( HXChain::getInstance(), SIGNAL(jsonDataUpdated(QString)), this, SLOT(jsonDataUpdated(QString))); ui->multisigTableWidget->installEventFilter(this); ui->multisigTableWidget->setSelectionMode(QAbstractItemView::NoSelection); ui->multisigTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->multisigTableWidget->setFocusPolicy(Qt::NoFocus); // ui->multisigTableWidget->setFrameShape(QFrame::NoFrame); ui->multisigTableWidget->setMouseTracking(true); ui->multisigTableWidget->setShowGrid(false);//隐藏表格线 ui->multisigTableWidget->horizontalHeader()->setSectionsClickable(true); // ui->multisigTableWidget->horizontalHeader()->setFixedHeight(40); ui->multisigTableWidget->horizontalHeader()->setVisible(true); ui->multisigTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); ui->multisigTableWidget->setColumnWidth(0,120); ui->multisigTableWidget->setColumnWidth(1,140); ui->multisigTableWidget->setColumnWidth(2,140); ui->multisigTableWidget->setColumnWidth(3,100); ui->multisigTableWidget->setColumnWidth(4,70); ui->multisigTableWidget->setColumnWidth(5,80); ui->multisigTableWidget->setStyleSheet(TABLEWIDGET_STYLE_1); ui->historyBtn->setStyleSheet(TOOLBUTTON_STYLE_1); ui->importBtn->setStyleSheet(TOOLBUTTON_STYLE_1); ui->changeAddressBtn->setStyleSheet(TOOLBUTTON_STYLE_1); pageWidget = new PageScrollWidget(); ui->stackedWidget->addWidget(pageWidget); connect(pageWidget,&PageScrollWidget::currentPageChangeSignal,this,&GuardKeyManagePage::pageChangeSlot); blankWidget = new BlankDefaultWidget(ui->multisigTableWidget); blankWidget->setTextTip(tr("There are no records!")); init(); } GuardKeyManagePage::~GuardKeyManagePage() { delete ui; } void GuardKeyManagePage::init() { inited = false; ui->accountComboBox->clear(); QStringList accounts = HXChain::getInstance()->getMyFormalGuards(); if(accounts.size() > 0) { ui->accountComboBox->addItems(accounts); if(accounts.contains(HXChain::getInstance()->currentAccount)) { ui->accountComboBox->setCurrentText(HXChain::getInstance()->currentAccount); } } else { ui->label->hide(); ui->accountComboBox->hide(); QLabel* label = new QLabel(this); label->setGeometry(QRect(ui->label->pos(), QSize(300,18))); label->setText(tr("There are no senator accounts in the wallet.")); } HXChain::getInstance()->mainFrame->installBlurEffect(ui->multisigTableWidget); showMultisigInfo(); inited = true; } void GuardKeyManagePage::showMultisigInfo() { QStringList assetIds = HXChain::getInstance()->assetInfoMap.keys(); assetIds.removeAll("1.3.0"); // 不显示HX int size = assetIds.size(); ui->multisigTableWidget->setRowCount(0); ui->multisigTableWidget->setRowCount(size); for(int i = 0; i < size; i++) { ui->multisigTableWidget->setRowHeight(i,40); AssetInfo assetInfo = HXChain::getInstance()->assetInfoMap.value(assetIds.at(i)); //资产名 QString symbol = assetInfo.symbol; ui->multisigTableWidget->setItem(i,0,new QTableWidgetItem(symbol)); ui->multisigTableWidget->setItem(i,1,new QTableWidgetItem(assetInfo.hotAddress)); ui->multisigTableWidget->setItem(i,2,new QTableWidgetItem(assetInfo.coldAddress)); ui->multisigTableWidget->setItem(i,3,new QTableWidgetItem(QString::number(assetInfo.effectiveBlock))); QStringList guardAccountIds = HXChain::getInstance()->getInstance()->getAssetMultisigUpdatedGuards(symbol); if(guardAccountIds.isEmpty()) { ui->multisigTableWidget->setItem(i,4,new QTableWidgetItem(tr("no update"))); } else { ui->multisigTableWidget->setItem(i,4,new QTableWidgetItem(tr("updating"))); ToolButtonWidget *toolButton = new ToolButtonWidget(); toolButton->setText(ui->multisigTableWidget->item(i,4)->text()); ui->multisigTableWidget->setCellWidget(i,4,toolButton); connect(toolButton,&ToolButtonWidget::clicked,std::bind(&GuardKeyManagePage::on_multisigTableWidget_cellClicked,this,i,4)); } if(ui->accountComboBox->currentText().isEmpty()) { ui->multisigTableWidget->setItem(i,5,new QTableWidgetItem(tr("no senator"))); } else { QString accountId = HXChain::getInstance()->allGuardMap.value(ui->accountComboBox->currentText()).accountId; if(guardAccountIds.contains(accountId)) { ui->multisigTableWidget->setItem(i,5,new QTableWidgetItem(tr("updated"))); ToolButtonWidget *toolButton = new ToolButtonWidget(); toolButton->setText(ui->multisigTableWidget->item(i,5)->text()); toolButton->setEnabled(false); ui->multisigTableWidget->setCellWidget(i,5,toolButton); connect(toolButton,&ToolButtonWidget::clicked,std::bind(&GuardKeyManagePage::on_multisigTableWidget_cellClicked,this,i,5)); } else { ui->multisigTableWidget->setItem(i,5,new QTableWidgetItem(tr("update"))); ToolButtonWidget *toolButton = new ToolButtonWidget(); toolButton->setText(ui->multisigTableWidget->item(i,5)->text()); ui->multisigTableWidget->setCellWidget(i,5,toolButton); connect(toolButton,&ToolButtonWidget::clicked,std::bind(&GuardKeyManagePage::on_multisigTableWidget_cellClicked,this,i,5)); } } AssetIconItem* assetIconItem = new AssetIconItem(); assetIconItem->setAsset(ui->multisigTableWidget->item(i,0)->text()); ui->multisigTableWidget->setCellWidget(i, 0, assetIconItem); } tableWidgetSetItemZebraColor(ui->multisigTableWidget); int page = (ui->multisigTableWidget->rowCount()%ROWNUMBER==0 && ui->multisigTableWidget->rowCount() != 0) ? ui->multisigTableWidget->rowCount()/ROWNUMBER : ui->multisigTableWidget->rowCount()/ROWNUMBER+1; pageWidget->SetTotalPage(page); pageWidget->setShowTip(ui->multisigTableWidget->rowCount(),ROWNUMBER); pageChangeSlot(pageWidget->GetCurrentPage()); pageWidget->setVisible(0 != ui->multisigTableWidget->rowCount()); blankWidget->setVisible(ui->multisigTableWidget->rowCount() == 0); } void GuardKeyManagePage::refresh() { showMultisigInfo(); } void GuardKeyManagePage::jsonDataUpdated(QString id) { if( id.startsWith("id-update_asset_private_keys")) { QString result = HXChain::getInstance()->jsonDataValue(id); qDebug() << id << result; if( result.startsWith("\"result\":{")) // 成功 { TransactionResultDialog transactionResultDialog; transactionResultDialog.setInfoText(tr("Transaction of updating multisig-address has been sent,please wait for confirmation")); transactionResultDialog.setDetailText(result); transactionResultDialog.pop(); } else { ErrorResultDialog errorResultDialog; if(result.contains("AES error:")) { errorResultDialog.setInfoText(tr("Wrong password!")); } else { errorResultDialog.setInfoText(tr("Failed!")); } errorResultDialog.setDetailText(result); errorResultDialog.pop(); } return; } if( id == "finish-import_crosschain_key") { CommonDialog commonDialog(CommonDialog::OkOnly); commonDialog.setText(tr("The cross-chain keys has already imported.")); commonDialog.pop(); } if( id == "id-import_crosschain_key") { QString result = HXChain::getInstance()->jsonDataValue(id); // qDebug() << id << result; } } void GuardKeyManagePage::paintEvent(QPaintEvent *) { QPainter painter(this); painter.setPen(QPen(QColor(229,226,240),Qt::SolidLine)); painter.setBrush(QBrush(QColor(229,226,240),Qt::SolidPattern)); painter.drawRect(rect()); } void GuardKeyManagePage::on_multisigTableWidget_cellClicked(int row, int column) { if(column == 4) { if(ui->multisigTableWidget->item(row,4)->text() != tr("updating")) return; GuardKeyUpdatingInfoDialog guardKeyUpdatingInfoDialog; guardKeyUpdatingInfoDialog.setAsset(ui->multisigTableWidget->item(row,0)->text()); guardKeyUpdatingInfoDialog.pop(); return; } if(column == 5) { if(ui->accountComboBox->currentText().isEmpty()) return; if(ui->multisigTableWidget->item(row,5)->text() != tr("update")) return; QString assetSymbol = ui->multisigTableWidget->item(row,0)->text(); ColdKeyPathDialog coldKeyPathDialog(ui->accountComboBox->currentText()); coldKeyPathDialog.pop(); if(!coldKeyPathDialog.filePath.isEmpty() && !coldKeyPathDialog.pwd.isEmpty()) { HXChain::getInstance()->postRPC( "id-update_asset_private_keys", toJsonFormat( "update_asset_private_keys", QJsonArray() << ui->accountComboBox->currentText() << assetSymbol << coldKeyPathDialog.filePath << coldKeyPathDialog.pwd << true)); } return; } } void GuardKeyManagePage::on_accountComboBox_currentIndexChanged(const QString &arg1) { if(!inited) return; HXChain::getInstance()->currentAccount = ui->accountComboBox->currentText(); showMultisigInfo(); } void GuardKeyManagePage::on_multisigTableWidget_cellPressed(int row, int column) { if( column == 1 || column == 2) { ShowContentDialog showContentDialog( ui->multisigTableWidget->item(row, column)->text(),this); int x = ui->multisigTableWidget->columnViewportPosition(column) + ui->multisigTableWidget->columnWidth(column) / 2 - showContentDialog.width() / 2; int y = ui->multisigTableWidget->rowViewportPosition(row) - 10 + ui->multisigTableWidget->horizontalHeader()->height(); showContentDialog.move( ui->multisigTableWidget->mapToGlobal( QPoint(x, y))); showContentDialog.exec(); return; } } void GuardKeyManagePage::on_historyBtn_clicked() { AssetChangeHistoryWidget* assetChangeHistoryWidget = new AssetChangeHistoryWidget(this); assetChangeHistoryWidget->setAttribute(Qt::WA_DeleteOnClose); assetChangeHistoryWidget->setObjectName("assetChangeHistoryWidget"); assetChangeHistoryWidget->move(0,0); assetChangeHistoryWidget->show(); assetChangeHistoryWidget->raise(); emit backBtnVisible(true); } void GuardKeyManagePage::on_importBtn_clicked() { QString filePath = QFileDialog::getOpenFileName(this, tr("Select the file of cross-chain key"), "", "*.gcck"); qDebug() << "GuardKeyManagePage filepath " << filePath; QFile file(filePath); if(!file.open(QIODevice::ReadOnly)) return; QByteArray ba = file.readAll(); file.close(); QJsonParseError json_error; QJsonDocument parse_doucment = QJsonDocument::fromJson(ba,&json_error); if(json_error.error != QJsonParseError::NoError || !parse_doucment.isObject()) return ; QJsonObject object = parse_doucment.object(); QStringList keys = object.keys(); foreach (QString key, keys) { QJsonArray array = object.take(key).toArray(); foreach (QJsonValue v, array) { QJsonObject object2 = v.toObject(); QString wifKey = object2.take("wif_key").toString(); HXChain::getInstance()->postRPC( "id-import_crosschain_key", toJsonFormat( "import_crosschain_key", QJsonArray() << wifKey << key)); } } HXChain::getInstance()->postRPC( "finish-import_crosschain_key", toJsonFormat( "import_crosschain_key", QJsonArray() )); } void GuardKeyManagePage::on_changeAddressBtn_clicked() { ChangeCrosschainAddressDialog changeCrosschainAddressDialog; changeCrosschainAddressDialog.pop(); } void GuardKeyManagePage::pageChangeSlot(unsigned int page) { for(int i = 0;i < ui->multisigTableWidget->rowCount();++i) { if(i < page*ROWNUMBER) { ui->multisigTableWidget->setRowHidden(i,true); } else if(page * ROWNUMBER <= i && i < page*ROWNUMBER + ROWNUMBER) { ui->multisigTableWidget->setRowHidden(i,false); } else { ui->multisigTableWidget->setRowHidden(i,true); } } }
37bda8fdee23130afcfef486b8f3014c572f3f7e
c1f44c0b39412c47d846aaaac41a061689cb837b
/src/AliceUI/AUIRecyclerAdapter.h
2982a67f233607ec818175041d249f8372663fc5
[ "MIT" ]
permissive
DevHwan/aliceui
e85c61473479f87a4ea9106177b37b793883d2bf
9ee7d9424c06d4e063e55b486e9a78dfcebf8f86
refs/heads/master
2020-04-25T08:08:04.220457
2020-02-21T13:13:58
2020-02-21T13:13:58
172,636,394
1
0
MIT
2019-09-20T10:52:21
2019-02-26T04:13:03
C++
UTF-8
C++
false
false
4,026
h
AUIRecyclerAdapter.h
#pragma once #include "AUIRecyclerCommonDef.h" #include "AUISignal.h" class AUIWidget; class ALICEUI_API AUIRecyclerAdapter : public std::enable_shared_from_this< AUIRecyclerAdapter > { public: AUIRecyclerAdapter(); virtual ~AUIRecyclerAdapter(); ////////////////////////////////////////////////////////////////////////// // Typecast helper public: template<typename _Derived> bool IsKindOf() const { static_assert(std::is_base_of<AUIRecyclerAdapter, _Derived>::value, "Must be derived from AUIRecyclerAdapter"); return (nullptr != dynamic_cast<const _Derived*>(this)); } template<typename _Derived> _Derived* Cast() const { AUIAssert(this->IsKindOf<_Derived>()); return static_cast<_Derived*>(const_cast<AUIRecyclerAdapter*>(this)); } template<typename _Derived> _Derived* DynCast() const { return dynamic_cast<_Derived*>(const_cast<AUIRecyclerAdapter*>(this)); } template<typename _Derived> std::shared_ptr<_Derived> CastShared() const { AUIAssert(this->IsKindOf<_Derived>()); return std::static_pointer_cast<_Derived>(shared_from_this()); } template<typename _Derived> std::shared_ptr<_Derived> DynCastShared() const { return std::dynamic_pointer_cast<_Derived>(shared_from_this()); } ////////////////////////////////////////////////////////////////////////// // Interface protected: virtual size_t OnGetItemCount() const = 0; virtual void OnBindWidgetHolder(const std::shared_ptr< AUIRecyclerWidgetHolder >& pHolder, const size_t pos) = 0; virtual std::shared_ptr< AUIRecyclerWidgetHolder > OnCreateWidgetHolder(AUIWidget* pParent, const size_t widgetType) = 0; ////////////////////////////////////////////////////////////////////////// // Operation public: virtual size_t GetItemWidgetType(const size_t pos) const; size_t GetItemCount() const; void BindWidgetHolder(const std::shared_ptr< AUIRecyclerWidgetHolder >& pHolder, const size_t pos); std::shared_ptr< AUIRecyclerWidgetHolder > CreateWidgetHolder(AUIWidget* pParent, const size_t widgetType); ////////////////////////////////////////////////////////////////////////// // Management public: void AttachedToRecycler(const std::shared_ptr< AUIRecyclerWidget >& pRecycler, const size_t pos); void DetachedFromRecycler(const std::shared_ptr< AUIRecyclerWidget >& pRecycler); void FailedToRecycler(const std::shared_ptr< AUIRecyclerWidgetHolder >& pHolder); void WidgetRecycled(const std::shared_ptr< AUIRecyclerWidgetHolder >& pHolder); ////////////////////////////////////////////////////////////////////////// // Notification public: void NotifyDataChanged() { signalDataChanged.Send(); } void NotifyItemChanged(const size_t pos) { signalItemChanged.Send(pos); } void NotifyItemInserted(const size_t pos) { signalItemInserted.Send(pos); } void NotifyItemMoved(const size_t fromPos, const size_t toPos) { signalItemMoved.Send(fromPos, toPos); } void NotifyItemRemoved(const size_t pos) { signalItemRemoved.Send(pos); } void NotifyItemRangeChanged(const size_t startPos, const size_t itemCount) { signalRangeChanged.Send(startPos, itemCount); } void NotifyItemRangeInserted(const size_t startPos, const size_t itemCount) { signalRangeInserted.Send(startPos, itemCount); } void NotifyItemRangeRemoved(const size_t startPos, const size_t itemCount) { signalRangeRemoved.Send(startPos, itemCount); } AUISignal<void(void)> signalDataChanged; AUISignal<void(size_t)> signalItemChanged; AUISignal<void(size_t)> signalItemInserted; AUISignal<void(size_t, size_t)> signalItemMoved; AUISignal<void(size_t)> signalItemRemoved; AUISignal<void(size_t, size_t)> signalRangeChanged; AUISignal<void(size_t, size_t)> signalRangeInserted; AUISignal<void(size_t, size_t)> signalRangeRemoved; };
66b0f5aaf0d297390952db4affa21663514e1fbb
3c9398925c9d260302c1209759ca1e05af9acde3
/librarian.h
160198aa46416a980ce37890252f315eae542cbb
[]
no_license
RizRam/CPlusPlusLibraryClient
ecec511badec53b0f03519ab0d0e59605543393d
ae51f46bb11e69fdb276ee113a7d646b6f07ce87
refs/heads/master
2021-01-19T08:46:44.664543
2017-04-09T01:53:02
2017-04-09T01:53:02
87,675,103
0
0
null
null
null
null
UTF-8
C++
false
false
2,020
h
librarian.h
/****************************************************************************** * Ben Pittman - David Nixon - Mike Chavez - Rizky Ramdhani * CS 502A Winter 2017 * HW 4 * librarian.h - Header file for Librarian ******************************************************************************/ #pragma once #include <list> #include "transaction.h" #include "transactionfactory.h" using namespace std; /* //--------------------------------------------------------------------------- Librarian A class used in Command Pattern implementation of the Library system (Invoker). This class manages a queue of Transaction objects and these objects execute commands on the Library. Commands are executed in FIFO fashion. Implementation: -Uses STL List<Transaction *> for its queue. Which is a doubly linked list. O(1) insertion and removal. -This class is responsible for deallocating dynamic Transaction memory objects contained within it. -Transaction objects will be automatically deallocated once they are executed //--------------------------------------------------------------------------- */ class Library; class Librarian { public: Librarian(Library *); // constructor takes a Library Librarian(const Librarian &); // copy constructor ~Librarian(); // destructor Librarian & operator=(const Librarian &); // assignment operator // executes all transactions in the transactionQueue in order void executeAll(); void execute(); //executes the next Transaction in queue; //adds a Transaction Object to the queue. bool addTransaction(Transaction *trans); void setLibrary(Library *); //setter for library Library * getLibrary() const; //returns a pointer to Library private: Library *library; //reference to Library //Queue of Transaction Objects for execution list<Transaction *> transactionQueue; //clears the contents of transaction queue void clearTransactionQueue(); };
a6249b308aceb2fb2074d7fc6a23b05de1a74e0c
4783a3856a4cf0c3bd43f231d9e1ef9537536109
/challenges/aabb7_simd.cpp
a40581daa91dc50fb1a16233adb9eab27d3e6bb7
[]
no_license
d3v3l0/aabo
f6616331eb51e47a92aeca599e01c9cac922b126
4205bbc962a0b6b0a830dc41d0800aaa98e5934c
refs/heads/master
2022-01-13T02:47:04.609433
2019-05-29T04:27:35
2019-05-29T04:27:35
277,680,185
1
0
null
2020-07-07T00:47:00
2020-07-07T00:47:00
null
UTF-8
C++
false
false
12,934
cpp
aabb7_simd.cpp
#include "stdio.h" #include <vector> #include <time.h> #include <math.h> #include <immintrin.h> struct Clock { const clock_t m_start; Clock() : m_start(clock()) { } float seconds() const { const clock_t end = clock(); const float seconds = ((float)(end - m_start)) / CLOCKS_PER_SEC; return seconds; } }; struct float2 { float x,y; }; struct float3 { float x,y,z; }; float3 operator+(const float3 a, const float3 b) { float3 c = {a.x+b.x, a.y+b.y, a.z+b.z}; return c; } float dot(const float3 a, const float3 b) { return a.x*b.x + a.y*b.y + a.z*b.z; } float length(const float3 a) { return sqrtf(dot(a,a)); } float3 min(const float3 a, const float3 b) { float3 c = {std::min(a.x,b.x), std::min(a.y,b.y), std::min(a.z,b.z)}; return c; } float3 max(const float3 a, const float3 b) { float3 c = {std::max(a.x,b.x), std::max(a.y,b.y), std::max(a.z,b.z)}; return c; } union float4 { __m128 m; struct { float a,b,c,d; }; }; float4 min(const float4 a, const float4 b) { float4 c = {std::min(a.a,b.a), std::min(a.b,b.b), std::min(a.c,b.c), std::min(a.d,b.d)}; return c; } float4 max(const float4 a, const float4 b) { float4 c = {std::max(a.a,b.a), std::max(a.b,b.b), std::max(a.c,b.c), std::max(a.d,b.d)}; return c; } float random(float lo, float hi) { const int grain = 10000; const float t = (rand() % grain) * 1.f/(grain-1); return lo + (hi - lo) * t; } struct Mesh { std::vector<float3> m_point; void Generate(int points, float radius) { m_point.resize(points); for(int p = 0; p < points; ++p) { do { m_point[p].x = random(-radius, radius); m_point[p].y = random(-radius, radius); m_point[p].z = random(-radius, radius); } while(length(m_point[p]) > radius); } } }; const float3 axes[] = { { sqrtf(8/9.f), 0, -1/3.f}, { -sqrtf(2/9.f), sqrtf(2/3.f), -1/3.f}, { -sqrtf(2/9.f), -sqrtf(2/3.f), -1/3.f}, { 0, 0, 1 } }; struct Object { Mesh *m_mesh; float3 m_position; void CalculateAABB(float3* mini, float3* maxi) const { const float3 xyz = m_position + m_mesh->m_point[0]; *mini = *maxi = xyz; for(int p = 1; p < m_mesh->m_point.size(); ++p) { const float3 xyz = m_position + m_mesh->m_point[p]; *mini = min(*mini, xyz); *maxi = max(*maxi, xyz); } } void CalculateAABO(float4* mini, float4* maxi) const { const float3 xyz = m_position + m_mesh->m_point[0]; float4 abcd; abcd.a = dot(xyz, axes[0]); abcd.b = dot(xyz, axes[1]); abcd.c = dot(xyz, axes[2]); abcd.d = dot(xyz, axes[3]); *mini = *maxi = abcd; for(int p = 1; p < m_mesh->m_point.size(); ++p) { const float3 xyz = m_position + m_mesh->m_point[p]; abcd.a = dot(xyz, axes[0]); abcd.b = dot(xyz, axes[1]); abcd.c = dot(xyz, axes[2]); abcd.d = dot(xyz, axes[3]); *mini = min(*mini, abcd); *maxi = max(*maxi, abcd); } }; }; int main(int argc, char* argv[]) { const int kMeshes = 100; Mesh mesh[kMeshes]; for(int m = 0; m < kMeshes; ++m) mesh[m].Generate(50, 1.f); const int kTests = 100; const int kObjects = 10000000; Object* objects = new Object[kObjects]; for(int o = 0; o < kObjects; ++o) { objects[o].m_mesh = &mesh[rand() % kMeshes]; objects[o].m_position.x = random(-50.f, 50.f); objects[o].m_position.y = random(-50.f, 50.f); objects[o].m_position.z = random(-50.f, 50.f); } float3* aabbMin = new float3[kObjects]; float3* aabbMax = new float3[kObjects]; for(int a = 0; a < kObjects; ++a) objects[a].CalculateAABB(&aabbMin[a], &aabbMax[a]); float2* aabbX = new float2[kObjects]; float2* aabbY = new float2[kObjects]; float2* aabbZ = new float2[kObjects]; for(int a = 0; a < kObjects; ++a) { aabbX[a].x = aabbMin[a].x; aabbX[a].y = aabbMax[a].x; aabbY[a].x = aabbMin[a].y; aabbY[a].y = aabbMax[a].y; aabbZ[a].x = aabbMin[a].z; aabbZ[a].y = aabbMax[a].z; } float4 *aabbXY = new float4[kObjects]; float4 *aabbZZ = new float4[kObjects/2]; { float2* ZZ = (float2*)aabbZZ; for(int o = 0; o < kObjects; ++o) { aabbXY[o].a = aabbMin[o].x; aabbXY[o].b = -aabbMax[o].x; // so SIMD tests are <= x4 aabbXY[o].c = aabbMin[o].y; aabbXY[o].d = -aabbMax[o].y; // so SIMD tests are <= x4 ZZ[o].x = aabbMin[o].z; ZZ[o].y = -aabbMax[o].z; // so SIMD tests are <= x4 } } float4* aabtMin = new float4[kObjects]; float4* aabtMax = new float4[kObjects]; for(int a = 0; a < kObjects; ++a) objects[a].CalculateAABO(&aabtMin[a], &aabtMax[a]); float4* sevenMin = new float4[kObjects]; float4* sevenMax = new float4[kObjects]; for(int a = 0; a < kObjects; ++a) { sevenMin[a].a = aabbMin[a].x; sevenMin[a].b = aabbMin[a].y; sevenMin[a].c = aabbMin[a].z; sevenMin[a].d = -(aabbMax[a].x + aabbMax[a].y + aabbMax[a].z); sevenMax[a].a = aabbMax[a].x; sevenMax[a].b = aabbMax[a].y; sevenMax[a].c = aabbMax[a].z; sevenMax[a].d = -(aabbMin[a].x + aabbMin[a].y + aabbMin[a].z); } const char *title = "%22s | %9s | %9s | %7s | %7s\n"; printf(title, "Bounding Volume", "trivials", "trivials", "accepts", "seconds"); printf("------------------------------------------------------------------\n"); const char *format = "%22s | %9d | %9d | %7d | %3.4f\n"; { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float3 queryMin = aabbMin[test]; const float3 queryMax = aabbMax[test]; for(int t = 0; t < kObjects; ++t) { const float3 objectMin = aabbMin[t]; if(objectMin.x <= queryMax.x && objectMin.y <= queryMax.y && objectMin.z <= queryMax.z) { ++trivials; const float3 objectMax = aabbMax[t]; if(queryMin.x <= objectMax.x && queryMin.y <= objectMax.y && queryMin.z <= objectMax.z) ++intersections; } } } const float seconds = clock.seconds(); printf(format, "AABB MIN,MAX", 0, trivials, intersections, seconds); } { const Clock clock; int trivialX = 0; int trivialY = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float2 queryX = aabbX[test]; const float2 queryY = aabbY[test]; const float2 queryZ = aabbZ[test]; for(int t = 0; t < kObjects; ++t) { const float2 objectX = aabbX[t]; if(objectX.x <= queryX.y && queryX.x <= objectX.y) { ++trivialX; const float2 objectY = aabbY[t]; if(objectY.x <= queryY.y && queryY.x <= objectY.y) { ++trivialY; const float2 objectZ = aabbZ[t]; if(objectZ.x <= queryZ.y && queryZ.x <= objectZ.y) ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "AABB X,Y,Z", trivialX, trivialY, intersections, seconds); } { const Clock clock; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float4 queryMax = aabtMax[test]; for(int t = 0; t < kObjects; ++t) { const float4 objectMin = aabtMin[t]; if(objectMin.a <= queryMax.a && objectMin.b <= queryMax.b && objectMin.c <= queryMax.c && objectMin.d <= queryMax.d) { ++intersections; } } } const float seconds = clock.seconds(); printf(format, "Tetrahedron", 0, 0, intersections, seconds); } { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float4 queryMin = aabtMin[test]; const float4 queryMax = aabtMax[test]; for(int t = 0; t < kObjects; ++t) { const float4 objectMin = aabtMin[t]; if(objectMin.a <= queryMax.a && objectMin.b <= queryMax.b && objectMin.c <= queryMax.c && objectMin.d <= queryMax.d) { ++trivials; const float4 objectMax = aabtMax[t]; if(queryMin.a <= objectMax.a && queryMin.b <= objectMax.b && queryMin.c <= objectMax.c && queryMin.d <= objectMax.d) { ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "Octahedron", 0, trivials, intersections, seconds); } { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float4 queryMin = sevenMin[test]; const float4 queryMax = sevenMax[test]; for(int t = 0; t < kObjects; ++t) { const float4 objectMin = sevenMin[t]; if(objectMin.a <= queryMax.a && objectMin.b <= queryMax.b && objectMin.c <= queryMax.c && objectMin.d <= queryMax.d) { ++trivials; const float4 objectMax = sevenMax[t]; if(queryMin.a <= objectMax.a && queryMin.b <= objectMax.b && queryMin.c <= objectMax.c) { ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "7-Sided AABB", 0, trivials, intersections, seconds); } printf("\n"); { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { float4 queryXY, queryZZ; queryXY = aabbXY[test]; queryZZ.m = _mm_loadu_ps((float*)aabbZZ + test * 2); queryXY.m = _mm_sub_ps(_mm_setzero_ps(), queryXY.m); queryZZ.m = _mm_sub_ps(_mm_setzero_ps(), queryZZ.m); queryXY.m = _mm_shuffle_ps(queryXY.m, queryXY.m, _MM_SHUFFLE(2,3,0,1)); queryZZ.m = _mm_shuffle_ps(queryZZ.m, queryZZ.m, _MM_SHUFFLE(0,1,0,1)); for(int t = 0; t < kObjects; ++t) { const float4 objectXY = aabbXY[t]; if(_mm_movemask_ps(_mm_cmplt_ps(queryXY.m, objectXY.m)) == 0x0) { ++trivials; float4 objectZZ; objectZZ.m = _mm_loadu_ps((float*)aabbZZ + t * 2); objectZZ.m = _mm_movelh_ps(objectZZ.m, objectZZ.m); if(_mm_movemask_ps(_mm_cmplt_ps(queryZZ.m, objectZZ.m)) == 0x0) { ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "6-Sided AABB XY,Z SIMD", 0, trivials, intersections, seconds); } { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { float4 queryXY, queryZZ; queryXY = aabbXY[test]; queryZZ.m = _mm_loadu_ps((float*)aabbZZ + test * 2); queryXY.m = _mm_sub_ps(_mm_setzero_ps(), queryXY.m); queryZZ.m = _mm_sub_ps(_mm_setzero_ps(), queryZZ.m); queryXY.m = _mm_shuffle_ps(queryXY.m, queryXY.m, _MM_SHUFFLE(2,3,0,1)); queryZZ.m = _mm_shuffle_ps(queryZZ.m, queryZZ.m, _MM_SHUFFLE(0,1,0,1)); for(int t = 0; t < kObjects; ++t) { float4 objectZZ; objectZZ.m = _mm_loadu_ps((float*)aabbZZ + t * 2); objectZZ.m = _mm_movelh_ps(objectZZ.m, objectZZ.m); if(_mm_movemask_ps(_mm_cmplt_ps(queryZZ.m, objectZZ.m)) == 0x0) { ++trivials; const float4 objectXY = aabbXY[t]; if(_mm_movemask_ps(_mm_cmplt_ps(queryXY.m, objectXY.m)) == 0x0) { ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "6-Sided AABB Z,XY SIMD", 0, trivials, intersections, seconds); } { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float4 queryMin = sevenMin[test]; const float4 queryMax = sevenMax[test]; for(int t = 0; t < kObjects; ++t) { const float4 objectMin = sevenMin[t]; if(_mm_movemask_ps(_mm_cmplt_ps(queryMax.m, objectMin.m)) == 0x0) { ++trivials; const float4 objectMax = sevenMax[t]; if(_mm_movemask_ps(_mm_cmplt_ps(objectMax.m, queryMin.m)) == 0x0) { ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "7-Sided AABB SIMD", 0, trivials, intersections, seconds); } { const Clock clock; int trivials = 0; int intersections = 0; for(int test = 0; test < kTests; ++test) { const float4 queryMin = aabtMin[test]; const float4 queryMax = aabtMax[test]; for(int t = 0; t < kObjects; ++t) { const float4 objectMin = aabtMin[t]; if(_mm_movemask_ps(_mm_cmplt_ps(queryMax.m, objectMin.m)) == 0x0) { ++trivials; const float4 objectMax = aabtMax[t]; if(_mm_movemask_ps(_mm_cmplt_ps(objectMax.m, queryMin.m)) == 0x0) { ++intersections; } } } } const float seconds = clock.seconds(); printf(format, "Octahedron SIMD", 0, trivials, intersections, seconds); } return 0; }
d9b0ac051bf800d5ce28e40f9fe8eabef1edcaa1
603cf35b3118a84557f8674695931d019f33bfc4
/test.cpp
09b0b4c9611229f59d58b07a7e23eb654b9d7f7e
[]
no_license
Murtaza-Kazmi/Linux-Systems-Programming
617f79a2927020bebec1e34ccbafa91d09b48451
5d116895749ce71eb8c4ffec16e981896af0f99c
refs/heads/main
2023-05-30T20:18:51.299850
2021-06-03T12:28:13
2021-06-03T12:28:13
336,844,449
0
0
null
null
null
null
UTF-8
C++
false
false
77
cpp
test.cpp
#include <unistd.h> int main(){ write(2, "abcd", 4); return 0; }
249b7aff2d6e87ecb4b6c80bfd5bc903d58e6648
c3e4a25ef8981b25f4922bd1a569b2b4aa0dd425
/Ray Tracing/main.cpp
fe231183b4ea71a8e74bda12756bb21997b65e1e
[]
no_license
ozgurcanc/computer-graphics-assignments
d1802eb7b4d9745e5c78f0f6b9784e11e90b8e62
a28c5ba11bd46c6fdaa092f89492092b3a412646
refs/heads/master
2021-01-05T07:28:46.186323
2020-02-16T17:21:39
2020-02-16T17:21:39
240,932,729
0
0
null
null
null
null
UTF-8
C++
false
false
491
cpp
main.cpp
#include "defs.h" #include "Scene.h" #include <iostream> Scene *pScene; // definition of the global scene variable (declared in defs.h) int main(int argc, char *argv[]) { if (argc != 2) { std::cout << "Please run the ray tracer as:" << std::endl << "\t./raytracer inputs/<input_file_name>" << std::endl; return 1; } else { const char *xmlPath = argv[1]; pScene = new Scene(xmlPath); pScene->renderScene(); } return 0; }
29b294a297d5c057405a16e5a06be360367f1e43
199db94b48351203af964bada27a40cb72c58e16
/lang/de/gen/Bible16.h
6466338ccc83b86ac474e4ff8551187ad734b56a
[]
no_license
mkoldaev/bible50cpp
04bf114c1444662bb90c7e51bd19b32e260b4763
5fb1fb8bd2e2988cf27cfdc4905d2702b7c356c6
refs/heads/master
2023-04-05T01:46:32.728257
2021-04-01T22:36:06
2021-04-01T22:36:06
353,830,130
0
0
null
null
null
null
UTF-8
C++
false
false
63,506
h
Bible16.h
#include <map> #include <string> class Bible16 { struct de1 { int val; const char *msg; }; struct de2 { int val; const char *msg; }; struct de3 { int val; const char *msg; }; struct de4 { int val; const char *msg; }; struct de5 { int val; const char *msg; }; struct de6 { int val; const char *msg; }; struct de7 { int val; const char *msg; }; struct de8 { int val; const char *msg; }; struct de9 { int val; const char *msg; }; struct de10 { int val; const char *msg; }; struct de11 { int val; const char *msg; }; struct de12 { int val; const char *msg; }; struct de13 { int val; const char *msg; }; public: static void view1() { struct de1 poems[] = { {1, "1 Dies sind die Geschichten Nehemias, des Sohnes Hachaljas: Es geschah im Monat Kislew, im zwanzigsten Jahre, daß ich zu Susan auf dem Schlosse war."}, {2, "2 Da kam Hanani, einer meiner Brüder, mit etlichen Männern aus Juda, und ich erkundigte mich bei ihm über die Juden, die Entronnenen, die nach der Gefangenschaft übriggeblieben waren, und über Jerusalem."}, {3, "3 Und sie sprachen zu mir: Die Übriggebliebenen, welche nach der Gefangenschaft übriggeblieben sind, befinden sich dort im Lande in großem Unglück und in Schmach; und die Mauern der Stadt Jerusalem sind zerbrochen und ihre Tore mit Feuer verbrannt."}, {4, "4 Als ich diese Worte hörte, setzte ich mich hin und weinte und trug Leid etliche Tage lang und fastete und betete vor dem Gott des Himmels und sprach:"}, {5, "5 Ach, HERR, du Gott des Himmels, du großer und schrecklicher Gott, der den Bund und die Barmherzigkeit denen bewahrt, die ihn lieben und seine Gebote halten!"}, {6, "6 Laß doch deine Ohren aufmerken und deine Augen offen sein, daß du hörest das Gebet deines Knechtes, das ich nun vor dir bete Tag und Nacht für die Kinder Israel, deine Knechte, und womit ich die Sünde der Kinder Israel, die wir an dir begangen haben, bekenne. Ich und meines Vaters Haus haben auch gesündigt."}, {7, "7 Wir haben gar verwerflich gegen dich gehandelt, daß wir die Gebote, die Satzungen und Rechte nicht befolgt haben, die du deinem Knechte Mose gegeben hast!"}, {8, "8 Gedenke aber doch des Wortes, das du deinem Knechte Mose verheißen hast, indem du sprachst: \"Wenn ihr euch versündigt, so will ich euch unter die Völker zerstreuen;"}, {9, "9 wenn ihr aber zu mir umkehret und meine Gebote befolget und sie tut: wenn ihr dann schon verstoßen wäret bis an der Himmel Ende, so würde ich euch doch von dannen sammeln und euch an den Ort bringen, den ich erwählt habe, daß mein Name daselbst wohne.\""}, {10, "10 Sie sind ja doch deine Knechte und dein Volk, die du durch deine große Kraft und durch deine mächtige Hand erlöst hast."}, {11, "11 Ach, HERR, laß doch deine Ohren aufmerken auf das Gebet deines Knechtes und auf das Gebet deiner Knechte, welche begehren, deinen Namen zu fürchten, und laß es doch deinem Knechte heute gelingen und gib ihm Barmherzigkeit vor diesem Mann! Ich war nämlich des Königs Mundschenk."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view2() { struct de2 poems[] = { {1, "1 Es geschah aber im Monat Nisan, im zwanzigsten Jahre des Königs Artasasta, als Wein vor ihm stand, nahm ich den Wein und gab ihn dem Könige. Ich war aber zuvor nie traurig vor ihm gewesen."}, {2, "2 Da sprach der König zu mir: Warum siehst du so übel aus? Du bist doch nicht krank? Es ist nichts anderes als ein betrübtes Herz!"}, {3, "3 Da fürchtete ich mich sehr und sprach: Der König lebe ewig! Warum sollte ich nicht traurig aussehen, da doch die Stadt, wo der Begräbnisplatz meiner Väter ist, wüste liegt und ihre Tore vom Feuer verzehrt sind?"}, {4, "4 Da sprach der König zu mir: Was forderst du denn?"}, {5, "5 Da flehte ich zu dem Gott des Himmels und sagte dann zum König: Gefällt es dem König und gefällt dir dein Knecht, so sende mich nach Juda, zu der Stadt, wo meine Väter begraben liegen, daß ich sie wieder aufbaue."}, {6, "6 Da sprach der König zu mir, während die Königin neben ihm saß: Wie lange wird die Reise währen, und wann wirst du zurückkommen? Und es gefiel dem König, mich hinzusenden, nachdem ich ihm eine bestimmte Zeit angegeben hatte."}, {7, "7 Und ich sprach zum König: Gefällt es dem König, so gebe man mir Briefe an die Landpfleger jenseits des Stromes, daß sie mich durchziehen lassen, bis ich nach Juda komme;"}, {8, "8 auch einen Brief an Asaph, den Forstmeister des Königs, daß er mir Holz gebe für die Balken der Tore der Burg, die zum Hause Gottes gehört, und für die Stadtmauer und für das Haus, darein ich ziehen soll. Und der König gab sie mir, dank der guten Hand meines Gottes über mir."}, {9, "9 Als ich nun zu den Landpflegern jenseits des Stromes kam, gab ich ihnen des Königs Brief. Und der König hatte Oberste des Heeres und Reiter mit mir gesandt."}, {10, "10 Als aber Sanballat, der Horoniter, und Tobija, der ammonitische Knecht, solches hörten, verdroß es sie sehr, daß ein Mensch gekommen war, das Wohl der Kinder Israel zu suchen."}, {11, "11 Ich aber kam nach Jerusalem. Und als ich drei Tage lang daselbst gewesen,"}, {12, "12 machte ich mich bei Nacht auf mit wenigen Männern; denn ich sagte keinem Menschen, was mir mein Gott ins Herz gegeben hatte, für Jerusalem zu tun; und es war kein Tier bei mir als das Tier, worauf ich ritt."}, {13, "13 Und ich ritt bei Nacht zum Taltor hinaus gegen den Drachenbrunnen und an das Misttor und untersuchte die Mauern Jerusalems, die zerrissen und deren Tore mit Feuer verbrannt waren."}, {14, "14 Und ich ging hinüber zum Brunnentor und zum Königsteich, aber da war für das Tier, das unter mir war, kein Raum zum Durchkommen."}, {15, "15 So stieg ich des Nachts das Tal hinauf und untersuchte die Mauern und kehrte dann um und kam durchs Taltor wieder heim."}, {16, "16 Die Vorsteher aber wußten nicht, wo ich hingegangen war und was ich gemacht hatte; denn ich hatte bis dahin den Juden und den Priestern, auch den Vornehmsten und den Vorstehern und den andern, die am Werke arbeiteten, nichts gesagt."}, {17, "17 Da sprach ich zu ihnen: Ihr seht das Unglück, in dem wir uns befinden; wie Jerusalem wüste liegt und ihre Tore mit Feuer verbrannt sind. Kommt, laßt uns die Mauern Jerusalems wieder aufbauen, daß wir nicht länger in der Schmach seien."}, {18, "18 Und ich teilte ihnen mit, wie gütig die Hand meines Gottes über mir sei; dazu die Worte des Königs, die er mit mir gesprochen hatte. Da sprachen sie: Wir wollen uns aufmachen und bauen! Und sie stärkten ihre Hände zum guten Werk."}, {19, "19 Als aber Sanballat, der Horoniter, und Tobija, der ammonitische Knecht, und Geschem, der Araber, solches hörten, spotteten sie über uns und verachteten uns und sprachen: Was hat das zu bedeuten, was ihr vornehmet? Wollt ihr euch gegen den König auflehnen?"}, {20, "20 Da antwortete ich ihnen und sprach: Der Gott des Himmels wird es uns gelingen lassen; darum wollen wir, seine Knechte, uns aufmachen und bauen; ihr aber habt weder Anteil noch Recht noch Andenken in Jerusalem!"}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view3() { struct de3 poems[] = { {1, "1 Und Eljaschib, der Hohepriester, machte sich auf, samt seinen Brüdern, den Priestern, und baute das Schaftor; das heiligten sie und setzten seine Türen ein; und sie bauten weiter bis zum Turm Mea, den heiligten sie, und bis zum Turm Hananeel."}, {2, "2 Neben ihm bauten die Männer von Jericho; auch Sakkur, der Sohn Imris, baute neben ihm."}, {3, "3 Und das Fischtor bauten die Söhne Senaas; sie deckten es mit Balken und setzten seine Türen ein, seine Schlösser und seine Riegel."}, {4, "4 Neben ihnen baute Meremot, der Sohn Urijas, des Sohnes des Hakkoz. Neben ihnen baute Mesullam, der Sohn Berechjas, des Sohnes Meschesabels; und neben ihnen baute Zadok, der Sohn Baanas."}, {5, "5 Neben ihnen bauten die Tekoiter; aber die Vornehmen unter ihnen beugten ihre Nacken nicht zum Dienst ihres HERRN."}, {6, "6 Das alte Tor bauten Jojada, der Sohn Paseachs, und Mesullam, der Sohn Besodjas; sie deckten es mit Balken und setzten seine Türen ein, seine Schlösser und seine Riegel."}, {7, "7 Neben ihnen baute Melatja, der Gibeoniter, und Jadon, der Meronotiter, samt den Männern von Gibeon und von Mizpa, die der Gerichtsbarkeit des Landpflegers jenseits des Stromes unterstanden."}, {8, "8 Neben ihm baute Ussiel, der Sohn Harhajas, einer der Goldschmiede. Neben ihm baute Hananja, ein Sohn der Salbenmischer, die Jerusalem verlassen hatten, bis an die breite Mauer."}, {9, "9 Neben ihnen baute Rephaja, der Sohn Churs, der Oberste des halben Bezirks von Jerusalem."}, {10, "10 Neben ihnen baute Jedaja, der Sohn Harumaphs, gegenüber seinem Haus. Neben ihm baute Hattus, der Sohn Hasabnias."}, {11, "11 Aber Malchija, der Sohn Harims, und Hassub, der Sohn Pachat-Moabs, bauten ein zweites Stück und den Ofenturm."}, {12, "12 Neben ihm baute Sallum, der Sohn Hallohes, der Oberste des andern halben Bezirkes von Jerusalem, er und seine Töchter."}, {13, "13 Das Taltor bauten Chanun und die Bürger von Sanoach. Sie bauten es und setzten seine Türen ein, seine Schlösser und seine Riegel, dazu tausend Ellen an der Mauer, bis an das Misttor."}, {14, "14 Das Misttor aber baute Malchija, der Sohn Rechabs, der Oberste über den Bezirk Beth-Kerem. Er baute es und setzte seine Türen ein, seine Schlösser und seine Riegel."}, {15, "15 Aber das Brunnentor baute Sallum, der Sohn Kol-Choses, der Oberste des Bezirks Mizpa. Er baute es und deckte es mit Balken und setzte seine Türen ein, seine Schlösser und seine Riegel, dazu baute er die Mauern am Teiche Siloah beim Garten des Königs, bis an die Stufen, die von der Stadt Davids herabführen."}, {16, "16 Nach ihm baute Nehemia, der Sohn Asbuks, der Oberste über die Hälfte des Bezirks Beth-Zur, bis gegenüber den Gräbern Davids und bis an den künstlichen Teich und bis an das Haus der Helden."}, {17, "17 Nach ihm bauten die Leviten, Rehum, der Sohn Banis. Neben ihm baute Hasabja, der Oberste über die Hälfte des Bezirks Kehila für seinen Bezirk."}, {18, "18 Nach ihm bauten ihre Brüder, Bavai, der Sohn Henadads, der Oberste über die andere Hälfte des Bezirks Kehila."}, {19, "19 Neben ihm baute Eser, der Sohn Jesuas, der Oberste zu Mizpa, ein zweites Stück gegenüber dem Aufstieg zum Zeughaus am Winkel."}, {20, "20 Nach ihm baute Baruch, der Sohn Sabbais, bergwärts ein weiteres Stück vom Winkel bis an die Haustüre Eljaschibs, des Hohenpriesters."}, {21, "21 Nach ihm baute Meremot, der Sohn Urijas, des Sohnes des Hakkoz, ein weiteres Stück von der Haustüre Eljaschibs bis an das Ende des Hauses Eljaschibs."}, {22, "22 Nach ihm bauten die Priester, die Männer der Umgebung."}, {23, "23 Nach ihnen bauten Benjamin und Hassub ihrem Hause gegenüber. Nach ihnen baute Asarja, der Sohn Maasejas, des Sohnes Ananjas, bei seinem Hause."}, {24, "24 Nach ihm baute Binnui, der Sohn Henadads, ein zweites Stück, von dem Hause Asarjas bis zum Winkel und bis an die Ecke."}, {25, "25 Palal, der Sohn Usais, baute gegenüber dem Winkel und dem obern Turm, der am Hause des Königs vorspringt, bei dem Kerkerhof. Nach ihm Pedaja, der Sohn Parhos."}, {26, "26 Die Tempeldiener aber wohnten auf dem Ophel bis gegenüber dem Wassertor im Osten und dem vorspringenden Turm."}, {27, "27 Nach ihm bauten die von Tekoa ein zweites Stück, gegenüber dem großen vorspringenden Turm und bis an die Ophelmauer."}, {28, "28 Von dem Roßtor an bauten die Priester, ein jeder seinem Hause gegenüber."}, {29, "29 Nach ihnen baute Zadok, der Sohn Immers, seinem Hause gegenüber. Nach ihm baute Semaja, der Sohn Sechanjas, der Hüter des östlichen Tores."}, {30, "30 Nach ihm bauten Hananja, der Sohn Selemjas, und Chanun, der sechste Sohn Zalaphs, ein zweites Stück. Nach ihm baute Mesullam, der Sohn Berechjas, gegenüber seiner Kammer."}, {31, "31 Nach ihm baute Malchija, der Sohn des Goldschmieds, bis an das Haus der Tempeldiener und der Krämer, dem Wachttor gegenüber, bis zum Ecksöller."}, {32, "32 Und zwischen dem Ecksöller und dem Schaftore bauten die Goldschmiede und die Krämer."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view4() { struct de4 poems[] = { {1, "1 Als aber Sanballat hörte, daß wir die Mauern bauten, ward er zornig und sehr entrüstet und spottete über die Juden"}, {2, "2 und sprach vor seinen Brüdern und den Mächtigen zu Samaria also: Was machen die ohnmächtigen Juden? Soll man sie machen lassen? Werden sie opfern? Werden sie es eines Tages vollenden? Werden sie die Steine aus den Schutthaufen wieder beleben, da sie doch verbrannt sind?"}, {3, "3 Aber Tobija, der Ammoniter, war bei ihm und sprach: Sie mögen bauen, was sie wollen; wenn ein Fuchs hinaufginge, würde er ihre steinernen Mauern zerreißen!"}, {4, "4 Höre, unser Gott, wie verachtet wir sind, und laß ihre Schmähungen auf ihren Kopf fallen und gib sie der Plünderung preis im Lande der Gefangenschaft;"}, {5, "5 und decke ihre Schuld nicht zu und laß ihre Sünde vor dir nicht ausgetilgt werden; denn sie haben die Bauleute geärgert!"}, {6, "6 Wir aber bauten die Mauer; und die ganze Mauer schloß sich bis zur halben Höhe. Und das Volk gewann Mut zur Arbeit."}, {7, "7 Als aber Sanballat und Tobija und die Ammoniter und die Asdoditer hörten, daß die Wiederherstellung der Mauer zu Jerusalem fortschritt und daß die Lücken sich zu schließen begannen,"}, {8, "8 wurden sie sehr zornig und verschworen sich alle miteinander, daß sie kommen und wider Jerusalem streiten und Verwirrung anrichten wollten."}, {9, "9 Wir aber beteten zu unserm Gott und bestellten Wachen wider sie, Tag und Nacht, aus Furcht vor ihnen."}, {10, "10 Und Juda sprach: Die Kraft der Träger wankt, und des Schuttes ist viel; wir können nicht an der Mauer bauen!"}, {11, "11 Unsere Widersacher aber sprachen: Die sollen es nicht wissen noch sehen, bis wir mitten unter sie kommen und sie erwürgen und dem Werk ein Ende machen!"}, {12, "12 Als aber die Juden, die in ihrer Nähe wohnten, kamen und es uns wohl zehnmal sagten, aus allen Orten, woher sie zu uns kamen,"}, {13, "13 da stellte ich das Volk nach ihren Geschlechtern an die tieferen Stellen hinter den Mauern, in die Gräben, und stellte sie auf mit ihren Schwertern, Speeren und Bogen."}, {14, "14 Und ich besah es und machte mich auf und sprach zu den Vornehmsten und zu den Vorstehern und zu dem übrigen Volk: Fürchtet euch nicht vor ihnen: Gedenket an den großen furchtbaren HERRN und streitet für eure Brüder, eure Söhne und eure Töchter, eure Frauen und eure Häuser!"}, {15, "15 Als aber unsre Feinde hörten, daß es uns kundgeworden und Gott ihren Rat vereitelt hatte, kehrten wir alle wieder zur Mauer zurück, ein jeder an seine Arbeit."}, {16, "16 Und forthin geschah es, daß die Hälfte meiner Leute arbeitete, während die andere Hälfte mit Speeren, Schilden, Bogen und Panzern bewaffnet war; und die Obersten standen hinter dem ganzen Hause Juda, das an der Mauer baute. Und die Lastträger, welche aufluden,"}, {17, "17 verrichteten mit der einen Hand die Arbeit, während sie mit der andern die Waffe hielten."}, {18, "18 Und von den Bauleuten hatte jeder sein Schwert an die Seite gegürtet und baute also. Und der Trompeter stand neben mir."}, {19, "19 Und ich sprach zu den Vornehmen und Vorstehern und zum übrigen Volk: Das Werk ist groß und weit, und wir sind auf der Mauer zerstreut und weit voneinander entfernt:"}, {20, "20 Von welchem Ort her ihr nun den Schall der Posaune hören werdet, dort sammelt euch um uns. Unser Gott wird für uns streiten!"}, {21, "21 So arbeiteten wir an dem Werk, während die eine Hälfte die Speere hielt, vom Aufgang der Morgenröte bis zum Hervorkommen der Sterne."}, {22, "22 Auch sprach ich zu jener Zeit zum Volk: Ein jeder bleibe mit seinem Burschen über Nacht zu Jerusalem, daß sie bei Nacht Wache halten und bei Tag die Arbeit verrichten."}, {23, "23 Und weder ich noch meine Brüder noch meine Leute noch die Männer der Wache in meinem Gefolge zogen unsre Kleider aus; ein jeder hatte seine Waffe zur Hand."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view5() { struct de5 poems[] = { {1, "1 Es erhob sich aber ein großes Geschrei des Volks und ihrer Frauen gegen ihre Brüder, die Juden."}, {2, "2 Etliche sprachen: Unsrer Söhne und unsrer Töchter und unser sind viele; lasset uns Getreide herschaffen, daß wir zu essen haben und leben!"}, {3, "3 Andere sprachen: Wir müssen unsere Äcker und unsere Weinberge verpfänden, damit wir Getreide bekommen für den Hunger!"}, {4, "4 Etliche aber sprachen: Wir haben Geld entlehnt auf unsere Äcker und unsere Weinberge, daß wir dem König die Steuern zahlen können."}, {5, "5 Nun ist ja das Fleisch unsrer Brüder wie unser Fleisch, und unsre Kinder sind wie ihre Kinder. Und siehe, wir müssen unsere Söhne und unsere Töchter verpfänden, und von unsern Töchtern sind schon etliche dienstbar geworden, und wir können es nicht verhindern, da ja unsre Äcker und Weinberge bereits andern gehören!"}, {6, "6 Als ich aber ihr Geschrei und diese Worte hörte, ward ich sehr zornig."}, {7, "7 Und mein Herz überlegte in mir, und ich schalt die Vornehmsten und Vorsteher und sprach zu ihnen: Treibet ihr Wucher an euren Brüdern? Und ich brachte eine große Gemeinde wider sie zusammen und sprach zu ihnen:"}, {8, "8 Wir haben nach unserm Vermögen unsere Brüder, die Juden, welche an die Heiden verkauft waren, losgekauft; ihr aber wollt sogar eure Brüder verkaufen, so daß sie sich an uns verkaufen müssen? Da schwiegen sie und fanden keine Antwort."}, {9, "9 Und ich sprach: Was ihr da tut, ist nicht gut. Solltet ihr nicht in der Furcht unsres Gottes wandeln wegen der Schmähungen der Heiden, unsrer Feinde?"}, {10, "10 Ich und meine Brüder und meine Leute haben ihnen auch Geld und Korn geliehen. Wir wollen ihnen doch diese Schuld erlassen!"}, {11, "11 Gebet ihnen heute noch ihre Äcker, ihre Weinberge, ihre Ölbäume und ihre Häuser zurück, dazu den Hundertsten vom Geld, vom Korn, vom Most und vom Öl, den ihr ihnen auferlegt habt!"}, {12, "12 Da sprachen sie: Wir wollen es zurückgeben und nichts von ihnen fordern, sondern tun, wie du gesagt hast. Und ich rief die Priester herbei und nahm einen Eid von ihnen, daß sie also tun wollten."}, {13, "13 Auch schüttelte ich den Bausch meines Gewandes aus und sprach: Also schüttle Gott jedermann von seinem Hause und von seinem Besitztum ab, der solches versprochen hat und nicht ausführt; ja, so werde er ausgeschüttelt und leer! Und die ganze Gemeinde sprach: Amen! Und sie lobten den HERRN. Und das Volk tat also."}, {14, "14 Auch habe ich von der Zeit an, da mir befohlen ward, im Lande Juda ihr Landpfleger zu sein, nämlich vom zwanzigsten Jahre bis zum zweiunddreißigsten Jahre des Königs Artasasta, das sind zwölf Jahre, für mich und meine Brüder nicht den Unterhalt eines Landpflegers beansprucht."}, {15, "15 Denn die frühern Landpfleger, die vor mir gewesen, hatten das Volk bedrückt und von ihnen Brot und Wein genommen, dazu vierzig Schekel Silber; auch ihre Leute herrschten mit Gewalt über das Volk; ich aber tat nicht also, um der Furcht Gottes willen."}, {16, "16 Auch habe ich am Wiederaufbau der Mauer gearbeitet, ohne daß wir Grundbesitz erwarben; und alle meine Leute mußten daselbst zur Arbeit zusammenkommen."}, {17, "17 Dazu aßen die Juden und die Vorsteher, hundertfünfzig Mann, und die, welche von den Heiden aus der Umgebung zu uns kamen, an meinem Tisch."}, {18, "18 Und man richtete mir täglich einen Ochsen zu, sechs auserlesene Schafe, Geflügel und alle zehn Tage allerlei Wein in Menge; gleichwohl forderte ich damit nicht die Landpflegerkost; denn der Dienst lastete schwer auf diesem Volk."}, {19, "19 Gedenke, mein Gott, mir zum Besten, alles dessen, was ich für dieses Volk getan habe!"}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view6() { struct de6 poems[] = { {1, "1 Und als Sanballat, Tobija und Geschem, der Araber, und andere von unsern Feinden erfuhren, daß ich die Mauern gebaut habe und daß keine Lücke mehr daran sei, wiewohl ich zu jener Zeit die Türflügel noch nicht in die Tore eingehängt hatte,"}, {2, "2 sandten Sanballat und Geschem zu mir und ließen mir sagen: Komm und laß uns in den Dörfern, in der Ebene Ono zusammenkommen! Sie gedachten aber, mir Böses zu tun."}, {3, "3 Da sandte ich Boten zu ihnen und ließ ihnen sagen: Ich habe ein großes Werk zu verrichten, darum kann ich nicht hinabkommen. Warum sollte das Werk stillestehen, indem ich es ruhen ließe und zu euch hinabkäme?"}, {4, "4 Sie ließen mir aber viermal das Gleiche sagen, und ich gab ihnen die gleiche Antwort."}, {5, "5 Da ließ mir Sanballat zum fünftenmal das Gleiche durch seinen Knappen sagen; der kam mit einem offenen Brief in der Hand, darin war geschrieben:"}, {6, "6 Unter den Nationen verlautet und Gasmu sagt, daß du und die Juden abzufallen gedenken; darum bauest du die Mauern, und du wollest ihr König sein, so sagt man."}, {7, "7 Und du habest dir auch Propheten bestellt, die von dir zu Jerusalem ausrufen und sagen sollen: Er ist König von Juda! Nun wird der König solches vernehmen; darum komm, wir wollen miteinander beraten!"}, {8, "8 Ich aber sandte zu ihm und ließ ihm sagen: Nichts von dem, was du sagst, ist geschehen; aus deinem eigenen Herzen hast du es erdacht!"}, {9, "9 Denn sie alle wollten uns furchtsam machen und dachten: Ihre Hände werden schon ablassen von dem Werk, und es wird nicht vollendet werden! Nun aber stärke du meine Hände!"}, {10, "10 Und ich kam in das Haus Semajas, des Sohnes Delajas, des Sohnes Mehetabeels. Der hatte sich eingeschlossen und sprach: Wir wollen zusammenkommen im Hause Gottes, mitten im Tempel, und die Türen des Tempels schließen; denn sie werden kommen, dich umzubringen, und zwar werden sie des Nachts kommen, um dich umzubringen!"}, {11, "11 Ich aber sprach: Sollte ein Mann wie ich fliehen? Und sollte ein Mann wie ich in den Tempel gehen, um am Leben zu bleiben? Ich gehe nicht!"}, {12, "12 Denn siehe, ich merkte wohl: nicht Gott hatte ihn gesandt, mir zu weissagen, sondern Tobija und Sanballat hatten ihn gedungen;"}, {13, "13 und zwar zu dem Zweck, daß ich in Furcht geraten und also tun und mich versündigen sollte, damit sie mir einen bösen Namen machen und mich verlästern könnten."}, {14, "14 Gedenke, mein Gott, des Tobija und Sanballat nach diesen ihren Werken, auch der Prophetin Noadja und der andern Propheten, die mir Furcht einjagen wollten!"}, {15, "15 Und die Mauer ward fertig am fünfundzwanzigsten Tag des Monats Elul, in zweiundfünfzig Tagen."}, {16, "16 Als nun alle unsre Feinde solches hörten und alle Heiden um uns her solches sahen, entfiel ihnen aller Mut; denn sie merkten, daß dieses Werk von Gott getan worden war."}, {17, "17 Auch ließen zu jener Zeit die Vornehmsten in Juda viele Briefe an Tobija abgehen, und auch von Tobija gelangten solche zu ihnen."}, {18, "18 Denn es waren viele in Juda, die mit ihm verschworen waren, weil er Sechanjas, des Sohnes Arachs, Tochtermann war und sein Sohn die Tochter Mesullams, des Sohnes Berechjas hatte."}, {19, "19 Sie redeten auch zu seinen Gunsten vor mir und hinterbrachten ihm meine Worte; und Tobija sandte Briefe, um mir Furcht einzujagen."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view7() { struct de7 poems[] = { {1, "1 Als nun die Mauern gebaut waren, setzte ich die Türflügel ein; und es wurden die Torhüter, Sänger und Leviten bestellt."}, {2, "2 Und ich gab meinem Bruder Hanani und Hananja, dem Obersten der Burg, den Oberbefehl über Jerusalem; denn er war ein zuverlässiger Mann und gottesfürchtig vor vielen andern."}, {3, "3 Und ich sprach zu ihnen: Man soll die Tore Jerusalems nicht öffnen, ehe die Sonne heiß scheint; und während sie noch Wache stehen, soll man die Türen schließen und verriegeln! Und bestellet Wachen aus den Bürgern Jerusalems, einen jeden auf seinen Posten, und zwar jeden gegenüber seinem Hause!"}, {4, "4 Nun war die Stadt weit und groß, das Volk darin aber spärlich, und die Häuser waren noch nicht aufgebaut."}, {5, "5 Da gab mir mein Gott ins Herz, die Vornehmsten und die Vorsteher und das Volk zu versammeln, um sie nach ihren Geschlechtern aufzuzeichnen; und ich fand ein Geschlechtsregister derer, die zuerst heraufgezogen waren, und fand darin geschrieben:"}, {6, "6 Folgendes sind die Landeskinder, die aus der Gefangenschaft heraufgekommen sind, welche Nebukadnezar, der König von Babel, hinweggeführt hatte, und die wieder nach Jerusalem und Juda gekommen sind, ein jeder in seine Stadt;"}, {7, "7 die gekommen sind mit Serubbabel, Jesua, Nehemia, Asarja, Raamja, Nahemani, Mordechai, Bilsan, Misperet, Bigvai, Nehum und Baana. Dies ist die Zahl der Männer vom Volke Israel:"}, {8, "8 Der Kinder Parhos waren 2172;"}, {9, "9 der Kinder Sephatjas: 372; (der Kinder Arachs: 652);"}, {10, "10 der Kinder Pachat-Moabs,"}, {11, "11 von den Kindern Jesuas und Joabs: 2818;"}, {12, "12 der Kinder Elams: 1254;"}, {13, "13 der Kinder Sattus: 854;"}, {14, "14 der Kinder Sakkais: 760;"}, {15, "15 der Kinder Binnuis: 648;"}, {16, "16 der Kinder Bebais: 628;"}, {17, "17 der Kinder Asgads: 2322;"}, {18, "18 der Kinder Adonikams: 667;"}, {19, "19 der Kinder Bigvais: 2067;"}, {20, "20 der Kinder Adins: 655; (der Kinder Aters, von Hiskia: 98);"}, {21, "21 der Kinder Hasums: 328;"}, {22, "22 der Kinder Bezais: 324;"}, {23, "23 der Kinder Hariphs: 112;"}, {24, "24 der Kinder Gibeons: 95;"}, {25, "25 der Männer von Bethlehem und Netopha: 188;"}, {26, "26 der Männer von Anatot: 128;"}, {27, "27 der Männer von Beth-Asmavet: 42;"}, {28, "28 der Männer von Kirjat-Jearim,"}, {29, "29 Kephira und Beerot: 743;"}, {30, "30 der Männer von Rama und Gaba: 621;"}, {31, "31 der Männer von Michmas: 122;"}, {32, "32 der Männer von Bethel und Ai: 123;"}, {33, "33 der Männer des andern Nebo: 52;"}, {34, "34 der Kinder des andern Elam: 1254;"}, {35, "35 der Kinder Harims: 320;"}, {36, "36 der Kinder Jerichos: 345;"}, {37, "37 der Kinder Lods, Hadids und Onos: 721;"}, {38, "38 der Kinder Senaas: 3930."}, {39, "39 Von den Priestern: der Kinder Jedajas, vom Hause Jesuas, waren 973;"}, {40, "40 der Kinder Immers: 1052;"}, {41, "41 der Kinder Pashurs: 1247;"}, {42, "42 der Kinder Harims: 1017."}, {43, "43 Von den Leviten: der Kinder Jesuas von Kadmiel unter den Kindern Hodevas waren 74;"}, {44, "44 von den Sängern: der Kinder Asaphs waren 148."}, {45, "45 Von den Torhütern: der Kinder Sallums, der Kinder Athers, der Kinder Talmons, der Kinder Akkubs, der Kinder Hatitas, der Kinder Sobais waren 138."}, {46, "46 Von den Tempeldienern: der Kinder Zihas, der Kinder Hasuphas, der Kinder Tabbaots,"}, {47, "47 der Kinder Keros, der Kinder Sias, der Kinder Padons,"}, {48, "48 der Kinder Lebanas, der Kinder Hagabas, der Kinder Salmais,"}, {49, "49 der Kinder Hanans, der Kinder Giddels,"}, {50, "50 der Kinder Gahars, der Kinder Reajas, der Kinder Rezins, der Kinder Nekodas,"}, {51, "51 der Kinder Gasams, der Kinder der Ussas,"}, {52, "52 der Kinder Paseachs, der Kinder Besais, der Kinder Meunim, der Kinder Nephisesim,"}, {53, "53 der Kinder Bakbuks, der Kinder Hakuphas, der Kinder Harhurs,"}, {54, "54 der Kinder Bazlits, der Kinder Mehidas,"}, {55, "55 der Kinder Harsas, der Kinder Barkos, der Kinder Siseras, der Kinder Temas,"}, {56, "56 der Kinder Neziachs, der Kinder Hatiphas;"}, {57, "57 von den Kindern der Knechte Salomos: der Kinder Sotais, der Kinder Sopherets,"}, {58, "58 der Kinder Peridas, der Kinder Jaalas, der Kinder Darkons, der Kinder Giddels,"}, {59, "59 der Kinder Sephatjas, der Kinder Hattils, der Kinder Pocherets, von Zebajim, der Kinder Ammon,"}, {60, "60 aller Tempeldiener und Kinder der Knechte Salomos waren 392."}, {61, "61 Und diese zogen auch mit herauf aus Tel-Melach, Tel-Harsa, Kerub, Addon und Ammer, konnten aber das Haus ihrer Väter und ihre Abstammung nicht nachweisen, ob sie aus Israel seien:"}, {62, "62 Die Kinder Delajas, die Kinder Tobijas, die Kinder Nekodas; derer waren 642."}, {63, "63 Und von den Priestern: die Kinder Hobajas, die Kinder Hakkoz`, die Kinder der Barsillais, der von den Töchtern Barsillais, des Gileaditers, ein Weib genommen hatte und nach deren Namen genannt ward."}, {64, "64 Diese suchten ihr Geburtsregister, und als sie es nicht fanden, wurden sie von dem Priestertum ausgestoßen."}, {65, "65 Und der Landpfleger sagte ihnen, daß sie nicht vom Allerheiligsten essen dürften, bis ein Priester mit dem Licht und Recht aufstände."}, {66, "66 Die ganze Gemeinde zählte insgesamt 42360 Seelen,"}, {67, "67 ausgenommen ihre Knechte und Mägde; derer waren 7337;"}, {68, "68 und sie hatten 245 Sänger und Sängerinnen"}, {69, "69 und 736 Pferde und 245 Maultiere und 435 Kamele und 6720 Esel."}, {70, "70 Und sämtliche Familienhäupter gaben Beiträge zum Werk. Der Landpfleger gab für den Schatz 1000 Dareiken, 50 Sprengschalen, 530 Priesterröcke,"}, {71, "71 und von den Familien ward beigesteuert an den Schatz für das Werk an Gold 20000 Dareiken, und an Silber 2000 Minen."}, {72, "72 Und das übrige Volk gab an Gold 20000 Dareiken und an Silber 2000 Minen und 67 Priesterröcke."}, {73, "73 Und die Priester und Leviten, die Torhüter, Sänger und ein Teil des Volkes und die Tempeldiener und alle Israeliten ließen sich in ihren Städten nieder. Und als der siebente Monat nahte, waren die Kinder Israel in ihren Städten."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view8() { struct de8 poems[] = { {1, "1 Und es versammelte sich das ganze Volk wie ein Mann auf dem Platz vor dem Wassertor, und sie sprachen zu Esra, dem Schriftgelehrten, daß er das Gesetzbuch Moses hole, welches der HERR Israel anbefohlen hatte."}, {2, "2 Und Esra, der Priester, brachte das Gesetz vor die Gemeinde, vor die Männer und Frauen und alle, die es verstehen konnten, am ersten Tage des siebenten Monats."}, {3, "3 Und er las darin auf dem Platz, der vor dem Wassertor ist, vom hellen Morgen bis zum Mittag, vor den Männern und Frauen und allen, die es verstehen konnten, und die Ohren des ganzen Volkes waren auf das Gesetzbuch gerichtet."}, {4, "4 Esra aber, der Schriftgelehrte, stand auf einer hölzernen Kanzel, die man zu diesem Zweck gemacht hatte, und neben ihm standen Mattitja, Schema, Anaja, Urija, Hilkija und Hasbaddana, Sacharja und Mesullam und Maaseja zu seiner Rechten; zu seiner Linken aber Pedaja, Misael, Malkija, Chaschum."}, {5, "5 Und Esra öffnete das Buch vor den Augen des ganzen Volkes; denn er stand höher als alles Volk. Und als er es öffnete, stand alles Volk auf."}, {6, "6 Und Esra lobte den HERRN, den großen Gott; und alles Volk antwortete mit aufgehobenen Händen: Amen! Amen! Und sie verneigten sich und beteten den HERRN an, das Angesicht zur Erde gewandt."}, {7, "7 Und Jesua, Bani, Serebja, Jamin, Akkub, Sabetai, Hodija, Maaseja, Kelita, Asarja, Josabad, Hanan, Pelaja, die Leviten, erklärten dem Volk das Gesetz, während das Volk an seinem Platze blieb."}, {8, "8 Und sie lasen im Gesetzbuche Gottes deutlich und gaben den Sinn an, so daß man das Gelesene verstand."}, {9, "9 Und Nehemia, der Landpfleger, und Esra, der Priester, der Schriftgelehrte, und die Leviten, welche das Volk lehrten, sprachen zu allem Volk: Dieser Tag ist dem HERRN, eurem Gott, heilig! Darum seid nicht traurig und weinet nicht! Denn das ganze Volk weinte, als es die Worte des Gesetzes hörte."}, {10, "10 Darum sprach er zu ihnen: Gehet hin, esset Fettes und trinket Süßes und sendet Teile davon auch denen, die nichts für sich zubereitet haben; denn dieser Tag ist unserm HERRN heilig; darum bekümmert euch nicht, denn die Freude am HERRN ist eure Stärke!"}, {11, "11 Und die Leviten beruhigten alles Volk und sprachen: Seid stille, denn der Tag ist heilig; bekümmert euch nicht!"}, {12, "12 Und alles Volk ging hin, um zu essen und zu trinken und Teile davon zu senden und ein großes Freudenfest zu machen; denn sie hatten die Worte verstanden, die man ihnen verkündigte."}, {13, "13 Und am zweiten Tage versammelten sich die Familienhäupter des ganzen Volkes, die Priester und Leviten zu Esra, dem Schriftgelehrten, daß er sie in den Worten des Gesetzes unterrichte."}, {14, "14 Und sie fanden im Gesetz, welches der HERR durch Mose anbefohlen hatte, geschrieben, daß die Kinder Israel am Fest im siebenten Monat in Laubhütten wohnen sollten."}, {15, "15 Und sie ließen es verkündigen und in allen ihren Städten und zu Jerusalem ausrufen und sagen: Gehet hinaus auf die Berge und holet Ölzweige, Zweige vom wilden Ölbaum, Myrtenzweige, Palmzweige und Zweige von dichtbelaubten Bäumen, daß man Laubhütten mache, wie geschrieben steht!"}, {16, "16 Und das Volk ging hinaus, und sie holten die Zweige und machten sich Laubhütten, ein jeder auf seinem Dache und in ihren Höfen und in den Höfen am Hause Gottes und auf dem Platze am Wassertore und auf dem Platze am Tore Ephraim."}, {17, "17 Und die ganze Gemeinde derer, die aus der Gefangenschaft zurückgekehrt waren, machte Laubhütten und wohnte darin. Denn die Kinder Israel hatten seit der Zeit Josuas, des Sohnes Nuns, bis auf diesen Tag nicht also getan. Und sie hatten sehr große Freude."}, {18, "18 Und es wurde im Gesetzbuche Gottes gelesen Tag für Tag, vom ersten Tage bis zum letzten. Und sie hielten das Fest sieben Tage lang und am achten Tage die Festversammlung, laut Verordnung."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view9() { struct de9 poems[] = { {1, "1 Aber am vierundzwanzigsten Tage dieses Monats kamen die Kinder Israel zusammen unter Fasten, in Sacktuch gekleidet und mit Erde auf ihnen."}, {2, "2 Und es sonderten sich die Nachkommen Israels von allen Kindern der Fremden ab und traten hin und bekannten ihre Sünden und die Missetaten ihrer Väter."}, {3, "3 Und sie standen auf an ihrem Platze, und man las im Gesetzbuche des HERRN, ihres Gottes, während eines Viertels des Tages: und sie bekannten ihre Sünde und beteten zu dem HERRN, ihrem Gott, während eines andern Viertels des Tages."}, {4, "4 Und auf der Erhöhung der Leviten standen Jesua, Banai, Kadmiel, Sebanja, Buni, Serebja, Bani und Kenani und schrieen laut zu dem HERRN, ihrem Gott."}, {5, "5 Und die Leviten Jesua, Kadmiel, Bani, Hasabneja, Serebja, Hodija, Sebanja und Petachja sprachen: Stehet auf, lobet den HERRN, euren Gott, von Ewigkeit zu Ewigkeit! Und man lobe den Namen deiner Herrlichkeit, der über alle Danksagung und alles Lob erhaben ist!"}, {6, "6 Du, HERR, bist der Einzige! Du hast den Himmel, aller Himmel Himmel samt ihrem ganzen Heere gemacht, die Erde und alles, was darauf ist, das Meer und alles, was darin ist! Du machst alles lebendig, und das himmlische Heer verehrt dich."}, {7, "7 Du, HERR, bist der Gott, der Abram erwählt und aus Ur in Chaldäa geführt und mit dem Namen Abraham benannt hat."}, {8, "8 Und du hast sein Herz treu vor dir befunden und einen Bund mit ihm gemacht, seinem Samen das Land der Kanaaniter, Hetiter, Amoriter, Pheresiter, Jebusiter und Girgasiter zu geben; und du hast dein Wort gehalten, denn du bist gerecht."}, {9, "9 Du hast das Elend unsrer Väter in Ägypten angesehen und ihr Schreien am Schilfmeer erhört;"}, {10, "10 und hast Zeichen und Wunder getan am Pharao und allen seinen Knechten und an allem Volke seines Landes; denn du wußtest wohl, daß sie Übermut mit ihnen trieben, und du hast dir einen Namen gemacht, wie es heute der Fall ist."}, {11, "11 Du hast das Meer vor ihnen zerteilt, und sie gingen mitten durchs Meer auf dem Trockenen, aber ihre Verfolger hast du in die Tiefe geschleudert, wie einen Stein in mächtige Wasser."}, {12, "12 Du hast sie bei Tage mit einer Wolkensäule und bei Nacht mit einer Feuersäule geleitet, um ihnen den Weg zu erleuchten, auf dem sie ziehen sollten."}, {13, "13 Du bist auf den Berg Sinai herabgefahren und hast mit ihnen vom Himmel her geredet und ihnen richtige Ordnungen und wahrhaftige Gesetze und gute Gebote und Satzungen gegeben."}, {14, "14 Du hast ihnen deinen heiligen Sabbat kundgetan und ihnen Gebote, Satzungen und Gesetze geboten durch deinen Knecht Mose."}, {15, "15 Brot vom Himmel hast du ihnen gegeben, als sie hungerten, und Wasser aus dem Felsen hast du für sie hervorgebracht, als sie dürsteten, und du hast ihnen befohlen, hineinzugehen und das Land einzunehmen, darüber du deine Hand erhoben hattest, es ihnen zu geben."}, {16, "16 Aber sie und unsere Väter wurden übermütig und halsstarrig, so daß sie deinen Geboten nicht folgten;"}, {17, "17 und sie weigerten sich zu hören, und gedachten nicht an deine Wunder, die du an ihnen getan hattest, sondern wurden halsstarrig und warfen ein Haupt auf, um in ihrer Widerspenstigkeit in die Knechtschaft zurückzukehren. Aber du, o Gott der Vergebung, warst gnädig, barmherzig, langmütig und von großer Barmherzigkeit und verließest sie nicht."}, {18, "18 Ob sie gleich ein gegossenes Kalb machten und sprachen: Das ist dein Gott, der dich aus Ägypten geführt hat! und arge Lästerungen verübten,"}, {19, "19 verließest du sie nach deiner großen Barmherzigkeit doch nicht in der Wüste; die Wolkensäule wich nicht von ihnen des Tages, um sie auf dem Wege zu führen, noch die Feuersäule des Nachts, um ihnen den Weg zu erleuchten, den sie ziehen sollten."}, {20, "20 Und du gabst ihnen deinen guten Geist, sie zu unterweisen; und dein Manna nahmst du nicht von ihrem Munde, und als sie dürsteten, gabst du ihnen Wasser."}, {21, "21 Vierzig Jahre lang versorgtest du sie in der Wüste, daß ihnen nichts mangelte; ihre Kleider veralteten nicht und ihre Füße schwollen nicht an."}, {22, "22 Du gabst ihnen Königreiche und Völker und teiltest ihnen das ganze Gebiet aus, daß sie das Land Sihons einnahmen, das Land des Königs zu Hesbon und das Land Ogs, des Königs zu Basan."}, {23, "23 Du machtest ihre Kinder zahlreich wie die Sterne am Himmel und brachtest sie in das Land, von dem du ihren Vätern verheißen hattest, daß sie hineinziehen und es einnehmen würden."}, {24, "24 Die Kinder zogen hinein und nahmen das Land ein. Und du demütigtest vor ihnen die Einwohner des Landes, die Kanaaniter, und gabst sie in ihre Hand, ebenso ihre Könige und die Völker im Lande, daß sie mit ihnen nach Belieben handelten."}, {25, "25 Und sie eroberten feste Städte und ein fettes Land und nahmen Häuser in Besitz, mit allerlei Gut gefüllt, ausgehauene Brunnen, Weinberge, Ölbäume und Obstbäume in Menge; und sie aßen und wurden satt und fett und ließen sich's wohl sein in deiner großen Güte."}, {26, "26 Aber sie wurden ungehorsam und widerstrebten dir und warfen deine Gebote hinter ihren Rücken und erwürgten die Propheten, die wider sie zeugten, um sie zu dir zurückzuführen, und verübten arge Lästerungen."}, {27, "27 Darum gabst du sie in die Hand ihrer Feinde, die sie ängstigten. Doch zur Zeit ihrer Angst schrieen sie zu dir, und du erhörtest sie vom Himmel her und gabst ihnen nach deiner großen Barmherzigkeit Retter, die sie aus ihrer Feinde Hand erretteten."}, {28, "28 Wenn sie aber zur Ruhe kamen, taten sie wiederum Böses vor dir; alsdann überließest du sie der Hand ihrer Feinde; die herrschten über sie. Wenn sie dann wieder zu dir schrieen, erhörtest du sie vom Himmel her und errettetest sie oftmals nach deiner großen Barmherzigkeit."}, {29, "29 Und du ließest ihnen bezeugen, daß sie zu deinem Gesetze zurückkehren sollten; aber sie waren übermütig und folgten deinen Geboten nicht, sondern sündigten gegen deine Rechte, durch die der Mensch, wenn er sie befolgt, leben wird, und kehrten dir widerspenstig den Nacken zu und folgten nicht."}, {30, "30 Du aber hattest viele Jahre lang Geduld mit ihnen und ließest gegen sie Zeugnis ablegen durch deinen Geist, vermittelst deiner Propheten; aber sie wollten nicht hören. Darum hast du sie in die Hand der Erdenvölker gegeben."}, {31, "31 Aber nach deiner großen Barmherzigkeit hast du sie nicht gänzlich vertilgt und sie nicht verlassen. Denn du bist ein gnädiger und barmherziger Gott!"}, {32, "32 Nun, unser Gott, du großer Gott, mächtig und furchtbar, der du den Bund und die Barmherzigkeit hältst, achte nicht gering all das Ungemach, das uns getroffen hat, uns, unsere Könige, unsere Fürsten, unsere Priester, unsere Propheten, unsere Väter und dein ganzes Volk, seit der Zeit der Könige von Assyrien bis auf diesen Tag."}, {33, "33 Du bist gerecht in allem, was über uns gekommen ist; denn du hast Treue bewiesen; wir aber sind gottlos gewesen."}, {34, "34 Und unsere Könige, unsere Fürsten, unsere Priester und unsere Väter haben nicht nach deinem Gesetze gehandelt und haben nicht geachtet auf deine Gebote und auf deine Zeugnisse, die du ihnen hast bezeugen lassen."}, {35, "35 Sie haben dir nicht gedient in ihrem Königreich, trotz deiner großen Wohltat, die du ihnen erwiesen, und trotz dem weiten, fetten Lande, welches du ihnen gegeben hast, und sie haben sich von ihrem bösen Wesen nicht abgekehrt."}, {36, "36 Siehe, wir sind heute Knechte; ja, in dem Lande, welches du unsern Vätern gegeben hast, um seine Früchte und Güter zu genießen, siehe, in dem sind wir Knechte;"}, {37, "37 und sein Ertrag mehrt sich für die Könige, die du über uns gesetzt hast um unsrer Sünden willen, und sie herrschen über unsre Leiber und über unser Vieh nach ihrem Wohlgefallen, und wir sind in großer Not!"}, {38, "38 Auf Grund alles dessen machen wir einen festen Bund und schreiben ihn nieder und lassen ihn durch unsre Fürsten, Leviten und Priester versiegeln!"}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view10() { struct de10 poems[] = { {1, "1 Zu der Versiegelung aber waren verordnet: Nehemia, der Landpfleger,"}, {2, "2 der Sohn Hachaljas, und Zedekia, Seraja,"}, {3, "3 Asarja, Jeremia, Paschchur, Amarja,"}, {4, "4 Malchija, Hattus, Sebanja, Malluch,"}, {5, "5 Harim, Meremot, Obadja, Daniel,"}, {6, "6 Ginneton, Baruch, Mesullam,"}, {7, "7 Abija, Mijamin, Maasja, Bilgai und Semaja;"}, {8, "8 dies waren die Priester."}, {9, "9 Ferner die Leviten: Jesua, der Sohn Asanjas, Binnui, aus den Kindern Henadads, und Kadmiel."}, {10, "10 Und ihre Brüder: Sebanja, Hodija, Kelita,"}, {11, "11 Pelaja, Hanan, Micha,"}, {12, "12 Rechob, Hasabja, Sakkur,"}, {13, "13 Serebja, Sebanja, Hodija, Bani, Beninu."}, {14, "14 Die Häupter des Volkes: Parhos, Pachat-Moab,"}, {15, "15 Elam, Sattu, Bani;"}, {16, "16 Bunni, Asgad, Bebai,"}, {17, "17 Adonia, Bigvai, Adin,"}, {18, "18 Ather, Hiskia, Assur, Hodija,"}, {19, "19 Hasum, Bezai, Hariph,"}, {20, "20 Anatot, Nebai, Magpias,"}, {21, "21 Messulam, Hesir, Mesesabeel,"}, {22, "22 Zadok, Jaddua, Pelatja,"}, {23, "23 Hanan, Anaja, Hosea, Hananja,"}, {24, "24 Hassub, Hallohes, Pilha, Sobek, Rehum,"}, {25, "25 Hasabna, Maaseja,"}, {26, "26 Achija, Hanan,"}, {27, "27 Anan, Malluch, Harim und Baana."}, {28, "28 Und das übrige Volk, die Priester, die Leviten, die Torhüter, die Sänger, die Tempeldiener und alle, die sich von den Völkern der Länder abgesondert hatten zum Gesetze Gottes, samt ihren Frauen, ihren Söhnen und Töchtern, alle, die es wissen und verstehen konnten,"}, {29, "29 die schlossen sich ihren Brüdern, den Vornehmen unter ihnen, an. Sie kamen, um zu schwören und sich eidlich zu verpflichten, im Gesetze Gottes, welches durch Mose, den Knecht Gottes, gegeben worden ist, zu wandeln und alle Gebote, Rechte und Satzungen des HERRN, unsres Gottes, zu beobachten und zu tun."}, {30, "30 Und daß wir unsere Töchter nicht den Völkern des Landes geben, noch ihre Töchter für unsere Söhne nehmen wollten."}, {31, "31 Und daß, wenn die Völker des Landes am Sabbattag Waren und allerlei Speisen zum Verkauf brächten, wir sie ihnen am Sabbat und an heiligen Tagen nicht abnehmen, und daß wir im siebenten Jahre auf die Bestellung der Felder und auf jede Schuldforderung verzichten wollten."}, {32, "32 Und wir legten uns die Verpflichtung auf, jährlich das Drittel eines Schekels für den Dienst im Hause unsres Gottes zu geben: für die Schaubrote,"}, {33, "33 für das tägliche Speisopfer und das tägliche Brandopfer, für die Opfer an den Sabbaten, Neumonden und Festtagen, und für das Geheiligte und für die Sündopfer, um für Israel Sühne zu erwirken, und für den ganzen Dienst im Hause unsres Gottes."}, {34, "34 Wir warfen auch das Los, wir, die Priester, Leviten und das Volk, wegen der Spenden an Holz, daß wir dieses Jahr für Jahr, zu bestimmten Zeiten, familienweise zum Hause unsres Gottes bringen wollten, damit es auf dem Altar des HERRN, unsres Gottes, verbrannt werde, wie im Gesetze geschrieben steht;"}, {35, "35 auch daß wir jährlich die Erstlinge unsres Landes und die Erstlinge aller Früchte von allen Bäumen, Jahr für Jahr, zum Hause des HERRN bringen wollten;"}, {36, "36 ebenso die Erstgeburt unsrer Söhne und unsres Viehes (wie im Gesetze geschrieben steht) und die Erstlinge unsrer Rinder und unsrer Schafe; daß wir das alles zum Hause Gottes bringen wollten, zu den Priestern, die im Hause unsres Gottes dienen."}, {37, "37 Auch daß wir den Priestern die Erstlinge unsres Mehls und unsrer Hebopfer und die Früchte von allen Bäumen, von Most und Öl in die Kammern am Hause unsres Gottes bringen wollten, ebenso den Leviten den Zehnten unsres Bodens; daß die Leviten den Zehnten erheben sollten in allen Städten, wo wir Ackerbau treiben."}, {38, "38 Und der Priester, der Sohn Aarons, soll bei den Leviten sein, wenn sie den Zehnten erheben, und die Leviten sollen den Zehnten von ihrem Zehnten zum Hause unsres Gottes, in die Kammern des Schatzhauses heraufbringen."}, {39, "39 Denn in die Kammern sollen die Kinder Israel und die Kinder Levi das Hebopfer vom Korn, Most und Öl bringen, weil dort die Geräte des Heiligtums sind und die Priester, welche dienen, und die Torhüter und Sänger. Und so wollen wir das Haus unsres Gottes nicht verlassen."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view11() { struct de11 poems[] = { {1, "1 Und die Obersten des Volkes wohnten zu Jerusalem; das übrige Volk aber warf das Los, wonach jeder zehnte Mann in der heiligen Stadt wohnen sollte, die übrigen neun Zehntel aber in den übrigen Städten des Landes."}, {2, "2 Und das Volk segnete alle Männer, die freiwillig zu Jerusalem wohnen wollten."}, {3, "3 Folgendes sind die Bezirksvorsteher, die zu Jerusalem und in den Städten Judas wohnten, ein jeder in seiner Besitzung, in ihren Städten, nämlich Israel, die Priester, die Leviten, die Tempeldiener und die Söhne der Knechte Salomos."}, {4, "4 Es wohnten aber zu Jerusalem Kinder von Juda und Kinder von Benjamin. Von den Kindern Juda: Ataja, der Sohn Ussias, des Sohnes Secharjas, des Sohnes Amarjas, des Sohnes Sephatjas, des Sohnes Mahalaleels, von den Kindern des Perez."}, {5, "5 Und Maaseja, der Sohn Baruchs, des Sohnes Kolchoses, des Sohnes Hassajas, des Sohnes Adajas, des Sohnes Jojaribs, des Sohnes Secharjas, des Sohnes Silonis."}, {6, "6 Die Gesamtzahl der Kinder des Perez, die zu Jerusalem wohnten, war 468, tapfere Männer."}, {7, "7 Und dies sind die Kinder Benjamin: Sallu, der Sohn Mesullams, des Sohnes Joeds, des Sohnes Pedajas, des Sohnes Kolajas, des Sohnes Maasejas, des Sohnes Itiels, des Sohnes Jesajas;"}, {8, "8 und nach ihm Gabbai, Sallai, zusammen 928."}, {9, "9 Und Joel, der Sohn Sichris, war ihr Vorgesetzter; und Juda, der Sohn Hassenuas, der zweite über die Stadt."}, {10, "10 Von den Priestern: Jedaja, der Sohn Jojaribs, und Jachin."}, {11, "11 Seraja, der Sohn Hilkijas, des Sohnes Mesullams, des Sohnes Zadoks, des Sohnes Merajots, des Sohnes Achitubs, der war der Fürst im Hause Gottes."}, {12, "12 Und ihrer Brüder, die den Tempeldienst besorgten, waren 822. Und Adaja, der Sohn Jerohams, des Sohnes Pelaljas, des Sohnes Amzis, des Sohnes Secharjas, des Sohnes Paschchurs, des Sohnes Malchijas."}, {13, "13 Und seine Brüder, die Familienhäupter, waren 242. Und Amassai, der Sohn Asareels, des Sohnes Achsais, des Sohnes Mesillemots, des Sohnes Immers;"}, {14, "14 und ihre Brüder, tapfere Männer, zusammen 128. Und ihr Vorgesetzter war Sabdiel, der Sohn Hagedolims."}, {15, "15 Von den Leviten: Semaja, der Sohn Hassubs, des Sohnes Asrikams, des Sohnes Hasabjas, des Sohnes Bunnis."}, {16, "16 Und Sabbetai und Josabad, von den Häuptern der Leviten, waren über die äußern Geschäfte des Hauses Gottes gesetzt."}, {17, "17 Und Mattanja, der Sohn Michas, des Sohnes Sabdis, des Sohnes Asaphs, der Leiter des Lobgesangs, der die Danksagung im Gebet anzuheben hatte; und Bakbukja, der zweite unter seinen Brüdern, und Abda, der Sohn Sammuas, des Sohnes Galals, des Sohnes Jedutuns."}, {18, "18 Die Gesamtzahl aller Leviten in der heiligen Stadt betrug 284."}, {19, "19 Und die Torhüter Akkub, Talmon und ihre Brüder, die bei den Toren hüteten, beliefen sich auf 172."}, {20, "20 Der Rest von Israel, die Priester und die Leviten, wohnten in allen Städten Judas, ein jeder in seinem Erbteil."}, {21, "21 Und die Tempeldiener wohnten auf dem Hügel Ophel; und Ziha und Gispa waren über die Tempeldiener verordnet."}, {22, "22 Der Vorgesetzte über die Leviten zu Jerusalem aber war Ussi, der Sohn Banis, des Sohnes Hasabjas, des Sohnes Mattanjas, des Sohnes Michas, von den Söhnen Asaphs, welche den Dienst im Hause Gottes mit Gesang begleiteten."}, {23, "23 Denn es bestand eine königliche Verordnung über sie, und es war eine bestimmte Gebühr für die Sänger festgesetzt, für jeden Tag."}, {24, "24 Und Petachja, der Sohn Mesesabeels, aus den Söhnen Serachs, des Sohnes Judas war des Königs Bevollmächtigter in allem, was das Volk betraf."}, {25, "25 Was aber die Gehöfte auf dem Lande betrifft, so wohnten etliche von den Kindern Juda in Kirjat-Arba und seinen Nebenorten, in Dibon und in seinen Nebenorten, in Jekabzeel und seinen Höfen;"}, {26, "26 in Jesua, in Molada, in Beth-Palet,"}, {27, "27 in Hazar-Schual, in Beerseba und seinen Dörfern;"}, {28, "28 in Ziklag, in Mechona und seinen Dörfern;"}, {29, "29 in En-Rimmon, in Zorea,"}, {30, "30 in Jarmut, in Sanoach, in Adullam und seinen Höfen; in Lachis und seinem Gebiet; in Aseka und seinen Dörfern. Und sie ließen sich nieder von Beer-Seba bis zum Tal Hinnom;"}, {31, "31 die Kinder Benjamin aber von Geba an, sie wohnten in Michmas, Aja, Bethel und seinen Dörfern;"}, {32, "32 zu Anatot, Nob, Ananja,"}, {33, "33 Hazor, Rama, Gittaim,"}, {34, "34 Hadid, Zeboim,"}, {35, "35 Neballat, Lod und Ono, im Tal der Zimmerleute."}, {36, "36 Und von den Leviten kamen Abteilungen von Juda zu Benjamin."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view12() { struct de12 poems[] = { {1, "1 Folgendes sind die Priester und Leviten, die mit Serubbabel, dem Sohne Sealtiels, und mit Jesua heraufgezogen waren: Seraja, Jeremja, Esra,"}, {2, "2 Amarja, Malluch, Hattus, Sechanja,"}, {3, "3 Rehum, Meremot, Iddo,"}, {4, "4 Gintoi, Abija, Mijamin, Maadja, Bilga,"}, {5, "5 Semaja, Jojarib,"}, {6, "6 Jedaja, Sallu, Amok, Hilkija und Jedaja."}, {7, "7 Diese waren die Häupter der Priester und ihrer Brüder, zu den Zeiten Jesuas."}, {8, "8 Die Leviten: Jesua, Binnui, Kadmiel, Serebja, Juda und Mattanja, der samt seinen Brüdern den Dankchören vorstand."}, {9, "9 Bakbukja und Unni, ihre Brüder, standen gemäß ihren Dienstabteilungen jenen gegenüber."}, {10, "10 Jesua aber zeugte Jojakim, Jojakim zeugte Eljaschip, Eljaschip zeugte Jojada."}, {11, "11 Jojada zeugte Jonatan, Jonatan zeugte Jaddua."}, {12, "12 Und zu den Zeiten Jojakims waren folgende Priester Familienhäupter: Von Seraja: Meraja, von Jeremia: Hananja;"}, {13, "13 von Esra: Mesullam, von Amarja: Johanan;"}, {14, "14 von Melichu: Jonatan, von Sebanja: Joseph;"}, {15, "15 von Harim: Adna, von Merajot: Helkai;"}, {16, "16 von Iddo: Secharja, von Ginton: Mesullam;"}, {17, "17 von Abija: Sichri, von Minjamin Moadja: Piltai;"}, {18, "18 von Bilga: Sammua, von Semaja: Jonatan;"}, {19, "19 von Jojarib: Mattnai, von Jedaja: Ussi;"}, {20, "20 von Sallai: Kellai, von Amok: Heber;"}, {21, "21 von Hilkija: Hasabja, von Jedaja: Netaneel."}, {22, "22 Und zu den Zeiten Eljaschibs, Jojadas, Johanans und Jadduas wurden die Familienhäupter der Leviten und die Priester aufgeschrieben bis zur Regierung des Persers Darius."}, {23, "23 Die Kinder Levi, die Familienhäupter, wurden aufgeschrieben in dem Buch der Chronik, bis zur Zeit Johanans, des Sohnes Eljaschibs."}, {24, "24 Und folgende waren die Obersten unter den Leviten: Hasabja, Serebja und Jesua, der Sohn Kadmiels, und ihre Brüder, die ihnen gegenüber standen, zu loben und zu danken, wie David, der Mann Gottes, befohlen hatte, eine Abteilung mit der andern abwechselnd."}, {25, "25 Mattanja, Bakbukja, Obadja, Mesullam, Talmon und Akkub waren Torhüter, die bei den Toren der Vorratskammern Wache hielten."}, {26, "26 Diese waren zu den Zeiten Jojakims, des Sohnes Jesuas, des Sohnes Jozadaks, und zu den Zeiten Nehemias, des Landpflegers, und Esras, des Priesters, des Schriftgelehrten."}, {27, "27 Bei der Einweihung der Mauer Jerusalems aber suchte man die Leviten an allen ihren Orten und brachte sie nach Jerusalem, um die Einweihung mit Freuden zu begehen, mit Lobliedern und Gesängen, mit Zimbeln, Psaltern und Harfen."}, {28, "28 Und die Sängerchöre versammelten sich aus der ganzen Umgebung von Jerusalem und von den Höfen der Netophatiter;"}, {29, "29 auch von Beth-Gilgal und von den Landgütern zu Geba und Asmavet; denn die Sänger hatten sich Gehöfte gebaut um Jerusalem her."}, {30, "30 Und die Priester und Leviten reinigten sich; sie reinigten auch das Volk und die Tore und die Mauern."}, {31, "31 Und ich ließ die Fürsten von Juda auf die Mauer steigen und bestellte zwei große Dankchöre und veranstaltete einen Umzug; der eine Dankchor zog nach rechts über die Mauer gegen das Misttor hin."}, {32, "32 Und hinter ihnen her ging Hosaja mit der einen Hälfte der Fürsten von Juda,"}, {33, "33 dazu Asarja, Esra,"}, {34, "34 Mesullam, Juda, Benjamin,"}, {35, "35 Semaja und Jeremia und etliche Priestersöhne mit Trompeten, nämlich Secharja, der Sohn Jonatans, des Sohnes Semajas, des Sohnes Mattanjas, des Sohnes Michajas, des Sohnes Sakkurs, des Sohnes Asaphs;"}, {36, "36 und seine Brüder Semaja, Asareel, Milalai, Gilalai, Maai, Netaneel, Juda und Hanani, mit den Musikinstrumenten Davids, des Mannes Gottes, und Esra, der Schriftgelehrte, vor ihnen her."}, {37, "37 Und sie zogen nach dem Brunnentor und dann geradeaus auf der Treppe der Stadt Davids, den Aufgang der Mauer hinauf, oberhalb des Hauses Davids, bis zum Wassertor gegen Morgen."}, {38, "38 Der zweite Dankchor zog nach links, und ich folgte ihm mit der andern Hälfte des Volkes oben auf der Mauer oberhalb des Ofenturms, bis an die breite Mauer;"}, {39, "39 dann über das Tor Ephraim und über das alte Tor und über das Fischtor und den Turm Hananeel und den Turm Mea, bis zum Schaftor; und sie blieben stehen beim Kerkertor."}, {40, "40 Dann stellten sich die beiden Dankchöre beim Hause Gottes auf, ebenso ich und die Hälfte der Vorsteher mit mir;"}, {41, "41 und die Priester Eljakim, Maaseja, Minjamin, Michaja, Eljoenai, Sacharja und Hananja mit Trompeten;"}, {42, "42 desgleichen Maaseja, Semaja, Eleasar, Ussi, Johanan, Malchija, Elam und Eser. Und die Sänger ließen sich hören unter der Leitung Jisrachjas."}, {43, "43 Und an jenem Tage brachte man große Opfer dar und war fröhlich; denn Gott hatte ihnen eine große Freude bereitet, so daß sich auch die Frauen und Kinder freuten. Und man hörte die Freude Jerusalems weithin."}, {44, "44 Zu jener Zeit wurden Männer verordnet über die Vorratskammern, die zur Aufbewahrung der Schätze, der Hebopfer, der Erstlinge und der Zehnten dienten, damit sie darin von den Äckern der Städte die gesetzlichen Abgaben für die Priester und Leviten sammeln sollten; denn Juda hatte Freude an den Priestern und an den Leviten,"}, {45, "45 die im Dienste standen und die Aufträge ihres Gottes und die Reinigungsvorschriften ausführten. Auch die Sänger und die Torhüter standen nach dem Gebot Davids und seines Sohnes Salomo im Dienst."}, {46, "46 Denn vor alters, zu den Zeiten Davids und Asaphs, gab es schon einen Sängerchor und Lobgesänge und Danklieder für Gott."}, {47, "47 Und ganz Israel gab zu den Zeiten Serubbabels und zu den Zeiten Nehemias den Sängern und Torhütern Geschenke, jeden Tag die bestimmte Gebühr; und sie weihten es den Leviten, die Leviten aber weihten es den Söhnen Aarons."}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } static void view13() { struct de13 poems[] = { {1, "1 Zu jener Zeit wurde vor den Ohren des Volkes im Buche Moses gelesen und darin geschrieben gefunden, daß die Ammoniter und Moabiter nimmermehr in die Gemeinde Gottes kommen sollten,"}, {2, "2 weil sie den Kindern Israel nicht mit Brot und Wasser entgegenkamen, sondern den Bileam wider sie dingten, damit er sie verfluche; aber unser Gott verwandelte den Fluch in Segen."}, {3, "3 Als sie nun das Gesetz hörten, geschah es, daß sie alles fremde Volk von Israel absonderten."}, {4, "4 Vorher aber hatte Eljaschib, der Priester, der über die Kammern des Hauses Gottes gesetzt war, ein Verwandter Tobijas,"}, {5, "5 diesem eine große Kammer eingeräumt, wohin man zuvor die Speisopfer, den Weihrauch und die Geräte gelegt hatte, dazu die Zehnten vom Korn, Most und Öl, die Gebühr der Leviten, der Sänger und der Torhüter, dazu das Hebopfer der Priester."}, {6, "6 Während aber solches geschah, war ich nicht zu Jerusalem. Denn im zweiunddreißigsten Jahre Artasastas, des Königs von Babel, war ich zum König gegangen; aber nach einiger Zeit begehrte ich wieder Urlaub vom König."}, {7, "7 Und als ich nach Jerusalem kam, erfuhr ich das Übel, das Eljaschib dem Tobija zuliebe getan hatte, indem er ihm eine Kammer in den Vorhöfen des Hauses Gottes eingeräumt hatte."}, {8, "8 Solches mißfiel mir sehr; und ich warf alle Geräte des Hauses Tobijas vor die Kammer hinaus"}, {9, "9 und befahl, die Kammer zu reinigen; dann brachte ich die Geräte des Hauses Gottes, das Speisopfer und den Weihrauch wieder dorthin."}, {10, "10 Ich erfuhr auch, daß man den Leviten ihre Anteile nicht gegeben hatte, so daß die Leviten und Sänger, die sonst den Dienst verrichteten, geflohen waren, ein jeder zu seinem Acker."}, {11, "11 Da schalt ich die Vorsteher und sprach: Warum ist das Haus Gottes verlassen worden? Und ich versammelte jene wieder und stellte sie an ihre Posten."}, {12, "12 Da brachte ganz Juda die Zehnten vom Korn, Most und Öl in die Vorratskammern."}, {13, "13 Und ich bestellte zu Verwaltern über die Vorräte Selemja, den Priester, und Zadok, den Schriftgelehrten, und Pedaja aus den Leviten und ordnete ihnen Hanan bei, den Sohn Sakkurs, des Sohnes Mattanjas; denn sie wurden für treu erachtet, und ihnen lag es ob, ihren Brüdern auszuteilen."}, {14, "14 Gedenke mir dessen, mein Gott, und tilge nicht aus deinem Gedächtnis die Wohltaten, die ich dem Hause meines Gottes und seinen Hütern erwiesen habe!"}, {15, "15 Zu jener Zeit sah ich, daß etliche in Juda am Sabbat die Keltern traten und Garben einbrachten und Esel beluden, auch Wein, Trauben, Feigen und allerlei Lasten aufluden und solches am Sabbat nach Jerusalem brachten. Da warnte ich sie, an dem Tage Lebensmittel zu verkaufen."}, {16, "16 Es wohnten auch Tyrer dort, die brachten Fische und allerlei Ware und verkauften sie am Sabbat den Kindern Juda und in Jerusalem."}, {17, "17 Da schalt ich die Obersten von Juda und sprach zu ihnen: Was ist das für eine schlimme Gewohnheit, die ihr habt, den Sabbat zu entheiligen?"}, {18, "18 Taten nicht eure Väter also, und brachte unser Gott nicht darum all dies Unglück über uns und über diese Stadt? Und ihr macht des Zornes noch mehr, indem ihr den Sabbat entheiligt?"}, {19, "19 Und sobald es dunkel wurde in den Toren Jerusalems vor dem Sabbat, ließ ich die Tore schließen; und ich befahl, man solle sie nicht öffnen bis nach dem Sabbat; und ich bestellte einige meiner Knappen an die Tore, damit man am Sabbattag keine Last hereinbringe."}, {20, "20 Nun blieben die Krämer und Verkäufer von allerlei Ware über Nacht draußen vor Jerusalem, ein oder zweimal."}, {21, "21 Da verwarnte ich sie und sprach: Warum bleibet ihr über Nacht vor der Mauer? Wenn ihr es noch einmal tut, werde ich Hand an euch legen! Von der Zeit an kamen sie am Sabbat nicht mehr."}, {22, "22 Und ich befahl den Leviten, sich zu reinigen und zu kommen und die Tore zu hüten, damit der Sabbattag geheiligt werde. Mein Gott, gedenke mir dessen auch, und schone meiner nach deiner großen Barmherzigkeit!"}, {23, "23 Auch sah ich zu jener Zeit Juden, welche Frauen von Asdod, Ammon und Moab heimgeführt hatten."}, {24, "24 Darum redeten auch ihre Kinder halb asdoditisch und konnten nicht jüdisch reden, sondern die Sprache dieses oder jenes Volkes."}, {25, "25 Und ich schalt sie und fluchte ihnen und schlug etliche Männer von ihnen und raufte ihnen das Haar und beschwor sie bei Gott und sprach: Ihr sollt eure Töchter nicht ihren Söhnen geben, noch von ihren Töchtern für eure Söhne oder für euch selbst nehmen!"}, {26, "26 Hat sich nicht Salomo, der König von Israel, damit versündigt? Ihm war doch unter vielen Völkern kein König gleich, und er war seinem Gott lieb, und Gott setzte ihn zum König über ganz Israel; gleichwohl verführten ihn die ausländischen Frauen zur Sünde!"}, {27, "27 Und nun muß man von euch vernehmen, daß ihr dieses ganz große Übel tut und euch so an unserm Gott versündigt, daß ihr ausländische Frauen nehmet?"}, {28, "28 Und einer von den Söhnen Jojadas, des Sohnes Eljaschibs, des Hohenpriesters, hatte sich mit Sanballat, dem Horoniter, verschwägert; den jagte ich von mir."}, {29, "29 Gedenke an die, mein Gott, welche das Priestertum und den Bund des Priestertums und der Leviten befleckt haben!"}, {30, "30 Also reinigte ich sie von allem Fremden und bestellte die Ämter der Priester und Leviten und wies jedem seine Arbeit an"}, {31, "31 und sorgte für die rechtzeitige Lieferung des Holzes und der Erstlinge. Gedenke mir das, mein Gott, zum Besten! "}, }; size_t npoems = sizeof poems / sizeof poems[0];size_t i;for (i=0; i < npoems; ++i) {printf("%s\n", poems[i].msg);} } };
1cb576d8e5c33de4ea3f97bb9526ae0c26c00b75
f3a9174535cd7e76d1c1e0f0fa1a3929751fb48d
/SDK/PVR_UI_Wheel_classes.hpp
5b78507d81529eb74dccb7833b020260766f9260
[]
no_license
hinnie123/PavlovVRSDK
9fcdf97e7ed2ad6c5cb485af16652a4c83266a2b
503f8d9a6770046cc23f935f2df1f1dede4022a8
refs/heads/master
2020-03-31T05:30:40.125042
2020-01-28T20:16:11
2020-01-28T20:16:11
151,949,019
5
2
null
null
null
null
UTF-8
C++
false
false
7,392
hpp
PVR_UI_Wheel_classes.hpp
#pragma once // PavlovVR (Dumped by Hinnie) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // WidgetBlueprintGeneratedClass UI_Wheel.UI_Wheel_C // 0x0088 (0x0290 - 0x0208) class UUI_Wheel_C : public UUserWidget { public: struct FPointerToUberGraphFrame UberGraphFrame; // 0x0208(0x0008) (ZeroConstructor, Transient, DuplicateTransient) class UCanvasPanel* Canvas; // 0x0210(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UCanvasPanel* forecanvas; // 0x0218(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* forground; // 0x0220(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* Inner; // 0x0228(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* money; // 0x0230(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UTextBlock* moneyLabel; // 0x0238(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UTextBlock* TextBlock_42; // 0x0240(0x0008) (ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* Touch; // 0x0248(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class AUberWheel* Logic; // 0x0250(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnTemplate, DisableEditOnInstance, IsPlainOldData) TArray<class UUi_Wheel_Segment_C*> Segments; // 0x0258(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance) class UCurveLinearColor* InnerColorCurve; // 0x0268(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData) float InnerTimer; // 0x0270(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData) float InnerDuration; // 0x0274(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData) struct FText CenterLabel; // 0x0278(0x0018) (Edit, BlueprintVisible) static UClass* StaticClass() { static auto ptr = UObject::FindClass("WidgetBlueprintGeneratedClass UI_Wheel.UI_Wheel_C"); return ptr; } struct FLinearColor Get_inner_ColorAndOpacity_1(); void Construct(); void Tick(struct FGeometry* MyGeometry, float* InDeltaTime); void OnWheelUpdate(); void ExecuteUbergraph_UI_Wheel(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
70e3fccda90070057ac9db0c67de8b9d2932a906
a25f5cca8caf95687d39e846fd7f2b15562bc6a7
/2021_02/2021_02_15/001_Geneic_Type_function.cpp
01cce5e86e37dfd916bb661793b52f7a5112600d
[]
no_license
ITlearning/ROKA_CPP
241dd0debab9eb03ca36bf2087b8d45d34760906
f268eaa92d290c4f3bb0392bbf5ae5b7fd1742af
refs/heads/main
2023-03-20T08:19:41.951503
2021-03-06T08:02:06
2021-03-06T08:02:06
324,778,256
1
0
null
2021-01-31T15:04:23
2020-12-27T14:24:20
C++
UTF-8
C++
false
false
855
cpp
001_Geneic_Type_function.cpp
// 제네릭 myswap() 함수 만들기 #include <iostream> using namespace std; class Circle { int radius; public: Circle(int radius = 1) { this->radius = radius; } int getRadius() { return radius; } }; template <class T> // 템플릿의 역할은 그저 함수의 틀이다. 제네릭 함수를 선언하고, 컴파일 시점에 구체화 시키기 위한 틀을 만드는 것이다. void myswap(T & a, T & b) { // 제네릭 함수 T tmp; tmp = a; a = b; b = tmp; } int main() { int a = 4, b = 5; myswap(a,b); cout << "a= " << a << ", " << "b= " << b << endl; double c = 0.3, d = 4.223; myswap(c,d); cout << "c = " << c << ", " << "d = " << d << endl; Circle donut(5), pizza(30); myswap(donut, pizza); cout << "donut의 반지름 = " << donut.getRadius() << endl; cout << "pizza의 반지름 = " << pizza.getRadius() << endl; }
f3debf84b74a7eeb7063459a9df6d8602ed7ff5c
8ce8e3787768e81941cfe126a90a5ddd272433a0
/tests/src/exec.cpp
cfe098423133924287075de4274a7010cb2612b9
[ "Apache-2.0" ]
permissive
swoole/phpx
859d9f2a199a85cae5c59d61ceb89e7c1a8e0e4d
21f44c8d4a44db6c5b091b65294ad0c866ed17a2
refs/heads/master
2023-09-03T00:54:16.126021
2022-07-29T08:00:31
2022-07-29T08:00:31
91,668,676
213
41
null
null
null
null
UTF-8
C++
false
false
550
cpp
exec.cpp
#include "phpx_test.h" using namespace php; static const char *g_date = "2009-02-15"; TEST(exec, func) { auto retval = exec("is_dir", "/tmp"); ASSERT_TRUE(retval.toBool()); } TEST(exec, method) { auto retval = exec("DateTime::createFromFormat", "j-M-Y", "15-Feb-2009"); ASSERT_TRUE(retval.isObject()); Object o(retval); auto _date = o.exec("format", "Y-m-d"); ASSERT_STREQ(_date.toCString(), g_date); } TEST(exec, func_with_namespace) { auto retval = exec("\\is_dir", "/tmp"); ASSERT_TRUE(retval.toBool()); }
98882de33fb95b4cd76c7c523565e11e7cad38a0
da746871abe934e8091552520305a3115e88d6dd
/EloBuddy.Core/EloBuddy.Wrapper/EloBuddy.Wrapper/FollowerObject.cpp
8eabf2c0bdde675911723e336543e3ee92183441
[]
no_license
spiderbuddy411/spiderbuddy.open
ffcd0a3d6440e7502991d36067b03261f210a857
c96c4c8e15fd7939deb58813e7c2b4e17237a60e
refs/heads/master
2023-01-25T02:43:49.155176
2020-11-19T22:38:55
2020-11-19T22:38:55
275,361,783
3
0
null
null
null
null
UTF-8
C++
false
false
74
cpp
FollowerObject.cpp
#include "Stdafx.h" #include "FollowerObject.hpp" namespace EloBuddy { }
1759fae8f18a35b746d9feeea80704e82a726016
f486530c25f94b5be53b5511b9ae2b30ac74f9ea
/XiaoDB/test/BlockSizeReadTest.cpp
d3f8d0de83b97400623974305528d13adaa23b29
[]
no_license
bjlovegithub/CLPIM
d69712cc7d9eabd285d3aa1ea80b7e906a396a3c
aca78fc0c155392618ded3b18bdf628e475db2a8
refs/heads/master
2021-01-01T20:05:33.381748
2011-02-13T15:28:05
2011-02-13T15:28:05
1,257,190
0
0
null
null
null
null
UTF-8
C++
false
false
1,471
cpp
BlockSizeReadTest.cpp
/** * This program is used for testing performance issues about file IO. * Conclusion: * 1. Consider about block size when using Liux RAW file API. * 2. Set the number of bytes readed each time to times of * (blocks of per group). Usually it is 8K. */ #include <string> #include <iostream> #include <fstream> #include <cstdlib> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> using namespace std; int main(int argc, char** argv) { if (argc != 3) { cout << "Usage: " << argv[0] << " [block size] [file name]" << endl; return 1; } timeval start, end; int readCount; const char *fileName = argv[2]; size_t blockSize = atoi(argv[1]); char buf[blockSize*2]; int fd = open(fileName, O_RDONLY); cout << "Block size: " << blockSize << endl; cout << "Linux API Test" << endl; if (fd < 0) { cout << "Open file error!" << endl; return 1; } gettimeofday(&start, NULL); while ((readCount=read(fd, buf, blockSize))); gettimeofday(&end, NULL); cout << "Time Usage: " << end.tv_usec-start.tv_usec << endl; cout << "=====\nC API Test" << endl; gettimeofday(&start, NULL); ifstream ifs(fileName, ios::binary); while (ifs.good()) { ifs.read(buf, blockSize); } gettimeofday(&end, NULL); cout << "Time Usage: " << end.tv_usec-start.tv_usec << endl; return 0; }
71f33527a902afff56946b21a8c262f96d049b37
01a42b69633daf62a2eb3bb70c5b1b6e2639aa5f
/SCUM_Snowman_01_functions.cpp
8973fab58d054380eac8c66decfd0691976c4632
[]
no_license
Kehczar/scum_sdk
45db80e46dac736cc7370912ed671fa77fcb95cf
8d1770b44321a9d0b277e4029551f39b11f15111
refs/heads/master
2022-07-25T10:06:20.892750
2020-05-21T11:45:36
2020-05-21T11:45:36
265,826,541
1
0
null
null
null
null
UTF-8
C++
false
false
42,430
cpp
SCUM_Snowman_01_functions.cpp
// Scum 3.79.22573 (UE 4.24) #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace Classes { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function ConZ.Item.Use // () // Parameters: // class APrisoner** Prisoner (Parm, ZeroConstructor, IsPlainOldData) // int* usage (Parm, ZeroConstructor, IsPlainOldData) // float* usageWeight (Parm, ZeroConstructor, IsPlainOldData) // bool* Eat (Parm, ZeroConstructor, IsPlainOldData) // float* damageMultiplier (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::Use(class APrisoner** Prisoner, int* usage, float* usageWeight, bool* Eat, float* damageMultiplier) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Use"); ASnowman_01_C_Use_Params params; params.Prisoner = Prisoner; params.usage = usage; params.usageWeight = usageWeight; params.Eat = Eat; params.damageMultiplier = damageMultiplier; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.UpdateVisuals // () // Parameters: // bool* shouldHandleAging (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::UpdateVisuals(bool* shouldHandleAging) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.UpdateVisuals"); ASnowman_01_C_UpdateVisuals_Params params; params.shouldHandleAging = shouldHandleAging; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.StopBlinking // () void ASnowman_01_C::StopBlinking() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.StopBlinking"); ASnowman_01_C_StopBlinking_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // DelegateFunction ConZ.Item.StaticMeshChangedDelegate__DelegateSignature // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::StaticMeshChangedDelegate__DelegateSignature(class AItem** Item) { static auto fn = UObject::FindObject<UFunction>("DelegateFunction ConZ.Item.StaticMeshChangedDelegate__DelegateSignature"); ASnowman_01_C_StaticMeshChangedDelegate__DelegateSignature_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // DelegateFunction ConZ.Item.SkeletalMeshChangedDelegate__DelegateSignature // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::SkeletalMeshChangedDelegate__DelegateSignature(class AItem** Item) { static auto fn = UObject::FindObject<UFunction>("DelegateFunction ConZ.Item.SkeletalMeshChangedDelegate__DelegateSignature"); ASnowman_01_C_SkeletalMeshChangedDelegate__DelegateSignature_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.SetWeight // () // Parameters: // float* Value (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::SetWeight(float* Value) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.SetWeight"); ASnowman_01_C_SetWeight_Params params; params.Value = Value; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.SetMaxHealth // () // Parameters: // float* maxHealth (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::SetMaxHealth(float* maxHealth) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.SetMaxHealth"); ASnowman_01_C_SetMaxHealth_Params params; params.maxHealth = maxHealth; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.SetHealth // () // Parameters: // float* health (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::SetHealth(float* health) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.SetHealth"); ASnowman_01_C_SetHealth_Params params; params.health = health; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.SetFuel // () // Parameters: // float* Value (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::SetFuel(float* Value) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.SetFuel"); ASnowman_01_C_SetFuel_Params params; params.Value = Value; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.Server_Throw // () // Parameters: // struct FVector* ZeroBasedStartPosition (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData) // struct FRotator* StartRotation (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData) // struct FVector* StartVelocity (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData) void ASnowman_01_C::Server_Throw(struct FVector* ZeroBasedStartPosition, struct FRotator* StartRotation, struct FVector* StartVelocity) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Server_Throw"); ASnowman_01_C_Server_Throw_Params params; params.ZeroBasedStartPosition = ZeroBasedStartPosition; params.StartRotation = StartRotation; params.StartVelocity = StartVelocity; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.Repair // () // Parameters: // float* healthToRepair (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::Repair(float* healthToRepair) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Repair"); ASnowman_01_C_Repair_Params params; params.healthToRepair = healthToRepair; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.RemoveStacks // () // Parameters: // int* stacksToSplit (Parm, ZeroConstructor, IsPlainOldData) // TScriptInterface<class UInventoryNode> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) TScriptInterface<class UInventoryNode> ASnowman_01_C::RemoveStacks(int* stacksToSplit) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.RemoveStacks"); ASnowman_01_C_RemoveStacks_Params params; params.stacksToSplit = stacksToSplit; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // DelegateFunction ConZ.Item.PickedUpStateDelegate__DelegateSignature // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) // bool* pickedUp (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::PickedUpStateDelegate__DelegateSignature(class AItem** Item, bool* pickedUp) { static auto fn = UObject::FindObject<UFunction>("DelegateFunction ConZ.Item.PickedUpStateDelegate__DelegateSignature"); ASnowman_01_C_PickedUpStateDelegate__DelegateSignature_Params params; params.Item = Item; params.pickedUp = pickedUp; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRightClicked // () void ASnowman_01_C::OnRightClicked() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRightClicked"); ASnowman_01_C_OnRightClicked_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_WeightUsed // () void ASnowman_01_C::OnRep_WeightUsed() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_WeightUsed"); ASnowman_01_C_OnRep_WeightUsed_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_WaterWeight // () void ASnowman_01_C::OnRep_WaterWeight() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_WaterWeight"); ASnowman_01_C_OnRep_WaterWeight_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_Visibility // () void ASnowman_01_C::OnRep_Visibility() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_Visibility"); ASnowman_01_C_OnRep_Visibility_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_Stacks // () void ASnowman_01_C::OnRep_Stacks() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_Stacks"); ASnowman_01_C_OnRep_Stacks_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_InventoryContainer2D // () void ASnowman_01_C::OnRep_InventoryContainer2D() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_InventoryContainer2D"); ASnowman_01_C_OnRep_InventoryContainer2D_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_Health // () void ASnowman_01_C::OnRep_Health() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_Health"); ASnowman_01_C_OnRep_Health_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnRep_Examined // () void ASnowman_01_C::OnRep_Examined() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnRep_Examined"); ASnowman_01_C_OnRep_Examined_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnProjectileStop // () // Parameters: // struct FHitResult* ImpactResult (ConstParm, Parm, OutParm, ReferenceParm, IsPlainOldData) void ASnowman_01_C::OnProjectileStop(struct FHitResult* ImpactResult) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnProjectileStop"); ASnowman_01_C_OnProjectileStop_Params params; params.ImpactResult = ImpactResult; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnLocalPrisonerPanelsClosed // () void ASnowman_01_C::OnLocalPrisonerPanelsClosed() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnLocalPrisonerPanelsClosed"); ASnowman_01_C_OnLocalPrisonerPanelsClosed_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnLocalPrisonerHoveredActorChanged // () // Parameters: // class AActor** hoveredActor (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::OnLocalPrisonerHoveredActorChanged(class AActor** hoveredActor) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnLocalPrisonerHoveredActorChanged"); ASnowman_01_C_OnLocalPrisonerHoveredActorChanged_Params params; params.hoveredActor = hoveredActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnEditTextWidgetTextAccepted // () // Parameters: // class APrisoner** User (Parm, ZeroConstructor, IsPlainOldData) // struct FText* Text (ConstParm, Parm, OutParm, ReferenceParm) void ASnowman_01_C::OnEditTextWidgetTextAccepted(class APrisoner** User, struct FText* Text) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnEditTextWidgetTextAccepted"); ASnowman_01_C_OnEditTextWidgetTextAccepted_Params params; params.User = User; params.Text = Text; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnDetachedFromItem // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::OnDetachedFromItem(class AItem** Item) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnDetachedFromItem"); ASnowman_01_C_OnDetachedFromItem_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnDestroyedEvent // () // Parameters: // class AActor** Self (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::OnDestroyedEvent(class AActor** Self) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnDestroyedEvent"); ASnowman_01_C_OnDestroyedEvent_Params params; params.Self = Self; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnContainedItemDestroyed // () // Parameters: // class AActor** containedItem (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::OnContainedItemDestroyed(class AActor** containedItem) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnContainedItemDestroyed"); ASnowman_01_C_OnContainedItemDestroyed_Params params; params.containedItem = containedItem; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.OnAttachedToItem // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::OnAttachedToItem(class AItem** Item) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.OnAttachedToItem"); ASnowman_01_C_OnAttachedToItem_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.NetMulticast_SpawnDestroyedEffects // () void ASnowman_01_C::NetMulticast_SpawnDestroyedEffects() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.NetMulticast_SpawnDestroyedEffects"); ASnowman_01_C_NetMulticast_SpawnDestroyedEffects_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.NetMulticast_SetPlayerGivenName // () // Parameters: // struct FString* Value (Parm, ZeroConstructor) void ASnowman_01_C::NetMulticast_SetPlayerGivenName(struct FString* Value) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.NetMulticast_SetPlayerGivenName"); ASnowman_01_C_NetMulticast_SetPlayerGivenName_Params params; params.Value = Value; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.NetMulticast_SetActorDropLocationAndRotation // () // Parameters: // struct FVector* Location (Parm, ZeroConstructor, IsPlainOldData) // struct FRotator* Rotation (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::NetMulticast_SetActorDropLocationAndRotation(struct FVector* Location, struct FRotator* Rotation) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.NetMulticast_SetActorDropLocationAndRotation"); ASnowman_01_C_NetMulticast_SetActorDropLocationAndRotation_Params params; params.Location = Location; params.Rotation = Rotation; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.Multicast_UpdateExpirationTime // () // Parameters: // int64_t* Time (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::Multicast_UpdateExpirationTime(int64_t* Time) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Multicast_UpdateExpirationTime"); ASnowman_01_C_Multicast_UpdateExpirationTime_Params params; params.Time = Time; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.Multicast_Throw // () // Parameters: // struct FVector* ZeroBasedStartPosition (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData) // struct FRotator* StartRotation (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData) // struct FVector* StartVelocity (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData) void ASnowman_01_C::Multicast_Throw(struct FVector* ZeroBasedStartPosition, struct FRotator* StartRotation, struct FVector* StartVelocity) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Multicast_Throw"); ASnowman_01_C_Multicast_Throw_Params params; params.ZeroBasedStartPosition = ZeroBasedStartPosition; params.StartRotation = StartRotation; params.StartVelocity = StartVelocity; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.HasPriorityForContainerItem // () // Parameters: // class AItem** containerItem (ConstParm, Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::HasPriorityForContainerItem(class AItem** containerItem) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.HasPriorityForContainerItem"); ASnowman_01_C_HasPriorityForContainerItem_Params params; params.containerItem = containerItem; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWidgetDisplayInfo // () // Parameters: // struct FWidgetDisplayInfo ReturnValue (Parm, OutParm, ReturnParm) struct FWidgetDisplayInfo ASnowman_01_C::GetWidgetDisplayInfo() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWidgetDisplayInfo"); ASnowman_01_C_GetWidgetDisplayInfo_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWetness // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetWetness() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWetness"); ASnowman_01_C_GetWetness_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWeightUsed // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetWeightUsed() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWeightUsed"); ASnowman_01_C_GetWeightUsed_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWeightRemained // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetWeightRemained() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWeightRemained"); ASnowman_01_C_GetWeightRemained_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWeightPerUse // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetWeightPerUse() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWeightPerUse"); ASnowman_01_C_GetWeightPerUse_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWeight // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetWeight() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWeight"); ASnowman_01_C_GetWeight_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetWaterWeight // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetWaterWeight() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetWaterWeight"); ASnowman_01_C_GetWaterWeight_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetUsedSlots // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetUsedSlots() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetUsedSlots"); ASnowman_01_C_GetUsedSlots_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetUsedMass // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetUsedMass() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetUsedMass"); ASnowman_01_C_GetUsedMass_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetTotalWeight // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetTotalWeight() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetTotalWeight"); ASnowman_01_C_GetTotalWeight_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetTotalUses // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetTotalUses() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetTotalUses"); ASnowman_01_C_GetTotalUses_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetStacksCount // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetStacksCount() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetStacksCount"); ASnowman_01_C_GetStacksCount_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetSizeY // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetSizeY() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetSizeY"); ASnowman_01_C_GetSizeY_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetSizeX // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetSizeX() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetSizeX"); ASnowman_01_C_GetSizeX_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetRemainingUses // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetRemainingUses() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetRemainingUses"); ASnowman_01_C_GetRemainingUses_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetRemaining // () // Parameters: // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) int ASnowman_01_C::GetRemaining() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetRemaining"); ASnowman_01_C_GetRemaining_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetNormalizedHealth // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetNormalizedHealth() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetNormalizedHealth"); ASnowman_01_C_GetNormalizedHealth_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetNoiseLoudnessWhenPickedUp // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetNoiseLoudnessWhenPickedUp() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetNoiseLoudnessWhenPickedUp"); ASnowman_01_C_GetNoiseLoudnessWhenPickedUp_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetNoiseLoudnessWhenDropped // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetNoiseLoudnessWhenDropped() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetNoiseLoudnessWhenDropped"); ASnowman_01_C_GetNoiseLoudnessWhenDropped_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetNoiseLoudnessOnGroundImpact // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetNoiseLoudnessOnGroundImpact() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetNoiseLoudnessOnGroundImpact"); ASnowman_01_C_GetNoiseLoudnessOnGroundImpact_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetMeshComponent // () // Parameters: // class UMeshComponent* ReturnValue (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData) class UMeshComponent* ASnowman_01_C::GetMeshComponent() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetMeshComponent"); ASnowman_01_C_GetMeshComponent_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetMaxHealth // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetMaxHealth() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetMaxHealth"); ASnowman_01_C_GetMaxHealth_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetHealth // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetHealth() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetHealth"); ASnowman_01_C_GetHealth_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetFuel // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetFuel() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetFuel"); ASnowman_01_C_GetFuel_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetDefaultMaxHealth // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetDefaultMaxHealth() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetDefaultMaxHealth"); ASnowman_01_C_GetDefaultMaxHealth_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetContainerDamagePercentage // () // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) float ASnowman_01_C::GetContainerDamagePercentage() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetContainerDamagePercentage"); ASnowman_01_C_GetContainerDamagePercentage_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.GetAllContainedItems // () // Parameters: // bool* recursive (Parm, ZeroConstructor, IsPlainOldData) // TArray<class AItem*> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm) TArray<class AItem*> ASnowman_01_C::GetAllContainedItems(bool* recursive) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.GetAllContainedItems"); ASnowman_01_C_GetAllContainedItems_Params params; params.recursive = recursive; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.DropAt // () // Parameters: // struct FVector* dropLocation (Parm, ZeroConstructor, IsPlainOldData) // struct FRotator* dropRotation (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::DropAt(struct FVector* dropLocation, struct FRotator* dropRotation) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.DropAt"); ASnowman_01_C_DropAt_Params params; params.dropLocation = dropLocation; params.dropRotation = dropRotation; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.DropAround // () // Parameters: // class AActor** Actor (Parm, ZeroConstructor, IsPlainOldData) // float* Radius (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::DropAround(class AActor** Actor, float* Radius) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.DropAround"); ASnowman_01_C_DropAround_Params params; params.Actor = Actor; params.Radius = Radius; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.Drop // () // Parameters: // bool* wasThrowed (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::Drop(bool* wasThrowed) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Drop"); ASnowman_01_C_Drop_Params params; params.wasThrowed = wasThrowed; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.DetachFromAll // () void ASnowman_01_C::DetachFromAll() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.DetachFromAll"); ASnowman_01_C_DetachFromAll_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // DelegateFunction ConZ.Item.DebugTextChangedDelegate__DelegateSignature // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::DebugTextChangedDelegate__DelegateSignature(class AItem** Item) { static auto fn = UObject::FindObject<UFunction>("DelegateFunction ConZ.Item.DebugTextChangedDelegate__DelegateSignature"); ASnowman_01_C_DebugTextChangedDelegate__DelegateSignature_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.CanStackWith // () // Parameters: // class UObject** Item (ConstParm, Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::CanStackWith(class UObject** Item) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.CanStackWith"); ASnowman_01_C_CanStackWith_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.CanStack // () // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::CanStack() { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.CanStack"); ASnowman_01_C_CanStack_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.CanBeDroppedBy // () // Parameters: // class AConZCharacter** Character (ConstParm, Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::CanBeDroppedBy(class AConZCharacter** Character) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.CanBeDroppedBy"); ASnowman_01_C_CanBeDroppedBy_Params params; params.Character = Character; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.CanBeCraftedByCharactrer // () // Parameters: // class ACharacter** Character (ConstParm, Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::CanBeCraftedByCharactrer(class ACharacter** Character) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.CanBeCraftedByCharactrer"); ASnowman_01_C_CanBeCraftedByCharactrer_Params params; params.Character = Character; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.CanAutoAddItem // () // Parameters: // class AItem** Item (ConstParm, Parm, ZeroConstructor, IsPlainOldData) // unsigned char column (Parm, OutParm, ZeroConstructor, IsPlainOldData) // unsigned char row (Parm, OutParm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::CanAutoAddItem(class AItem** Item, unsigned char* column, unsigned char* row) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.CanAutoAddItem"); ASnowman_01_C_CanAutoAddItem_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (column != nullptr) *column = params.column; if (row != nullptr) *row = params.row; return params.ReturnValue; } // Function ConZ.Item.CanAddItem // () // Parameters: // class AItem** Item (Parm, ZeroConstructor, IsPlainOldData) // unsigned char* column (Parm, ZeroConstructor, IsPlainOldData) // unsigned char* row (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::CanAddItem(class AItem** Item, unsigned char* column, unsigned char* row) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.CanAddItem"); ASnowman_01_C_CanAddItem_Params params; params.Item = Item; params.column = column; params.row = row; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.Blink // () // Parameters: // float* Duration (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::Blink(float* Duration) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.Blink"); ASnowman_01_C_Blink_Params params; params.Duration = Duration; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function ConZ.Item.AutoAddItemToInventoryNode // () // Parameters: // TScriptInterface<class UInventoryNode>* Item (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::AutoAddItemToInventoryNode(TScriptInterface<class UInventoryNode>* Item) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.AutoAddItemToInventoryNode"); ASnowman_01_C_AutoAddItemToInventoryNode_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.AttachToCharacterHands // () // Parameters: // class AConZCharacter** Character (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool ASnowman_01_C::AttachToCharacterHands(class AConZCharacter** Character) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.AttachToCharacterHands"); ASnowman_01_C_AttachToCharacterHands_Params params; params.Character = Character; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function ConZ.Item.AddStack // () // Parameters: // TScriptInterface<class UInventoryNode>* Item (Parm, ZeroConstructor, IsPlainOldData) void ASnowman_01_C::AddStack(TScriptInterface<class UInventoryNode>* Item) { static auto fn = UObject::FindObject<UFunction>("Function ConZ.Item.AddStack"); ASnowman_01_C_AddStack_Params params; params.Item = Item; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
472be7fea08708376b19d950f448301c00f1d2cb
f6bdac5f1eda23454f9012815c6216c1f9531898
/global/msgs.hpp
9f2dee8cecf1d32f63f0e87bd77d940f1e83508f
[]
no_license
Pink-Dragon-Labs/DnGServerSource
62310037935d223f4db0555b4ba7837621feb895
995e8d1e23bd7b3e952f0e36b6ed84e6c41055d8
refs/heads/master
2021-02-08T19:57:41.259553
2020-02-29T04:19:48
2020-02-29T04:19:48
244,190,421
0
0
null
null
null
null
UTF-8
C++
false
false
8,999
hpp
msgs.hpp
/* global system message definitions author: Stephen Nichols */ #ifndef _MSGS_HPP_ #define _MSGS_HPP_ #include "new.hpp" #include "malloc.hpp" #include "ipcclient.hpp" #include "ipcmsg.hpp" #include <time.h> enum { _ACCT_TYPE_12MONTH, _ACCT_TYPE_30DAY, _ACCT_TYPE_90DAY, _ACCT_TYPE_INVALID, _ACCT_TYPE_IN_USE, _ACCT_TYPE_DOWN, _ACCT_TYPE_MAX }; // caution!! Do not go below -1 or exceed 1024 without changing the // values in ipc.cpp for _type in "read". enum { _IPC_TERMINATED = -1, _IPC_CLIENT_SEND = 0, _IPC_CLIENT_CONNECTED, // 1 _IPC_CLIENT_HUNG_UP, // 2 _IPC_SERVER_SEND, // 3 _IPC_SERVER_CONNECTED, // 4 _IPC_SERVER_HUNG_UP, // 5 _IPC_OLD_PATCH_REQUEST, // 6 _IPC_OLD_PATCH_BLOCK, // 7 _IPC_OLD_PATCH_INFO, // 8 _IPC_ROUTE_INFO = 10, _IPC_PATCH_REQUEST, // 11 _IPC_PATCH_BLOCK, // 12 _IPC_PATCH_INFO, // 13 _IPC_PLAYER_CHECK_LOGIN = 14, _IPC_SECURITY, // 15 _IPC_INN_LOGIN, // 16 _IPC_SERVER_PING, // 17 _IPC_PLAYER_QUERY_CHARACTERS, // 18 _IPC_OLD_INN_LOGIN = 20, _IPC_PLAYER_LOGIN, // 21 _IPC_PLAYER_LOGOUT, // 22 _IPC_PLAYER_PAGE, // 23 _IPC_PLAYER_SYSTEM_MSG, // 24 _IPC_PLAYER_ACK, // 25 _IPC_PLAYER_NAK, // 26 _IPC_PLAYER_ADD_ROOM, // 27 _IPC_PLAYER_READ_ROOM, // 28 _IPC_PLAYER_UPDATE_ROOM, // 29 _IPC_PLAYER_DELETE_ROOM, // 30 _IPC_PLAYER_UNLINK_ROOM, // 31 _IPC_PLAYER_CHANGE_ROOM, // 32 _IPC_PLAYER_NEW_ROOM, // 33 _IPC_PLAYER_INVALIDATE_ROOMS, // 34 _IPC_PLAYER_ENTERED_GAME, // 35 _IPC_PLAYER_EXITED_GAME, // 36 _IPC_PLAYER_ROOM_CHAT, // 37 _IPC_PLAYER_TEXT, // 38 _IPC_PLAYER_CREATE_OBJ, // 39 _IPC_PLAYER_OBJ_INFO, // 40 _IPC_PLAYER_MOVIE, // 41 _IPC_PLAYER_MOVIE_DATA, // 42 _IPC_PLAYER_CHAT, // 43 _IPC_PLAYER_SERVID, // 44 _IPC_PLAYER_DESTROY_OBJECT, // 45 _IPC_OLD_SERVER_PING, // 46 _IPC_CLIENT_PING, // 47 _IPC_PLAYER_CREATE_CHARACTER, // 48 _IPC_PLAYER_DESTROY_CHARACTER, // 49 _IPC_PLAYER_OLD_QUERY_CHARACTERS, // 50 _IPC_PLAYER_REQUEST_SERVID, // 51 _IPC_PLAYER_SHIFT_ROOM, // 52 _IPC_PLAYER_CHARACTER_INFO, // 53 _IPC_PLAYER_OLD_CHARACTER_LOGIN, // 54 _IPC_PLAYER_GET_BIOGRAPHY, // 55 _IPC_PLAYER_SET_BIOGRAPHY, // 56 _IPC_PLAYER_GET_DESCRIPTION, // 57 _IPC_PLAYER_GET_EXTENDED_PROPS, // 58 _IPC_PLAYER_SET_HEAD_DATA, // 59 _IPC_PLAYER_GET_CHAR_INFO, // 60 _IPC_PLAYER_WHO, // 61 _IPC_PLAYER_OLD_CHECK_LOGIN, // 62 _IPC_ATTACH_EFFECT, // 63 _IPC_REMOVE_EFFECT, // 64 _IPC_PLAYER_EFFECT_DATA, // 65 _IPC_SET_PROP, // 66 _IPC_COMBAT_BEGIN, // 67 _IPC_COMBAT_MOVE, // 68 _IPC_COMBAT_EXIT, // 69 _IPC_COMBAT_FLEE, // 70 _IPC_GET_SHOP_INFO, // 71 _IPC_SHOP_BUY, // 72 _IPC_SHOP_EXAMINE, // 73 _IPC_SHOP_SELL, // 74 _IPC_SHOP_GET_PRICE, // 75 _IPC_MONEY_DROP, // 76 _IPC_MONEY_PUT, // 77 _IPC_MONEY_GIVE, // 78 _IPC_MONEY_TAKE, // 79 _IPC_CAST_SPELL, // 80 _IPC_PLAYER_INFO, // 81 _IPC_GET_BOOK_INFO, // 82 _IPC_GET_BOOK_PAGE, // 83 _IPC_FATAL_DATA, // 84 _IPC_LOCK_OBJ, // 85 _IPC_UNLOCK_OBJ, // 86 _IPC_GROUP_JOIN, // 87 _IPC_GROUP_LEAVE, // 88 _IPC_GROUP_KICK, // 89 _IPC_GROUP_QUESTION, // 90 _IPC_SECURITY_REQUEST, // 91 _IPC_GET_POSN, // 92 _IPC_CHANGE_PASSWORD, // 93 _IPC_GET_HOUSE, // 94 _IPC_GET_ENTRY_INFO, // 95 _IPC_TALK, // 96 _IPC_LOGIN_DONE, // 97 _IPC_LOGIN_UPDATE, // 98 _IPC_FOREFIT_TURN, // 99 _IPC_OLD_ROUTE_INFO, // 100 _IPC_SHOP_RECHARGE, // 101 _IPC_SHOP_GET_RECHARGE_PRICE, // 102 _IPC_SET_TITLE, // 103 _IPC_TREE_GET, // 104 _IPC_TREE_CHOOSE_TOPIC, // 105 _IPC_TREE_GET_TEXT, // 106 _IPC_TREE_BACK, // 107 _IPC_QUEST_ACCEPT, // 108 _IPC_QUEST_DECLINE, // 109 _IPC_GET_QUEST_LIST, // 110 _IPC_MIX_OBJECT, // 111 _IPC_COMBAT_ACTION, // 112 _IPC_CREATE_OBJECT, // 113 _IPC_WHATS_NEW, // 114 _IPC_SET_ENGRAVE_NAME, // 115 _IPC_GET_LOOK_INFO, // 116 _IPC_SELL_CRYSTALS, // 117 _IPC_BULK_TAKE, // 118 _IPC_BULK_DROP, // 119 _IPC_BULK_PUT, // 120 _IPC_BULK_GIVE, // 121 _IPC_REPAIR, // 122 _IPC_GET_REPAIR_PRICE, // 123 _IPC_UPDATE_ATTRIBUTES, // 124 _IPC_SEND_REG, // 125 _IPC_MASS_SELL, // 126 _IPC_MASS_BUY, // 127 _IPC_GET_SELL_PRICES, // 128 _IPC_CREATE_CHANNEL, // 129 _IPC_PLAYER_CHARACTER_LOGIN, // 130 _IPC_GET_REPAIR_PRICES, // 131 _IPC_MASS_REPAIR, // 132 _IPC_ROCKING, // 133 _IPC_TRADE, // 134 _IPC_MAIL_LIST_GET = 135, _IPC_MAIL_MESSAGE_GET, // 136 _IPC_MAIL_MESSAGE_DELETE, // 137 _IPC_MAIL_MESSAGE_SEND, // 138 _IPC_MAIL_MESSAGE_ARCHIVE, // 139 _IPC_MAIL_MESSAGE_COMPLAIN, // 140 _IPC_WRITE_SPELLS = 145, _IPC_VERB_GET = 150, _IPC_VERB_DROP, // 151 _IPC_VERB_PUT_IN, // 152 _IPC_VERB_PUT_ON, // 153 _IPC_VERB_TAKE_OFF, // 154 _IPC_VERB_OPEN, // 155 _IPC_VERB_CLOSE, // 156 _IPC_VERB_LOCK, // 157 _IPC_VERB_UNLOCK, // 158 _IPC_VERB_ATTACK, // 159 _IPC_VERB_ENGAGE, // 160 _IPC_VERB_CONSUME, // 161 _IPC_VERB_SIT, // 162 _IPC_VERB_STAND, // 163 _IPC_VERB_GIVE, // 164 _IPC_VERB_MEMORIZE, // 165 _IPC_VERB_ROB, // 166 _IPC_VERB_USE, // 167 _IPC_VERB_PUSH, // 168 _IPC_VERB_DYE, // 169 _IPC_VERB_COMBINE, // 170 _IPC_NPC_PULSE = 180, _IPC_TIMER_PULSE, // 181 _IPC_COMBAT_PULSE, // 182 _IPC_ZONE_RESET_PULSE, // 183 _IPC_PROCESS_AFFECT_PULSE, // 184 _IPC_CHAR_DOIT_PULSE, // 185 _IPC_HEAL_PULSE, // 186 _IPC_PING_PULSE, // 187 _IPC_MONSTER_PULSE, // 188 _IPC_MAINTENANCE_PULSE, // 189 _IPC_RESET_PULSE, // 190 _IPC_ZONE_RESET_CMD, // 191 _IPC_ADD_TO_ROOM, // 192 _IPC_TOSS_DEAD_HOUSES, // 193 _IPC_DUNGEON_QUEUE_PULSE, // 194 _IPC_TOSS_DEAD_MAIL, // 195 _IPC_AMBUSH_PULSE, // 196 _IPC_SAVE_STATE, // 197 _IPC_FILEMGR_HELLO = 200, _IPC_FILEMGR_GET, // 201 _IPC_FILEMGR_PUT, // 202 _IPC_FILEMGR_EXISTS, // 203 _IPC_FILEMGR_ERASE, // 204 _IPC_FILEMGR_APPEND, // 205 _IPC_FILEMGR_EXCLUSIVE_CREATE, // 206 _IPC_DATAMGR_LOG_PERMANENT = 210, _IPC_DATAMGR_LOGIN, // 211 _IPC_DATAMGR_LOGOUT, // 212 _IPC_DATAMGR_NEW_CHAR, // 213 _IPC_DATAMGR_SAVE_CHAR, // 214 _IPC_DATAMGR_DEL_CHAR, // 215 _IPC_DATAMGR_SUSPEND, // 216 _IPC_DATAMGR_DISABLE, // 217 _IPC_DATAMGR_REVOKE, // 218 _IPC_DATAMGR_GAG, // 219 _IPC_DATAMGR_SETPASS, // 220 _IPC_DATAMGR_NEW_HOUSE, // 221 _IPC_DATAMGR_WRITE_HOUSE, // 222 _IPC_DATAMGR_DEL_HOUSE, // 223 _IPC_DATAMGR_GET_HOUSE, // 224 _IPC_DATAMGR_HELLO, // 225 _IPC_DATAMGR_GET_ALL_HOUSES, // 226 _IPC_DATAMGR_GET_NEXT_HOUSE, // 227 _IPC_DATAMGR_LOGINMESSAGE, // 228 _IPC_DATAMGR_DOWNTIMEMESSAGE, // 229 _IPC_DATAMGR_SET_RIGHTS, // 230 _IPC_DATAMGR_WHATS_NEW, // 231 _IPC_DATAMGR_LOG_ENGRAVE, // 232 _IPC_DATAMGR_MAIL, // 233 _IPC_DATAMGR_COPPER, // 234 _IPC_DATAMGR_CREDIT, // 235 _IPC_DATAMGR_CONFIG_INFO, // 236 _IPC_DATAMGR_PLACE_BOUNTY, // 237 _IPC_DATAMGR_GAME_CRASHER = 253, _IPC_CLIENT_HACKED_MSG = 254, _IPC_MAX_MESSAGES }; enum { _TRADE_START, _TRADE_QUESTION, _TRADE_OPEN, _TRADE_CLOSE, _TRADE_CHECK_ON, _TRADE_CHECK_OFF, _TRADE_OBJ_LOOK, _TRADE_OBJ_ADD, _TRADE_OBJ_LIST }; enum { _DATAMGR_MAIL_GET_LIST = 1, _DATAMGR_MAIL_GET, _DATAMGR_MAIL_DELETE, _DATAMGR_MAIL_SEND, _DATAMGR_MAIL_ARCHIVE, _DATAMGR_MAIL_COMPLAIN, _DATAMGR_MAX_MAIL }; enum { _DATAMGR_CONFIG_INFO_GET = 1, _DATAMGR_CONFIG_INFO_WRITE_QUESTS, _DATAMGR_CONFIG_INFO_WRITE_CRIMES, _DATAMGR_CONFIG_INFO_ADD_FRIEND, _DATAMGR_CONFIG_INFO_DEL_FRIEND, _DATAMGR_CONFIG_INFO_ADD_FOE, _DATAMGR_CONFIG_INFO_DEL_FOE, _DATAMGR_CONFIG_INFO_WRITE_SPELLS, _DATAMGR_CONFIG_INFO_CHECK_FOE, }; extern char gMsgNames[256][60]; /* player/object manager message structures */ class IPCPMMessage { public: int to; int from; }; class IPCPMAckMsg : public IPCPMMessage { public: int command, info; }; class IPCPMNakMsg : public IPCPMAckMsg {}; class IPCPMChatMsg : public IPCPMMessage { public: int servID; }; class IPCStats { protected: int m_nType; clock_t m_nExecTime; long long m_nInCount; long long m_nInbound; long long m_nOutCount; long long m_nOutbound; long long m_nAcked; long long m_nNaked; static int m_nSlowestMsg; static clock_t m_nSlowestTime; static time_t m_nStartTime; public: IPCStats(); void addExecTime( clock_t nTime, IPCMessage* pMsg ); void addOutbound( int nSize, int* nBuf ); char* displayStats( int nCount ); char* displaySlowest(); static char* display(); static void init(); static IPCStats Msgs[ _IPC_MAX_MESSAGES ]; }; #endif
61b9553d775e4ba154f397bcd928409d845b2d2a
5d385a65dcc228d7a99b761e110164c643e81818
/ps2/ps2.ino
4f8ec48888780b7877fae6057876935baa6098e7
[]
no_license
xtsimpouris/arduino-test-code
c083b8f582d72936bfe95eb720d00e795cf91e19
643f51cd1603083a7f56811fff485e6fb2fa6072
refs/heads/master
2020-05-02T11:28:15.282765
2012-08-30T10:25:24
2012-08-30T10:25:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,748
ino
ps2.ino
// include the library code: #include <LiquidCrystal.h> #include <PS2Keyboard.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(9, 8, 5, 4, 7, 6); PS2Keyboard keyboard; const int DataPin = 3; // ps2-mple const int IRQpin = 2; // ps2-kitrino // ps2-kokkino = trofodosia // ps2-aspro = geiwsi void setup() { // set up the LCD's number of columns and rows: lcd.begin(20, 4); keyboard.begin(DataPin, IRQpin); } int keypad_availiable() { return keyboard.available(); } char keypad_read() { int k = keyboard.read(); switch(k) { case 109: return '1'; case 118: return '2'; case 42: return '3'; case 47: return 'A'; case 104: return '4'; case 103: return '5'; case 46: return '6'; case 48: return 'B'; case 106: return '7'; case 102: return '8'; case 51: return '9'; case 50: return 'C'; case 121: return '*'; case 116: return '0'; case 54: return '#'; case 53: return 'D'; default: return '?'; } } void loop() { static char p; lcd.clear(); lcd.setCursor(0, 0); int a = keypad_availiable(); lcd.print(a); if (a) { p = keypad_read(); if (p == '1') keyboard.setLed(0, 0); else if (p == '2') keyboard.setLed(1, 0); else if (p == '3') keyboard.setLed(2, 0); else if (p == '4') keyboard.setLed(0, 1); else if (p == '5') keyboard.setLed(1, 1); else if (p == '6') keyboard.setLed(2, 1); else if (p == '7') keyboard.toggleLed(0); else if (p == '8') keyboard.toggleLed(1); else if (p == '9') keyboard.toggleLed(2); } lcd.setCursor(0, 1); lcd.print(p); delay(10); }
ae10d80af79c3511f248b19d3fac47fc27c9622f
4b330850846c6f98b4325dd3c53408cf9f5bd3cf
/IntrinsicRenderer/src/IntrinsicRendererResourcesDrawCall.h
c3bb15bdf591cf8ef95057be4f27697b2f855383
[ "Apache-2.0" ]
permissive
begla/Intrinsic
d172bda49a7dc489fc2d1710ed32a2ae5f57ad41
bbe988993d09cb282a6629db412d764d0daa2e06
refs/heads/master
2023-04-27T19:33:28.633697
2023-04-21T09:42:43
2023-04-21T09:42:43
71,087,084
1,218
106
null
2017-08-19T01:49:10
2016-10-17T00:49:15
C++
UTF-8
C++
false
false
16,732
h
IntrinsicRendererResourcesDrawCall.h
// Copyright 2017 Benjamin Glatzel // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once namespace Intrinsic { namespace Renderer { namespace Resources { // Typedefs typedef Dod::Ref DrawCallRef; typedef _INTR_ARRAY(DrawCallRef) DrawCallRefArray; struct DrawCallData : Dod::Resources::ResourceDataBase { DrawCallData() : Dod::Resources::ResourceDataBase(_INTR_MAX_DRAW_CALL_COUNT) { descVertexCount.resize(_INTR_MAX_DRAW_CALL_COUNT); descIndexCount.resize(_INTR_MAX_DRAW_CALL_COUNT); descInstanceCount.resize(_INTR_MAX_DRAW_CALL_COUNT); descPipeline.resize(_INTR_MAX_DRAW_CALL_COUNT); descBindInfos.resize(_INTR_MAX_DRAW_CALL_COUNT); descVertexBuffers.resize(_INTR_MAX_DRAW_CALL_COUNT); descIndexBuffer.resize(_INTR_MAX_DRAW_CALL_COUNT); descMaterial.resize(_INTR_MAX_DRAW_CALL_COUNT); descMaterialPass.resize(_INTR_MAX_DRAW_CALL_COUNT); descMeshComponent.resize(_INTR_MAX_DRAW_CALL_COUNT); dynamicOffsets.resize(_INTR_MAX_DRAW_CALL_COUNT); vertexBuffers.resize(_INTR_MAX_DRAW_CALL_COUNT); vkDescriptorSet.resize(_INTR_MAX_DRAW_CALL_COUNT); vertexBufferOffsets.resize(_INTR_MAX_DRAW_CALL_COUNT); indexBufferOffset.resize(_INTR_MAX_DRAW_CALL_COUNT); sortingHash.resize(_INTR_MAX_DRAW_CALL_COUNT); } // Description _INTR_ARRAY(uint32_t) descVertexCount; _INTR_ARRAY(uint32_t) descIndexCount; _INTR_ARRAY(uint32_t) descInstanceCount; _INTR_ARRAY(PipelineRef) descPipeline; _INTR_ARRAY(_INTR_ARRAY(BindingInfo)) descBindInfos; _INTR_ARRAY(_INTR_ARRAY(BufferRef)) descVertexBuffers; _INTR_ARRAY(BufferRef) descIndexBuffer; _INTR_ARRAY(Dod::Ref) descMaterial; _INTR_ARRAY(uint8_t) descMaterialPass; _INTR_ARRAY(Dod::Ref) descMeshComponent; // Resources _INTR_ARRAY(_INTR_ARRAY(uint32_t)) dynamicOffsets; _INTR_ARRAY(VkDescriptorSet) vkDescriptorSet; _INTR_ARRAY(_INTR_ARRAY(VkDeviceSize)) vertexBufferOffsets; _INTR_ARRAY(_INTR_ARRAY(VkBuffer)) vertexBuffers; _INTR_ARRAY(VkDeviceSize) indexBufferOffset; _INTR_ARRAY(uint32_t) sortingHash; }; struct DrawCallManager : Dod::Resources::ResourceManagerBase<DrawCallData, _INTR_MAX_DRAW_CALL_COUNT> { _INTR_INLINE static void init() { _INTR_LOG_INFO("Inititializing Draw Call Manager..."); Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_initResourceManager(); } // <- _INTR_INLINE static DrawCallRef createDrawCall(const Name& p_Name) { DrawCallRef ref = Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_createResource(p_Name); return ref; } // <- _INTR_INLINE static void allocateUniformMemory(DrawCallRef p_DrawCall) { _INTR_ARRAY(BindingInfo)& bindInfos = _descBindInfos(p_DrawCall); static const uint32_t perFrameRangeSizeInBytes = sizeof(RenderProcess::PerFrameDataVertex) + sizeof(RenderProcess::PerFrameDataFrament); uint32_t dynamicOffsetIndex = 0u; for (uint32_t bIdx = 0u; bIdx < bindInfos.size(); ++bIdx) { BindingInfo& bindInfo = bindInfos[bIdx]; if (bindInfo.bindingType == BindingType::kUniformBufferDynamic) { if (bindInfo.bufferData.uboType == UboType::kPerInstanceVertex) { UniformManager::allocatePerInstanceDataMemory( bindInfo.bufferData.rangeInBytes, _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex]); } else if (bindInfo.bufferData.uboType == UboType::kPerInstanceFragment) { UniformManager::allocatePerInstanceDataMemory( bindInfo.bufferData.rangeInBytes, _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex]); } else if (bindInfo.bufferData.uboType == UboType::kPerMaterialVertex) { _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex] = MaterialManager::_perMaterialDataVertexOffset( _descMaterial(p_DrawCall)); } else if (bindInfo.bufferData.uboType == UboType::kPerMaterialFragment) { _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex] = MaterialManager::_perMaterialDataFragmentOffset( _descMaterial(p_DrawCall)); } else if (bindInfo.bufferData.uboType == UboType::kPerFrameVertex) { _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex] = RenderProcess:: UniformManager::getDynamicOffsetForPerFrameDataVertex(); } else if (bindInfo.bufferData.uboType == UboType::kPerFrameFragment) { _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex] = RenderProcess:: UniformManager::getDynamicOffsetForPerFrameDataFragment(); } ++dynamicOffsetIndex; } } } // <- _INTR_INLINE static void allocateUniformMemory(const DrawCallRefArray& p_DrawCalls, uint32_t p_FirstIdx, uint32_t p_Count) { for (uint32_t dcIdx = p_FirstIdx; dcIdx < p_Count; ++dcIdx) { Resources::DrawCallRef dcRef = p_DrawCalls[dcIdx]; allocateUniformMemory(dcRef); } } // <- _INTR_INLINE static void updateUniformMemory(DrawCallRef p_DrawCall, void* p_PerInstanceDataVertex, uint32_t p_PerInstanceDataVertexSize, void* p_PerInstanceDataFragment, uint32_t p_PerInstanceDataFragmentSize) { _INTR_ARRAY(BindingInfo)& bindInfos = _descBindInfos(p_DrawCall); uint32_t dynamicOffsetIndex = 0u; for (uint32_t bIdx = 0u; bIdx < bindInfos.size(); ++bIdx) { BindingInfo& bindInfo = bindInfos[bIdx]; if (bindInfo.bindingType == BindingType::kUniformBufferDynamic) { const uint32_t dynamicOffset = _dynamicOffsets(p_DrawCall)[dynamicOffsetIndex]; if (bindInfo.bufferData.uboType == UboType::kPerInstanceVertex) { uint8_t* gpuMem = &UniformManager::_perInstanceMemory[dynamicOffset]; memcpy(gpuMem, p_PerInstanceDataVertex, p_PerInstanceDataVertexSize); } else if (bindInfo.bufferData.uboType == UboType::kPerInstanceFragment) { uint8_t* gpuMem = &UniformManager::_perInstanceMemory[dynamicOffset]; memcpy(gpuMem, p_PerInstanceDataFragment, p_PerInstanceDataFragmentSize); } ++dynamicOffsetIndex; } } } // <- _INTR_INLINE static void updateUniformMemory(const DrawCallRefArray& p_DrawCalls, uint32_t p_FirstIdx, uint32_t p_Count, void* p_PerInstanceDataVertex, uint32_t p_PerInstanceDataVertexSize, void* p_PerInstanceDataFragment, uint32_t p_PerInstanceDataFragmentSize) { for (uint32_t dcIdx = p_FirstIdx; dcIdx < p_Count; ++dcIdx) { Resources::DrawCallRef dcRef = p_DrawCalls[dcIdx]; updateUniformMemory( dcRef, p_PerInstanceDataVertex, p_PerInstanceDataVertexSize, p_PerInstanceDataFragment, p_PerInstanceDataFragmentSize); } } // <- _INTR_INLINE static void updateSortingHash(DrawCallRef p_DrawCall, float p_DistToCamera2) { _sortingHash(p_DrawCall) = (_descMaterialPass(p_DrawCall) << 16u) | (uint16_t)p_DistToCamera2; } // <- static void allocateAndUpdateUniformMemory( const DrawCallRefArray& p_DrawCalls, void* p_PerInstanceDataVertex, uint32_t p_PerInstanceDataVertexSize, void* p_PerInstanceDataFragment, uint32_t p_PerInstanceDataFragmentSize) { allocateUniformMemory(p_DrawCalls, 0u, (uint32_t)p_DrawCalls.size()); updateUniformMemory(p_DrawCalls, 0u, (uint32_t)p_DrawCalls.size(), p_PerInstanceDataVertex, p_PerInstanceDataVertexSize, p_PerInstanceDataFragment, p_PerInstanceDataFragmentSize); } // <- static DrawCallRef createDrawCallForMesh( const Name& p_Name, Dod::Ref p_Mesh, Dod::Ref p_Material, uint8_t p_MaterialPass, uint32_t p_PerInstanceDataVertexSize, uint32_t p_PerInstanceDataFragmentSize, uint32_t p_SubMeshIdx = 0u); // <- _INTR_INLINE static void resetToDefault(BufferRef p_Ref) { _descVertexCount(p_Ref) = 0u; _descIndexCount(p_Ref) = 0u; _descInstanceCount(p_Ref) = 1u; _descPipeline(p_Ref) = PipelineRef(); _descBindInfos(p_Ref).clear(); _descVertexBuffers(p_Ref).clear(); _descIndexBuffer(p_Ref) = BufferRef(); _descMaterial(p_Ref) = Dod::Ref(); _descMaterialPass(p_Ref) = 0u; _descMeshComponent(p_Ref) = Dod::Ref(); } _INTR_INLINE static void destroyDrawCall(DrawCallRef p_Ref) { Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_destroyResource(p_Ref); } _INTR_INLINE static void compileDescriptor(DrawCallRef p_Ref, bool p_GenerateDesc, rapidjson::Value& p_Properties, rapidjson::Document& p_Document) { Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_compileDescriptor(p_Ref, p_GenerateDesc, p_Properties, p_Document); } _INTR_INLINE static void initFromDescriptor(DrawCallRef p_Ref, bool p_GenerateDesc, rapidjson::Value& p_Properties) { Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_initFromDescriptor(p_Ref, p_GenerateDesc, p_Properties); } _INTR_INLINE static void saveToSingleFile(const char* p_FileName) { Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_saveToSingleFile(p_FileName, compileDescriptor); } _INTR_INLINE static void loadFromSingleFile(const char* p_FileName) { Dod::Resources::ResourceManagerBase< DrawCallData, _INTR_MAX_DRAW_CALL_COUNT>::_loadFromSingleFile(p_FileName, initFromDescriptor, resetToDefault); } // <- _INTR_INLINE static void createAllResources() { destroyResources(_activeRefs); createResources(_activeRefs); } // <- static void createResources(const DrawCallRefArray& p_DrawCalls); // <- _INTR_INLINE static void destroyResources(const DrawCallRefArray& p_DrawCalls) { for (uint32_t i = 0u; i < p_DrawCalls.size(); ++i) { DrawCallRef drawCallRef = p_DrawCalls[i]; VkDescriptorSet& vkDescSet = _vkDescriptorSet(drawCallRef); PipelineRef pipeline = _descPipeline(drawCallRef); _INTR_ASSERT(pipeline.isValid()); DrawCallRef pipelineLayout = PipelineManager::_descPipelineLayout(pipeline); _INTR_ASSERT(pipelineLayout.isValid()); if (vkDescSet != VK_NULL_HANDLE) { VkDescriptorPool vkDescPool = PipelineLayoutManager::_vkDescriptorPool(pipelineLayout); _INTR_ASSERT(vkDescPool != VK_NULL_HANDLE); RenderSystem::releaseResource(_N(VkDescriptorSet), (void*)vkDescSet, (void*)vkDescPool); vkDescSet = VK_NULL_HANDLE; } _vertexBufferOffsets(drawCallRef).clear(); _indexBufferOffset(drawCallRef) = 0ull; _dynamicOffsets(drawCallRef).clear(); // Remove from per material pass array uint8_t materialPass = _descMaterialPass(drawCallRef); { uint32_t dcCount = (uint32_t)_drawCallsPerMaterialPass[materialPass].size(); for (uint32_t i = 0u; i < dcCount; ++i) { if (_drawCallsPerMaterialPass[materialPass][i] == drawCallRef) { // Erase and swap _drawCallsPerMaterialPass[materialPass][i] = _drawCallsPerMaterialPass[materialPass][dcCount - 1u]; _drawCallsPerMaterialPass[materialPass].resize(dcCount - 1u); break; } } } } } // <- _INTR_INLINE static void destroyDrawCallsAndResources(const DrawCallRefArray& p_DrawCalls) { destroyResources(p_DrawCalls); for (uint32_t i = 0u; i < p_DrawCalls.size(); ++i) { destroyDrawCall(p_DrawCalls[i]); } } // <- _INTR_INLINE static void sortDrawCallsFrontToBack(DrawCallRefArray& p_RefArray) { _INTR_PROFILE_CPU("General", "Sort Draw Calls"); struct Comparator { bool operator()(const Dod::Ref& a, const Dod::Ref& b) const { return _sortingHash(a) < _sortingHash(b); } } comp; Algorithm::parallelSort<Dod::Ref, Comparator>(p_RefArray, comp); } // <- _INTR_INLINE static void sortDrawCallsBackToFront(DrawCallRefArray& p_RefArray) { _INTR_PROFILE_CPU("General", "Sort Draw Calls"); struct Comparator { bool operator()(const Dod::Ref& a, const Dod::Ref& b) const { return _sortingHash(a) > _sortingHash(b); } } comp; Algorithm::parallelSort<Dod::Ref, Comparator>(p_RefArray, comp); } // <- static void bindImage(DrawCallRef p_DrawCallRef, const Name& p_Name, uint8_t p_ShaderStage, Dod::Ref p_ImageRef, uint8_t p_SamplerIdx, uint8_t p_BindingFlags = 0u, uint8_t p_ArrayLayerIdx = 0u, uint8_t p_MipLevelIdx = 0u); static void bindBuffer(DrawCallRef p_DrawCallRef, const Name& p_Name, uint8_t p_ShaderStage, Dod::Ref p_BufferRef, uint8_t p_UboType, uint32_t p_RangeInBytes, uint32_t p_OffsetInBytes = 0u); // Description _INTR_INLINE static uint32_t& _descVertexCount(DrawCallRef p_Ref) { return _data.descVertexCount[p_Ref._id]; } _INTR_INLINE static uint32_t& _descIndexCount(DrawCallRef p_Ref) { return _data.descIndexCount[p_Ref._id]; } _INTR_INLINE static uint32_t& _descInstanceCount(DrawCallRef p_Ref) { return _data.descInstanceCount[p_Ref._id]; } _INTR_INLINE static PipelineRef& _descPipeline(DrawCallRef p_Ref) { return _data.descPipeline[p_Ref._id]; } _INTR_INLINE static _INTR_ARRAY(BindingInfo) & _descBindInfos(DrawCallRef p_Ref) { return _data.descBindInfos[p_Ref._id]; } _INTR_INLINE static _INTR_ARRAY(BufferRef) & _descVertexBuffers(DrawCallRef p_Ref) { return _data.descVertexBuffers[p_Ref._id]; } _INTR_INLINE static BufferRef& _descIndexBuffer(DrawCallRef p_Ref) { return _data.descIndexBuffer[p_Ref._id]; } _INTR_INLINE static Dod::Ref& _descMaterial(DrawCallRef p_Ref) { return _data.descMaterial[p_Ref._id]; } _INTR_INLINE static Dod::Ref& _descMeshComponent(DrawCallRef p_Ref) { return _data.descMeshComponent[p_Ref._id]; } _INTR_INLINE static uint8_t& _descMaterialPass(DrawCallRef p_Ref) { return _data.descMaterialPass[p_Ref._id]; } // Resources _INTR_INLINE static uint32_t& _sortingHash(DrawCallRef p_Ref) { return _data.sortingHash[p_Ref._id]; } _INTR_INLINE static _INTR_ARRAY(uint32_t) & _dynamicOffsets(DrawCallRef p_Ref) { return _data.dynamicOffsets[p_Ref._id]; } _INTR_INLINE static _INTR_ARRAY(VkDeviceSize) & _vertexBufferOffsets(DrawCallRef p_Ref) { return _data.vertexBufferOffsets[p_Ref._id]; } _INTR_INLINE static _INTR_ARRAY(VkBuffer) & _vertexBuffers(DrawCallRef p_Ref) { return _data.vertexBuffers[p_Ref._id]; } _INTR_INLINE static VkDeviceSize& _indexBufferOffset(DrawCallRef p_Ref) { return _data.indexBufferOffset[p_Ref._id]; } _INTR_INLINE static VkDescriptorSet& _vkDescriptorSet(DrawCallRef p_Ref) { return _data.vkDescriptorSet[p_Ref._id]; } // Static members static _INTR_ARRAY(_INTR_ARRAY(DrawCallRef)) _drawCallsPerMaterialPass; }; } } }
d02ccc15a648148326da6da3a1fa78f393d6ebce
73bd731e6e755378264edc7a7b5d16132d023b6a
/CodeForces/984C-1.cpp
bf411f36b609cb3e8c0b6b4a4a4f866669c6fe48
[]
no_license
IHR57/Competitive-Programming
375e8112f7959ebeb2a1ed6a0613beec32ce84a5
5bc80359da3c0e5ada614a901abecbb6c8ce21a4
refs/heads/master
2023-01-24T01:33:02.672131
2023-01-22T14:34:31
2023-01-22T14:34:31
163,381,483
0
3
null
null
null
null
UTF-8
C++
false
false
443
cpp
984C-1.cpp
// BISMILLAHIR RAHMANIR RAHIM #include <bits/stdc++.h> #define MAX 100005 using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); ll p, q, b; int test; cin>>test; while(test--){ cin>>p>>q>>b; if((__gcd(p, q) == 1 && q != 1)){ cout<<"Infinite"<<endl; } else{ cout<<"Finite"<<endl; } } return 0; }