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
d2fc4f653cde2d2ca565c7db7e6b01d8dcf5cc7f
b8a317bfd56ce30ff8eb376ca229e89e43a926f7
/test/base/testFileUtil.h
c23d248890afe3634e2b47f25f3d0889254ccd8a
[]
no_license
linxiangyao/sc
e7f0efb3fb9f68a68c7cf63b5cd9acb68d2495db
53938e9019da2b9bfd222206a7bf3fc20831ebab
refs/heads/master
2020-03-25T01:55:50.456389
2018-08-08T02:01:28
2018-08-08T02:01:28
143,265,160
0
0
null
null
null
null
UTF-8
C++
false
false
372
h
testFileUtil.h
#ifndef __TEST_FILE_UTIL_H #define __TEST_FILE_UTIL_H #include "../comm.h" using namespace std; USING_NAMESPACE_S void __testFileUtil() { printf("\n__testFileUtil ---------------------------------------------------------\n"); std::string str; FileUtil::readFileAllContent("test.txt", str); cout << "test.txt content=" << endl << str << endl; } #endif
a56573d2e4ccf336e60d2330662bf218a2d8f8e2
d6471818bb77d0ebf568991fcc0622f08019522a
/Project14/Project14/Source.cpp
4d590f11ac2b18472db88d62e8e32c470b8b967b
[]
no_license
Blizzard-Nova/AVL-Balanced-tree
1e5679bba353ec4e353c1d76ecae9e6f9702e293
fc2694e70461fbcb9e270e622ad5bccba6d766ad
refs/heads/main
2023-07-07T02:06:17.832896
2021-08-11T15:53:07
2021-08-11T15:53:07
395,042,326
0
0
null
null
null
null
UTF-8
C++
false
false
3,380
cpp
Source.cpp
#include <iostream> using namespace std; struct node { int data; node* right; node* left; int height; }; class BST { public: BST(); void insert(int val); void inorder_print(); int max_depth(); private: node* insert(int val, node* leaf); void inorder_print(node* leaf); int MaxDepth(node* leaf); int getBalance(node* leaf); int height(node* leaf); node* RightRotate(node* a); node* LeftRotate(node* b); node* root; }; BST::BST() { root = NULL; } node* BST::insert(int val, node* leaf) { if (leaf == NULL) { leaf = new node; leaf->data = val; leaf->left = NULL; leaf->right = NULL; leaf->height = 1; } else if (val < leaf->data) { leaf->left = insert(val, leaf->left); } else if (val > leaf->data) { leaf->right = insert(val, leaf->right); } return leaf; leaf->height = MaxDepth(leaf); int balance = getBalance(leaf); //If nodes become un balanced then there are four cases //LEFT LEFT CASE if (balance > 1 && val < leaf->left->data) { return RightRotate(leaf); } //RIGHT RIGHT CASSE if (balance > 1 && val > leaf->right->data) { return LeftRotate(leaf); } //LEFT RIGHT CASE if (balance > 1 && val > leaf->left->data) { leaf->left = LeftRotate(leaf->left); return RightRotate(leaf); } //RIGHT LEFT ROTATE if (balance > 1 && val < leaf->right->data) { leaf->right = RightRotate(leaf->right); return LeftRotate(leaf); } } void BST::inorder_print(node* leaf) { if (leaf == NULL) return; else { inorder_print(leaf->left); cout << leaf->data << " " << endl; inorder_print(leaf->right); } } int BST::MaxDepth(node* leaf) { if (leaf == NULL) { return 0; } else { int LDepth = MaxDepth(leaf->left); int RDepth = MaxDepth(leaf->right); if (LDepth > RDepth) { return(LDepth + 1); } else { return(RDepth + 1); } } } void BST::insert(int x) { root = insert(x, root); } void BST::inorder_print() { inorder_print(root); } int BST::max_depth() { return MaxDepth(root); } node* BST::RightRotate(node* y) { node* x = y->left; node* child = x->right; //Now Performing Rotation x->right = y; y->left = child; //Updating heights y->height = max(height(y->left), height(y->right)) + 1; x->height = max(height(x->left), height(x->right)) + 1; //Return new root return x; } node* BST::LeftRotate(node* x) { node* y = x->right; node* Child2 = y->left; //Perform rotation y->left = x; y->right = Child2; //Updating Heights x->height = max(height(x->left), height(x->right) + 1); y->height = max(height(y->left), height(x->right) + 1); return y; } int BST::getBalance(node* leaf) { if (leaf == NULL) { return 0; } else { return height(leaf->left) - height(leaf->right); } } int BST::height(node* leaf) { if (leaf == NULL) { return 0; } else { return leaf->height; } } int main() { BST bst; bst.insert(20); bst.insert(15); bst.insert(10); bst.insert(25); bst.insert(30); bst.insert(12); bst.insert(22); cout << "Inorder arrangement of the balanced tree is \n"; bst.inorder_print(); cout << endl; cout << endl; cout << "Maximum depth of the tree is "<< bst.max_depth()<<endl; return 0; }
72e8e6c22d71243263aec51197a33defed0f518f
bed88e5d7e40ebb11ec19488596d7a8a9b9c99ac
/organizacao_e_recuperacao_de_inforacoes/fixofixo.cpp
1f2ce64df12386444115d0bc04fd4dd884b7e49a
[]
no_license
BGCX067/fabiocpngraduationworks-svn-to-git
cb1e84f4956b6096e8698946d3e93fa0008d90ba
1ccbcdfc9bbaf1256a90867a0f3a79f9e3a891fb
refs/heads/master
2016-09-01T08:53:25.337196
2015-12-28T14:38:33
2015-12-28T14:38:33
48,759,709
0
0
null
null
null
null
ISO-8859-1
C++
false
false
4,198
cpp
fixofixo.cpp
/*Organização e Recuperação da Informação Manipulação de Registros em Arquivo Registros e Campos de Tamanho Fixo*/ #include <iostream> #include <fstream> using namespace std; class Pessoa { private: char *key; //A chave possui 4 dígitos char *lastname; char *firstname; char *address; char *city; char *state; //Formato ST char *zip; //Formato 13565-000 char *phone; //Formato 16-8888-3456 public: Pessoa(); Pessoa( char[], char[], char[], char[], char[], char[], char[], char[] ); ~Pessoa(); char *getkey(); char *getlastname(); char *getfirstname(); char *getaddress(); char *getcity(); char *getstate(); char *getzip(); char *getphone(); }; Pessoa::Pessoa(){} Pessoa::Pessoa( char chave[], char ultNome[], char primNome[], char endereco[], char cidade[], char estado[], char cep[], char telefone[]) { key = chave; lastname = ultNome; firstname = primNome; address = endereco; city = cidade; state = estado; zip = cep; phone = telefone; } Pessoa::~Pessoa() { delete key; delete lastname; delete firstname; delete address; delete city; delete state; delete zip; delete phone; } char * Pessoa::getkey() { return key; } char * Pessoa::getlastname() { return lastname; } char * Pessoa::getfirstname() { return firstname; } char * Pessoa::getaddress() { return address; } char * Pessoa::getcity() { return city; } char * Pessoa::getstate() { return state; } char * Pessoa::getzip() { return zip; } char * Pessoa::getphone() { return phone; } void gravaRegistro( Pessoa p) { ofstream arquivo( "regs.dat", ios::app ); if (! arquivo ) { cerr << "Arquivo nao pode ser aberto. Programa abortado\n"; system( "Pause"); exit(1); //Aborta a execução em caso de erro na abertura do arquivo } arquivo.write( reinterpret_cast< const char * > ( &p ), sizeof( Pessoa )); arquivo.close(); } void leRegistro() { Pessoa p; ifstream arquivo( "regs.dat", ios::in ); if (! arquivo ) { cerr << "Arquivo nao pode ser aberto. Programa abortado\n"; system( "Pause"); exit(1); //Aborta a execução em caso de erro na abertura do arquivo } arquivo.read( reinterpret_cast< char * > ( &p ), sizeof( Pessoa )); cout << p.getkey() << endl << p.getfirstname(); arquivo.close(); } void pegaDados() { char chave[ 5 ], nome[ 15 ], sobrenome[ 15 ], endereco[ 35 ], cidade[ 15 ], estado[ 15 ], cep[ 10 ], telefone[ 13 ]; cout << "Chave: "; cin.getline( chave, 5); cin.ignore(); cout << "Nome: "; cin.getline( nome, 15 ); cin.ignore(); cout << "Sobrenome: "; cin.getline( sobrenome, 15 ); cin.ignore(); cout << "Endereco: "; cin.getline( endereco, 35 ); cin.ignore(); cout << "Cidade: "; cin.getline( cidade, 14 ); cin.ignore(); cout << "Estado: "; cin.getline( estado, 14 ); cin.ignore(); cout << "CEP: "; cin.getline( cep, 9 ); cin.ignore(); cout << "Telefone: "; cin.getline( telefone, 12 ); cin.ignore(); Pessoa p( chave, sobrenome, nome, endereco, cidade, estado, cep, telefone ); gravaRegistro( p ); } int main() { fstream arquivo( ¨regs.dat¨, ios::in|ios::out ); arquivo.close(); pegaDados(); leRegistro(); system( "pause" ); return 0; }
4cd23355408e19ccc32c260079b78def392e7e09
48425ca11050646f5f0f956106b7d9d13d827e6f
/gfg/C++ productivity hacks/passing1d_array_vector.cpp
c2e926cd794593658bd9f50f52bf32e5452d7ac4
[]
no_license
Saptarshidas131/CPP
1d854ca530c0f17407c587c7528b4d30d2528811
c93cce85089e6ec28820c91a2c6da39576889c4a
refs/heads/main
2023-05-30T21:35:56.218850
2021-06-28T08:04:36
2021-06-28T08:04:36
321,994,798
1
0
null
null
null
null
UTF-8
C++
false
false
464
cpp
passing1d_array_vector.cpp
#include <iostream> #include <vector> using namespace std; void fun(int a[], int n) { for (int i = 0; i < n; i++) cout << a[i] << ' '; cout << '\n'; } void fun(const vector<int> &v) // using reference to avoid copying of vector { for(auto x : v) cout << x << " "; cout << "\n"; } int main() { int a[] = { 1, 2, 3, 4, 5 }; int n = sizeof(a) / sizeof(int); fun(a, n); vector<int> v{1,2,3,4}; fun(v); return 0; }
89d6dfcea57945b4970511eb0fe913842e1471a2
af168681c24ed4f20a8902de694e5d2c7f18c89d
/DS DATASTUCTURES/BUILDING TREE.cpp
7cbf3599d28989c8c6be3ace457ae36ab0852b3c
[]
no_license
Captain272/cpp_code_base
1dc552094940c301790e9313509412c782e97597
38f6d7aaca9cf6cabfc705a111fd99f10971d6ee
refs/heads/master
2023-08-28T12:34:58.637415
2021-10-01T07:51:30
2021-10-01T07:51:30
412,550,375
0
0
null
null
null
null
UTF-8
C++
false
false
1,015
cpp
BUILDING TREE.cpp
#include<iostream> using namespace std; struct node { int data; node* left; node* right; }*root=NULL,*temp=NULL,*p=NULL; node * create(int a) { node* temp=new node; temp->data=a; temp->left=NULL; temp->right=NULL; if(root==NULL) { root=temp; } return temp; } node* insert(int a,node* p) { if(p==NULL) { create(a); } else if(a<p->data) { //cout<<"Left check"; p->left=insert(a,p->left); } else if(a>p->data) { //cout<<"Right check"; p->right=insert(a,p->right); } } node* preorder(node* p) { if(p!=NULL) { cout<<p->data; preorder(p->left); preorder(p->right); } } void display() { temp=root; while(temp!=NULL) { cout<<temp->data; temp=temp->right; } } int main() { int a; cout<<"Enter the root element"; cin>>a; root=create(a); int n[6]={4,3,5,8,7,9}; // cout<<"Enter the No. of elements: "; // cin>>n; for(int i=1;i<6;i++) { insert(n[i],root); } // cout<<"HI"; // cout<<root->data; // cout<<root->right->right->data; p=root; preorder(root); }
66382ec2f964f84c936149971dc8564f09b2ce35
1de094a15fa0067b63e8a7106209dfe29e803ea9
/STL/my_first_hash_table.cpp
3b5e7f5a2ecd5eca86c313b47faa3ddbcde788b7
[]
no_license
jigsaw5071/algorithms
70146537d2e617c02f6253549abc8a32d9361272
9144b2c117f2845ab125b89aeec6b33891c98dd3
refs/heads/master
2020-07-20T19:03:11.431940
2019-10-17T22:17:36
2019-10-17T22:17:36
66,913,566
0
0
null
null
null
null
UTF-8
C++
false
false
1,628
cpp
my_first_hash_table.cpp
/* -By Shubham Sharma :13-10-2016 HASHING FUNCTION FOR INTEGER THAT ARE MOSTLY REPEATING FOR LEETCODE QUESTION MAJORITY ELEMENT */ #include<bits/stdc++.h> using namespace std; #define TABLE_SIZE 4999 // prime number is best probability of collisions is low class _hash_map{ private: vector<list<pair<int,int>>> _hash_table; public: _hash_map(){ vector<list<pair<int,int>>> v(TABLE_SIZE); _hash_table=v; } int _get_size(); void _insert(int); int _get_count(int); }; /* utility function to get the size of the hash table */ int _hash_map::_get_size(){ return _hash_table.size(); } /* utility function to insert a variable */ void _hash_map::_insert(const int key){ int n=key%TABLE_SIZE; if(_hash_table[n].begin()==_hash_table[n].end()){ _hash_table[n].push_back(make_pair(key,1)); } else{ list<pair<int,int>>& L=_hash_table[n]; bool _found=false; for(auto iter=L.begin();iter!=L.end();++iter){ if(iter->first==key){ _found=true; iter->second=iter->second+1; break; } } if(!_found){ L.push_back(make_pair(key,1)); } } } /* utility function to get the count of the key */ int _hash_map::_get_count(const int key){ int n=key%TABLE_SIZE; list<pair<int,int>>& L=_hash_table[n]; for(auto iter=L.begin();iter!=L.end();++iter){ if(iter->first==key){ return iter->second; } } return 0; } int main(void){ _hash_map H; H._insert(25); return 0; }
6764374ac04b528f4ed99dad60b769d9b1a6040d
c0b429e6aafe68c6896a947b231bb34280d14ca4
/src/RenderingEngineRayTraceFunc.cpp
4528b65450a975bbe55a7f86ba436c8eb4bb8923
[]
no_license
jbpagliuco/CS419RayTracer
d48ce0e75ee13f081573d6f6158b6241ad4ab34e
d9bc4bfa3fdf0aaa68cb062d0c73e4fbc53bbadb
refs/heads/master
2020-12-30T23:10:35.974218
2017-03-28T02:35:18
2017-03-28T02:35:18
80,589,830
0
0
null
2017-03-28T02:35:19
2017-02-01T04:35:21
C++
UTF-8
C++
false
false
3,110
cpp
RenderingEngineRayTraceFunc.cpp
#include <RenderingEngine.h> #include <Log.h> #include <fstream> #include <direct.h> namespace RE { // RIGHT HANDED COORDINATE SYSTEM void RenderingEngine::RunRayTracer() { if (!pWorld) { RE_LOGERROR(RENDER_ENG, RUNTIME, "World reference not set. Not able to draw scene."); return; } RE_LOG(RENDER_ENG, RUNTIME, "Running ray tracing algorithm..."); // Start time auto start = GetTime(); // Run ray tracer RenderScene(); // Total running time for the ray tracer U64 elapsedTime = DiffTime(start, GetTime()); D64 elapsedSeconds = ((D64)elapsedTime / 1000000.0); D64 elapsedMinutes = elapsedSeconds / 60.0; // Viewport stats U32 width = pCamera->GetViewport().GetWidth(); U32 height = pCamera->GetViewport().GetHeight(); U32 numSamples = pCamera->GetViewport().GetSampler()->GetNumSamples(); // Other stats U64 numWorldElements = pWorld->GetRenderables().size(); U64 numPrimaryRays = numSamples * width * height; U64 numLights = pWorld->GetLights().size(); D64 averageTPP = (D64)elapsedTime / ((D64)width * (D64)height); std::stringstream ss; ss << "------------------------------------------------------------" << "\nElapsed Time: " << elapsedTime << " usec (" << elapsedSeconds << " sec) (" << elapsedMinutes << " min)" << "\nNumber of objects in world: " << numWorldElements << "\nNumber of lights in world: " << numLights << "\nNumber of samples per pixel: " << numSamples << "\nTotal number of rays shot: " << numPrimaryRays << "\nNumber of threads used: " << (U32)numThreads << "\nRender target stats: " << "\n\tResolution: " << width << "x" << height << "\n\tTotal number of pixels rendered: " << width * height << "\n\tAverage time per pixel: " << averageTPP << " usec" << "\n\tAverage time per pixel per sample: " << averageTPP / numSamples << " usec" << "\n\tAverage time per pixel per thread: " << averageTPP / numThreads << " usec" << "\n\tAverage time per pixel per thread per sample: " << averageTPP / numThreads / numSamples << " usec" << "\n------------------------------------------------------------"; // Dump stats to console std::string stats = ss.str(); RE_LOG(RENDER_ENG, RUNTIME, "RENDER STATS\n" << stats); // Dump results to file _mkdir(outputFolder.c_str()); std::stringstream outputFileSS; if (outputFilename != "") outputFileSS << outputFolder << "/" << outputFilename; else if (bUseMultiThreading) { outputFileSS << outputFolder << "/result-" << width << "x" << height << "-" << numSamples << "SAMPLES" << "-" << (U32)numThreads << "THREADS" << ".png"; } else { outputFileSS << outputFolder << "/result-" << width << "x" << height << "-" << numSamples << "SAMPLES" << ".png"; } RE_LOG(RENDER_ENG, RUNTIME, "Writing result image to " << outputFileSS.str()); renderBuffer.SaveToImage(outputFileSS.str()); outputFileSS << ".stats"; RE_LOG(RENDER_ENG, RUNTIME, "Writing result stats to " << outputFileSS.str()); std::ofstream out(outputFileSS.str()); out << ss.str(); out.close(); } }
63716ffb5e57fc4feeb5d1ac4a9ee86585a794fb
b0c66358ae5c0386db5887e2609929e753c38d18
/arch/fbhc/2018/2/Ethan.cpp
5a790cb43889dd57e981a4c38455090170ba76bb
[]
no_license
michalsvagerka/competitive
e7683133ee5f108429135a3a19b3bbaa6732ea9f
07f084dff6c1ba6f151c93bf78405574456100e4
refs/heads/master
2021-06-07T14:54:35.516490
2020-07-07T08:17:56
2020-07-07T08:19:09
113,440,107
4
0
null
null
null
null
UTF-8
C++
false
false
836
cpp
Ethan.cpp
#include "../l/lib.h" // #include "../l/mod.h" class Ethan { public: void solve(istream& cin, ostream& cout) { int T; cin >> T; for (int t = 0; t < T; ++t) { cout << "Case #" << t+1 << ": "; int N, K; cin >> N >> K; if (N == 2 || K <= 3) { cout << "0\n1\n"; } else if (K >= N) { cout << (2*K - N) * (N-1) / 2 - K << '\n'; cout << N << '\n'; for (int i = 1; i < N; ++i) { cout << i << ' ' << i + 1 << ' ' << K - i << '\n'; } } else { cout << K * (K-1) / 2 - K << '\n'; cout << K << '\n'; for (int i = 1; i < K; ++i) { cout << i << ' ' << (i==K-1?N:i+1) << ' ' << K - i << '\n'; } } cout << "1 " << N << ' ' << K << '\n'; } } };
cd27876f8afd4693268f5ce1b244f528cf8da80e
7040eebac314697384964cbb6552922886034a58
/lesson2/project/src/game.cpp
d92063c2a72d328c9cd5ea2cdfc05385890d0525
[ "MIT" ]
permissive
VarLog/cpp_lessons
dcbefb272e22e285003660d3e91f60c3058cea8e
82112997a75edba9b7b039f56f8606728d38ef7b
refs/heads/master
2020-06-21T01:26:11.609246
2016-12-17T11:04:05
2016-12-17T11:04:05
74,812,000
1
0
null
null
null
null
UTF-8
C++
false
false
657
cpp
game.cpp
#include "game.h" #include <iostream> #include <random> #include <sstream> int Game::run() { std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(1, 9); while (std::cin.good()) { auto a = dis(gen); auto b = dis(gen); auto answer = 0; std::cout << a << " + " << b << std::endl; std::cin >> answer; if (answer == a + b) { ++score_; std::cout << "Correct! You score: " << score_ << std::endl; } else { std::cout << "You made a mistake. The right answer is " << (a + b) << std::endl; } } return 0; }
7ff099193f4c32bde36b145045fb086fcd937374
536656cd89e4fa3a92b5dcab28657d60d1d244bd
/services/device/serial/serial_device_enumerator_linux.cc
7243bdc9aaac5a4490b4b96a0f255c842f76fa36
[ "BSD-3-Clause" ]
permissive
ECS-251-W2020/chromium
79caebf50443f297557d9510620bf8d44a68399a
ac814e85cb870a6b569e184c7a60a70ff3cb19f9
refs/heads/master
2022-08-19T17:42:46.887573
2020-03-18T06:08:44
2020-03-18T06:08:44
248,141,336
7
8
BSD-3-Clause
2022-07-06T20:32:48
2020-03-18T04:52:18
null
UTF-8
C++
false
false
4,868
cc
serial_device_enumerator_linux.cc
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "services/device/serial/serial_device_enumerator_linux.h" #include <stdint.h> #include <memory> #include <utility> #include <vector> #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/threading/scoped_blocking_call.h" namespace device { namespace { const char kSerialSubsystem[] = "tty"; const char kHostPathKey[] = "DEVNAME"; const char kHostBusKey[] = "ID_BUS"; const char kMajorKey[] = "MAJOR"; const char kVendorIDKey[] = "ID_VENDOR_ID"; const char kProductIDKey[] = "ID_MODEL_ID"; const char kProductNameKey[] = "ID_MODEL"; // The major number for an RFCOMM TTY device. const char kRfcommMajor[] = "216"; } // namespace // static std::unique_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { return std::make_unique<SerialDeviceEnumeratorLinux>(); } SerialDeviceEnumeratorLinux::SerialDeviceEnumeratorLinux() { DETACH_FROM_SEQUENCE(sequence_checker_); watcher_ = UdevWatcher::StartWatching(this); watcher_->EnumerateExistingDevices(); } SerialDeviceEnumeratorLinux::~SerialDeviceEnumeratorLinux() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } std::vector<mojom::SerialPortInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() { std::vector<mojom::SerialPortInfoPtr> ports; ports.reserve(ports_.size()); for (const auto& map_entry : ports_) ports.push_back(map_entry.second->Clone()); return ports; } base::Optional<base::FilePath> SerialDeviceEnumeratorLinux::GetPathFromToken( const base::UnguessableToken& token) { auto it = ports_.find(token); if (it == ports_.end()) return base::nullopt; return it->second->path; } void SerialDeviceEnumeratorLinux::OnDeviceAdded(ScopedUdevDevicePtr device) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); const char* subsystem = udev_device_get_subsystem(device.get()); if (!subsystem || strcmp(subsystem, kSerialSubsystem) != 0) return; const char* syspath_str = udev_device_get_syspath(device.get()); if (!syspath_str) return; std::string syspath(syspath_str); // Platform serial ports. if (base::StartsWith(syspath, "/sys/devices/platform/", base::CompareCase::SENSITIVE)) { CreatePort(std::move(device), syspath); return; } // USB serial ports and others that have a proper bus identifier. const char* bus = udev_device_get_property_value(device.get(), kHostBusKey); if (bus) { CreatePort(std::move(device), syspath); return; } // Bluetooth ports are virtual TTYs but have an identifiable major number. const char* major = udev_device_get_property_value(device.get(), kMajorKey); if (major && base::StringPiece(major) == kRfcommMajor) { CreatePort(std::move(device), syspath); return; } } void SerialDeviceEnumeratorLinux::OnDeviceChanged(ScopedUdevDevicePtr device) {} void SerialDeviceEnumeratorLinux::OnDeviceRemoved(ScopedUdevDevicePtr device) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); const char* syspath = udev_device_get_syspath(device.get()); if (!syspath) return; auto it = paths_.find(syspath); if (it == paths_.end()) return; ports_.erase(it->second); paths_.erase(it); } void SerialDeviceEnumeratorLinux::CreatePort(ScopedUdevDevicePtr device, const std::string& syspath) { const char* path = udev_device_get_property_value(device.get(), kHostPathKey); if (!path) return; auto token = base::UnguessableToken::Create(); auto info = mojom::SerialPortInfo::New(); info->path = base::FilePath(path); info->token = token; const char* vendor_id = udev_device_get_property_value(device.get(), kVendorIDKey); const char* product_id = udev_device_get_property_value(device.get(), kProductIDKey); const char* product_name = udev_device_get_property_value(device.get(), kProductNameKey); uint32_t int_value; if (vendor_id && base::HexStringToUInt(vendor_id, &int_value)) { info->vendor_id = int_value; info->has_vendor_id = true; } if (product_id && base::HexStringToUInt(product_id, &int_value)) { info->product_id = int_value; info->has_product_id = true; } if (product_name) info->display_name.emplace(product_name); ports_.insert(std::make_pair(token, std::move(info))); paths_.insert(std::make_pair(syspath, token)); } } // namespace device
d922cc3da9a6ac2810c3c2dc034d0e3e1271e5e8
0ac485cca6a3a5c90b73c8ffaadf51c3637c1704
/RPG_MyLife/StageManager.h
25038965ed354adf85c5c75218bb5ad14e91dc13
[]
no_license
americococo/RPG_FIrst
6ddfcaf2835b33358ec6683d36fb35f35fd613ee
16db481ba69caa59a27dcd101821106637944e86
refs/heads/master
2020-03-19T11:13:42.981708
2018-08-03T10:56:39
2018-08-03T10:56:39
136,440,737
1
0
null
null
null
null
UTF-8
C++
false
false
368
h
StageManager.h
#pragma once #include <list> class Stage; class StageManager { private: StageManager(); static StageManager * _instance; public: ~StageManager(); static StageManager * GetInstance(); public: void Init(); void Update(float deltTime); void render(); private: Stage * _stage; std::list<Stage*> _stageList; public: Stage * GetStage() { return _stage; } };
955d72a2ddb122de18315dd4193c0525e4e18130
9f0d42c412db503f0759980a35136618ac6fda79
/MyProjects/C++/2020/10.03/bf.cpp
4db913f37c28db8a7ebc4b1dd5ff599e84d9c427
[]
no_license
lieppham/MyCode
38a8c1353a2627d68b47b5f959bb827819058357
469d87f9d859123dec754b2e4ae0dced53f68660
refs/heads/main
2023-08-25T04:00:00.495534
2021-10-21T12:15:44
2021-10-21T12:15:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
696
cpp
bf.cpp
//File: bf.cpp //Author: yanyanlongxia //Date: 2020/10/5 // #include <bits/stdc++.h> #define ll long long using namespace std; int n,m,maxm,step[2000005]; vector<pair<int,int> >v; inline bool check(int num) { for (int i=v.size()-1;i>=0;i--) { int x=v[i].first,y=v[i].second; } } int main() { scanf("%d",&n); char opt[10]; int x; for (int i=1;i<=10000;i++) step[i]=step[i-(i & -i)]+1; for (int i=1;i<=n;i++) { scanf("%s",opt); scanf("%d",&x); if (opt[0]=='c') { m++; } else { v.push_back(make_pair(x,m)); } } }
c6e5acf1e412e866e39b6f6762e5d0c976ca73c5
d5dfa659de2f76ce6be461db87bfd3dab78190eb
/derive.cpp
08e2dee3582d289560e57ac5b9caabb0a881b272
[]
no_license
GuangChenPidouki/c_puls_plus_study
5c69dd35909b52cadd990a1a26c537e2e8e7aefa
6c6eb9fe1af40500d140125f2de34b36f46d3452
refs/heads/master
2020-12-15T02:40:12.724518
2020-01-19T21:19:46
2020-01-19T21:19:46
234,968,731
0
0
null
null
null
null
UTF-8
C++
false
false
344
cpp
derive.cpp
#include<iostream> using namespace std; class Base{ public: void func(double){cout << "base double" << endl;} private: void func(int){cout << "base int" << endl;} }; class Derived : public Base{ public: using Base::func; void func(int a){cout << "derived int" << a << endl;} }; int main() { Derived d; d.func(1234); d.func(12.34); }
8f1f107b4c93ea3e52e3fbc04f775e1d70e22a13
a671414f8f624acfeb1db81a43a13ba1b780fc37
/Libraries/LibGUI/GScrollableWidget.cpp
246158d9f4d778c9fa09973cec8518d6ec414cef
[ "BSD-2-Clause" ]
permissive
Thecarisma/serenity
28940e6a1c304e9c330fdb051b179ae687eb15bc
bd1e8bf16639eda528df671e64447febbcffd10a
refs/heads/master
2020-07-30T07:34:49.840914
2019-09-21T22:46:29
2019-09-21T22:46:29
210,136,929
3
0
BSD-2-Clause
2019-09-22T11:37:41
2019-09-22T11:37:41
null
UTF-8
C++
false
false
6,748
cpp
GScrollableWidget.cpp
#include <LibGUI/GScrollBar.h> #include <LibGUI/GScrollableWidget.h> GScrollableWidget::GScrollableWidget(GWidget* parent) : GFrame(parent) { m_vertical_scrollbar = GScrollBar::construct(Orientation::Vertical, this); m_vertical_scrollbar->set_step(4); m_vertical_scrollbar->on_change = [this](int) { did_scroll(); update(); }; m_horizontal_scrollbar = GScrollBar::construct(Orientation::Horizontal, this); m_horizontal_scrollbar->set_step(4); m_horizontal_scrollbar->set_big_step(30); m_horizontal_scrollbar->on_change = [this](int) { did_scroll(); update(); }; m_corner_widget = GWidget::construct(this); m_corner_widget->set_fill_with_background_color(true); } GScrollableWidget::~GScrollableWidget() { } void GScrollableWidget::mousewheel_event(GMouseEvent& event) { // FIXME: The wheel delta multiplier should probably come from... somewhere? vertical_scrollbar().set_value(vertical_scrollbar().value() + event.wheel_delta() * 20); } void GScrollableWidget::custom_layout() { auto inner_rect = frame_inner_rect_for_size(size()); int height_wanted_by_horizontal_scrollbar = m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->preferred_size().height() : 0; int width_wanted_by_vertical_scrollbar = m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->preferred_size().width() : 0; m_vertical_scrollbar->set_relative_rect( inner_rect.right() + 1 - m_vertical_scrollbar->preferred_size().width(), inner_rect.top(), m_vertical_scrollbar->preferred_size().width(), inner_rect.height() - height_wanted_by_horizontal_scrollbar); m_horizontal_scrollbar->set_relative_rect( inner_rect.left(), inner_rect.bottom() + 1 - m_horizontal_scrollbar->preferred_size().height(), inner_rect.width() - width_wanted_by_vertical_scrollbar, m_horizontal_scrollbar->preferred_size().height()); m_corner_widget->set_visible(m_vertical_scrollbar->is_visible() && m_horizontal_scrollbar->is_visible()); if (m_corner_widget->is_visible()) { Rect corner_rect { m_horizontal_scrollbar->relative_rect().right() + 1, m_vertical_scrollbar->relative_rect().bottom() + 1, width_occupied_by_vertical_scrollbar(), height_occupied_by_horizontal_scrollbar() }; m_corner_widget->set_relative_rect(corner_rect); } } void GScrollableWidget::resize_event(GResizeEvent& event) { GFrame::resize_event(event); update_scrollbar_ranges(); } Size GScrollableWidget::available_size() const { int available_width = frame_inner_rect().width() - m_size_occupied_by_fixed_elements.width() - width_occupied_by_vertical_scrollbar(); int available_height = frame_inner_rect().height() - m_size_occupied_by_fixed_elements.height() - height_occupied_by_horizontal_scrollbar(); return { available_width, available_height }; } void GScrollableWidget::update_scrollbar_ranges() { auto available_size = this->available_size(); int excess_height = max(0, m_content_size.height() - available_size.height()); m_vertical_scrollbar->set_range(0, excess_height); if (should_hide_unnecessary_scrollbars()) m_vertical_scrollbar->set_visible(excess_height > 0); int excess_width = max(0, m_content_size.width() - available_size.width()); m_horizontal_scrollbar->set_range(0, excess_width); if (should_hide_unnecessary_scrollbars()) m_horizontal_scrollbar->set_visible(excess_width > 0); m_vertical_scrollbar->set_big_step(visible_content_rect().height() - m_vertical_scrollbar->step()); } void GScrollableWidget::set_content_size(const Size& size) { if (m_content_size == size) return; m_content_size = size; update_scrollbar_ranges(); } void GScrollableWidget::set_size_occupied_by_fixed_elements(const Size& size) { if (m_size_occupied_by_fixed_elements == size) return; m_size_occupied_by_fixed_elements = size; update_scrollbar_ranges(); } int GScrollableWidget::height_occupied_by_horizontal_scrollbar() const { return m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->height() : 0; } int GScrollableWidget::width_occupied_by_vertical_scrollbar() const { return m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0; } Rect GScrollableWidget::visible_content_rect() const { return { m_horizontal_scrollbar->value(), m_vertical_scrollbar->value(), min(m_content_size.width(), frame_inner_rect().width() - width_occupied_by_vertical_scrollbar() - m_size_occupied_by_fixed_elements.width()), min(m_content_size.height(), frame_inner_rect().height() - height_occupied_by_horizontal_scrollbar() - m_size_occupied_by_fixed_elements.height()) }; } void GScrollableWidget::scroll_into_view(const Rect& rect, Orientation orientation) { if (orientation == Orientation::Vertical) return scroll_into_view(rect, false, true); return scroll_into_view(rect, true, false); } void GScrollableWidget::scroll_into_view(const Rect& rect, bool scroll_horizontally, bool scroll_vertically) { auto visible_content_rect = this->visible_content_rect(); if (visible_content_rect.contains(rect)) return; if (scroll_vertically) { if (rect.top() < visible_content_rect.top()) m_vertical_scrollbar->set_value(rect.top()); else if (rect.bottom() > visible_content_rect.bottom()) m_vertical_scrollbar->set_value(rect.bottom() - visible_content_rect.height()); } if (scroll_horizontally) { if (rect.left() < visible_content_rect.left()) m_horizontal_scrollbar->set_value(rect.left()); else if (rect.right() > visible_content_rect.right()) m_horizontal_scrollbar->set_value(rect.right() - visible_content_rect.width()); } } void GScrollableWidget::set_scrollbars_enabled(bool scrollbars_enabled) { if (m_scrollbars_enabled == scrollbars_enabled) return; m_scrollbars_enabled = scrollbars_enabled; m_vertical_scrollbar->set_visible(m_scrollbars_enabled); m_horizontal_scrollbar->set_visible(m_scrollbars_enabled); m_corner_widget->set_visible(m_scrollbars_enabled); } void GScrollableWidget::scroll_to_top() { scroll_into_view({ 0, 0, 1, 1 }, Orientation::Vertical); } void GScrollableWidget::scroll_to_bottom() { scroll_into_view({ 0, content_height(), 1, 1 }, Orientation::Vertical); } Rect GScrollableWidget::widget_inner_rect() const { auto rect = frame_inner_rect(); rect.set_width(rect.width() - width_occupied_by_vertical_scrollbar()); rect.set_height(rect.height() - height_occupied_by_horizontal_scrollbar()); return rect; }
7f328ad40c1cae6d503f7826b0c93355307c9e32
9dd7633fd0625e5b5858a3d7a2fd9791d39bd137
/IntroD3D9/Ch03D3DRender/Cube/RenderCube.h
fd0720ba02366497151d373371b03ae4196178f6
[]
no_license
breaker/studies
9f47846f8e8fbe7330a3fab5dd7d4ab711d44b60
015050ee892587ad0b5af4f2ac235134190fbe59
refs/heads/master
2022-12-04T16:31:04.104470
2022-11-24T10:23:27
2022-11-24T10:23:27
6,194,386
9
5
null
null
null
null
GB18030
C++
false
false
1,432
h
RenderCube.h
// RenderCube.h // #ifndef __RENDERCUBE_H__ #define __RENDERCUBE_H__ // FVF 顶点类型, 只包含位置 struct Vertex { Vertex(float x, float y, float z) : x_(x), y_(y), z_(z) {} float x_; float y_; float z_; static const DWORD FVF = D3DFVF_XYZ; }; //////////////////////////////////////////////////////////////////////////////// // 绘制立方体异常类 RenderCubeExcept //////////////////////////////////////////////////////////////////////////////// class RenderCubeExcept : public SGLExcept { public: explicit RenderCubeExcept(DWORD err = SGL::SGL_ERR::ERR_UNKNOWN, const char* msg = "") : SGLExcept(err, msg) {} explicit RenderCubeExcept(const char* msg) : SGLExcept(msg) {} static const char* ERR_INIT_VERTEX_FAILED; static const char* ERR_INIT_COORD_FAILED; }; //////////////////////////////////////////////////////////////////////////////// // 绘制立方体类 RenderCube //////////////////////////////////////////////////////////////////////////////// class RenderCube : public SGLRender { public: RenderCube(UINT width, UINT height, HWND hwnd, BOOL windowed, D3DDEVTYPE devType); virtual void render(float timeDelta); private: BOOL initVertex(); BOOL initCamera(); private: CComPtr<IDirect3DVertexBuffer9> vertex_buf_; CComPtr<IDirect3DIndexBuffer9> index_buf_; }; #endif // __RENDERCUBE_H__
987cbe85d1a5a3fb98fe2d3d8fbdc306bdaeb98c
4498a53d12a3e1611540d2130c36f36f6e9294cd
/braintrain/boostdi/bindings/bindings4.cpp
e68f9ebd41b2a69cfecef9453eace9a82b83df0e
[]
no_license
haldokan/CppEdge
bec9fb92ea8a7f2dd473e7bc1f3bd97d11abf4e0
ae6a8509d41ee7b2f2c29fde00480ebec6d5fb0c
refs/heads/main
2023-02-10T02:19:20.788089
2021-01-05T17:32:23
2021-01-05T17:32:23
304,011,300
0
0
null
null
null
null
UTF-8
C++
false
false
2,873
cpp
bindings4.cpp
#include <iostream> #include "../di.hpp" using namespace std; namespace di = boost::di; class icard { public: virtual ~icard() = default; virtual double charge(double) = 0; // charge amt and return balance }; class credit_card : public icard { public: double charge(double amt) override { cout << "charging: " << amt << " to credit card" << endl; blnc += amt; return blnc; } private: double blnc = 500; }; class debit_card : public icard { public: double charge(double amt) override { cout << "charging: " << amt << " to debit card" << endl; blnc -= amt; return blnc; } private: double blnc = 1000; }; class cards { public: explicit cards(vector<shared_ptr<icard>> cards) : m_cards{move(cards)} { // note that we should not use 'cards' here because it was moved to m_cards assert(4 == m_cards.size()); assert(dynamic_cast<credit_card*>(m_cards[0].get())); assert(dynamic_cast<debit_card*>(m_cards[1].get())); } [[nodiscard]] double charge(int index, double amt) const {return m_cards.at(index)->charge(amt);} // using vector.at bcz it throws for out_of_range access private: // note that prefixing this with const screws things up grandly because we do subscript access in func 'charge'. // compile errors I got for that suck donkey. vector<shared_ptr<icard>> m_cards; }; void container_injection_with_scopes() { cout << "container_injection_with_scopes" << endl; const auto injector = di::make_injector( // we explicitly bind this to unique-scope: different per request (even tho we use shared_ptr which deduced to be a singleton) di::bind<debit_card>.in(di::unique), // all the credit_card(s) injected here are the pointed to by the same shared pointer, while the debit_card(s) are different objects di::bind<icard *[]>().to<credit_card, debit_card, credit_card, debit_card>() // this will inject a vector into class cards with 2 cards: once credit and one debit ); const auto cardz = injector.create<cards>(); // note that using var name that's the same as the class name wont compile cout << ">>>>credit transactions" << endl; cout << cardz.charge(0, 50) << endl; // prints 550 cout << cardz.charge(0, 50) << endl; // prints 600 cout << cardz.charge(2, 50) << endl; // prints 650: because all credit_card(s) are pointed to by the same shared_ptr (actually one object: singleton) cout << ">>>debit transactions" << endl; cout << cardz.charge(1, 50) << endl; // prints 950 cout << cardz.charge(1, 50) << endl; // prints 900 cout << cardz.charge(3, 50) << endl; // prints 950: the 3rd debit_card is a different object and is accessed by a different unique_ptr } int main() { container_injection_with_scopes(); return 0; }
3e467ffaa201327c9728f5013555c66232d66159
a2206795a05877f83ac561e482e7b41772b22da8
/Source/PV/build/Qt/Components/moc_pqProxyInformationWidget.cxx
87bba15e3eff34d9729dcd28ef1c1c39b3ed2db4
[]
no_license
supreethms1809/mpas-insitu
5578d465602feb4d6b239a22912c33918c7bb1c3
701644bcdae771e6878736cb6f49ccd2eb38b36e
refs/heads/master
2020-03-25T16:47:29.316814
2018-08-08T02:00:13
2018-08-08T02:00:13
143,947,446
0
0
null
null
null
null
UTF-8
C++
false
false
3,389
cxx
moc_pqProxyInformationWidget.cxx
/**************************************************************************** ** Meta object code from reading C++ file 'pqProxyInformationWidget.h' ** ** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.6) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../../ParaView/Qt/Components/pqProxyInformationWidget.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'pqProxyInformationWidget.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 63 #error "This file was generated using the moc from 4.8.6. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_pqProxyInformationWidget[] = { // content: 6, // revision 0, // classname 0, 0, // classinfo 3, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount // slots: signature, parameters, type, tag, flags 26, 25, 25, 25, 0x0a, 57, 46, 25, 25, 0x0a, 91, 86, 25, 25, 0x08, 0 // eod }; static const char qt_meta_stringdata_pqProxyInformationWidget[] = { "pqProxyInformationWidget\0\0updateInformation()\0" "outputport\0setOutputPort(pqOutputPort*)\0" "item\0onItemClicked(QTreeWidgetItem*)\0" }; void pqProxyInformationWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Q_ASSERT(staticMetaObject.cast(_o)); pqProxyInformationWidget *_t = static_cast<pqProxyInformationWidget *>(_o); switch (_id) { case 0: _t->updateInformation(); break; case 1: _t->setOutputPort((*reinterpret_cast< pqOutputPort*(*)>(_a[1]))); break; case 2: _t->onItemClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; default: ; } } } const QMetaObjectExtraData pqProxyInformationWidget::staticMetaObjectExtraData = { 0, qt_static_metacall }; const QMetaObject pqProxyInformationWidget::staticMetaObject = { { &QWidget::staticMetaObject, qt_meta_stringdata_pqProxyInformationWidget, qt_meta_data_pqProxyInformationWidget, &staticMetaObjectExtraData } }; #ifdef Q_NO_DATA_RELOCATION const QMetaObject &pqProxyInformationWidget::getStaticMetaObject() { return staticMetaObject; } #endif //Q_NO_DATA_RELOCATION const QMetaObject *pqProxyInformationWidget::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; } void *pqProxyInformationWidget::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_pqProxyInformationWidget)) return static_cast<void*>(const_cast< pqProxyInformationWidget*>(this)); return QWidget::qt_metacast(_clname); } int pqProxyInformationWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 3) qt_static_metacall(this, _c, _id, _a); _id -= 3; } return _id; } QT_END_MOC_NAMESPACE
f651a205eac2479c6a1ad6af78aeff14eb899cae
2bdca426e00b7648e1cb76432c7b9548dcfe5095
/src/instruments/CashFlow.hpp
d9fbf8473dfcb6de9bcb735dd3cfbcc936d222fd
[]
no_license
mbrzecki/julian
b6b0c7c5fdc40f2970ae9cbeed1bd12c020dae6f
04a38f0a26a23ba8f80c879997216c22dbc81ebb
refs/heads/master
2020-03-28T02:30:08.777303
2019-05-28T18:10:30
2019-05-28T18:10:30
147,575,336
3
0
null
null
null
null
UTF-8
C++
false
false
2,130
hpp
CashFlow.hpp
#ifndef JULIAN_CASHFLOW_HPP #define JULIAN_CASHFLOW_HPP #include <marketData/interestRateCurves/irCurve.hpp> #include <dates/date.hpp> #include <interestRates/interestRate.hpp> namespace julian { /** * @file CashFlow.hpp * @brief File contains definition of cash flow class. */ /** \ingroup instruments * \brief Class implements the general concept of CF understand as certain amount paid on predefined date * * Class implements the general concept of CF understand as certain amount paid on predefined date. Class is a building block of all linear instruments. */ class CashFlow { public: /** \brief discounts the cashflow * * Method discount the cashflow on the curve valuation date. */ virtual double price(const SmartPointer<ir::Curve>& disc) = 0; /** \brief prints and returns the value discounted the cashflow * * Method calculates discounted cashflow on the curve valuation date and then prints it */ virtual double value(const SmartPointer<ir::Curve>& disc) = 0; /** \brief returns payment date */ virtual Date getDate() const = 0; /** \brief returns notional */ virtual double getNotional() const = 0; /** \brief returns CF */ virtual double getCF() const = 0; /** \brief sets new CF value */ virtual void setCashFlow(double amount) = 0; /** \brief calculates new CF value basing on quoting and interest rate provided */ virtual void setCashFlow(double quote, const InterestRate& rate) = 0; /** \brief sets new CF value basing on interest rate curve */ virtual void setCashFlow(const SmartPointer<ir::Curve>&) = 0; /** \brief virtual copy constructor */ virtual CashFlow* clone() const = 0; /** \brief destructor */ virtual ~CashFlow(){}; friend class boost::serialization::access; private: template<class Archive> /**\brief interface of Boost serialization library */ void serialize(Archive & , const unsigned int) { } }; } // namespace julian #endif /* CASHFLOW_HPP */
d3c20ceea5e7fc250ccb6445bfd5f06bfac39467
f3b589ef1d0a7353ac7ec16ab4aa6c5d7f05dc0b
/Node/PatchEditor.h
58c4440fbfe6f1046743a575d2214e1b18759fb2
[]
no_license
Snake174/PipmakAssistant
46b6abbaa9f7131fe64de3d31dad425f5f2f1d65
4095507f95ac4f483114394ec4038773c998c00c
refs/heads/master
2021-01-04T22:32:39.834369
2015-03-06T04:41:51
2015-03-06T04:41:51
19,058,852
0
0
null
null
null
null
UTF-8
C++
false
false
1,135
h
PatchEditor.h
#ifndef PATCHEDITOR_H #define PATCHEDITOR_H //================================================================================================= #include <QWidget> #include <QVariant> #include <QListWidgetItem> //================================================================================================= QT_BEGIN_NAMESPACE class QComboBox; class QTreeWidget; class QTreeWidgetItem; class Node; class PropertyEditor; class PatchViewer; QT_END_NAMESPACE //================================================================================================= class PatchEditor : public QWidget { Q_OBJECT PatchViewer *viewer; Node *node; QStringList imageFormats; public: explicit PatchEditor( Node *node, QWidget *parent = 0 ); ~PatchEditor(); QComboBox *faces; Node *getNode(); private slots: void faceChanged( int index ); void selectImage( QWidget *lineEdit ); void patchChanged( int index ); void patchVisibleChanged( QListWidgetItem *it ); }; //================================================================================================= #endif // PATCHEDITOR_H
317d89e2868d3f84b0f13da1d3d235c0463e90e1
4be1b10eac05682757da9155fdd0265ac26d4880
/Command/MoveLightSourceCommand.h
26c2fe2b2ab2390829d93fe15e786074168991d6
[]
no_license
JacKeTUs/ComputerGraphics
0d0a8925088b35d62c88d32f18e099061f9c8155
8dc04c0f5d84e025f1028c221ec4e6fb858ff8c0
refs/heads/master
2021-09-05T19:14:09.885200
2018-01-30T12:57:23
2018-01-30T12:57:23
119,534,697
0
0
null
null
null
null
UTF-8
C++
false
false
484
h
MoveLightSourceCommand.h
#ifndef MOVELIGHTSOURCECOMMAND_H #define MOVELIGHTSOURCECOMMAND_H #include "Command.h" class MoveLightSourceCommand : public Command { private: int index; double dx; double dy; double dz; public: MoveLightSourceCommand(int i, double x, double y, double z): index(i), dx(x), dy(y), dz(z) {} ~MoveLightSourceCommand() {} void execute(AdapterFacade& facade) { facade.moveLightSource(index,dx,dy,dz); } }; #endif // MOVELIGHTSOURCECOMMAND_H
0758a192afe6337858de6be0c7649ddd346dbf80
06aa3647ea9caf1e5fe6cd37c76651f6fece1a3b
/src/mxFlowCanvas.cpp
6e05319427b643bb4500cc65e8da3246eb56daf2
[]
no_license
SoftwareIDE/ZinjaI
6731dc9a5a67a9f138f547f02f8c62a67d42f8d5
a3d752bf5fa971a726fc4ba036d860edf6588b5f
refs/heads/master
2020-12-24T19:46:21.098172
2016-05-04T20:45:52
2016-05-04T20:45:52
58,789,743
3
4
null
null
null
null
UTF-8
C++
false
false
34,625
cpp
mxFlowCanvas.cpp
#include <stack> #include "mxFlowCanvas.h" #include "mxSource.h" #include "mxUtils.h" #include "mxMessageDialog.h" //#define FC_DRAW_LINE(x1,y1,x2,y2,pen) draw.lines.insert(draw.lines.begin(),fc_line(x1,y1,(x2)==(x1)?(x1):(x2)>(x1)?(x2)+1:(x2)-1,(y2)==(y1)?(y1):(y2)>(y1)?(y2)+1:(y2)-1,pen)) #define FC_DRAW_LINE(x1,y1,x2,y2,pen) draw.lines.insert(draw.lines.begin(),fc_line(x1,y1,x2,y2,pen)) #define FC_DRAW_TEXT(x,y,text,col) draw.texts.insert(draw.texts.begin(),fc_text(x,y,text,col)) #define FC_DRAW_CIRCLE(x,y,w,h,col) draw.arcs.insert(draw.arcs.begin(),fc_arc(x,y,w,h,col)) #define FC_COLOUR_FLECHAS pen_red #define FC_COLOUR_BOOLEANS colour_red #define FC_COLOUR_MARCOS pen_blue #define FC_COLOUR_INSTRUCTION colour_black #define FC_COLOUR_CONDITION colour_black #define FC_COLOUR_RETURN colour_black #define FC_COLOUR_JUMP colour_red #define FC_MARGIN_IN 4 #define FC_MARGIN_BETWEEN 12 #define FC_MARGIN_ARROW 5 #include "mxMainWindow.h" BEGIN_EVENT_TABLE(mxFlowCanvas, wxScrolledWindow) EVT_PAINT (mxFlowCanvas::OnPaint) EVT_MOUSEWHEEL(mxFlowCanvas::OnMouseWheel) EVT_LEFT_DOWN(mxFlowCanvas::OnMouseDown) EVT_LEAVE_WINDOW(mxFlowCanvas::OnMouseUp) EVT_LEFT_UP(mxFlowCanvas::OnMouseUp) EVT_MOTION(mxFlowCanvas::OnMouseMotion) END_EVENT_TABLE() mxFlowCanvas::mxFlowCanvas(wxWindow *parent, mxSource *src) : wxScrolledWindow (parent,wxID_ANY,wxDefaultPosition,wxSize(200,200),wxFULL_REPAINT_ON_RESIZE) { scale=1; reference_index=0; source=src; colour_black = new wxColour(0,0,0); colour_blue = new wxColour(0,0,255); colour_red = new wxColour(255,0,0); colour_green = new wxColour(0,255,0); pen_black = new wxPen(*colour_black); pen_blue = new wxPen(*colour_blue); pen_red = new wxPen(*colour_red); pen_green = new wxPen(*colour_green); wxClientDC ddc(this); PrepareDC(ddc); wxDC *dc = &ddc; font = new wxFont(10,wxFONTFAMILY_TELETYPE,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false); SetBackgroundColour(*wxWHITE); dc->SetFont(*font); dc->SetBackgroundMode(wxTRANSPARENT); dc->SetTextBackground(*wxWHITE); dc->SetTextForeground(*wxBLACK); int r1=0,r2=0; if (!Analize(source->GetSelectionStart(), source->GetSelectionEnd(),draw,dc,r1,r2)) mxMessageDialog(main_window,"El bloque de codigo no es correcto").Title(LANG(GENERAL_ERROR,"Error")).IconError().Run(); // dibujar inicio y fin wxString ini,fin; ini<<_T("Lin ")<<source->LineFromPosition(source->GetSelectionStart())+1<<_T(" - Col ")<<source->GetSelectionStart()-source->PositionFromLine(source->LineFromPosition(source->GetSelectionStart())); fin<<_T("Lin ")<<source->LineFromPosition(source->GetSelectionEnd())+1<<_T(" - Col ")<<source->GetSelectionEnd()-source->PositionFromLine(source->LineFromPosition(source->GetSelectionEnd())); int ih,iw,fh,fw; GetTextSize(ini,dc,iw,ih); GetTextSize(fin,dc,fw,fh); draw.y=ih+FC_MARGIN_IN*2+1; // incicio FC_DRAW_LINE(-iw,0,iw,0,FC_COLOUR_FLECHAS); FC_DRAW_LINE(-iw,-ih-FC_MARGIN_IN*2,iw,-ih-FC_MARGIN_IN*2,FC_COLOUR_FLECHAS); FC_DRAW_TEXT(-iw,-ih-FC_MARGIN_IN,ini,FC_COLOUR_CONDITION); FC_DRAW_LINE(-iw,0,-iw-FC_MARGIN_BETWEEN,-FC_MARGIN_IN-ih/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(+iw,0,+iw+FC_MARGIN_BETWEEN,-FC_MARGIN_IN-ih/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(+iw,-FC_MARGIN_IN*2-ih,+iw+FC_MARGIN_BETWEEN,-FC_MARGIN_IN-ih/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(-iw,-FC_MARGIN_IN*2-ih,-iw-FC_MARGIN_BETWEEN,-FC_MARGIN_IN-ih/2,FC_COLOUR_FLECHAS); // flecha FC_DRAW_LINE(0,draw.alto,0,draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(FC_MARGIN_ARROW,draw.alto+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,0,draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(-FC_MARGIN_ARROW,draw.alto+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,0,draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); // fin FC_DRAW_LINE(-fw,draw.alto+FC_MARGIN_BETWEEN,fw,draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(-fw,fh+FC_MARGIN_IN*2+draw.alto+FC_MARGIN_BETWEEN,+fw,fh+FC_MARGIN_IN*2+draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_TEXT(-fw,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN,fin,FC_COLOUR_CONDITION); FC_DRAW_LINE(-fw,draw.alto+FC_MARGIN_BETWEEN,-fw-FC_MARGIN_BETWEEN,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN+fh/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(+fw,draw.alto+FC_MARGIN_BETWEEN,+fw+FC_MARGIN_BETWEEN,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN+fh/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(+fw,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN*2+fh,+fw+FC_MARGIN_BETWEEN,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN+fh/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(-fw,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN*2+fh,-fw-FC_MARGIN_BETWEEN,draw.alto+FC_MARGIN_BETWEEN+FC_MARGIN_IN+fh/2,FC_COLOUR_FLECHAS); draw.alto+=2*FC_MARGIN_BETWEEN+FC_MARGIN_IN*4+ih+fh; if (draw.izquierda<(iw>fw?iw:fw)+2*FC_MARGIN_BETWEEN) draw.izquierda=iw>fw?iw:fw+2*FC_MARGIN_BETWEEN; if (draw.derecha<(iw>fw?iw:fw)+2*FC_MARGIN_BETWEEN) draw.derecha=iw>fw?iw:fw+2*FC_MARGIN_BETWEEN; SetScrollbars(1,1,draw.izquierda+draw.derecha+2*FC_MARGIN_BETWEEN,draw.alto+FC_MARGIN_BETWEEN*2,draw.izquierda+FC_MARGIN_BETWEEN,FC_MARGIN_BETWEEN,true); SetCursor(wxCursor(wxCURSOR_HAND)); } int mxFlowCanvas::FindBlockEnd(int p, int pe) { int s; char c; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (source->GetCharAt(p)=='{') { return source->BraceMatch(p); } if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='i' && source->GetCharAt(p+1)=='f' && source->GetStyleAt(p+2)!=wxSTC_C_WORD) { p+=2; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (c!='(' || (p=source->BraceMatch(p))==wxSTC_INVALID_POSITION) return wxSTC_INVALID_POSITION; p++; if ( (p=FindBlockEnd(p,pe))==wxSTC_INVALID_POSITION) return wxSTC_INVALID_POSITION; p++; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='e' && source->GetCharAt(p+1)=='l' && source->GetCharAt(p+2)=='s' && source->GetCharAt(p+3)=='e' && source->GetStyleAt(p+4)!=wxSTC_C_WORD) return FindBlockEnd(p+4,pe); else return p-1; } else { while (!FC_IS(';') || FC_SHOULD_IGNORE) { if ( (c=='{' || c=='(') && source->GetStyleAt(p)==wxSTC_C_OPERATOR) { p=source->BraceMatch(p); if (p==wxSTC_INVALID_POSITION) return wxSTC_INVALID_POSITION; } p++; } } return p; } bool mxFlowCanvas::Analize(int ps, int pe, draw_data &draw, wxDC *dc, int &break_index, int &continue_index) { int p=ps; int p1,p2, ax,ay, tw,th; wxString text; int x=0, y=0; int mb_index, mc_index; // stack<wxChar> pila; while (true) { char c; int s; // para los FC_* FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); while (c=='{' || c=='}') { p++; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (p>pe) { draw.alto = y; return true; } } if (p>pe) { draw.alto = y; return true; } if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='i' && source->GetCharAt(p+1)=='f' && source->GetStyleAt(p+2)!=wxSTC_C_WORD) { // dibujar flecha FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; // extraer condicion p+=2; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (c!='(' || (p2=source->BraceMatch(p))==wxSTC_INVALID_POSITION) return false; p1=p+1; GetTextSize ( text = GetText(p1,p2), dc, tw, th ); p=p2+1; // dibujar condicion int cw = tw+FC_MARGIN_BETWEEN, ch=th+2*FC_MARGIN_BETWEEN; FC_DRAW_LINE(x,y,x-cw,y+ch/2,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y,x+cw,y+ch/2,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y+ch,x-cw,y+ch/2,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y+ch,x+cw,y+ch/2,FC_COLOUR_MARCOS); FC_DRAW_TEXT(x-tw,y+FC_MARGIN_BETWEEN,text,FC_COLOUR_CONDITION); FC_DRAW_TEXT(x-tw-FC_MARGIN_BETWEEN*2,y+ch/2-FC_MARGIN_BETWEEN-FC_MARGIN_IN,_T("f"),FC_COLOUR_BOOLEANS); FC_DRAW_TEXT(x+tw+FC_MARGIN_BETWEEN+FC_MARGIN_IN,y+ch/2-FC_MARGIN_BETWEEN-FC_MARGIN_IN,_T("v"),FC_COLOUR_BOOLEANS); // bloque verdadero FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p2 = FindBlockEnd(p1=p,pe); if (p2==wxSTC_INVALID_POSITION) return false; draw_data v_draw(x,y+ch); if (!Analize(p1,p2,v_draw,dc,break_index,continue_index)) return false; v_draw.x = v_draw.izquierda>cw ? x+FC_MARGIN_BETWEEN+v_draw.izquierda : x+FC_MARGIN_BETWEEN+cw; draw.draws.insert(draw.draws.begin(),v_draw); p=p2+1; if (v_draw.x-x+v_draw.derecha>draw.derecha) draw.derecha = v_draw.x-x+v_draw.derecha; // bloque false FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='e' && source->GetCharAt(p+1)=='l' && source->GetCharAt(p+2)=='s' && source->GetCharAt(p+3)=='e' && source->GetStyleAt(p+4)!=wxSTC_C_WORD) { p+=4; // buscar que sigue FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p2 = FindBlockEnd(p1=p,pe); if (p2==wxSTC_INVALID_POSITION) return false; draw_data f_draw(x,y+ch); if (!Analize(p1,p2,f_draw,dc,break_index,continue_index)) return false; f_draw.x = f_draw.derecha>cw ? x-FC_MARGIN_BETWEEN-f_draw.derecha : x-FC_MARGIN_BETWEEN-cw; draw.draws.insert(draw.draws.begin(),f_draw); p=p2+1; if (x-f_draw.x+f_draw.izquierda>draw.izquierda) draw.izquierda = x-f_draw.x+f_draw.izquierda; int hh = v_draw.alto>f_draw.alto?v_draw.alto:f_draw.alto; // flechas verdadero FC_DRAW_LINE(x+cw,y+ch/2,v_draw.x,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(v_draw.x,v_draw.y,v_draw.x,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(v_draw.x,v_draw.y+v_draw.alto,v_draw.x,y+ch+hh+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); // flechas falso FC_DRAW_LINE(x-cw,y+ch/2,f_draw.x,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(f_draw.x,f_draw.y,f_draw.x,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(f_draw.x,f_draw.y+f_draw.alto,f_draw.x,y+ch+hh+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=hh+ch+FC_MARGIN_BETWEEN; FC_DRAW_LINE(v_draw.x,y,f_draw.x,y,FC_COLOUR_FLECHAS); } else { // lineas true FC_DRAW_LINE(x+cw,y+ch/2,v_draw.x,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(v_draw.x,v_draw.y,v_draw.x,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(v_draw.x,v_draw.y+v_draw.alto,v_draw.x,v_draw.y+v_draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); // lineas false FC_DRAW_LINE(x-cw,y+ch/2,x-cw-FC_MARGIN_BETWEEN,y+ch/2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-cw-FC_MARGIN_BETWEEN,y+ch+v_draw.alto+FC_MARGIN_BETWEEN,x-cw-FC_MARGIN_BETWEEN,y+ch/2,FC_COLOUR_FLECHAS); // linea que cierra abajo y+=v_draw.alto+ch+FC_MARGIN_BETWEEN; FC_DRAW_LINE(x-cw-FC_MARGIN_BETWEEN,y,x+v_draw.x,y,FC_COLOUR_FLECHAS); if (draw.izquierda<cw+FC_MARGIN_BETWEEN) draw.izquierda=cw+FC_MARGIN_BETWEEN; } } else if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='f' && source->GetCharAt(p+1)=='o' && source->GetCharAt(p+2)=='r' && source->GetStyleAt(p+3)!=wxSTC_C_WORD) { p+=3; FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; FC_DRAW_LINE(x,y,x-FC_MARGIN_ARROW,y-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y,x-FC_MARGIN_ARROW,y+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); // buscar las condiciones FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (c!='(' || (p2=source->BraceMatch(p))==wxSTC_INVALID_POSITION) return false; int p11,p12,p21,p22,p31,p32; // condicion inicial p++; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p11=p; FC_FRONT(!FC_IS(';') || FC_SHOULD_IGNORE); p12=p; if (p12>=p2) return false; //condicion de continuidad p++; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p21=p; FC_FRONT(!FC_IS(';') || FC_SHOULD_IGNORE); p22=p; if (p22>=p2) return false; // incremento p++; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p31=p; p32=p2; //cortar los textos seleccionados wxString t1,t2,t3; int th1,th2,th3,tw1,tw2,tw3; GetTextSize ( t1 = GetText(p11,p12), dc, tw1, th1 ); GetTextSize ( t2 = GetText(p21,p22), dc, tw2, th2 ); GetTextSize ( t3 = GetText(p31,p32), dc, tw3, th3 ); p=p2+1; // buscar que sigue FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p2 = FindBlockEnd(p1=p,pe); if (p2==wxSTC_INVALID_POSITION) return false; draw_data i_draw(x,y); mb_index=0; mc_index=0; if (!Analize(p1,p2,i_draw,dc,mb_index,mc_index)) return false; draw.draws.insert(draw.draws.begin(),i_draw); p=p2+1; if (mc_index) { // dibujar referencia del break si es necesario y+=i_draw.alto; FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; wxString text; text<<mc_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_LINE(x,y,x,y+ax*2,FC_COLOUR_FLECHAS);; FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-ax-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x-FC_MARGIN_BETWEEN-ax*2,y,ax*2,ax*2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_BETWEEN,y+ax,FC_COLOUR_FLECHAS); y-=FC_MARGIN_IN+i_draw.alto; i_draw.alto+=ax*2+FC_MARGIN_IN; } // dibujar flechas y condiciones int gw,gh; gh = FC_MARGIN_BETWEEN*2+FC_MARGIN_IN*4+th1+th2+th3; gw = FC_MARGIN_BETWEEN*2+2*(tw2>tw1*4/3&&tw2>tw3*4/2?tw2:(tw1>tw3?tw1*4/3:tw3*4/3)); int hh = gh+FC_MARGIN_BETWEEN*2>i_draw.alto?gh+FC_MARGIN_BETWEEN*2:i_draw.alto; FC_DRAW_LINE(x,y+i_draw.alto,x,y+hh+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=hh+FC_MARGIN_BETWEEN; FC_DRAW_CIRCLE(x-i_draw.izquierda-FC_MARGIN_BETWEEN-gw,y-hh/2-gh/2,gw,gh,FC_COLOUR_MARCOS); FC_DRAW_LINE(x, y, x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y, FC_COLOUR_FLECHAS); FC_DRAW_LINE(x, y-hh-FC_MARGIN_BETWEEN, x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y-hh-FC_MARGIN_BETWEEN, FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y ,x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y-hh/2+gh/2, FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y-hh-FC_MARGIN_BETWEEN ,x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y-hh/2-gh/2, FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN-FC_MARGIN_ARROW, y-hh/2+gh/2+FC_MARGIN_ARROW, x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y-hh/2+gh/2, FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN+FC_MARGIN_ARROW, y-hh/2+gh/2+FC_MARGIN_ARROW, x-i_draw.izquierda-gw/2-FC_MARGIN_BETWEEN, y-hh/2+gh/2, FC_COLOUR_FLECHAS); FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2-tw1,y-hh/2-gh/2+FC_MARGIN_BETWEEN,t1,FC_COLOUR_CONDITION); /* TODO: mejorar estas dos lineas */ FC_DRAW_LINE( (int)(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2+gw/2*sin((gh-th1-FC_MARGIN_BETWEEN-FC_MARGIN_IN)*M_PI/gh)), y-hh/2-gh/2+FC_MARGIN_BETWEEN+th1+FC_MARGIN_IN, (int)(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2-gw/2*sin((gh-th1-FC_MARGIN_BETWEEN-FC_MARGIN_IN)*M_PI/gh)) -2, y-hh/2-gh/2+FC_MARGIN_BETWEEN+th1+FC_MARGIN_IN, FC_COLOUR_MARCOS); FC_DRAW_LINE( (int)(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2+gw/2*sin((gh-th3-FC_MARGIN_BETWEEN-FC_MARGIN_IN)*M_PI/gh)), y-hh/2-gh/2+FC_MARGIN_BETWEEN+th1+th2+3*FC_MARGIN_IN, (int)(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2-gw/2*sin((gh-th3-FC_MARGIN_BETWEEN-FC_MARGIN_IN)*M_PI/gh)) -2, y-hh/2-gh/2+FC_MARGIN_BETWEEN+th1+th2+3*FC_MARGIN_IN, FC_COLOUR_MARCOS); FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2-tw2,y-hh/2-gh/2+FC_MARGIN_BETWEEN+th1+FC_MARGIN_IN*2,t2,FC_COLOUR_CONDITION); FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-i_draw.izquierda-gw/2-tw3,y-hh/2-gh/2+FC_MARGIN_BETWEEN+th1+th2+FC_MARGIN_IN*4,t3,FC_COLOUR_CONDITION); if (draw.izquierda<i_draw.izquierda+gw+FC_MARGIN_BETWEEN) draw.izquierda=i_draw.izquierda+gw+FC_MARGIN_BETWEEN; if (draw.derecha<i_draw.derecha) draw.derecha=i_draw.derecha; if (mb_index) { // dibujar referencia del break si es necesario FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; wxString text; text<<mb_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_LINE(x,y,x,y+ax*2,FC_COLOUR_FLECHAS);; FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-ax-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x-FC_MARGIN_BETWEEN-ax*2,y,ax*2,ax*2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_BETWEEN,y+ax,FC_COLOUR_FLECHAS); y+=ax*2; } } else if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='b' && source->GetCharAt(p+1)=='r' && source->GetCharAt(p+2)=='e' && source->GetCharAt(p+3)=='a' && source->GetCharAt(p+4)=='k' && source->GetStyleAt(p+5)!=wxSTC_C_WORD) { p+=5; FC_FRONT(!FC_IS(';') || FC_SHOULD_IGNORE); p++; FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; if (break_index==0) break_index=++reference_index; wxString text; text<<reference_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_TEXT(x-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x-ax,y,ax*2,ax*2,FC_COLOUR_FLECHAS); y+=ax*2+FC_MARGIN_BETWEEN; } else if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='c' && source->GetCharAt(p+1)=='o' && source->GetCharAt(p+2)=='n' && source->GetCharAt(p+3)=='t' && source->GetCharAt(p+4)=='i' && source->GetCharAt(p+5)=='n' && source->GetCharAt(p+6)=='u' && source->GetCharAt(p+7)=='e' && source->GetStyleAt(p+8)!=wxSTC_C_WORD) { p+=8; FC_FRONT(!FC_IS(';') || FC_SHOULD_IGNORE); p++; FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; if (continue_index==0) continue_index=++reference_index; wxString text; text<<reference_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_TEXT(x-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x-ax,y,ax*2,ax*2,FC_COLOUR_FLECHAS); y+=ax*2+FC_MARGIN_BETWEEN; } else if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='r' && source->GetCharAt(p+1)=='e' && source->GetCharAt(p+2)=='t' && source->GetCharAt(p+3)=='u' && source->GetCharAt(p+4)=='r' && source->GetCharAt(p+5)=='n' && source->GetStyleAt(p+6)!=wxSTC_C_WORD) { p1 = p; FC_FRONT(!FC_IS(';') || FC_SHOULD_IGNORE); p2 = p; FC_BACK(p1,FC_IS_EMPTY || FC_SHOULD_IGNORE); text = GetText(p1,p); p=p2; if (text.Len()==0) { draw.alto = y; return true; } // dibujar una instruccion comun FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; GetTextSize(text,dc,tw,th); FC_DRAW_TEXT(x-tw,y+FC_MARGIN_IN,text,FC_COLOUR_RETURN); // dibujar flecha de salida FC_DRAW_LINE(x+tw-FC_MARGIN_ARROW-FC_MARGIN_IN,-1+y+FC_MARGIN_ARROW,x+tw+FC_MARGIN_ARROW-FC_MARGIN_IN,-1+y-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+tw+FC_MARGIN_ARROW-FC_MARGIN_IN,-1+y-FC_MARGIN_ARROW,x+tw-FC_MARGIN_IN,-1+y-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+tw+FC_MARGIN_ARROW-FC_MARGIN_IN,-1+y-FC_MARGIN_ARROW,x+tw+FC_MARGIN_ARROW-FC_MARGIN_IN,-1+y,FC_COLOUR_FLECHAS); ax=tw+FC_MARGIN_IN; ay=th+FC_MARGIN_IN+FC_MARGIN_IN; FC_DRAW_LINE(x-ax,y,x+ax,y,FC_COLOUR_MARCOS); FC_DRAW_LINE(x-ax,y+ay,x+ax,y+ay,FC_COLOUR_MARCOS); FC_DRAW_LINE(x-ax,y,x-ax,y+ay,FC_COLOUR_MARCOS); FC_DRAW_LINE(x+ax,y,x+ax,y+ay,FC_COLOUR_MARCOS); y+=ay+FC_MARGIN_BETWEEN; if (ax>draw.izquierda) draw.izquierda=ax; if (ax>draw.derecha) draw.derecha=ax; // --- p++; } else if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='d' && source->GetCharAt(p+1)=='o' && source->GetStyleAt(p+2)!=wxSTC_C_WORD) { p+=2; FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; // buscar que sigue FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p2 = FindBlockEnd(p1=p,pe); if (p2==wxSTC_INVALID_POSITION) return false; draw_data i_draw(x,y); mb_index=0; mc_index=0; if (!Analize(p1,p2,i_draw,dc,mb_index,mc_index)) return false; y+=i_draw.alto; draw.draws.insert(draw.draws.begin(),i_draw); p=p2+1; // buscar la condicion FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); if (source->GetCharAt(p)!='w' || source->GetCharAt(p+1)!='h' || source->GetCharAt(p+2)!='i' || source->GetCharAt(p+3)!='l' || source->GetCharAt(p+4)!='e' ) return false; p+=5; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p1=p+1; if (source->GetCharAt(p)!='(' || (p=source->BraceMatch(p))==wxSTC_INVALID_POSITION) return false; p2=p; p++; int cont_space; if (mc_index) { // dibujar referencia del continue si es necesario FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; wxString text; text<<mc_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_LINE(x,y,x,y+ax*2,FC_COLOUR_FLECHAS);; FC_DRAW_TEXT(x+FC_MARGIN_BETWEEN+ax-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x+FC_MARGIN_BETWEEN,y,ax*2,ax*2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x+FC_MARGIN_ARROW,y+ax-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x+FC_MARGIN_ARROW,y+ax+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x+FC_MARGIN_BETWEEN,y+ax,FC_COLOUR_FLECHAS); y+=ax*2; FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; cont_space=(FC_MARGIN_IN+ax)*2; } else { FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; cont_space=FC_MARGIN_BETWEEN; } FC_DRAW_LINE(x-FC_MARGIN_ARROW,y-FC_MARGIN_ARROW,x,y,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y-FC_MARGIN_ARROW,x,y,FC_COLOUR_FLECHAS); // dibujar la condicion GetTextSize(text=GetText(p1,p2),dc,tw,th); int ch = th/2+FC_MARGIN_BETWEEN, cw = tw+FC_MARGIN_BETWEEN; FC_DRAW_LINE(x,y,x+cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y,x-cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y+ch*2,x+cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y+ch*2,x-cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_TEXT(x-tw,y+ch-th/2,text,FC_COLOUR_CONDITION); y+=ch*2; // dibujar flechas que faltan int fw=(cw>i_draw.izquierda?cw:i_draw.izquierda)+FC_MARGIN_BETWEEN; // falso FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_TEXT(x+FC_MARGIN_ARROW,y,_T("f"),FC_COLOUR_BOOLEANS); // verdadero FC_DRAW_LINE(x-cw,y-ch,x-fw,y-ch,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-fw,y-ch,x-fw,y-ch*2-cont_space-i_draw.alto,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y-ch*2-cont_space-i_draw.alto,x-fw,y-ch*2-cont_space-i_draw.alto,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y-FC_MARGIN_ARROW-ch*2-cont_space-i_draw.alto,x,y-ch*2-cont_space-i_draw.alto,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_ARROW-ch*2-cont_space-i_draw.alto,x,y-ch*2-cont_space-i_draw.alto,FC_COLOUR_FLECHAS); FC_DRAW_TEXT(x-cw-FC_MARGIN_ARROW*2,y-ch,_T("v"),FC_COLOUR_BOOLEANS); y+=FC_MARGIN_BETWEEN; if (mb_index) { // dibujar referencia del break si es necesario FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; wxString text; text<<mb_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_LINE(x,y,x,y+ax*2,FC_COLOUR_FLECHAS);; FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-ax-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x-FC_MARGIN_BETWEEN-ax*2,y,ax*2,ax*2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_BETWEEN,y+ax,FC_COLOUR_FLECHAS); y+=ax*2; } if (fw>draw.izquierda) draw.izquierda=fw; if (draw.derecha<i_draw.derecha) draw.derecha=i_draw.derecha; p++; } else if (source->GetStyleAt(p)==wxSTC_C_WORD && source->GetCharAt(p)=='w' && source->GetCharAt(p+1)=='h' && source->GetCharAt(p+2)=='i' && source->GetCharAt(p+3)=='l' && source->GetCharAt(p+4)=='e' && source->GetStyleAt(p+5)!=wxSTC_C_WORD) { p+=5; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p1=p+1; if (source->GetCharAt(p)!='(' || (p=source->BraceMatch(p))==wxSTC_INVALID_POSITION) return false; p2=p; p++; // extraer condicion wxString condicion=GetText(p1,p2); // buscar que sigue int cont_space; FC_FRONT(FC_IS_EMPTY || FC_SHOULD_IGNORE); p2 = FindBlockEnd(p1=p,pe); if (p2==wxSTC_INVALID_POSITION) return false; draw_data i_draw(x,y); mb_index=0; mc_index=0; if (!Analize(p1,p2,i_draw,dc,mb_index,mc_index)) return false; if (mc_index) { // dibujar flecha FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; wxString text; text<<mc_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; cont_space=(ax+FC_MARGIN_IN)*2; i_draw.y+=cont_space; FC_DRAW_LINE(x,y,x,y+cont_space,FC_COLOUR_FLECHAS); y+=ax+FC_MARGIN_BETWEEN; FC_DRAW_LINE(x,y,x+FC_MARGIN_BETWEEN,y,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y,x+FC_MARGIN_ARROW,y-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y,x+FC_MARGIN_ARROW,y+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_TEXT(x+FC_MARGIN_BETWEEN+ax-tw,y-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x+FC_MARGIN_BETWEEN,y-ax,ax*2,ax*2,FC_COLOUR_FLECHAS); cont_space+=FC_MARGIN_BETWEEN; } else { FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; cont_space=FC_MARGIN_BETWEEN*2; } p=p2+1; // dibujar flecha FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; // dibujar condicion GetTextSize(condicion,dc,tw,th); int ch = th/2+FC_MARGIN_BETWEEN, cw = tw+FC_MARGIN_BETWEEN; FC_DRAW_LINE(x,y,x+cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y,x-cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y+ch*2,x+cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_LINE(x,y+ch*2,x-cw,y+ch,FC_COLOUR_MARCOS); FC_DRAW_TEXT(x-tw,y+ch-th/2,condicion,FC_COLOUR_CONDITION); FC_DRAW_LINE(x,y+ch*2,x,y+ch*2+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); // v de verdadero y+=ch*2+FC_MARGIN_BETWEEN; FC_DRAW_TEXT(x+FC_MARGIN_ARROW,y-FC_MARGIN_BETWEEN,_T("v"),FC_COLOUR_BOOLEANS); i_draw.y+=ch*2+FC_MARGIN_BETWEEN*2; draw.draws.insert(draw.draws.begin(),i_draw); // dibujar flechas que faltan int fwi=(cw>i_draw.izquierda?cw:i_draw.izquierda)+FC_MARGIN_BETWEEN; int fwd=(cw>i_draw.derecha?cw:i_draw.derecha)+FC_MARGIN_BETWEEN; FC_DRAW_LINE(x,y+i_draw.alto,x,y+i_draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+i_draw.alto+FC_MARGIN_BETWEEN,x-fwi,y+i_draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-fwi,y-ch*2-cont_space,x-fwi,y+i_draw.alto+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-fwi,y-ch*2-cont_space,x,y-ch*2-cont_space,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y-ch*2-cont_space+FC_MARGIN_ARROW,x,y-ch*2-cont_space,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y-ch*2-cont_space-FC_MARGIN_ARROW,x,y-ch*2-cont_space,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+cw,y-ch-FC_MARGIN_BETWEEN,x+fwd,y-ch-FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+fwd,y-ch-FC_MARGIN_BETWEEN,x+fwd,y+i_draw.alto+FC_MARGIN_BETWEEN*2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+i_draw.alto+FC_MARGIN_BETWEEN*2,x+fwd,y+i_draw.alto+FC_MARGIN_BETWEEN*2,FC_COLOUR_FLECHAS); // f de falso FC_DRAW_TEXT(x+cw,y-ch-FC_MARGIN_BETWEEN,_T("f"),FC_COLOUR_BOOLEANS); if (fwi>draw.izquierda) draw.izquierda=fwi; if (fwd>draw.derecha) draw.derecha=fwd; y+=i_draw.alto+FC_MARGIN_BETWEEN*2; if (mb_index) { // dibujar referencia del break si es necesario FC_DRAW_LINE(x,y,x,y+FC_MARGIN_IN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_IN; wxString text; text<<mb_index; GetTextSize(text,dc,tw,th); ax=tw+FC_MARGIN_IN; FC_DRAW_LINE(x,y,x,y+ax*2,FC_COLOUR_FLECHAS);; FC_DRAW_TEXT(x-FC_MARGIN_BETWEEN-ax-tw,y+ax-th/2,text,FC_COLOUR_JUMP); FC_DRAW_CIRCLE(x-FC_MARGIN_BETWEEN-ax*2,y,ax*2,ax*2,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax-FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_ARROW,y+ax+FC_MARGIN_ARROW,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x,y+ax,x-FC_MARGIN_BETWEEN,y+ax,FC_COLOUR_FLECHAS); y+=ax*2; } } else { p1 = p; FC_FRONT(!FC_IS(';') || FC_SHOULD_IGNORE); p2 = p; FC_BACK(p1,FC_IS_EMPTY || FC_SHOULD_IGNORE); text = GetText(p1,p); p=p2; if (text.Len()==0) { draw.alto = y; return true; } // dibujar una instruccion comun FC_DRAW_LINE(x,y,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x+FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); FC_DRAW_LINE(x-FC_MARGIN_ARROW,y+FC_MARGIN_BETWEEN-FC_MARGIN_ARROW,x,y+FC_MARGIN_BETWEEN,FC_COLOUR_FLECHAS); y+=FC_MARGIN_BETWEEN; GetTextSize(text,dc,tw,th); FC_DRAW_TEXT(x-tw,y+FC_MARGIN_IN,text,FC_COLOUR_INSTRUCTION); ax=tw+FC_MARGIN_IN; ay=th+FC_MARGIN_IN+FC_MARGIN_IN; FC_DRAW_LINE(x-ax,y,x+ax,y,FC_COLOUR_MARCOS); FC_DRAW_LINE(x-ax,y+ay,x+ax,y+ay,FC_COLOUR_MARCOS); FC_DRAW_LINE(x-ax,y,x-ax,y+ay,FC_COLOUR_MARCOS); FC_DRAW_LINE(x+ax,y,x+ax,y+ay,FC_COLOUR_MARCOS); y+=ay; if (ax>draw.derecha) draw.derecha=ax; if (ax>draw.izquierda) draw.izquierda=ax; // --- p++; } } return true; } mxFlowCanvas::~mxFlowCanvas() { delete colour_black; delete colour_red; delete colour_green; delete colour_blue; delete pen_black; delete pen_red; delete pen_green; delete pen_blue; delete font; } void mxFlowCanvas::GetTextSize(wxString text, wxDC *dc, int &m_ancho, int &alto) { wxSize s = dc->GetTextExtent(text); m_ancho = s.GetWidth()/2; alto = s.GetHeight(); } void mxFlowCanvas::OnPaint (wxPaintEvent &event) { int w=GetRect().GetWidth(); wxPaintDC dc(this); PrepareDC(dc); dc.SetUserScale(scale,scale); dc.Clear(); dc.SetFont(*font); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextBackground(*wxWHITE); if (scale*(draw.izquierda+draw.derecha+2*FC_MARGIN_BETWEEN)<w) Draw(dc,draw,int((w/2+(draw.izquierda-(draw.izquierda+draw.derecha)/2))/scale),FC_MARGIN_BETWEEN /*draw.alto+FC_MARGIN_BETWEEN*/ ); else Draw(dc,draw,draw.izquierda+FC_MARGIN_BETWEEN,FC_MARGIN_BETWEEN /*draw.alto+FC_MARGIN_BETWEEN*/ ); } void mxFlowCanvas::Draw(wxPaintDC &dc, draw_data &draw, int x, int y) { x+=draw.x; y+=draw.y; list<fc_arc>::iterator it_a=draw.arcs.begin(), ed_a=draw.arcs.end(); while (it_a!=ed_a) { dc.SetPen(*(it_a->pen)); dc.DrawEllipse(x+it_a->x,y+it_a->y,it_a->w,it_a->h); ++it_a; } list<fc_line>::iterator it_l=draw.lines.begin(), ed_l=draw.lines.end(); while (it_l!=ed_l) { dc.SetPen(*(it_l->pen)); dc.DrawLine(x+it_l->x1,y+it_l->y1,x+it_l->x2,y+it_l->y2); ++it_l; } list<fc_text>::iterator it_t=draw.texts.begin(), ed_t=draw.texts.end(); while (it_t!=ed_t) { dc.SetTextForeground(*(it_t->colour)); dc.DrawText(it_t->text,x+it_t->x,y+it_t->y); ++it_t; } list<draw_data>::iterator it_d=draw.draws.begin(), ed_d=draw.draws.end(); while (it_d!=ed_d) { Draw(dc,*it_d, x, y); ++it_d; } } wxString mxFlowCanvas::GetText(int p1, int p2) { wxString ret; int p=p1; while (p<p2) { char c; int s; // para los FC_* while (p<p2 && !FC_IS_EMPTY && !FC_IS_COMMENT) { ret+=c; p++; } ret+=" "; while (p<p2 && (FC_IS_EMPTY || FC_IS_COMMENT) ) p++; } ret.RemoveLast(); return ret; } bool mxFlowCanvas::IsWord(wxString &text, wxString word) { if (text.Len()<=word.Len()) return false; unsigned int i; for (i=0; i<word.Len();i++) { if (text[i]!=word[i]) return false; } char c=text[i]; return !((c>='a' && c<='z') || (c>='A' && c<='z') || (c>='0' && c<='9') || c=='.' || c=='_'); } void mxFlowCanvas::ChangeScale(double rel_size, int mx, int my) { scale*=rel_size; int x,y,w,h; GetViewStart(&x,&y); GetClientSize(&w,&h); SetScrollbars(1,1,int((draw.izquierda+draw.derecha+FC_MARGIN_BETWEEN*2)*scale),int((draw.alto+FC_MARGIN_BETWEEN*2)*scale),int(x*rel_size),int(y*rel_size),false); // SetVirtualSize(scale*(draw.izquierda+draw.derecha+2*FC_MARGIN_BETWEEN),scale*(draw.alto+FC_MARGIN_BETWEEN*2)); // SetScrollRate(1,1); // Scroll(x+w/2-w/rel_size,y+h/2-y/rel_size); Refresh(); } void mxFlowCanvas::OnMouseUp(wxMouseEvent &evt) { m_motion=false; } void mxFlowCanvas::OnMouseDown(wxMouseEvent &evt) { m_motion=true; m_y=evt.m_y; m_x=evt.m_x; GetViewStart(&m_sx,&m_sy); } void mxFlowCanvas::OnMouseMotion(wxMouseEvent &evt) { if (m_motion) Scroll(m_sx+m_x-evt.m_x,m_sy+m_y-evt.m_y); } void mxFlowCanvas::OnMouseWheel(wxMouseEvent &evt) { if (evt.m_wheelRotation>0) ChangeScale(5.0/4,evt.m_x,evt.m_y); else ChangeScale(4.0/5,evt.m_x,evt.m_y); }
4a696e3c87bd5162b7ab39bc0ea3629b14bc0d4e
e166c0c3712eccd4e8d5527016b16327efcfbc34
/artemis-code/src/concolic/executiontree/tracevisitor.h
0c7e7b112b06eb0b75f48c717a3459c9b7de1a17
[ "Apache-2.0" ]
permissive
daisy1754/Artemis
1b7b49bee5db746628e1616d70c7aa8027f10a80
8a5dcbcda569a39fe51723388d66d3297ad18eff
refs/heads/master
2020-12-24T22:20:52.045403
2013-09-18T16:13:39
2013-09-18T16:13:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,202
h
tracevisitor.h
/* * Copyright 2012 Aarhus University * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TRACEVISITOR_H #define TRACEVISITOR_H #include <QSharedPointer> namespace artemis { // Need to forward declare the concrete nodes so we can reference them in the visitor. class TraceNode; class TraceBranch; class TraceConcreteBranch; class TraceSymbolicBranch; class TraceUnexplored; class TraceAnnotation; class TraceAlert; class TraceDomModification; class TracePageLoad; class TraceFunctionCall; class TraceEnd; class TraceEndSuccess; class TraceEndFailure; class TraceEndUnknown; /* * The visitor interface. * Implementations of this interface must implement visit() at least for TraceBranch but can also choose to * implement special cases for specific node types as desired. */ /* * Note on pointers: * We must use standard pointers instead of smart pointers here, because in the visitor pattern a node must pass * out a reference to itself. If this reference is wrapped in a shared pointer then as soon as that pointer goes * out of scope the node will be deleted. * So the visitor parts use standard pointers and have the following restrictions: * * A visitor must never store a node pointer. * * A visitor cannot guarantee that a pointer is still valid if modifications are made higher up the tree * which may have caused it to become unreferenced by any smart pointer. */ class TraceVisitor { public: // Must be provided by a concrete visitor as a catch-all. virtual void visit(TraceNode* node) = 0; // Supply a default implementation for each node type which relays the call to the node type's parent type. // These can be overrriden as required by a concrete visitor. virtual void visit(TraceBranch* node); virtual void visit(TraceConcreteBranch* node); virtual void visit(TraceSymbolicBranch* node); virtual void visit(TraceUnexplored* node); virtual void visit(TraceAnnotation* node); virtual void visit(TraceAlert* node); virtual void visit(TraceDomModification* node); virtual void visit(TracePageLoad* node); virtual void visit(TraceFunctionCall* node); virtual void visit(TraceEnd* node); virtual void visit(TraceEndSuccess* node); virtual void visit(TraceEndFailure* node); virtual void visit(TraceEndUnknown* node); // Helper methods for concrete visitors. static bool isImmediatelyUnexplored(QSharedPointer<TraceNode> trace); static bool isImmediatelyConcreteBranch(QSharedPointer<TraceNode> trace); virtual ~TraceVisitor(){} }; typedef QSharedPointer<TraceVisitor> TraceVisitorPtr; } // namespace artemis #endif // TRACEVISITOR_H
10f12f16b568dd1004bcc63cfe84e45a4e8cf30a
a91e4983cca710865e76f69c608d159d4af7f596
/main.cpp
f8bab2552372495fab945ca52142556a0383819c
[]
no_license
ploe/citron
7ef576180648ab0c5a875d35c0dbfc639c85f9dd
bfd4045f56fe0442ef812efa6aa9c9b6ff143064
refs/heads/master
2020-07-30T11:09:41.397972
2019-09-23T15:40:40
2019-09-23T15:40:40
210,208,322
0
0
null
null
null
null
UTF-8
C++
false
false
8,703
cpp
main.cpp
#include <IL/il.h> #include <IL/ilu.h> #define GLEW_STATIC #include <GL/glew.h> #ifdef __linux #include <SDL2/SDL.h> #include <SDL_opengl.h> #elif __APPLE__ #include <SDL.h> #include <SDL_opengl.h> #endif SDL_Window *window; SDL_GLContext context; GLuint vertexShader, fragmentShader; typedef char *Text; enum { ELOAD = -1, }; void Panic(int code, const char *format, ...) { va_list args; va_start (args, format); vprintf (format, args); va_end (args); abort(); } static const char *ErrorString(GLenum error) { switch (error) { case GL_NO_ERROR: return "GL_NO_ERROR"; break; case GL_INVALID_ENUM: return "GL_INVALID_ENUM"; break; case GL_INVALID_VALUE: return "GL_INVALID_VALUE"; break; case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; break; case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION"; break; case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; break; } return NULL; } void Panic_on_glGetError(const char *tag) { GLenum error = glGetError(); if (error) { printf("%s panic: ", tag); Panic(1, "%s (%d)\n", ErrorString(error), error); } } Text Text_New(const char *format, ...) { va_list size_args, format_args; va_start(format_args, format); va_copy(size_args, format_args); int size = 1 + vsnprintf(NULL, 0, format, size_args); va_end(size_args); Text t = (Text) calloc(size, sizeof(char)); vsnprintf (t, size, format, format_args); va_end(format_args); return t; } Text Text_FromFile(const char *path) { FILE *file = fopen(path, "r"); if (!file) { Panic(ELOAD, "Text_FromFile: unable to find '%s'", path); } long size = 0; fseek(file, 0, SEEK_END); size = ftell(file); rewind(file); Text buffer = (Text) calloc(size+1, sizeof(char)); if (!buffer) Panic(ELOAD, "Text_FromFile: unable to allocate buffer for '%s'\n", path); if(fread(buffer, 1, size, file) != size) Panic(ELOAD, "Text_FromFile: error reading '%s'\n", path); fclose(file); return buffer; } Text Text_Free(Text t) { if(t) free(t); return NULL; } bool Window_New() { SDL_Init(SDL_INIT_VIDEO); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); window = SDL_CreateWindow("OpenGL", 100, 100, 800, 600, SDL_WINDOW_OPENGL); context = SDL_GL_CreateContext(window); glewExperimental = GL_TRUE; glewInit(); ilInit(); iluInit(); return true; } void Window_Destroy() { SDL_GL_DeleteContext(context); SDL_Quit(); } bool Window_Event() { SDL_Event Window_Event; while (true) { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); // Draw a rectangle from the 2 triangles using 6 indices glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); if (SDL_PollEvent(&Window_Event)) { if (Window_Event.type == SDL_QUIT) return false; if (Window_Event.type == SDL_KEYUP && Window_Event.key.keysym.sym == SDLK_ESCAPE) return false; SDL_GL_SwapWindow(window); } } return true; } GLuint Shader_FromFile(const char *filename, GLenum shaderType) { const char *src = Text_FromFile(filename); GLuint shader = glCreateShader(shaderType); glShaderSource(shader, 1, &src, NULL); Text_Free((Text) src); glCompileShader(shader); GLint status; glGetShaderiv(shader, GL_COMPILE_STATUS, &status); if (!status) { char log[512]; glGetShaderInfoLog(shader, sizeof(log), NULL, log); Panic(1, "%s: %s\n", filename, log); } return shader; } GLuint ShaderProgram_New(const char *filename, GLuint *shader, GLenum shaderType, ...) { GLuint program = glCreateProgram(); va_list args; va_start(args, shaderType); while (filename && shaderType) { *shader = Shader_FromFile(filename, shaderType); glAttachShader(program, *shader); filename = (const char *) va_arg(args, const char *); shader = va_arg(args, GLuint *); shaderType = va_arg(args, GLenum); } va_end(args); Panic_on_glGetError("ShaderProgram_New"); return program; } #define PROGRAM_NEW(...) ShaderProgram_New(__VA_ARGS__, NULL, NULL, 0) GLuint Vao_New() { GLuint vao; glGenVertexArrays(1, &vao); glBindVertexArray(vao); Panic_on_glGetError("Vao_New"); return vao; } GLuint GlBuffer_New(GLenum target, GLsizeiptr size, const GLvoid *data) { GLuint buffer; glGenBuffers(1, &buffer); // Generate 1 buffer glBindBuffer(target, buffer); glBufferData(target, size, data, GL_STATIC_DRAW); return buffer; } GLuint Vbo_New(GLsizeiptr size, const GLvoid *data) { GLuint vbo = GlBuffer_New(GL_ARRAY_BUFFER, size, data); Panic_on_glGetError("Vbo_New"); return vbo; } GLuint Ebo_New(GLsizeiptr size, const GLvoid *data) { GLuint ebo = GlBuffer_New(GL_ELEMENT_ARRAY_BUFFER, size, data); Panic_on_glGetError("Ebo_New"); return ebo; } GLint ShaderProgram_SetAttrib(GLuint program, const GLchar *name, GLint size, GLsizei stride, unsigned long offset) { puts(name); GLint index = glGetAttribLocation(program, name); Panic_on_glGetError("ShaderProgram_SetAttrib/glGetAttribLocation"); glEnableVertexAttribArray(index); Panic_on_glGetError("ShaderProgram_SetAttrib/glEnableVertexAttribArray"); stride *= sizeof(GLfloat); unsigned long pointer = offset * sizeof(GLfloat); glVertexAttribPointer(index, size, GL_FLOAT, GL_FALSE, stride, (const GLvoid *) pointer); Panic_on_glGetError("ShaderProgram_SetAttrib/glVertexAttribPointer"); return index; } static void GetAttribFromArgs(va_list args, const GLchar **name, GLint **attrib, GLint *size) { *name = (const char *) va_arg(args, const char *); *attrib = (GLint *) va_arg(args, GLint *); *size = (GLint) va_arg(args, GLint); } static GLsizei GetStride(va_list src, GLsizei size) { va_list args; va_copy(args, src); const GLchar *name; GLint *attrib, stride = 0; do { stride += size; GetAttribFromArgs(args, &name, &attrib, &size); } while(name && attrib && size); va_end(args); return stride; } void ShaderProgram_SetAttribs(GLuint program, const GLchar *name, GLint *attrib, GLint size, ...) { if (!(program && name && attrib && size)) Panic(1, "ShaderProgram_SetAttribs: args not set"); va_list args; va_start(args, size); GLsizei stride = GetStride(args, size); printf("%d\n", stride); unsigned long offset = 0; while(name && attrib && size) { *attrib = ShaderProgram_SetAttrib(program, name, size, stride, offset); offset += size; GetAttribFromArgs(args, &name, &attrib, &size); } va_end(args); } GLuint Texture_FromFile(const char *path) { ILuint img = 0; ilGenImages(1, &img); ilBindImage(img); ilLoadImage(path); if (!ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE)) Panic(1, "image not converted"); GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); GLuint width = ilGetInteger(IL_IMAGE_WIDTH), height = ilGetInteger(IL_IMAGE_HEIGHT); GLuint *pixels = (GLuint *) ilGetData(); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); return texture; return 0; } int main(int argc, char *argv[]) { Window_New(); float vertices[] = { // Position Color Texcoords -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // Top-left 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // Top-right 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // Bottom-right -0.5f, -0.5f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f // Bottom-left }; GLuint vao = Vao_New(); GLuint vbo = Vbo_New(sizeof(vertices), vertices); GLuint elements[] = { 0, 1, 2, 2, 3, 0 }; GLuint ebo = Ebo_New(sizeof(elements), elements); GLuint program = ShaderProgram_New( "./shader.vert", &vertexShader, GL_VERTEX_SHADER, "./shader.frag", &fragmentShader, GL_FRAGMENT_SHADER, NULL, NULL, 0 ); glBindFragDataLocation(program, 0, "outColor"); glLinkProgram(program); glUseProgram(program); Panic_on_glGetError("link/use program"); // Specify the layout of the vertex data GLint position, color, texcoord; ShaderProgram_SetAttribs(program, "position", &position, 2, "color", &color, 3, "texcoord", &texcoord, 2, NULL, NULL, 0 ); GLuint texture = Texture_FromFile("./myke.png"); Window_Event(); Window_Destroy(); return 0; }
719be6f2762c1f28096d3775e2ce3350c8c9509c
41a05309d3d4aff77816417f8b1e551294decbf4
/deps/v8/src/builtins/builtins-intl.cc
c14d73b3b60b69701fad42d74508c5cbfb071c18
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-unicode", "ICU", "LicenseRef-scancode-openssl", "NAIST-2003", "ISC", "Zlib", "LicenseRef-scancode-public-domain", "NTP", "BSD-2-Clause", "Artistic-2.0", "MIT", "bzip2-1.0.6", "SunPro" ]
permissive
RajithaKumara/nodejs-mobile
27d86aa5e64e400fe78441c57db78ce453906734
2d415b1d7efd6ff90ce44d4b90f553bbdcf11882
refs/heads/mobile-master
2020-05-02T22:23:13.694176
2019-02-07T16:23:05
2019-02-07T16:29:54
178,250,404
1
0
NOASSERTION
2019-04-01T12:11:38
2019-03-28T17:18:36
JavaScript
UTF-8
C++
false
false
3,553
cc
builtins-intl.cc
// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_INTL_SUPPORT #error Internationalization is expected to be enabled. #endif // V8_INTL_SUPPORT #include "src/builtins/builtins-utils.h" #include "src/builtins/builtins.h" #include "src/intl.h" #include "src/objects-inl.h" #include "unicode/normalizer2.h" namespace v8 { namespace internal { BUILTIN(StringPrototypeToUpperCaseIntl) { HandleScope scope(isolate); TO_THIS_STRING(string, "String.prototype.toUpperCase"); string = String::Flatten(string); return ConvertCase(string, true, isolate); } BUILTIN(StringPrototypeNormalizeIntl) { HandleScope handle_scope(isolate); TO_THIS_STRING(string, "String.prototype.normalize"); Handle<Object> form_input = args.atOrUndefined(isolate, 1); const char* form_name; UNormalization2Mode form_mode; if (form_input->IsUndefined(isolate)) { // default is FNC form_name = "nfc"; form_mode = UNORM2_COMPOSE; } else { Handle<String> form; ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, form, Object::ToString(isolate, form_input)); if (String::Equals(form, isolate->factory()->NFC_string())) { form_name = "nfc"; form_mode = UNORM2_COMPOSE; } else if (String::Equals(form, isolate->factory()->NFD_string())) { form_name = "nfc"; form_mode = UNORM2_DECOMPOSE; } else if (String::Equals(form, isolate->factory()->NFKC_string())) { form_name = "nfkc"; form_mode = UNORM2_COMPOSE; } else if (String::Equals(form, isolate->factory()->NFKD_string())) { form_name = "nfkc"; form_mode = UNORM2_DECOMPOSE; } else { Handle<String> valid_forms = isolate->factory()->NewStringFromStaticChars("NFC, NFD, NFKC, NFKD"); THROW_NEW_ERROR_RETURN_FAILURE( isolate, NewRangeError(MessageTemplate::kNormalizationForm, valid_forms)); } } int length = string->length(); string = String::Flatten(string); icu::UnicodeString result; std::unique_ptr<uc16[]> sap; UErrorCode status = U_ZERO_ERROR; { DisallowHeapAllocation no_gc; String::FlatContent flat = string->GetFlatContent(); const UChar* src = GetUCharBufferFromFlat(flat, &sap, length); icu::UnicodeString input(false, src, length); // Getting a singleton. Should not free it. const icu::Normalizer2* normalizer = icu::Normalizer2::getInstance(nullptr, form_name, form_mode, status); DCHECK(U_SUCCESS(status)); CHECK(normalizer != nullptr); int32_t normalized_prefix_length = normalizer->spanQuickCheckYes(input, status); // Quick return if the input is already normalized. if (length == normalized_prefix_length) return *string; icu::UnicodeString unnormalized = input.tempSubString(normalized_prefix_length); // Read-only alias of the normalized prefix. result.setTo(false, input.getBuffer(), normalized_prefix_length); // copy-on-write; normalize the suffix and append to |result|. normalizer->normalizeSecondAndAppend(result, unnormalized, status); } if (U_FAILURE(status)) { return isolate->heap()->undefined_value(); } RETURN_RESULT_OR_FAILURE( isolate, isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>( reinterpret_cast<const uint16_t*>(result.getBuffer()), result.length()))); } } // namespace internal } // namespace v8
0033e53e175556d840f81deb1dcbb5b7d62ded37
9956d3dfc1536b32d1fea7bd4efaafc593a5ab10
/src/data_structures/cc_node.tpl.h
282301ee279070de6cd0f1572f00b39ab19faf77
[]
no_license
curiousTauseef/chapchom
a66201d8a5dfcd8eeb310e4e23645f5c69fbbee5
127f07758a35305d82336216abf1e068d67992e8
refs/heads/master
2022-11-22T00:10:05.408899
2020-01-29T19:25:11
2020-01-29T19:25:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,468
h
cc_node.tpl.h
// IN THIS FILE: The definition of a class to represent nodes // Check whether the class has been already defined #ifndef CCNODE_TPL_H #define CCNODE_TPL_H #include "../general/common_includes.h" #include "../general/utilities.h" #include "./cc_data.h" namespace chapchom { /// @class CCNode cc_node.h // Abstract class to represent nodes template<class T> class CCNode { public: // Empty constructor CCNode(const unsigned dimension, const unsigned n_variables, const unsigned n_history_values); // Empty destructor virtual ~CCNode(); // Pin al positions inline void pin_all_positions() {X.pin_all();} // Pin all variables inline void pin_all_variables() {U.pin_all();} // Pin i-th position inline void pin_position(const unsigned &i) {X.pin(i);} // Unpin i-th position inline void unpin_position(const unsigned &i) {X.unpin(i);} // Pin i-th variable inline void pin_u(const unsigned &i) {U.pin(i);} // Unpin i-th variable inline void unpin_u(const unsigned &i) {U.unpin(i);} // Get access to the spatial position of the node inline CCData<T> &x() {return X;} // Get the i-th spatial position of the node at time t inline T get_position(const unsigned &i, const unsigned t=0) {return X.value(i,t);} // Set the i-th spatial position of the node at time t inline void set_position(const T i_position, const unsigned &i, const unsigned t=0) {X.value(i,t)=i_position;} // Get access to variables stored in the node inline CCData<T> &u() {return U;} // Get the i-th variable value at time t inline T get_variable(const unsigned &i, const unsigned t=0) {return U.value(i,t);} // Set the i-th variable value at time t inline void set_variable(const T i_variable, const unsigned &i, const unsigned t=0) {U.value(i,t)=i_variable;} inline unsigned dimension() const {return Dimension;} inline unsigned n_variables() const {return N_variables;} inline unsigned n_history_values() const {return N_history_values;} // Output the data stored at the node (output horizontally without // position by default, otherwise output vertically with position) virtual void output(bool output_position = false, const unsigned t = 0) const; // Output the data stored at the node to a file (output horizontally // without position by default, otherwise output vertically with // position) virtual void output(std::ofstream &outfile, bool output_position = false, const unsigned t = 0) const; // Output the node inline void print(bool output_position = false, const unsigned t = 0) const {output(output_position, t);} // Output to file inline void print(std::ofstream &outfile, bool output_position = false, const unsigned t = 0) const {output(outfile, output_position, t);} protected: // The spatial dimension of the node const unsigned Dimension; // The number of variables stored in the node const unsigned N_variables; // The number of history values of the variable stored in the node const unsigned N_history_values; // Store the spatial position of the node CCData<T> X; // Store the values of the variables stored in the node CCData<T> U; }; } #endif // #ifndef CCNODE_TPL_H
a91c198b975999578fa6ba38126a6fb825f05b98
ae831e9906154180f0e2192a1a2715f6d394b08c
/src/timer.h
835ed43eeb5594836734c74c459c02f76889e540
[ "BSD-3-Clause" ]
permissive
Treecodes/TABI-PB
0109377e538ce104f2345619da93b6a064aa31fe
0710ff7c346c5b13416d34a1ae6da2a738a5dbbd
refs/heads/master
2022-05-04T08:58:18.959724
2022-05-01T19:05:53
2022-05-01T19:07:48
108,321,952
5
0
NOASSERTION
2022-05-01T19:07:49
2017-10-25T20:23:27
C++
UTF-8
C++
false
false
773
h
timer.h
#ifndef H_TIMER_STRUCT_H #define H_TIMER_STRUCT_H #include <chrono> class Timer { private: std::chrono::time_point<std::chrono::steady_clock> start_time_; std::chrono::time_point<std::chrono::steady_clock> end_time_; std::chrono::duration<double, std::milli> elapsed_time_ = std::chrono::steady_clock::duration::zero(); public: void start() { start_time_ = std::chrono::steady_clock::now(); } void stop() { end_time_ = std::chrono::steady_clock::now(); elapsed_time_ += std::chrono::duration<double, std::milli>(end_time_ - start_time_); } double elapsed_time() const { return std::chrono::duration<double>(elapsed_time_).count(); } Timer() = default; ~Timer() = default; }; #endif
24462abdd79f9652da0782abf43508572cfe8d09
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/third_party/blink/renderer/core/style/style_variables_test.cc
77ffa595db43cd5734cab115f892c6808866a9eb
[ "GPL-1.0-or-later", "MIT", "LGPL-2.0-or-later", "Apache-2.0", "LGPL-2.0-only", "BSD-2-Clause", "LGPL-2.1-only", "LicenseRef-scancode-warranty-disclaimer", "GPL-2.0-only", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
7,945
cc
style_variables_test.cc
// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/core/style/style_variables.h" #include "third_party/blink/renderer/core/css/css_test_helpers.h" #include "third_party/blink/renderer/core/css/css_variable_data.h" #include "third_party/blink/renderer/core/css/parser/css_tokenizer.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" namespace blink { namespace { class StyleVariablesTest : public PageTestBase {}; TEST_F(StyleVariablesTest, EmptyEqual) { StyleVariables vars1; StyleVariables vars2; EXPECT_EQ(vars1, vars1); EXPECT_EQ(vars2, vars2); EXPECT_EQ(vars1, vars2); } TEST_F(StyleVariablesTest, Copy) { auto foo_data = css_test_helpers::CreateVariableData("foo"); const CSSValue* foo_value = css_test_helpers::CreateCustomIdent("foo"); AtomicString x_string("--x"); StyleVariables vars1; vars1.SetData(x_string, foo_data); vars1.SetValue(x_string, foo_value); StyleVariables vars2(vars1); EXPECT_EQ(foo_data, vars2.GetData(x_string).value_or(nullptr)); EXPECT_EQ(foo_value, vars2.GetValue(x_string).value_or(nullptr)); EXPECT_EQ(vars1, vars2); } TEST_F(StyleVariablesTest, Assignment) { auto foo_data = css_test_helpers::CreateVariableData("foo"); const CSSValue* foo_value = css_test_helpers::CreateCustomIdent("foo"); AtomicString x_string("--x"); AtomicString y_string("--y"); AtomicString z_string("--z"); StyleVariables vars1; vars1.SetData(x_string, foo_data); vars1.SetValue(x_string, foo_value); EXPECT_EQ(foo_data, vars1.GetData(x_string).value_or(nullptr)); EXPECT_EQ(foo_value, vars1.GetValue(x_string).value_or(nullptr)); StyleVariables vars2; EXPECT_FALSE(vars2.GetData(x_string).has_value()); EXPECT_FALSE(vars2.GetValue(x_string).has_value()); vars2.SetData(y_string, foo_data); vars2.SetValue(y_string, foo_value); EXPECT_EQ(foo_data, vars2.GetData(y_string).value_or(nullptr)); EXPECT_EQ(foo_value, vars2.GetValue(y_string).value_or(nullptr)); vars2 = vars1; EXPECT_TRUE(vars2.GetData(x_string).has_value()); EXPECT_TRUE(vars2.GetValue(x_string).has_value()); EXPECT_FALSE(vars2.GetData(y_string).has_value()); EXPECT_FALSE(vars2.GetValue(y_string).has_value()); EXPECT_EQ(vars1, vars2); vars2.SetData(z_string, foo_data); vars2.SetValue(z_string, foo_value); EXPECT_EQ(foo_data, vars2.GetData(z_string).value_or(nullptr)); EXPECT_EQ(foo_value, vars2.GetValue(z_string).value_or(nullptr)); // Should not affect vars1: EXPECT_FALSE(vars1.GetData(y_string).has_value()); EXPECT_FALSE(vars1.GetValue(y_string).has_value()); EXPECT_FALSE(vars1.GetData(z_string).has_value()); EXPECT_FALSE(vars1.GetValue(z_string).has_value()); } TEST_F(StyleVariablesTest, GetNames) { AtomicString x_string("--x"); AtomicString y_string("--y"); StyleVariables vars; vars.SetData(x_string, css_test_helpers::CreateVariableData("foo")); vars.SetData(y_string, css_test_helpers::CreateVariableData("bar")); HashSet<AtomicString> names; vars.CollectNames(names); EXPECT_EQ(2u, names.size()); EXPECT_TRUE(names.Contains(x_string)); EXPECT_TRUE(names.Contains(y_string)); } // CSSVariableData TEST_F(StyleVariablesTest, IsEmptyData) { AtomicString x_string("--x"); StyleVariables vars; EXPECT_TRUE(vars.IsEmpty()); vars.SetData(x_string, css_test_helpers::CreateVariableData("foo")); EXPECT_FALSE(vars.IsEmpty()); } TEST_F(StyleVariablesTest, SetData) { AtomicString x_string("--x"); StyleVariables vars; auto foo = css_test_helpers::CreateVariableData("foo"); auto bar = css_test_helpers::CreateVariableData("bar"); EXPECT_FALSE(vars.GetData(x_string).has_value()); vars.SetData(x_string, foo); EXPECT_EQ(foo, vars.GetData(x_string).value_or(nullptr)); vars.SetData(x_string, bar); EXPECT_EQ(bar, vars.GetData(x_string).value_or(nullptr)); } TEST_F(StyleVariablesTest, SetNullData) { AtomicString x_string("--x"); StyleVariables vars; EXPECT_FALSE(vars.GetData(x_string).has_value()); vars.SetData(x_string, nullptr); auto data = vars.GetData(x_string); ASSERT_TRUE(data.has_value()); EXPECT_EQ(nullptr, data.value()); } TEST_F(StyleVariablesTest, SingleDataSamePointer) { AtomicString x_string("--x"); auto data = css_test_helpers::CreateVariableData("foo"); StyleVariables vars1; StyleVariables vars2; vars1.SetData(x_string, data); vars2.SetData(x_string, data); EXPECT_EQ(vars1, vars2); } TEST_F(StyleVariablesTest, SingleDataSameContent) { AtomicString x_string("--x"); StyleVariables vars1; StyleVariables vars2; vars1.SetData(x_string, css_test_helpers::CreateVariableData("foo")); vars2.SetData(x_string, css_test_helpers::CreateVariableData("foo")); EXPECT_EQ(vars1, vars2); } TEST_F(StyleVariablesTest, SingleDataContentNotEqual) { AtomicString x_string("--x"); StyleVariables vars1; StyleVariables vars2; vars1.SetData(x_string, css_test_helpers::CreateVariableData("foo")); vars2.SetData(x_string, css_test_helpers::CreateVariableData("bar")); EXPECT_NE(vars1, vars2); } TEST_F(StyleVariablesTest, DifferentDataSize) { AtomicString x_string("--x"); AtomicString y_string("--y"); StyleVariables vars1; StyleVariables vars2; vars1.SetData(x_string, css_test_helpers::CreateVariableData("foo")); vars2.SetData(x_string, css_test_helpers::CreateVariableData("bar")); vars2.SetData(y_string, css_test_helpers::CreateVariableData("foz")); EXPECT_NE(vars1, vars2); } // CSSValue TEST_F(StyleVariablesTest, IsEmptyValue) { AtomicString x_string("--x"); StyleVariables vars; EXPECT_TRUE(vars.IsEmpty()); vars.SetValue(x_string, css_test_helpers::CreateCustomIdent("foo")); EXPECT_FALSE(vars.IsEmpty()); } TEST_F(StyleVariablesTest, SetValue) { AtomicString x_string("--x"); StyleVariables vars; const CSSValue* foo = css_test_helpers::CreateCustomIdent("foo"); const CSSValue* bar = css_test_helpers::CreateCustomIdent("bar"); EXPECT_FALSE(vars.GetValue(x_string).has_value()); vars.SetValue(x_string, foo); EXPECT_EQ(foo, vars.GetValue(x_string).value_or(nullptr)); vars.SetValue(x_string, bar); EXPECT_EQ(bar, vars.GetValue(x_string).value_or(nullptr)); } TEST_F(StyleVariablesTest, SetNullValue) { AtomicString x_string("--x"); StyleVariables vars; EXPECT_FALSE(vars.GetValue(x_string).has_value()); vars.SetValue(x_string, nullptr); auto value = vars.GetValue(x_string); ASSERT_TRUE(value.has_value()); EXPECT_EQ(nullptr, value.value()); } TEST_F(StyleVariablesTest, SingleValueSamePointer) { AtomicString x_string("--x"); const CSSValue* foo = css_test_helpers::CreateCustomIdent("foo"); StyleVariables vars1; StyleVariables vars2; vars1.SetValue(x_string, foo); vars2.SetValue(x_string, foo); EXPECT_EQ(vars1, vars2); } TEST_F(StyleVariablesTest, SingleValueSameContent) { AtomicString x_string("--x"); StyleVariables vars1; StyleVariables vars2; vars1.SetValue(x_string, css_test_helpers::CreateCustomIdent("foo")); vars2.SetValue(x_string, css_test_helpers::CreateCustomIdent("foo")); EXPECT_EQ(vars1, vars2); } TEST_F(StyleVariablesTest, SingleValueContentNotEqual) { AtomicString x_string("--x"); StyleVariables vars1; StyleVariables vars2; vars1.SetValue(x_string, css_test_helpers::CreateCustomIdent("foo")); vars2.SetValue(x_string, css_test_helpers::CreateCustomIdent("bar")); EXPECT_NE(vars1, vars2); } TEST_F(StyleVariablesTest, DifferentValueSize) { AtomicString x_string("--x"); AtomicString y_string("--y"); StyleVariables vars1; StyleVariables vars2; vars1.SetValue(x_string, css_test_helpers::CreateCustomIdent("foo")); vars2.SetValue(x_string, css_test_helpers::CreateCustomIdent("bar")); vars2.SetValue(y_string, css_test_helpers::CreateCustomIdent("foz")); EXPECT_NE(vars1, vars2); } } // namespace } // namespace blink
f9abc39d48852570adb378941fbeb6b76204692f
a33aac97878b2cb15677be26e308cbc46e2862d2
/program_data/PKU_raw/72/578.c
0ea465abe50e76eadc07e553e3d8b5b5ca58bb1c
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
467
c
578.c
main() { int a[21][21]; int i,j,k,m,n; for(i=0;i<21;i++) for(j=0;j<21;j++) a[i][j]=0; scanf("%d %d",&m,&n); for(i=1;i<m+1;i++) for(j=1;j<n+1;j++) scanf("%d",&a[i][j]); for(i=1;i<m+1;i++) { for(j=1;j<n+1;j++) { if(a[i][j]>=a[i-1][j]&&a[i][j]>=a[i][j-1]&&a[i][j]>=a[i+1][j]&&a[i][j]>=a[i][j+1]) printf("%d %d\n",i-1,j-1); } } }
407ac95eb6d5417fde8037119f59f9bd0850064b
dd2b09c58a82ac7c5ee62e7d889f450a3b4b55c2
/src/http_category.cpp
6af60766a8b951350878da9e27a88bcb5a6ec360
[ "BSL-1.0" ]
permissive
darcyg/boost.http
6d3db384798bcf81ab9ffa42841ac457f0afbd94
a9cc6838afd1672d794b8c9bef3a0dadd3950c8e
refs/heads/master
2021-01-18T14:29:52.635116
2014-05-22T02:03:52
2014-05-22T02:03:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
970
cpp
http_category.cpp
/* Copyright (c) 2014 Vinícius dos Santos Oliveira Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #include <boost/http/http_errc.hpp> namespace boost { namespace http { class http_category_impl: public std::error_category { public: const char* name() const noexcept override; std::string message(int condition) const noexcept override; }; const char* http_category_impl::name() const noexcept { return "http"; } std::string http_category_impl::message(int condition) const noexcept { switch (condition) { case static_cast<int>(http_errc::out_of_order): return "HTTP actions issued on the wrong order for some object"; default: return "undefined"; } } const std::error_category& out_of_order_category() { static http_category_impl category; return category; } } // namespace http } // namespace boost
fefefa637c1a76593b7962dffe56e55ef13a0a5a
fa5d4fc69288949d60fadb7a2b6ac5c448284032
/include/Pixel.h
c3404c3f2b719dae46c682754511290dc49bd2fc
[ "Apache-2.0" ]
permissive
giane88/NormalizeMPI
1c86432e96cd57327e0faf8ad556813df72524bc
792cdc1c7b9abf066e7cbaa58c4f9b81e372dbbe
refs/heads/master
2016-09-15T23:02:39.679877
2014-12-16T12:33:15
2014-12-16T12:33:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
955
h
Pixel.h
#ifndef PIXEL_H #define PIXEL_H #include <boost/mpi.hpp> #include <boost/serialization/access.hpp> class Pixel { private: unsigned char m_red; unsigned char m_green; unsigned char m_blue; friend class boost::serialization::access; template <class Archive> void serialize(Archive &ar, const unsigned int version) { ar & m_red; ar & m_green; ar & m_blue; } public: Pixel(); Pixel(unsigned char red,unsigned char green,unsigned char blue) : m_red(red), m_green(green), m_blue(blue) {}; virtual ~Pixel(); unsigned char getRed(); void setRed(unsigned char val); unsigned char getGreen(); void setGreen(unsigned char val); unsigned char getBlue(); void setBlue(unsigned char val); void setColor (unsigned char red,unsigned char green,unsigned char blue); }; #endif // PIXEL_H
6fcb3ce01f543155235d2d41cf743454edbadf19
a82e7f7a5b55197d0639cb4b9f7cacd50ae6b0a1
/LeetCode/algorithm/Add_Strings_415.cpp
e480ef816d9a06eab7829401e1f22518255e4dcf
[]
no_license
bhushan23/competitive-programming
af96f38cb32f351abbd3551c9cf4f25974e01a13
530c602498ee153517dacf9d95822e99c7e248db
refs/heads/master
2021-01-20T00:50:52.393881
2018-03-01T17:26:34
2018-03-01T17:26:34
89,196,037
0
0
null
null
null
null
UTF-8
C++
false
false
945
cpp
Add_Strings_415.cpp
class Solution { public: string addStrings(string num1, string num2) { reverse(num1.begin(), num1.end()); reverse(num2.begin(), num2.end()); string ans(max(num1.length(), num2.length()), '0'); int i, carry = 0; for (i = 0; i < min(num1.length(), num2.length()); ++i) { int tmp = carry + num1[i] - '0' + num2[i] - '0'; ans[i] = tmp % 10 + '0'; carry = tmp / 10; } for (; i < num1.length(); ++i) { int tmp = carry + num1[i] - '0'; ans[i] = tmp % 10 + '0'; carry = tmp / 10; } for (; i < num2.length(); ++i) { int tmp = carry + num2[i] - '0'; ans[i] = tmp % 10 + '0'; carry = tmp / 10; } if (carry) { ans.resize(ans.size()+1, carry+'0'); } reverse(ans.begin(), ans.end()); return ans; } };
ae95bbafdc6f028637967bc82eab751b1acb4005
0443e6cbc9c3b755748224b9877cd9c77f87175d
/Question7/src/main/main.cc
ca47eee26df01d0b71f8ac71a77ab4b4a218c342
[]
no_license
JingchaoZhou/EE599_HW2
ef9cc010528bfb3d186779126e1e9481b792fccd
a1a167021b8f8262561ff03529d1859926dfd51e
refs/heads/master
2020-12-29T11:53:58.424428
2020-02-06T03:25:59
2020-02-06T03:25:59
238,598,725
0
0
null
null
null
null
UTF-8
C++
false
false
439
cc
main.cc
#include <iostream> #include "src/lib/solution.h" #include <iterator> int main() { Solution solution ; string from = "add"; string to = "egk"; map<char,char> out = solution.mappable(from,to); map <char,char>::iterator itr; cout << "{"; for(itr = out.begin(); itr != out.end(); ++itr){ cout <<"(" << itr -> first << "->" << itr -> second <<")"; } cout << "}" << endl; return EXIT_SUCCESS; }
b8c55778ab3866dbf1f83af79f02dce8f2903443
e09347fc3a3518e96bda01277474350f43ab06ec
/scpp_models/include/rocketHoverDefinitions.hpp
1fe97d02d30f01a6752fcdee679731f194bfb241
[ "MIT" ]
permissive
kaikaishen/SCpp
21744beca0be90fe37516374e1b1c9c53c31d954
bebaf6148c932e3b053e1d8414eba0a4b9496c8b
refs/heads/master
2020-12-06T16:09:26.867590
2019-12-18T18:35:00
2019-12-18T18:35:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
147
hpp
rocketHoverDefinitions.hpp
#pragma once #include "common.hpp" namespace scpp::models { enum rocketHover { STATE_DIM_ = 10, INPUT_DIM_ = 3, PARAM_DIM_ = 10 }; }
bafc4d6ee15266a37b4cc7ab2d774fcfae1078be
31435b5020e2b2ce1f15d3222376f0fdd6a92add
/src/Functors/GeometrySpringGetAngles.cpp
195abdce48c37a212a5279bb468a2a7368c5ab10
[]
no_license
vadimostanin/sceleton_phisics_constructor
4ac3a3a371133a3a97cc763ef9158a667fdaa3dc
87424844e8ca8c8eef1d1935a845c81f0162021a
refs/heads/master
2021-01-16T00:27:56.271805
2015-04-25T10:45:18
2015-04-25T10:45:18
32,335,198
0
2
null
null
null
null
UTF-8
C++
false
false
2,147
cpp
GeometrySpringGetAngles.cpp
/* * GeometrySpringGetAngles.cpp * * Created on: 22 апр. 2015 * Author: vadim */ #include "GeometrySpringGetAngles.h" #include "GeometrySpringGetCrosslinkPredicate.h" #include "GeometryLinkGetAbsoluteAnglePredicate.h" GeometrySpringGetAngles::GeometrySpringGetAngles( const GeometrySpring * geometrySpring ) : m_GeometrySpring( geometrySpring ), m_CrossPoint( 0 ) { GeometrySpringGetCrosslinkPredicate getCrosspoint( m_GeometrySpring ); m_CrossPoint = getCrosspoint(); } GeometrySpringGetAngles::~GeometrySpringGetAngles() { } bool GeometrySpringGetAngles::getIsValid() const { return m_CrossPoint != NULL; } const GeometryPoint * GeometrySpringGetAngles::getCrospoint() const { return m_CrossPoint; } const GeometryPoint * GeometrySpringGetAngles::getLinkFromAdjacentPoint() const { const GeometryPoint * result = NULL; if( m_GeometrySpring->getLinkFrom()->getPointFrom() == getCrospoint() ) { result = m_GeometrySpring->getLinkFrom()->getPointTo(); } else { result = m_GeometrySpring->getLinkFrom()->getPointFrom(); } return result; } const GeometryPoint * GeometrySpringGetAngles::getLinkToAdjacentPoint() const { const GeometryPoint * result = NULL; if( m_GeometrySpring->getLinkTo()->getPointFrom() == getCrospoint() ) { result = m_GeometrySpring->getLinkTo()->getPointTo(); } else { result = m_GeometrySpring->getLinkTo()->getPointFrom(); } return result; } int GeometrySpringGetAngles::getLinkFromAngle() const { int linkX1 = getCrospoint()->getX(); int linkY1 = getCrospoint()->getY(); int linkX2 = getLinkFromAdjacentPoint()->getX(); int linkY2 = getLinkFromAdjacentPoint()->getY(); GeometryLinkGetAbsoluteAnglePredicate getLinkAbsoluteAngle( linkX1, linkY1, linkX2, linkY2 ); return getLinkAbsoluteAngle(); } int GeometrySpringGetAngles::getLinkToAngle() const { int linkX1 = getCrospoint()->getX(); int linkY1 = getCrospoint()->getY(); int linkX2 = getLinkToAdjacentPoint()->getX(); int linkY2 = getLinkToAdjacentPoint()->getY(); GeometryLinkGetAbsoluteAnglePredicate getLinkAbsoluteAngle( linkX1, linkY1, linkX2, linkY2 ); return getLinkAbsoluteAngle(); }
0263cd430228230497f2262114b3053c6a0309b8
cd0cfa7320731abedb554e528324b6eae7fb5ce1
/BilliardsGL/Engine/UI/UIButton.hpp
6384c17401519b7c0b9c7e71ec6e99b89968bc8e
[]
no_license
HSKKOU/BilliardsGL
1d5654773454ca8934fd6becb238085aaa61d803
80d9cd3d99c014017983d2d6419fc2ecdc4f5d6a
refs/heads/master
2021-05-04T01:28:04.681376
2016-12-15T10:58:56
2016-12-15T10:58:56
71,215,581
0
0
null
null
null
null
UTF-8
C++
false
false
927
hpp
UIButton.hpp
// // UIButton.hpp // BilliardsGL // // Created by 比佐 幸基 on 2016/11/13. // Copyright © 2016年 比佐 幸基. All rights reserved. // #ifndef UIButton_hpp #define UIButton_hpp #include "UIPanel.hpp" NS_ENGINE_UI class IButtonHandler { public: virtual ~IButtonHandler() {} virtual void onButtonDown() = 0; virtual void onButtonDownRepeat() = 0; virtual void onButtonUp() = 0; }; class UIButton : public UIPanel { protected: bool isPressedFlag; IButtonHandler* handler; public: UIButton(Point2D p, Vector2D s, ETex tex, UI_ALIGNMENT_MASK mask, Color c); virtual ~UIButton(); virtual void setHandler(IButtonHandler* hdl); virtual void awake(); virtual bool isInRange(Point2D p) const; virtual bool isPressed() const; virtual void setIsPressedFlag(bool f); virtual void press(); virtual void pressRepeat(); virtual void release(); }; NS_END2 #endif /* UIButton_hpp */
f3edf29f6e3a4670f6133f2c6efffb764ae363a8
8386739914b178a5aa31964b29820f7675e617d4
/src/Object.h
b2b829d9f7bf51e56289a32e57fced2d93319a8b
[]
no_license
dAmihl/ppg-core
3892c823876370d5f4fb75b2b2fffd6af18b10ec
b8815f020803d299e0b3fb0adb3d654e8cebf4ba
refs/heads/master
2023-08-06T02:23:34.513301
2021-10-04T18:07:34
2021-10-04T18:07:34
200,243,877
0
0
null
2021-09-27T14:56:32
2019-08-02T13:57:33
C++
UTF-8
C++
false
false
1,230
h
Object.h
#pragma once #include "core/Core.h" #include "State.h" #include "StateTransition.h" #include "core/ObjectMetaData.h" namespace PPG { class PPG_EXPORT Object { public: Object(); Object(Str name); public: Str getObjectName() const; State getCurrentState() const; StateTransition getStateTransition() const; Str getTextualRepresentation() const; Vec<State> getReachableStates() const; ObjectMetaData getMetaData() const; Str getTemplateName() const; bool isTemplateObject() const; void setStateTransition(const StateTransition F); void setCurrentState(State Sc); void setMetaData(ObjectMetaData MD); void setTemplateName(Str tName); void setIsTemplateObject(bool bTemplate); bool sameTemplateAs(const Object& o2) const; private: Str objectName; State currentState; StateTransition stateTransition; Str getReachableStatesTextualRepresentation() const; ObjectMetaData metaData; bool bIsTemplate = false; Str templateName; }; inline bool operator==(const Object& lhs, const Object& rhs) { return (&lhs == &rhs) || (lhs.getObjectName() == rhs.getObjectName() && lhs.getTemplateName() == rhs.getTemplateName() && lhs.getCurrentState() == rhs.getCurrentState()); } }
c557f5ca2caa2cc87f27f23e258b6422f9967c71
5b23c5c264ee9d6c3a9317f2e56b837b611f72e3
/demo/AllInOneDialog.h
3e8a519ce115a3961179042a035bbd5fa9a91cbc
[ "MIT", "GPL-1.0-or-later" ]
permissive
shi-yan/AssortedWidgets
1cc620f5ee9513cf7f501456995ef8b51ddd06d6
a2f2e8503dea99658c06ce14ef0fbc3203360ebd
refs/heads/master
2021-11-25T21:19:12.466213
2021-11-16T01:38:57
2021-11-16T01:38:57
37,887,411
117
35
MIT
2021-11-16T01:38:57
2015-06-23T00:11:02
C++
UTF-8
C++
false
false
1,543
h
AllInOneDialog.h
#pragma once #include "Dialog.h" #include "GridLayout.h" #include "Label.h" #include "Button.h" #include "TextField.h" #include "ScrollPanel.h" #include "CheckButton.h" #include "RadioButton.h" #include "SlideBar.h" #include "ProgressBar.h" #include "DropList.h" #include "DropListItem.h" #include "RadioGroup.h" namespace AssortedWidgets { namespace Test { class AllInOneDialog: public Widgets::Dialog { private: Widgets::Label *m_label; Widgets::Button *m_closeButton; Widgets::TextField *m_textField; Widgets::ScrollPanel *m_scrollPanel; Widgets::Label *m_labelInScroll; Widgets::CheckButton *m_check; Widgets::RadioButton *m_radio1; Widgets::RadioButton *m_radio2; Widgets::SlideBar *m_sliderH; Widgets::SlideBar *m_sliderV; Widgets::ProgressBar *m_progressH; Widgets::ProgressBar *m_progressV; Widgets::DropList *m_dropList1; Widgets::DropList *m_dropList2; Widgets::RadioGroup *m_radioGroup; Widgets::DropListItem *m_option1; Widgets::DropListItem *m_option2; Widgets::DropListItem *m_option3; Widgets::DropListItem *m_option4; Widgets::DropListItem *m_option5; Widgets::DropListItem *m_option6; Layout::GridLayout *m_gridLayout; public: void onClose(const Event::MouseEvent &e); AllInOneDialog(void); public: ~AllInOneDialog(void); }; } }
f02adf6bea3c3c92fe1947d7a3a0fe79288dc682
c5a1f3a68bd228df99f7a2520099c25a00ea0fb1
/debugStuff.h
9f126f0e1e154ed8176c48ef037c1fa59bc55acc
[]
no_license
ericDeCourcy/BiologySim
6d7dfa018a7ee87ce6b41c2f2c81f786ea8178ce
7d6d3ef94d1c7121407ee2f46a26a8aa6993aece
refs/heads/master
2020-03-17T00:32:18.545514
2018-11-14T02:05:29
2018-11-14T02:05:29
133,120,427
0
0
null
null
null
null
UTF-8
C++
false
false
1,307
h
debugStuff.h
ofstream logFile; void spreadMinerals() { mineralPop[0].directionMoving = -1; mineralPop[0].type = 0; mineralPop[0].x = 0; mineralPop[0].y = 3; gameMap[0][3] = 1000; mineralPop[1].directionMoving = -1; mineralPop[1].type = 0; mineralPop[1].x = 1; mineralPop[1].y = 3; gameMap[1][3] = 1001; mineralPop[2].directionMoving = -1; mineralPop[2].type = 0; mineralPop[2].x = 2; mineralPop[2].y = 3; gameMap[2][3] = 1002; mineralPop[3].directionMoving = -1; mineralPop[3].type = 0; mineralPop[3].x = 3; mineralPop[3].y = 3; gameMap[3][3] = 1003; mineralPop[4].directionMoving = -1; mineralPop[4].type = 0; mineralPop[4].x = 3; mineralPop[4].y = 0; gameMap[3][0] = 1004; mineralPop[5].directionMoving = -1; mineralPop[5].type = 0; mineralPop[5].x = 3; mineralPop[5].y = 1; gameMap[3][1] = 1005; mineralPop[6].directionMoving = -1; mineralPop[6].type = 0; mineralPop[6].x = 3; mineralPop[6].y = 2; gameMap[3][2] = 1006; } void closeLog() { logFile.close(); } void initializeLog() { logFile.open("log.txt"); } void coutAndLog(string content) { logFile << content; std::cout << content; }
3ae900ab85a35a8b45e8857c36b025f289c0fc3a
f83ef53177180ebfeb5a3e230aa29794f52ce1fc
/ACE/ACE_wrappers/TAO/tests/InterOp-Naming/INS_i.h
afce1f3c4e40f087b185bd5ff483e4ac3783bb74
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-sun-iiop" ]
permissive
msrLi/portingSources
fe7528b3fd08eed4a1b41383c88ee5c09c2294ef
57d561730ab27804a3172b33807f2bffbc9e52ae
refs/heads/master
2021-07-08T01:22:29.604203
2019-07-10T13:07:06
2019-07-10T13:07:06
196,183,165
2
1
Apache-2.0
2020-10-13T14:30:53
2019-07-10T10:16:46
null
UTF-8
C++
false
false
703
h
INS_i.h
// -*- C++ -*- //============================================================================= /** * @file INS_i.h * * This class implements the INS interface. * * @author Vishal Kachroo <vishal@cs.wustl.edu> */ //============================================================================= #ifndef INS_I_H #define INS_I_H #include "INSS.h" class INS_i : public POA_INS { public: // = Initialization and termination methods. /// Constructor. INS_i (void); /// Destructor. ~INS_i (void); /// test the INS. char * test_ins (void); /// Set the ORB pointer. void orb (CORBA::ORB_ptr o); private: /// ORB pointer. CORBA::ORB_var orb_; }; #endif /* INS_I_H */
609b6192d35f764e12923a2832790ef8e31a80de
f5602d385458a7a85ae292184359939721d25b77
/Data/neigh_inc.cpp
c40c212d0db366d07e239666e81a29d8f3ab00ff
[]
no_license
LiisaLoog/pleistocene-wolves
5aaa6c875fe2fa6d9c81ed26a7486918f3b60824
5bad55557dd0bf99313ec3a43a40edd86c098dca
refs/heads/master
2020-06-13T17:44:10.610149
2019-10-16T12:11:53
2019-10-16T12:11:53
194,736,650
0
0
null
null
null
null
UTF-8
C++
false
false
847
cpp
neigh_inc.cpp
//----------------------------------------------------------------------------------- // Graph defining wolf regions // // 0: Europe // 1: Central_North_Eurasia // 2: Beringia // 3: Middle_East // 4: South_East_Asia // 5: Arctic_North_America // 6: North_America // //----------------------------------------------------------------------------------- const int nDemes = 7; const int nNeigh = 16; int neigh[nNeigh] = { 1, // 0 0, 2, 3, 4, // 1 1, 4, 5, 6, // 2 1, // 3 1, 2, // 4 2, 6, // 5 2, 5 // 6 }; const int nNeighs[nDemes] = { 1, // Deme 0: 1 4, // Deme 1: 5 4, // Deme 2: 9 1, // Deme 3: 10 2, // Deme 4: 12 2, // Deme 5: 14 2 // Deme 6: 16 }; // 0 1 2 3 4 5 6, terminal const int neighStart[nDemes+1] = { 0, 1, 5, 9, 10, 12, 14, 16 };
4ed9efee7df4330afab5aa718cd33dce2e193998
976004c9f4426106d7ca59db25755d4d574b8025
/demos/network/src/demo_download.cpp
6a03816262829839a3ba2e08c0c6c75e0628a723
[]
no_license
peterzxli/cvpp
18a90c23baaaa07a32b2aafdb25d6ae78a1768c0
3b73cfce99dc4b5908cd6cb7898ce5ef1e336dce
refs/heads/master
2022-12-05T07:23:20.488638
2020-08-11T20:08:10
2020-08-11T20:08:10
286,062,971
1
0
null
null
null
null
UTF-8
C++
false
false
502
cpp
demo_download.cpp
#include <cvpp/network/network_downloader.h> #include <cvpp/auxiliar/macros.h> using namespace cvpp; int main(int argc, char *argv[]) { // CREATE DOWNLOAD INTERFACE Downloader down; // DOWNLOAD FILE disp( "Downloading..." ); bool suc = down.toFile( "https://eigen.tuxfamily.org/dox/AsciiQuickReference.txt" , "eigen.txt" ); // CHECK FOR SUCCESS if( suc ) disp( "SUCCESS!" ); else disp( "FAILURE!" ); // FINALIZE return 0; }
3372f326f42aab40c9799a850d00d0b4ba3777b9
8bf6eff1bff54f677801144d6ede3a5e8ce12900
/base/Sources/Compute/RomixCpu.hpp
52b6a4e35d25ea6a72805e89b5d5c2c31bff3cbf
[]
no_license
DarkIntegral/romix-acceleration
791c2cf21ad4b2b7cc6d56144d3024fbe09d8c80
b9ab77027bccd36a19fab3c653e1e190cc5fe898
refs/heads/main
2023-04-10T12:02:04.252399
2021-03-26T21:08:38
2021-03-26T21:08:38
351,782,437
0
0
null
null
null
null
UTF-8
C++
false
false
961
hpp
RomixCpu.hpp
// // RomixCpu.hpp // // Created by Braiden Brousseau on 2021-03-26. // #ifndef RomixCpu_hpp #define RomixCpu_hpp #include <vector> #include "RomixBase.hpp" class RomixCpu: public RomixBase { public: RomixCpu(); void mix(uint8_t* data, size_t blocks); private: // scratch buffers std::vector<uint8_t> mV; std::vector<uint8_t> mXY; // taken directly from libbitcoin/system/math/external/crypto_scrypt.c static void blkcpy(uint8_t*, uint8_t*, size_t); static void blkxor(uint8_t*, uint8_t*, size_t); static void salsa20_8(uint8_t[64]); static void blockmix_salsa8(uint8_t*, uint8_t*, size_t); static uint64_t integerify(uint8_t*, size_t); static void smix(uint8_t* , size_t, uint64_t, uint8_t*, uint8_t*); static inline uint32_t le32dec(const void* pp); static inline void le32enc(void* pp, uint32_t x); static inline uint64_t le64dec(const void* pp); }; #endif /* RomixCpu_hpp */
579ba52a65e4e62ca334e6894b305e0f7033483e
8ea521234d9a63d73d99f6c67dd23d81cc8b4999
/Tecent_exam/Tecent_exam/main.cpp
06b43ad091baf7d38b87a932c4d8be29989dffe6
[]
no_license
chenfushan/alps_algorithm
e9b9994e398a0cb503b50812b262049475185815
fe23ce5a6d6eb647f6fae41e78c9d729170b1f11
refs/heads/master
2021-01-21T04:55:22.840848
2016-06-05T08:36:35
2016-06-05T08:36:35
22,367,983
0
0
null
null
null
null
UTF-8
C++
false
false
538
cpp
main.cpp
// // main.cpp // Tecent_exam // // Created by Alps on 15/4/8. // Copyright (c) 2015年 chen. All rights reserved. // #include <iostream> using namespace std; struct A{ unsigned char x; unsigned char y; int z; }; #pragma pack(8) struct B{ uint8_t a; uint32_t b; uint16_t c; }; #pragma pack() int main(int argc, const char * argv[]) { int i = 1; int a = 1; for (i = 2; ; i++) { if (a > (a<<1)) { break; } a = a<<1; } printf("%d\n",i/8); return 0; }
ba0f3b362a1c51f2d4854539dee956a8495d7a74
dfc4d0ae87d50a34441c80a690955126001f36a4
/11145.cpp
867ca0805a4d23590f8dc1a24e3a0e0d191f52b8
[]
no_license
fakerainjw/ProblemSolving
48c2e83f414f3ea9a9b8e182ff94842b4f9453ae
402c06a1d64ee287e39a74282acc1f0c7714d8fe
refs/heads/master
2023-07-08T07:33:18.003061
2016-08-01T13:16:07
2016-08-01T13:16:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,108
cpp
11145.cpp
#include <iostream> #include <cstdio> #include <cstring> using namespace std; char input_stream[100]; int main(void) { int N; freopen("test.txt","r",stdin); scanf("%d",&N); getchar(); for (int i=0;i<N;i++) { gets(input_stream); int len = strlen(input_stream); bool checking = true; int nStart=-1,nEnd; for ( int j=0;j<len;j++ ) { if ( input_stream[j]!=' ' && !( '0' <= input_stream[j] && input_stream[j] <='9' )) checking = false; if ( ( '0' <= input_stream[j] && input_stream[j] <='9' ) && nStart == -1 ) nStart = j; if ( ( '0' <= input_stream[j] && input_stream[j] <='9' ) ) nEnd = j; } if ( checking ) { bool yep = true; for ( int j=nStart;j<=nEnd;j++ ) { if ( input_stream[j] == ' ' ) yep = false; } if ( yep ) { while ( input_stream[nStart] == '0' ) nStart++; if ( len == 1 ) printf("%s\n",input_stream); else printf("%s\n",input_stream+nStart); } else printf("invalid input\n"); } else printf("invalid input\n"); } return 0; }
a3012c267d9cd454d31c006b7dccb0c4d39a64f9
a52c4c629e6dba91de3ca1f04784507392c0b798
/arduinoir/arduinoir.ino
03dad971aaff05ec38d9ee230de603a7eac38e24
[]
no_license
freedom5566/Arduino
57ee4df4d0e815935b5d40a00149d41d080c1c44
6cb0596543fa222561242e770cc213e6563180c6
refs/heads/master
2021-05-02T14:23:57.984976
2018-03-18T14:53:04
2018-03-18T14:53:04
120,719,697
0
0
null
null
null
null
UTF-8
C++
false
false
590
ino
arduinoir.ino
int Led=13; #define FALSE 0 #define TRUE 1 int buttonpin=3; int val; int i=0,j=0; static int g_counter = 0; //http://www.yd-tech.com.tw/product_info.php/products_id/70965 void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(Led,OUTPUT); pinMode(buttonpin,INPUT); } void loop() { // put your main code here, to run repeatedly: val=digitalRead(buttonpin); if(val==HIGH){ digitalWrite(Led,HIGH); }else{ digitalWrite(Led,LOW); i=1; delay(1000); if(i){ j++; Serial.print(j); } } }
fd37ae7477e4284e05f9d46c4949f0e99a8a4b9a
5ddfc063c839e7880d28eaa1166475eda41aab90
/MSCMPSO/function.h
04d7f721d68f91613498ebae4ce4cd6f43c2b519
[]
no_license
lanshiyinging/MSCMPSO
c81d2549a252aa96dd17010ed3a6426a9777a9eb
2a824d15026d9ccf4b8c2adc835f4fcb8cb7803c
refs/heads/master
2020-09-08T10:30:04.571207
2019-11-15T15:59:19
2019-11-15T15:59:19
221,108,837
0
0
null
null
null
null
UTF-8
C++
false
false
646
h
function.h
// // Created by lansy on 2019/11/12. // #ifndef MSCMPSO_FUNCTION_H #define MSCMPSO_FUNCTION_H #include <cmath> #include <vector> using namespace std; #define PI 3.14159265 const double TabletWidth = 100; const double QuadricWidth = 100; const double RosenbrockWidth = 50; const double GriewankWidth = 300; const double RastriginWidth = 5.12; const double SchafferWidth = 100; const int dim = 30; double Tablet(vector<double> x); double Quadric(vector<double> x); double Rosenbrock(vector<double> x); double Griewank(vector<double> x); double Rastrigin(vector<double> x); double SchafferF7(vector<double> x); #endif //MSCMPSO_FUNCTION_H
fd53a86a40b3ee57c947d5553a64c8452b7cb622
35bc9c40286431c55a835625219793e8d12e9e65
/processing/module/maker/yas_processing_number_to_signal_module.cpp
4a40d7699def44520a80e36cd7d88f3a831f5a27
[ "MIT" ]
permissive
objective-audio/processing
07bd9ff77932f37b199edc704935a90bac7bc3b9
2963433b633e474113103ff4cbfb4cf1798d4173
refs/heads/master
2023-06-08T17:48:50.505776
2023-06-04T09:16:17
2023-06-04T09:16:17
73,592,179
0
0
MIT
2023-06-04T09:16:18
2016-11-13T02:59:40
Objective-C++
UTF-8
C++
false
false
4,946
cpp
yas_processing_number_to_signal_module.cpp
// // yas_processing_number_to_signal_module.cpp // #include "yas_processing_number_to_signal_module.h" #include <cpp_utils/yas_boolean.h> #include <cpp_utils/yas_fast_each.h> #include <processing/yas_processing_module.h> #include <processing/yas_processing_number_event.h> #include <processing/yas_processing_number_process_context.h> #include <processing/yas_processing_receive_number_processor.h> #include <processing/yas_processing_remove_number_processor.h> #include <processing/yas_processing_send_signal_processor.h> #include <processing/yas_processing_signal_event.h> #include <map> using namespace yas; using namespace yas::proc; template <typename T> proc::module_ptr proc::make_number_to_signal_module() { auto make_processors = [] { auto context = std::make_shared<number_process_context<T, 1>>(); auto prepare_processor = [context](time::range const &current_range, connector_map_t const &, connector_map_t const &, stream &) mutable { context->reset(current_range); }; auto receive_processor = make_receive_number_processor<T>( [context](proc::time::frame::type const &frame, channel_index_t const, connector_index_t const, T const &value) mutable { context->insert_input(frame, value, 0); }); auto remove_processor = make_remove_number_processor<T>({to_connector_index(number_to_signal::input::number)}); auto send_processor = make_send_signal_processor<T>( [context, out_each = fast_each<T *>{}](proc::time::range const &time_range, sync_source const &, channel_index_t const, connector_index_t const, T *const signal_ptr) mutable { auto const top_frame = time_range.frame; auto iterator = context->inputs().cbegin(); auto const end_iterator = context->inputs().cend(); T const &last_value = context->last_values()[0]; out_each.reset(signal_ptr, time_range.length); while (yas_each_next(out_each)) { auto const frame = top_frame + yas_each_index(out_each); if (iterator != end_iterator) { if (iterator->first == frame) { context->update_last_values(iterator->second); ++iterator; } } yas_each_value(out_each) = last_value; } }); return module::processors_t{{std::move(prepare_processor), std::move(receive_processor), std::move(remove_processor), std::move(send_processor)}}; }; return proc::module::make_shared(std::move(make_processors)); } template proc::module_ptr proc::make_number_to_signal_module<double>(); template proc::module_ptr proc::make_number_to_signal_module<float>(); template proc::module_ptr proc::make_number_to_signal_module<int64_t>(); template proc::module_ptr proc::make_number_to_signal_module<int32_t>(); template proc::module_ptr proc::make_number_to_signal_module<int16_t>(); template proc::module_ptr proc::make_number_to_signal_module<int8_t>(); template proc::module_ptr proc::make_number_to_signal_module<uint64_t>(); template proc::module_ptr proc::make_number_to_signal_module<uint32_t>(); template proc::module_ptr proc::make_number_to_signal_module<uint16_t>(); template proc::module_ptr proc::make_number_to_signal_module<uint8_t>(); template proc::module_ptr proc::make_number_to_signal_module<boolean>(); #pragma mark - void yas::connect(proc::module_ptr const &module, proc::number_to_signal::input const &input, proc::channel_index_t const &ch_idx) { module->connect_input(proc::to_connector_index(input), ch_idx); } void yas::connect(proc::module_ptr const &module, proc::number_to_signal::output const &output, proc::channel_index_t const &ch_idx) { module->connect_output(proc::to_connector_index(output), ch_idx); } std::string yas::to_string(proc::number_to_signal::input const &input) { using namespace yas::proc::number_to_signal; switch (input) { case input::number: return "number"; } throw "input not found."; } std::string yas::to_string(proc::number_to_signal::output const &output) { using namespace yas::proc::number_to_signal; switch (output) { case output::signal: return "signal"; } throw "output not found."; } std::ostream &operator<<(std::ostream &os, yas::proc::number_to_signal::input const &value) { os << to_string(value); return os; } std::ostream &operator<<(std::ostream &os, yas::proc::number_to_signal::output const &value) { os << to_string(value); return os; }
4ac014f465fcf3457b8e96d3955ac008eb5e00bd
cb3ac43d4dc552f5158be56aff3ef935417d4e47
/Non Zero Segments.cpp
6116852f0c7b16f69a28bbd948bd80a3866aca80
[]
no_license
ShreyasKadiri/CodeForces
3fe7ca8487202b666286f72d64f95f18b29a7ec6
74cf476855c2c2964c24ae4c8568d87f39154501
refs/heads/master
2023-02-02T16:22:35.973993
2020-12-20T17:32:53
2020-12-20T17:32:53
291,511,134
0
0
null
null
null
null
UTF-8
C++
false
false
546
cpp
Non Zero Segments.cpp
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main(){ //freopen("input.in","r",stdin); //freopen("output.in","w",stdout); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,i,j,t; cin>>n; vector<ll> v(n); ll su(0),cnt(0); set<ll> s; s.insert(0); for(auto &it:v){ cin>>it; su+=it; if(s.count(su)){ cnt++; s.clear(); s.insert(0); s.insert(it); su=it; } else s.insert(su); } cout<<cnt; return 0; }
b31ef20689ecaf5b6cb1535bfd556284b7a2f963
17053a27fc1fb3373bc5582815ff2482f17af011
/EOYRacingGame/Intermediate/Build/Win64/UE4Editor/Inc/EOYRacingGame/EOYRacingGamePawn.gen.cpp
9a279647f4f3c6d30e2d34f0eea253d38b7560fd
[]
no_license
wcthscgda/EOYRacingGame
09eba38b6796106ed800baa90974bf0458219fc1
c442ac95520089479f83c53f2667dae95658b895
refs/heads/master
2020-05-14T09:37:20.589390
2019-05-03T13:33:41
2019-05-03T13:33:41
181,743,151
0
0
null
null
null
null
UTF-8
C++
false
false
20,274
cpp
EOYRacingGamePawn.gen.cpp
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "EOYRacingGame/EOYRacingGamePawn.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodeEOYRacingGamePawn() {} // Cross Module References EOYRACINGGAME_API UClass* Z_Construct_UClass_AEOYRacingGamePawn_NoRegister(); EOYRACINGGAME_API UClass* Z_Construct_UClass_AEOYRacingGamePawn(); PHYSXVEHICLES_API UClass* Z_Construct_UClass_AWheeledVehicle(); UPackage* Z_Construct_UPackage__Script_EOYRacingGame(); COREUOBJECT_API UScriptStruct* Z_Construct_UScriptStruct_FColor(); ENGINE_API UClass* Z_Construct_UClass_UAudioComponent_NoRegister(); ENGINE_API UClass* Z_Construct_UClass_UTextRenderComponent_NoRegister(); ENGINE_API UClass* Z_Construct_UClass_UCameraComponent_NoRegister(); ENGINE_API UClass* Z_Construct_UClass_USceneComponent_NoRegister(); ENGINE_API UClass* Z_Construct_UClass_USpringArmComponent_NoRegister(); // End Cross Module References void AEOYRacingGamePawn::StaticRegisterNativesAEOYRacingGamePawn() { } UClass* Z_Construct_UClass_AEOYRacingGamePawn_NoRegister() { return AEOYRacingGamePawn::StaticClass(); } struct Z_Construct_UClass_AEOYRacingGamePawn_Statics { static UObject* (*const DependentSingletons[])(); #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[]; #endif #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_bInReverseGear_MetaData[]; #endif static void NewProp_bInReverseGear_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bInReverseGear; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_bInCarCameraActive_MetaData[]; #endif static void NewProp_bInCarCameraActive_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bInCarCameraActive; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GearDisplayReverseColor_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GearDisplayReverseColor; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GearDisplayColor_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GearDisplayColor; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GearDisplayString_MetaData[]; #endif static const UE4CodeGen_Private::FTextPropertyParams NewProp_GearDisplayString; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_SpeedDisplayString_MetaData[]; #endif static const UE4CodeGen_Private::FTextPropertyParams NewProp_SpeedDisplayString; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_EngineSoundComponent_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_EngineSoundComponent; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_InCarGear_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_InCarGear; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_InCarSpeed_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_InCarSpeed; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_InternalCamera_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_InternalCamera; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_InternalCameraBase_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_InternalCameraBase; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_Camera_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_Camera; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_SpringArm_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_SpringArm; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; static const FCppClassTypeInfoStatic StaticCppClassTypeInfo; static const UE4CodeGen_Private::FClassParams ClassParams; }; UObject* (*const Z_Construct_UClass_AEOYRacingGamePawn_Statics::DependentSingletons[])() = { (UObject* (*)())Z_Construct_UClass_AWheeledVehicle, (UObject* (*)())Z_Construct_UPackage__Script_EOYRacingGame, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::Class_MetaDataParams[] = { { "HideCategories", "Navigation" }, { "IncludePath", "EOYRacingGamePawn.h" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, }; #endif #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear_MetaData[] = { { "Category", "Camera" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Are we in reverse gear" }, }; #endif void Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear_SetBit(void* Obj) { ((AEOYRacingGamePawn*)Obj)->bInReverseGear = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear = { UE4CodeGen_Private::EPropertyClass::Bool, "bInReverseGear", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x0010000000030015, 1, nullptr, sizeof(bool), UE4CodeGen_Private::ENativeBool::Native, sizeof(AEOYRacingGamePawn), &Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear_SetBit, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive_MetaData[] = { { "Category", "Camera" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Are we using incar camera" }, }; #endif void Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive_SetBit(void* Obj) { ((AEOYRacingGamePawn*)Obj)->bInCarCameraActive = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive = { UE4CodeGen_Private::EPropertyClass::Bool, "bInCarCameraActive", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x0010000000030015, 1, nullptr, sizeof(bool), UE4CodeGen_Private::ENativeBool::Native, sizeof(AEOYRacingGamePawn), &Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive_SetBit, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayReverseColor_MetaData[] = { { "Category", "Display" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "The color of the incar gear text when in reverse" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayReverseColor = { UE4CodeGen_Private::EPropertyClass::Struct, "GearDisplayReverseColor", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x0010000000030015, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, GearDisplayReverseColor), Z_Construct_UScriptStruct_FColor, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayReverseColor_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayReverseColor_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayColor_MetaData[] = { { "Category", "Display" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "The color of the incar gear text in forward gears" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayColor = { UE4CodeGen_Private::EPropertyClass::Struct, "GearDisplayColor", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x0010000000030015, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, GearDisplayColor), Z_Construct_UScriptStruct_FColor, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayColor_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayColor_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayString_MetaData[] = { { "Category", "Display" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "The current gear as a string (R,N, 1,2 etc)" }, }; #endif const UE4CodeGen_Private::FTextPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayString = { UE4CodeGen_Private::EPropertyClass::Text, "GearDisplayString", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x0010000000030015, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, GearDisplayString), METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayString_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayString_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpeedDisplayString_MetaData[] = { { "Category", "Display" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "The current speed as a string eg 10 km/h" }, }; #endif const UE4CodeGen_Private::FTextPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpeedDisplayString = { UE4CodeGen_Private::EPropertyClass::Text, "SpeedDisplayString", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x0010000000030015, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, SpeedDisplayString), METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpeedDisplayString_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpeedDisplayString_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_EngineSoundComponent_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Display" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Audio component for the engine sound" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_EngineSoundComponent = { UE4CodeGen_Private::EPropertyClass::Object, "EngineSoundComponent", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, EngineSoundComponent), Z_Construct_UClass_UAudioComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_EngineSoundComponent_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_EngineSoundComponent_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarGear_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Display" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Text component for the In-Car gear" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarGear = { UE4CodeGen_Private::EPropertyClass::Object, "InCarGear", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, InCarGear), Z_Construct_UClass_UTextRenderComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarGear_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarGear_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarSpeed_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Display" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Text component for the In-Car speed" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarSpeed = { UE4CodeGen_Private::EPropertyClass::Object, "InCarSpeed", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, InCarSpeed), Z_Construct_UClass_UTextRenderComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarSpeed_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarSpeed_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCamera_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Camera" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Camera component for the In-Car view" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCamera = { UE4CodeGen_Private::EPropertyClass::Object, "InternalCamera", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, InternalCamera), Z_Construct_UClass_UCameraComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCamera_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCamera_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCameraBase_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Camera" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "SCene component for the In-Car view origin" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCameraBase = { UE4CodeGen_Private::EPropertyClass::Object, "InternalCameraBase", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, InternalCameraBase), Z_Construct_UClass_USceneComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCameraBase_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCameraBase_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_Camera_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Camera" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Camera component that will be our viewpoint" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_Camera = { UE4CodeGen_Private::EPropertyClass::Object, "Camera", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, Camera), Z_Construct_UClass_UCameraComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_Camera_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_Camera_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpringArm_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Camera" }, { "EditInline", "true" }, { "ModuleRelativePath", "EOYRacingGamePawn.h" }, { "ToolTip", "Spring arm that will offset the camera" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpringArm = { UE4CodeGen_Private::EPropertyClass::Object, "SpringArm", RF_Public|RF_Transient|RF_MarkAsNative, (EPropertyFlags)0x00400000000b001d, 1, nullptr, STRUCT_OFFSET(AEOYRacingGamePawn, SpringArm), Z_Construct_UClass_USpringArmComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpringArm_MetaData, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpringArm_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_AEOYRacingGamePawn_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInReverseGear, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_bInCarCameraActive, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayReverseColor, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayColor, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_GearDisplayString, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpeedDisplayString, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_EngineSoundComponent, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarGear, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InCarSpeed, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCamera, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_InternalCameraBase, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_Camera, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AEOYRacingGamePawn_Statics::NewProp_SpringArm, }; const FCppClassTypeInfoStatic Z_Construct_UClass_AEOYRacingGamePawn_Statics::StaticCppClassTypeInfo = { TCppClassTypeTraits<AEOYRacingGamePawn>::IsAbstract, }; const UE4CodeGen_Private::FClassParams Z_Construct_UClass_AEOYRacingGamePawn_Statics::ClassParams = { &AEOYRacingGamePawn::StaticClass, DependentSingletons, ARRAY_COUNT(DependentSingletons), 0x008000A0u, nullptr, 0, Z_Construct_UClass_AEOYRacingGamePawn_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::PropPointers), "Game", &StaticCppClassTypeInfo, nullptr, 0, METADATA_PARAMS(Z_Construct_UClass_AEOYRacingGamePawn_Statics::Class_MetaDataParams, ARRAY_COUNT(Z_Construct_UClass_AEOYRacingGamePawn_Statics::Class_MetaDataParams)) }; UClass* Z_Construct_UClass_AEOYRacingGamePawn() { static UClass* OuterClass = nullptr; if (!OuterClass) { UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_AEOYRacingGamePawn_Statics::ClassParams); } return OuterClass; } IMPLEMENT_CLASS(AEOYRacingGamePawn, 2903828702); static FCompiledInDefer Z_CompiledInDefer_UClass_AEOYRacingGamePawn(Z_Construct_UClass_AEOYRacingGamePawn, &AEOYRacingGamePawn::StaticClass, TEXT("/Script/EOYRacingGame"), TEXT("AEOYRacingGamePawn"), false, nullptr, nullptr, nullptr); DEFINE_VTABLE_PTR_HELPER_CTOR(AEOYRacingGamePawn); PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
860b923b4b0d61ae4a362fedc4c49c0590915c6f
8073614012d6f036bc68f72145fecd5d11cd125d
/my_gl_widget.h
077988cc97f9b5fd31116f7474d5583ac76c0681
[]
no_license
GentleHedgehog/learnopengl_qt
81ad8bea1a5d0f21eebfa015fab45be7328403dc
a3beb3de92fe975e17c643975cb8905f1fb7a986
refs/heads/master
2021-09-01T18:49:10.596204
2017-12-28T08:24:11
2017-12-28T08:24:11
115,601,000
0
0
null
null
null
null
UTF-8
C++
false
false
301
h
my_gl_widget.h
#ifndef MY_GL_WIDGET_H #define MY_GL_WIDGET_H #include <QGLWidget> class MyGlWidget : public QGLWidget { public: MyGlWidget(QWidget *parent = nullptr); protected: virtual void initializeGL(); virtual void resizeGL(int w, int h); virtual void paintGL(); }; #endif // MY_GL_WIDGET_H
38e0131ca9f305d4fb8b3c9eed4c73c126a06e36
790c74e6fb10857cd396e07f1eb39c4733596e91
/include/eagine/units/dim/acceleration.hpp
767391440cc98f9de08a949aef7c6b343c1b46cc
[ "BSL-1.0" ]
permissive
Blinky0815/oglplu2
838a4d9484359b8c381ab49827caad4bef7e0a39
8cc3f1d3305179e4ade8b3973f4862df7543ad2a
refs/heads/master
2020-03-22T21:59:10.271736
2017-11-17T14:01:25
2017-11-17T14:01:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
636
hpp
acceleration.hpp
/** * @file eagine/unit/dim/acceleration.hpp * * Copyright Matus Chochlik. * Distributed under the Boost Software License, Version 1.0. * See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt */ #ifndef EAGINE_UNITS_DIM_ACCELERATION_1512222148_HPP #define EAGINE_UNITS_DIM_ACCELERATION_1512222148_HPP #include "velocity.hpp" namespace eagine { namespace units { typedef decltype(velocity()/time()) acceleration; template <> struct dim_name<acceleration> { static constexpr const char mp_str[] = "acceleration"; }; } // namespace units } // namespace eagine #endif //include guard
ed74265a5a94eec94073e449ad0df3461a79ea9d
078d16366463370cc74caea92f9b35e43d9870be
/Module 3/part2-cute_comics/cutecomics/entities/panel.cpp
8412615d79953ab371fe29b76afa93325c20c7cd
[ "MIT" ]
permissive
PacktPublishing/End-to-End-GUI-development-with-Qt5
6cac1289c6b03dbc94435d9c4ee971d7b71049b4
8ac713da23aac4b305b12ee1ef6ec60362bcd391
refs/heads/master
2023-02-03T09:16:34.581304
2023-01-30T09:56:23
2023-01-30T09:56:23
138,880,448
26
10
null
null
null
null
UTF-8
C++
false
false
270
cpp
panel.cpp
#include "panel.h" namespace entities { Panel::Panel(QObject *parent) : QObject(parent) { } QSize Panel::get_size() const { return m_size; } void Panel::set_size(QSize size) { if (size != m_size) { m_size = size; emit sizeChanged(); } } }
0a31b27ee7d2426b00ef60f6a38287ad5b2b4508
591e32997255776efeb7692b6623c2bdc2167531
/Lista 1/Code/openGL_tutorial.cpp
c462568d56565400958708a7a96fbba6ac749428
[]
no_license
tfc2/if680
2ad90aaf333132401f79a429f9a8006083b019d9
275b98b7fa3d39859bc877779ea88f0412033bb7
refs/heads/master
2020-04-19T04:25:41.067800
2015-07-10T06:07:02
2015-07-10T06:07:02
35,982,256
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
3,295
cpp
openGL_tutorial.cpp
#include "openGL_tutorial.h" #include <iostream> #include <vector> const int WINDOW_W = 500; const int WINDOW_H = 500; using namespace std; class Ponto { public: float x, y; Ponto(float x, float y) : x(x), y(y) {}; }; vector <Ponto> pontos; double fatorial(int n) { double resposta; if (n <= 1) { resposta = 1; } else { resposta = n; while (n > 1) { resposta *= (n - 1); n--; } } return resposta; } double coeficiente_binomial(int n, int k) { double resposta; resposta = fatorial (n) / (fatorial (k) * fatorial (n - k)); return resposta; } Ponto desenhaBezier(double t) { Ponto p(0.0f, 0.0f); int quantidade = pontos.size(); for (int i = 0; i < quantidade; i++) { double aux = coeficiente_binomial((quantidade - 1), i) * pow((1 - t), (quantidade - 1 - i)) * pow(t, i); p.x = p.x + (aux * pontos.at(i).x); p.y = p.y + (aux * pontos.at(i).y); } return p; } void display() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); if (pontos.size() > 0) { glPointSize(5.0f); glBegin(GL_POINTS); glColor3f(1.0f, 1.0f, 0.0f); for (int i = 0; i < pontos.size(); i++) glVertex2d(pontos.at(i).x, pontos.at(i).y); glEnd(); glBegin(GL_LINE_STRIP); glColor3f(1.0f, 1.0f, 1.0f); double t; for (t = 0.0; t <= 1.0; t += 0.01) { glVertex2d(desenhaBezier(t).x, desenhaBezier(t).y); } glVertex2d(desenhaBezier(t).x, desenhaBezier(t).y); glEnd(); } glFlush(); } void reshape(int w, int h) { glViewport(0, 0, (GLsizei)w, (GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0f, WINDOW_W, WINDOW_H, 0.0f, -5.0, 5.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void handleKeypress(unsigned char key, int x, int y) { static int x1 = 0; switch (key){ case 27: // ESC exit(0); break; case 119: glLineWidth(5.0f); pontos.push_back(Ponto(x, y)); glutPostRedisplay(); x1++; break; } } int indicePonto(int x, int y) { int resposta = -1; // caso nao haja um ponto no vetor for (int i = 0; i < pontos.size(); i++){ if ((pontos.at(i).x <= (x + 5)) && (pontos.at(i).x >= (x - 5)) && (pontos.at(i).y <= (y + 5)) && (pontos.at(i).y >= (y - 5))){ return i; } } return resposta; } int i; void handleMouseClick(int button, int state, int x, int y) { i = indicePonto(x, y); if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){ if (i == -1){ pontos.push_back(Ponto(x, y)); i = pontos.size() - 1; } } glutPostRedisplay(); // avisa que a janela atual deve ser reimpressa } void drag(int x, int y){ if (i > -1){ pontos.at(i) = Ponto(x, y); } glutPostRedisplay(); } int main(int argc, char ** argv) { glutInit(&argc, argv); glutInitWindowPosition(0, 0); // a janela irá iniciar to topo esquerdo glutInitWindowSize(WINDOW_W, WINDOW_H); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); glutCreateWindow("Exemplo OpenGL"); glMatrixMode(GL_MODELVIEW); // altera a matrix do modelo da cena glLoadIdentity(); glutDisplayFunc(display); glutKeyboardFunc(handleKeypress); glutMouseFunc(handleMouseClick); glutMotionFunc(drag); glutReshapeFunc(reshape); glutMainLoop(); return 0; }
7dc4fdcb12651f7a07c593a2fea7f62f0285d97a
f9c0a7f9eb3e35cd022937518420d1e2716f3603
/Graph/GraphSource.cpp
6aa1b15d993395d0b4af00585617524b36392313
[]
no_license
BaranovMykola/Parallel-Computing
275d107c393eb20b6927c4c97db223eac651f653
a27a6c932fa465672836cbaa4269fb9c33f2aed2
refs/heads/master
2021-01-23T10:20:58.685543
2017-10-28T13:55:41
2017-10-28T13:55:41
102,609,969
0
0
null
null
null
null
UTF-8
C++
false
false
4,780
cpp
GraphSource.cpp
// A C / C++ program for Dijkstra's single source shortest path algorithm. // The program is for adjacency matrix representation of the graph #include <stdio.h> #include <chrono> #include <limits.h> #include <iostream> #include <vector> #include <thread> #include <ctime> // Number of vertices in the graph #define V 10 using namespace std::chrono; // A utility function to find the vertex with minimum distance value, from // the set of vertices not yet included in shortest path tree int minDistance(int dist[], bool sptSet[]) { // Initialize min value int min = INT_MAX, min_index; for (int v = 0; v < V; v++) if (sptSet[v] == false && dist[v] <= min) min = dist[v], min_index = v; return min_index; } // A utility function to print the constructed distance array void printSolution(int dist[], int n) { printf("Vertex Distance from Sourcen"); for (int i = 0; i < V; i++) printf("%d tt %dn ", i, dist[i]); } // Funtion that implements Dijkstra's single source shortest path algorithm // for a graph represented using adjacency matrix representation void help(bool **sptSet, int** graph, int** dist, int u, int from ,int to) { // Update dist value of the adjacent vertices of the picked vertex. for (int v = from; v < to; v++) { // Update dist[v] only if is not in sptSet, there is an edge from // u to v, and total weight of path from src to v through u is // smaller than current value of dist[v] if (!(*sptSet)[v] && graph[u][v] && (*dist)[u] != INT_MAX && (*dist)[u] + graph[u][v] < (*dist)[v]) (*dist)[v] = (*dist)[u] + graph[u][v]; std::this_thread::sleep_for(10ms); } } void dijkstra(int** graph, int src) { int* dist = new int[V]; // The output array. dist[i] will hold the shortest // distance from src to i bool *sptSet = new bool[V]; // sptSet[i] will true if vertex i is included in shortest // path tree or shortest distance from src to i is finalized // Initialize all distances as INFINITE and stpSet[] as false for (int i = 0; i < V; i++) dist[i] = INT_MAX, sptSet[i] = false; // Distance of source vertex from itself is always 0 dist[src] = 0; // Find shortest path for all vertices for (int count = 0; count < V - 1; count++) { // Pick the minimum distance vertex from the set of vertices not // yet processed. u is always equal to src in first iteration. int u = minDistance(dist, sptSet); // Mark the picked vertex as processed sptSet[u] = true; // Update dist value of the adjacent vertices of the picked vertex. /*for (int v = 0; v < V; v++) std::thread(); // Update dist[v] only if is not in sptSet, there is an edge from // u to v, and total weight of path from src to v through u is // smaller than current value of dist[v] if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX && dist[u] + graph[u][v] < dist[v]) dist[v] = dist[u] + graph[u][v];*/ help(&sptSet, graph, &dist, u, 0, V); } // print the constructed distance array //printSolution(dist, V); } void dijkstraParallel(int** graph, int src, int p) { int* dist = new int[V]; // The output array. dist[i] will hold the shortest // distance from src to i bool *sptSet = new bool[V]; // sptSet[i] will true if vertex i is included in shortest // path tree or shortest distance from src to i is finalized // Initialize all distances as INFINITE and stpSet[] as false for (int i = 0; i < V; i++) dist[i] = INT_MAX, sptSet[i] = false; // Distance of source vertex from itself is always 0 dist[src] = 0; // Find shortest path for all vertices for (int count = 0; count < V - 1; count++) { // Pick the minimum distance vertex from the set of vertices not // yet processed. u is always equal to src in first iteration. int u = minDistance(dist, sptSet); // Mark the picked vertex as processed sptSet[u] = true; // Update dist value of the adjacent vertices of the picked vertex. double h = (V-1) / (double)p; std::vector<std::thread> thrs; for (int i = 0; i < p; i++) { thrs.push_back(std::thread(help, &sptSet, graph, &dist, u, i*h, (i+1)*h)); //help(&sptSet, graph, &dist, u, i*h, (i + 1)*h); } for (auto& i : thrs) { i.join(); } } // print the constructed distance array //printSolution(dist, V); } // driver program to test above function int main() { /* Let us create the example graph discussed above */ int** graph = new int*[V]; for (int i = 0; i < V; i++) { graph[i] = new int[V]; for (int j = 0; j < V; j++) { graph[i][j] = rand() % 10; } } auto t0 = clock(); dijkstra(graph, 0); auto t1 = clock(); dijkstraParallel(graph, 0,4); auto t2 = clock(); std::cout << std::endl << "t0 = " << t1 - t0 << "\tt1 = " << t2 - t1 << std::endl; std::getchar(); return 0; }
c64231cd2e1d51676927ef11e5b994be8be97763
995951566b842a9871e20025635233b883d034b2
/Tertian/Tertian/Source/Keyboard.cpp
661d13c44bbb6633c3a08f87632c278850ec7a1e
[]
no_license
Hypervariate/tertian
36e0e82b84c889525117ad20c19dbe7c71b4a4a8
af3af4cf620a1deff34de4c0a62d7142be63a567
refs/heads/master
2020-03-29T09:47:34.007373
2012-02-13T02:04:29
2012-02-13T02:04:29
3,612,452
2
0
null
null
null
null
UTF-8
C++
false
false
739
cpp
Keyboard.cpp
#include "Keyboard.h" map<SDL_Keycode, bool> Keyboard::keys; Keyboard::Keyboard(){} Keyboard::~Keyboard(){} void Keyboard::AnalyzeEvents(SDL_Event* event) { switch( event->type ) { case SDL_KEYDOWN: keys[event->key.keysym.sym] = true; cout << "Key: " << SDL_GetKeyName( event->key.keysym.sym ) << endl; break; case SDL_KEYUP: keys[event->key.keysym.sym] = false; break; default: break; } } bool Keyboard::GetKey(const char* key_name) { if(keys[SDL_GetKeyFromName(key_name)] == NULL) keys[SDL_GetKeyFromName(key_name)] = false; return keys[SDL_GetKeyFromName(key_name)]; }
42763d4151f4023347503e4a0609234e029ebdd3
dd4f474ecc48f309941879b761dba5f4c5d5b912
/OtherCodes/UltrasonicMatrix/UltraMat.h
efb043ee07f13e9de472947134970f608c17ff66
[ "Unlicense" ]
permissive
manykits/ManyKitArduino
e0d776676d4aa92bc1ce3bd5c6925f574ec50066
f4dc989a1c04fe9111abc9974c487aa138f27286
refs/heads/master
2020-04-29T02:37:52.409040
2019-08-25T02:14:33
2019-08-25T02:14:33
175,777,789
2
0
null
null
null
null
UTF-8
C++
false
false
907
h
UltraMat.h
// UltraMat #ifndef ULTRAMAT #define ULTRAMAT #include "UltraObj.h" #include "Arduino.h" const int NumMaxUltra = 6; const int OT_DSTMAT_I = 30; const int OT_RETURN_DSTMAT = 31; enum PXFPin { P_0 = 0, P_1, P_2, P_3, P_4, P_5, P_6, P_7, P_8, P_9, P_10, P_11, P_12, P_13, P_A0, P_A1, P_A2, P_A3, P_A4, P_A5, P_A6, P_MAX_TYPE }; #define PXFA0 30 class UltraMat { public: UltraMat(); void Init(int index, int pinTrigger, int pinEcho); void Test(int index); float GetDistance(int index); void SetRange(int index, float near, float far); void Shutdown(int index); void Tick(); void OnCMD(String &cmdStr); UltraObj Objs[NumMaxUltra]; private: int _Str2Pin(String &str); char *mpCMD; #define NumCMDParams 7 String mCmdParams[NumCMDParams]; int mCMDIndexTemp; char *mpCMDParam; }; #endif
ea7b7f332df9dc900397809cce88822386e792dc
c6194c146264a314cddcf3ddfeaf9a9f4d06dfd5
/frc/wpi/include/wpi/StackTrace.h
44e0b21d7bbae1c8450367b51d24739266e22984
[ "MIT" ]
permissive
qhdwight/frc-go
f911222c6d147ddeefa8a177d18dba0ea03c5b99
b3a59ac64b76d55c6ede586f8ca3a35bdfc3a4d3
refs/heads/main
2022-02-23T08:34:52.677930
2022-02-03T03:59:41
2022-02-03T03:59:41
217,160,684
8
1
MIT
2022-02-03T03:59:42
2019-10-23T21:56:23
C++
UTF-8
C++
false
false
907
h
StackTrace.h
// Copyright (c) FIRST and other WPILib contributors. // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. #ifndef WPIUTIL_WPI_STACKTRACE_H_ #define WPIUTIL_WPI_STACKTRACE_H_ #include <string> namespace wpi { /** * Get a stack trace, ignoring the first "offset" symbols. * * @param offset The number of symbols at the top of the stack to ignore */ std::string GetStackTrace(int offset); /** * The default implementation used for GetStackTrace(). * * @param offset The number of symbols at the top of the stack to ignore */ std::string GetStackTraceDefault(int offset); /** * Set the implementation used by GetStackTrace(). * * @param func Function called by GetStackTrace(). */ void SetGetStackTraceImpl(std::string (*func)(int offset)); } // namespace wpi #endif // WPIUTIL_WPI_STACKTRACE_H_
9f1217c1f379dc2e11aa363128d3e0c33308973b
6f9c0dc059a5d8c3ba5163e6058e86b3df6e0c87
/src/Base/3dModelBase.h
aa729f32f5103e07b03da6669d90b0ee27297f9b
[]
no_license
hy-2013/3d_model_base
d75def135c3c9ef96b590b4a80c221f8c3759f3e
99f963b817876b227d3ac98ccf7e1b3017d2b8e6
refs/heads/master
2020-04-06T06:59:23.132718
2015-08-19T01:58:58
2015-08-19T01:58:58
39,321,808
3
2
null
2015-08-18T06:35:44
2015-07-19T04:00:55
C++
UTF-8
C++
false
false
13,380
h
3dModelBase.h
/************************************************************************* > File Name: ModelBase.h > Author: clzhang > Mail: zcwtuibian@gmail.com > Created Time: 2014年11月25日 星期二 05时28分42秒 ************************************************************************/ #include<iostream> #include<vector> #include<cstring> #include<algorithm> #include<Eigen/Dense> using namespace std; /*#include <fstream>*/ /*#include <string.h>*/ /*#include <stdio.h>*/ class Face; class Mesh; class ModelBase; // TYPE DEFINITION class Vertex { friend class Face; friend class Mesh; friend class SD; friend class ModelBase; private: float x,y,z; /*double x,y,z;*/ //if statement x,y,z to double type, and use the %f way to read .off, it will be a unknown error. }; class Face //定义一个三角面片 { friend class Mesh; friend class SD; friend class ModelBase; private: Face(void): nverts(0),verts(0) {};//初始化 int nverts;//一个面内有几个顶点; Vertex **verts;//一个顶点指针数组 }; class Mesh //一个对模型应一个mesh { friend class SD; friend class ModelBase; private: /*public:*/ Mesh(void) : nverts(0), verts(0), nfaces(0), faces(0) {};//构造函数初始化 int nverts; //顶点个数 Vertex *verts; //顶点坐标 int nfaces; //面片个数 Face *faces; //面片顶点序号 }; /*class Area//中间结构体,用来存储每个面片的面积*/ /*{ */ /*friend class ModelBase;*/ /*private:*/ /*Vertex *verts;*/ /*float area; */ /*Vertex gravity; //三角面片重心*/ /*};*/ class ModelBase { public: //ModelBase(string filename, int idx): _filename(filename), _idx(idx){} ModelBase(const char *filename): _filename(filename){} ~ModelBase(){} void ReadOffFile(); int getVertexNum(); int getFaceNum(); void off2pcd(); // convert vertex of .off to .pcd file directly. template<typename elemtype> double distVector(const vector<elemtype> v1, const vector<elemtype> v2, const char distType[]); //calculate the distance of the pair vector. /*Mesh *ReadOffFile();*/ protected: //string _filename; const char * _filename; Mesh * _mesh; // store the model's vertexes and face. }; //////////////////////////////////////////////////////////// // OFF FILE READING CODE //////////////////////////////////////////////////////////// void ModelBase::ReadOffFile() { int i; // Open file FILE *fp; if (!(fp = fopen(_filename, "r"))) {//"r"是以只读方式打开,此参数为const char* fprintf(stderr, "Unable to open file %s\n", _filename);//stderr是标准错误流,一般把屏幕设为默认, 也可以输出到文件 //return 0; exit(-1); } // Allocate _mesh structure _mesh = new Mesh(); if (!_mesh) { fprintf(stderr, "Unable to allocate memory for file %s\n", _filename); fclose(fp); //return 0; exit(-1); } // Read file int nverts = 0;//顶点数 int nfaces = 0;//面片数 int nedges = 0;//边数 int line_count = 0;//.off文件里有多少行 char buffer[1024]; while (fgets(buffer, 1023, fp)) { // Increment line counter line_count++; // Skip white space char *bufferp = buffer;//buffer[1024]的头指针 while (isspace(*bufferp)) bufferp++;//#include<ctype.h>里,若参数c为空格字符,则返回TRUE,否则返回NULL(0)。 // Skip blank lines and comments if (*bufferp == '#') continue; if (*bufferp == '\0') continue; // Check section if (nverts == 0) { //当顶点数为0时,也就是第一次读取时 // Read header if (!strstr(bufferp, "OFF")) {//off文件头有OFF字样,strstr返回指向第一次出现OFF位置的指针,如果没找到则返回NULL。 // Read _mesh counts if ((sscanf(bufferp, "%d%d%d", &nverts, &nfaces, &nedges) != 3) || (nverts == 0)) { //OFF下面有3个数,分别是点的个数,面片的个数,边的个数。 fprintf(stderr, "Syntax error reading header on line %d in file %s\n", line_count, _filename); fclose(fp); //return 0; exit(-1); } // Allocate memory for _mesh _mesh->verts = new Vertex [nverts];//申请刚读入的nverts个点的数组 assert(_mesh->verts);//在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行 _mesh->faces = new Face [nfaces];//申请读入的nface个FACE数组 assert(_mesh->faces); } } else if (_mesh->nverts < nverts) //当nvert不为0,也就是读取完OFF下面的三个点之后,当mesh里的nvert比读取进来的nvert小 { // Read vertex coordinates Vertex& vert = _mesh->verts[_mesh->nverts];//mesh->verts是一个数组,mesh->nverts从0开始,只要小于读入的nvert _mesh->nverts++; //mesh中的verts指针,指向这个vertex结构体 if (sscanf(bufferp, "%f%f%f", &(vert.x), &(vert.y), &(vert.z)) != 3)//读入vert(vertex的结构体中的第_mesh->nvert个位置) { fprintf(stderr, "Syntax error with vertex coordinates on line %d in file %s\n", line_count, _filename); fclose(fp); //return 0; exit(-1); } } else if (_mesh->nfaces < nfaces) { // Get next face Face& face = _mesh->faces[_mesh->nfaces];//新申请一个face,然后让mesh中的指针指向他,之后对face操作 _mesh->nfaces++; // Read number of vertices in face bufferp = strtok(bufferp, " \t");//strtok在bufferp中查找包含在'\t'的字符,返回之前的部分(此buffer[1024]被修改) if (bufferp) { face.nverts = atoi(bufferp); }//把字符串转换成整型数,读取的是off文件中面片的N的数字。 else { fprintf(stderr, "Syntax error with face on line %d in file %s\n", line_count, _filename); fclose(fp); //return 0; exit(-1); } // Allocate memory for face vertices face.verts = new Vertex *[face.nverts];//为一个面中的n个顶点申请一个vertx*的数组,每一个vertex* 抓着一个vertx的结构体 assert(face.verts); // Read vertex indices for face for (i = 0; i < face.nverts; i++) { bufferp = strtok(NULL, " \t");//接着读取N个面片个数之后的 顶点信息。 if (bufferp) face.verts[i] = &(_mesh->verts[atoi(bufferp)]);//buff读入的值,是mesh->verts数组的下标,代表第几个点,把点的坐标,放入verts[i]; else { fprintf(stderr, "Syntax error with face on line %d in file %s\n", line_count, _filename); fclose(fp); //return 0; exit(-1); } } } }//end of while // Check whether read all faces if (nfaces != _mesh->nfaces) { fprintf(stderr, "Expected %d faces, but read only %d faces in file %s\n", nfaces, _mesh->nfaces, _filename); } // Close file fclose(fp); //cout << _mesh->verts[0].x <<endl; //return 0; /*return _mesh; */ }//end of readofffile int ModelBase::getVertexNum(){ int vertexNum = _mesh->nverts; return vertexNum; } int ModelBase::getFaceNum(){ int faceNum = _mesh->nfaces; return faceNum; } void ModelBase::off2pcd(){ //int verts; //double *vertices; //vertices=new double[3*rand2]; //vertices=sd.Row2Column(RAR1); //char filenamepcd[20]; //string * filenamepcd = (string*)_filename; //string_replace(filenamepcd, "off", "pcd"); //cout << __FILE__ <<endl; char * filenamepcd = new char[100]; for(int i=0;i<strlen(_filename);i++){ if(_filename[i] != '.') filenamepcd[i] = _filename[i]; else{ filenamepcd[i] = '\0'; strcat(filenamepcd, ".pcd"); break;} } //cout << filenamepcd <<endl; //ofstream saveFile("cup2.pcd"); //可以读取任意类型的文本文件,远不止txt等 //ofstream saveFile("Airplane4_gravity.pcd"); ofstream saveFile(filenamepcd); string str1="# .PCD v.7 - Point Cloud Data file format"; string str2="VERSION .7"; string str3="FIELDS x y z"; string str4="SIZE 4 4 4"; string str5="TYPE F F F"; string str6="COUNT 1 1 1"; string str7="WIDTH "; string str8="HEIGHT 1"; string str9="VIEWPOINT 0 0 0 1 0 0 0"; string str10="POINTS "; string str11="DATA ascii"; saveFile << str1 << endl; saveFile<<str2<<endl; saveFile<<str3<<endl; saveFile<<str4<<endl; saveFile<<str5<<endl; saveFile<<str6<<endl; saveFile<<str7<<_mesh->nverts<<endl; saveFile<<str8<<endl; saveFile<<str9<<endl; saveFile<<str10<<_mesh->nverts<<endl; saveFile<<str11<<endl; //saveFile<<vertices[0][0]<<" "<<vertices[0][1]<<" "vertices[0][2]<<endl; for(int i=0;i<_mesh->nverts;i++){ //for(int j=0;j<3;j++){ //saveFile<< *(vertices+j+i*3)<<" "; saveFile<< _mesh->verts[i].x <<" "; saveFile<< _mesh->verts[i].y <<" "; saveFile<< _mesh->verts[i].z <<" "; //cout << _mesh->verts[i].x <<" "; //} saveFile<<endl; } saveFile.close(); delete [] filenamepcd; } /** Implement four similarity distance calculation,as Euclidean, Manhaton, Chebyshev, Mahalanobis distance. **/ // 实现欧氏距离的计算 template<typename elemtype> double Oshi(const vector<elemtype> v1, const vector<elemtype> v2) { typename vector<elemtype>::const_iterator it1 = v1.begin(); //need ‘typename’ before ‘std::vector<elemtype>::const_iterator’ because ‘std::vector<elemtype>’ is a dependent scope /*vector<double>::iterator it1 = v1.begin();*/ typename vector<elemtype>::const_iterator it2 = v2.begin(); double ODistance=0; for(;it1 != v1.end();it1++, it2++) { ODistance=ODistance+(*it1 - *it2)*(*it1 - *it2); /*cout << ODistance << endl;*/ } /*ODistance=ODistance/v1.size();*/ ODistance=sqrt(ODistance); return ODistance; } // 实现曼哈顿距离的计算 template<typename elemtype> double Manhaton(const vector<elemtype> &v1, const vector<elemtype> &v2) { typename vector<elemtype>::const_iterator it1 = v1.begin(); //need ‘typename’ before ‘std::vector<elemtype>::const_iterator’ because ‘std::vector<elemtype>’ is a dependent scope typename vector<elemtype>::const_iterator it2 = v2.begin(); double ODistance=0; for(;it1 != v1.end();it1++, it2++) { ODistance=ODistance+ abs(*it1 - *it2); /*cout << ODistance << endl;*/ } return ODistance; } // 实现切比雪夫距离的计算 template<typename elemtype> double Chebyshev(const vector<elemtype> &v1, const vector<elemtype> &v2) { typename vector<elemtype>::const_iterator it1 = v1.begin(); //need ‘typename’ before ‘std::vector<elemtype>::const_iterator’ because ‘std::vector<elemtype>’ is a dependent scope typename vector<elemtype>::const_iterator it2 = v2.begin(); double ODistance = 0; for(;it1 != v1.end();it1++, it2++) { /*cout << *it1 << "," << *it2 <<endl;*/ /*cout << abs(*it1 - *it2) <<endl;*/ ODistance = max(ODistance, abs(*it1-*it2)); /*cout << ODistance << endl;*/ } return ODistance; } // calculate the covariance of the v1 and v2 void cov(const vector<double>& v1, const vector<double>& v2, vector<vector<double> > &ret) { assert(v1.size() == v2.size() && v1.size() > 1); const int vs = v1.size(); /*double ret[vs][vs];*/ double va[vs]; for(int i=0;i<vs;i++){ va[i] = (v1.at(i) + v2.at(i))/2; } for (vector<double>::size_type i = 0; i != v1.size(); ++i) { for (vector<double>::size_type j = 0; j != v1.size(); ++j) ret[i][j]=(v1[i]-va[i])*(v1[j]-va[j])+(v2[i]-va[i])*(v2[j]-va[j]); /*ret += (v1[i] - v1a) * (v2[i] - v2a);*/ } /*return ret;*/ } //实现马氏距离的计算 double Mashi(const vector<double>& v1, const vector<double>& v2) { const int elemnum = v1.size(); /*double **cov = cov(dv3, dv4);*/ vector<vector<double> > covdv; covdv.resize(elemnum+1,vector<double>(elemnum+1)); //apply memory to more, as elemnum+1 (not elemnum), to avoid out of memory cov(v1, v2, covdv); Eigen::MatrixXd mat(elemnum,elemnum); for(int i = 0;i<elemnum;i++){ for(int j = 0;j<elemnum;j++){ /*cout<< covdv[i][j] << " ";*/ mat(i,j) = covdv[i][j]; } /*cout << endl;*/ } Eigen::VectorXd ev1(elemnum); Eigen::VectorXd ev2(elemnum); for(int i = 0;i<elemnum;i++){ ev1(i) = v1[i]; ev2(i) = v2[i]; } /*cout<< m <<endl;*/ /*cout<< ev1 <<endl<<endl;*/ /*cout<< ev2 <<endl<<endl;*/ double ODistance = 0; if(!mat.determinant()) cout << "the covariance matrix's determinant is zero." << endl; else{ /*cout << (ev1 - ev2).transpose() <<endl<<endl;*/ /*cout << mat.inverse() <<endl<<endl;*/ ODistance = sqrt((ev1 - ev2).transpose() * mat.inverse() * (ev1 - ev2)); /*ODistance = (ev1 - ev2).transpose() * m.inverse() * (ev1 - ev2); */ } /*cout << ODistance <<endl;*/ return ODistance; } template<typename elemtype> double ModelBase::distVector(const vector<elemtype> v1, const vector<elemtype> v2, const char distType[]){ /*double distVector(const vector<double> v1, const vector<double> v2, char* distType){*/ double Dist = 0; if(!strcmp(distType,"Oshi")) Dist = Oshi(v1, v2); /*if(distType == "Oshi") OshiDist = Oshi(v1, v2);*/ else if(!strcmp(distType, "Manhaton")) Dist = Manhaton(v1, v2); else if(!strcmp(distType, "Chebyshev")) Dist = Chebyshev(v1, v2); /*else if(distType == (string)"Mashi") Dist = Mashi(v1, v2);*/ else if(!strcmp(distType,"Mashi")) Dist = Mashi(v1, v2); /*else if(strcmp(distType, "Cosine")) Dist = Cosine(v1, v2);*/ return Dist; }
67bbfec361d555fc3a10e2887e58031e40ba2ffa
6591044f45464f289420f9c98e296554836b8deb
/sim/csim/lsm/csim/src/membranepatchsimple.h
3e39df00cb5e68148b61f4ffec965e44f191e191
[]
no_license
vbaker145/neuron
8dab0fae1fdb5c96f5804404b159812302eb6b80
2d977854e99e389c2541e86c6d6d5cc779fcb02a
refs/heads/master
2022-01-18T03:54:59.864863
2018-12-15T14:02:18
2018-12-15T14:02:18
84,617,348
2
0
null
null
null
null
UTF-8
C++
false
false
4,463
h
membranepatchsimple.h
/*! \file membranepatchsimple.h ** \brief Class definition of MembranePatchSimple */ #ifndef _MEMBRANEPATCH_SIMPLE_H_ #define _MEMBRANEPATCH_SIMPLE_H_ #include "spikingneuron.h" #include "ionchannel.h" #include "synapsetarget.h" class IonChannel; //! A a path of membrane with an arbitrary number of channels and current supplying synapses /** ** \latexonly \subsubsection*{The Model} \endlatexonly ** \htmlonly <h3>Model</h3> \endhtmlonly ** ** The membrane voltage \f$V_m\f$ is governed by ** \f[ ** C_m \frac{V_m}{dt} = -\frac{V_m-E_m}{R_m} - \sum_{c=1}^{N_c} g_c(t) ( V_m - E_{rev}^c ) + \sum_{s=1}^{N_s} I_s(t) + I_{inject} ** \f] ** with the following meanings of symbols ** - \f$C_m\f$ membrane capacity (Farad) ** - \f$E_m\f$ reversal potential of the leak current (Volts) ** - \f$R_m\f$ membrane resistance (Ohm) ** - \f$N_c\f$ total number of channels (active + synaptic) ** - \f$g_c(t)\f$ current conductance of channel \f$c\f$ (Siemens) ** - \f$E_{rev}^c(t)\f$ reversal potential of channel \f$c\f$ (Volts) ** - \f$N_s\f$ total number of current supplying synapses ** - \f$I_s(t)\f$ current supplied by synapse \f$s\f$ (Ampere) ** - \f$I_{inject}\f$ injected current (Ampere) ** ** At time \f$t=0\f$ \f$V_m\f$ ist set to \f$V_{init}\f$. ** ** The value of \f$E_m\f$ is calculated to compensate for ionic ** currents such that \f$V_m\f$ actually has a resting value of ** \f$V_\mathit{resting}\f$. ** ** \latexonly \subsubsection*{Spiking and reseting the membrane voltage} \endlatexonly ** \htmlonly <h3>Spiking and reseting the membrane voltage</h3> \endhtmlonly ** ** If the membrane voltage \f$V_m\f$ exceeds the threshold ** \f$V_{tresh}\f$ the MembranePatchSimple sends a spike to all its outgoing ** synapses. ** ** The membrane voltage is reseted and clamped during the absolute ** refractory period of length \f$T_{refract}\f$ to \f$V_{reset}\f$ ** if the flag \c doReset=1. This is similar to a LIF neuron (see ** LifNeuron). ** ** If the flag \c doReset=0 the membrane voltage is not reseted and ** the above equation is also applied during the absolute refractory ** period but the event of threshold crossing is transmitted as a ** spike to outgoing synapses. This is usfull if one includes ** channels which produce a \em real action potential (see ** HH_K_Channel and HH_Na_Channel ) but one still just wants to ** communicate the spikes as events in time. ** ** \latexonly \subsubsection*{Implementation} \endlatexonly ** \htmlonly <h3>Implementation</h3> \endhtmlonly ** ** The exponential Euler method is used for numerical integration. ** ***/ class MembranePatchSimple { public: MembranePatchSimple(void); virtual ~MembranePatchSimple(); //! Reset the MembranePatchSimple. virtual void reset(void); //! Calculate the new membrane voltage and check wheter Vm exceeds the threshold V_thresh. virtual void IandGtot(double *i, double *g); //! The membrane capacity \f$C_m\f$ [range=(0,1); units=F;] float Cm; //! The membrane resistance \f$R_m\f$ [units=Ohm; range=(0,1e30)] float Rm; //! The reversal potential of the leakage channel [readonly; units=V; range=(-1,1)] double Em; //! The resting membrane voltage. [units=V; range=(-1,1);] /** The value of \f$E_m\f$ is calculated to compensate for ionic ** currents such that \f$V_m\f$ actually has a resting value of ** \f$V_\mathit{resting}\f$. This is done in reset(). ** */ float Vresting; //! Initial condition for\f$V_m\f$ at time \f$t=0\f$. [units=V; range=(-1,1);] float Vinit; //! Defines the difference between Vresting and the Vthresh for the calculation of the iongate tables and the ionbuffer Erev. [units=V; range=(0,1e5);] float VmScale; //! The membrane voltage [readonly; units=V;] double Vm; //! Variance of the noise to be added each integration time constant. [range=(0,1); units=W^2;] float Inoise; //! Constant current to be injected into the CB neuron. [units=A; range=(-1,1);] float Iinject; protected: friend class IonChannel; friend class ActiveChannel; //! Number of channels [readonly; units=;] int nChannels; //! Length of list of channels [hidden] int lChannels; //! W list of associated channels [hidden] IonChannel **channels; //! Call to add a new channel virtual void addChannel(IonChannel *newChannel); //! Call to destroy the channels virtual void destroyChannels(void); }; #endif
98b0dace69374c1ce9dd44a87d42636b087644c7
696ea2a7febaf75a03b296c1c35376cc9e36b269
/openscenario/openscenario_interpreter/include/openscenario_interpreter/syntax/parameter_action.hpp
4192adfcea6af4aad8d9c3646541fe95585bd341
[ "Apache-2.0" ]
permissive
kmiya/scenario_simulator_v2
2c260787af6b7493f556d00e7e3cb641099bde71
13635e661cc643c783853d1b4c060d1e3dff3458
refs/heads/master
2023-06-11T20:45:51.934634
2021-07-02T06:05:39
2021-07-02T06:05:39
382,219,805
0
0
Apache-2.0
2021-07-21T13:25:10
2021-07-02T03:29:15
C++
UTF-8
C++
false
false
2,354
hpp
parameter_action.hpp
// Copyright 2015-2020 Tier IV, Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef OPENSCENARIO_INTERPRETER__SYNTAX__PARAMETER_ACTION_HPP_ #define OPENSCENARIO_INTERPRETER__SYNTAX__PARAMETER_ACTION_HPP_ #include <openscenario_interpreter/reader/attribute.hpp> #include <openscenario_interpreter/reader/element.hpp> #include <openscenario_interpreter/syntax/parameter_modify_action.hpp> #include <openscenario_interpreter/syntax/parameter_set_action.hpp> #include <utility> namespace openscenario_interpreter { inline namespace syntax { /* ---- ParameterAction -------------------------------------------------------- * * <xsd:complexType name="ParameterAction"> * <xsd:choice> * <xsd:element name="SetAction" type="ParameterSetAction"/> * <xsd:element name="ModifyAction" type="ParameterModifyAction"/> * </xsd:choice> * <xsd:attribute name="parameterRef" type="String" use="required"/> * </xsd:complexType> * * -------------------------------------------------------------------------- */ #define ELEMENT(NAME) \ std::make_pair(#NAME, [&](auto && child) { \ return make<Parameter##NAME>( \ child, outer_scope, readAttribute<String>("parameterRef", parent, outer_scope)); \ }) struct ParameterAction : public Element { template <typename Node, typename Scope> explicit ParameterAction(const Node & parent, Scope & outer_scope) : Element(choice(parent, ELEMENT(SetAction), ELEMENT(ModifyAction))) { } static bool endsImmediately() { return true; } }; #undef ELEMENT } // namespace syntax } // namespace openscenario_interpreter #endif // OPENSCENARIO_INTERPRETER__SYNTAX__PARAMETER_ACTION_HPP_
e0fcd4e7dc1beb71eae290bfe51cfc946fbf4c07
0ef832d8eaedc16253cc220bc704a52597d248fe
/libs/els/if_parser/src/attributeStruct.cxx
8e738db7f13a3d3511b5f1eabfbb3acd7e7f1262
[ "BSD-2-Clause" ]
permissive
radtek/software-emancipation-discover
9c0474b1abe1a8a3f91be899a834868ee0edfc18
bec6f4ef404d72f361d91de954eae9a3bd669ce3
refs/heads/master
2020-05-24T19:03:26.967346
2015-11-21T22:23:54
2015-11-21T22:23:54
187,425,106
1
0
BSD-2-Clause
2019-05-19T02:26:08
2019-05-19T02:26:07
null
UTF-8
C++
false
false
4,515
cxx
attributeStruct.cxx
/************************************************************************* * Copyright (c) 2015, Synopsys, Inc. * * All rights reserved. * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions are * * met: * * * * 1. Redistributions of source code must retain the above copyright * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *************************************************************************/ //++C++ #ifndef ISO_CPP_HEADERS #include <stdlib.h> #include <iostream.h> #else /* ISO_CPP_HEADERS */ #include <cstdlib> #include <iostream> using namespace std; #endif /* ISO_CPP_HEADERS */ //--C++ //++OSPORT #ifdef USE_EXTERN_LIB #include <pdustring.h> //#include <pdumem.h> #include <raFile.h> #endif //--OSPORT //++ADS #include <parray.h> //--ADS //++ELS #include <attributeStruct.h> #include <iff_parser.h> //--ELS #define ATTRIBUTE_STRUCTS_TO_ALLOCATE 10000 static parray freeAttributes(ATTRIBUTE_STRUCTS_TO_ALLOCATE); #ifdef COUNT_STRUCTS static int max_count = 0; static int current_count = 0; #endif attributeStruct *CreateAttributeStruct(void) { return new attributeStruct; } #ifndef USING_PURIFY void *attribute::operator new(size_t) { void *retval = 0; if ( freeAttributes.size() == 0 ) { attributeStruct *more = ::new attributeStruct [ ATTRIBUTE_STRUCTS_TO_ALLOCATE ]; if ( more ) { for ( int i = 0; i < ATTRIBUTE_STRUCTS_TO_ALLOCATE; i++ ) { freeAttributes.insert((void *)&more[i]); } } } retval = (attributeStruct *) freeAttributes[freeAttributes.size()-1]; freeAttributes.remove(freeAttributes.size()-1); #ifdef COUNT_STRUCTS current_count++; if ( current_count > max_count ) max_count = current_count; #endif return retval; } #endif void DestroyAttributeStruct(attributeStruct *a) { delete a; } #ifndef USING_PURIFY void attribute::operator delete(void *a) { if ( a ) { freeAttributes.insert((void *)a); #ifdef COUNT_STRUCTS current_count--; #endif } } #endif int attribute::print(ostream &o) { if ( name ) o << name << ' '; if ( value ) { char *str = 0; if ( iff_quote(value, &str) >= 0 ) o << "(\"" << value << "\")"; free(str); } return 1; } #ifdef USE_EXTERN_LIB int attribute::print(raFile *f) { int retval = -1; if ( f ) { if ( name ) { f->write(name, pdstrlen(name)); f->write(" ", 1); } if ( value ) { char *str = 0; if ( iff_quote(value, &str) >= 0 ) { f->write("(\"", 2); f->write(value, pdstrlen(value)); f->write("\")",2); } free(str); } retval = 1; } return retval; } #endif #ifdef COUNT_STRUCTS void ReportAttributeStructs(void) { cout << "Maximum number of attribute structs in use at one time: " << max_count << "\n"; cout << "Current number of atrribute structs in use: " << current_count << "\n"; } #endif
0b1e08710bb24682cdb6b9dd2ec8692ae79a901c
8d129048ae705c3f78f1f3ac6aedbd475cb67316
/chroma-renderer/core/scene/scene.cpp
6aa18a44a1f203a2b5de1cc300efbb6e697783ba
[]
no_license
alexfrasson/ChromaRenderer
ce17dcc2a7c044b0b9b8cfffb4b793f62d751ec3
3214fe14b76faa782a9ff9ec9b434982e9f55eac
refs/heads/master
2023-04-30T13:40:32.741358
2023-04-16T17:31:38
2023-04-16T17:31:38
24,805,912
5
0
null
2023-04-16T17:31:39
2014-10-05T01:27:14
C++
UTF-8
C++
false
false
1,182
cpp
scene.cpp
#include "chroma-renderer/core/scene/scene.h" size_t Scene::triangleCount() { size_t tc = 0; for (size_t i = 0; i < meshes.size(); i++) { tc += meshes[i]->t.size(); } return tc; } void Scene::clear() { meshes.clear(); materials.clear(); } BoundingBox Scene::getBoundingBox() { BoundingBox bb; for (size_t i = 0; i < meshes.size(); i++) { if (meshes[i]->bounding_box.max.x > bb.max.x) { bb.max.x = meshes[i]->bounding_box.max.x; } if (meshes[i]->bounding_box.max.z > bb.max.z) { bb.max.z = meshes[i]->bounding_box.max.z; } if (meshes[i]->bounding_box.max.y > bb.max.y) { bb.max.y = meshes[i]->bounding_box.max.y; } if (meshes[i]->bounding_box.min.x < bb.min.x) { bb.min.x = meshes[i]->bounding_box.min.x; } if (meshes[i]->bounding_box.min.z < bb.min.z) { bb.min.z = meshes[i]->bounding_box.min.z; } if (meshes[i]->bounding_box.min.y < bb.min.y) { bb.min.y = meshes[i]->bounding_box.min.y; } } return bb; }
a7ec92dd1fc940a16fe0fd351893ea4be939d60f
a6f5f9e85c25a8523276501e7a53362189bc8685
/King.cpp
359aec1ea281a1e61da0c990920a7b8d533be2e3
[]
no_license
jkasari/terminalChess
bd081c60aa9adbd8f05576347c00a649a1fa55f3
b4f2b95609221e49127c4b2a5ffc5611b50aeeea
refs/heads/master
2023-04-24T08:45:13.849318
2021-05-06T04:26:39
2021-05-06T04:26:39
342,637,502
0
0
null
2021-04-04T00:44:01
2021-02-26T16:40:35
C++
UTF-8
C++
false
false
1,416
cpp
King.cpp
#include "King.h" std::vector<Location> King::potentialMoves(Location location) { std::vector<Location> moves; Location potentialMove = location; uint8_t boardLimit = location.row; for(int moveIndex = 0; moveIndex < 8; ++moveIndex) { moves.push_back(potentialMove); potentialMove = movePiece(moveIndex, potentialMove); moves.push_back(potentialMove); potentialMove = location; } if (canCastle) { uint8_t row = location.row; uint8_t col = location.col; moves.push_back(Location(row, col + 2)); moves.push_back(Location(row, col - 2)); } return moves; } std::string King::getTerminalDisplay(void) const { if(getColor() == Color::White) { return "\xE2\x99\x9A"; } else { return "\xE2\x99\x94"; } } Location King::movePiece(uint8_t direction, Location location) { uint8_t row = location.row; uint8_t col = location.col; if(direction > 7) { return location; } switch(direction) { case 0: return Location(row + 1, col + 1); case 1: return Location(row + 1, col - 1); case 2: return Location(row - 1, col + 1); case 3: return Location(row - 1, col - 1); case 4: return Location(row, col + 1); case 5: return Location(row, col - 1); case 6: return Location(row + 1, col); case 7: return Location(row - 1, col); } return location; }
7eaf510f60d784d9a0a21c77f53c465151368169
879681c994f1ca9c8d2c905a4e5064997ad25a27
/root-2.3.0/run/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/98/U.water
e28150fe10dc31b0c0760f6d0370b503701c7c4c
[]
no_license
MizuhaWatanabe/OpenFOAM-2.3.0-with-Ubuntu
3828272d989d45fb020e83f8426b849e75560c62
daeb870be81275e8a81f5cbac4ca1906a9bc69c0
refs/heads/master
2020-05-17T16:36:41.848261
2015-04-18T09:29:48
2015-04-18T09:29:48
34,159,882
1
0
null
null
null
null
UTF-8
C++
false
false
49,035
water
U.water
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "98"; object U.water; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 1875 ( (0.0224258 -0.103327 0) (0.041688 -0.110375 0) (0.0755531 -0.113333 0) (0.11007 -0.111899 0) (0.143354 -0.107687 0) (0.173965 -0.101911 0) (0.201109 -0.0953405 0) (0.224298 -0.0884244 0) (0.243175 -0.0813694 0) (0.257476 -0.0742126 0) (0.266992 -0.066902 0) (0.27158 -0.0594638 0) (0.270778 -0.0519749 0) (0.264072 -0.0445758 0) (0.251422 -0.0372241 0) (0.233248 -0.0301635 0) (0.210402 -0.0242877 0) (0.184236 -0.0204632 0) (0.156424 -0.0196511 0) (0.128951 -0.0221473 0) (0.103534 -0.0271892 0) (0.0809046 -0.0329726 0) (0.0602797 -0.0371264 0) (0.0366556 -0.0385716 0) (0.0225328 -0.0411404 0) (0.0302467 -0.0707132 0) (0.0548915 -0.0766044 0) (0.0850981 -0.0797493 0) (0.111946 -0.0769261 0) (0.136568 -0.0697746 0) (0.158808 -0.0595749 0) (0.17849 -0.047492 0) (0.195426 -0.0342129 0) (0.209348 -0.0201515 0) (0.219962 -0.0054088 0) (0.226889 0.0100956 0) (0.229449 0.0263137 0) (0.227874 0.04242 0) (0.222885 0.0579695 0) (0.214196 0.0727249 0) (0.201057 0.0860963 0) (0.183255 0.0963787 0) (0.161653 0.102793 0) (0.137884 0.105249 0) (0.113569 0.104274 0) (0.0895925 0.101229 0) (0.066768 0.0981645 0) (0.0458269 0.097906 0) (0.0261029 0.101421 0) (0.0116867 0.0997834 0) (0.0217863 -0.187651 0) (0.0495599 -0.18247 0) (0.0759269 -0.172852 0) (0.0969548 -0.160133 0) (0.114616 -0.145142 0) (0.129524 -0.128358 0) (0.141861 -0.110165 0) (0.151645 -0.0908576 0) (0.158983 -0.0706034 0) (0.164007 -0.0495688 0) (0.166957 -0.0278406 0) (0.168173 -0.00529929 0) (0.167076 0.0182122 0) (0.162927 0.0422549 0) (0.155705 0.06591 0) (0.14545 0.0878844 0) (0.132163 0.105727 0) (0.115972 0.11754 0) (0.0976482 0.122287 0) (0.0786379 0.120757 0) (0.060298 0.115129 0) (0.0434725 0.108629 0) (0.0284559 0.104496 0) (0.0157537 0.102426 0) (0.00772472 0.0975819 0) (0.00826687 -0.223261 0) (0.0325883 -0.213315 0) (0.049163 -0.197331 0) (0.0624117 -0.179054 0) (0.0736833 -0.158929 0) (0.0829847 -0.137013 0) (0.0901269 -0.113561 0) (0.0950174 -0.088949 0) (0.0977464 -0.0635006 0) (0.0984897 -0.0373746 0) (0.0973135 -0.0106124 0) (0.0942712 0.0166973 0) (0.0897424 0.0442737 0) (0.0840408 0.0720082 0) (0.0771867 0.0992713 0) (0.0691979 0.124711 0) (0.0601504 0.145835 0) (0.0504208 0.159834 0) (0.0403674 0.16504 0) (0.0305786 0.162148 0) (0.0217911 0.15383 0) (0.0143984 0.143807 0) (0.00869897 0.134853 0) (0.00462536 0.127558 0) (0.00163402 0.119342 0) (-0.000525032 -0.245855 0) (0.0139599 -0.236211 0) (0.0193304 -0.21906 0) (0.0238062 -0.198837 0) (0.027652 -0.175947 0) (0.0300314 -0.150636 0) (0.0306876 -0.123406 0) (0.0296985 -0.0948721 0) (0.0272427 -0.0656835 0) (0.0235591 -0.036114 0) (0.0188833 -0.00620074 0) (0.0134076 0.0240591 0) (0.00735948 0.054483 0) (0.00105757 0.0846089 0) (-0.00510692 0.113544 0) (-0.0105895 0.139629 0) (-0.0147777 0.160131 0) (-0.0172124 0.171952 0) (-0.0179689 0.174343 0) (-0.0172312 0.168363 0) (-0.0153246 0.157239 0) (-0.0126439 0.144908 0) (-0.00935211 0.134276 0) (-0.0054075 0.125792 0) (-0.00340581 0.117665 0) (-0.00557501 -0.249577 0) (-0.00155487 -0.23902 0) (-0.00659722 -0.220352 0) (-0.0110451 -0.198678 0) (-0.015664 -0.17348 0) (-0.0215683 -0.145352 0) (-0.028598 -0.115308 0) (-0.0363346 -0.0842136 0) (-0.0444748 -0.0528362 0) (-0.0527511 -0.0215804 0) (-0.0608841 0.00946211 0) (-0.0685133 0.0401865 0) (-0.0752057 0.0702445 0) (-0.0804533 0.0989709 0) (-0.0836032 0.125119 0) (-0.0839097 0.14668 0) (-0.0808832 0.16113 0) (-0.0746961 0.167048 0) (-0.0660113 0.164462 0) (-0.0556899 0.155055 0) (-0.044814 0.142148 0) (-0.0341055 0.129135 0) (-0.0237222 0.118233 0) (-0.0132061 0.109958 0) (-0.00798682 0.103108 0) (-0.0135168 -0.236787 0) (-0.0152213 -0.225125 0) (-0.0288542 -0.205551 0) (-0.0417155 -0.183008 0) (-0.0548806 -0.156199 0) (-0.0690439 -0.126382 0) (-0.0834237 -0.0951754 0) (-0.0973907 -0.0636661 0) (-0.110446 -0.0326269 0) (-0.12213 -0.00245966 0) (-0.131966 0.0266828 0) (-0.139425 0.0544994 0) (-0.143935 0.0803965 0) (-0.144933 0.103421 0) (-0.141963 0.122224 0) (-0.13488 0.13535 0) (-0.123925 0.141795 0) (-0.109777 0.141143 0) (-0.0935305 0.134173 0) (-0.0765502 0.123058 0) (-0.0600474 0.110529 0) (-0.0445975 0.0988543 0) (-0.0302217 0.0894148 0) (-0.0165344 0.0826209 0) (-0.00986345 0.0778662 0) (-0.0196611 -0.208207 0) (-0.0257826 -0.195032 0) (-0.0464855 -0.174721 0) (-0.0663771 -0.151415 0) (-0.0867269 -0.123547 0) (-0.107322 -0.0934437 0) (-0.126915 -0.0630891 0) (-0.144716 -0.033698 0) (-0.159952 -0.00606412 0) (-0.171903 0.0193585 0) (-0.180046 0.0422525 0) (-0.183991 0.0625425 0) (-0.183439 0.0797222 0) (-0.178311 0.0933881 0) (-0.16871 0.10276 0) (-0.155066 0.107325 0) (-0.138102 0.1066 0) (-0.118888 0.101201 0) (-0.0988009 0.0924354 0) (-0.0791613 0.0821252 0) (-0.0608259 0.0719825 0) (-0.0441063 0.0633302 0) (-0.029005 0.057121 0) (-0.0154258 0.0539563 0) (-0.00888098 0.0527927 0) (-0.0236226 -0.167835 0) (-0.0331874 -0.153089 0) (-0.0582759 -0.132122 0) (-0.0824898 -0.108377 0) (-0.106815 -0.080625 0) (-0.130249 -0.0522366 0) (-0.151397 -0.0253684 0) (-0.169333 -0.0013573 0) (-0.183231 0.0191284 0) (-0.192518 0.0358902 0) (-0.196836 0.0494031 0) (-0.196133 0.0596867 0) (-0.190623 0.0669951 0) (-0.180527 0.0710554 0) (-0.16636 0.0716514 0) (-0.148978 0.0690624 0) (-0.12939 0.0636222 0) (-0.108886 0.0563218 0) (-0.0886733 0.0482262 0) (-0.0696613 0.040412 0) (-0.0523448 0.0337685 0) (-0.0369074 0.029043 0) (-0.0234334 0.0269917 0) (-0.0119973 0.0282765 0) (-0.00676969 0.0312695 0) (-0.0260922 -0.11974 0) (-0.036628 -0.103677 0) (-0.0631682 -0.0824114 0) (-0.0885052 -0.0590517 0) (-0.11326 -0.033065 0) (-0.136091 -0.00844394 0) (-0.155697 0.0126469 0) (-0.171214 0.0290062 0) (-0.182144 0.0403662 0) (-0.187757 0.0468129 0) (-0.188586 0.0495641 0) (-0.184248 0.0497747 0) (-0.175394 0.0470684 0) (-0.162677 0.0419465 0) (-0.146937 0.0355535 0) (-0.129022 0.0283254 0) (-0.110093 0.0208081 0) (-0.0911944 0.0136979 0) (-0.0731025 0.00757165 0) (-0.0563414 0.00293538 0) (-0.0412344 0.000218285 0) (-0.0280017 -0.000111365 0) (-0.016877 0.00261131 0) (-0.00809989 0.00909673 0) (-0.00435241 0.0164786 0) (-0.0257243 -0.0691372 0) (-0.0357009 -0.0522407 0) (-0.0610631 -0.0312406 0) (-0.0848906 -0.00939516 0) (-0.107564 0.0131905 0) (-0.127806 0.0324102 0) (-0.144596 0.0461544 0) (-0.157298 0.0534819 0) (-0.164897 0.0548485 0) (-0.168162 0.0513657 0) (-0.166532 0.0439674 0) (-0.160585 0.0341165 0) (-0.150948 0.0230555 0) (-0.138382 0.0119268 0) (-0.12384 0.00121136 0) (-0.108151 -0.00850009 0) (-0.0920802 -0.0166979 0) (-0.0761997 -0.0230274 0) (-0.0609218 -0.0272263 0) (-0.0465751 -0.0290398 0) (-0.0334527 -0.0281846 0) (-0.0218741 -0.0242574 0) (-0.0122433 -0.0166429 0) (-0.0049968 -0.00470862 0) (-0.00207747 0.0074384 0) (-0.0231949 -0.0215242 0) (-0.0317626 -0.00387537 0) (-0.0541705 0.0165026 0) (-0.0749456 0.0361046 0) (-0.0943686 0.0546954 0) (-0.111407 0.0683849 0) (-0.125304 0.0752607 0) (-0.135559 0.074668 0) (-0.141676 0.06705 0) (-0.143493 0.0538128 0) (-0.141273 0.0374305 0) (-0.135661 0.0200305 0) (-0.127402 0.00296127 0) (-0.117243 -0.0127984 0) (-0.105858 -0.0265622 0) (-0.0937839 -0.0379815 0) (-0.0813872 -0.0468737 0) (-0.0688904 -0.0531153 0) (-0.0564515 -0.0565414 0) (-0.0442405 -0.0568985 0) (-0.0324902 -0.0538242 0) (-0.0215243 -0.0467717 0) (-0.0117978 -0.0349473 0) (-0.0040634 -0.0175564 0) (-0.000956771 0.000775591 0) (-0.0200564 0.0199962 0) (-0.026792 0.0385622 0) (-0.0454937 0.0581211 0) (-0.0626589 0.0751748 0) (-0.0785621 0.0897634 0) (-0.092427 0.0983355 0) (-0.103712 0.0991143 0) (-0.111952 0.0915162 0) (-0.116712 0.0762383 0) (-0.118032 0.0556686 0) (-0.116449 0.0327562 0) (-0.112597 0.00989173 0) (-0.107104 -0.0113615 0) (-0.100502 -0.0301426 0) (-0.0931443 -0.046089 0) (-0.0852408 -0.0591131 0) (-0.0768938 -0.0692231 0) (-0.0681322 -0.0764052 0) (-0.0589351 -0.0805088 0) (-0.049283 -0.0811893 0) (-0.0392227 -0.0778823 0) (-0.0288913 -0.0697384 0) (-0.0186595 -0.0555344 0) (-0.00964825 -0.0335035 0) (-0.00529297 -0.00776246 0) (-0.0164898 0.0543789 0) (-0.0212133 0.0736958 0) (-0.0358014 0.0923014 0) (-0.0490527 0.106893 0) (-0.0612788 0.118039 0) (-0.0719659 0.12251 0) (-0.0807632 0.118573 0) (-0.0872278 0.105551 0) (-0.0910889 0.0846212 0) (-0.0926491 0.0589691 0) (-0.0924587 0.0318167 0) (-0.0910223 0.00557939 0) (-0.0887512 -0.0183111 0) (-0.0858872 -0.039216 0) (-0.0825133 -0.0569648 0) (-0.0786232 -0.0716156 0) (-0.0741664 -0.0833 0) (-0.0690763 -0.0921134 0) (-0.0632566 -0.0980112 0) (-0.0565712 -0.100536 0) (-0.0488244 -0.0990066 0) (-0.0399 -0.0924831 0) (-0.0300411 -0.0792775 0) (-0.0196075 -0.0570101 0) (-0.0131815 -0.0326567 0) (-0.0115617 0.0803605 0) (-0.0145079 0.100106 0) (-0.0245448 0.117921 0) (-0.0336729 0.130501 0) (-0.0421303 0.139069 0) (-0.0496262 0.140702 0) (-0.0559832 0.133652 0) (-0.0608894 0.117074 0) (-0.0642778 0.0928129 0) (-0.0665514 0.0643508 0) (-0.0681048 0.0349018 0) (-0.0691982 0.00680476 0) (-0.0699131 -0.018668 0) (-0.07022 -0.0410654 0) (-0.0700634 -0.0603338 0) (-0.0693607 -0.0765953 0) (-0.0680311 -0.090002 0) (-0.0660065 -0.100672 0) (-0.0632135 -0.10863 0) (-0.0594864 -0.113756 0) (-0.0545833 -0.115557 0) (-0.0481446 -0.112989 0) (-0.039867 -0.104372 0) (-0.0279379 -0.0880713 0) (-0.0185152 -0.0714081 0) (-0.00594432 0.0959462 0) (-0.00708305 0.116003 0) (-0.0120802 0.133807 0) (-0.0167701 0.145442 0) (-0.021252 0.152633 0) (-0.0254581 0.152909 0) (-0.029329 0.144518 0) (-0.0328582 0.126502 0) (-0.0361097 0.10116 0) (-0.0392553 0.0719021 0) (-0.0423915 0.0417461 0) (-0.0454971 0.0127912 0) (-0.0484186 -0.0138091 0) (-0.0509821 -0.0374936 0) (-0.0530684 -0.0581526 0) (-0.0546017 -0.0758685 0) (-0.0555619 -0.0907903 0) (-0.055966 -0.103098 0) (-0.0558436 -0.11299 0) (-0.0550985 -0.120668 0) (-0.053407 -0.126042 0) (-0.0501644 -0.1287 0) (-0.0441321 -0.127941 0) (-0.0321242 -0.123462 0) (-0.0188016 -0.117255 0) (-0.000662751 0.100572 0) (0.000200736 0.121152 0) (0.000469478 0.139179 0) (0.000403448 0.150856 0) (-4.49475e-06 0.158095 0) (-0.000724101 0.158659 0) (-0.00197071 0.150935 0) (-0.00401158 0.133939 0) (-0.00696452 0.109574 0) (-0.0106581 0.0809921 0) (-0.0148501 0.051068 0) (-0.0192711 0.0218651 0) (-0.023663 -0.0054022 0) (-0.0278001 -0.0300881 0) (-0.031498 -0.0519647 0) (-0.0346574 -0.0709862 0) (-0.0372762 -0.0872107 0) (-0.0394558 -0.100808 0) (-0.0412953 -0.112109 0) (-0.0426523 -0.121763 0) (-0.0430384 -0.130359 0) (-0.0416983 -0.138405 0) (-0.0375493 -0.14646 0) (-0.0278736 -0.154522 0) (-0.0122898 -0.159435 0) (0.00358837 0.0954181 0) (0.00677258 0.115478 0) (0.0124254 0.133957 0) (0.0168089 0.146721 0) (0.0203803 0.155147 0) (0.023166 0.157531 0) (0.0247045 0.15238 0) (0.0245613 0.138488 0) (0.022478 0.116982 0) (0.0187889 0.0905838 0) (0.0139961 0.0619825 0) (0.00859891 0.0332569 0) (0.00301036 0.00574987 0) (-0.00244405 -0.0197329 0) (-0.00751324 -0.0427701 0) (-0.0120477 -0.0631119 0) (-0.0159974 -0.0806657 0) (-0.0194295 -0.0955312 0) (-0.0223486 -0.108337 0) (-0.0244562 -0.120144 0) (-0.0252994 -0.13177 0) (-0.0245364 -0.143913 0) (-0.0221273 -0.157267 0) (-0.0169164 -0.172556 0) (-0.00361873 -0.183119 0) (0.00731837 0.0805129 0) (0.0124379 0.0988027 0) (0.0227268 0.11832 0) (0.0312576 0.133283 0) (0.0385057 0.143971 0) (0.0445342 0.149343 0) (0.0489434 0.148054 0) (0.0510896 0.13921 0) (0.0506093 0.122444 0) (0.0475664 0.0998227 0) (0.0426036 0.073768 0) (0.0364786 0.0463968 0) (0.0298247 0.0192374 0) (0.0231159 -0.00668846 0) (0.0166965 -0.0307323 0) (0.0108039 -0.0524279 0) (0.00558928 -0.0715168 0) (0.00117014 -0.0880356 0) (-0.00234723 -0.102762 0) (-0.00487437 -0.116876 0) (-0.00630114 -0.131094 0) (-0.00656011 -0.145771 0) (-0.00611981 -0.161364 0) (-0.00569593 -0.179076 0) (0.00120421 -0.191425 0) (0.00960013 0.058665 0) (0.0161136 0.0744363 0) (0.0297588 0.0943265 0) (0.0419685 0.111771 0) (0.0525256 0.125445 0) (0.0614864 0.134491 0) (0.0685514 0.137853 0) (0.0732027 0.134388 0) (0.0748424 0.124061 0) (0.0733063 0.107165 0) (0.0689483 0.0853373 0) (0.0625515 0.0606066 0) (0.0550272 0.0346932 0) (0.047133 0.00889915 0) (0.0393886 -0.0158479 0) (0.0321507 -0.0388485 0) (0.0256697 -0.0596615 0) (0.0201742 -0.078249 0) (0.0157947 -0.0951183 0) (0.012384 -0.111232 0) (0.00972973 -0.127295 0) (0.00774456 -0.143469 0) (0.00591276 -0.159613 0) (0.00261888 -0.177589 0) (0.00414087 -0.191359 0) (0.0104453 0.0329076 0) (0.0175488 0.045396 0) (0.0330062 0.0642547 0) (0.0480479 0.0837557 0) (0.0613985 0.100708 0) (0.0728451 0.113816 0) (0.0822218 0.122248 0) (0.0891446 0.125107 0) (0.0931338 0.121344 0) (0.0937598 0.111228 0) (0.0909353 0.0953106 0) (0.0850443 0.0748134 0) (0.077083 0.0513516 0) (0.0681856 0.0265058 0) (0.0591795 0.00155016 0) (0.0506102 -0.022525 0) (0.0428339 -0.0450194 0) (0.0360729 -0.0656696 0) (0.0304248 -0.0846383 0) (0.0257277 -0.102485 0) (0.0216041 -0.119785 0) (0.0177265 -0.136555 0) (0.0136871 -0.152314 0) (0.00798628 -0.169386 0) (0.00684203 -0.184209 0) (0.0102573 0.00614769 0) (0.0169439 0.0147224 0) (0.0325894 0.0310423 0) (0.0491859 0.051352 0) (0.0646497 0.0712985 0) (0.0781071 0.0885037 0) (0.0893456 0.101834 0) (0.098116 0.110394 0) (0.104124 0.113593 0) (0.106862 0.110595 0) (0.106047 0.101959 0) (0.101664 0.087559 0) (0.0943328 0.0681155 0) (0.0850966 0.0453023 0) (0.0751231 0.0208398 0) (0.0653016 -0.00388113 0) (0.0562066 -0.0278069 0) (0.0481274 -0.0503133 0) (0.0411403 -0.0711967 0) (0.0351036 -0.0905367 0) (0.0296007 -0.108613 0) (0.0241526 -0.125421 0) (0.0184768 -0.140486 0) (0.0112832 -0.156255 0) (0.00863015 -0.17157 0) (0.00912775 -0.0184778 0) (0.0146414 -0.0144643 0) (0.0290259 -0.00197866 0) (0.0455932 0.0173586 0) (0.0621506 0.0392477 0) (0.0770936 0.060226 0) (0.0897503 0.0783885 0) (0.0998329 0.0926239 0) (0.107101 0.101965 0) (0.111322 0.106127 0) (0.11214 0.104683 0) (0.109987 0.0974055 0) (0.104535 0.0835457 0) (0.0963508 0.064272 0) (0.0863737 0.0413262 0) (0.0757854 0.0165741 0) (0.0655548 -0.00842497 0) (0.0562519 -0.0325524 0) (0.0480373 -0.0551533 0) (0.0408039 -0.0758592 0) (0.0341981 -0.0945766 0) (0.0277016 -0.111263 0) (0.0210584 -0.1256 0) (0.0131545 -0.139899 0) (0.00964207 -0.155043 0) (0.00713254 -0.038895 0) (0.0111756 -0.0402322 0) (0.0230468 -0.0324789 0) (0.0377967 -0.0158547 0) (0.0539802 0.00630766 0) (0.0696206 0.0302423 0) (0.0833161 0.0530648 0) (0.0944091 0.0729866 0) (0.102577 0.0887687 0) (0.10779 0.0996829 0) (0.11005 0.104437 0) (0.109523 0.102907 0) (0.106325 0.0953437 0) (0.100039 0.0811224 0) (0.0913077 0.061375 0) (0.0810375 0.0377635 0) (0.0703742 0.0123352 0) (0.0602596 -0.0130987 0) (0.0511408 -0.0372451 0) (0.0430285 -0.0593156 0) (0.0356611 -0.0787573 0) (0.028574 -0.0954265 0) (0.0214634 -0.10919 0) (0.0134193 -0.122258 0) (0.0102119 -0.136765 0) (0.0048582 -0.0540661 0) (0.00776621 -0.0612062 0) (0.0168639 -0.0580769 0) (0.0287085 -0.0454645 0) (0.0427892 -0.0250455 0) (0.0575882 0.000118058 0) (0.0713935 0.0267003 0) (0.083033 0.0519295 0) (0.0919098 0.0736786 0) (0.0978326 0.0905125 0) (0.101084 0.101455 0) (0.10165 0.10582 0) (0.0998091 0.103768 0) (0.0954918 0.0949742 0) (0.0886325 0.0792403 0) (0.0798404 0.0580014 0) (0.0699077 0.0331234 0) (0.0598592 0.0069131 0) (0.050479 -0.0185633 0) (0.0420368 -0.0419034 0) (0.0343874 -0.0621998 0) (0.0271615 -0.0790441 0) (0.020062 -0.092474 0) (0.0123776 -0.104789 0) (0.0097961 -0.118505 0) (0.00409806 -0.0649209 0) (0.00665491 -0.0771893 0) (0.0131779 -0.0781756 0) (0.021673 -0.0693904 0) (0.0322622 -0.0516229 0) (0.0443156 -0.0269998 0) (0.0565355 0.00159103 0) (0.0675485 0.0309691 0) (0.0763845 0.0581512 0) (0.082541 0.0808884 0) (0.0860664 0.0971387 0) (0.0872595 0.106613 0) (0.0863009 0.109043 0) (0.0835666 0.10486 0) (0.078741 0.0934056 0) (0.0720558 0.0752198 0) (0.0639344 0.0519391 0) (0.0550717 0.025822 0) (0.0463236 -0.000523521 0) (0.0382621 -0.0249564 0) (0.0309711 -0.0460667 0) (0.0241666 -0.0632423 0) (0.017587 -0.0766209 0) (0.0106839 -0.0886335 0) (0.00863355 -0.101776 0) (0.00422494 -0.076065 0) (0.00671801 -0.0890955 0) (0.0108944 -0.0923249 0) (0.0164334 -0.0860459 0) (0.0234055 -0.0708618 0) (0.0318256 -0.0478869 0) (0.0411026 -0.0191287 0) (0.0501579 0.0125224 0) (0.0579306 0.043676 0) (0.063716 0.0713205 0) (0.0672719 0.092483 0) (0.0688095 0.106195 0) (0.0686196 0.112494 0) (0.067007 0.111452 0) (0.0639788 0.103416 0) (0.0594238 0.0881576 0) (0.0535739 0.0670257 0) (0.0467188 0.0418684 0) (0.0394746 0.0153542 0) (0.0324981 -0.00981593 0) (0.0261379 -0.0316457 0) (0.0202562 -0.049142 0) (0.0145885 -0.0625971 0) (0.00874145 -0.0746087 0) (0.00713744 -0.0874662 0) (0.00421385 -0.086842 0) (0.00685266 -0.0977079 0) (0.00890544 -0.101728 0) (0.0117793 -0.0966652 0) (0.0157363 -0.0832298 0) (0.0208176 -0.0618732 0) (0.0268202 -0.033856 0) (0.033137 -0.00148749 0) (0.03897 0.0319185 0) (0.0436578 0.0628745 0) (0.0468167 0.0876493 0) (0.0485059 0.104577 0) (0.0489926 0.113653 0) (0.0483846 0.115156 0) (0.046846 0.109563 0) (0.0442688 0.0966827 0) (0.040699 0.0775781 0) (0.0361894 0.0538373 0) (0.0310186 0.0278359 0) (0.0257035 0.00245866 0) (0.0207027 -0.0198019 0) (0.0160297 -0.037489 0) (0.0114087 -0.050984 0) (0.00668833 -0.0631903 0) (0.00551436 -0.0759706 0) (0.00440582 -0.0987502 0) (0.00821483 -0.104313 0) (0.00829571 -0.10653 0) (0.00805797 -0.101832 0) (0.00922168 -0.0896392 0) (0.0115267 -0.0696405 0) (0.0145765 -0.0425748 0) (0.0180332 -0.0103698 0) (0.0214702 0.0238744 0) (0.0244876 0.0565148 0) (0.0268191 0.0834682 0) (0.0284299 0.102348 0) (0.0293845 0.113233 0) (0.0297031 0.116337 0) (0.0294674 0.112095 0) (0.0286487 0.100824 0) (0.0271606 0.0833726 0) (0.0249422 0.061136 0) (0.0220303 0.0361232 0) (0.0187033 0.0110936 0) (0.0153646 -0.011166 0) (0.0120712 -0.0287464 0) (0.00833457 -0.0420615 0) (0.00454112 -0.0546736 0) (0.0038316 -0.067523 0) (0.00333177 -0.111372 0) (0.00860131 -0.11003 0) (0.00766693 -0.107126 0) (0.00518399 -0.102152 0) (0.00409951 -0.0910912 0) (0.00408119 -0.072191 0) (0.0045557 -0.0459786 0) (0.00535445 -0.0142836 0) (0.00638188 0.0198827 0) (0.00757545 0.0528084 0) (0.00890937 0.080263 0) (0.0102721 0.0997354 0) (0.0115376 0.111249 0) (0.0126456 0.115055 0) (0.0135431 0.111518 0) (0.01417 0.101162 0) (0.0143981 0.0848559 0) (0.0141172 0.0638922 0) (0.0132609 0.0400252 0) (0.0118891 0.0157386 0) (0.0102258 -0.00607719 0) (0.00831049 -0.0230688 0) (0.00546234 -0.0357431 0) (0.00256441 -0.049297 0) (0.00225383 -0.0623698 0) (0.000792549 -0.120052 0) (0.00639383 -0.112896 0) (0.00530921 -0.10504 0) (0.00275121 -0.0989158 0) (0.000365481 -0.0884048 0) (-0.00155983 -0.0701648 0) (-0.00329458 -0.0446097 0) (-0.00478932 -0.0136462 0) (-0.00586763 0.0196908 0) (-0.00628023 0.0516706 0) (-0.00587735 0.0782239 0) (-0.00483668 0.0970761 0) (-0.00341985 0.108214 0) (-0.00177009 0.111882 0) (-1.48952e-05 0.108428 0) (0.00169203 0.098476 0) (0.00318773 0.082933 0) (0.00432472 0.062984 0) (0.00499975 0.040247 0) (0.00516437 0.0170046 0) (0.00484439 -0.00393436 0) (0.00406189 -0.019943 0) (0.00262348 -0.0316716 0) (0.00122592 -0.0463389 0) (0.00113423 -0.0597166 0) (-0.00170799 -0.122673 0) (0.00303099 -0.112381 0) (0.00137295 -0.102026 0) (-0.000665822 -0.0939827 0) (-0.00346352 -0.0827808 0) (-0.00664363 -0.0645208 0) (-0.00999266 -0.03937 0) (-0.0131994 -0.00928448 0) (-0.015813 0.0226438 0) (-0.0173343 0.0526971 0) (-0.0175418 0.0772403 0) (-0.0166982 0.0945323 0) (-0.0151462 0.104504 0) (-0.0130996 0.107407 0) (-0.0107183 0.103609 0) (-0.00823342 0.0937324 0) (-0.00583275 0.0786834 0) (-0.00368418 0.0595711 0) (-0.00191363 0.0378927 0) (-0.000613326 0.0157836 0) (0.000102924 -0.00408595 0) (0.000207264 -0.0192827 0) (5.72715e-05 -0.030686 0) (0.000170418 -0.0455721 0) (0.000221804 -0.0588275 0) (-0.0037021 -0.12103 0) (-0.000370747 -0.109154 0) (-0.00286171 -0.0972856 0) (-0.00506086 -0.0878951 0) (-0.00804727 -0.0754781 0) (-0.0119639 -0.0566601 0) (-0.0163556 -0.03166 0) (-0.0206244 -0.00256695 0) (-0.0240434 0.0274431 0) (-0.0260057 0.0548199 0) (-0.0263819 0.0766611 0) (-0.0255076 0.0918184 0) (-0.0237418 0.100146 0) (-0.0213399 0.101927 0) (-0.0184764 0.0974998 0) (-0.0154256 0.0874896 0) (-0.0123748 0.0727518 0) (-0.00948602 0.0543225 0) (-0.00689048 0.0336174 0) (-0.00473008 0.012688 0) (-0.00323067 -0.00593962 0) (-0.00248255 -0.0202118 0) (-0.00190506 -0.0313551 0) (-0.000799182 -0.0463551 0) (-0.000571667 -0.0592904 0) (-0.00485553 -0.116503 0) (-0.00340773 -0.103804 0) (-0.00627883 -0.0913208 0) (-0.00892573 -0.081056 0) (-0.0123834 -0.0672621 0) (-0.0169538 -0.0476179 0) (-0.0220594 -0.0226859 0) (-0.0268285 0.00517336 0) (-0.0303946 0.0327739 0) (-0.0322535 0.0570304 0) (-0.0324585 0.0758938 0) (-0.0313949 0.088659 0) (-0.029418 0.0951367 0) (-0.0266999 0.095666 0) (-0.0235169 0.0904859 0) (-0.0200896 0.0802153 0) (-0.0166101 0.0656468 0) (-0.0132253 0.0477504 0) (-0.010072 0.0279043 0) (-0.00735209 0.00813182 0) (-0.00537494 -0.00920749 0) (-0.00426337 -0.0226059 0) (-0.00327802 -0.0338336 0) (-0.00150783 -0.0488679 0) (-0.000952889 -0.0612531 0) (-0.00557467 -0.109655 0) (-0.00532943 -0.0967697 0) (-0.00857789 -0.0841424 0) (-0.0118052 -0.0730726 0) (-0.0159718 -0.058062 0) (-0.0211635 -0.037682 0) (-0.0266405 -0.0131125 0) (-0.031357 0.0129978 0) (-0.0345704 0.0376936 0) (-0.0360442 0.0585822 0) (-0.03598 0.0744576 0) (-0.0347029 0.0849583 0) (-0.0325226 0.0896468 0) (-0.0295834 0.0888703 0) (-0.0261755 0.082893 0) (-0.0225088 0.0723058 0) (-0.0187616 0.0578287 0) (-0.0150678 0.0403848 0) (-0.011583 0.0213667 0) (-0.00857595 0.00280357 0) (-0.00638111 -0.0131662 0) (-0.00508614 -0.0256307 0) (-0.00389519 -0.0370714 0) (-0.00185088 -0.0525393 0) (-0.00104084 -0.064112 0) (-0.00628393 -0.101006 0) (-0.00644528 -0.0883006 0) (-0.0101836 -0.0758082 0) (-0.0139818 -0.063924 0) (-0.0188168 -0.0479846 0) (-0.0244179 -0.0272789 0) (-0.0298039 -0.0036859 0) (-0.0340005 0.0201081 0) (-0.0365863 0.0417101 0) (-0.0376124 0.0594753 0) (-0.0373039 0.0726771 0) (-0.0358191 0.080766 0) (-0.0334307 0.0836852 0) (-0.0303211 0.0816399 0) (-0.026776 0.0749048 0) (-0.0229857 0.064005 0) (-0.0191042 0.0495918 0) (-0.0152604 0.0325749 0) (-0.0116448 0.014403 0) (-0.00857878 -0.00290185 0) (-0.00634452 -0.0175056 0) (-0.00492723 -0.0290565 0) (-0.00365673 -0.0407177 0) (-0.00180875 -0.0562481 0) (-0.00093331 -0.066932 0) (-0.00666914 -0.0910107 0) (-0.00712654 -0.078689 0) (-0.0113962 -0.0664668 0) (-0.0157284 -0.0539695 0) (-0.0210109 -0.0373933 0) (-0.0266525 -0.0169774 0) (-0.0315246 0.00493808 0) (-0.0349842 0.0260503 0) (-0.0368989 0.0446737 0) (-0.0374076 0.059789 0) (-0.0366945 0.0704881 0) (-0.0349396 0.0762063 0) (-0.0323718 0.0774739 0) (-0.0292144 0.074242 0) (-0.0256597 0.0668039 0) (-0.021881 0.0556096 0) (-0.0180108 0.041259 0) (-0.0141871 0.0246867 0) (-0.0106387 0.00741605 0) (-0.0076943 -0.0085966 0) (-0.00552573 -0.0218821 0) (-0.00399118 -0.0324519 0) (-0.0026892 -0.0438689 0) (-0.00143739 -0.0591724 0) (-0.000633316 -0.0692438 0) (-0.00683928 -0.0803071 0) (-0.00758236 -0.0683216 0) (-0.0123561 -0.0563288 0) (-0.0171106 -0.0435013 0) (-0.0224912 -0.0267595 0) (-0.0276996 -0.00737962 0) (-0.0317779 0.0123179 0) (-0.0344606 0.030615 0) (-0.0357481 0.0463145 0) (-0.0357372 0.0586314 0) (-0.0345909 0.0669322 0) (-0.0326566 0.0710654 0) (-0.030041 0.0710453 0) (-0.0269049 0.0668576 0) (-0.0234279 0.0588365 0) (-0.0197555 0.0474011 0) (-0.0160069 0.0331444 0) (-0.0123335 0.0170602 0) (-0.00898037 0.000723818 0) (-0.00622145 -0.0140571 0) (-0.00412123 -0.026188 0) (-0.00247643 -0.0358761 0) (-0.00116426 -0.0466476 0) (-0.000725406 -0.0610681 0) (-0.000193025 -0.0709843 0) (-0.0067978 -0.0695382 0) (-0.00790049 -0.0577467 0) (-0.0130627 -0.0459811 0) (-0.0179454 -0.0331663 0) (-0.0229911 -0.0168715 0) (-0.0273896 0.000877333 0) (-0.03058 0.0181885 0) (-0.0325258 0.0338532 0) (-0.0332766 0.0469552 0) (-0.032931 0.0568351 0) (-0.0316407 0.0632556 0) (-0.0296357 0.0659579 0) (-0.0270176 0.0647096 0) (-0.0239656 0.0596733 0) (-0.0206309 0.051153 0) (-0.017137 0.0395294 0) (-0.0135953 0.0254046 0) (-0.0101646 0.00983194 0) (-0.00707523 -0.00561481 0) (-0.00451738 -0.0193241 0) (-0.00249371 -0.0304849 0) (-0.000854231 -0.0393287 0) (0.00041416 -0.0489922 0) (-1.04797e-05 -0.0621542 0) (2.36236e-05 -0.0722983 0) (-0.0065575 -0.0590377 0) (-0.00780778 -0.0471797 0) (-0.0129794 -0.0358105 0) (-0.0177476 -0.0234465 0) (-0.0222263 -0.00824501 0) (-0.0257787 0.00755785 0) (-0.0282236 0.0225836 0) (-0.0295954 0.0359253 0) (-0.0299519 0.046847 0) (-0.0294057 0.0548249 0) (-0.0280845 0.059503 0) (-0.0261066 0.0607828 0) (-0.0236041 0.0585308 0) (-0.0207446 0.0528185 0) (-0.0176669 0.0439214 0) (-0.0144796 0.0321959 0) (-0.0112939 0.0182674 0) (-0.00827232 0.00323263 0) (-0.00561976 -0.0113859 0) (-0.00345604 -0.0241755 0) (-0.00174522 -0.0344981 0) (-0.00040395 -0.042515 0) (0.000588501 -0.050746 0) (0.000152583 -0.0620883 0) (0.000311257 -0.0731065 0) (-0.00604298 -0.0490953 0) (-0.00712174 -0.0373039 0) (-0.0118867 -0.0261849 0) (-0.0163973 -0.0145573 0) (-0.0202567 -0.000878493 0) (-0.0231345 0.0129356 0) (-0.0250412 0.02588 0) (-0.0260186 0.0371802 0) (-0.0261246 0.046212 0) (-0.0254559 0.0525314 0) (-0.0241459 0.0558253 0) (-0.0222903 0.0559801 0) (-0.0200165 0.0528659 0) (-0.0174583 0.0466197 0) (-0.0147453 0.0374739 0) (-0.0119796 0.025766 0) (-0.00927583 0.0121464 0) (-0.00679261 -0.00227 0) (-0.00470611 -0.0160519 0) (-0.00309423 -0.0279882 0) (-0.00190313 -0.0375721 0) (-0.00103649 -0.0448265 0) (-0.000352406 -0.0520978 0) (-0.000172982 -0.0623383 0) (0.000467757 -0.0736977 0) (-0.00531464 -0.040029 0) (-0.00622564 -0.0285047 0) (-0.010349 -0.0173517 0) (-0.0142928 -0.0066595 0) (-0.0175126 0.00534912 0) (-0.019863 0.0173008 0) (-0.0213742 0.0283955 0) (-0.0220835 0.0379215 0) (-0.022049 0.0453272 0) (-0.021358 0.0502264 0) (-0.0201319 0.0523556 0) (-0.018453 0.0515972 0) (-0.0164459 0.0478391 0) (-0.0142285 0.0412252 0) (-0.0119114 0.0319649 0) (-0.0095885 0.0203921 0) (-0.00737079 0.00718084 0) (-0.00539929 -0.00656135 0) (-0.0037986 -0.0195056 0) (-0.00261545 -0.0306212 0) (-0.00183094 -0.039512 0) (-0.00130241 -0.046412 0) (-0.00082428 -0.0533996 0) (-0.000419762 -0.0629475 0) (0.000306591 -0.0739953 0) (-0.00456569 -0.0320048 0) (-0.00536112 -0.0207867 0) (-0.00862136 -0.00976318 0) (-0.0117148 2.75076e-05 0) (-0.0143407 0.0105507 0) (-0.0162762 0.0208832 0) (-0.0175057 0.0303747 0) (-0.0180494 0.0383778 0) (-0.0179598 0.0444078 0) (-0.0173167 0.0481136 0) (-0.016225 0.0492814 0) (-0.0147627 0.0477786 0) (-0.0130421 0.0435202 0) (-0.011168 0.0366528 0) (-0.00923536 0.0273639 0) (-0.00732976 0.0159868 0) (-0.00555816 0.00320406 0) (-0.00404349 -0.00991543 0) (-0.00286566 -0.022176 0) (-0.00202667 -0.0325671 0) (-0.0014816 -0.040744 0) (-0.00113766 -0.0472734 0) (-0.000809993 -0.0539907 0) (-0.000465529 -0.0634112 0) (0.000334499 -0.0742519 0) (-0.00379132 -0.0251059 0) (-0.00446029 -0.0143133 0) (-0.00692903 -0.00367754 0) (-0.00925022 0.00547006 0) (-0.0113317 0.0148543 0) (-0.0128841 0.0238546 0) (-0.0138638 0.0319856 0) (-0.014273 0.0386859 0) (-0.0141558 0.0435363 0) (-0.0135855 0.0462371 0) (-0.0126371 0.0466188 0) (-0.0113927 0.0445226 0) (-0.00994758 0.0398885 0) (-0.0083961 0.0328609 0) (-0.00682058 0.0236117 0) (-0.00529812 0.0124778 0) (-0.00392077 0.000147669 0) (-0.00280194 -0.0123655 0) (-0.00201395 -0.02397 0) (-0.00151973 -0.0338803 0) (-0.00120323 -0.041854 0) (-0.00098816 -0.0480626 0) (-0.000732585 -0.0547018 0) (-0.000412601 -0.0639249 0) (0.000458114 -0.0747917 0) (-0.0030332 -0.0193801 0) (-0.00356673 -0.00897982 0) (-0.00547492 0.00116073 0) (-0.00724199 0.00977104 0) (-0.00883209 0.0182603 0) (-0.0100129 0.0261893 0) (-0.0107402 0.0332093 0) (-0.0110083 0.0388444 0) (-0.0108511 0.0427482 0) (-0.0103265 0.0446442 0) (-0.00949799 0.0443674 0) (-0.00844421 0.0417984 0) (-0.00724279 0.0368913 0) (-0.00597535 0.029781 0) (-0.00471739 0.0206231 0) (-0.00353893 0.00975257 0) (-0.0025138 -0.00216505 0) (-0.00171955 -0.0140662 0) (-0.00117791 -0.0250232 0) (-0.000862888 -0.0345203 0) (-0.000733483 -0.0423509 0) (-0.000673046 -0.0485961 0) (-0.000510806 -0.0553804 0) (-0.000272327 -0.064587 0) (0.000475745 -0.075089 0) (-0.00238467 -0.0148593 0) (-0.00279703 -0.00485851 0) (-0.00425357 0.00485311 0) (-0.00558956 0.0130194 0) (-0.00677854 0.0208054 0) (-0.00764035 0.0278935 0) (-0.00813871 0.0340295 0) (-0.00827513 0.0388083 0) (-0.00807296 0.0419211 0) (-0.00757409 0.0431476 0) (-0.00684543 0.0423995 0) (-0.00595103 0.0394998 0) (-0.00494833 0.0344232 0) (-0.00391098 0.0273039 0) (-0.00290059 0.0182936 0) (-0.00199737 0.00771453 0) (-0.00128048 -0.0037801 0) (-0.000752674 -0.0153086 0) (-0.000391655 -0.0260106 0) (-0.000203238 -0.0351296 0) (-0.000181916 -0.042508 0) (-0.000235782 -0.0487956 0) (-0.000203304 -0.0556393 0) (-0.000124029 -0.0646381 0) (0.000614297 -0.0749399 0) (-0.00184665 -0.0112816 0) (-0.00216551 -0.0016167 0) (-0.00326114 0.00767473 0) (-0.0042464 0.0154553 0) (-0.00510589 0.0226674 0) (-0.00570197 0.0290613 0) (-0.00601075 0.034489 0) (-0.00603554 0.0386077 0) (-0.00579989 0.0410951 0) (-0.00535861 0.0418355 0) (-0.00472943 0.0407173 0) (-0.00394214 0.0375603 0) (-0.00308775 0.0323679 0) (-0.00223716 0.0252761 0) (-0.00143418 0.0164182 0) (-0.00073606 0.00621593 0) (-0.00020404 -0.00479966 0) (0.000132737 -0.0160403 0) (0.000267365 -0.0263836 0) (0.000233981 -0.0352394 0) (0.000119848 -0.0424995 0) (-2.15489e-05 -0.0486513 0) (-6.77895e-05 -0.0554002 0) (-3.21191e-05 -0.0644796 0) (0.000779171 -0.074818 0) (-0.00140906 -0.00852243 0) (-0.00164256 0.00082152 0) (-0.00243898 0.00976472 0) (-0.00314267 0.0171851 0) (-0.00374373 0.0239194 0) (-0.00415735 0.0297802 0) (-0.00436021 0.0346578 0) (-0.00431786 0.0382412 0) (-0.00406783 0.0403311 0) (-0.00364401 0.0407967 0) (-0.00305175 0.0392113 0) (-0.00235644 0.035823 0) (-0.00162329 0.0306347 0) (-0.000908205 0.0236422 0) (-0.000292086 0.0149801 0) (0.000205814 0.00497813 0) (0.000585447 -0.00573579 0) (0.000764748 -0.0163975 0) (0.000744261 -0.0262647 0) (0.000600963 -0.0348857 0) (0.000392107 -0.0421936 0) (0.000160317 -0.0484373 0) (5.23069e-05 -0.05548 0) (6.08605e-05 -0.0644898 0) (0.000840511 -0.0745665 0) (-0.001073 -0.00642046 0) (-0.00124638 0.00264003 0) (-0.00182773 0.0112475 0) (-0.00234824 0.0184094 0) (-0.00279207 0.0248235 0) (-0.00305057 0.0303995 0) (-0.00310832 0.0348473 0) (-0.00298412 0.0378952 0) (-0.00268434 0.0396104 0) (-0.00220906 0.0395523 0) (-0.00165935 0.0378518 0) (-0.00109552 0.0343794 0) (-0.0004952 0.0291092 0) (9.41794e-05 0.0222561 0) (0.000596029 0.0139982 0) (0.000949382 0.00426373 0) (0.00114184 -0.00616289 0) (0.00119425 -0.0164387 0) (0.00113098 -0.026152 0) (0.000974905 -0.0346426 0) (0.000734842 -0.0417558 0) (0.000448448 -0.0479945 0) (0.000263683 -0.0550547 0) (0.000172036 -0.0641061 0) (0.000922863 -0.0740676 0) (-0.000843205 -0.00478318 0) (-0.000985986 0.0040374 0) (-0.00144546 0.0124228 0) (-0.00183781 0.0194392 0) (-0.00212127 0.0254792 0) (-0.0022133 0.0304349 0) (-0.00212568 0.0344643 0) (-0.00190969 0.0373363 0) (-0.00156322 0.0386077 0) (-0.00112945 0.0384233 0) (-0.000643063 0.036793 0) (-0.000106931 0.0333149 0) (0.000399604 0.0280019 0) (0.000840858 0.0212203 0) (0.00124352 0.0130319 0) (0.00155178 0.00380328 0) (0.00169276 -0.00624746 0) (0.00169335 -0.0164717 0) (0.00156299 -0.0259365 0) (0.00131917 -0.0342326 0) (0.00100333 -0.0411779 0) (0.000661816 -0.0474257 0) (0.000427871 -0.0546127 0) (0.000281921 -0.0636129 0) (0.00101566 -0.0734669 0) (-0.000664649 -0.00341697 0) (-0.000772648 0.00519965 0) (-0.00108875 0.0133509 0) (-0.00131931 0.0199222 0) (-0.00145625 0.0255958 0) (-0.00149219 0.0302817 0) (-0.00142061 0.0340038 0) (-0.00119562 0.0365484 0) (-0.000866637 0.037721 0) (-0.000472419 0.0375326 0) (2.34854e-05 0.035505 0) (0.000577242 0.0319975 0) (0.00109058 0.0270574 0) (0.00151935 0.0204682 0) (0.00185149 0.0123157 0) (0.00208253 0.00316884 0) (0.00218527 -0.00658184 0) (0.0021048 -0.0163325 0) (0.00187214 -0.0254372 0) (0.00155027 -0.0335088 0) (0.00117946 -0.0404529 0) (0.000803536 -0.0467489 0) (0.000535863 -0.0539991 0) (0.000357737 -0.0630096 0) (0.00105799 -0.0727149 0) (-0.000484415 -0.00242669 0) (-0.000557328 0.00590995 0) (-0.000755287 0.0137799 0) (-0.000923131 0.0202328 0) (-0.00104446 0.0257461 0) (-0.00102002 0.0303901 0) (-0.000867202 0.0338803 0) (-0.00061523 0.0360143 0) (-0.000270111 0.03703 0) (0.000167035 0.0363791 0) (0.000625342 0.0343187 0) (0.00106983 0.0307908 0) (0.00153691 0.0258009 0) (0.00198133 0.0194155 0) (0.00229683 0.0117913 0) (0.00243608 0.0029341 0) (0.00242318 -0.00647479 0) (0.00227367 -0.0158606 0) (0.00201183 -0.0248352 0) (0.00168471 -0.0327881 0) (0.00131975 -0.0397119 0) (0.000925474 -0.0460478 0) (0.00062427 -0.0533768 0) (0.000416099 -0.0622425 0) (0.00108904 -0.0718946 0) (-0.00036931 -0.00165556 0) (-0.00042159 0.00657845 0) (-0.000575796 0.014232 0) (-0.000724922 0.0206628 0) (-0.000787151 0.0258642 0) (-0.000667085 0.0298972 0) (-0.000413412 0.0331122 0) (-9.376e-05 0.0353084 0) (0.000291364 0.0359883 0) (0.000701466 0.0354348 0) (0.00110872 0.0335785 0) (0.00152993 0.0300799 0) (0.00191037 0.0249731 0) (0.00222145 0.0186827 0) (0.00245653 0.0112848 0) (0.00258441 0.0029082 0) (0.00257032 -0.00623694 0) (0.00242918 -0.0155097 0) (0.00217552 -0.0242868 0) (0.00183883 -0.0321221 0) (0.00146261 -0.0389121 0) (0.00104961 -0.0451828 0) (0.000717249 -0.0525722 0) (0.000485376 -0.0615307 0) (0.0011343 -0.0710305 0) (-0.00028806 -0.00105858 0) (-0.000300051 0.0069596 0) (-0.000348708 0.0145332 0) (-0.000403139 0.0205594 0) (-0.000383375 0.0254672 0) (-0.000261289 0.0294146 0) (-8.12862e-05 0.032446 0) (0.000207988 0.0343771 0) (0.000554907 0.0351093 0) (0.000919553 0.0346181 0) (0.00134212 0.0324463 0) (0.00178514 0.0290085 0) (0.0021654 0.0243782 0) (0.00245636 0.0183205 0) (0.0026698 0.0109706 0) (0.00279226 0.00261248 0) (0.00277969 -0.00621935 0) (0.00260983 -0.0151268 0) (0.00232187 -0.0235952 0) (0.0019583 -0.0313148 0) (0.001557 -0.0380547 0) (0.00113542 -0.0443579 0) (0.000802418 -0.0518077 0) (0.000554948 -0.0607049 0) (0.00117347 -0.0700638 0) (-0.000188217 -0.000774207 0) (-0.00019396 0.00703397 0) (-0.00018531 0.014376 0) (-0.0001624 0.0204661 0) (-0.000122401 0.0252957 0) (2.62417e-05 0.0292492 0) (0.000263071 0.0321449 0) (0.000554158 0.0338028 0) (0.000895558 0.0344565 0) (0.00129553 0.0336149 0) (0.00167959 0.0314965 0) (0.00201288 0.0280763 0) (0.00235158 0.0233742 0) (0.00266594 0.0174573 0) (0.00288273 0.0104358 0) (0.00294355 0.00249706 0) (0.00285366 -0.00599283 0) (0.00264795 -0.0146514 0) (0.00234477 -0.0229572 0) (0.00198155 -0.0305449 0) (0.00159068 -0.0371877 0) (0.0011849 -0.0434728 0) (0.000855118 -0.050964 0) (0.00059184 -0.0598054 0) (0.00119222 -0.0690488 0) (-0.000171754 -0.000472281 0) (-0.000157305 0.00729594 0) (-0.000124794 0.0144368 0) (-4.39399e-05 0.0204942 0) (9.87817e-05 0.025101 0) (0.000329659 0.0285617 0) (0.000649492 0.0312803 0) (0.000996343 0.0330707 0) (0.00137427 0.0334821 0) (0.00175123 0.032795 0) (0.00209287 0.0309345 0) (0.00241902 0.0275935 0) (0.00269396 0.0228292 0) (0.00289025 0.0170284 0) (0.00299707 0.0102497 0) (0.00300412 0.00268335 0) (0.00289979 -0.00565419 0) (0.00268696 -0.0141167 0) (0.00238277 -0.022294 0) (0.00201761 -0.0297411 0) (0.00162992 -0.0363802 0) (0.00123706 -0.042658 0) (0.000914096 -0.0501471 0) (0.000640694 -0.0588959 0) (0.00123088 -0.0679999 0) (-0.000127445 -0.000279512 0) (-5.60689e-05 0.00722011 0) (8.91445e-05 0.0143398 0) (0.000276595 0.0200082 0) (0.000510976 0.0244465 0) (0.000739323 0.0279155 0) (0.000987235 0.0305308 0) (0.00130883 0.032136 0) (0.00165558 0.0326542 0) (0.0019945 0.0320777 0) (0.00235822 0.0299831 0) (0.00271486 0.0267379 0) (0.00299887 0.0224538 0) (0.00318594 0.0169224 0) (0.00328225 0.0102826 0) (0.00328605 0.00268449 0) (0.00316573 -0.00534418 0) (0.00289975 -0.0135883 0) (0.0025404 -0.0215819 0) (0.00214372 -0.0288976 0) (0.00174364 -0.0354762 0) (0.00135018 -0.0417344 0) (0.00101698 -0.0491751 0) (0.000715181 -0.057898 0) (0.0012912 -0.066872 0) (-2.34837e-05 -0.000430354 0) (6.94774e-05 0.00690368 0) (0.000293857 0.0138033 0) (0.000533774 0.0195086 0) (0.00076576 0.0239787 0) (0.00102996 0.0275477 0) (0.00134772 0.0301014 0) (0.00169575 0.0315124 0) (0.00206103 0.0320152 0) (0.00245552 0.0311653 0) (0.00281078 0.0291754 0) (0.00308994 0.0259922 0) (0.0033529 0.0216726 0) (0.00357716 0.0162837 0) (0.00369911 0.00992539 0) (0.00366297 0.00275064 0) (0.00347265 -0.00496181 0) (0.00316067 -0.0129194 0) (0.00275454 -0.0207203 0) (0.0023189 -0.0280215 0) (0.00189867 -0.0345736 0) (0.00149856 -0.0408075 0) (0.00115304 -0.0482198 0) (0.000814543 -0.0567935 0) (0.00137368 -0.0656277 0) (-1.98455e-05 -0.000558221 0) (0.000111794 0.00670138 0) (0.000393561 0.0134193 0) (0.000681724 0.0191255 0) (0.00100369 0.0234502 0) (0.00137244 0.0266179 0) (0.00180441 0.0290526 0) (0.00224573 0.0306421 0) (0.00268437 0.0309795 0) (0.00309866 0.0303282 0) (0.00346332 0.0286418 0) (0.00377939 0.0255999 0) (0.00401573 0.021274 0) (0.00415649 0.0160369 0) (0.00419247 0.00994307 0) (0.00411225 0.00314877 0) (0.00390376 -0.00439788 0) (0.00357353 -0.0121473 0) (0.0031478 -0.0198069 0) (0.00266923 -0.0270076 0) (0.00219168 -0.0335233 0) (0.00174517 -0.0397616 0) (0.00135118 -0.0471128 0) (0.000948065 -0.0555659 0) (0.00149107 -0.0642231 0) (1.33567e-05 -0.000822441 0) (0.00021509 0.00612266 0) (0.00062459 0.012837 0) (0.00102649 0.0182013 0) (0.00145324 0.0224202 0) (0.00184969 0.025647 0) (0.00225211 0.0280241 0) (0.0027154 0.0294834 0) (0.00318284 0.0299791 0) (0.00363067 0.0294817 0) (0.00409985 0.0276649 0) (0.00451882 0.0247539 0) (0.00481203 0.0209367 0) (0.00498144 0.0160209 0) (0.00503434 0.0101253 0) (0.00496565 0.003369 0) (0.00473967 -0.00382471 0) (0.0043464 -0.0113438 0) (0.00383636 -0.0188269 0) (0.00326227 -0.0258911 0) (0.0026867 -0.032342 0) (0.00215573 -0.0385559 0) (0.00167798 -0.0457851 0) (0.00116332 -0.0540932 0) (0.00166457 -0.0625983 0) (0.000117638 -0.00141254 0) (0.00033583 0.00530919 0) (0.000818683 0.0118238 0) (0.00128332 0.0172516 0) (0.00173185 0.0215253 0) (0.00219607 0.0248674 0) (0.00270311 0.0271999 0) (0.00325073 0.0284906 0) (0.0038241 0.0289886 0) (0.00442665 0.0282479 0) (0.00500493 0.0265387 0) (0.0054633 0.0238356 0) (0.00582581 0.0201086 0) (0.0060987 0.0154277 0) (0.00621451 0.00989353 0) (0.00612821 0.00362185 0) (0.00584827 -0.00318093 0) (0.00539707 -0.0103434 0) (0.00478982 -0.0175522 0) (0.00409188 -0.0244864 0) (0.00338493 -0.030913 0) (0.00273485 -0.0370824 0) (0.00213257 -0.0441682 0) (0.00146159 -0.0523086 0) (0.0018945 -0.060631 0) (9.03981e-05 -0.00192363 0) (0.000325824 0.00463872 0) (0.000832254 0.0109494 0) (0.00134497 0.0163648 0) (0.00190385 0.020493 0) (0.00252662 0.0234727 0) (0.00323953 0.025667 0) (0.00398795 0.0270613 0) (0.00476468 0.027401 0) (0.0055229 0.0267951 0) (0.00620339 0.0253218 0) (0.00679672 0.0229627 0) (0.00725445 0.0193865 0) (0.00754868 0.0149988 0) (0.0076662 0.00986194 0) (0.00759602 0.00410206 0) (0.00732508 -0.00240046 0) (0.00683562 -0.00922941 0) (0.00613459 -0.0161408 0) (0.00528954 -0.0228669 0) (0.0044041 -0.029188 0) (0.00357677 -0.0353023 0) (0.00279488 -0.0421936 0) (0.00190683 -0.0501311 0) (0.00221589 -0.0582298 0) (4.61644e-05 -0.00254768 0) (0.000293923 0.00363935 0) (0.000820581 0.00988306 0) (0.00140525 0.0148988 0) (0.00208767 0.018831 0) (0.00282907 0.0217251 0) (0.00365937 0.0237901 0) (0.00458469 0.025077 0) (0.00557013 0.0254998 0) (0.00654251 0.0251659 0) (0.00745024 0.0237973 0) (0.008295 0.0215216 0) (0.00898029 0.0184757 0) (0.00943142 0.0145415 0) (0.00967126 0.00978733 0) (0.00969466 0.00428204 0) (0.00944999 -0.0017111 0) (0.0089062 -0.00804567 0) (0.00809208 -0.0145403 0) (0.00706656 -0.0209646 0) (0.00595192 -0.0271074 0) (0.00487112 -0.0330904 0) (0.00380971 -0.039702 0) (0.0025932 -0.0473584 0) (0.00268529 -0.055198 0) (7.95093e-05 -0.0031718 0) (0.000273664 0.00272606 0) (0.00073224 0.0085997 0) (0.00135043 0.0134771 0) (0.00210994 0.0171998 0) (0.00299241 0.0198546 0) (0.00400735 0.0216689 0) (0.00515217 0.0227 0) (0.0063806 0.0230337 0) (0.00764962 0.0226071 0) (0.00888882 0.0214409 0) (0.0100119 0.019433 0) (0.0109667 0.0167233 0) (0.0116955 0.0132535 0) (0.0121483 0.00907896 0) (0.0122845 0.00427415 0) (0.0120847 -0.000994841 0) (0.0115452 -0.00665857 0) (0.0106732 -0.0125558 0) (0.00951151 -0.0185114 0) (0.00816191 -0.0243446 0) (0.00675147 -0.0300964 0) (0.00527574 -0.0363581 0) (0.00355464 -0.0436518 0) (0.00322924 -0.0511452 0) (-0.000274004 -0.00333417 0) (-0.000160333 0.00237922 0) (0.000178678 0.00784192 0) (0.00089191 0.0123129 0) (0.00189562 0.0156591 0) (0.00310803 0.0179407 0) (0.00449502 0.0194366 0) (0.00602252 0.0202597 0) (0.00762699 0.0204703 0) (0.00924649 0.0200254 0) (0.0108179 0.01901 0) (0.0122538 0.0174098 0) (0.0134875 0.015149 0) (0.0144694 0.0122633 0) (0.0151455 0.00878226 0) (0.0154681 0.00478249 0) (0.0154081 0.000304221 0) (0.0149535 -0.00453929 0) (0.0140931 -0.00963638 0) (0.0128333 -0.0148685 0) (0.0112278 -0.0201073 0) (0.00939458 -0.0253698 0) (0.00735416 -0.0310949 0) (0.00488377 -0.03794 0) (0.00373728 -0.0451206 0) (-0.00181939 -0.00138036 0) (-0.00157855 0.00382931 0) (-0.0011286 0.00840406 0) (7.86245e-05 0.011853 0) (0.0016288 0.0144645 0) (0.00338117 0.0162631 0) (0.00529921 0.0173789 0) (0.00733702 0.017974 0) (0.00942523 0.0181238 0) (0.0114829 0.0178304 0) (0.0134364 0.0170882 0) (0.0152292 0.015867 0) (0.0168089 0.0142039 0) (0.018108 0.0120237 0) (0.0190575 0.00934041 0) (0.0196138 0.0061861 0) (0.0197595 0.00267249 0) (0.019458 -0.00114585 0) (0.0186699 -0.00518582 0) (0.0173724 -0.00936785 0) (0.0155561 -0.0136184 0) (0.0133123 -0.0179608 0) (0.0107961 -0.0227057 0) (0.00758452 -0.0286732 0) (0.00531206 -0.0355491 0) (-0.00422375 -0.00408884 0) (-0.00401006 -0.000480149 0) (-0.00248205 0.00178811 0) (-0.000144759 0.00374416 0) (0.00224984 0.00543395 0) (0.00462902 0.0065908 0) (0.00702338 0.00734457 0) (0.00945397 0.00778061 0) (0.0118981 0.00788315 0) (0.0142995 0.00768937 0) (0.0165975 0.00717784 0) (0.0187317 0.00632668 0) (0.0206433 0.00507609 0) (0.0222656 0.00345886 0) (0.0235224 0.0014635 0) (0.0243476 -0.000883964 0) (0.0246813 -0.00357319 0) (0.0244967 -0.00651791 0) (0.0237789 -0.00961772 0) (0.022516 -0.0127636 0) (0.020724 -0.0158805 0) (0.0184882 -0.0190364 0) (0.0160148 -0.0223955 0) (0.01267 -0.0265092 0) (0.00827521 -0.0321711 0) (-0.00288995 -0.0251799 0) (-0.00402394 -0.0284882 0) (-0.00135004 -0.0296543 0) (0.00142339 -0.0287054 0) (0.00408827 -0.026943 0) (0.00663394 -0.0253159 0) (0.00911116 -0.0241284 0) (0.0116084 -0.0233945 0) (0.0141518 -0.0230417 0) (0.0167107 -0.0230631 0) (0.0192306 -0.0234504 0) (0.0216412 -0.0241925 0) (0.0238558 -0.0252877 0) (0.0257826 -0.0267393 0) (0.0273245 -0.0285443 0) (0.0283812 -0.0306902 0) (0.0288564 -0.0331499 0) (0.0286678 -0.0358806 0) (0.0277651 -0.038845 0) (0.0261627 -0.0419903 0) (0.02396 -0.0451904 0) (0.0212893 -0.0481702 0) (0.0182235 -0.050269 0) (0.0146522 -0.0503659 0) (0.00615347 -0.0472349 0) (0.0285849 -0.0655476 0) (0.0153406 -0.0798068 0) (0.0100003 -0.0827882 0) (0.00719405 -0.0799297 0) (0.00670213 -0.0755352 0) (0.00772616 -0.0718137 0) (0.0096157 -0.069225 0) (0.0119826 -0.067596 0) (0.0146107 -0.0666668 0) (0.0173684 -0.066261 0) (0.0201486 -0.0663004 0) (0.022851 -0.0667383 0) (0.0253773 -0.0675599 0) (0.027625 -0.0687641 0) (0.029483 -0.070356 0) (0.0308281 -0.0723427 0) (0.0315268 -0.0747381 0) (0.0314315 -0.0775778 0) (0.0303603 -0.0809556 0) (0.0280516 -0.0850638 0) (0.0241008 -0.0900943 0) (0.0178494 -0.0958719 0) (0.0083634 -0.100589 0) (-0.00485872 -0.0991118 0) (-0.0282954 -0.0835359 0) (0.112998 -0.0516375 0) (0.0547252 -0.093572 0) (0.0262034 -0.10192 0) (0.0105441 -0.0980849 0) (0.00453668 -0.0913441 0) (0.00418227 -0.0857192 0) (0.00646779 -0.0819732 0) (0.00975356 -0.0797237 0) (0.013336 -0.078464 0) (0.0169654 -0.0778685 0) (0.0205398 -0.0777933 0) (0.0239866 -0.0781698 0) (0.0272368 -0.0789794 0) (0.0302084 -0.080227 0) (0.0328055 -0.0819267 0) (0.0349183 -0.0841006 0) (0.0364252 -0.0867882 0) (0.0371803 -0.0900959 0) (0.0369328 -0.0942812 0) (0.03506 -0.0998226 0) (0.0299893 -0.107346 0) (0.01826 -0.116827 0) (-0.0058676 -0.124747 0) (-0.0485083 -0.119386 0) (-0.133882 -0.0700378 0) (0.252321 0.0365796 0) (0.110544 -0.131921 0) (0.0365775 -0.129404 0) (0.00399287 -0.112055 0) (-0.00643667 -0.0961936 0) (-0.005365 -0.0856516 0) (-0.000139765 -0.0798598 0) (0.00574666 -0.0769895 0) (0.0112594 -0.0756435 0) (0.016343 -0.0751175 0) (0.0211168 -0.0751607 0) (0.0256389 -0.0756915 0) (0.0299111 -0.0766989 0) (0.0338887 -0.0781953 0) (0.037507 -0.0802004 0) (0.0407045 -0.0827401 0) (0.0434644 -0.0858571 0) (0.0458488 -0.0897121 0) (0.0478798 -0.0948279 0) (0.0489728 -0.102516 0) (0.0462864 -0.115278 0) (0.0316286 -0.135883 0) (-0.0102373 -0.162775 0) (-0.109844 -0.177848 0) (-0.315177 0.0263943 0) (0.352327 0.243988 0) (0.27842 -0.25699 0) (0.0186375 -0.193381 0) (-0.0302611 -0.138824 0) (-0.0350489 -0.103253 0) (-0.0237042 -0.0835994 0) (-0.0100895 -0.0750176 0) (0.000849254 -0.0720166 0) (0.00911226 -0.0711708 0) (0.0158621 -0.0710898 0) (0.0219138 -0.071454 0) (0.027599 -0.0722561 0) (0.033025 -0.0735484 0) (0.0381723 -0.0753851 0) (0.0429885 -0.0777909 0) (0.0474486 -0.0807606 0) (0.0516971 -0.0842514 0) (0.0563423 -0.088386 0) (0.0626149 -0.0940643 0) (0.0718328 -0.104307 0) (0.0820669 -0.126066 0) (0.0794809 -0.169556 0) (0.0272595 -0.245654 0) (-0.290941 -0.347578 0) (-0.46717 0.262495 0) (0.00410222 0.158036 0) (0.177242 -0.056306 0) (-0.0992947 -0.245345 0) (-0.119865 -0.118475 0) (-0.089719 -0.0738539 0) (-0.0531845 -0.0548986 0) (-0.0254867 -0.0502653 0) (-0.00746903 -0.0497892 0) (0.00483709 -0.0508276 0) (0.0143986 -0.0513684 0) (0.0230539 -0.0516345 0) (0.0314636 -0.0512007 0) (0.0401074 -0.0496094 0) (0.0486068 -0.0482791 0) (0.0566709 -0.0472961 0) (0.0641285 -0.0468883 0) (0.0708663 -0.0458688 0) (0.077507 -0.043572 0) (0.0868286 -0.0397677 0) (0.104292 -0.0383394 0) (0.132667 -0.0511834 0) (0.165357 -0.103869 0) (0.15849 -0.266632 0) (-0.187899 -0.0780086 0) (-0.0255728 0.181307 0) (-0.0425973 0.176489 0) (-0.0473441 0.188651 0) (-0.0841643 0.164706 0) (-0.0752968 0.0651635 0) (-0.048303 -0.0222605 0) (-0.033585 -0.0469441 0) (-0.0212165 -0.0515152 0) (-0.0120595 -0.0464673 0) (-0.00668712 -0.0394578 0) (-0.00241862 -0.0345725 0) (-3.57303e-05 -0.0322976 0) (0.00189199 -0.0282206 0) (0.00538216 -0.0217356 0) (0.0123141 -0.0156545 0) (0.0230858 -0.00784775 0) (0.0369383 0.0022997 0) (0.0573114 0.0276249 0) (0.0767143 0.0591883 0) (0.0917473 0.0898761 0) (0.100139 0.128228 0) (0.0991824 0.171281 0) (0.0947192 0.201102 0) (0.072072 0.205013 0) (0.0362902 0.197888 0) (0.032569 0.177691 0) (-0.0294188 0.294207 0) (-0.0318037 0.269178 0) (-0.0545866 0.182557 0) (-0.0423923 0.0136752 0) (-0.0196469 -0.0718432 0) (-0.0158725 -0.0816387 0) (-0.0074463 -0.0719443 0) (-0.00393068 -0.0563774 0) (-0.00181081 -0.0444383 0) (-0.000663024 -0.0375952 0) (-0.000115642 -0.032748 0) (0.000155665 -0.0295695 0) (0.000901192 -0.0267658 0) (0.00246375 -0.0270856 0) (0.00562025 -0.0294192 0) (0.0114111 -0.0315851 0) (0.0201048 -0.0276768 0) (0.0351353 -0.0116222 0) (0.0560674 0.0312916 0) (0.0719903 0.0957379 0) (0.0804004 0.16524 0) (0.078061 0.23167 0) (0.0671795 0.281148 0) (0.0374182 0.298528 0) (0.0292931 0.290131 0) ) ; boundaryField { inlet { type fixedValue; value uniform (0 0 0); } outlet { type pressureInletOutletVelocity; phi phi.water; value nonuniform List<vector> 25 ( (-0.0294188 0.294207 0) (-0.0318037 0.269178 0) (-0.0545866 0.182557 0) (-0.0423923 0.0136752 0) (-0 -0.0727288 0) (-0 -0.0820211 0) (-0 -0.072142 0) (-0 -0.0564771 0) (-0 -0.0444765 0) (-0 -0.0375983 0) (-0 -0.0327438 0) (0 -0.0295571 0) (0 -0.0267603 0) (0 -0.0270904 0) (0 -0.029481 0) (0 -0.0318166 0) (0 -0.0283057 0) (0 -0.0129078 0) (0.0560674 0.0312916 0) (0.0719903 0.0957379 0) (0.0804004 0.16524 0) (0.078061 0.23167 0) (0.0671795 0.281148 0) (0.0374182 0.298528 0) (0.0292931 0.290131 0) ) ; } walls { type fixedValue; value uniform (0 0 0); } defaultFaces { type empty; } } // ************************************************************************* //
49117f56b3cef6887aca5ce7951b9e6a7326aebb
64178ab5958c36c4582e69b6689359f169dc6f0d
/vscode/wg/sdk/FLightmassPointLightSettings.hpp
b183af8083f12e1e84149159b14d896fd37c1d54
[]
no_license
c-ber/cber
47bc1362f180c9e8f0638e40bf716d8ec582e074
3cb5c85abd8a6be09e0283d136c87761925072de
refs/heads/master
2023-06-07T20:07:44.813723
2023-02-28T07:43:29
2023-02-28T07:43:29
40,457,301
5
5
null
2023-05-30T19:14:51
2015-08-10T01:37:22
C++
UTF-8
C++
false
false
586
hpp
FLightmassPointLightSettings.hpp
#pragma once #include "FLightmassLightSettings.hpp" #ifdef _MSC_VER #pragma pack(push, 1) #endif namespace PUBGSDK { struct alignas(1) FLightmassPointLightSettings // Size: 0xC : public FLightmassLightSettings // Size: 0xC { public: }; #ifdef VALIDATE_SDK namespace Validation{ auto constexpr sizeofFLightmassPointLightSettings = sizeof(FLightmassPointLightSettings); // 12 static_assert(sizeof(FLightmassPointLightSettings) == 0xC, "Size of FLightmassPointLightSettings is not correct."); } #endif } #ifdef _MSC_VER #pragma pack(pop) #endif
d4dd3f5b9863fc04681d11f3c3a396ccb34d03a0
38ec1fcc95781b8e244b2cc6801980d22fec4cb2
/uva-solutions/cf1A.cpp
acd4eb6cde4c7040a5ee63dcc65aa7056089511b
[]
no_license
techyvish/uva-solutions
e88a349f5126f184a6928bf481cedc4a66e6e232
6ac2290b64836fee5f952c13ab2e800b9f6a2fa2
refs/heads/master
2021-01-20T00:48:29.121266
2015-10-04T13:46:30
2015-10-04T13:46:30
38,370,878
0
0
null
null
null
null
UTF-8
C++
false
false
917
cpp
cf1A.cpp
// // Created by Vishal Patel on 7/5/15. // Copyright (c) 2015 Vishal Patel. All rights reserved. // #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream> #include<cctype> #include<map> #include<stack> #include<cstdlib> #include <queue> #include <vector> #include<algorithm> #include <string> #include <fstream> #include <ostream> #include <sstream> #include <string> #include <fstream> #include <ostream> #include <sstream> #include <iomanip> #define fin cin #define ll long long #define sc scanf #define pf printf #define Pi 2*acos(0.0) using namespace std; int main_cf1A() { //fstream fin("/Users/vishal/Cerebro/uva-solutions/uva-solutions/cf1A.txt"); long long a =0 ,b = 0,c =0; fin >> a >> b >> c; double rema = a%c ? 1 : 0; double remb = b%c ? 1 : 0 ; long long k = ((a/c) + rema); long long j = ((b/c) + remb); cout << j*k; return 0; }
70b4b84546d9179fa7e7b98f439aebcfb2b41a8c
1e5e30a157cb009a7a40ba7de5b2751101d62710
/SNACS/branches/branch_001/snacs/trunk/snSimulation/snFIRFilter.cpp
5b9c333ee95fea53938686ed86cf39b3c0f34835
[]
no_license
zhufengGNSS/GNSSDDM
630cfb7dbc83e8cc04631516223bdcec750a3b06
22de16723fc2abd5b8c2ab1753b386db7542eb74
refs/heads/master
2022-12-05T00:31:50.464294
2020-08-26T10:51:11
2020-08-26T10:51:11
295,369,687
1
0
null
2020-09-14T09:36:43
2020-09-14T09:36:43
null
UTF-8
C++
false
false
1,660
cpp
snFIRFilter.cpp
/* * SNACS - The Satellite Navigation Radio Channel Simulator * * Copyright (C) 2009 F. M. Schubert * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ /** * \file snFIRFilter.cpp * * \author Frank Schubert */ #include "snFIRFilter.h" /** * \brief implements a FIR filter * @param pdataIn pointer to input array * @param pdataOut pointer to output array * @param pn number of input samples * @param pcoeff pointer to coefficients array * @param pm number of coefficients */ snFIRFilter::snFIRFilter(itpp::vec *pdataIn, itpp::vec *pdataOut, int pdata_len, itpp::vec *pcoeff, int pfilter_order) : QThread(), dataIn(pdataIn), dataOut(pdataOut), n(pdata_len), coeff(pcoeff), filter_order(pfilter_order) { //std::cout << "\n setting up new FIR filter. n = " << n << ", m = " << m; state.set_length(filter_order+1); state.zeros(); state_out.set_length(state.size()); } snFIRFilter::~snFIRFilter() { } void snFIRFilter::run() { *dataOut = itpp::filter(*coeff, 1, *dataIn, state, state_out);; state = state_out; }
ba4dc7d2ad73a658b48cbd67f4135035f9213c7a
d3bf068ac90138457dd23649736f95a8793c33ae
/PFAResult/inc/ComponentTranOutMgr.h
4a926798743b8032eb8871a562b6d388f238ecc5
[]
no_license
xxxmen/uesoft-AutoPFA
cab49bfaadf716de56fef8e9411c070a4b1585bc
f9169e203d3dc3f2fd77cde39c0bb9b4bdf350a6
refs/heads/master
2020-03-13T03:38:50.244880
2013-11-12T05:52:34
2013-11-12T05:52:34
130,947,910
1
2
null
null
null
null
UTF-8
C++
false
false
931
h
ComponentTranOutMgr.h
// ComponentTranOutMgr.h: interface for the ComponentTranOutMgr class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_COMPONENTTRANOUTMGR_H__597AE7D7_E6E1_4688_8BB4_6899006CC35A__INCLUDED_) #define AFX_COMPONENTTRANOUTMGR_H__597AE7D7_E6E1_4688_8BB4_6899006CC35A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "PipeTranOutMgr.h" #include "JunTranOutMgr.h" class UnitSubSystem; class OutputRefPersist; class AFX_EXT_CLASS ComponentTranOutMgr { public: BOOL IsEmpty(); void TimeStep(double dTime); void EmptyOut(); PipeTranOutMgr& PipeOutMgr(); JunTranOutMgr& JunOutMgr(); ComponentTranOutMgr(UnitSubSystem &unitsys,OutputRefPersist &OutPutData); virtual ~ComponentTranOutMgr(); private: JunTranOutMgr m_junOutMgr; PipeTranOutMgr m_pipeOutMgr; }; #endif // !defined(AFX_COMPONENTTRANOUTMGR_H__597AE7D7_E6E1_4688_8BB4_6899006CC35A__INCLUDED_)
e469512867c68972b6f69c7166aa0112754feee2
480a636bd44373abe85245c03271a4a273c5bd60
/2nd sem/labs/2.cpp
cf363f591ed060792bcf9597f133ed131be9300e
[]
no_license
allf1337/lab1st
bdc7161b89d5e14c338c0219cc015a7949076526
20bf6387fa6c06b13a957b9b7441410e0295f0a7
refs/heads/master
2023-03-26T07:57:32.727640
2021-03-11T11:14:06
2021-03-11T11:14:06
298,055,466
0
0
null
null
null
null
UTF-8
C++
false
false
444
cpp
2.cpp
#include "stdafx.h" #include <iostream> #include <locale.h> using namespace std; int main() { setlocale(LC_ALL, "Russian"); int number,tens,units, sum, composition; cout << "Введите двузначное число: "; cin >> number; if (number > 99 | number < 9) cout << "Данное число не двузначно "<< endl; tens = number / 10; units = number % 10; cout << units << tens << endl; return 0; }
f76f9d69387df3e002567f737e556c78f0abf0e6
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/components/gcm_driver/crypto/encryption_header_parsers.cc
6148cae6851ceeec1e798f58add949a2809109fa
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
4,754
cc
encryption_header_parsers.cc
// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/gcm_driver/crypto/encryption_header_parsers.h" #include "base/base64url.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" namespace gcm { namespace { // The default record size in bytes, as defined in section two of // https://tools.ietf.org/html/draft-thomson-http-encryption. const uint64_t kDefaultRecordSizeBytes = 4096; // Decodes the string in |value| using base64url and writes the decoded value to // |*salt|. Returns whether the string is not empty and could be decoded. bool ValueToDecodedString(base::StringPiece value, std::string* salt) { if (value.empty()) return false; return base::Base64UrlDecode( value, base::Base64UrlDecodePolicy::IGNORE_PADDING, salt); } // Parses the record size in |value| and writes the value to |*rs|. The value // must be a positive decimal integer greater than one that does not start // with a plus. Returns whether the record size was valid. bool RecordSizeToInt(base::StringPiece value, uint64_t* rs) { if (value.empty()) return false; // Reject a leading plus, as the fact that the value must be positive is // dictated by the specification. if (value[0] == '+') return false; uint64_t candidate_rs; if (!base::StringToUint64(value, &candidate_rs)) return false; // The record size MUST be greater than one byte. if (candidate_rs <= 1) return false; *rs = candidate_rs; return true; } } // namespace EncryptionHeaderIterator::EncryptionHeaderIterator( std::string::const_iterator header_begin, std::string::const_iterator header_end) : iterator_(header_begin, header_end, ','), rs_(kDefaultRecordSizeBytes) {} EncryptionHeaderIterator::~EncryptionHeaderIterator() {} bool EncryptionHeaderIterator::GetNext() { keyid_.clear(); salt_.clear(); rs_ = kDefaultRecordSizeBytes; if (!iterator_.GetNext()) return false; net::HttpUtil::NameValuePairsIterator name_value_pairs( iterator_.value_begin(), iterator_.value_end(), ';', net::HttpUtil::NameValuePairsIterator::Values::REQUIRED, net::HttpUtil::NameValuePairsIterator::Quotes::NOT_STRICT); bool found_keyid = false; bool found_salt = false; bool found_rs = false; while (name_value_pairs.GetNext()) { const base::StringPiece name = name_value_pairs.name_piece(); const base::StringPiece value = name_value_pairs.value_piece(); if (base::EqualsCaseInsensitiveASCII(name, "keyid")) { if (found_keyid) return false; keyid_ = value; found_keyid = true; } else if (base::EqualsCaseInsensitiveASCII(name, "salt")) { if (found_salt || !ValueToDecodedString(value, &salt_)) return false; found_salt = true; } else if (base::EqualsCaseInsensitiveASCII(name, "rs")) { if (found_rs || !RecordSizeToInt(value, &rs_)) return false; found_rs = true; } else { // Silently ignore unknown directives for forward compatibility. } } return name_value_pairs.valid(); } CryptoKeyHeaderIterator::CryptoKeyHeaderIterator( std::string::const_iterator header_begin, std::string::const_iterator header_end) : iterator_(header_begin, header_end, ',') {} CryptoKeyHeaderIterator::~CryptoKeyHeaderIterator() {} bool CryptoKeyHeaderIterator::GetNext() { keyid_.clear(); aesgcm128_.clear(); dh_.clear(); if (!iterator_.GetNext()) return false; net::HttpUtil::NameValuePairsIterator name_value_pairs( iterator_.value_begin(), iterator_.value_end(), ';', net::HttpUtil::NameValuePairsIterator::Values::REQUIRED, net::HttpUtil::NameValuePairsIterator::Quotes::NOT_STRICT); bool found_keyid = false; bool found_aesgcm128 = false; bool found_dh = false; while (name_value_pairs.GetNext()) { const base::StringPiece name = name_value_pairs.name_piece(); const base::StringPiece value = name_value_pairs.value_piece(); if (base::EqualsCaseInsensitiveASCII(name, "keyid")) { if (found_keyid) return false; keyid_ = value; found_keyid = true; } else if (base::EqualsCaseInsensitiveASCII(name, "aesgcm128")) { if (found_aesgcm128 || !ValueToDecodedString(value, &aesgcm128_)) return false; found_aesgcm128 = true; } else if (base::EqualsCaseInsensitiveASCII(name, "dh")) { if (found_dh || !ValueToDecodedString(value, &dh_)) return false; found_dh = true; } else { // Silently ignore unknown directives for forward compatibility. } } return name_value_pairs.valid(); } } // namespace gcm
0969374285237ac1bf633141394abca515317d42
6b28d9a072b59b5fa6b527fd60f26b8a997f01d8
/Microsoft.WindowsAzure.Storage/tests/main.cpp
2e6f4af987986c46ace9f2dbd6516dd7b72ec510
[ "Apache-2.0" ]
permissive
mildwolf/azure-storage-cpp
030b7d15bbfb523d8fc75496a6f009264fc425c4
5486e18ef0de786479e44c2cf58b2c139b1a29f0
refs/heads/master
2020-03-10T05:13:47.255408
2019-08-07T02:19:47
2019-08-07T02:19:47
129,212,501
0
0
Apache-2.0
2018-04-12T07:41:12
2018-04-12T07:41:11
null
UTF-8
C++
false
false
2,732
cpp
main.cpp
// ----------------------------------------------------------------------------------------- // <copyright file="main.cpp" company="Microsoft"> // Copyright 2013 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // ----------------------------------------------------------------------------------------- #include "stdafx.h" #include "was/blob.h" #ifndef _WIN32 #include <boost/log/core.hpp> #include <boost/log/trivial.hpp> #include <boost/log/expressions.hpp> #include <boost/log/utility/setup/file.hpp> #include <boost/log/utility/setup/common_attributes.hpp> #endif int run_tests(const char* suite_name, const char* test_name) { UnitTest::TestReporterStdout reporter; UnitTest::TestRunner runner(reporter); return runner.RunTestsIf(UnitTest::Test::GetTestList(), suite_name, [test_name] (UnitTest::Test* test) -> bool { return (test_name == NULL) || (!strcmp(test_name, test->m_details.testName)); }, 0); } int main(int argc, const char* argv[]) { azure::storage::operation_context::set_default_log_level(azure::storage::client_log_level::log_level_verbose); #ifndef _WIN32 boost::log::add_common_attributes(); boost::log::add_file_log ( boost::log::keywords::file_name = "test_log.log", boost::log::keywords::format = ( boost::log::expressions::stream << "<Sev: " << boost::log::trivial::severity << "> " << boost::log::expressions::smessage ) ); #endif int failure_count; if (argc == 1) { failure_count = run_tests(NULL, NULL); } else { failure_count = 0; for (int i = 1; i < argc; ++i) { std::string arg(argv[i]); auto colon = arg.find(':'); if (colon == std::string::npos) { failure_count += run_tests(argv[i], NULL); } else { auto suite_name = arg.substr(0, colon); auto test_name = arg.substr(colon + 1); failure_count += run_tests(suite_name.c_str(), test_name.c_str()); } } } return failure_count; }
37027a50625940a0d131c378a617326f463dfbb8
ea54021e59910ae07c171a556f487f3403f79f6c
/VisualStudioProjects/VC7/COM/KeyInput/KeyInput/CKeyInput.cpp
882555e4e9188feb78345ebcc70df8ae85b2364d
[]
no_license
15831944/pre2006
e56441c0e511a5b4695d970d8a9a14b343ccc675
7d38b738fb74fa8987fa49bf2598be74645ebbd0
refs/heads/master
2023-02-24T19:57:40.843660
2021-01-19T13:01:19
2021-01-19T13:01:19
null
0
0
null
null
null
null
GB18030
C++
false
false
2,886
cpp
CKeyInput.cpp
// CKeyInput.cpp : 实现文件 // #include "stdafx.h" #include "KeyInput.h" #include "CKeyInput.h" #include ".\ckeyinput.h" // CKeyInput IMPLEMENT_DYNCREATE(CKeyInput, CCmdTarget) CKeyInput::CKeyInput() { EnableAutomation(); EnableConnections(); // 为了使应用程序在 OLE 自动化对象处于活动状态时保持 // 运行,构造函数调用 AfxOleLockApp。 g_pKeyInput = this; g_hKeyHook = ::SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, AfxGetInstanceHandle(), ::GetCurrentThreadId()); TRACE(_T("%s(%d) : 安装键盘钩子\n"), __FILE__, __LINE__); AfxOleLockApp(); } CKeyInput::~CKeyInput() { // 为了在用 OLE 自动化创建所有对象后终止应用程序, // 析构函数调用 AfxOleUnlockApp。 AfxOleUnlockApp(); UnhookWindowsHookEx(g_hKeyHook); } void CKeyInput::OnFinalRelease() { // 释放了对自动化对象的最后一个引用后,将调用 // OnFinalRelease。基类将自动 // 删除该对象。在调用该基类之前,请添加您的 // 对象所需的附加清除代码。 CCmdTarget::OnFinalRelease(); } BEGIN_MESSAGE_MAP(CKeyInput, CCmdTarget) END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CKeyInput, CCmdTarget) END_DISPATCH_MAP() BEGIN_INTERFACE_MAP(CKeyInput, CCmdTarget) INTERFACE_PART(CKeyInput, IID_IKeyInput, Dispatch) INTERFACE_PART(CKeyInput, IID_IConnectionPointContainer, ConnPtContainer) END_INTERFACE_MAP() BEGIN_CONNECTION_MAP(CKeyInput, CCmdTarget) CONNECTION_PART(CKeyInput, IID_IKeyEvents, KeyEventsConnPt) END_CONNECTION_MAP() // {7C6F1364-8C73-4335-B6FD-C61D53681573} IMPLEMENT_OLECREATE_FLAGS(CKeyInput, "KeyInput.KeyInput", afxRegApartmentThreading, 0x7c6f1364, 0x8c73, 0x4335, 0xb6, 0xfd, 0xc6, 0x1d, 0x53, 0x68, 0x15, 0x73) // CKeyInput 消息处理程序 void CKeyInput::FireEventV(DISPID dispid, BYTE* pbParams, va_list argList) { COleDispatchDriver driver; POSITION pos = m_xKeyEventsConnPt.GetStartPosition(); LPDISPATCH pDispatch; while (pos != NULL) { pDispatch = (LPDISPATCH)m_xKeyEventsConnPt.GetNextConnection(pos); if(pDispatch != NULL) { driver.AttachDispatch(pDispatch, FALSE); TRY driver.InvokeHelperV(dispid, DISPATCH_METHOD, VT_EMPTY, NULL, pbParams, argList); END_TRY driver.DetachDispatch(); } } } void AFX_CDECL CKeyInput::FireEvent(DISPID dispid, BYTE* pbParams, ...) { va_list argList; va_start(argList, pbParams); FireEventV(dispid, pbParams, argList); va_end(argList); } LRESULT CALLBACK KeyboardProc(int nCode, //指定是否需要处理该消息 WPARAM wParam, //虚拟键值 LPARAM lParam ) { MessageBox(NULL, _T("OK"), NULL, MB_OK); return CallNextHookEx(g_hKeyHook, nCode, wParam, lParam); } void CKeyInput::a(void) { }
e5e2abc181d6bf83f9c59334a88d46461a3eed0a
c15d124ea20024ed94884e0d457a4e24f024b377
/1357_dp_矩阵快速幂.cpp
b5a684058ae8bbc5fc48bc2b498b6935d04098ab
[]
no_license
zm2417/luogu-cpp
34e37afaf96f17e45f1ccb2b883dea5584b332d0
40d4960dc7ccf84168707fd5f0285b2e325eb03f
refs/heads/master
2020-12-21T02:24:12.088314
2020-03-11T07:44:39
2020-03-11T07:44:39
236,278,364
0
0
null
null
null
null
UTF-8
C++
false
false
1,653
cpp
1357_dp_矩阵快速幂.cpp
#include <iostream> using namespace std; const long long MOD = 1000000007; long long n, m, k, ans; int lim; struct node { long long t[64][64]; } re, x; int ok[64], bin[6]; //ok:是否是合法状态 void work(int zt, int num) { ok[zt] = 1; int kl = zt >> 1; x.t[kl][zt] = 1; // 判断后面能否为1 if (num == k && !(zt & 1)) return; x.t[kl + bin[m]][zt] = 1; } void dfs(int x, int num, int zt) { if (x == m + 1) { work(zt, num); return; } dfs(x + 1, num, zt); if (num < k) dfs(x + 1, num + 1, zt | bin[x]); } node operator*(node a, node b) { int i, j, k; node c; for (i = 0; i <= lim; ++i) for (j = 0; j <= lim; ++j) { c.t[i][j] = 0; for (k = 0; k <= lim; ++k) c.t[i][j] += a.t[i][k] * b.t[k][j] % MOD, c.t[i][j] %= MOD; } return c; } // 快速幂 void ksm() { int bj = 0; while (n) { if (n & 1) { if (!bj) re = x, bj = 1; else re = re * x; } x = x * x; n >>= 1; } } int main() { bin[1] = 1; for (int i = 2; i <= 5; ++i) bin[i] = bin[i - 1] << 1; cin >> n >> m >> k; lim = (1 << m) - 1; dfs(1, 0, 0); ksm(); // 由于所有的花圃是一个环,所以第1~m个花圃就是第n+1~n+m个花圃,所以我们求的答案就是一个合法状态转移n次,转移回原状态的方案数之和。 for (int i = 0; i <= lim; ++i) if (ok[i]) ans += re.t[i][i], ans %= MOD; cout << ans << endl; return 0; }
c031108e0cfb3fcebbca8e48291afd3c05cf0ceb
ac8ffabf4d7339c5466e53dafc3f7e87697f08eb
/python_solutions/1221.split-a-string-in-balanced-strings.cpp
b8e638df6d4bad65a51c996cab4105a454d1b4bf
[]
no_license
h4hany/leetcode
4cbf23ea7c5b5ecfd26aef61bfc109741f881591
9e4f6f1a2830bd9aab1bba374c98f0464825d435
refs/heads/master
2023-01-09T17:39:06.212421
2020-11-12T07:26:39
2020-11-12T07:26:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,457
cpp
1221.split-a-string-in-balanced-strings.cpp
/* * @lc app=leetcode id=1221 lang=cpp * * [1221] Split a String in Balanced Strings * * https://leetcode.com/problems/split-a-string-in-balanced-strings/description/ * * algorithms * Easy (78.31%) * Total Accepted: 16.7K * Total Submissions: 21.3K * Testcase Example: '"RLRRLLRLRL"' * * Balanced strings are those who have equal quantity of 'L' and 'R' * characters. * * Given a balanced string s split it in the maximum amount of balanced * strings. * * Return the maximum amount of splitted balanced strings. * * * Example 1: * * * Input: s = "RLRRLLRLRL" * Output: 4 * Explanation: s can be split into "RL", "RRLL", "RL", "RL", each substring * contains same number of 'L' and 'R'. * * * Example 2: * * * Input: s = "RLLLLRRRLR" * Output: 3 * Explanation: s can be split into "RL", "LLLRRR", "LR", each substring * contains same number of 'L' and 'R'. * * * Example 3: * * * Input: s = "LLLLRRRR" * Output: 1 * Explanation: s can be split into "LLLLRRRR". * * * * Constraints: * * * 1 <= s.length <= 1000 * s[i] = 'L' or 'R' * * */ class Solution { public: int balancedStringSplit(string s) { int balance = 0, res = 0; for(auto &c: s) { balance += c == 'L' ? 1 : -1; if (balance == 0) res ++; } return res; } }; static const int _ = []() { ios::sync_with_stdio(false); cin.tie(NULL);return 0; }();
25ad54a6f91c5e59af5195c9d0e269619a275157
d129923ee05243e11668bc2c6102a65997a269b0
/src/DBFile.h
64ba8961b36209d5b4934c8ff4d358ba49cd7506
[]
no_license
vikramsk/sequel
82e8cc07b1eb9b094cf0a639bb7436e08cff3e54
b292cdaa28e790ecc2d64ff2cbee5a1c66e639cc
refs/heads/master
2021-03-27T13:33:40.293837
2018-05-02T15:04:30
2018-05-02T15:04:30
117,310,418
0
0
null
null
null
null
UTF-8
C++
false
false
2,905
h
DBFile.h
#ifndef DBFILE_H #define DBFILE_H #include "BigQ.h" #include "Comparison.h" #include "ComparisonEngine.h" #include "File.h" #include "Record.h" #include "Schema.h" #include "TwoWayList.h" typedef enum { heap, sorted, tree } fType; typedef enum { READ, WRITE } modeType; class GenericDBFile { private: fType fileType; public: modeType mode; File dataFile; virtual int Create(const char *fpath, fType file_type, void *startup) = 0; virtual int Open(const char *fpath) = 0; virtual int Close() = 0; virtual void Load(Schema &myschema, const char *loadpath) = 0; virtual void MoveFirst() = 0; virtual void Add(Record &addme) = 0; virtual int GetNext(Record &fetchme) = 0; virtual int GetNext(Record &fetchme, CNF &cnf, Record &literal) = 0; }; class HeapDBFile : public virtual GenericDBFile { private: Page buffer; off_t pageIndex; void flushBuffer(); void bufferAppend(Record *rec); public: HeapDBFile(); ~HeapDBFile(); int Create(const char *fpath, fType file_type, void *startup); int Open(const char *fpath); int Close(); void Load(Schema &myschema, const char *loadpath); void MoveFirst(); void Add(Record &addme); int GetNext(Record &fetchme); int GetNext(Record &fetchme, CNF &cnf, Record &literal); }; class SortedDBFile : public virtual GenericDBFile { private: BigQ *bigQ; Pipe *inPipe; Pipe *outPipe; int runLength; const char *filePath; OrderMaker *originalOrder; OrderMaker *queryOrder; OrderMaker *queryLiteralOrder; Page buffer; off_t pageIndex; void flushBuffer(); void mergeRecords(); int getFirstValidRecord(int &status, Record &fetchme, CNF &cnf, Record &literal); int getEqualToLiteral(Record &fetchme, CNF &cnf, Record &literal); off_t binarySearch(off_t start, off_t end, Record &literal); void readMetaFile(const char *f_path); public: SortedDBFile(const char *filePath); // SortedDBFile(OrderMaker *o, int r); ~SortedDBFile(); int Create(const char *fpath, fType file_type, void *startup); int Open(const char *fpath); int Close(); void Load(Schema &myschema, const char *loadpath); void MoveFirst(); void Add(Record &addme); int GetNext(Record &fetchme); int GetNext(Record &fetchme, CNF &cnf, Record &literal); }; class DBFile { private: GenericDBFile *dbInstance; GenericDBFile *getInstance(const char *f_path); char *filePath; public: DBFile(); ~DBFile(); int Create(const char *fpath, fType file_type, void *startup); int Open(const char *fpath); int Close(); int Delete(); void Load(Schema &myschema, const char *loadpath); void MoveFirst(); void Add(Record &addme); int GetNext(Record &fetchme); int GetNext(Record &fetchme, CNF &cnf, Record &literal); }; #endif
8fc716ea0c99725289acb372d09bcaa6fd616153
830bc266bdbfb6d1b8f0a15b85bafdb59c269c36
/samples/sampleImportExport/InferenceEngine.cpp
90cc68ae8419cc7b22fdbeca46c2f54bdb9f1825
[]
no_license
FrancescoMarchesini/tensorRT
c839d8f80294ddcdf5cd9dc3678dd46e97aa577d
909b8b607a657bdbd7871ca70f3f335d4dc4074c
refs/heads/master
2021-09-15T19:54:14.102719
2018-06-01T23:45:22
2018-06-01T23:45:22
115,917,024
0
1
null
2018-01-02T11:45:15
2018-01-01T12:11:23
null
UTF-8
C++
false
false
4,670
cpp
InferenceEngine.cpp
#include "InferenceEngine.h" #include <fstream> #include <iostream> #include <sstream> motoreDiInferenza::motoreDiInferenza() { } motoreDiInferenza::motoreDiInferenza( const std::string& model_file, const std::string& weights_file) { std::cout<<LOG_GIE<<"Creo il Builder"<<std::endl; nvinfer1::IBuilder* builder = nvinfer1::createInferBuilder(gLogger); std::cout<<LOG_GIE<<"Creo il Modello tramite il parser"<<std::endl; nvinfer1::INetworkDefinition* network = builder->createNetwork(); std::cout<<LOG_GIE<<"parso il modello"<<std::endl; nvcaffeparser1::ICaffeParser* parser = nvcaffeparser1::createCaffeParser(); bool fp16 = builder->platformHasFastFp16(); if(fp16) std::cout<<LOG_GIE<<"bella storia c'è il suporto per fp16 ovvero dataType KHALF"<<std::endl; std::cout<<LOG_GIE<<"Mappo i blob di Caffe sui tensori parsando il file caffe"<<std::endl; const nvcaffeparser1::IBlobNameToTensor* blobNameToTensor = parser->parse(model_file.c_str(), weights_file.c_str(), *network, fp16 ? nvinfer1::DataType::kHALF : nvinfer1::DataType::kFLOAT); if(blobNameToTensor) std::cout<<LOG_GIE<<"Modello parsato correttamente bella storia abbiamo i tensori"<<std::endl; network->markOutput(*blobNameToTensor->find("prob")); std::cout<<LOG_GIE<<"costruisco l'engine"<<std::endl; builder->setMaxBatchSize(1); builder->setMaxWorkspaceSize(1 << 30); builder->setHalf2Mode(fp16); engine_ = builder->buildCudaEngine(*network); if(engine_) { std::cout<<LOG_GIE<<"Motore Costruito Corretamente"<<std::endl; } std::cout<<LOG_GIE<<"distruggo builder e network"<<std::endl; network->destroy(); builder->destroy(); } motoreDiInferenza::~motoreDiInferenza() { std::cout<<LOG_GIE<<"distruggo l'oggetto motoreInferenza"<<std::endl; engine_->destroy(); } void motoreDiInferenza::Esporta(const std::string& plan_file) { std::cout<<LOG_GIE<<"serializzo il modello su file"<<std::endl; std::ofstream gieModelStream(plan_file.c_str(), std::ofstream::binary); nvinfer1::IHostMemory* serMem = engine_->serialize(); gieModelStream.write((const char*)serMem->data(), serMem->size()); } void motoreDiInferenza::Importa(const std::string& plan_file) { std::stringstream gieModelStream; gieModelStream.seekg(0, gieModelStream.beg); std::cout<<LOG_GIE<<"cerco file plane del modello"<<std::endl; char cache_path[512]; //sprintf(cache_path, "%s.tensorcache", "plane"); sprintf(cache_path, plan_file.c_str()); std::cout<<LOG_GIE<<"apro il file "<<cache_path<<std::endl; std::ifstream cache( cache_path ); if(cache) { std::cout<<LOG_GIE<<"file plane trovato carico modello.."<<std::endl; gieModelStream << cache.rdbuf(); cache.close(); std::cout<<LOG_GIE<<"costruisco l'engine a partire dal plane"<<std::endl; std::cout<<LOG_GIE<<"Creo il Builder"<<std::endl; nvinfer1::IBuilder* builder = nvinfer1::createInferBuilder(gLogger); if(builder != NULL){ bool fp16 = builder->platformHasFastFp16(); if(fp16) std::cout<<LOG_GIE<<"bella storia c'è il suporto per fp16 ovvero dataType KHALF"<<std::endl; builder->destroy(); std::cout<<LOG_GIE<<"distruggo il builder"<<std::endl; } } std::cout<<LOG_GIE<<"creo il contesto per l'esecuzione run time"<<std::endl; nvinfer1::IRuntime* infer = nvinfer1::createInferRuntime(gLogger); //determina la fine del file gieModelStream.seekg(0, std::ios::end); //determino la lunghezza del file const int modelSize = gieModelStream.tellg(); std::cout<<LOG_GIE<<"grandezza file plane byte = "<<modelSize<<std::endl; //determino la fine del file gieModelStream.seekg(0, std::ios::beg); std::cout<<LOG_GIE<<"alloco la memoria per deserializzara il modello"<<std::endl; void* modelMem = malloc(modelSize); if(!modelMem){ std::cout<<LOG_GIE<<"azz fallito ad allocare la memoria"<<std::endl; } std::cout<<LOG_GIE<<"leggo il file"<<std::endl; gieModelStream.read((char*)modelMem, modelSize); engine_ = infer->deserializeCudaEngine(modelMem, modelSize, NULL); free(modelMem); if(!engine_){ std::cout<<LOG_GIE<<"Fallito a creare l'engine dal file"<<std::endl; exit(true); }else{ std::cout<<LOG_GIE<<"Bella storia possiamo fare inferenze :) "<<std::endl; } } ///////////////////////////////////////////////////////////////////////////////////// //main////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { motoreDiInferenza* motore = new motoreDiInferenza(); //argv[1], argv[2]); // motore->Esporta(argv[3]); motore->Importa(argv[3]); return 0; }
e866515b2ea799948f09e104c1bc7b0166b00121
3a9de4bd3d74257a7a45de105f8be5d462f768b1
/Mathematics/Function/Computable/Library/a_Macro.hpp
6db50f294c35bc346d5f83ee2461a601a88cc279
[ "MIT" ]
permissive
p-adic/cpp
0ffd97a06f79e744c9ceeee25d409a509812828b
006036e88ed402efd1d55cab3cbe43e58daf6e13
refs/heads/master
2023-08-31T21:59:42.647794
2023-08-31T11:10:46
2023-08-31T11:10:46
228,025,919
4
0
null
null
null
null
UTF-8
C++
false
false
147
hpp
a_Macro.hpp
// c:/Users/user/Documents/Programming/Mathematics/Function/Computable/Basic/a_Macro.hpp #pragma once #define BASIC using namespace QpBasic
b6634c7071354b46bfe5c1789245ca61252f05b0
34382bac2cd600407e0873cf73e1babd6a3149ad
/leq2020/0714/K-找规律.cpp
2cde911d20cb708a4a9cc32bace71d86432c26b8
[]
no_license
windring/CppAlgorithms
a5a2f199e04e66db2dc5e4b8e7b01fad07747b03
3a1489c07bf363cf730c446828515065733fe484
refs/heads/master
2021-01-02T09:19:03.702868
2020-10-21T04:46:01
2020-10-21T04:46:01
99,191,191
0
0
null
2020-10-21T04:46:02
2017-08-03T04:37:57
C++
UTF-8
C++
false
false
898
cpp
K-找规律.cpp
#include <bits/stdc++.h> using namespace std; int st[6500+5]; void shift(string &str,int n){ int len=str.length(); reverse(str.begin(),str.begin()+len-n); reverse(str.begin(),str.end()); } void solve(){ int cnt=0; string str1,str2; cin>>str1>>str2; if(str1==str2){ cout<<0<<endl; return; } string str3=str1,str4=str2; sort(str3.begin(),str3.end()); sort(str4.begin(),str4.end()); if(str3!=str4){ cout<<"-1"<<endl; cout<<"-1"<<endl; return; } int len=str1.length(); for(int i=0;i<len;i++){ int o=int(str1.find(str2[i])); o++; if(o==len)continue; shift(str1,st[cnt++]=len-o); shift(str1,st[cnt++]=1); shift(str1,st[cnt++]=len); } cout<<cnt<<endl; for(int i=0;i<cnt;i++){ cout<<st[i]; if(i!=cnt-1) cout<<" "; else cout<<endl; } } int main(){ int cases; cin>>cases; while(cases--)solve(); return 0; }
0698e8a4419db1165dbdd0f46caaf441bc204ebe
ab2177db3b2a793b1377d41729d9ef3d3b8685c5
/ch6/wwwServer.cpp
46b6328994d6ca7c641d418a8383dca7a45116ed
[]
no_license
mageru/parallelalgo
aa2b931d5e35d6c874e0278e67ab2ed72693c12b
dbd0c29daeb3e524afdd8e53524eb8ede98b0d18
refs/heads/master
2021-01-18T18:32:27.156858
2012-07-19T02:15:36
2012-07-19T02:15:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,199
cpp
wwwServer.cpp
#include <stdio.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <sys/socket.h> /* Run the code until it stops at the accept. Then start a web browser and enter http://localhost/index.html The program should print the content of the HTTP (hypertext transfer protocol) GET packet. If port 80 is already in use or protected, use public port 1080 in the program and try telnet localhost 1080. The program should output the first line entered. */ int main(int argc, char *argv[]) { int i; char str[1024]; int s, news; unsigned int j; struct sockaddr_in si; struct hostent *h; s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); memset(&si, 0, sizeof(si)); h = gethostbyname("localhost"); memcpy(&si.sin_addr, h->h_addr_list[0], sizeof(struct in_addr)); si.sin_port = htons(80); si.sin_family = AF_INET; i = bind(s, (const struct sockaddr *)&si, sizeof(si)); listen(s, 5); j = sizeof(si); news = accept(s, (struct sockaddr *)&si, &j); if (news > 0) { i = recv(news, str, sizeof(str), 0); str[i] = 0; /* C/C++ strings end with '\0' */ printf("%s\n", str); close(news); } close(s); }
e512ff1d29be3ca222c9b37b052a52f5e0b1943b
f98fde7dafbb31e59b85791c071c0c87b22544a0
/NueralNetworks/Test.cpp
da681c61187eacd6debba3614a515cd7c625ff7f
[]
no_license
stephenverderame/NNLib
2fd7437fdae37cd7f0374aa3252cc4957c89c9b8
75df47e2093b3cb9884b61d2acadfed98e2f3046
refs/heads/master
2021-01-08T22:55:12.865815
2020-03-21T20:44:23
2020-03-21T20:44:23
242,166,993
0
0
null
null
null
null
UTF-8
C++
false
false
7,096
cpp
Test.cpp
#include "Matrix.h" #include <iostream> #include "FeedForward.h" #include <time.h> #include "MNIST.h" #include "AdvancedFeedForward.h" #include "Layer.h" /* #define relu(x) ((x) >= 0 ? (x) : ((x) / 20.0)) #define reluP(x) ((x) >= 0 ? 1 : (1.0 / 20.0)) #define sig(x) (1.0 / (1 + exp(-(x)))) #define sigP(x) (sig(x) * (1 - sig(x))) */ int main() { /* auto ff = NetworkSerializer::loadNet("xorModel.net"); ff->setActivation(sigmoid, sigmoidP); iterations = 100; for (int i = 0; i < iterations; ++i) { Vector<> input = { round((double)rand() / RAND_MAX), round((double)rand() / RAND_MAX) }; Vector<> out = ff->calculate(input); int real = ((int)input[0] ^ (int)input[1]); if ((int)round(out[0]) == real) ++correct; } printf("Correct: %d / %d \n", correct, iterations); // NetworkSerializer::saveNet(ff.get(), nt_feedForward, "xorModel.net");*/ #ifdef _training auto images = mnist::readImages("C:\\Users\\stephen\\Downloads\\MNIST\\train-images.idx3-ubyte"); auto labels = mnist::readLabels("C:\\Users\\stephen\\Downloads\\MNIST\\train-labels.idx1-ubyte"); auto testImages = mnist::readImages("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-images.idx3-ubyte"); auto testLabels = mnist::readLabels("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-labels.idx1-ubyte"); FeedForward nn(4, 28 * 28, 16, 16, 10); nn.setActivation(sigmoid, sigmoidP); nn.setLearningRate(0.1); /* for (int i = 0; i < iterations; ++i) { int n = i % images.size(); Vector<> input = images[n]; assert(input.size() == 28 * 28); Vector<> output = nn.calculate(input); Vector<> real(10); real.zero(); real[labels[n]] = 1.0; nn.backprop(output, real); if(i % 100) printf("Training: %.2f%%\r", (double)i / iterations * 100.0); } nn.trainMultithreaded(images, [&labels](const Vector<> & x, size_t id) -> Vector<> { Vector<> r(10); r.zero(); r[labels[id]] = 1.0; return r; }, 6, 10000, images.size() * 1000); printf("\n"); NetworkSerializer::saveNet(&nn, nt_feedForward, "mnistModel2.net"); assert(images.size() == labels.size() && images.size() > 0); correct = 0; iterations = 1000; for (int i = 0; i < iterations; ++i) { Vector<> x = (Vector<>)images[i]; Vector<> y = nn.calculate(x); double max = DBL_MIN; int id = -1; for (int i = 0; i < y.size(); ++i) { if (y[i] > max) { max = y[i]; id = i; } } if (id == labels[i]) ++correct; printf("Testing: %.2f%%\r", (double)i / iterations * 100.0); } printf("Testing: 100.00%%\n"); printf("Correct: %d / %d\n", correct, iterations); */ size_t epochs = 1000; for (size_t i = 0; i < epochs; ++i) { nn.trainMultithreaded(images, [&labels](const Vector<> & x, size_t id) -> Vector<> { Vector<> r(10); r.zero(); r[labels[id]] = 1.0; return r; }, 6, 10000, images.size()); int correct = 0; int testSize = testImages.size(); for (int j = 0; j < testSize; ++j) { Vector<> x = (Vector<>)testImages[j]; Vector<> y = nn.calculate(x); double max = DBL_MIN; int id = -1; for (int k = 0; k < y.size(); ++k) { if (y[k] > max) { max = y[k]; id = k; } } if (id == testLabels[i]) ++correct; } float r = (float)correct / testSize; printf("Epoch %d: Correct: %d / %d (%.2f%%)\n", i, correct, testSize, r * 100.f); if(r >= 0.8) NetworkSerializer::saveNet(&nn, nt_feedForward, "mnistModel_g.net"); } NetworkSerializer::saveNet(&nn, nt_feedForward, "mnistModel.net"); #endif /* auto net = NetworkSerializer::loadNet("mnistModel_g.net"); net->setActivation(sigmoid, sigmoidP); auto testImages = mnist::readImages("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-images.idx3-ubyte"); auto testLabels = mnist::readLabels("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-labels.idx1-ubyte"); int correct = 0, iterations = 10000; for (int i = 0; i < iterations; ++i) { int id = i; Vector<> x = testImages[id]; Vector<> y = net->calculate(x); int actual = testLabels[id]; int calc = -1; double mx = DBL_MIN; for (int j = 0; j < y.size(); ++j) { if (y[j] > mx) { mx = y[j]; calc = j; } } if (actual == calc) ++correct; } printf("%d / %d correct! (%.2f%%)\n", correct, iterations, (float)correct / iterations * 100.f); ///////////////////////////////////////////////// auto images = mnist::readImages("C:\\Users\\stephen\\Downloads\\MNIST\\train-images.idx3-ubyte"); auto labels = mnist::readLabels("C:\\Users\\stephen\\Downloads\\MNIST\\train-labels.idx1-ubyte"); auto testImages = mnist::readImages("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-images.idx3-ubyte"); auto testLabels = mnist::readLabels("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-labels.idx1-ubyte"); FeedForward ff({ 28 * 28, 2500, 2000, 1500, 1000, 500, 10 }); ff.setActivation(ReLu, ReLuP); ff.setLearningRate(0.001); ff.trainMultithreaded(images, [&](const Vector<> & x, size_t id) -> Vector<> { Vector<> r(10); r.zero(); r[labels[id]] = 1.0; return r; }, 6, 10000, 5 * images.size()); int correct = 0, iterations = 10000; for (int i = 0; i < iterations; ++i) { int id = i % testImages.size(); Vector<> x = testImages[id]; Vector<> y = ff.calculate(x); int actual = testLabels[id]; int calc = -1; double mx = DBL_MIN; for (int j = 0; j < y.size(); ++j) { if (y[j] > mx) { mx = y[j]; calc = j; } } if (actual == calc) ++correct; } printf("%d / %d correct! (%.2f%%)\n", correct, iterations, (float)correct / iterations * 100.f); NetworkSerializer::saveNet(&ff, nt_feedForward, "bigMnistModel.net"); */ convData c(5, 10, true); // convData c2(5, 2, 1, 10, 10, true); activationData a(reLu, d_reLu); poolData p; fcData fc(10); activationData fa(fsig_m, d_fsig_m); AdvancedFeedForward net({ 28, 28, 1 }, {1, 10, 1}, { &c, &fc, &fa}); /* Matrix<> test(28, 28); randomize(test); // Vector<> out = net.calculate((Vector<>)test); std::cout << out << std::endl; std::cout << "Size: " << out.size() << std::endl; Vector<> testReal(10); testReal[3] = 1.0; // net.backprop(out, testReal); printf("Done!\n"); printf("Read\n");*/ auto img = mnist::readImages("C:\\Users\\stephen\\Downloads\\MNIST\\t10k-images.idx3-ubyte"); auto lbl = mnist::readLabels("C:\\Users\\stephen\\Downloads\\MNIST\\train-labels.idx1-ubyte"); Vector<> real2(10); Vector<> test2; net.setLearningRates({ 0.7 }); size_t correct = 0; for (int i = 0; i < 1000; ++i) { test2 = img[i % img.size()]; real2.zero(); real2[lbl[i % lbl.size()]] = 1.0; Vector<> out2 = net.calculate(test2); printf("Cost: %f\n", dot(out2 - real2, out2 - real2)); net.backprop(out2, real2); if (getMaxIndex(out2) == lbl[i % lbl.size()]) ++correct; if (i % 10 == 0) printf("%d / %d Correct!\n", correct, i); } printf("%d / 1000\n", correct); printf("Done\n"); /* convData tC(3, 2, true); fcData tF(1); AdvancedFeedForward tNet({ 1, 1, 1 }, { 1, 1, 1 }, {&tC, &tC, &tF, &fa}); for (int i = 0; i < 200; ++i) { Vector<> in = { (double)rand() / RAND_MAX }; Vector<> r = { 1.0 }; auto out = tNet.calculate(in); printf("Out: %f Cost: %f\n", out[0], hadamard(out - r, out - r)[0]); tNet.backprop(out, r); }*/ getchar(); return 0; }
07cd14ab420d137ca65c6781d95b794a93b9690a
ca0d65a2519697f1fab4d0467271e032f72feed5
/darts-x86/omp2cd-examples/tests/reduce-omp-test/reduce-omp.output.darts.h
106c6944448e3eb4a2eeb5114533b6299388e51e
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
jandres742/omp2cd
fca943f38e77ff9d32d066c6713e4556cf30fd54
15f64d65c41a1b9238af81fe2627c1b8e12ceca7
refs/heads/master
2020-12-24T11:09:41.811053
2017-06-28T19:23:40
2017-06-28T19:23:40
73,186,762
6
1
null
null
null
null
UTF-8
C++
false
false
2,950
h
reduce-omp.output.darts.h
#ifndef _reduce_omp_output_darts_h_ #define _reduce_omp_output_darts_h_ #ifndef __DARTS_ #define __DARTS_ #endif #include "darts.h" #include "ompTP.h" #include "tbb/concurrent_vector.h" #include "utils.h" #include <limits.h> #include <mutex> #include <numa.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <time.h> #include <time.h> #include <unistd.h> int main(int argc, char** argv); class TP76; extern int DARTS_CODELETS_MULT; extern int NUMTPS; extern size_t numOfCUs; extern darts::Codelet* RuntimeFinalCodelet; extern darts::ThreadAffinity* affin; extern bool affinMaskRes; extern darts::Runtime* myDARTSRuntime; extern std::vector<std::vector<void*> > threadFunctionStack; extern size_t ompNumThreads; extern int ompSchedulePolicy; extern int ompScheduleChunk; extern void omp_set_num_threads(unsigned long numThreadsToSet); extern int omp_get_num_threads(); extern int omp_get_max_threads(); extern int omp_get_num_procs(); extern double omp_get_wtime(); extern void omp_init_lock(omp_lock_t* lock); extern void omp_destroy_lock(omp_lock_t* lock); extern void omp_set_lock(omp_lock_t* lock); extern void omp_unset_lock(omp_lock_t* lock); /*TP76: OMPParallelForDirective*/ class TP76 : public darts::ThreadedProcedure { public: class _barrierCodelets76 : public darts::Codelet { public: TP76* inputsTPParent; _barrierCodelets76() : darts::Codelet() { } _barrierCodelets76(uint32_t dep, uint32_t res, TP76* myTP, uint32_t id) : darts::Codelet(dep, res, myTP, LONGWAIT, id) , inputsTPParent(myTP->inputsTPParent) { } void fire(void); }; bool requestNewRangeIterations76(int* endRange, uint32_t codeletID); class _checkInCodelets77 : public darts::Codelet { public: TP76* myTP; TP76* inputsTPParent; int endRange; _checkInCodelets77() : darts::Codelet() { } _checkInCodelets77(uint32_t dep, uint32_t res, TP76* myTP, uint32_t id) : darts::Codelet(dep, res, myTP, LONGWAIT, id) , myTP(myTP) , inputsTPParent(myTP->inputsTPParent) { } void fire(void); }; darts::Codelet* nextCodelet; TP76* TPParent; TP76* controlTPParent; TP76* inputsTPParent; double** a_darts76; /*OMP_SHARED - INPUT*/ int* i_darts76 /*OMP_PRIVATE - INPUT*/; double* resa_par_darts76; /*OMP_SHARED - INPUT*/ int initIteration76; int lastIteration76; int range76; int rangePerCodelet76; int minIteration76; int remainderRange76; std::mutex resa_par_darts76_mutex; _barrierCodelets76* barrierCodelets76; _checkInCodelets77* checkInCodelets77; TP76(int in_numThreads, int in_mainCodeletID, darts::Codelet* in_nextCodelet, int in_initIteration, int in_lastIteration, double** in_a, double* in_resa_par); ~TP76(); }; #endif
010e58f789c8bcd1e88d76302c0a5f0b2d11a16b
4258060d4015b4f6fd17c238833b74dd4ecafa70
/assignment4/main.cpp
522458b0edb7db172e1e1242b36c757b5967a4d7
[ "MIT" ]
permissive
MichaelReiter/CSC305
f150a09c618950ab38eb251906902c3ad4ded00c
37e52be3a82c990032d9113747d1cf1db5125b07
refs/heads/master
2021-03-27T10:03:30.594357
2018-04-07T21:33:35
2018-04-07T21:33:35
116,181,191
0
0
null
null
null
null
UTF-8
C++
false
false
470
cpp
main.cpp
#include "Rendering/renderer.h" int main(int argc, char** argv) { constexpr unsigned int width = 1280; constexpr unsigned int height = 720; constexpr float field_of_view = 80.0f; constexpr float movement_speed = 0.25f; // Procedurally generate and render a 3D environment using OpenGL Rendering::Renderer renderer { width, height, field_of_view, movement_speed }; return renderer.create_application(); }
c3348bb45bede67130dad242746a96ec5c4172c5
5d8068348be2eb408758f9aa44b9c882f283b4ee
/Firebird 1.07 VS - eventColliders/Firebird/Timer.h
a42a25a6e2a87c2beca28528e37673beeb82d721
[]
no_license
Losapioj/Firebird
6dacd7689871b605c775a96f73719f6753627138
a4ab06f3b4b7f765de3db1696ba1616370d8f40e
refs/heads/master
2020-04-08T12:22:17.039002
2015-02-01T18:49:58
2015-02-01T18:49:58
30,155,385
0
0
null
null
null
null
UTF-8
C++
false
false
1,409
h
Timer.h
// Timer.h - class cTimer definition #ifndef __TIMER_H__ #define __TIMER_H__ #include <windows.h> class cTimer : public iListener { private: __int64 cntsPerSec; float secsPerCnt; __int64 currTimeStamp, prevTimeStamp; float dt; bool paused; EventID TimeUpdate; EventID TimePause; public: cTimer() : cntsPerSec(0), prevTimeStamp(0), dt(0.0f), TimeUpdate("TIMER_UPDATE_EVENT"), TimePause("TIMER_PAUSE_EVENT") { QueryPerformanceFrequency ((LARGE_INTEGER*)&cntsPerSec); secsPerCnt = 1.0f / (float)cntsPerSec; QueryPerformanceCounter ((LARGE_INTEGER*)&prevTimeStamp); g_eventMngr.RegisterListener(TimePause, this); paused = false; } void Tick() { //debug << "Begin cTimer::Tick()" << endl; currTimeStamp = 0; QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp); dt = (currTimeStamp - prevTimeStamp) * secsPerCnt; prevTimeStamp = currTimeStamp; if (paused) { cEvent e(TimeUpdate, 0); g_eventMngr.SendEvent(&e); return; } cEvent e(TimeUpdate, sVarient(dt)); g_eventMngr.SendEvent(&e); //debug << "Time delta: " << dt << endl; //debug << "End cTimer::Tick()" << endl; } void TogglePause() { if (paused) paused = false; else paused = true; } void HandleEvent(cEvent* e) { EventID eid = e->GetEventID(); if (eid == TimePause) TogglePause(); } }; ///////////////////////////////////////////////// #endif // __TIMER_H__
43f71ae64e93a8b6cbd208a957f36932565614ec
5a980d185577ed17bea4bc4bb9b49b22a88a12ed
/include/Rtype/Game/Client/GameClientObject.hpp
cdd8fa340f0d5569ab6e4812e04f0d082df768ae
[]
no_license
LeonardoRicky/rtype
90120c175212ddca76aef8e94fec5ad0a05194d3
d721f26800cc09114a02138e5e8bbc82a10033b6
refs/heads/master
2022-05-05T05:11:24.696050
2017-01-02T19:25:56
2017-01-02T19:25:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,481
hpp
GameClientObject.hpp
#pragma once #include "SaltyEngine/SaltyBehaviour.hpp" #include "SaltyEngine/GameObject.hpp" #include "Rtype/Game/Client/RtypeClientGameClient.hpp" #include "Network/Core/NativeSocketIOOperationDispatcher.hpp" #include "Protocol/Game/GamePackageFactory.hpp" namespace Rtype { namespace Game { namespace Client { class PREF_EXPORT GameClientObject : public SaltyEngine::SaltyBehaviour { public: explicit GameClientObject(SaltyEngine::GameObject* const gamObj, const std::string &ip, const uint16_t port, const uint16_t secret); GameClientObject(const std::string &name, SaltyEngine::GameObject* const gamObj, const std::string &ip, const uint16_t port, const uint16_t secret); void Start(); void Update(); ~GameClientObject(); public: template <typename Pack, typename Send, typename ... Args> void SendPackage(Send send1, Args ... args) { m_rtypeclient->SendPackage<Pack>(send1, args...); } template <typename Package, typename SendFunc, typename ... Args> void BroadCastPackage(SendFunc func, Args ... args) { m_rtypeclient->BroadCastPackage<Package>(func, args...); } SaltyEngine::Component *CloneComponent(SaltyEngine::GameObject *const obj) override; private: uint16_t m_port; std::string m_ip; const uint32_t m_secret; Client::RtypeClientGameClient *m_rtypeclient = nullptr; Network::Core::NativeSocketIOOperationDispatcher m_dispatcher; }; } } }
9ec4a8f931d5cc3518b4c2d5d555ca4d5cc9f033
b61d2afb38cbe96851b32570ce1b55dfb3f9321b
/interface/vm/vmclone.h
2e04f50066a3d835d7959fed42894d3b932c86ca
[]
no_license
hbiner/VMRR
c53c0dc2d42647d3fbe58bd193d78697909e99e8
40a1e11d49efff1aba45f0868f108086cc59ffbe
refs/heads/master
2021-01-01T05:34:39.059852
2015-09-02T02:16:42
2015-09-02T02:16:42
41,773,904
0
0
null
null
null
null
UTF-8
C++
false
false
2,157
h
vmclone.h
#ifndef VMCLONE_H #define VMCLONE_H #include <QObject> /* * 功能:完成虚拟的克隆,从模板部署虚拟机 * 编写时间:2013-04-21 * 具体功能: * |克隆 * |开机->| * 虚拟机->| |克隆为模板 * | |克隆 * |关机->| 克隆为模板 * |转化为模板 * | 克隆 * 模板->| 转化为虚拟机 * |从该模板中部署虚拟机 */ class VMClone : public QObject { Q_OBJECT public: explicit VMClone(QObject *parent = 0); static VMClone* getVMCloneInstance(); //获取单例对象 void cloneVM(QString hostName, QString vmName, QString cloneName); // 克隆虚拟机(开机或关机) void sendcloneVMSignal(QString msg); //发送cloneVMSignal信号 void cloneTemplate(QString hostName,QString templateName, QString cloneName); // 克隆模板 (模板是虚拟机的主镜像) void sendcloneTemplateSignal(QString msg); //发送cloneTemplateSignal信号 void cloneVMToTemplate(QString hostName,QString vmName, QString cloneName) ; // 虚拟机克隆为模板 void sendcloneVMToTemplateSignal(QString msg); //发送cloneVMToTemplateSignal信号 void cloneTemplatToVM(QString clusterName, QString hostName,QString templateName, QString cloneName) ; // 从模板部署虚拟机 void sendcloneTemplatToVMSignal(QString msg); //发送cloneTemplatToVMSignal信号 void vmToTemp( QString hostName,QString vmName); // 将虚拟机转化为模板 void sendvmToTempSignal(QString msg); //发送vmToTempSignal信号 void markAsVM(QString clusterName,QString hostName, QString templateName); // 将模板转化为虚拟机 void sendmarkAsVMSignal(QString msg); //发送markAsVMSignal信号 signals: void cloneVMSignal(QString); //接收数据 void cloneTemplateSignal(QString); //接收数据 void cloneVMToTemplateSignal(QString); //接收数据 void cloneTemplatToVMSignal(QString); //接收数据 void vmToTempSignal(QString); //接收数据 void markAsVMSignal(QString); //接收数据 public slots: }; #endif // VMCLONE_H
93ddd0479b8b674ecaa66ebb847474676b0b011c
3f78a9da3eecc6d8e401f1cce37e054a252930bc
/[Client]MH/MunpaMarkManager.cpp
3b13e271380459b4a8e8a62be78f3ad2f843314f
[]
no_license
apik1997/Mosiang-Online-Titan-DarkStroy-Azuga-Source-Code
9055aa319c5371afd1ebd504044160234ddbb418
74d6441754efb6da87855ee4916994adb7f838d5
refs/heads/master
2020-06-14T07:46:03.383719
2019-04-09T00:07:28
2019-04-09T00:07:28
194,951,315
0
0
null
2019-07-03T00:14:59
2019-07-03T00:14:59
null
UHC
C++
false
false
2,962
cpp
MunpaMarkManager.cpp
// MunpaMarkManager.cpp: implementation of the CMunpaMarkManager class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "MunpaMarkManager.h" #include "MHFile.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// GLOBALTON(CMunpaMarkManager) CMunpaMarkManager::CMunpaMarkManager() { m_bIsInited = FALSE; m_DescTable.Initialize(64); m_MunpaMarkNumTable.Initialize(64); } CMunpaMarkManager::~CMunpaMarkManager() { Release(); } BOOL CMunpaMarkManager::IsInited() { return m_bIsInited; } void CMunpaMarkManager::Init() { if(!LoadMunpaMarkNum()) { ASSERTMSG(0, "Fail To Load a File : MunpaMarkNumList"); return; } CMHFile file; #ifdef _FILE_BIN_ if(file.Init("image/munpamarkList.bin","rb") == FALSE ) return; #else if(file.Init("image/munpamarkList.txt","rt") == FALSE ) return; #endif int marknum; char fileimagename[64]; while(1) { if(file.IsEOF() != FALSE) break; marknum = file.GetInt(); file.GetString(fileimagename); // 약간의 검사 과정 MUNPAMARKDESC* pDesc = new MUNPAMARKDESC; pDesc->MarkNum = marknum; strcpy(pDesc->MarkFileName,fileimagename); BOOL rt = pDesc->Mark.Init(pDesc->MarkFileName); ASSERT(rt); m_DescTable.Add(pDesc,pDesc->MarkNum); } m_bIsInited = TRUE; } BOOL CMunpaMarkManager::LoadMunpaMarkNum() { CMHFile file; #ifdef _FILE_BIN_ if(file.Init("image/MunpaMarkNumList.bin", "rb") == FALSE) return FALSE; #else if(file.Init("image/MunpaMarkNumList.txt", "rt") == FALSE) return FALSE; #endif DWORD munpaidx; int imgnum; if(!file.IsInited()) return FALSE; while(1) { if(file.IsEOF() != FALSE) break; munpaidx = file.GetDword(); imgnum = file.GetInt(); MUNPAMARKNUM* pNum = new MUNPAMARKNUM; pNum->MunpaID = munpaidx; pNum->MarkNum = imgnum; m_MunpaMarkNumTable.Add(pNum, pNum->MunpaID); } file.Release(); return TRUE; } void CMunpaMarkManager::Release() { m_bIsInited = FALSE; MUNPAMARKDESC* pDescTable = NULL; m_DescTable.SetPositionHead(); while(pDescTable = m_DescTable.GetData()) { delete pDescTable; } m_DescTable.RemoveAll(); MUNPAMARKNUM* pMarkTable = NULL; m_MunpaMarkNumTable.SetPositionHead(); while(pMarkTable = m_MunpaMarkNumTable.GetData()) { delete pMarkTable; } m_MunpaMarkNumTable.RemoveAll(); } CMunpaMark* CMunpaMarkManager::GetMunpaMark(int MarkNum) { // ASSERT(IsInited()); if(IsInited()) { MUNPAMARKDESC* pMunpaMarkDesc = m_DescTable.GetData(MarkNum); ASSERT(pMunpaMarkDesc); return &pMunpaMarkDesc->Mark; } else return NULL; } CMunpaMark* CMunpaMarkManager::GetMunpaMark(DWORD MunpaID) { if(MunpaID == 0) return NULL; MUNPAMARKNUM* p = m_MunpaMarkNumTable.GetData(MunpaID); if(!p) return NULL; //GetMunpaMark(0); //기본 이미지 // ASSERT(p); else return GetMunpaMark(p->MarkNum); }
e30efdc1aefb11391ad82fe51a743cb34f3aaf77
671b33372cd8eaf6b63284b03b94fbaf5eb8134e
/protocols/zlight/zl_Request.h
92ef2fc3dbb6389a26de7eaff540060312cb4da1
[ "MIT" ]
permissive
LPD-EPFL/consensusinside
41f0888dc7c0f9bd25f1ff75781e7141ffa21894
4ba9c5274a9ef5bd5f0406b70d3a321e7100c8ac
refs/heads/master
2020-12-24T15:13:51.072881
2014-11-30T11:27:41
2014-11-30T11:27:41
23,539,134
5
2
null
null
null
null
UTF-8
C++
false
false
3,495
h
zl_Request.h
#ifndef _zl_Request_h #define _zl_Request_h 1 #include "zl_Message.h" #include "types.h" #include "Digest.h" #include "ARequest.h" //class Digest; class zl_Principal; // // Request messages have the following format. // struct zl_Request_rep : public zl_Message_rep { Digest od; // Digest of rid, cid, command. short replier; // id of replica from which client // expects to receive a full reply // (if negative, it means all replicas). short command_size; int cid; // unique id of client who sent the request Request_id rid; // unique request identifier // Followed a command which is "command_size" bytes long and an // authenticator. // Digest resp_digest; }; class zl_Request : public zl_Message, public ARequest { // // Request messages: // // Requires: Requests that may have been allocated by library users // through the libbyz.h interface can not be trimmed (this could free // memory the user expects to be able to use.) // public: zl_Request(zl_Request_rep *r); zl_Request(Request_id r, short rr=-1); // Effects: Creates a new Request message with an empty // command and no authentication. The methods store_command and // authenticate should be used to finish message construction. // "rr" is the identifier of the replica from which the client // expects a full reply (if negative, client expects a full reply // from all replicas). virtual ~zl_Request(); static const int big_req_thresh = 8000; // Maximum size of not-big requests char* store_command(int &max_len); // Effects: Returns a pointer to the location within the message // where the command should be stored and sets "max_len" to the number of // bytes available to store the reply. The caller can copy any command // with length less than "max_len" into the returned buffer. void authenticate(int act_len, bool read_only=false); // Effects: Terminates the construction of a request message by // setting the length of the command to "act_len", and appending an // authenticator. read-only should be true iff the request is read-only // (i.e., it will not change the service state). virtual int& client_id() const; Request_id& request_id(); char* command(int &len); int replier() const; // Effects: Returns the identifier of the replica from which // the client expects a full reply. If negative, client expects // a full reply from all replicas. void set_replier(int replier) const; // Effects: Sets the identifier of the replica from which // the client expects a full reply. bool is_read_only() const; bool verify(); // Effects: Verifies if the message is authenticated by the client // "client_id()" using an authenticator. static bool convert(zl_Message *m1, zl_Request *&m2); void comp_digest(Digest& d); void display() const; virtual Digest& digest() const { return rep().od; } private: zl_Request_rep &rep() const; // Effects: Casts "msg" to a Request_rep& }; inline Request_id &zl_Request::request_id() { return rep().rid; } inline char *zl_Request::command(int &len) { len = rep().command_size; return contents() + sizeof(zl_Request_rep); } inline int zl_Request::replier() const { return rep().replier; } inline void zl_Request::set_replier(int replier) const { rep().replier = replier; } inline bool zl_Request::is_read_only() const { return rep().extra & 1; } inline int& zl_Request::client_id() const { return rep().cid; } #endif // _zl_Request_h
9abca54c873e7a73579a681095c91305d5ce80e6
2ce8c4d9046ee4887127d87dc01ad97ebf1f3408
/common-c-library/httpcontroller/item/HttpConfigItem.h
92f39d7cc49932e5c3097ce55e234e8d330d78b6
[]
no_license
ListFranz/LiveClient
7be8ab96d420bd8a06ea415bdbb9484d06b8e63e
0bc40e09c0edda782bbdc1ebf675236feac79e49
refs/heads/master
2019-07-02T04:24:39.474802
2017-09-08T02:53:19
2017-09-08T02:53:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,695
h
HttpConfigItem.h
/* * HttpConfigItem.h * * Created on: 2017-8-18 * Author: Alex * Email: Kingsleyyau@gmail.com */ #ifndef HTTPCONFIGITEM_H_ #define HTTPCONFIGITEM_H_ #include <string> using namespace std; #include <json/json/json.h> #include "../HttpLoginProtocol.h" #include "../HttpRequestEnum.h" class HttpConfigItem { public: bool Parse(const Json::Value& root) { bool result = false; if (root.isObject()) { /* imSvrIp */ if (root[LIVEROOM_IMSVR_IP].isString()) { imSvrIp = root[LIVEROOM_IMSVR_IP].asString(); } /* imSvrPort */ if (root[LIVEROOM_IMSVR_PORT].isInt()) { imSvrPort = root[LIVEROOM_IMSVR_PORT].asInt(); } /* httpSvrIp */ if (root[LIVEROOM_HTTPSVR_IP].isString()) { httpSvrIp = root[LIVEROOM_HTTPSVR_IP].asString(); } /* httpSvrPort */ if (root[LIVEROOM_HTTPSVR_PORT].isInt()) { httpSvrPort = root[LIVEROOM_HTTPSVR_PORT].asInt(); } /* uploadSvrIp */ if (root[LIVEROOM_UPLOADSVR_IP].isString()) { uploadSvrIp = root[LIVEROOM_UPLOADSVR_IP].asString(); } /* uploadSvrPort */ if (root[LIVEROOM_UPLOADSVR_PORT].isInt()) { uploadSvrPort = root[LIVEROOM_UPLOADSVR_PORT].asInt(); } /* addCreditsUrl */ if (root[LIVEROOM_ADDCREDITS_URL].isString()) { addCreditsUrl = root[LIVEROOM_ADDCREDITS_URL].asString(); } } if (!imSvrIp.empty()) { result = true; } return result; } HttpConfigItem() { imSvrIp = ""; imSvrPort = 0; httpSvrIp = ""; httpSvrPort = 0; uploadSvrIp = ""; uploadSvrPort = 0; addCreditsUrl = ""; } virtual ~HttpConfigItem() { } /** * 有效邀请数组结构体 * imSvrIp IM服务器ip或域名 * imSvrPort IM服务器端口 * httpSvrIp http服务器ip或域名 * httpSvrPort http服务器端口 * uploadSvrIp 上传图片服务器ip或域名 * uploadSvrPort 上传图片服务器端口 * addCreditsUrl 充值页面URL */ string imSvrIp; int imSvrPort; string httpSvrIp; int httpSvrPort; string uploadSvrIp; int uploadSvrPort; string addCreditsUrl; }; #endif /* HTTPCONFIGITEM_H_*/
3e3a6c3d6ed6b57f6fb97bdf00e987b4195717fc
878edb95b565c3200710a32ee155d9e6784f45dc
/Menu.h
1fa8017fdeea511251707cb7ae0471d228ba3751
[]
no_license
WuangMai/baza_studentow_edukacja
1fe800cf53d82122fce56de191389a69f48ec312
4e17c70cb1013fd2a056626bf73eac63626bbe51
refs/heads/master
2023-06-20T02:52:01.686852
2021-06-25T05:01:34
2021-06-25T05:01:34
379,464,881
0
0
null
null
null
null
UTF-8
C++
false
false
116
h
Menu.h
#pragma once #include <string> #include <vector> #include <iostream> class Menu { public: static void menu(); };
195a58255e2a9bf84351c8db85eb7aff7495e9cc
cbe59932b468f2ecf6e59e63bba98dd3410e2398
/Pointers/Pointers giris2.cpp
fb544bf4a4ece6cab24dc2b577fc9bf47147bbeb
[]
no_license
healtherengineer/Algorithms
95e245bc73cddeca1a65bb71b83b0d637fb53357
28340f895a869df6e4805321f18201c4ba747fda
refs/heads/master
2023-08-14T12:58:35.282231
2021-09-22T19:03:49
2021-09-22T19:03:49
409,321,609
1
0
null
null
null
null
UTF-8
C++
false
false
579
cpp
Pointers giris2.cpp
#include<stdio.h> int main() { //write code int a = 12; int *a_ptr = &a; //printf("%p",a_ptr); //printf("\n%d",*a_ptr); float decimal =3.14; char ch= 'E'; float *decimal_p = &decimal; char *ch_p = &ch; int arr[5]={1,2,3,4,5},*arr_ptr; for(int i=0;i<5;i++) { arr_ptr=&arr[i]; printf("%d array elemaninin adresi = %p\n",*arr_ptr,arr_ptr); } printf("\n\n"); arr_ptr=&arr[1]; printf("%d integer degerinin adresi = %p\n",a,a_ptr); printf("%f float degerinin adresi = %p\n",decimal,decimal_p); printf("%c char degerinin adresi = %p\n ",ch,ch_p); }
de1c705044ebe721cd59a9dccd90dcd6c3c1ca5c
1583065211b61f0076fb673e1533091548633e1b
/esp32-nofrendo/display.cpp
f8ce73aa837827156923028d4c504d527a3a1150
[ "MIT" ]
permissive
daomao201/TTGO_FC
121d73c55c54b7143a4beaf47f1732239656f1d8
330d0d7c81477b3e29144542fe1976cbfe2c1204
refs/heads/main
2023-08-19T13:06:36.422521
2021-10-16T10:57:07
2021-10-16T10:57:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,167
cpp
display.cpp
extern "C" { #include <nes/nes.h> } #include "hw_config.h" #include <Arduino_GFX_Library.h> /* M5Stack */ #if defined(ARDUINO_M5Stack_Core_ESP32) || defined(ARDUINO_M5STACK_FIRE) #define TFT_BRIGHTNESS 255 /* 0 - 255 */ #define TFT_BL 32 Arduino_DataBus *bus = new Arduino_ESP32SPI(27 /* DC */, 14 /* CS */, SCK, MOSI, MISO); Arduino_ILI9341_M5STACK *gfx = new Arduino_ILI9341_M5STACK(bus, 33 /* RST */, 1 /* rotation */); /* Odroid-Go */ #elif defined(ARDUINO_ODROID_ESP32) #define TFT_BRIGHTNESS 255 /* 0 - 255 */ #define TFT_BL 4 Arduino_DataBus *bus = new Arduino_ESP32SPI(16 /* DC */, 5 /* CS */, 18 /* SCK */, 19 /* MOSI */, -1 /* MISO */); Arduino_ST7789 *gfx = new Arduino_ST7789(bus, 23 /* RST */, 2 /* rotation */, true /* IPS */, 135 /* width */, 240 /* height */, 53 /* col offset 1 */, 40 /* row offset 1 */, 52 /* col offset 2 */, 40 /* row offset 2 */); //#define TFT_BL 14 //Arduino_DataBus *bus = new Arduino_ESP32SPI(21 /* DC */, 5 /* CS */, SCK, MOSI, MISO); // ILI9341 240 x 320. //Arduino_ILI9341 *gfx = new Arduino_ILI9341(bus, -1 /* RST */, 3 /* rotation */); // ILI9488 320 x480 18 位彩色 //Arduino_ILI9488_18bit *gfx = new Arduino_ILI9488_18bit(bus, -1 /* RST */, 3 /* rotation */); /* TTGO T-Watch */ #elif defined(ARDUINO_T) || defined(ARDUINO_TWATCH_BASE) || defined(ARDUINO_TWATCH_2020_V1) || defined(ARDUINO_TWATCH_2020_V2) // TTGO T-Watch #define TFT_BRIGHTNESS 255 /* 0 - 255 */ #define TFT_BL 12 Arduino_DataBus *bus = new Arduino_ESP32SPI(27 /* DC */, 5 /* CS */, 18 /* SCK */, 19 /* MOSI */, -1 /* MISO */); Arduino_ST7789 *gfx = new Arduino_ST7789(bus, -1 /* RST */, 1 /* rotation */, true /* IPS */, 240, 240, 0, 80); /* custom hardware */ #else #define TFT_BRIGHTNESS 180 /* 0 - 255 */ // TTGO T-DISPLAY. #define TFT_BL 4 Arduino_DataBus *bus = new Arduino_ESP32SPI(16 /* DC */, 5 /* CS */, 18 /* SCK */, 19 /* MOSI */, -1 /* MISO */); Arduino_ST7789 *gfx = new Arduino_ST7789(bus, 23 /* RST */, 2 /* rotation */, true /* IPS */, 135 /* width */, 240 /* height */, 53 /* col offset 1 */, 40 /* row offset 1 */, 52 /* col offset 2 */, 40 /* row offset 2 */); /* ILI9341 */ //#define TFT_BL 14 //Arduino_DataBus *bus = new Arduino_ESP32SPI(21 /* DC */, 5 /* CS */, SCK/*18*/, MOSI/*23*/, MISO/*19*/); //Arduino_ILI9341 *gfx = new Arduino_ILI9341(bus, -1 /* RST */, 3 /* rotation */); /* ST7789 ODROID Compatible pin connection */ //#define TFT_BL 14 //Arduino_DataBus *bus = new Arduino_ESP32SPI(21 /* DC */, 5 /* CS */, SCK, MOSI, MISO); //Arduino_ST7789 *gfx = new Arduino_ST7789(bus, -1 /* RST */, 1 /* rotation */, true /* IPS */); /* ST7796 on breadboard */ // #define TFT_BL 32 //Arduino_DataBus *bus = new Arduino_ESP32SPI(32 /* DC */, -1 /* CS */, 25 /* SCK */, 33 /* MOSI */, -1 /* MISO */); //Arduino_TFT *gfx = new Arduino_ST7796(bus, -1 /* RST */, 1 /* rotation */); /* ST7796 on LCDKit */ // #define TFT_BL 23 // Arduino_DataBus *bus = new Arduino_ESP32SPI(19 /* DC */, 5 /* CS */, 22 /* SCK */, 21 /* MOSI */, -1 /* MISO */); // Arduino_ST7796 *gfx = new Arduino_ST7796(bus, 18, 1 /* rotation */); #endif /* custom hardware */ static int16_t w, h, frame_x, frame_y, frame_x_offset, frame_width, frame_height, frame_line_pixels; extern int16_t bg_color; extern uint16_t myPalette[]; extern void display_begin() { gfx->begin(); //bg_color = gfx->color565(24, 28, 24); // DARK DARK GREY bg_color = gfx->color565(0, 0, 0); gfx->fillScreen(bg_color); gfx->setRotation(1); #ifdef TFT_BL // turn display backlight on ledcAttachPin(TFT_BL, 1); // assign TFT_BL pin to channel 1 ledcSetup(1, 12000, 8); // 12 kHz PWM, 8-bit resolution ledcWrite(1, TFT_BRIGHTNESS); // brightness 0 - 255 #endif } extern "C" void display_init() { //gfx->setRotation(1); w = gfx->width(); h = gfx->height(); if (w < 480) // assume only 240x240 or 320x240 { if (w > NES_SCREEN_WIDTH) { frame_x = (w - NES_SCREEN_WIDTH) / 2; frame_x_offset = 0; frame_width = NES_SCREEN_WIDTH; frame_height = NES_SCREEN_HEIGHT; frame_line_pixels = frame_width; } else { // TTGO. frame_x = 0; frame_x_offset = 8; frame_width = w+16; frame_height = NES_SCREEN_HEIGHT; frame_line_pixels = frame_width; } frame_y = (gfx->height() - NES_SCREEN_HEIGHT) / 2; } else // assume 480x320 { frame_x = 0; frame_y = 0; frame_x_offset = 8; frame_width = w; frame_height = h; frame_line_pixels = frame_width / 2; } //Serial.print("gfx->width:"); //Serial.println(w); //Serial.print("gfx->height:"); //Serial.println(h); } extern "C" void display_write_frame(const uint8_t *data[]) { gfx->startWrite(); // TTGO. if (w == 240 && h==135){ gfx->writeAddrWindow(0, 0, frame_width, frame_height); for (int32_t i = 0; i < NES_SCREEN_HEIGHT; i++) { if ((i % 2) == 1) gfx->writeIndexedPixels((uint8_t *)(data[i] + frame_x_offset), myPalette, frame_line_pixels); } }else if (w < 480){ gfx->writeAddrWindow(frame_x, frame_y, frame_width, frame_height); for (int32_t i = 0; i < NES_SCREEN_HEIGHT; i++) { gfx->writeIndexedPixels((uint8_t *)(data[i] + frame_x_offset), myPalette, frame_line_pixels); } } else { /* ST7796 480 x 320 resolution */ /* Option 1: * crop 256 x 240 to 240 x 214 * then scale up width x 2 and scale up height x 1.5 * repeat a line for every 2 lines */ // gfx->writeAddrWindow(frame_x, frame_y, frame_width, frame_height); // for (int16_t i = 10; i < (10 + 214); i++) // { // gfx->writeIndexedPixelsDouble((uint8_t *)(data[i] + 8), myPalette, frame_line_pixels); // if ((i % 2) == 1) // { // gfx->writeIndexedPixelsDouble((uint8_t *)(data[i] + 8), myPalette, frame_line_pixels); // } // } /* Option 2: * crop 256 x 240 to 240 x 214 * then scale up width x 2 and scale up height x 1.5 * simply blank a line for every 2 lines */ int16_t y = 0; for (int16_t i = 10; i < (10 + 214); i++) { gfx->writeAddrWindow(frame_x, y++, frame_width, 1); gfx->writeIndexedPixelsDouble((uint8_t *)(data[i] + 8), myPalette, frame_line_pixels); if ((i % 2) == 1) { y++; // blank line } } /* Option 3: * crop 256 x 240 to 240 x 240 * then scale up width x 2 and scale up height x 1.33 * repeat a line for every 3 lines */ // gfx->writeAddrWindow(frame_x, frame_y, frame_width, frame_height); // for (int16_t i = 0; i < 240; i++) // { // gfx->writeIndexedPixelsDouble((uint8_t *)(data[i] + 8), myPalette, frame_line_pixels); // if ((i % 3) == 1) // { // gfx->writeIndexedPixelsDouble((uint8_t *)(data[i] + 8), myPalette, frame_line_pixels); // } // } /* Option 4: * crop 256 x 240 to 240 x 240 * then scale up width x 2 and scale up height x 1.33 * simply blank a line for every 3 lines */ // int16_t y = 0; // for (int16_t i = 0; i < 240; i++) // { // gfx->writeAddrWindow(frame_x, y++, frame_width, 1); // gfx->writeIndexedPixelsDouble((uint8_t *)(data[i] + 8), myPalette, frame_line_pixels); // if ((i % 3) == 1) // { // y++; // blank line // } // } } gfx->endWrite(); } extern "C" void display_clear() { gfx->fillScreen(bg_color); }
5d053fe7ac899dde3ee3d5f2a1ccbab3cb396cc6
4536c89828880388a65f811a9e871a6ca26ad58b
/game/entity/Entities.hpp
efd13dfd5094578d0e7e544e0bbf36d312b78e38
[]
no_license
CyberFlameGO/AwdClient
2dbf24f17034abe166b5cc2403c700135e9cd6f4
2cc76980d0dbbbe80dff3deb539e3ba8c053d93c
refs/heads/main
2023-05-31T07:41:56.228127
2021-06-20T22:03:09
2021-06-20T22:03:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
729
hpp
Entities.hpp
#pragma once #include <cstdint> namespace awd::game { class Entities { public: class EntityPlayer { public: static constexpr uint32_t TYPE = 1; static constexpr uint32_t ANIM_BASE_STILL_FRONT = 0; // Стоит на месте. Лицом к пользователю. static constexpr uint32_t ANIM_BASE_WALK_RIGHT_0 = 1000; // Идёт вправо (1-й этап анимации). static constexpr uint32_t ANIM_BASE_WALK_RIGHT_1 = 1001; // ^ ......... (2-й этап анимации). static constexpr uint32_t ANIM_BASE_WALK_RIGHT_2 = 1002; // ^ ......... (3-й этап анимации). }; }; }
0c11f228fb3837054765d7bdf30fd78c3f589418
fe2ea8a5ef9b585b7eadf5123ae87cb0a965dfe1
/cookingprocess.h
7f7770129ed26cf60dc1c0e457abf9b541c3d943
[]
no_license
SammyVimes/IDP-Strikes-back
97f9a9fae454e5c07a79e9b7c486cbdd2384a6d4
27781fafc9ec8628439a9dbdfc9279d7b3d48c95
refs/heads/master
2021-01-22T20:45:18.074338
2017-06-15T10:05:55
2017-06-15T10:05:55
85,358,239
2
1
null
2017-05-11T11:31:40
2017-03-17T22:01:57
C++
UTF-8
C++
false
false
597
h
cookingprocess.h
#ifndef COOKINGPROCESS_H #define COOKINGPROCESS_H #include "dfdelement.h" #include "food.h" #include "pill.h" #include "vector" using namespace std; class CookingProcess : public DFDElement { public: CookingProcess(int type):DFDElement(0) { } CookingProcess():DFDElement(0) { } vector<Food> getMenu() const; void setMenu(const vector<Food> &value); static DFDElement* deserialize (QDomNode node); private: vector<Food> menu; // DFDElement interface public: virtual void printToStream(ostream &os) const override; }; #endif // COOKINGPROCESS_H
05038141d30b2c4b06c1d02c939981b48ecaa78b
98acd351cde85dccefbae219c2ebbf7e097c2762
/Kosmo/KosmoCore/Sources/Components/KmComponent.cpp
1a2111c6bf67196a5d6b0329e4601ad1aef5b309
[]
no_license
korben4leeloo/korben-dev
d75f48a79592ae951fd40b6a97679db82ab12591
846f00d731d28842459903d73743ec96a7467e54
refs/heads/master
2020-04-05T14:39:37.626857
2018-08-22T16:45:58
2018-08-22T16:45:58
32,147,112
0
0
null
null
null
null
UTF-8
C++
false
false
814
cpp
KmComponent.cpp
//***************************************************************************** // // File: KmComponent.cpp // Created: 2013-08-26 // //***************************************************************************** #include "KmComponent.h" //----------------------------------------------------------------------------- // Name: KmComponent constructor // // Created: 2013-08-26 //----------------------------------------------------------------------------- KmComponent::KmComponent(const KmString& componentName) : _componentName( componentName ) { } //----------------------------------------------------------------------------- // Name: KmComponent destructor // // Created: 2013-08-26 //----------------------------------------------------------------------------- KmComponent::~KmComponent() { }
a0e769e9f489ab0847675f6c99d6d55e78672865
af4961412f288f01624e0d088f0fafbe15f2ba65
/Guias/Cristian/p3_track.cpp
c81562728381da3bb4ae4a147e30e51fa7fbf4c5
[]
no_license
escudero89/pdifich
7ec345d58a8c8a5460b17de5e464e7f69b9734d1
a77ecb63832075f98330740d93975860f4e61cc3
refs/heads/master
2016-09-11T07:13:20.494936
2013-08-26T15:19:21
2013-08-26T15:19:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,365
cpp
p3_track.cpp
#include <cassert> #include <cmath> #include <complex> #include <ctime> #include <iostream> #include <cstring> #include "../../CImg-1.5.4/CImg.h" #include "PDI_functions.h" #include "funciones.h" #define EPSILON 0.00001 #define PI 3.14159265359 using namespace cimg_library; void track_coloring( const char * filename, const double UMBRAL, const double A) { CImg<double> track(filename); // Aplicamos un filtro mediana varias veces CImg<double> track_filtrada(cimg_ce::apply_mean(track, 'm')); track_filtrada = cimg_ce::apply_mean(track, 'm', 0, 7, 7); track_filtrada = cimg_ce::apply_mean(track, 'm'); track_filtrada = cimg_ce::apply_mean(track, 'a', 3, 7, 7); // Y luego otro geometrico para mejorar el resultado track_filtrada = cimg_ce::apply_mean(track_filtrada, 'g'); // Le paso un filtro high-boost CImg<double> filtro_promediado(7, 7, 1, 1, 1); double factor_promediado = filtro_promediado.width() * filtro_promediado.height(); // Y cambio su valor central por A CImg<double> track_hb(A * track_filtrada - track_filtrada.get_convolve(filtro_promediado) / factor_promediado); // Obtengo ahora solo la pista CImg<double> track_only(track_hb.get_threshold(UMBRAL)); // Y uso hough CImg<double> track_hough(hough(track_only)); // Busco donde esta su maxima colinearidad unsigned int max_x = 0; unsigned int max_y = 0; double max_val = track_hough.max(); cimg_forXY(track_hough, x, y) { if (track_hough(x, y) == max_val) { max_x = x; max_y = y; break; } } double val_theta = cimg_ce::coord_hough_to_value(track_hough, max_x, 't'); double val_rho = cimg_ce::coord_hough_to_value(track_hough, max_y, 'p'); std::cout << "(x,y): " << max_x << " | " << max_y << std::endl; std::cout << "(theta, rho): " << val_theta << " | " << val_rho << std::endl; CImg<double> track_back(hough(cimg_ce::slice_hough(track_hough, val_theta, max_y, 1, 1), true)); // Mostramos la imagen final (track_filtrada * 0.7 + track_back * 0.3).display("Final", 0); } int main (int argc, char* argv[]) { srand(time(0)); const char* _filename = cimg_option("-i", "training/track/01.jpg", "Imagen"); const double _umbral = cimg_option("-umbral", 200.0, "Umbral dps de PA"); const double _hb = cimg_option("-hb", 2.0, "A para el filtro HB"); track_coloring(_filename, _umbral, _hb); return 0; }
b73a34dfecbca23db313c905422760dc7813dec8
d15f656f56daa0d1cf9d6bdcac9fab7ddbde393b
/GeometryLib/MinOBB.cpp
8e41f5380ed157e061f842dcd975d7979a7a4d7f
[]
no_license
ljwdust/fold-hcc
814d02a70bdb4fff90385028a2f76aa2a4ae2bb3
fe371809065c292d6f36a1d70f8c6a415dd2bb6e
refs/heads/master
2020-05-18T13:25:47.359249
2014-11-15T02:34:39
2014-11-15T02:34:39
35,209,422
0
0
null
null
null
null
UTF-8
C++
false
false
10,133
cpp
MinOBB.cpp
// Geometric Tools, LLC #include "MinOBB.h" #include "Numeric.h" #include "AABB.h" #include "ProbabilityDistributions.h" Geom::MinOBB::MinOBB( QVector<Vector3> &points, bool addNoise) { if (addNoise) computeWithNoise(points); else compute(points); } void Geom::MinOBB::computeWithNoise( QVector<Vector3> &points ) { // Add noise to reduce precision problems in CH AABB aabb(points); double enlarge_scale = 1.0/100; double noise_scale = enlarge_scale / 2 * aabb.radius(); for (int i = 0; i < (int)points.size(); i++) { points[i] -= aabb.center(); points[i] *= (1 + enlarge_scale); double nx = uniformDistrReal() - 0.5; double ny = uniformDistrReal() - 0.5; double nz = uniformDistrReal() - 0.5; points[i] += Vector3(nx, ny,nz) * noise_scale; points[i] += aabb.center(); } // Compute minOBB compute(points); } void Geom::MinOBB::compute( QVector<Vector3> &points ) { isReady = false; // Get the convex hull of the points. ConvexHull kHull(points); int hullQuantity = kHull.getNumSimplices(); QVector<int> hullIndices = kHull.getIndices(); Real volume, minVolume = maxDouble(); // Create the unique set of hull vertices to minimize the time spent // projecting vertices onto planes of the hull faces. std::set<int> uniqueIndices(hullIndices.begin(), hullIndices.end()); int i, j; Vector3 origin, diff, U, V, W; QVector<Vector2> points2(uniqueIndices.size(), Vector2()); Box2 box2; // Use the rotating calipers method on the projection of the hull onto // the plane of each face. Also project the hull onto the normal line // of each face. The minimum area box in the plane and the height on // the line produce a containing box. If its volume is smaller than the // current volume, this box is the new candidate for the minimum volume // box. The unique edges are accumulated into a set for use by a later // step in the algorithm. QVector<int>::const_iterator currentHullIndex = hullIndices.begin(); Real height, minHeight, maxHeight; std::set<EdgeKey> edges; for (i = 0; i < hullQuantity; ++i) { // Get the triangle. int v0 = *currentHullIndex++; int v1 = *currentHullIndex++; int v2 = *currentHullIndex++; // Save the edges for later use. edges.insert(EdgeKey(v0, v1)); edges.insert(EdgeKey(v1, v2)); edges.insert(EdgeKey(v2, v0)); // Get 3D coordinate system relative to plane of triangle. origin = (points[v0] + points[v1] + points[v2])/(Real)3.0; U = points[v2] - points[v0]; V = points[v1] - points[v0]; U.normalize(); V.normalize(); W = cross(U, V); // inner-pointing normal if (W.norm() < ZERO_TOLERANCE_LOW) { continue; // The triangle is needle-like, so skip it. } W.normalize(); V = cross(W, U); // Project points onto plane of triangle, onto normal line of plane. minHeight = (Real)0; maxHeight = (Real)0; j = 0; std::set<int>::const_iterator iter = uniqueIndices.begin(); while (iter != uniqueIndices.end()) { int index = *iter++; diff = points[index] - origin; points2[j].x() = dot(U, diff); points2[j].y() = dot(V, diff); height = dot(W, diff); if (height > maxHeight) { maxHeight = height; } j++; } // Compute minimum area box in 2D. MinOBB2 mobb(points2); box2 = mobb.getBox2(); // Update current minimum-volume box (if necessary). volume = maxHeight*box2.Extent[0]*box2.Extent[1]; if (volume < minVolume) { minVolume = volume; // Lift the values into 3D. mMinBox.Extent[0] = box2.Extent[0]; mMinBox.Extent[1] = box2.Extent[1]; mMinBox.Extent[2] = ((Real)0.5)*maxHeight; mMinBox.Axis[0] = box2.Axis[0].x()*U + box2.Axis[0].y()*V; mMinBox.Axis[1] = box2.Axis[1].x()*U + box2.Axis[1].y()*V; mMinBox.Axis[2] = W; mMinBox.Center = origin + box2.Center.x()*U + box2.Center.y()*V + mMinBox.Extent[2]*W; } } // The minimum-volume box can also be supported by three mutually // orthogonal edges of the convex hull. For each triple of orthogonal // edges, compute the minimum-volume box for that coordinate frame by // projecting the points onto the axes of the frame. std::set<EdgeKey>::const_iterator e2iter; for (e2iter = edges.begin(); e2iter != edges.end(); e2iter++) { W = points[e2iter->V[1]] - points[e2iter->V[0]]; W.normalize(); std::set<EdgeKey>::const_iterator e1iter = e2iter; for (++e1iter; e1iter != edges.end(); e1iter++) { V = points[e1iter->V[1]] - points[e1iter->V[0]]; V.normalize(); if (fabs(dot(V, W)) > ZERO_TOLERANCE_LOW) { continue; } std::set<EdgeKey>::const_iterator e0iter = e1iter; for (++e0iter; e0iter != edges.end(); e0iter++) { U = points[e0iter->V[1]] - points[e0iter->V[0]]; U.normalize(); if (fabs(dot(U,V)) > ZERO_TOLERANCE_LOW) { continue; } if (fabs(dot(U,W)) > ZERO_TOLERANCE_LOW) { continue; } // The three edges are mutually orthogonal. Project the // hull points onto the lines containing the edges. Use // hull point zero as the origin. Real umin = (Real)0, umax = (Real)0; Real vmin = (Real)0, vmax = (Real)0; Real wmin = (Real)0, wmax = (Real)0; origin = points[hullIndices[0]]; std::set<int>::const_iterator iter = uniqueIndices.begin(); while (iter != uniqueIndices.end()) { int index = *iter++; diff = points[index] - origin; Real fU = dot(U, diff); if (fU < umin) { umin = fU; } else if (fU > umax) { umax = fU; } Real fV = dot(V, diff); if (fV < vmin) { vmin = fV; } else if (fV > vmax) { vmax = fV; } Real fW = dot(W, diff); if (fW < wmin) { wmin = fW; } else if (fW > wmax) { wmax = fW; } } Real uExtent = ((Real)0.5)*(umax - umin); Real vExtent = ((Real)0.5)*(vmax - vmin); Real wExtent = ((Real)0.5)*(wmax - wmin); // Update current minimum-volume box (if necessary). volume = uExtent*vExtent*wExtent; if (volume < minVolume) { minVolume = volume; mMinBox.Extent[0] = uExtent; mMinBox.Extent[1] = vExtent; mMinBox.Extent[2] = wExtent; mMinBox.Axis[0] = U; mMinBox.Axis[1] = V; mMinBox.Axis[2] = W; mMinBox.Center = origin + ((Real)0.5)*(umin+umax)*U + ((Real)0.5)*(vmin+vmax)*V + ((Real)0.5)*(wmin+wmax)*W; } } } } isReady = true; } void Geom::MinOBB::GenerateComplementBasis (Vector3& u, Vector3& v, const Vector3& w) { Real invLength; if (fabs(w[0]) >= fabs(w[1])) { // W.x or W.z is the largest magnitude component, swap them invLength = (Real)1/sqrt(w[0]*w[0] + w[2]*w[2]); u[0] = -w[2]*invLength; u[1] = (Real)0; u[2] = +w[0]*invLength; v[0] = w[1]*u[2]; v[1] = w[2]*u[0] - w[0]*u[2]; v[2] = -w[1]*u[0]; } else { // W.y or W.z is the largest magnitude component, swap them invLength = (Real)1/sqrt(w[1]*w[1] + w[2]*w[2]); u[0] = (Real)0; u[1] = +w[2]*invLength; u[2] = -w[1]*invLength; v[0] = w[1]*u[2] - w[2]*u[1]; v[1] = -w[0]*u[2]; v[2] = w[0]*u[1]; } } void Geom::MinOBB::getCorners( QVector<Vector3> &pnts ) { pnts.resize(8); if ( dot(cross(mMinBox.Axis[0], mMinBox.Axis[1]), mMinBox.Axis[2]) < 0 ) { mMinBox.Axis[2] = -mMinBox.Axis[2]; } QVector<Vector3> Axis; for (int i=0;i<3;i++) { Axis.push_back( 2 * mMinBox.Extent[i] * mMinBox.Axis[i]); } pnts[0] = mMinBox.Center - 0.5*Axis[0] - 0.5*Axis[1] + 0.5*Axis[2]; pnts[1] = pnts[0] + Axis[0]; pnts[2] = pnts[1] - Axis[2]; pnts[3] = pnts[2] - Axis[0]; pnts[4] = pnts[0] + Axis[1]; pnts[5] = pnts[1] + Axis[1]; pnts[6] = pnts[2] + Axis[1]; pnts[7] = pnts[3] + Axis[1]; } Geom::MinOBB::EdgeKey::EdgeKey (int v0, int v1) { if (v0 < v1) { // v0 is minimum V[0] = v0; V[1] = v1; } else { // v1 is minimum V[0] = v1; V[1] = v0; } } //---------------------------------------------------------------------------- bool Geom::MinOBB::EdgeKey::operator< (const EdgeKey& key) const { if (V[1] < key.V[1]) { return true; } if (V[1] > key.V[1]) { return false; } return V[0] < key.V[0]; } //---------------------------------------------------------------------------- Geom::MinOBB::EdgeKey::operator size_t () const { return V[0] | (V[1] << 16); }
ce984bbbbcff2be4b004658ea1e0bf5c74613b03
89ebb834fb4c3f9d9a3ec250efa18eaea5d3879d
/designPatterns/Builder2nd/src/Builder2nd.cpp
5dddc0e134d1515aea4db092b5679df44c240009
[]
no_license
ManteshE/cpp
0656107ec7464d0461bf822824f029797e0a812d
b8d3a965d2455d027591fcb30bf8207932026a38
refs/heads/master
2020-03-28T00:08:52.220164
2018-09-08T17:47:31
2018-09-08T17:47:31
147,379,249
0
0
null
null
null
null
UTF-8
C++
false
false
1,171
cpp
Builder2nd.cpp
//============================================================================ // Name : Builder2nd.cpp // Author : Mantesh // Version : // Copyright : Your copyright notice // Description : //============================================================================ #include <iostream> #include <sstream> #include <string> using namespace std; class Email { public: class EmailBuilder; Email(string from, string to) { m_from = from; m_to = to; } string to_string() { stringstream stream; stream << "\nFrom : " << m_from << "\nTo : " << m_to; return stream.str(); } string m_from; string m_to; }; class Email::EmailBuilder { public: EmailBuilder& from(string from) { m_from = from; return *this; } EmailBuilder& to(string to) { m_to = to; return *this; } Email build() const { return Email{m_from, m_to}; } private: string m_from; string m_to; }; int main() { cout << "Builder example !!!" << endl; // prints Builder example Email email = Email::EmailBuilder{}.from("abc@gmail.com") .to("xyz@gmail.com") .build(); cout << "Email data" << email.to_string() << endl; return 0; }
d9378dd7960ac22dd93a061fa17b180b38da8ea9
aa9c1220a0b2b0fa6ba89acd03148cc71bfd749b
/c2/frameworks/runtime-src/Classes/auto/lua_YVChatNode_auto.cpp
be57ac3788495b8fd695de29e43a00722147e520
[]
no_license
JackXuXin/nn
2d291371a5ae97eb75057fb9545347e1ba49c6f1
7918bc403a400732071acff1b3fbbb42d6b8d7b9
refs/heads/master
2021-08-29T01:38:11.518210
2017-12-13T09:35:23
2017-12-13T09:35:23
112,933,598
3
5
null
null
null
null
UTF-8
C++
false
false
19,371
cpp
lua_YVChatNode_auto.cpp
#include "lua_YVChatNode_auto.hpp" #include "YVChatNode.h" #include "tolua_fix.h" #include "LuaBasicConversions.h" int lua_YVChatNode_YVChatNode_setisvoiceAutoplay(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_setisvoiceAutoplay'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { bool arg0; ok &= luaval_to_boolean(tolua_S, 2,&arg0, "YVChatNode:setisvoiceAutoplay"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_setisvoiceAutoplay'", nullptr); return 0; } cobj->setisvoiceAutoplay(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:setisvoiceAutoplay",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_setisvoiceAutoplay'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_setFrindChat(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_setFrindChat'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { bool arg0; ok &= luaval_to_boolean(tolua_S, 2,&arg0, "YVChatNode:setFrindChat"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_setFrindChat'", nullptr); return 0; } cobj->setFrindChat(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:setFrindChat",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_setFrindChat'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_removeFromParent(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_removeFromParent'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 0) { if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_removeFromParent'", nullptr); return 0; } cobj->removeFromParent(); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:removeFromParent",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_removeFromParent'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_setParent(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_setParent'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { cocos2d::Node* arg0; ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_setParent'", nullptr); return 0; } cobj->setParent(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:setParent",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_setParent'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_onStopRecordListern(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_onStopRecordListern'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { YVSDK::RecordStopNotify* arg0; #pragma warning NO CONVERSION TO NATIVE FOR RecordStopNotify* ok = false; if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_onStopRecordListern'", nullptr); return 0; } cobj->onStopRecordListern(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:onStopRecordListern",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_onStopRecordListern'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_releaseVoiceList(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_releaseVoiceList'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 0) { if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_releaseVoiceList'", nullptr); return 0; } cobj->releaseVoiceList(); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:releaseVoiceList",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_releaseVoiceList'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_autoPlayeVoice(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_autoPlayeVoice'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { double arg0; ok &= luaval_to_number(tolua_S, 2,&arg0, "YVChatNode:autoPlayeVoice"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_autoPlayeVoice'", nullptr); return 0; } cobj->autoPlayeVoice(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:autoPlayeVoice",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_autoPlayeVoice'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_init(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_init'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 0) { if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_init'", nullptr); return 0; } bool ret = cobj->init(); tolua_pushboolean(tolua_S,(bool)ret); return 1; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:init",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_init'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_addContextItem(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_addContextItem'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { ChatItem* arg0; ok &= luaval_to_object<ChatItem>(tolua_S, 2, "ChatItem",&arg0); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_addContextItem'", nullptr); return 0; } cobj->addContextItem(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:addContextItem",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_addContextItem'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_getItemByMsg(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_getItemByMsg'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { unsigned long long arg0; #pragma warning NO CONVERSION TO NATIVE FOR unsigned long long ok = false; if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_getItemByMsg'", nullptr); return 0; } ChatItem* ret = cobj->getItemByMsg(arg0); object_to_luaval<ChatItem>(tolua_S, "ChatItem",(ChatItem*)ret); return 1; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:getItemByMsg",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_getItemByMsg'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_BeginVoice(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_BeginVoice'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 0) { if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_BeginVoice'", nullptr); return 0; } cobj->BeginVoice(); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:BeginVoice",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_BeginVoice'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_recordingTimeUpdate(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_recordingTimeUpdate'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { double arg0; ok &= luaval_to_number(tolua_S, 2,&arg0, "YVChatNode:recordingTimeUpdate"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_recordingTimeUpdate'", nullptr); return 0; } cobj->recordingTimeUpdate(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:recordingTimeUpdate",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_recordingTimeUpdate'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_EndVoice(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_EndVoice'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 1) { std::string arg0; ok &= luaval_to_std_string(tolua_S, 2,&arg0, "YVChatNode:EndVoice"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_EndVoice'", nullptr); return 0; } cobj->EndVoice(arg0); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:EndVoice",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_EndVoice'.",&tolua_err); #endif return 0; } int lua_YVChatNode_YVChatNode_CancelVoice(lua_State* tolua_S) { int argc = 0; YVChatNode* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"YVChatNode",0,&tolua_err)) goto tolua_lerror; #endif cobj = (YVChatNode*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_YVChatNode_YVChatNode_CancelVoice'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 0) { if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_YVChatNode_YVChatNode_CancelVoice'", nullptr); return 0; } cobj->CancelVoice(); return 0; } luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "YVChatNode:CancelVoice",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_YVChatNode_YVChatNode_CancelVoice'.",&tolua_err); #endif return 0; } static int lua_YVChatNode_YVChatNode_finalize(lua_State* tolua_S) { printf("luabindings: finalizing LUA object (YVChatNode)"); return 0; } int lua_register_YVChatNode_YVChatNode(lua_State* tolua_S) { tolua_usertype(tolua_S,"YVChatNode"); tolua_cclass(tolua_S,"YVChatNode","YVChatNode","cc.Node",nullptr); tolua_beginmodule(tolua_S,"YVChatNode"); tolua_function(tolua_S,"setisvoiceAutoplay",lua_YVChatNode_YVChatNode_setisvoiceAutoplay); tolua_function(tolua_S,"setFrindChat",lua_YVChatNode_YVChatNode_setFrindChat); tolua_function(tolua_S,"removeFromParent",lua_YVChatNode_YVChatNode_removeFromParent); tolua_function(tolua_S,"setParent",lua_YVChatNode_YVChatNode_setParent); tolua_function(tolua_S,"onStopRecordListern",lua_YVChatNode_YVChatNode_onStopRecordListern); tolua_function(tolua_S,"releaseVoiceList",lua_YVChatNode_YVChatNode_releaseVoiceList); tolua_function(tolua_S,"autoPlayeVoice",lua_YVChatNode_YVChatNode_autoPlayeVoice); tolua_function(tolua_S,"init",lua_YVChatNode_YVChatNode_init); tolua_function(tolua_S,"addContextItem",lua_YVChatNode_YVChatNode_addContextItem); tolua_function(tolua_S,"getItemByMsg",lua_YVChatNode_YVChatNode_getItemByMsg); tolua_function(tolua_S,"BeginVoice",lua_YVChatNode_YVChatNode_BeginVoice); tolua_function(tolua_S,"recordingTimeUpdate",lua_YVChatNode_YVChatNode_recordingTimeUpdate); tolua_function(tolua_S,"EndVoice",lua_YVChatNode_YVChatNode_EndVoice); tolua_function(tolua_S,"CancelVoice",lua_YVChatNode_YVChatNode_CancelVoice); tolua_endmodule(tolua_S); std::string typeName = typeid(YVChatNode).name(); g_luaType[typeName] = "YVChatNode"; g_typeCast["YVChatNode"] = "YVChatNode"; return 1; } TOLUA_API int register_all_YVChatNode(lua_State* tolua_S) { tolua_open(tolua_S); tolua_module(tolua_S,"yvcc",0); tolua_beginmodule(tolua_S,"yvcc"); lua_register_YVChatNode_YVChatNode(tolua_S); tolua_endmodule(tolua_S); return 1; }
7f4a132669cb9bccb0d94f95c2744286a3c69e88
d0a2a6a83168b5a1fa8d6202e450f808bdd27722
/plugin/libdbusmenuqt/dbusmenuimporter.h
d041782652580e03721a89710b4fd3aa8e2c52a7
[]
no_license
KDE/plasma-active-window-control
4d321d3d9a23079157c65de6afd52a54a2c8729b
6ec2af55ed474479f568c44ba0d5ee0c5c822464
refs/heads/master
2023-03-16T14:36:41.763875
2023-03-12T03:35:56
2023-03-12T03:35:56
106,180,033
23
6
null
null
null
null
UTF-8
C++
false
false
2,549
h
dbusmenuimporter.h
/* This file is part of the dbusmenu-qt library SPDX-FileCopyrightText: 2009 Canonical SPDX-FileCopyrightText: Aurelien Gateau <aurelien.gateau@canonical.com> SPDX-License-Identifier: LGPL-2.0-or-later */ #ifndef DBUSMENUIMPORTER_H #define DBUSMENUIMPORTER_H // Qt #include <QObject> class QAction; class QDBusPendingCallWatcher; class QDBusVariant; class QIcon; class QMenu; class DBusMenuImporterPrivate; /** * A DBusMenuImporter instance can recreate a menu serialized over DBus by * DBusMenuExporter */ class DBusMenuImporter : public QObject { Q_OBJECT public: /** * Creates a DBusMenuImporter listening over DBus on service, path */ DBusMenuImporter(const QString &service, const QString &path, QObject *parent = nullptr); ~DBusMenuImporter() override; QAction *actionForId(int id) const; /** * The menu created from listening to the DBusMenuExporter over DBus */ QMenu *menu() const; public Q_SLOTS: /** * Load the menu * * Will emit menuUpdated() when complete. * This should be done before showing a menu */ void updateMenu(); void updateMenu(QMenu *menu); Q_SIGNALS: /** * Emitted after a call to updateMenu(). * @see updateMenu() */ void menuUpdated(QMenu *); /** * Emitted when the exporter was asked to activate an action */ void actionActivationRequested(QAction *); protected: /** * Must create a menu, may be customized to fit host appearance. * Default implementation creates a simple QMenu. */ virtual QMenu *createMenu(QWidget *parent); /** * Must convert a name into an icon. * Default implementation returns a null icon. */ virtual QIcon iconForName(const QString &); private Q_SLOTS: void sendClickedEvent(int); void slotMenuAboutToShow(); void slotMenuAboutToHide(); void slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *); void slotItemActivationRequested(int id, uint timestamp); void processPendingLayoutUpdates(); void slotLayoutUpdated(uint revision, int parentId); void slotGetLayoutFinished(QDBusPendingCallWatcher *); private: Q_DISABLE_COPY(DBusMenuImporter) DBusMenuImporterPrivate *const d; friend class DBusMenuImporterPrivate; // Use Q_PRIVATE_SLOT to avoid exposing DBusMenuItemList Q_PRIVATE_SLOT(d, void slotItemsPropertiesUpdated(const DBusMenuItemList &updatedList, const DBusMenuItemKeysList &removedList)) }; #endif /* DBUSMENUIMPORTER_H */
4b5c1ee65d9c7ba1794b0cb6c6324353c6a5f81f
d6dcf7cea843560c76abce63688cd6b915afeab8
/DualTetrahedron/DualTetrahedron.cpp
ddcd9990e85293b9fdd38469fbe13e2edf5221fc
[]
no_license
reecec/CI312-Graphic-Algorithms
37b7743b9958559542814deb36cb0e5398e3d58e
d7b15711a35a84ed8fab5a377a72454db4f97064
refs/heads/master
2022-11-10T06:50:52.872889
2020-06-30T13:15:20
2020-06-30T13:15:20
115,644,255
0
0
null
null
null
null
UTF-8
C++
false
false
20,922
cpp
DualTetrahedron.cpp
// Geometry // // This tutorial supports learning // about assembling a scene in a scene graph // using transformation cores // headers for OpenSG configuration and GLUT #include <OpenSG/OSGGLUT.h> #include <OpenSG/OSGConfig.h> #include <OpenSG/OSGSimpleGeometry.h> #include <OpenSG/OSGGLUTWindow.h> #include <OpenSG/OSGSimpleSceneManager.h> #include <OpenSG/OSGSceneFileHandler.h> #include <OpenSG/OSGGeoProperties.h> #include <math.h> #include <OpenSG/OSGTriangleIterator.h> // Simple Scene manager for accesing cameras and geometry OSG::SimpleSceneManagerRefPtr mgr; //OSG::NodeRefPtr createCube(); OSG::NodeRefPtr createTetrahedron(float); OSG::NodeRefPtr createDual(OSG::NodeRefPtr nodegeo); OSG::NodeRefPtr createCube(); //OSG::Vec3f getNorms(OSG::Pnt3f a, OSG::Pnt3f b, OSG::Pnt3f c); int setupGLUT(int *argc, char *argv[]); enum MENU_ITEMS { WIREFRAME, SOLID, VERTEX, }; int main(int argc, char **argv) { // initialise OpenSG OSG::osgInit(argc, argv); // initialise GLUT int winid = setupGLUT(&argc, argv); { // create a OSGGLUT window OSG::GLUTWindowRefPtr gwin = OSG::GLUTWindow::create(); gwin->setGlutId(winid); gwin->init(); OSG::NodeRefPtr scene = OSG::Node::create(); OSG::GroupRefPtr group_core = OSG::Group::create(); scene->setCore(group_core); //value for sides of tetrahedron to be passed in float s = 1; //create a tetrahedron OSG::NodeRefPtr tetra = createTetrahedron(s); scene->addChild(tetra); OSG::NodeRefPtr dual = createDual(tetra); scene->addChild(dual); //commit all changes to OpenSG OSG::commitChanges(); // create the SimpleSceneManager helper mgr = OSG::SimpleSceneManager::create(); // tell the manager what to manage mgr->setWindow(gwin); mgr->setRoot(scene); // show the whole scene mgr->showAll(); } // GLUT main loop glutMainLoop(); return 0; } // // GLUT callback functions // // redraw the window void display(void) { mgr->redraw(); } // react to size changes void reshape(int w, int h) { mgr->resize(w, h); glutPostRedisplay(); } // react to mouse button presses void mouse(int button, int state, int x, int y) { if (!state) mgr->mouseButtonPress(button, x, y); glutPostRedisplay(); } // react to mouse motions with pressed buttons void motion(int x, int y) { mgr->mouseMove(x, y); glutPostRedisplay(); } // react to keys void keyboard(unsigned char k, int x, int y) { switch (k) { case 'e': { // clean up global variables mgr = NULL; OSG::osgExit(); exit(0); } break; case 's': { mgr->setStatistics(!mgr->getStatistics()); } break; } } void menu(int item) { switch (item) { case VERTEX: { glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); } break; case WIREFRAME: { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } break; case SOLID: { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } break; default: { } break; } glutPostRedisplay(); return; } void createMenu() { glutCreateMenu(menu); // Add menu items glutAddMenuEntry("Show vertices", VERTEX); glutAddMenuEntry("Show wireframe", WIREFRAME); glutAddMenuEntry("Show solid", SOLID); // Associate a mouse button with menu glutAttachMenu(GLUT_RIGHT_BUTTON); return; } // setup the GLUT library which handles the windows for us int setupGLUT(int *argc, char *argv[]) { glutInit(argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); int winid = glutCreateWindow("02 Geometry Tutorial"); glutReshapeFunc(reshape); glutDisplayFunc(display); glutMouseFunc(mouse); glutMotionFunc(motion); glutKeyboardFunc(keyboard); createMenu(); return winid; } OSG::NodeRefPtr createDual(OSG::NodeRefPtr nodegeo) { //create a node to hold the geometry OSG::NodeRefPtr dualthnode = OSG::Node::create(); //used to iterate over OpenGL triangle primitives OSG::TriangleIterator triangleIterator; //create a geometry OSG::GeometryRefPtr thgeo = OSG::Geometry::create(); //reference geometry core to hold passed in geomotry core (tetrahedron geometry) OSG::GeometryRefPtr geocore = dynamic_cast<OSG::Geometry *>(nodegeo->getCore()); //The primitive types. //OpenGL provides us with several different types of shapes that we can draw //(e.g. GL_LINES, GL_POLYGON, GL_QUADS, GL_TRIANGLES) //we need to specify the type of geometry we want to use //lets start by using only triangles (although different //types can be freely mixed) OSG::GeoUInt8PropertyRefPtr type = OSG::GeoUInt8Property::create(); //adding OpenGl triangle primitive to type type->addValue(GL_TRIANGLES); // The primitive lengths. //These define the number of vertices to be passed to OpenGL for each //primitive Thus there have to be at least as many entries as in the types //property.in the case of the cube we are using 12 triangles which each //have 3 vertices (12 X 3 = 36) OSG::GeoUInt32PropertyRefPtr lens = OSG::GeoUInt32Property::create(); lens->addValue(12); //4 triangles which have 3 vertices (4 * 3 = 12) //vector to store centre of points for dual geometry std::vector<OSG::Pnt3f> dualPoints; //iterate over triangle primitives of geometry core passed in (tetrahedron) //code for loop shown in lecture slides for (triangleIterator = geocore->beginTriangles(); triangleIterator != geocore->endTriangles(); ++triangleIterator) { std::cout << "Triangle " << triangleIterator.getIndex() << ":" << std::endl; std::cout << triangleIterator.getPosition(0) << std::endl; std::cout << triangleIterator.getPosition(1) << std::endl; std::cout << triangleIterator.getPosition(2) << std::endl; //storing 3 points of trinagle primitive currently iterating OSG::Pnt3f p0 = triangleIterator.getPosition(0); OSG::Pnt3f p1 = triangleIterator.getPosition(1); OSG::Pnt3f p2 = triangleIterator.getPosition(2); //variables to store centre co-ordinates of triangle primitive iterating over //by applying formula to assign the variable value float xdual = (p0.x() + p1.x() + p2.x()) / 3; float ydual = (p0.y() + p1.y() + p2.y()) / 3; float zdual = (p0.z() + p1.z() + p2.z()) / 3; std::cout << "Points of dual " << OSG::Pnt3f(xdual, ydual, zdual) << std::endl; //adding Pnt3f variable (centre point of triangle primitive) to end of dual points //vector storing centre points for dual geometry dualPoints.push_back(OSG::Pnt3f(xdual, ydual, zdual)); } //used to iterate over dual points reference pointer list std::vector<OSG::Pnt3f>::iterator myIntVectorIterator; //used to store final centre points for indexing dual geometry OSG::GeoPnt3fPropertyRefPtr finaldualPoints = OSG::GeoPnt3fProperty::create(); //iterating over dual points vector containing //centre points so can be added to finaldualpoints pointer //to add points for indexing the dual geometry for (myIntVectorIterator = dualPoints.begin(); myIntVectorIterator != dualPoints.end(); myIntVectorIterator++) { finaldualPoints->addValue(*myIntVectorIterator); } // The indices. // in order not to replicate the same positions all the time, // use index number of the position in relation to index of pnts reference pointer list OSG::GeoUInt32PropertyRefPtr indices = OSG::GeoUInt32Property::create(); //POINTS OF FACES //face 1: front of tetrahedron //face 1: left of dual tetrahedron indices->addValue(0); indices->addValue(3); indices->addValue(1); //face 2: left of tetrahedron //face 2: right of dual tetrahedron indices->addValue(2); indices->addValue(3); indices->addValue(0); //face 3: right of tetrahedron //face 3: front of dual tetrahedron indices->addValue(1); indices->addValue(3); indices->addValue(2); //face 4: bottom of tetrahedron //face 4: top of dual tetrahedron indices->addValue(1); indices->addValue(2); indices->addValue(0); // Put it all together into a Geometry NodeCore. thgeo->setTypes(type); thgeo->setLengths(lens); thgeo->setProperty(finaldualPoints, OSG::Geometry::PositionsIndex); thgeo->setIndex(indices, OSG::Geometry::PositionsIndex); dualthnode->setCore(thgeo); return dualthnode; } OSG::NodeRefPtr createTetrahedron(float length) { //create a node to hold the geometry OSG::NodeRefPtr thnode = OSG::Node::create(); //create a geometry OSG::GeometryRefPtr thgeo = OSG::Geometry::create(); //The primitive types. //OpenGL provides us with several different types of shapes that we can draw //(e.g. GL_LINES, GL_POLYGON, GL_QUADS, GL_TRIANGLES) //we need to specify the type of geometry we want to use //lets start by using only triangles (although different types can be freely mixed) OSG::GeoUInt8PropertyRefPtr type = OSG::GeoUInt8Property::create(); //MODIFY HERE type->addValue(GL_TRIANGLES); //The primitive lengths. //These define the number of vertices to be passed to OpenGL for each primitive. //Thus there have to be at least as many entries as in the types property. //in the case of the cube we are using 12 triangles which each have 3 vertices (12 X 3 = 36) OSG::GeoUInt32PropertyRefPtr lens = OSG::GeoUInt32Property::create(); //MODIFY HERE lens->addValue(12); //4 triangles which have 3 vertices (4 * 3 = 12) float s, h, H; //side s = length; //lateral height h = (sqrt(3) * s) / 2; //space height H = (sqrt(6) * s) / 3; //variables to store co-ordinates of four points of tetrahedron OSG::Pnt3f p0, p1, p2, p3; // The vertices. OSG::GeoPnt3fPropertyRefPtr pnts = OSG::GeoPnt3fProperty::create(); //MODIFY HERE with positions of your geometry p0 = OSG::Pnt3f(0.0, 0.0, 0.0); pnts->addValue(OSG::Pnt3f(p0)); //point 0 - origin p1 = OSG::Pnt3f(s, 0.0, 0.0); pnts->addValue(OSG::Pnt3f(p1)); //point 1 - x/right p2 = OSG::Pnt3f(s / 2, 0.0, h); pnts->addValue(OSG::Pnt3f(p2)); //point 2 - z/forward p3 = OSG::Pnt3f(s / 2, H, h/3); pnts->addValue(OSG::Pnt3f(p3)); //point 3 - y/top vertex //print to console point co-ordinates std::cout << "Point 0: " << p0 << std::endl; std::cout << "Point 1: " << p1 << std::endl; std::cout << "Point 2: " << p2 << std::endl; std::cout << "Point 3: " << p3 << std::endl; //vectors for front face OSG::Vec3f FFVA = p0-p1; OSG::Vec3f FFVB = p3 - p1; //vectors for left face OSG::Vec3f LFVA = p2-p0; OSG::Vec3f LFVB = p3 - p0; //vectors for right face OSG::Vec3f RFVA = p1-p2; OSG::Vec3f RFVB = p3-p2; //vectors for bottom face OSG::Vec3f BFVA = p1-p0; OSG::Vec3f BFVB = p2-p0; //cross product of faces to get face normals OSG::GeoVec3fPropertyRefPtr norms = OSG::GeoVec3fProperty::create(); norms->push_back(OSG::Vec3f(FFVA.cross(FFVB))); //front norms->push_back(OSG::Vec3f(LFVA.cross(LFVB))); //left norms->push_back(OSG::Vec3f(RFVA.cross(LFVB))); //right norms->push_back(OSG::Vec3f(BFVA.cross(BFVB))); //bottom //Calculate distances of edges of tetrahedron by using varation of pyhtagerous thereom, Magnitude of edge vectors float squared = 2; //power of value to pass in for pow function float mag_VecFFVA = std::sqrt((pow(FFVA.x(), squared)) + pow(FFVA.y(), squared) + pow(FFVA.z(), squared)); float mag_VecFFVB = std::sqrt((pow(FFVB.x(), squared)) + pow(FFVB.y(), squared) + pow(FFVB.z(), squared)); float mag_VecLFVA = std::sqrt((pow(LFVA.x(), squared)) + pow(LFVA.y(), squared) + pow(LFVA.z(), squared)); float mag_VecLFVB = std::sqrt((pow(LFVB.x(), squared)) + pow(LFVB.y(), squared) + pow(LFVB.z(), squared)); float mag_VecRFVA = std::sqrt((pow(RFVA.x(), squared)) + pow(RFVA.y(), squared) + pow(RFVA.z(), squared)); float mag_VecRFVB = std::sqrt((pow(RFVB.x(), squared)) + pow(RFVB.y(), squared) + pow(RFVB.z(), squared)); float mag_VecBFVA = std::sqrt((pow(BFVA.x(), squared)) + pow(BFVA.y(), squared) + pow(BFVA.z(), squared)); float mag_VecBFVB = std::sqrt((pow(BFVB.x(), squared)) + pow(BFVB.y(), squared) + pow(BFVB.z(), squared)); //printing to console vector magnitudes std::cout << "Tetrahedron edge vector magnitudes" << std::endl; std::cout << "Vector FFVA magnitude: " << mag_VecFFVA << std::endl; std::cout << "Vector FFVB magnitude: " << mag_VecFFVB << std::endl; std::cout << "Vector LFVA magnitude: " << mag_VecLFVA << std::endl; std::cout << "Vector LFVB magnitude: " << mag_VecLFVB << std::endl; std::cout << "Vector RFVA magnitude: " << mag_VecRFVA << std::endl; std::cout << "Vector RFVB magnitude: " << mag_VecRFVB << std::endl; std::cout << "Vector BFVA magnitude: " << mag_VecBFVA << std::endl; std::cout << "Vector BFVB magnitude: " << mag_VecBFVB << std::endl; // The colours. // GeoColor3fProperty stores all color values that will be used OSG::GeoColor3fPropertyRecPtr colors = OSG::GeoColor3fProperty::create(); colors->addValue(OSG::Color3f(0, 0, 1)); //blue - front face colors->addValue(OSG::Color3f(1, 0, 0)); //red - left face colors->addValue(OSG::Color3f(0, 1, 0)); //green - right face colors->addValue(OSG::Color3f(1, 0.5, 0)); //orange - bottom face // The indices. // in order not to replicate the same positions all the time, // use index number of the position in relation to index of pnts reference pointer list OSG::GeoUInt32PropertyRefPtr indices = OSG::GeoUInt32Property::create(); //POINTS OF FACES //face 1: front //face 1 - triangle 1 indices->addValue(0); indices->addValue(3); indices->addValue(1); //face 2: left //face 2: triangle 2 indices->addValue(2); indices->addValue(3); indices->addValue(0); //face 3: right //face 3: triangle 3 indices->addValue(1); indices->addValue(3); indices->addValue(2); //face 4: bottom //face 4: triangle 4 indices->addValue(1); indices->addValue(2); indices->addValue(0); // The indices for colours and normals // as normals are different for each side of the cube, we use a special index for this property OSG::GeoUInt32PropertyRefPtr indicesnormpos = OSG::GeoUInt32Property::create(); //FACE NORMALS //face 1: front indicesnormpos->addValue(0); indicesnormpos->addValue(0); indicesnormpos->addValue(0); //face 2: left indicesnormpos->addValue(1); indicesnormpos->addValue(1); indicesnormpos->addValue(1); //face 3: right indicesnormpos->addValue(2); indicesnormpos->addValue(2); indicesnormpos->addValue(2); //face 4: bottom indicesnormpos->addValue(3); indicesnormpos->addValue(3); indicesnormpos->addValue(3); // Put it all together into a Geometry NodeCore. thgeo->setTypes(type); thgeo->setLengths(lens); thgeo->setProperty(pnts, OSG::Geometry::PositionsIndex); thgeo->setIndex(indices, OSG::Geometry::PositionsIndex); thgeo->setProperty(norms, OSG::Geometry::NormalsIndex); thgeo->setIndex(indicesnormpos, OSG::Geometry::NormalsIndex); thgeo->setProperty(colors, OSG::Geometry::ColorsIndex); thgeo->setIndex(indicesnormpos, OSG::Geometry::ColorsIndex); thnode->setCore(thgeo); return thnode; } OSG::NodeRefPtr createCube() { //create a node to hold the geometry OSG::NodeRefPtr geonode = OSG::Node::create(); //create a geometry OSG::GeometryRefPtr geo = OSG::Geometry::create(); //The primitive types. //OpenGL provides us with several different types of shapes that we can draw //(e.g. GL_LINES, GL_POLYGON, GL_QUADS, GL_TRIANGLES) //we need to specify the type of geometry we want to use //lets start by using only triangles (although different types can be freely mixed) OSG::GeoUInt8PropertyRefPtr type = OSG::GeoUInt8Property::create(); //MODIFY HERE type->addValue(GL_TRIANGLES); //The primitive lengths. //These define the number of vertices to be passed to OpenGL for each primitive. //Thus there have to be at least as many entries as in the types property. //in the case of the cube we are using 12 triangles which each have 3 vertices (12 X 3 = 36) OSG::GeoUInt32PropertyRefPtr lens = OSG::GeoUInt32Property::create(); //MODIFY HERE lens->addValue(36); // The vertices. OSG::GeoPnt3fPropertyRefPtr pnts = OSG::GeoPnt3fProperty::create(); //MODIFY HERE with positions of your geometry pnts->addValue(OSG::Pnt3f(-0.5, 0.5, 0.5)); pnts->addValue(OSG::Pnt3f(0.5, 0.5, 0.5)); pnts->addValue(OSG::Pnt3f(0.5, -0.5, 0.5)); pnts->addValue(OSG::Pnt3f(-0.5, -0.5, 0.5)); pnts->addValue(OSG::Pnt3f(-0.5, 0.5, -0.5)); pnts->addValue(OSG::Pnt3f(0.5, 0.5, -0.5)); pnts->addValue(OSG::Pnt3f(0.5, -0.5, -0.5)); pnts->addValue(OSG::Pnt3f(-0.5, -0.5, -0.5)); // The normals. //These are used for lighting calculations and have to point away from the //surface. Normals are standard vectors. OSG::GeoVec3fPropertyRefPtr norms = OSG::GeoVec3fProperty::create(); norms->push_back(OSG::Vec3f(0, 0, 1)); norms->push_back(OSG::Vec3f(1, 0, 0)); norms->push_back(OSG::Vec3f(0, 0, -1)); norms->push_back(OSG::Vec3f(-1, 0, 0)); norms->push_back(OSG::Vec3f(0, 1, 0)); norms->push_back(OSG::Vec3f(0, -1, 0)); // The colours. // GeoColor3fProperty stores all color values that will be used OSG::GeoColor3fPropertyRecPtr colors = OSG::GeoColor3fProperty::create(); colors->addValue(OSG::Color3f(0, 0, 1)); colors->addValue(OSG::Color3f(0, 0, 1)); colors->addValue(OSG::Color3f(0, 0, 1)); colors->addValue(OSG::Color3f(0, 0, 1)); colors->addValue(OSG::Color3f(0, 0, 1)); colors->addValue(OSG::Color3f(0, 0, 1)); // The indices. // in order not to replicate the same positions all the time, // use index number of the position OSG::GeoUInt32PropertyRefPtr indices = OSG::GeoUInt32Property::create(); //face 1: front //face 1 - triangle 1 indices->addValue(0); indices->addValue(2); indices->addValue(1); //face 1 - triangle 2 indices->addValue(0); indices->addValue(3); indices->addValue(2); //face 2: right //face 2 - triangle 1 indices->addValue(1); indices->addValue(2); indices->addValue(6); //face 3 - triangle 2 indices->addValue(1); indices->addValue(6); indices->addValue(5); //face 3: back //face 3 - triangle 1 indices->addValue(5); indices->addValue(6); indices->addValue(7); //face 3 - triangle 2 indices->addValue(5); indices->addValue(7); indices->addValue(4); //face 4: left //face 4 - triangle 1 indices->addValue(4); indices->addValue(7); indices->addValue(3); //face 4 - triangle 2 indices->addValue(4); indices->addValue(3); indices->addValue(0); //face 5: top //face 5 - triangle 1 indices->addValue(4); indices->addValue(1); indices->addValue(5); //face 5 - triangle 2 indices->addValue(4); indices->addValue(0); indices->addValue(1); //face 6: bottom //face 6 - triangle 1 indices->addValue(2); indices->addValue(3); indices->addValue(7); //face 6 - triangle 2 indices->addValue(2); indices->addValue(7); indices->addValue(6); // The indices for colours and normals // as normals are different for each side of the cube, we use a special index for this property OSG::GeoUInt32PropertyRefPtr indicesnormpos = OSG::GeoUInt32Property::create(); //face 1: front //face 1 - triangle 1 indicesnormpos->addValue(0); indicesnormpos->addValue(0); indicesnormpos->addValue(0); //face 1 - triangle 2 indicesnormpos->addValue(0); indicesnormpos->addValue(0); indicesnormpos->addValue(0); //face 2: right //face 2 - triangle 1 indicesnormpos->addValue(1); indicesnormpos->addValue(1); indicesnormpos->addValue(1); //face 3 - triangle 2 indicesnormpos->addValue(1); indicesnormpos->addValue(1); indicesnormpos->addValue(1); //face 3: back //face 3 - triangle 1 indicesnormpos->addValue(2); indicesnormpos->addValue(2); indicesnormpos->addValue(2); //face 3 - triangle 2 indicesnormpos->addValue(2); indicesnormpos->addValue(2); indicesnormpos->addValue(2); //face 4: left //face 4 - triangle 1 indicesnormpos->addValue(3); indicesnormpos->addValue(3); indicesnormpos->addValue(3); //face 4 - triangle 2 indicesnormpos->addValue(3); indicesnormpos->addValue(3); indicesnormpos->addValue(3); //face 5: top //face 5 - triangle 1 indicesnormpos->addValue(4); indicesnormpos->addValue(4); indicesnormpos->addValue(4); //face 5 - triangle 2 indicesnormpos->addValue(4); indicesnormpos->addValue(4); indicesnormpos->addValue(4); //face 6: bottom //face 6 - triangle 1 indicesnormpos->addValue(5); indicesnormpos->addValue(5); indicesnormpos->addValue(5); //face 6 - triangle 2 indicesnormpos->addValue(5); indicesnormpos->addValue(5); indicesnormpos->addValue(5); // Put it all together into a Geometry NodeCore. geo->setTypes(type); geo->setLengths(lens); geo->setProperty(pnts, OSG::Geometry::PositionsIndex); geo->setIndex(indices, OSG::Geometry::PositionsIndex); geo->setProperty(norms, OSG::Geometry::NormalsIndex); geo->setIndex(indicesnormpos, OSG::Geometry::NormalsIndex); geo->setProperty(colors, OSG::Geometry::ColorsIndex); geo->setIndex(indicesnormpos, OSG::Geometry::ColorsIndex); // if you were not using any indexing you will simply use: //geo->setTypes (type); //geo->setLengths (lens); //geo->setPositions (pnts); //geo->setNormals (norms); //geo->setColors (colors); geonode->setCore(geo); return geonode; }