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
3dc43640c822c6b4ee3bb341132b78639901adbe
fbd8c56e8e449f7ac80b5156e80c15c14cb34b12
/Uva/Uva_AC/11878 Homework Checker.cpp
2a2d6a52f57dcc30e33ce2cd7a450c8be3500100
[ "MIT" ]
permissive
Saikat-S/acm-problems-solutions
558374a534f4f4aa2bf3bea889c1d5c5a536cf59
921c0f3e508e1ee8cd14be867587952d5f67bbb9
refs/heads/master
2021-08-03T02:27:21.019914
2021-07-27T06:18:28
2021-07-27T06:18:28
132,938,151
4
0
null
null
null
null
UTF-8
C++
false
false
2,411
cpp
11878 Homework Checker.cpp
/*************************************************** * Problem name : 11878 Homework Checker.cpp * Problem Link : https://uva.onlinejudge.org/external/118/11878.pdf * OJ : Uva * Verdict : AC * Date : 2017-07-25 * Problem Type : AdHoc * Author Name : Saikat Sharma * University : CSE,MBSTU ***************************************************/ #include<iostream> #include<cstdio> #include<algorithm> #include<climits> #include<cstring> #include<string> #include<sstream> #include<cmath> #include<vector> #include<queue> #include<cstdlib> #include<deque> #include<stack> #include<map> #include<set> #define __FastIO ios_base::sync_with_stdio(false); cin.tie(0) #define SET(a) memset(a,-1,sizeof(a)) #define pii pair<int,int> #define pll pair <int, int> #define debug printf("#########\n") #define nl printf("\n") #define sl(n) scanf("%lld", &n) #define sf(n) scanf("%lf", &n) #define si(n) scanf("%d", &n) #define ss(n) scanf("%s", n) #define pb push_back #define MAX 100000 using namespace std; typedef long long ll; typedef unsigned long long ull; template <typename T> std::string NumberToString ( T Number ) { std::ostringstream ss; ss << Number; return ss.str(); } ll gcd(ll a, ll b) { if (a % b == 0) return b; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } /************************************ Code Start Here ******************************************************/ int main () { //~ freopen("input.txt", "r", stdin); //~ freopen("output.txt", "w", stdout); string str; int cnt = 0; while (cin >> str) { int sz = str.size(), a = 0, b = 0, c = 0, i = 0, flag = 0; char ch; while (str[i] != '+' && str[i] != '-') { a = (a * 10 ) + (str[i] - '0'); i++; } ch = str[i]; i++; while (str[i] != '=') { b = (b * 10) + (str[i] - '0'); i++; } i++; if (str[i] != '?') { while (i < sz) { c = (c * 10) + (str[i] - '0'); i++; } } else { flag = 1; } int ans; if (ch == '+') ans = a + b; else if (ch == '-') ans = a - b; if (!flag && ans == c) cnt++; //~ printf("a = %d , b = %d , c = %d, ch = %c\n", a, b, c, ch); } printf("%d\n", cnt); return 0; }
e798915e79b098a67743b27766ed5b7ecad71ff7
e36906be9399685b0d03daffec9c33735eda8ba1
/src/mpl/yocto/mpl/natural.hpp
1497fe823a9bc58f142452800fc6fb4f5cc4673b
[]
no_license
ybouret/yocto4
20deaa21c1ed4f52d5d6a7991450d90103a7fe8e
c02aa079d21cf9828f188153e5d65c1f0d62021c
refs/heads/master
2020-04-06T03:34:11.834637
2016-09-09T14:41:55
2016-09-09T14:41:55
33,724,799
1
0
null
null
null
null
UTF-8
C++
false
false
19,131
hpp
natural.hpp
#ifndef YOCTO_MPL_NATURAL_INCLUDED #define YOCTO_MPL_NATURAL_INCLUDED 1 #include "yocto/mpl/types.hpp" #include "yocto/memory/buffers.hpp" #include "yocto/code/endian.hpp" #include "yocto/code/bswap.hpp" #include "yocto/xnumeric.hpp" #include "yocto/ios/bitio.hpp" #include "yocto/ios/ostream.hpp" #include "yocto/ios/istream.hpp" #include <iosfwd> namespace yocto { namespace mpl { #define YOCTO_CHECK_MPN(X) \ assert( (X).byte != 0 ); \ assert( (X).maxi > 0 ); \ assert( (X).size <= (X).maxi );\ assert( ! ( ((X).size>0) && (X).byte[(X).size-1] <= 0 ) ) #define YOCTO_MPN_DECL(RET,OP,CALL) \ inline friend RET operator OP (const natural &lhs, const natural &rhs) \ { return CALL(lhs.byte,lhs.size,rhs.byte,rhs.size); } \ inline friend RET operator OP (const natural &lhs, word_t rhs ) \ { const size_t n = prepare(rhs); return CALL(lhs.byte,lhs.size,&rhs,n); } \ inline friend RET operator OP (word_t lhs, const natural &rhs) \ { const size_t n = prepare(lhs); return CALL(&lhs,n,rhs.byte,rhs.size); } #define YOCTO_MPN_DECL_SELF(OP1,OP) \ inline natural & operator OP1 ( const natural &rhs ) { natural tmp = (*this) OP rhs; xch(tmp); return *this; }\ inline natural & operator OP1 ( const word_t rhs ) { natural tmp = (*this) OP rhs; xch(tmp); return *this; } class integer; class natural : public memory::ro_buffer { public: //__________________________________________________________________ // // // management functions // //__________________________________________________________________ natural(); //!< this is zero natural(const word_t); //!< any word natural(const natural &); //!< copy constructor natural(const void *buf, const size_t len); natural(const memory::ro_buffer &buf); //!< default n bytes, MUST be updated natural(size_t n, const as_capacity_t &); //! no throw swaps inline void xch( natural &other) throw() { cswap(maxi,other.maxi); cswap(size,other.size); cswap(byte,other.byte); } //! assign operator inline natural & operator=(const natural &other) { natural tmp(other); xch(tmp); return *this; } //! assign a word, optimized, no throw inline natural & operator=(const word_t n) throw() { assert(maxi>=sizeof(word_t)); size = sizeof(word_t); *(word_t *)byte = swap_le(n); update(); YOCTO_CHECK_MPN(*this); return *this; } //! destructor virtual ~natural() throw(); static inline void update(const uint8_t *b, size_t &n) { assert(b!=0); while(n>0) { const size_t imsb = n-1; if(b[imsb]>0) break; n=imsb; } } static inline size_t prepare(word_t &w) { size_t n = sizeof(word_t); w = swap_le(w); update( (uint8_t *)&w, n ); return n; } //! try to decrease size inline void update() throw() { update(byte,size); } //! size=maxi and update inline void rescan() throw() { update(byte,(size=maxi)); } //! ro_buffer interface virtual size_t length() const throw() { return size; } //__________________________________________________________________ // // // input/output // //__________________________________________________________________ void display( std::ostream & ) const; inline friend std::ostream & operator<<( std::ostream &os, const natural &n ) { n.display(os); return os; } //! least significant word inline word_t lsw() const throw() { word_t ans = 0; const uint8_t *b = byte+size; for(size_t i=min_of<size_t>(sizeof(word_t),size);i>0;--i) { (ans <<= 8) |= unsigned( *(--b) ); } return ans; } inline bool is_zero() const throw() { return (size<=0); } inline bool is_byte(const uint8_t x) const throw() { assert(x>0); return (1==size) && (x==byte[0]); } void put(ios::bitio &Q, const size_t n) const; inline void put(ios::bitio &Q) const { put(Q,bits()); } static natural get(ios::bitio &Q, const size_t n); void save( ios::ostream &) const; static natural load(ios::istream &); static natural hex2mpn( const string &s ); static natural dec2mpn( const string &s ); static natural parse(const string &s); //__________________________________________________________________ // // // comparison // //__________________________________________________________________ static inline bool are_same(const void *lhs, const size_t nl, const void *rhs, const size_t nr) throw() { if(nl!=nr) { return false; } else { const uint8_t *l = (const uint8_t *)lhs; const uint8_t *r = (const uint8_t *)rhs; YOCTO_LOOP(nl, if( *(l++) != *(r++) ) return false); return true; } } YOCTO_MPN_DECL(bool,==,are_same) static inline bool are_different(const void *lhs, const size_t nl, const void *rhs, const size_t nr) throw() { if(nl!=nr) { return true; } else { const uint8_t *l = (const uint8_t *)lhs; const uint8_t *r = (const uint8_t *)rhs; YOCTO_LOOP(nl, if( *(l++) != *(r++) ) return true); return false; } } YOCTO_MPN_DECL(bool,!=,are_different) static int compare(const void *lhs, const size_t nl, const void *rhs, const size_t nr) throw(); static inline int compare(const natural &lhs, const natural &rhs) throw() { return compare(lhs.byte,lhs.size,rhs.byte,rhs.size); } static inline int compare(const natural &lhs, word_t rhs ) throw() { const size_t n = prepare(rhs); return compare(lhs.byte,lhs.size,&rhs,n); } static inline int compare(word_t lhs, const natural &rhs) throw() { const size_t n = prepare(lhs); return compare(&lhs,n,rhs.byte,rhs.size); } #define YOCTO_MPN_CMP(OP) \ inline friend bool operator OP (const natural &lhs, const natural &rhs) throw() { return natural::compare(lhs,rhs) OP 0; } \ inline friend bool operator OP (const natural &lhs, const word_t rhs) throw() { return natural::compare(lhs,rhs) OP 0; } \ inline friend bool operator OP (const word_t lhs, const natural &rhs) throw() { return natural::compare(lhs,rhs) OP 0; } YOCTO_MPN_CMP(<) YOCTO_MPN_CMP(<=) YOCTO_MPN_CMP(>) YOCTO_MPN_CMP(>=) //__________________________________________________________________ // // // bit ops // //__________________________________________________________________ static const uint8_t _bit[8]; //! get the number of bits size_t bits() const throw(); //! highest bit is always 1 static natural rand(size_t nbits); inline bool is_odd() const throw() { return (size>0) ? ( 0 != (byte[0]&0x01) ) : false; } inline bool is_even() const throw() { return (size>0) ? ( 0 == (byte[0]&0x01) ) : true; } //__________________________________________________________________ // //! 2^n //__________________________________________________________________ static natural exp2(const size_t n); //__________________________________________________________________ // // SHR //__________________________________________________________________ natural & shr() throw(); //!< optimized one bit right shift static natural shr(const natural &lhs, const size_t n); //!< right shift n bits inline friend natural operator>>(const natural &lhs, const size_t n) { return natural::shr(lhs,n); } inline natural & operator>>=(const size_t n) { natural ans = natural::shr(*this,n); xch(ans); return *this; } //__________________________________________________________________ // // SHL //__________________________________________________________________ static natural shl( const natural &lhs, const size_t n ); //!< shift left n bits inline natural & shl() { natural ans = shl(*this,1); xch(ans); return *this; } inline friend natural operator<<(const natural &lhs, const size_t n) { return natural::shl(lhs,n); } inline natural & operator<<=(const size_t n) { natural ans = natural::shl(*this,n); xch(ans); return *this; } //__________________________________________________________________ // // // addition // //__________________________________________________________________ //! helper inline void ldz() throw() { size=0; } #define Y_MPL_CLR(I) ( (uint8_t &)byte[I] ) = 0 inline void __clr() const throw() { (size_t &)size = 0; YOCTO_LOOP_FUNC_(maxi,Y_MPL_CLR,0); } //! unversal add function static natural add(const void *lhs, size_t nl, const void *rhs, size_t nr); //! unary operator natural operator+() const { return natural(*this); } YOCTO_MPN_DECL(natural,+,add) YOCTO_MPN_DECL_SELF(+=,+) inline natural &inc() { word_t __one = 1; const size_t __len = prepare(__one); natural __ans = add(byte,size,&__one,__len); xch(__ans); return *this; } //! prefix increment inline natural & operator++() { return inc(); } //! postfix increment natural operator++ (int) { natural sav(*this); (void)inc(); return sav; } //__________________________________________________________________ // // // subtraction // //__________________________________________________________________ //! universal sub function static natural sub(const void *lhs, const size_t nl, const void *rhs, const size_t nr); // no unary operator ! YOCTO_MPN_DECL(natural,-,sub) YOCTO_MPN_DECL_SELF(-=,-) inline natural &dec() { word_t __one = 1; const size_t __len = prepare(__one); natural __ans = sub(byte,size,&__one,__len); xch(__ans); return *this; } //! prefix increment inline natural & operator--() { return dec(); } //! postfix increment natural operator-- (int) { natural sav(*this); (void)dec(); return sav; } //__________________________________________________________________ // // // multiplication // //__________________________________________________________________ //! universal FFT based mul function static natural mul(const void *lhs, const size_t nl, const void *rhs, const size_t nr); static natural mul_v2(const void *lhs, const size_t nl, const void *rhs, const size_t nr); YOCTO_MPN_DECL(natural,*,mul) YOCTO_MPN_DECL_SELF(*=,*) static natural sqr(const natural &); static inline natural power(const natural &rhs, word_t p) { natural ans = 1; while(p-->0) { ans *= rhs; } return ans; } static inline natural power(const natural &rhs, const natural &p ) { natural ans = 1; for(natural i=0;i<p;++i) { ans *= rhs; } return ans; } static inline natural factorial(const word_t n) { natural ans(1); for(word_t i=2;i<=n;++i) { ans *= i; } return ans; } static inline natural factorial(const natural &n) { natural ans(1); for(natural i=2;i<=n;++i) { ans *= i; } return ans; } //__________________________________________________________________ // // // division // //__________________________________________________________________ //!universal division algorithm static natural div(const void *num, const size_t nn, const void *den, const size_t nd); YOCTO_MPN_DECL(natural,/,div) YOCTO_MPN_DECL_SELF(/=,/) static void split( natural &q, natural &r, const natural &num, const natural &den ); //__________________________________________________________________ // // // modulo // //__________________________________________________________________ //! universal modulo static natural __mod(const void *num, const size_t nn, const void *den, const size_t nd); static natural modulo(const void *num, const size_t nn, const void *den, const size_t nd); YOCTO_MPN_DECL(natural,%,modulo) YOCTO_MPN_DECL_SELF(%=,%) //__________________________________________________________________ // // // arithmetic // //__________________________________________________________________ static natural gcd(const natural &lhs, const natural &rhs); static inline bool are_coprime(const natural &lhs, const natural &rhs) { const natural __gcd = natural::gcd(lhs,rhs); return __gcd.is_byte(1); } static void simplify(natural &lhs, natural &rhs); static inline natural comb(const word_t n, const word_t k) { if(k<=0) { return natural(1); } else { if(k>=n) { return natural( (k>n) ? 0 : 1 ); } else { assert(k>0); assert(k<n); const natural fn = factorial(n); const natural fk = factorial(k); const natural fnmk = factorial(n-k); const natural den = fk * fnmk; return fn/den; } } } static natural mod_inv( const natural &b, const natural &n ); //!< modular inverse static natural mod_exp( const natural &b, const natural &e, const natural &n ); //!< modular exponentiation (b^e)[n] //__________________________________________________________________ // // // primality // //__________________________________________________________________ static bool __is_prime( const natural &n ); static natural __next_prime(const natural &n); //__________________________________________________________________ // // // conversion // //__________________________________________________________________ double to_real() const; static double ratio_of(const natural &num,const natural &den); private: size_t maxi; //!< maximum #bytes size_t size; //!< current #bytes uint8_t *byte; //!< little endian static uint8_t * build(size_t &n); virtual const void *get_address() const throw() { return byte; } friend class integer; }; } typedef mpl::natural mpn; template <> struct xnumeric<mpn> { inline static mpn zero() { return mpn(); } inline static mpn one() { return mpn(1); } }; } #endif
dd4db4c50eeb88d3da365b33a2b42f3ae469f1b0
eb9488d622e957d83dbf6bbbd487ad9814e1bf87
/PROJECTTEST/boite.h
48a158c039bc12ee1f97a26a2295508c319234db
[]
no_license
mryassain/RRTs-Algorithm
5b3785af46d2278113bcd974f1ec55261cd93da1
4f213adad7a4933e4aa6bc575fada54a4730bf30
refs/heads/master
2023-02-04T10:39:51.557860
2020-12-15T14:46:36
2020-12-15T14:46:36
299,050,638
0
0
null
null
null
null
UTF-8
C++
false
false
1,301
h
boite.h
#pragma once #include "RRTVertexe.h" #include "RRTTree.h" #include "RRTAlgorithmes.h" #include <windows.h> #include <vector> using namespace std; class boite { public: //constructeurs boite(); boite(int dm,double PasU,double MinEsacedeta,double MaxEpacedeta); ~boite(void); struct box{ int NbrOfVertex;//fai just pour calculer le nombre de vertexs int NbrOfVertexAplus;//fai pour discrepency plus int NbrOfVertexAmoins;//fai pour discrepency moins double volumeBplus;//fai pour discr double VolumeBmoins;//fai pour discr double MCVmax2;//fait pour discr double MCVmin1;//fait pour discr double MCVmin2;//fait pour discr double MCVmax1;//fait pour discr double DiscrAplus;//fai pour discr double DiscrAMoins;//fai pour discr double VolumeBox;//fai pour discr double PoidsPartition;//fai pour discr RRTVertexe LowerVertex;//fai RRTVertexe UpperVertex;//fai }; void PartitionOfBoxs(); protected : std::vector <struct box> Boxs; int dim;//fai int NbrOfIteration;//fai double PasU;//fai double VolumeTotal; double MinEspacedeta;//fai double MaxEspacedeta;//fai double StarDiscrepancyMax; double StarDiscrepancyMin; double PoiOfpartitionMax; double AvergStarDiscrepancyMax; double MesureOfcoverge; double *stardiscrepency; RRTVertexe Origine;//fai };
8dc7bba5454f5ac33890215a059a8b444ecc16b8
7ea42e64d21acd3cdcca8409e4375e4dfed5384e
/main.cpp
7c631cada8d6f49ba9a564822a16fd806918aae2
[]
no_license
kells1986/Blackjack
ed047221a4aacdd3b74e58f40929df221a6dd53b
a8af17aeddccd82a6955c471dd4acb2ca638f6ed
refs/heads/master
2016-09-05T19:41:16.570230
2012-10-11T20:48:25
2012-10-11T20:48:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
508
cpp
main.cpp
//#include"card.h" #include"deck.h" using namespace std; int main(){ deck card_deck(true); card one; int v1, v2; char d; card two; int i = 2; //card_deck.shuffle(); one = card_deck.deal(); two = card_deck.deal(); one.print(); two.print(); while((i <= 52) && (v1 != v2)){ v1 = one.get_val(); v2 = two.get_val(); one = two; two = card_deck.deal(); two.print(); i += 1; } if (i==53){ cout << "we got through the whole deck with getting a match!!!\n"; } else{ cout << "SNAP!!! \n"; } return 0; }
ac4f00dfc7b9585f2ca6e5ddeb812ec9a364e658
42903b4b9ad23f46fe0e9c9f335902707f701698
/AlgoLab 2_1/pathbge1.cpp
287c9342e9f6861460e47475ca02fa7f265bdb7f
[]
no_license
sheensekai/itmo-2nd-sem-algo-tasks
22e552f42e46d9dfa06ce7cd2771a1dbe601cce9
01e1fd961045e293eb5563c76d0013fc19190bc6
refs/heads/master
2020-05-03T23:23:25.166929
2019-04-21T13:53:13
2019-04-21T13:53:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,307
cpp
pathbge1.cpp
#include <iostream> #include <fstream> #include <queue> #include <forward_list> struct vertex { bool visited = false; int dist = -1; std::forward_list<int> adj; }; int bfs(vertex * verts, int n); int main() { std::ifstream input("input.txt"); std::ofstream output("output.txt"); int m, n; input >> n >> m; vertex verts[n]; int i, j; for (int k = 0; k < m; k++) { input >> i >> j; verts[i - 1].adj.push_front(j - 1); if (i != j) verts[j - 1].adj.push_front(i - 1); } bfs(verts, n); for (int k = 0; k < n; k++) output << verts[k].dist << " "; input.close(); output.close(); return 0; } int bfs(vertex *verts, int n) { std::queue<int> queue; int vert = 0; verts[vert].visited = true; verts[vert].dist = 0; queue.push(vert); int comp; while (!queue.empty()) { vert = queue.front(); queue.pop(); while (!verts[vert].adj.empty()) { comp = verts[vert].adj.front(); verts[vert].adj.pop_front(); if (!verts[comp].visited) { verts[comp].visited = true; verts[comp].dist = verts[vert].dist + 1; queue.push(comp); } } } return 0; }
8cff51c16a5a55093fa2444694e3ed8661074c47
31475b58b676a174d89b3130f869656366dc3078
/fm_gui/eventmanager.h
2de919a5b1393ebd12fd0f5d2cbb02bb21eba7ba
[]
no_license
cooper-zhzhang/engine
ed694d15b5d065d990828e43e499de9fa141fc47
b19b45316220fae2a1d00052297957268c415045
refs/heads/master
2021-06-21T07:09:37.355174
2017-07-18T14:51:45
2017-07-18T14:51:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,107
h
eventmanager.h
#pragma once #include "../public/persistid.h" #include "../public/i_var_list.h" #include "../visual/i_event_manager.h" #include <map> #include <string> #include <vector> typedef std::vector<EventDelegate> SLOT_DELEGATE_LIST; struct SLOT_DELEGATES { public: SLOT_DELEGATES() { enabled = true; delegates.clear(); } ~SLOT_DELEGATES() { delegates.clear(); } bool GetEnabled(){return enabled;} void SetEnabled(bool _val){enabled = _val;} size_t size() const { return delegates.size(); } SLOT_DELEGATE_LIST::const_reference operator[](size_t index) const { return delegates[index]; } void push_back(const EventDelegate& val) { delegates.push_back(val); } SLOT_DELEGATE_LIST::iterator erase(SLOT_DELEGATE_LIST::iterator _Where) { return delegates.erase(_Where); } SLOT_DELEGATE_LIST::iterator begin() { return delegates.begin(); } SLOT_DELEGATE_LIST::iterator end() { return delegates.end(); } private: bool enabled; SLOT_DELEGATE_LIST delegates; }; class EventManager { //typedef std::vector<EventDelegate> SLOT_DELEGATES; typedef std::map<std::string, SLOT_DELEGATES> MAP_EVENT; typedef std::map<uint64_t, MAP_EVENT> MAP_SENDER; SLOT_DELEGATES m_globals; MAP_SENDER m_senders; inline void invoke(SLOT_DELEGATES& delegates, const char* name, const IVarList& arg) { for(size_t i = 0; i < delegates.size(); i++) { if (delegates.GetEnabled()) { delegates[i](name, arg); } } } public: void connect(const PERSISTID& sender, const char* eventname, EventDelegate recv_callback); int invoke(const PERSISTID& sender, const char* eventname, const IVarList& arg); void disconnect(const PERSISTID& sender); void disconnect(const PERSISTID& sender, const char* eventname, EventDelegate recv_callback); void enableconnect(const PERSISTID& sender, bool enable); void enableconnect(const PERSISTID& sender, const char* eventname, bool enable); void connect_globals(EventDelegate recv_callback); void disconnect_globals(EventDelegate recv_callback); static EventManager& Inst() { static EventManager s_inst; return s_inst; } };
b4b11cf421bc7e8e6acb9550cb0dcf04bec6db31
f8cc7ceccaf3d87142fce46c8903edace3a71fad
/nixycore/container/map.h
299d1cf15562812197256fe1e67bcbe2321b2370
[ "MIT" ]
permissive
yyzybb537/nixy
c6197d4a705a17c722d45e9fad10254ee5b2aa27
a77d0eac833a29d29d6717ce722ed75a813a4e1f
refs/heads/master
2023-08-31T17:55:02.260939
2014-05-08T15:47:41
2014-05-08T15:47:41
19,988,406
1
4
null
null
null
null
UTF-8
C++
false
false
5,450
h
map.h
/* The Nixy Library Code covered by the MIT License Author: mutouyun (http://darkc.at) */ #pragma once #include "nixycore/memory/default_alloc.h" #include "nixycore/utility/rvalue.h" #include "nixycore/general/general.h" #include <map> // std::map ////////////////////////////////////////////////////////////////////////// NX_BEG ////////////////////////////////////////////////////////////////////////// #ifdef NX_SP_CXX11_ALIAS template <typename KeyT, typename TypeT, class CompT = std::less<KeyT>, class AllocT = NX_DEFAULT_ALLOC> using map = std::map<KeyT, TypeT, CompT, typename AllocT::template std_allocator<std::pair<const KeyT, TypeT> >::type_t>; template <typename KeyT, typename TypeT, class CompT = std::less<KeyT>, class AllocT = NX_DEFAULT_ALLOC> using multimap = std::multimap<KeyT, TypeT, CompT, typename AllocT::template std_allocator<std::pair<const KeyT, TypeT> >::type_t>; #else /*NX_SP_CXX11_ALIAS*/ template <typename KeyT, typename TypeT, class CompT = std::less<KeyT>, class AllocT = NX_DEFAULT_ALLOC> class map : public std::map<KeyT, TypeT, CompT, typename AllocT::template std_allocator<std::pair<const KeyT, TypeT> >::type_t> { typedef std::map<KeyT, TypeT, CompT, typename AllocT::template std_allocator<std::pair<const KeyT, TypeT> >::type_t> base_t; public: #ifdef NX_SP_CXX11_INHERITING using base_t::map; #else /*NX_SP_CXX11_INHERITING*/ map(void) : base_t() {} explicit map(const typename base_t::allocator_type& a) : base_t(a) {} explicit map(const CompT& c, const typename base_t::allocator_type& a = typename base_t::allocator_type()) : base_t(c, a) {} template <typename IteratorT> map(IteratorT f, IteratorT l) : base_t(f, l) {} template <typename IteratorT> map(IteratorT f, IteratorT l, const CompT& c, const typename base_t::allocator_type& a = typename base_t::allocator_type()) : base_t(f, l, c, a) {} map(const map& rhs) : base_t(rhs) {} map(nx_rref(map, true) rhs) : base_t() { base_t::swap(nx::moved(rhs)); } #endif/*NX_SP_CXX11_INHERITING*/ map& operator=(map rhs) { rhs.swap(*this); return (*this); } }; template <typename KeyT, typename TypeT, class CompT = std::less<KeyT>, class AllocT = NX_DEFAULT_ALLOC> class multimap : public std::multimap<KeyT, TypeT, CompT, typename AllocT::template std_allocator<std::pair<const KeyT, TypeT> >::type_t> { typedef std::multimap<KeyT, TypeT, CompT, typename AllocT::template std_allocator<std::pair<const KeyT, TypeT> >::type_t> base_t; public: #ifdef NX_SP_CXX11_INHERITING using base_t::multimap; #else /*NX_SP_CXX11_INHERITING*/ multimap(void) : base_t() {} explicit multimap(const typename base_t::allocator_type& a) : base_t(a) {} explicit multimap(const CompT& c, const typename base_t::allocator_type& a = typename base_t::allocator_type()) : base_t(c, a) {} template <typename IteratorT> multimap(IteratorT f, IteratorT l) : base_t(f, l) {} template <typename IteratorT> multimap(IteratorT f, IteratorT l, const CompT& c, const typename base_t::allocator_type& a = typename base_t::allocator_type()) : base_t(f, l, c, a) {} multimap(const multimap& rhs) : base_t(rhs) {} multimap(nx_rref(multimap, true) rhs) : base_t() { base_t::swap(nx::moved(rhs)); } #endif/*NX_SP_CXX11_INHERITING*/ multimap& operator=(multimap rhs) { rhs.swap(*this); return (*this); } }; /* Special swap algorithm */ template <typename K, typename T, typename C, class A> inline void swap(map<K, T, C, A>& x, map<K, T, C, A>& y) { x.swap(y); } template <typename K, typename T, typename C, class A> inline void swap(multimap<K, T, C, A>& x, multimap<K, T, C, A>& y) { x.swap(y); } #endif/*NX_SP_CXX11_ALIAS*/ /* Special container traits */ template <typename K, typename T, class C, class A> struct container_traits<std::map<K, T, C, A> > { typedef typename std::map<K, T, C, A>::value_type val_t; typedef typename std::map<K, T, C, A>::iterator ite_t; typedef std::pair<K, T> pair_t; }; template <typename K, typename T, class C, class A> struct container_traits<std::multimap<K, T, C, A> > { typedef typename std::multimap<K, T, C, A>::value_type val_t; typedef typename std::multimap<K, T, C, A>::iterator ite_t; typedef std::pair<K, T> pair_t; }; #ifndef NX_SP_CXX11_ALIAS template <typename K, typename T, class C, class A> struct container_traits<nx::map<K, T, C, A> > { typedef typename nx::map<K, T, C, A>::value_type val_t; typedef typename nx::map<K, T, C, A>::iterator ite_t; typedef std::pair<K, T> pair_t; }; template <typename K, typename T, class C, class A> struct container_traits<nx::multimap<K, T, C, A> > { typedef typename nx::multimap<K, T, C, A>::value_type val_t; typedef typename nx::multimap<K, T, C, A>::iterator ite_t; typedef std::pair<K, T> pair_t; }; #endif/*NX_SP_CXX11_ALIAS*/ ////////////////////////////////////////////////////////////////////////// NX_END //////////////////////////////////////////////////////////////////////////
2f29f9ed297d45d7c2e1b0ecd1c011842dc4cf41
bdec4e67719c2dda02cb7e51f5d426fdc0c23972
/src/base/math/floating.cpp
8a7028348472e24100d6b643b38c483489cb8190
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
vizzuhq/vizzu-lib
032a653267e22a0ce1f76cbca52c39356fac982b
a048ee50400bc12b336759cf5ab8648ce207f629
refs/heads/main
2023-09-02T20:04:26.929526
2023-08-31T16:03:38
2023-08-31T16:03:38
374,784,415
1,537
93
Apache-2.0
2023-09-14T06:24:21
2021-06-07T19:53:30
JavaScript
UTF-8
C++
false
false
331
cpp
floating.cpp
#include "floating.h" #include <cmath> using namespace Math; int Floating::orderOfMagnitude(double base) const { return static_cast<int>(floor(log(std::abs(value)) / log(base))); } bool Floating::isInteger() const { return value == floor(value); } double Floating::sign() const { return value < 0 ? -1 : 1; }
641c22faeb54ba5ad012aefd36d72d03fba49146
83188d56a7775feb53d9837a57dae0d56642eaf6
/Sorting algorithms/main.cpp
e78032ddd968df379563ad99aaf2ede52ad362cf
[]
no_license
Faramoz161/cpp
656311ccab563c0eb6ae2a94b6006c9d5a3dd646
6b246ddf2e11be0f337b602b748925478eeb5931
refs/heads/master
2022-05-08T14:18:45.372145
2022-04-20T13:55:21
2022-04-20T13:55:21
151,257,625
0
0
null
null
null
null
UTF-8
C++
false
false
524
cpp
main.cpp
#include "main.h" int main() { const size_t size = 10000000; vector<int> array(size, 0); // fill generate(begin(array), end(array), UniqueNumber); // shuffle mt19937 g { random_device {}() }; g.seed(time(NULL)); shuffle(begin(array), end(array), g); bubble_sort(array); //cocktail_sort(array); //comb_sort(array); //insertion_sort(array); //shell_sort(array); //selection_sort(array); //tree_sort(array); //merge_sort(array); //radixLSD_sort(array); //quick_sort(array); system("pause"); return 0; }
70c6650f569216d453ac240af508ab51d7b3fe9a
1d64c65617b2f1b2288330a3b5856dd0bec4786f
/ee569/hw4/texture/TextureDataset.h
ec0da915966c9101d019283bf9b5816c617c87b5
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
chenying-wang/usc-ee-coursework-public
695230b85cc1dd5debb874211cc786a92e45a572
5bc94c2350bcebf1036fb058fe7dc4f7e31e1de1
refs/heads/main
2023-05-06T08:46:22.903222
2021-05-13T00:00:00
2021-05-19T04:20:27
265,717,688
3
1
null
null
null
null
UTF-8
C++
false
false
1,147
h
TextureDataset.h
/** * Name: Chenying Wang * Email: chenying.wang@usc.edu * USC ID: ****-****-** * Date: Friday, March 20, 2020 **/ #ifndef __TEXTURE_DATASET #define __TEXTURE_DATASET #include <iostream> #include <vector> #include <tuple> #include <unordered_map> #include <string> #include <mutex> class TextureDataset { private: std::vector<std::string> m_psFilename; std::vector<std::vector<float>> m_ppfFeatures; std::vector<std::string> m_psLabel; std::mutex *m_mtxWrite; public: TextureDataset(); virtual ~TextureDataset(); std::unordered_multimap<std::string, std::vector<float>> packageTrainingData() const; void insert(std::string filename, std::vector<float> features, std::string label); std::tuple<std::string, std::vector<float>, std::string> at(const uint i) const; uint size() const; void clear(); std::vector<std::string> getFilename() const { return this->m_psFilename; } const std::vector<std::vector<float>> getFeatures() const { return this->m_ppfFeatures; } std::vector<std::string> getLabel() const { return this->m_psLabel; } }; #endif
f79b3c1b8b62fb95069bbfa4fb76f7b163e0f8cd
2d446eac1649daf0b7a98ceaf9be8037793144e7
/src/controller/task/TurnTask.h
7b7c4235af5ecb8526026053e347dff5196fe0da
[ "MIT" ]
permissive
mda-ut/SubZero
8ebcd2cf73021252ecab52c9e33c48ff5b61f925
4f5e5291f146c38b2151841c747458aa92d2c0cc
refs/heads/master
2020-03-30T08:11:48.207743
2015-11-02T21:25:53
2015-11-02T21:25:53
28,941,998
4
35
null
2015-07-17T19:28:27
2015-01-08T01:04:27
C++
UTF-8
C++
false
false
676
h
TurnTask.h
/* * TurnTask.h * * Created on: Jul 3, 2015 * Author: jwong */ #ifndef TURNTASK_H_ #define TURNTASK_H_ #include "Task.h" #include "Logger.h" class TurnTask : public Task { private: Logger* logger = new Logger("TurnTask"); Model* fpgaModel; int* currentTargetYaw; int targetYaw; public: /** * Contructor */ TurnTask(); TurnTask(Model* fpgaModel, int& currentTargetYaw, int delta = 15); void execute(); /** * Destructor */ virtual ~TurnTask(); void setYawDelta(int delta); void setYawAbsolute(int newTargetYaw); }; #endif /* SUBZERO_SRC_CONTROLLER_TASK_TURNTASK_H_ */
5ed8ad50d2130ef944927e968f761661084ce6a7
55bfe24af7c6cbb277dc3ddcaa80480384f95abf
/IOT Lab/Arduino_code_/Arduino_code_.ino
deab70f6837ae65ae83aac23144ca874895daa26
[]
no_license
Matthew-Noce/IOTLAB_5
45ffcb52077bdabc6629c86332a61be3b55bcae3
d7044e64bbd134eec7c2cf881b1f23d83c48c93e
refs/heads/main
2023-08-19T18:01:02.402374
2021-10-22T14:23:38
2021-10-22T14:23:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
664
ino
Arduino_code_.ino
void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); } int val =0; void loop() { // put your main code here, to run repeatedly: val=analogRead(0); Serial.println(val); digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(6, LOW); if(val > 205) { digitalWrite(2, HIGH); } else digitalWrite(2, LOW); if(val > 310) { digitalWrite(3, HIGH); } if(val > 420 ) { digitalWrite(4, HIGH); } if(val > 540) { digitalWrite(5, HIGH); } if(val > 600) { digitalWrite(6, HIGH); } }
0b1f016b2e37464a031451324786c389cff09eff
50e6ba037f1c60e5342c707a9d4223ac379a8047
/InstanceMonitor.cpp
4614a897e5b23c73c9db3d1008b01893d4e8582c
[]
no_license
buryhuang/blueplus
299bbe23efa93f9d3acceeedccd5e8194cb71891
7843ccfa4b8fc773c6de1992acb9c9bb805671ed
refs/heads/master
2021-05-06T15:59:40.471142
2011-05-31T06:50:46
2011-05-31T06:50:46
113,696,936
1
0
null
null
null
null
GB18030
C++
false
false
2,147
cpp
InstanceMonitor.cpp
/** \addtogroup application * @{ */ #include "config.h" #include "InstanceMonitor.h" #include "BTDeviceDetector.h" #include "BTDeviceManager.h" #include "BTServer.h" #include "PersistentStorage.h" #include "Utils.h" #include <iostream> using namespace std; CInstanceMonitor::CInstanceMonitor(void) { #if 0 if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: 更改错误代码以符合您的需要 _tprintf(_T("错误: MFC 初始化失败\n")); } #endif } CInstanceMonitor::~CInstanceMonitor(void) { GraceShutdown(); vector<CManagedThread*>::iterator vi=m_listThreads.begin(); for(;vi!=m_listThreads.end();vi++){ if((*vi)!=NULL){ delete (*vi); } } } void CInstanceMonitor::AppStart() { LOGSVREVENT(0,L"Starting App"); //Register services this->m_listThreads.push_back(DEF_BTDETECTOR); this->m_listThreads.push_back(DEF_BTDEV_MGR); this->m_listThreads.push_back(DEF_BTSERVER); //Start services vector<CManagedThread*>::iterator vi=m_listThreads.begin(); for(;vi!=m_listThreads.end();vi++){ (*vi)->Start(); wcout<<_L(IDS_DEBUG_STARTED_SERVICE)<<(*vi)->GetName()<<endl; } //Main loop: Monitor workers and keep alive. while(true){ vector<CManagedThread*>::iterator vi=m_listThreads.begin(); for(;vi!=m_listThreads.end();vi++){ STDOUT<<_L(IDS_DEBUG_CHECKING_SERVICE)<<(*vi)->GetName()<<endl; if(!(*vi)->IsAlive()){ STDOUT<<_T("Retarting ")<<(*vi)->GetName()<<endl; (*vi)->Restart(); } } Sleep(MON_THREAD_CHECK_INTERVAL_MS); } } void CInstanceMonitor::GraceShutdown() { vector<CManagedThread*>::iterator vi=m_listThreads.begin(); for(;vi!=m_listThreads.end();vi++){ if((*vi)!=NULL){ (*vi)->GraceShutdown(); } wcout<<_L(IDS_DEBUG_STARTED_SERVICE)<<(*vi)->GetName()<<endl; } } void CInstanceMonitor::Shutdown() { vector<CManagedThread*>::iterator vi=m_listThreads.begin(); for(;vi!=m_listThreads.end();vi++){ if((*vi)!=NULL){ (*vi)->Shutdown(); } wcout<<_L(IDS_DEBUG_STARTED_SERVICE)<<(*vi)->GetName()<<endl; } } /** @}*/
b8717586ca2f513a845283e7164000f9f58c9eb6
2c221417937bac357edee935fff3a9cdb4a6a572
/src/editor/scriptvariablesview.cpp
d02c6cd7f38adcc45810cda3fec0d79b3afda6d0
[]
no_license
timbaker/scripted
c72458f44f3252ddc39fc766974c032847eb7f92
682012134a0d36a16f52700ba206a42e688a315b
refs/heads/master
2016-09-06T08:44:43.483357
2013-12-08T03:13:14
2013-12-08T03:13:14
14,830,149
1
0
null
null
null
null
UTF-8
C++
false
false
11,089
cpp
scriptvariablesview.cpp
/* * Copyright 2013, Tim Baker <treectrl@users.sf.net> * * 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 2 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/>. */ #include "scriptvariablesview.h" #include "documentmanager.h" #include "node.h" #include "project.h" #include "projectchanger.h" #include "projectdocument.h" #include "scriptvariable.h" #include <QApplication> #include <QMimeData> #include <QPainter> #include <QScrollBar> #include <QStandardItemModel> const QString VARIABLE_MIME_TYPE = QLatin1String("application/x-pzdraft-variable"); class ScriptVariablesDelegate : public QAbstractItemDelegate { public: ScriptVariablesDelegate(ScriptVariablesView *view, QObject *parent = 0) : QAbstractItemDelegate(parent) , mView(view) #if 0 , mLabelFontMetrics(mLabelFont) #endif { #if 0 if (true/*mFont != mView->font()*/) { mFont = mView->font(); mLabelFont = mFont.resolve(mFont); mLabelFont.setBold(true); if (mLabelFont.pixelSize() != -1) mLabelFont.setPixelSize(mLabelFont.pixelSize() + 4); else if (mLabelFont.pointSize() != -1) mLabelFont.setPointSize(mLabelFont.pointSize() + 1); mLabelFontMetrics = QFontMetrics(mLabelFont); } #endif } void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; static const int INSET = 3; static const int BOXSIZE = 48; private: ScriptVariablesView *mView; #if 0 QFont mFont; QFont mLabelFont; QFontMetrics mLabelFontMetrics; #endif }; void ScriptVariablesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { painter->fillRect(option.rect.x() + (option.rect.width() - BOXSIZE) / 2, option.rect.y() + INSET, BOXSIZE, BOXSIZE, Qt::gray); // painter->setFont(mLabelFont); painter->drawText(option.rect.x(), option.rect.y() + INSET + BOXSIZE, option.rect.width(), option.fontMetrics.lineSpacing(), Qt::AlignHCenter, index.data(Qt::DisplayRole).toString()); if (option.state & QStyle::State_Selected) { QPen oldPen = painter->pen(); QPen pen; pen.setWidth(2); painter->setPen(pen); painter->drawRect(option.rect.adjusted(1,1,-1,-1)); painter->setPen(oldPen); } } QSize ScriptVariablesDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { Q_UNUSED(option) #if 1 if (index.parent().isValid()) return QSize(); #ifndef QT_NO_DEBUG static bool reported = false; if (!reported) { noise() << "linespacing actually" << option.fontMetrics.lineSpacing(); reported = true; } #endif QString label = index.data(Qt::DisplayRole).toString(); int labelWidth = option.fontMetrics.boundingRect(label).width(); labelWidth++; // return QSize(qMax(BOXSIZE, labelWidth) + INSET * 2, BOXSIZE + INSET * 2 + option.fontMetrics.lineSpacing()); #else const ScriptVariablesModel *m = static_cast<const ScriptVariablesModel*>(index.model()); QVector<BmpBlend*> blends = m->blendsAt(index); if (blends.isEmpty()) return QSize(); const qreal zoom = mView->zoomable()->scale(); const int extra = 2 * 2; const QFontMetrics &fm = mLabelFontMetrics; const int labelHeight = fm.lineSpacing(); const int tileWidth = qCeil(64 * zoom); const int tileHeight = mView->isExpanded() ? qCeil(128 * zoom) : 0; const int viewWidth = mView->viewport()->width(); const int columns = 9; return QSize(qMax(qMax(tileWidth * columns, mView->maxHeaderWidth()) + extra, viewWidth), 2 + labelHeight + (tileHeight * 1) + extra); #endif } ///// ScriptVariablesModel::ScriptVariablesModel(QObject *parent) : QAbstractItemModel(parent), mDocument(0) { connect(docman(), SIGNAL(currentDocumentChanged(Document*)), SLOT(setDocument(Document*))); } ScriptVariablesModel::~ScriptVariablesModel() { qDeleteAll(mItems); } int ScriptVariablesModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; return mItems.size(); } int ScriptVariablesModel::columnCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 1; } Qt::ItemFlags ScriptVariablesModel::flags(const QModelIndex &index) const { Qt::ItemFlags flags = QAbstractItemModel::flags(index); if (itemAt(index)) flags |= Qt::ItemIsDragEnabled; return flags; } QVariant ScriptVariablesModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { if (Item *item = itemAt(index)) { return item->mVariable->label(); } } #if 0 if (role == Qt::ToolTipRole) { if (Item *item = toItem(index)) { return item->mVariable->mName; } } #endif return QVariant(); } QVariant ScriptVariablesModel::headerData(int section, Qt::Orientation orientation, int role) const { Q_UNUSED(section) Q_UNUSED(orientation) if (role == Qt::SizeHintRole) return QSize(1, 1); return QVariant(); } QModelIndex ScriptVariablesModel::index(int row, int column, const QModelIndex &parent) const { if (parent.isValid() || (row >= mItems.size())) return QModelIndex(); return createIndex(row, column, mItems.at(row)); } QModelIndex ScriptVariablesModel::index(ScriptVariable *var) { if (Item *item = itemFor(var)) return index(mItems.indexOf(item), 0, QModelIndex()); return QModelIndex(); } QModelIndex ScriptVariablesModel::parent(const QModelIndex &child) const { return QModelIndex(); } QStringList ScriptVariablesModel::mimeTypes() const { return QStringList() << VARIABLE_MIME_TYPE; } QMimeData *ScriptVariablesModel::mimeData(const QModelIndexList &indexes) const { QMimeData *mimeData = new QMimeData(); QByteArray encodedData; QDataStream stream(&encodedData, QIODevice::WriteOnly); foreach (const QModelIndex &index, indexes) { if (Item *item = itemAt(index)) { stream << QString::fromLatin1("%1:%2") .arg(item->mVariable->node()->id()) .arg(item->mVariable->name()); } } mimeData->setData(VARIABLE_MIME_TYPE, encodedData); return mimeData; } ScriptVariable *ScriptVariablesModel::variableAt(const QModelIndex &index) { if (Item *item = itemAt(index)) return item->mVariable; return 0; } void ScriptVariablesModel::reset() { if (mItems.size()) { // Do this because beginResetModel() doesn't update the selection beginRemoveRows(QModelIndex(), 0, mItems.size()); qDeleteAll(mItems); mItems.clear(); endRemoveRows(); } if (!mDocument) return; if (int count = mDocument->project()->rootNode()->variableCount()) { beginInsertRows(QModelIndex(), 0, count - 1); foreach (ScriptVariable *var, mDocument->project()->rootNode()->variables()) { Item *item = new Item(var); mItems += item; } endInsertRows(); } } void ScriptVariablesModel::setDocument(Document *doc) { if (mDocument) mDocument->changer()->disconnect(this); mDocument = doc ? doc->asProjectDocument() : 0; if (mDocument) { connect(mDocument->changer(), SIGNAL(afterAddVariable(BaseNode*,int,ScriptVariable*)), SLOT(afterAddVariable(BaseNode*,int,ScriptVariable*))); connect(mDocument->changer(), SIGNAL(beforeRemoveVariable(BaseNode*,int,ScriptVariable*)), SLOT(beforeRemoveVariable(BaseNode*,int,ScriptVariable*))); connect(mDocument->changer(), SIGNAL(afterChangeVariable(ScriptVariable*,const ScriptVariable*)), SLOT(afterChangeVariable(ScriptVariable*,const ScriptVariable*))); } reset(); } void ScriptVariablesModel::afterAddVariable(BaseNode *node, int index, ScriptVariable *var) { if (node != mDocument->project()->rootNode()) return; beginInsertRows(QModelIndex(), index, index); mItems.insert(index, new Item(var)); endInsertRows(); } void ScriptVariablesModel::beforeRemoveVariable(BaseNode *node, int index, ScriptVariable *var) { Q_UNUSED(var) if (node != mDocument->project()->rootNode()) return; beginRemoveRows(QModelIndex(), index, index); delete mItems.takeAt(index); endRemoveRows(); } void ScriptVariablesModel::afterChangeVariable(ScriptVariable *var, const ScriptVariable *oldValue) { if (!itemFor(var)) return; // could be a variable of a child node Q_UNUSED(oldValue) emit dataChanged(index(var), index(var)); } ScriptVariablesModel::Item *ScriptVariablesModel::itemAt(const QModelIndex &index) const { if (index.isValid()) return static_cast<Item*>(index.internalPointer()); return 0; } ScriptVariablesModel::Item *ScriptVariablesModel::itemFor(ScriptVariable *var) { foreach (Item *item, mItems) if (item->mVariable == var) return item; return 0; } ///// ScriptVariablesView::ScriptVariablesView(QWidget *parent) : QListView(parent), mModel(new ScriptVariablesModel(this)) { setFlow(LeftToRight); // setViewMode(IconMode); // setUniformItemSizes(true); setModel(mModel); // item-delegate's size hint sets correct width but the item height is always // the height of the list view ??? // setGridSize(QSize(64, 64)); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setFont(QApplication::font("QListView")); // bit of weirdness here... QStyleOptionViewItem option = viewOptions(); int itemHeight = ScriptVariablesDelegate::BOXSIZE + ScriptVariablesDelegate::INSET * 2; itemHeight += option.fontMetrics.lineSpacing(); noise() << "linespacing thought to be" << option.fontMetrics.lineSpacing() << "scrollbar height" << horizontalScrollBar()->sizeHint().height() << "framwidth" << frameWidth(); setFixedHeight(itemHeight + frameWidth() * 2 + horizontalScrollBar()->sizeHint().height()); setDragDropMode(QAbstractItemView::DragOnly); setItemDelegate(new ScriptVariablesDelegate(this, this)); }
ecd92e4909c8005385bb8deb49da5e5e6a203fd0
ef4845192c77b43104976009452f26e111f1579b
/Space/Controllers/Action/Action.h
5b77ee29695f59205cc61e9a46dcfd24ac890b16
[]
no_license
AlexeyShag/Space
198bfeed3456b29e7ed569da553eeac7c8be0964
076bcc523de3e2bfc96ed53cf9630c44991671cc
refs/heads/master
2023-04-20T02:41:20.777426
2021-04-29T09:14:40
2021-04-29T09:14:40
362,756,498
0
0
null
2021-04-29T09:14:41
2021-04-29T09:09:11
null
UTF-8
C++
false
false
191
h
Action.h
#ifndef _ACTION_H_ #define _ACTION_H_ #include<functional> class Action { private: std::function<void()> action; public: Action(const std::function<void()>& a); void run(); }; #endif
3b05205edfdf74d38643a36bbff1742001bc58ae
82d0d49d7997b119d5eabee688d653e95502d4fe
/src/core/vulkan_instance.h
10647e3a4f9c4956668e016bcdd11ef32c7ce6b6
[]
no_license
filipecn/vulkan-experiments
a2d48cca93dee044caa211825d73dc833696f13a
efccaaf5c2293dd32133d2edf11292de473831fa
refs/heads/master
2021-01-01T05:21:28.485595
2020-05-08T14:46:58
2020-05-08T14:46:58
56,081,006
0
0
null
2020-05-08T14:46:59
2016-04-12T16:45:11
C++
UTF-8
C++
false
false
3,571
h
vulkan_instance.h
/// Copyright (c) 2019, FilipeCN. /// /// The MIT License (MIT) /// /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to /// deal in the Software without restriction, including without limitation the /// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or /// sell copies of the Software, and to permit persons to whom the Software is /// furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING /// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS /// IN THE SOFTWARE. /// ///\file vulkan_instance.h ///\author FilipeCN (filipedecn@gmail.com) ///\date 2019-10-16 /// ///\brief #ifndef CIRCE_VULKAN_INSTANCE_H #define CIRCE_VULKAN_INSTANCE_H #include "vulkan_physical_device.h" #include <string> #include <vector> namespace circe { namespace vk { class SupportInfo { public: SupportInfo(); bool isValidationLayerSupported(const char *validation_layer) const; /// Checks if extension is supported by the instance ///\param desired_instance_extension **[in]** extension name (ex: ) ///\return bool true if extension is supported bool isInstanceExtensionSupported(const char *desired_instance_extension) const; private: /// Gets the list of the properties of supported instance extensions on the /// current hardware platform. /// \param extensions **[out]** list of extensions /// \return bool true if success bool checkAvailableExtensions(std::vector<VkExtensionProperties> &extensions); bool checkAvailableValidationLayers( std::vector<VkLayerProperties> &validation_layers); static bool first_build_flag; static std::vector<VkExtensionProperties> vk_extensions_; static std::vector<VkLayerProperties> vk_validation_layers_; }; ///\brief Vulkan Instance object handle /// The Vulkan Instance holds all kinds of information about the application, /// such as application name, version, etc. The instance is the interface /// between the application and the Vulkan Library. class Instance final { public: ///\brief Construct a new Instance object ///\param application_name **[in]** ///\param desired_instance_extensions **[in | default = {}]** Instance(std::string application_name, const std::vector<const char *> &desired_instance_extensions = std::vector<const char *>(), const std::vector<const char *> &validation_layers = std::vector<const char *>()); ///\brief Default destructor ~Instance(); VkInstance handle() const; /// Checks with instance object construction succeded ///\return bool true if this can be used bool good() const; ///\brief /// ///\param physical_devices **[in]** ///\return bool bool enumerateAvailablePhysicalDevices( std::vector<PhysicalDevice> &physical_devices) const; private: VkInstance vk_instance_ = VK_NULL_HANDLE; VkDebugUtilsMessengerEXT vk_debug_messenger_; }; } // namespace vk } // namespace circe #endif
78dc6f83f64c665b87240f7e78425e5c488949de
68f2fbd6d891e3930608e8086d61946ffe0971a9
/B1043.cpp
0c2c921211830166d742c011194052499f67a792
[]
no_license
WEN1WE/PAT
dbb40932621138b0a33cc9f072d4217a54561061
696d77e751ac46fdd2d544a02db8604a1a2871bd
refs/heads/master
2020-06-27T20:46:07.119790
2019-12-03T01:41:49
2019-12-03T01:41:49
200,045,004
0
0
null
null
null
null
UTF-8
C++
false
false
548
cpp
B1043.cpp
/* * 1. 此题使用 hash table 简单 */ #include <iostream> using namespace std; int main() { int count[256] = {0}; string table = "PATest"; string s; cin >> s; for (auto e : s) { count[e]++; } while (true) { bool flag = false; for (int i = 0; i < 6; i++) { if (count[table[i]]) { count[table[i]]--; flag = true; cout << table[i]; } } if (!flag) { break; } } return 0; }
3ae9ae90b252aa730d26815d93d3dd848507eef9
6ce40a8eab21b32e8890f4bc44932a55741d8f02
/src/Commands/AutoSelector.h
20aa27d8a9af3e5ef14aaeea0a29def069241cf6
[]
no_license
daredevils2512/PowerUp
1a12056bf3d4e547768560a9584d1a6d23bf015a
367a283a7daa1a343d2219f92265084e887d1790
refs/heads/master
2021-03-27T12:37:22.678353
2018-05-17T21:24:31
2018-05-17T21:24:31
116,889,790
0
0
null
null
null
null
UTF-8
C++
false
false
1,150
h
AutoSelector.h
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include <Commands/CommandGroup.h> #include "AutonomousSource.h" class AutoSelector : public frc::CommandGroup { public: AutoSelector(AutonomousSource* autonomousSource); void SwitchY(); void SameOutsideSwitch(); void OppositeOutsideSwitch(); void OutsideStraightScale(); void OutsideOppositeScale(); //TODO Add in functions for doing alternate switch autos private: static constexpr double scaleHeight = 7.2; //6.8(not high enough for tipped scale) static constexpr double carryHeight = 0.35; bool doScale = false; bool doSwitch = false; int directionSwitch = 1; int directionScale = 1; char scale = ' '; char ourSwitch = ' '; };
15e2a8434347e2b74063732d008498f0b1f4e5c2
cd94e4a89afb36b4d03f4808c6001c65217d63d7
/SpehsEngine/Net/Port.h
40e770765e57d8e351242e13ea238a5a82cf41ac
[]
no_license
Yuuso/SpehsEngine
61e35a6cc6f800fddd6aa36ad4e3b225c1f222e5
04bbddaf7c3d8d597f6b79cd54732506ce0b34cc
refs/heads/master
2023-08-16T22:59:50.776551
2023-08-10T16:35:01
2023-08-10T16:35:01
51,141,207
1
1
null
2016-09-16T07:11:18
2016-02-05T10:49:43
C++
UTF-8
C++
false
false
704
h
Port.h
#pragma once namespace se { namespace net { struct Port { typedef uint16_t ValueType; Port() = default; Port(const ValueType& _value) : value(_value) {} operator ValueType() const { return value; } bool operator==(const Port& other) const { return value == other.value; } bool operator!=(const Port& other) const { return value != other.value; } explicit operator bool() const { return value != 0; } std::string toString() const { return std::to_string(value); } ValueType value = 0; }; } } template<> template<typename S, typename T> static bool se::Serial<se::net::Port>::serial(S& _serial, T _value) { se_serial(_serial, _value.value, "value"); return true; }
646e580064d05e14b581b925378a69be48b14472
d31f699e417a79d3d242b1a0f25387c1d90ae439
/Exo_FSM/Exo_FSM/FSM_State.cpp
7a2d60d47467eedf786fa6014739c69d9981d61b
[]
no_license
CptWildfire/Exo_FSM_cpp
c97659436e188ead91321a4b19da8b6fe9b059fc
18be5a24ed19d21aefa553a8b0a4b9ac0051d578
refs/heads/main
2023-04-27T07:48:42.371545
2021-05-08T20:01:04
2021-05-08T20:01:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
887
cpp
FSM_State.cpp
#include "FSM_State.h" #include "FSM_StateMachine.h" FSM_State::FSM_State() { } FSM_State::~FSM_State() { for (int i = 0; i < allTrans.size(); ++i) { delete(allTrans[i]); } } FSM_State::FSM_State(FSM_StateMachine* _fsm) { fsm = _fsm; } void FSM_State::Init() { } bool FSM_State::CanEnter() { return true; } void FSM_State::Enter() { isEnter = true; } void FSM_State::Run() { foundValidTrans = CanExit(); } void FSM_State::Exit() { if(!fsm)return; fsm->SwitchNextSate(validTrans->GetNextState()); } bool FSM_State::GetIsFinish() { return foundValidTrans; } bool FSM_State::GetIsEnter() { return isEnter; } std::string FSM_State::DebugFSM() { return std::string("FSM - State"); } bool FSM_State::CanExit() { for (int i = 0; i < allTrans.size(); ++i) { if(allTrans[i]->CanTransit()) { validTrans = allTrans[i]; return true; } } return false; }
75b7072ebc6e67de965d1d874217bc77ea8f21d5
4352b5c9e6719d762e6a80e7a7799630d819bca3
/tutorials/oldd/Basic-Dynamic-Mesh-Tutorial-OpenFoam/TUT16rotating/3.98/meshPhi
0db70c2d3410d22579ccede1986b11da004d75c4
[]
no_license
dashqua/epicProject
d6214b57c545110d08ad053e68bc095f1d4dc725
54afca50a61c20c541ef43e3d96408ef72f0bcbc
refs/heads/master
2022-02-28T17:20:20.291864
2019-10-28T13:33:16
2019-10-28T13:33:16
184,294,390
1
0
null
null
null
null
UTF-8
C++
false
false
88,157
meshPhi
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class surfaceScalarField; location "3.98"; object meshPhi; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 3 -1 0 0 0 0]; internalField nonuniform List<scalar> 8193 ( -0.00491858 0.00340252 0.00185841 -0.00748645 0.00645528 -0.00956245 0.00922294 -0.0111597 0.0116621 -0.0123016 0.013739 -0.0130199 0.015429 -0.0133519 0.0167171 -0.013339 0.0175968 -0.0130247 0.0180697 -0.0124526 0.0181448 -0.0116656 0.0178374 -0.0107046 0.0171685 -0.00960777 0.0161634 -0.00841002 0.0148516 -0.00714271 0.013265 -0.00583358 0.0114382 -0.00450683 0.00940723 -0.00318334 0.00720942 -0.001881 0.00488296 -0.000615107 0.0024667 0.000601219 -2.106e-14 0.00175657 -0.00247736 0.00284084 -0.00492524 0.00384477 -0.00730315 0.00475968 -0.00957042 0.00557705 -0.0116863 0.00628841 -0.0136102 0.00688513 -0.0153021 0.00735838 -0.0167231 0.00769919 -0.0178362 0.00789854 -0.0186066 0.00794767 -0.0190032 0.00783834 -0.0189995 0.00756327 -0.0185742 0.00711664 -0.017713 0.00649465 -0.0164094 0.00569607 -0.0146654 0.0047229 -0.012493 0.00358089 -0.00991447 0.00228016 -0.00696279 -0.00368208 0.000835568 -0.0178409 0.00938471 0.00922643 -0.0249986 0.0146688 -0.0307155 0.0194442 -0.0350413 0.0236388 -0.0380532 0.0271952 -0.0398494 0.0300714 -0.0405434 0.0322399 -0.0402579 0.0336878 -0.03912 0.0344155 -0.037257 0.0344357 -0.0347928 0.0337723 -0.0318446 0.0324587 -0.0285216 0.0305364 -0.0249231 0.0280539 -0.021138 0.0250655 -0.0172448 0.0216296 -0.0133115 0.0178084 -0.00939657 0.0136667 -0.0055501 0.00927189 -0.00181458 0.00469277 0.00177361 0 0.00518298 -0.00473437 0.00838563 -0.0094369 0.0113561 -0.0140329 0.0140703 -0.0184464 0.0165048 -0.022601 0.0186359 -0.0264195 0.0204394 -0.0298255 0.0218903 -0.0327436 0.0229631 -0.0351012 0.0236318 -0.0368295 0.023871 -0.0378657 0.0236563 -0.0381545 0.0229658 -0.0376504 0.0217812 -0.0363196 0.0200896 -0.0341423 0.017885 -0.0311143 0.0151697 -0.0272492 0.0119566 -0.0225791 0.00827021 -0.0171563 -0.0110531 0.00414805 -0.0366886 0.017 0.0237018 -0.0473183 0.0237764 -0.0556462 0.029893 -0.0617748 0.0352575 -0.0658442 0.0397948 -0.068023 0.0434479 -0.0684995 0.0461774 -0.0674733 0.0479617 -0.0651482 0.048796 -0.0617257 0.048691 -0.0574001 0.0476721 -0.0523546 0.0457772 -0.0467582 0.0430555 -0.0407639 0.0395661 -0.0345081 0.0353759 -0.0281103 0.0305587 -0.0216737 0.025194 -0.0152866 0.019366 -0.00902413 0.0131627 -0.0029496 0.00667575 0.00288302 -9.92844e-15 0.00842725 -0.00676681 0.0136421 -0.013524 0.0184901 -0.0201683 0.0229359 -0.0265939 0.0269447 -0.0326928 0.0304811 -0.038356 0.0335087 -0.0434737 0.0359896 -0.0479373 0.0378842 -0.0516409 0.0391524 -0.0544832 0.0397535 -0.0563702 0.0396486 -0.0572175 0.0388012 -0.0569536 0.03718 -0.0555224 0.0347608 -0.0528866 0.0315288 -0.0490299 0.0274815 -0.0439599 0.0226309 -0.0377097 0.0170062 -0.0303396 -0.0219375 0.0106553 -0.0608789 0.0252853 0.0447719 -0.0738354 0.0329263 -0.0837491 0.039831 -0.090782 0.0458914 -0.0951389 0.0510169 -0.0970565 0.0551356 -0.096792 0.0581948 -0.0946138 0.0601609 -0.0907923 0.0610193 -0.0855925 0.0607733 -0.079268 0.0594431 -0.0720562 0.0570643 -0.0641749 0.0536862 -0.0558204 0.0493706 -0.0471667 0.0441898 -0.0383654 0.0382251 -0.0295471 0.0315661 -0.0208226 0.024309 -0.0122856 0.0165563 -0.00401456 0.00841559 0.00392394 9.65741e-15 0.011473 -0.00857272 0.0185827 -0.0171801 0.0252073 -0.0256951 0.0313038 -0.0339866 0.0368293 -0.0419201 0.0417401 -0.0493579 0.0459909 -0.0561613 0.0495335 -0.0621913 0.0523178 -0.0673117 0.0542916 -0.0713908 0.0554021 -0.0743049 0.055597 -0.0759415 0.0548273 -0.0762029 0.0530488 -0.0750098 0.0502255 -0.0723049 0.0463325 -0.0680564 0.0413591 -0.0622611 0.0353119 -0.0549467 0.0282177 -0.0461736 -0.0360361 0.0201263 -0.0896533 0.0333093 0.0716896 -0.103812 0.0413173 -0.114329 0.0485822 -0.121424 0.0549817 -0.125364 0.06041 -0.126445 0.0647793 -0.124984 0.0680209 -0.121307 0.070086 -0.11574 0.0709458 -0.1086 0.0705911 -0.100187 0.0690313 -0.0907808 0.0662937 -0.0806384 0.0624215 -0.069989 0.0574729 -0.0590349 0.0515189 -0.0479519 0.0446426 -0.0368903 0.0369373 -0.0259772 0.0285056 -0.0153189 0.0194584 -0.00500452 0.00991456 0.00489156 9.34563e-15 0.0143059 -0.0101523 0.0231829 -0.0204025 0.0314724 -0.0306046 0.0391263 -0.0406063 0.0460971 -0.0502503 0.0523357 -0.0593746 0.0577905 -0.0678147 0.0624065 -0.075405 0.0661254 -0.0819819 0.0688862 -0.0873861 0.0706264 -0.0914665 0.0712833 -0.0940844 0.0707967 -0.0951169 0.0691117 -0.0944617 0.0661814 -0.0920414 0.0619706 -0.087807 0.0564594 -0.0817419 0.0496466 -0.0738646 0.0415531 -0.0642307 -0.0529343 0.032225 -0.122102 0.0402176 0.1035 -0.136403 0.0482335 -0.146618 0.0555586 -0.153019 0.0620568 -0.155922 0.067606 -0.155673 0.072101 -0.152637 0.0754546 -0.147187 0.0776 -0.13969 0.0784903 -0.130501 0.0780996 -0.119958 0.0764223 -0.108372 0.0734722 -0.0960268 0.0692817 -0.0831763 0.0639001 -0.0700427 0.0573926 -0.0568185 0.0498385 -0.0436672 0.0413304 -0.0307266 0.0319723 -0.018111 0.0218795 -0.00591524 0.0111771 0.00578173 0 0.0169133 -0.0115077 0.0274217 -0.023193 0.0372544 -0.0348944 0.0463616 -0.0464424 0.0546934 -0.0576605 0.0621979 -0.0683662 0.0688202 -0.0783725 0.0745008 -0.0874908 0.0791765 -0.0955332 0.0827801 -0.102316 0.085242 -0.107663 0.0864921 -0.111413 0.0864618 -0.113418 0.0850874 -0.113556 0.0823131 -0.11173 0.0780948 -0.107873 0.0724041 -0.101955 0.0652316 -0.0939834 0.056591 -0.0840068 -0.0721152 0.046522 -0.157193 0.045273 0.139072 -0.170684 0.0530745 -0.179801 0.0602829 -0.184855 0.0667479 -0.186202 0.0723305 -0.184224 0.0769065 -0.179322 0.0803689 -0.171898 0.0826299 -0.162352 0.0836224 -0.151065 0.0833005 -0.138399 0.0816401 -0.124686 0.0786383 -0.11023 0.0743127 -0.0952992 0.0687002 -0.0801285 0.0618562 -0.0649206 0.0538527 -0.049847 0.0447774 -0.0350509 0.0347327 -0.0206505 0.023834 -0.0067432 0.0122097 0.00659101 0 0.0192851 -0.0126431 0.0312812 -0.0255568 0.0425272 -0.0385675 0.0529735 -0.0514918 0.0625701 -0.0641372 0.0712647 -0.0763038 0.0790012 -0.087786 0.0857183 -0.098375 0.0913502 -0.107862 0.0958264 -0.116042 0.099073 -0.122718 0.101015 -0.127706 0.101579 -0.130839 0.100694 -0.131976 0.098299 -0.131001 0.0943428 -0.127833 0.0887899 -0.122427 0.0816244 -0.114782 0.0728532 -0.104936 -0.0929752 0.0625094 -0.193804 0.0478894 0.177139 -0.205673 0.0553798 -0.213029 0.062405 -0.216211 0.0688005 -0.215597 0.0744101 -0.211594 0.0790901 -0.204622 0.0827125 -0.195104 0.0851676 -0.183456 0.086366 -0.170078 0.0862404 -0.155343 0.084746 -0.139597 0.0818607 -0.123152 0.0775849 -0.106286 0.0719405 -0.0892403 0.0649704 -0.0722216 0.0567365 -0.0554045 0.0473192 -0.038934 0.036816 -0.0229288 0.0253403 -0.00748561 0.0130206 0.00731669 -3.5293e-20 0.0214128 -0.0135646 0.034747 -0.0275031 0.0472692 -0.0416326 0.0589318 -0.0557587 0.0696865 -0.0696759 0.0794825 -0.0831698 0.0882643 -0.0960191 0.0959712 -0.107998 0.102537 -0.11888 0.10789 -0.128442 0.111955 -0.136469 0.114655 -0.142758 0.115913 -0.147125 0.115656 -0.149413 0.113819 -0.14949 0.110347 -0.147262 0.105199 -0.142674 0.0983566 -0.135711 0.0898203 -0.126408 -0.114844 0.0796184 -0.23076 0.0476572 0.216343 -0.240364 0.0548468 -0.245451 0.0617143 -0.246372 0.0680817 -0.243515 0.0737763 -0.237297 0.0786353 -0.228145 0.0825098 -0.21649 0.0852678 -0.202756 0.0867975 -0.187347 0.087009 -0.170643 0.0858361 -0.152992 0.0832361 -0.13471 0.0791909 -0.116077 0.0737059 -0.0973355 0.0668094 -0.0786918 0.0585519 -0.0603202 0.0490042 -0.0423637 0.0382572 -0.0249392 0.0264202 -0.00814042 0.0136199 0.00795674 -4.0948e-15 0.0232904 -0.0142797 0.0378082 -0.029044 0.0514637 -0.0441033 0.0642125 -0.0592542 0.0760094 -0.0742809 0.0868064 -0.0889572 0.0965504 -0.103048 0.105183 -0.116315 0.112639 -0.128516 0.118848 -0.139412 0.123736 -0.148773 0.127226 -0.156382 0.129241 -0.162041 0.129708 -0.165577 0.12856 -0.166846 0.125742 -0.165745 0.121212 -0.162207 0.114948 -0.156212 0.106948 -0.147787 -0.137007 0.0972392 -0.26687 0.0443603 0.255282 -0.273754 0.051341 -0.276232 0.058145 -0.274649 0.0645824 -0.269394 0.0704656 -0.260878 0.0756139 -0.249528 0.0798583 -0.235772 0.0830458 -0.22003 0.0850423 -0.202704 0.0857359 -0.184171 0.0850384 -0.164778 0.0828867 -0.144837 0.0792435 -0.124625 0.0740967 -0.104381 0.0674597 -0.0843098 0.0593698 -0.0645801 0.0498877 -0.0453318 0.0390961 -0.0266773 0.0270986 -0.00870631 0.014019 0.00850987 -3.5293e-20 0.0249138 -0.0147975 0.0404575 -0.0301951 0.0550989 -0.0459979 0.0687979 -0.0619959 0.0815133 -0.077965 0.0932009 -0.0936694 0.103811 -0.108864 0.113289 -0.123297 0.121572 -0.136715 0.128594 -0.148867 0.134282 -0.159511 0.138562 -0.168416 0.141359 -0.175373 0.142602 -0.180198 0.142226 -0.182738 0.140177 -0.182881 0.136415 -0.180552 0.130918 -0.175727 0.123685 -0.168428 -0.158727 0.114742 -0.300963 0.0379825 0.292557 -0.304874 0.0448987 -0.304573 0.0517761 -0.300394 0.0584153 -0.29271 0.0646158 -0.281923 0.0701813 -0.268446 0.0749247 -0.252697 0.078673 -0.235086 0.0812714 -0.216005 0.0825868 -0.195823 0.0825099 -0.17488 0.0809574 -0.15348 0.0778729 -0.131895 0.0732272 -0.110356 0.0670179 -0.0890615 0.0592693 -0.0681763 0.0500308 -0.0478338 0.0393763 -0.0281412 0.0274032 -0.00918268 0.0142309 0.00897551 -2.32934e-17 0.026281 -0.0151285 0.0426909 -0.0309744 0.0581679 -0.0473392 0.0726766 -0.0640077 0.0861804 -0.0807492 0.0986396 -0.0973202 0.110009 -0.113467 0.120238 -0.128928 0.129268 -0.14344 0.137036 -0.156743 0.143475 -0.168582 0.148513 -0.178719 0.152081 -0.186934 0.154111 -0.193035 0.154542 -0.196863 0.153322 -0.198297 0.150416 -0.197259 0.145804 -0.19372 0.13949 -0.1877 -0.17927 0.131499 -0.331929 0.028705 0.326823 -0.332814 0.035722 -0.329738 0.042825 -0.323015 0.0498078 -0.312997 0.0564596 -0.300065 0.0625707 -0.284616 0.0679381 -0.267051 0.0723711 -0.247763 0.0756958 -0.227133 0.0777591 -0.205517 0.0784322 -0.183242 0.0776122 -0.160604 0.0752246 -0.137863 0.0712229 -0.115246 0.0655898 -0.0929409 0.0583358 -0.0711063 0.0494994 -0.0498693 0.0391453 -0.0293309 0.0273637 -0.00956965 0.0142694 0.00935377 2.41757e-17 0.0273923 -0.0152843 0.044508 -0.0314026 0.0606686 -0.0481539 0.0758436 -0.0653189 0.0900011 -0.082662 0.103106 -0.0999332 0.115118 -0.116871 0.125991 -0.133208 0.135671 -0.148672 0.144101 -0.162994 0.151218 -0.175911 0.156955 -0.187177 0.161248 -0.196566 0.164035 -0.203879 0.165258 -0.20895 0.164874 -0.211655 0.16285 -0.211912 0.159172 -0.20969 0.153847 -0.205007 -0.197933 0.146905 -0.358753 0.0168931 0.356833 -0.356754 0.0241665 -0.351071 0.0316361 -0.341993 0.0390916 -0.329847 0.0463142 -0.314992 0.0530834 -0.297803 0.0591826 -0.278659 0.0644053 -0.257939 0.0685605 -0.236003 0.0714771 -0.213195 0.0730076 -0.189828 0.0730312 -0.166187 0.0714558 -0.142522 0.0682187 -0.119049 0.0632876 -0.0959494 0.0566601 -0.0733734 0.0483634 -0.0514416 0.0384529 -0.0302489 0.0270118 -0.00986807 0.0141493 0.00964548 3.65085e-15 0.0282497 -0.0152777 0.0459117 -0.0315025 0.0626038 -0.0484721 0.0783 -0.0659641 0.0929732 -0.0837386 0.106593 -0.101541 0.119123 -0.119104 0.130523 -0.136153 0.140744 -0.152409 0.149734 -0.167596 0.157434 -0.181447 0.163784 -0.193707 0.168726 -0.204145 0.172202 -0.212556 0.174163 -0.218771 0.174569 -0.222662 0.173394 -0.224144 0.17063 -0.223185 0.166287 -0.2198 -0.214061 0.160402 -0.380545 0.00307501 0.381486 -0.375984 0.0107217 -0.368013 0.0186634 -0.356893 0.0266872 -0.342929 0.0345687 -0.326455 0.0420781 -0.307823 0.0489875 -0.287393 0.0550764 -0.265523 0.0601385 -0.242558 0.063986 -0.218824 0.0664546 -0.194624 0.0674065 -0.170227 0.066733 -0.145875 0.064356 -0.121773 0.0602289 -0.0980962 0.0543366 -0.0749863 0.0466953 -0.0525578 0.0373512 -0.0308996 0.0263802 -0.0100794 0.0138862 0.00985211 3.4782e-15 0.0288576 -0.0151219 0.0469083 -0.0312988 0.0639808 -0.048327 0.0800533 -0.0659822 0.0951027 -0.0840211 0.109103 -0.102184 0.122022 -0.120201 0.133824 -0.137789 0.144466 -0.154666 0.153898 -0.170549 0.162069 -0.185164 0.168925 -0.198254 0.174411 -0.209579 0.178477 -0.218933 0.181079 -0.226142 0.182183 -0.231074 0.18177 -0.233644 0.179836 -0.233815 0.176398 -0.231604 -0.227078 0.171493 -0.396572 -0.0120885 0.399859 -0.389928 -0.00401397 -0.380116 0.00444931 -0.367376 0.0130867 -0.351991 0.0216688 -0.334271 0.0299583 -0.31455 0.0377168 -0.293169 0.0447118 -0.270466 0.0507226 -0.246772 0.0555463 -0.222397 0.0590028 -0.197632 0.0609384 -0.172735 0.0612286 -0.147937 0.0597807 -0.123436 0.0565343 -0.0993978 0.0514621 -0.0759591 0.0445694 -0.0532283 0.0358935 -0.0312895 0.025503 -0.010206 0.0134962 0.00997577 3.38294e-15 0.0292219 -0.0148312 0.0475072 -0.0308175 0.0648116 -0.0477546 0.0811167 -0.0654164 0.096403 -0.0835568 0.110648 -0.101913 0.123823 -0.120209 0.135897 -0.138159 0.146829 -0.155475 0.156577 -0.171869 0.165093 -0.187062 0.172327 -0.200791 0.17823 -0.212814 0.182758 -0.222918 0.185873 -0.230927 0.187544 -0.236705 0.187759 -0.240164 0.186516 -0.241266 0.183838 -0.240023 -0.236501 0.179764 -0.406281 -0.02784 0.411247 -0.39816 -0.0193634 -0.38706 -0.0104003 -0.373206 -0.0011678 -0.356863 0.00809986 -0.338328 0.0171579 -0.317915 0.0257582 -0.295949 0.0336564 -0.272755 0.0406187 -0.24865 0.0464278 -0.223931 0.0508884 -0.198877 0.0538315 -0.173739 0.055118 -0.148737 0.0546406 -0.124063 0.0523258 -0.0998776 0.0481342 -0.0763108 0.0420607 -0.0534672 0.0341337 -0.0314271 0.0244143 -0.0102504 0.0129954 0.0100192 -3.26439e-15 0.0293505 -0.0144201 0.0477209 -0.0300858 0.0651126 -0.0467927 0.0815096 -0.0643131 0.096895 -0.0823985 0.111249 -0.100783 0.124546 -0.119186 0.136757 -0.137318 0.147847 -0.154885 0.157774 -0.171595 0.166496 -0.187165 0.173968 -0.201326 0.180145 -0.213831 0.184985 -0.224464 0.188455 -0.233043 0.190531 -0.23943 0.191199 -0.243532 0.190465 -0.245307 0.18835 -0.244762 -0.241959 0.184895 -0.409312 0.415178 -0.400413 -0.388655 -0.374255 -0.35747 -0.338585 -0.317906 -0.295745 -0.272417 -0.248228 -0.223467 -0.198404 -0.173281 -0.148316 -0.123692 -0.0995661 -0.0760656 -0.0532918 -0.0313226 -0.0102161 0.00998574 0.0292532 0.0475648 0.0649041 0.0812566 0.0966067 0.110936 0.124221 0.136435 0.147545 0.157512 0.166296 0.173855 0.180147 0.185135 0.188785 0.191076 0.191998 0.191555 0.189768 0.186676 0.255826 0.169785 0.26242 0.168343 0.26391 0.164093 0.260105 0.1572 0.251029 0.147911 0.236925 0.136544 0.21826 0.123483 0.195713 0.109161 0.170159 0.0940483 0.142645 0.07864 0.114349 0.0634373 0.0865472 0.048934 0.0605597 0.0356008 0.037706 0.0238704 0.0192497 0.0141242 0.00634764 0.00668064 0.00178502 0.248472 0.152648 0.255193 0.151525 0.257346 0.148063 0.254739 0.142388 0.247352 0.134688 0.235347 0.125206 0.219067 0.114232 0.199035 0.102097 0.175941 0.0891644 0.150626 0.075817 0.124055 0.0624489 0.0972904 0.0494533 0.0714586 0.0372126 0.0477098 0.026087 0.0271795 0.0164049 0.010948 0.00845371 0.002472 0.239146 0.135572 0.245949 0.134736 0.248681 0.131964 0.24715 0.127353 0.241299 0.121042 0.231219 0.113212 0.217152 0.10408 0.199485 0.0938964 0.17875 0.0829356 0.155608 0.0714904 0.130836 0.0598654 0.105303 0.0483685 0.0799505 0.0373042 0.05576 0.0269657 0.0337278 0.0176274 0.0148318 0.00953897 0.00291831 0.228076 0.118838 0.234907 0.118249 0.238127 0.116072 0.237542 0.112377 0.233066 0.107266 0.224733 0.100871 0.212698 0.0933528 0.197237 0.0848957 0.178746 0.0757042 0.157733 0.0659985 0.134806 0.0560096 0.110664 0.0459744 0.0860751 0.0361303 0.061861 0.0267103 0.0388735 0.0179376 0.017972 0.0100213 0.00315117 0.215521 0.102696 0.22232 0.102311 0.225929 0.100636 0.226154 0.0977196 0.222891 0.0936341 0.216124 0.0884748 0.205938 0.0823571 0.192518 0.0754149 0.176144 0.0677977 0.157195 0.0596675 0.136134 0.0511964 0.113507 0.0425624 0.0899287 0.0339469 0.0660682 0.0255305 0.0426359 0.0174897 0.0203663 0.00999383 0.00320136 0.201756 0.0873586 0.208457 0.0871361 0.212354 0.0858759 0.213258 0.0836113 0.211044 0.0803928 0.205663 0.0762866 0.197144 0.071374 0.185595 0.0657498 0.171203 0.0595208 0.154236 0.0528039 0.135036 0.045724 0.114017 0.0384122 0.0916546 0.0310034 0.0684805 0.023634 0.0450705 0.0164397 0.0220338 0.00955309 0.00310153 0.187064 0.0730033 0.193602 0.0729022 0.197688 0.0719777 0.199136 0.0702513 0.197813 0.0677568 0.193643 0.064539 0.18661 0.0606534 0.176761 0.0561654 0.164209 0.0511493 0.14913 0.0456872 0.131765 0.0398675 0.112414 0.0337842 0.0914341 0.0275348 0.0692327 0.0212196 0.0462623 0.0149395 0.0230122 0.00879503 0.0028846 0.171726 0.0597674 0.178036 0.0597515 0.182213 0.0590924 0.18408 0.0578034 0.183497 0.0559061 0.180367 0.0534295 0.174644 0.0504104 0.166327 0.0468924 0.155469 0.0429255 0.142174 0.0385657 0.126598 0.0338736 0.108947 0.0289146 0.0894762 0.023757 0.0684863 0.0184721 0.0463191 0.0131324 0.0233536 0.0078115 0.00258246 0.156009 0.0477515 0.16203 0.0477894 0.166209 0.047335 0.168374 0.0463957 0.168386 0.0449844 0.166137 0.0431192 0.161554 0.0408233 0.154605 0.0381247 0.145295 0.0350557 0.133671 0.031653 0.119822 0.027957 0.103877 0.0240112 0.0860066 0.0198618 0.0664205 0.0155577 0.0453651 0.0111491 0.0231211 0.00668746 0.00222495 0.140161 0.0370209 0.145838 0.0370871 0.149933 0.0367861 0.152286 0.0361214 0.152759 0.0351002 0.151239 0.0337329 0.147639 0.0320335 0.141899 0.0300189 0.133993 0.0277092 0.123923 0.0251273 0.111725 0.0222988 0.0974695 0.0192514 0.0812573 0.0160152 0.0632233 0.012622 0.0435336 0.00910514 0.0223844 0.00549902 0.00183901 0.124401 0.0276098 0.129683 0.0276846 0.133618 0.0274947 0.136057 0.0270416 0.13687 0.0263285 0.135941 0.0253612 0.133173 0.0241471 0.128494 0.022696 0.121851 0.0210196 0.113215 0.0191314 0.102585 0.0170466 0.0899831 0.014782 0.0754574 0.0123561 0.059083 0.00978841 0.0409605 0.00709986 0.021216 0.00431226 0.00144824 0.108913 0.019526 0.113757 0.0195953 0.117464 0.019483 0.119901 0.0191893 0.120942 0.0187154 0.120476 0.0180639 0.118405 0.0172385 0.114645 0.0162443 0.109131 0.0150874 0.101812 0.0137754 0.0926591 0.0123164 0.0816602 0.0107202 0.0688244 0.00899693 0.0541806 0.00715808 0.0377785 0.00521574 0.0196882 0.00318276 0.00107263 0.0938469 0.0127571 0.0982151 0.0128119 0.101636 0.0127513 0.103989 0.0125747 0.10516 0.0122824 0.105044 0.0118753 0.103544 0.0113549 0.100575 0.0107235 0.0960634 0.0099841 0.0899466 0.00914014 0.0821768 0.00819584 0.0727199 0.00715599 0.0615569 0.00602593 0.0486836 0.00481155 0.034112 0.00351923 0.0178695 0.00215583 0.000728619 0.0793125 0.00727694 0.0831736 0.00731298 0.0862568 0.00728465 0.0884563 0.00719144 0.0896703 0.00703317 0.0898024 0.00680998 0.0887623 0.00652234 0.0864666 0.00617106 0.0828399 0.00575723 0.0778153 0.00528231 0.0713353 0.00474802 0.0633524 0.00415641 0.0538298 0.00350979 0.0427415 0.00281079 0.0300734 0.00206225 0.0158229 0.00126731 0.00042932 0.0653834 0.00305267 0.0687106 0.00306943 0.0714122 0.00305971 0.0733975 0.0030232 0.0745782 0.00295973 0.0748691 0.00286923 0.0741887 0.00275176 0.0724602 0.00260747 0.0696117 0.00243665 0.065577 0.00223969 0.0602961 0.0020171 0.0537159 0.00176949 0.0457906 0.00149757 0.036482 0.00120218 0.0257602 0.000884242 0.0136037 0.000544775 0.000184894 0.0520981 5.17407e-05 0.0548683 5.19064e-05 0.0571501 5.16281e-05 0.0588684 5.09044e-05 0.0599493 4.97356e-05 0.0603206 4.81226e-05 0.0599122 4.60691e-05 0.0586568 4.35801e-05 0.05649 4.06617e-05 0.0533513 3.73219e-05 0.0491839 3.35699e-05 0.0439353 2.9416e-05 0.0375581 2.48719e-05 0.0300099 1.99503e-05 0.0212538 1.46649e-05 0.0112588 9.03021e-06 3.06185e-06 0.0394649 -0.0017513 0.0416571 -0.00176261 0.0434852 -0.00175913 0.0448901 -0.00174064 0.0458131 -0.00170692 0.0461964 -0.00165784 0.0459831 -0.0015933 0.0451181 -0.00151324 0.0435479 -0.00141766 0.0412209 -0.00130661 0.0380882 -0.00118019 0.0341034 -0.00103854 0.0292231 -0.000881856 0.0234073 -0.000710381 0.0166194 -0.000524406 0.00882653 -0.000324268 -0.000110353 0.0274672 -0.00236874 0.0290611 -0.00238458 0.0304045 -0.00238061 0.0314545 -0.00235646 0.0321684 -0.00231184 0.0325039 -0.00224651 0.0324191 -0.00216028 0.0318727 -0.00205304 0.0308244 -0.00192471 0.0292351 -0.00177529 0.027067 -0.00160483 0.0242837 -0.00141345 0.0208506 -0.00120133 0.0167351 -0.000968686 0.0119066 -0.000715825 0.00633687 -0.000443095 -0.000150906 0.0160703 -0.00179446 0.0170447 -0.00180673 0.0178734 -0.00180407 0.0185304 -0.00178618 0.0189896 -0.00175284 0.0192251 -0.00170384 0.0192108 -0.00163902 0.0189212 -0.00155825 0.0183312 -0.00146147 0.0174161 -0.00134863 0.0161518 -0.00121974 0.0145152 -0.00107486 0.0124839 -0.000914059 0.0100364 -0.000737486 0.00715241 -0.000545313 0.00381289 -0.000337759 -0.000115083 0.00522841 -3.93442e-18 0.00555973 -3.1201e-18 0.00584375 -3.34401e-18 0.00607163 -3.25406e-18 0.00623451 -2.53284e-18 0.00632351 -2.41066e-18 0.0063298 -2.29409e-18 0.00624461 -1.71944e-18 0.00605929 -1.19626e-18 0.00576533 -8.53405e-19 0.00535441 -4.82354e-19 0.00481845 -4.84832e-19 0.0041496 -6.02584e-19 0.00334034 -4.22373e-19 0.00238347 -2.15672e-19 0.00127216 -8.64521e-20 -1.72999e-20 -0.00510816 0.00306799 -0.0054467 0.00308894 -0.00573884 0.00308436 -0.0059756 0.00305376 -0.00614792 0.00299673 -0.00624675 0.00291293 -0.00626305 0.00280209 -0.00618786 0.00266399 -0.00601234 0.00249851 -0.00572777 0.00230558 -0.00532564 0.00208522 -0.00479766 0.00183751 -0.00413578 0.00156261 -0.00333228 0.00126075 -0.00237976 0.000932215 -0.0012712 0.000577396 0.000196732 -0.0149856 0.00748851 -0.0160251 0.00753845 -0.0169273 0.00752573 -0.0176645 0.00744924 -0.0182091 0.00730805 -0.0185332 0.00710138 -0.0186093 0.00682867 -0.01841 0.00648953 -0.0179084 0.00608376 -0.0170779 0.00561135 -0.0158929 0.00507247 -0.0143282 0.00446748 -0.0123596 0.00379694 -0.00996389 0.00306159 -0.00711908 0.00226236 -0.00380429 0.00140037 0.000476918 -0.0244403 0.0133652 -0.0262167 0.0134508 -0.0277659 0.0134236 -0.0290405 0.0132817 -0.0299931 0.0130238 -0.0305767 0.0126486 -0.0307445 0.0121555 -0.0304502 0.0115441 -0.0296486 0.0108144 -0.0282955 0.00996673 -0.0263479 0.00900191 -0.0237646 0.00792105 -0.020506 0.00672565 -0.0165343 0.00541758 -0.0118144 0.00399907 -0.00631307 0.00247272 0.000841463 -0.0334934 0.0208234 -0.0360478 0.0209491 -0.0382841 0.0208968 -0.0401342 0.0206642 -0.0415301 0.0202493 -0.0424044 0.019651 -0.0426907 0.0188688 -0.0423238 0.0179028 -0.0412403 0.0167538 -0.0393786 0.0154232 -0.0366799 0.0139134 -0.033088 0.012227 -0.0285497 0.0103675 -0.0230155 0.00833899 -0.0164396 0.00614624 -0.00878021 0.00379454 0.00128983 -0.0421464 0.0300052 -0.0455247 0.0301721 -0.0484916 0.0300787 -0.0509567 0.0297219 -0.0528302 0.0291 -0.0540236 0.0282123 -0.0544504 0.0270591 -0.0540266 0.0256421 -0.0526712 0.023964 -0.0503067 0.0220284 -0.0468599 0.0198405 -0.0422623 0.017406 -0.0364504 0.0147322 -0.0293666 0.0118271 -0.0209592 0.0086997 -0.0111831 0.00536012 0.00181929 -0.0503788 0.0410626 -0.0546312 0.0412677 -0.0583749 0.0411095 -0.0614954 0.0405851 -0.0638796 0.0396936 -0.0654172 0.0384355 -0.0660014 0.0368136 -0.0655296 0.0348322 -0.0639046 0.0324977 -0.0610347 0.0298181 -0.0568355 0.0268031 -0.0512296 0.0234642 -0.044148 0.0198145 -0.0355302 0.0158688 -0.0253253 0.0116432 -0.0134922 0.00715527 0.00242401 -0.0581465 0.0541491 -0.0633268 0.0543835 -0.0678956 0.0541278 -0.071712 0.05338 -0.0746382 0.0521408 -0.0765412 0.050414 -0.0772938 0.0482063 -0.0767759 0.0455272 -0.0748755 0.042389 -0.0714901 0.0388069 -0.0665275 0.0347986 -0.0599068 0.0303842 -0.0515594 0.0255866 -0.0414297 0.0204307 -0.0294758 0.0149436 -0.0156701 0.0091544 0.00309402 -0.0653831 0.0694095 -0.0715474 0.0696575 -0.0769904 0.0692603 -0.0815422 0.068218 -0.0850388 0.066535 -0.0873235 0.0642203 -0.088249 0.0612874 -0.0876789 0.0577542 -0.0854894 0.0536425 -0.0815705 0.0489785 -0.0758278 0.0437922 -0.0681835 0.0381172 -0.0585774 0.0319906 -0.0469681 0.0254525 -0.0333334 0.0185463 -0.0176712 0.0113175 0.00381415 -0.0720015 0.086969 -0.0792069 0.0872065 -0.0855727 0.0866106 -0.0908975 0.0851852 -0.0949887 0.0829408 -0.0976655 0.0798951 -0.0987607 0.0760721 -0.0981238 0.0715022 -0.0956224 0.0662222 -0.0911444 0.0602744 -0.0846 0.053707 -0.0759226 0.046573 -0.0650706 0.0389302 -0.0520281 0.0308406 -0.036806 0.02237 -0.0194417 0.013587 0.00456311 -0.0778986 0.106921 -0.0862013 0.107114 -0.0935367 0.106247 -0.0996683 0.10433 -0.104373 0.101382 -0.107445 0.0974353 -0.108697 0.0925284 -0.107969 0.0867109 -0.105124 0.0800406 -0.100054 0.0725837 -0.0926813 0.064414 -0.0829622 0.0556118 -0.0708854 0.0462639 -0.0564745 0.0364622 -0.0397883 0.0263028 -0.0209206 0.0158856 0.00531255 -0.0829599 0.129316 -0.0924138 0.129421 -0.100762 0.128193 -0.107729 0.125652 -0.113059 0.121832 -0.116519 0.116783 -0.117907 0.110567 -0.117053 0.103259 -0.113821 0.0949486 -0.108117 0.0857337 -0.099887 0.0757237 -0.0891198 0.0650367 -0.07585 0.0537983 -0.0601568 0.0421402 -0.0421645 0.0301989 -0.0220418 0.018114 0.00602661 -0.0870663 0.154147 -0.0977209 0.154109 -0.10712 0.152413 -0.114944 0.149091 -0.120902 0.1442 -0.124735 0.137815 -0.126225 0.13003 -0.125197 0.120957 -0.121526 0.110726 -0.115138 0.0994812 -0.106016 0.0873789 -0.094198 0.0745872 -0.0797797 0.0612833 -0.0629146 0.0476504 -0.0438121 0.0338763 -0.0227358 0.0201505 0.00666167 -0.0901014 0.181346 -0.102 0.181098 -0.11248 0.178805 -0.121176 0.17452 -0.127755 0.168326 -0.131932 0.160335 -0.133477 0.150685 -0.132215 0.139537 -0.128039 0.127077 -0.12091 0.113508 -0.110859 0.0990496 -0.0979916 0.0839363 -0.0824837 0.0684101 -0.0645834 0.05272 -0.0446069 0.037117 -0.0229333 0.021851 0.00716666 -0.0919584 0.210764 -0.105135 0.210231 -0.11672 0.207195 -0.12629 0.201736 -0.133472 0.193973 -0.137953 0.184069 -0.139491 0.172218 -0.137922 0.15865 -0.133164 0.143621 -0.125226 0.127415 -0.114207 0.110332 -0.100296 0.0926888 -0.0837728 0.0748114 -0.065002 0.0570289 -0.0444283 0.0396688 -0.022568 0.0230513 0.00748383 -0.0925481 0.242175 -0.107028 0.241274 -0.11973 0.237329 -0.130168 0.230455 -0.137922 0.220824 -0.142652 0.20866 -0.144108 0.194235 -0.142141 0.177865 -0.136711 0.159901 -0.127888 0.140727 -0.115858 0.120748 -0.100916 0.100385 -0.0834681 0.0800648 -0.0640195 0.0602141 -0.0431657 0.0412495 -0.0215803 0.0235702 0.00755023 -0.0918056 0.275265 -0.107601 0.273907 -0.121421 0.268871 -0.132708 0.260317 -0.14099 0.248481 -0.1459 0.233671 -0.147183 0.216258 -0.144715 0.196669 -0.138509 0.175377 -0.128716 0.152894 -0.115629 0.129754 -0.099675 0.106506 -0.08141 0.0837002 -0.0615037 0.0618771 -0.0407248 0.041554 -0.0199218 0.0232149 0.00729972 -0.0896964 0.309633 -0.106806 0.307731 -0.121732 0.301408 -0.133837 0.290882 -0.142592 0.276472 -0.147596 0.258591 -0.148599 0.237736 -0.145511 0.214478 -0.138412 0.189443 -0.127556 0.1633 -0.113365 0.136746 -0.0964249 0.110484 -0.0774666 0.0852103 -0.057349 0.0615943 -0.037034 0.0402636 -0.0175579 0.021788 0.00666562 -0.0862208 0.344795 -0.104629 0.342268 -0.120636 0.334455 -0.133515 0.321643 -0.142671 0.304256 -0.147673 0.28284 -0.148274 0.258053 -0.144432 0.230643 -0.136312 0.201429 -0.12429 0.171276 -0.108948 0.141076 -0.0910536 0.111718 -0.0715421 0.0840646 -0.0514837 0.0589307 -0.0320499 0.0370581 -0.0144726 0.0190963 0.00558396 -0.0814174 0.380188 -0.10109 0.37697 -0.118141 0.367461 -0.131738 0.352033 -0.141212 0.331236 -0.146099 0.305787 -0.146163 0.276541 -0.141418 0.244468 -0.132137 0.210625 -0.118842 0.176117 -0.1023 0.14207 -0.0834932 0.109588 -0.0635843 0.0797274 -0.0438768 0.0534564 -0.0257633 0.0316298 -0.0106703 0.0149603 0.00399721 -0.0753643 0.415178 -0.0962496 0.411229 -0.114293 0.399825 -0.128539 0.381439 -0.138237 0.356777 -0.142885 0.326763 -0.142263 0.292498 -0.136457 0.255227 -0.125864 0.216295 -0.111184 0.1771 -0.0933964 0.139042 -0.0737257 0.10348 -0.0535903 0.0716776 -0.0345431 0.0447657 -0.0182027 0.0236994 -0.00617962 0.00922586 0.00185837 0.189767 -0.241935 -0.186676 0.191553 -0.244746 0.191995 -0.245298 0.191072 -0.243532 0.188781 -0.239439 0.18513 -0.233061 0.180142 -0.22449 0.17385 -0.213864 0.166292 -0.201366 0.157508 -0.18721 0.147541 -0.171644 0.136432 -0.154935 0.124218 -0.137367 0.110934 -0.119234 0.0966049 -0.100827 0.0812554 -0.0824383 0.0649034 -0.0643466 0.0475644 -0.0468189 0.029253 -0.0301037 0.00998573 -0.0144292 -0.0102161 0 -0.0313228 0.0130045 -0.0532922 0.0244322 -0.0760664 0.0341598 -0.0995673 0.0420942 -0.123694 0.048174 -0.148318 0.0523705 -0.173284 0.0546887 -0.198407 0.0551678 -0.223471 0.0538814 -0.248232 0.0509365 -0.272422 0.0464725 -0.29575 0.0406584 -0.317911 0.0336897 -0.33859 0.0257839 -0.357474 0.0171753 -0.374258 0.00810842 -0.388658 -0.00116812 -0.400415 -0.0104092 -0.409313 -0.0193803 -0.027864 0.188366 -0.236474 -0.184913 0.190479 -0.240004 0.191211 -0.241255 0.190541 -0.240162 0.188463 -0.236712 0.184992 -0.230942 0.18015 -0.222942 0.173972 -0.212846 0.166499 -0.20083 0.157776 -0.187106 0.147848 -0.171917 0.136758 -0.155524 0.124547 -0.138209 0.111249 -0.120257 0.0968953 -0.101958 0.0815098 -0.0835965 0.0651126 -0.0654499 0.0477209 -0.0477807 0.0293505 -0.0308353 0.0100192 -0.0148403 -0.0102504 3.92152e-15 -0.031427 0.0135052 -0.0534672 0.0255209 -0.0763108 0.0359196 -0.0998775 0.0446028 -0.124063 0.0515018 -0.148737 0.0565788 -0.173738 0.0598285 -0.198876 0.0612781 -0.22393 0.0609878 -0.248647 0.0590503 -0.272752 0.0555902 -0.295945 0.0507612 -0.31791 0.0447438 -0.338321 0.0377411 -0.356855 0.029974 -0.373196 0.0216756 -0.387048 0.0130844 -0.398146 0.00443834 -0.406265 -0.00403298 -0.0121146 0.183869 -0.227049 -0.179798 0.186545 -0.231582 0.187785 -0.233801 0.187568 -0.233638 0.185893 -0.231078 0.182776 -0.226155 0.178245 -0.218955 0.172339 -0.209609 0.165103 -0.19829 0.156586 -0.185206 0.146837 -0.170595 0.135903 -0.154714 0.123828 -0.137837 0.110651 -0.120247 0.0964054 -0.102228 0.0811183 -0.08406 0.0648126 -0.066015 0.0475077 -0.0483527 0.029222 -0.0313164 0.00997579 -0.0151309 -0.0102059 0 -0.0312893 0.0138952 -0.0532278 0.0263978 -0.0759581 0.0373769 -0.0993962 0.0467281 -0.123434 0.0543755 -0.147934 0.0602725 -0.172731 0.0644027 -0.197626 0.0667812 -0.22239 0.0674544 -0.246763 0.0665004 -0.270455 0.064028 -0.293156 0.060175 -0.314535 0.0551061 -0.334254 0.0490093 -0.35197 0.0420913 -0.367353 0.0345727 -0.380091 0.0266822 -0.3899 0.0186496 -0.396541 0.0106999 0.00304634 0.176442 -0.21403 -0.17154 0.179878 -0.219776 0.181809 -0.223168 0.182218 -0.224136 0.18111 -0.222662 0.178505 -0.218781 0.174435 -0.212575 0.168946 -0.204172 0.162088 -0.193741 0.153913 -0.181486 0.144478 -0.16764 0.133835 -0.152454 0.122031 -0.136199 0.109109 -0.119149 0.0951071 -0.101583 0.0800562 -0.0837761 0.0639826 -0.0659957 0.0469092 -0.0484968 0.0288579 -0.0315195 0.00985214 -0.0152863 -0.0100794 4.15131e-15 -0.0308992 0.014158 -0.0525568 0.0270288 -0.0749845 0.0384777 -0.0980933 0.0483951 -0.121769 0.0566976 -0.145869 0.0633294 -0.170219 0.0682634 -0.194613 0.0715017 -0.218811 0.0730767 -0.242542 0.0730507 -0.265505 0.0715162 -0.287372 0.068594 -0.307798 0.0644319 -0.326427 0.0592011 -0.342898 0.0530932 -0.356858 0.0463149 -0.367975 0.0390832 -0.375943 0.0316192 -0.380501 0.0241418 0.0168619 0.166341 -0.197899 -0.160458 0.170681 -0.204979 0.173442 -0.20967 0.174613 -0.2119 0.174204 -0.211652 0.172239 -0.208956 0.168759 -0.203894 0.163814 -0.196589 0.157459 -0.187207 0.149755 -0.175946 0.140762 -0.163033 0.130538 -0.148714 0.119135 -0.133251 0.106602 -0.116913 0.0929796 -0.0999726 0.0783043 -0.0826973 0.0626065 -0.0653489 0.0459131 -0.0481774 0.0282502 -0.0314187 0.00964553 -0.0152926 -0.00986802 3.5293e-20 -0.0302484 0.0142776 -0.0514403 0.0273799 -0.0733708 0.0391688 -0.0959451 0.0495294 -0.119043 0.0583712 -0.142513 0.0656292 -0.166176 0.0712649 -0.189814 0.0752674 -0.213177 0.0776543 -0.235982 0.0784717 -0.257913 0.0777945 -0.27863 0.0757254 -0.29777 0.0723937 -0.314955 0.0679527 -0.329806 0.0625766 -0.341948 0.0564566 -0.351023 0.049796 -0.356703 0.042805 -0.358699 0.0356947 0.0286717 0.153906 -0.179236 -0.146965 0.15923 -0.187671 0.162905 -0.193698 0.164926 -0.197244 0.165307 -0.19829 0.164079 -0.196865 0.161288 -0.193046 0.156991 -0.186952 0.151249 -0.178744 0.144128 -0.168613 0.135694 -0.156778 0.126009 -0.143478 0.115133 -0.128967 0.103117 -0.113505 0.0900094 -0.0973565 0.0758492 -0.0807819 0.0606721 -0.0640355 0.0445098 -0.047361 0.0273929 -0.0309894 0.00935385 -0.0151361 -0.00956958 -2.34699e-17 -0.0293303 0.0142385 -0.0498676 0.0274182 -0.0711029 0.0393981 -0.0929352 0.0500586 -0.115237 0.059302 -0.137852 0.0670543 -0.160589 0.0732657 -0.183223 0.077912 -0.205494 0.0809954 -0.227106 0.0825451 -0.247732 0.0826177 -0.267015 0.0812967 -0.284576 0.0786913 -0.300021 0.0749351 -0.312948 0.0701833 -0.322963 0.0646093 -0.329683 0.0584004 -0.332757 0.0517536 -0.33187 0.0448696 0.0379482 0.13955 -0.158693 -0.131559 0.145864 -0.168398 0.150474 -0.175703 0.153378 -0.180535 0.154594 -0.182871 0.15416 -0.182737 0.152127 -0.180204 0.148554 -0.175387 0.143511 -0.168437 0.137067 -0.159537 0.129294 -0.148898 0.12026 -0.136748 0.110027 -0.123331 0.0986532 -0.108898 0.0861904 -0.093702 0.0726834 -0.0779946 0.0581721 -0.0620211 0.0426931 -0.0460177 0.0262818 -0.0302087 0.00897559 -0.0148044 -0.00918259 4.47802e-15 -0.0281404 0.014026 -0.0478317 0.0271123 -0.0681721 0.0391159 -0.0890547 0.0499129 -0.110346 0.0593993 -0.131881 0.0674923 -0.153463 0.0741311 -0.174858 0.0792781 -0.195796 0.0829201 -0.215973 0.0850689 -0.235049 0.0857621 -0.252656 0.0850629 -0.268401 0.0830596 -0.281874 0.0798647 -0.292658 0.0756123 -0.300338 0.0704561 -0.304515 0.0645653 -0.304814 0.0581211 -0.300903 0.0513114 0.0443265 0.123743 -0.136975 -0.114798 0.130976 -0.147758 0.136474 -0.156188 0.140235 -0.162188 0.142281 -0.165733 0.142654 -0.166842 0.141407 -0.165579 0.138606 -0.162051 0.134321 -0.156398 0.128628 -0.148795 0.121602 -0.139438 0.113313 -0.128544 0.103831 -0.116345 0.0932162 -0.103078 0.0815246 -0.0889857 0.0688056 -0.0743068 0.0551037 -0.0592764 0.04046 -0.0441208 0.0249146 -0.0290561 0.00850997 -0.0142858 -0.00870621 4.55979e-15 -0.0266764 0.013626 -0.0453294 0.0264323 -0.0645754 0.0382748 -0.0843021 0.0490264 -0.10437 0.0585778 -0.12461 0.066838 -0.144817 0.0737358 -0.164753 0.0792208 -0.184141 0.0832645 -0.202669 0.0858616 -0.219991 0.0870304 -0.235728 0.0868134 -0.24948 0.0852774 -0.260826 0.0825125 -0.269339 0.0786308 -0.274592 0.0737646 -0.276173 0.0680633 -0.273696 0.0616902 -0.266812 0.0548181 0.0476255 0.107 -0.114816 -0.0972875 0.115002 -0.126382 0.121267 -0.135688 0.125797 -0.142655 0.128615 -0.147249 0.12976 -0.149483 0.12929 -0.149413 0.127271 -0.147131 0.123777 -0.142769 0.118884 -0.136485 0.11267 -0.128462 0.105209 -0.118903 0.0965718 -0.108023 0.086823 -0.0960443 0.0760217 -0.083194 0.0642209 -0.069698 0.0514689 -0.0557777 0.0378109 -0.0416476 0.0232914 -0.0275135 0.00795684 -0.0135699 -0.00814031 -3.5293e-20 -0.0249382 0.0130259 -0.0423611 0.0253506 -0.060315 0.036831 -0.0786834 0.0473382 -0.0973232 0.0567586 -0.116061 0.0649946 -0.134689 0.0719657 -0.152966 0.0776098 -0.170611 0.0818841 -0.187311 0.0847666 -0.202715 0.086257 -0.216445 0.0863777 -0.228095 0.0851735 -0.237244 0.0827123 -0.243461 0.0790835 -0.246317 0.0743973 -0.245396 0.0687821 -0.24031 0.062382 -0.230709 0.0553535 0.0478613 0.0898641 -0.0929518 -0.0796575 0.0984041 -0.104913 0.105249 -0.114761 0.110398 -0.12241 0.11387 -0.12782 0.115706 -0.130993 0.115961 -0.131973 0.114699 -0.130842 0.111996 -0.127713 0.107926 -0.12273 0.102569 -0.116058 0.0959982 -0.10788 0.0882863 -0.0983949 0.0794997 -0.0878064 0.0696993 -0.0763236 0.0589405 -0.0641554 0.0472746 -0.0515074 0.0347498 -0.0385799 0.0214138 -0.0255654 0.0073168 -0.0126475 -0.0074855 0 -0.0229278 0.0122141 -0.0389312 0.0238426 -0.0553991 0.0347451 -0.0722128 0.0447931 -0.0892275 0.0538708 -0.106269 0.0618759 -0.12313 0.0687206 -0.13957 0.0743326 -0.155311 0.0786567 -0.170041 0.0816559 -0.183415 0.0833127 -0.195059 0.0836302 -0.204574 0.0826328 -0.211544 0.0803665 -0.215546 0.0768988 -0.21616 0.0723177 -0.212979 0.0667307 -0.205625 0.0602624 -0.19376 0.0530518 0.0452497 0.0728878 -0.0720972 -0.0625386 0.0816635 -0.0839886 0.0888325 -0.0939663 0.0943877 -0.10194 0.0983451 -0.107861 0.10074 -0.111722 0.101624 -0.113553 0.101058 -0.113419 0.0991124 -0.111418 0.0958619 -0.107672 0.0913815 -0.102327 0.0857449 -0.0955469 0.079023 -0.087506 0.0712819 -0.0783882 0.0625829 -0.0683815 0.0529823 -0.0576747 0.0425327 -0.0464547 0.031284 -0.0349042 0.0192861 -0.0231998 0.00659113 -0.0115112 -0.00674308 -9.72824e-15 -0.0206495 0.0111806 -0.0350481 0.0218863 -0.0498416 0.0319821 -0.0649118 0.0413427 -0.0801158 0.0498527 -0.0952821 0.0574079 -0.110208 0.0639157 -0.12466 0.0692968 -0.138367 0.0734859 -0.151029 0.0764337 -0.162312 0.078108 -0.171856 0.078495 -0.179277 0.0776006 -0.184178 0.075451 -0.186156 0.0720932 -0.18481 0.0675944 -0.179758 0.062042 -0.170645 0.0555415 -0.157158 0.0482154 0.0401996 0.0566163 -0.0529218 -0.0465419 0.0652618 -0.0642174 0.0724383 -0.0738515 0.0781321 -0.0817301 0.0823523 -0.0877973 0.0851275 -0.0920344 0.0865016 -0.0944578 0.0865305 -0.0951162 0.0852781 -0.0940868 0.0828131 -0.0914718 0.0792057 -0.0873938 0.0745259 -0.0819915 0.0688409 -0.0754158 0.0622143 -0.067826 0.0547056 -0.0593858 0.0463701 -0.0502607 0.0372597 -0.0406154 0.0274244 -0.0306118 0.0169143 -0.0204076 0.00578184 -0.0101549 -0.00591512 3.5293e-20 -0.01811 0.00991715 -0.0307238 0.0194635 -0.043662 0.0285129 -0.05681 0.0369464 -0.0700304 0.0446531 -0.0831599 0.0515301 -0.0960061 0.0574842 -0.108347 0.0624323 -0.119929 0.0663033 -0.130468 0.069039 -0.139653 0.0705964 -0.147148 0.0709482 -0.152598 0.0700853 -0.155633 0.068017 -0.155882 0.0647723 -0.152982 0.0604004 -0.146584 0.0549699 -0.136373 0.0485691 -0.122077 0.041304 0.0332968 0.04157 -0.0360284 -0.032237 0.0496681 -0.0461649 0.056485 -0.0549378 0.0619996 -0.0622527 0.0662129 -0.0680492 0.0691447 -0.0722994 0.0708302 -0.0750063 0.0713162 -0.0762016 0.0706578 -0.0759424 0.0689153 -0.0743078 0.0661514 -0.0713955 0.062429 -0.0673178 0.0578093 -0.0621983 0.0523507 -0.0561687 0.0461083 -0.0493654 0.0391341 -0.0419271 0.0314772 -0.0339928 0.0231855 -0.0257 0.0143068 -0.0171835 0.00489166 -0.00857448 -0.00500442 0 -0.015318 0.00841736 -0.0259746 0.0165597 -0.0368855 0.024314 -0.0479442 0.0315723 -0.0590237 0.0382321 -0.0699741 0.0441972 -0.0806196 0.0493781 -0.0907582 0.0536932 -0.10016 0.0570703 -0.108571 0.0594478 -0.115709 0.0607762 -0.121274 0.0610202 -0.12495 0.0601596 -0.126412 0.0581913 -0.125333 0.0551301 -0.121395 0.0510097 -0.114303 0.045883 -0.10379 0.0398221 -0.0896364 0.0329176 0.0252776 0.0282276 -0.0219336 -0.0201324 0.0353257 -0.0303348 0.0413766 -0.0377045 0.0463533 -0.0439548 0.0502489 -0.0490254 0.053074 -0.052883 0.0548535 -0.0555199 0.0556233 -0.0569524 0.0554275 -0.0572176 0.0543155 -0.0563715 0.0523395 -0.0544857 0.0495525 -0.0516442 0.0460068 -0.0479413 0.0417529 -0.043478 0.0368389 -0.0383603 0.0313105 -0.032697 0.0252115 -0.0265975 0.0185849 -0.0201713 0.0114738 -0.0135261 0.00392403 -0.00676787 -0.00401447 -1.0296e-14 -0.0122848 0.00667681 -0.0208204 0.0131647 -0.0295429 0.0193689 -0.0383587 0.0251976 -0.0471571 0.0305628 -0.0558077 0.0353802 -0.064159 0.0395704 -0.0720373 0.0430595 -0.0792464 0.0457805 -0.0855686 0.0476746 -0.0907668 0.0486924 -0.0945875 0.0487961 -0.0967658 0.0479605 -0.0970312 0.0461749 -0.0951155 0.0434443 -0.0907612 0.0397903 -0.0837316 0.0352524 -0.0738216 0.0298878 -0.060869 0.0237716 0.0169961 0.017011 -0.0110516 -0.0106577 0.0226386 -0.0171543 0.027492 -0.0225768 0.031542 -0.0272468 0.0347763 -0.0311121 0.0371974 -0.0341404 0.0388197 -0.0363183 0.0396675 -0.0376496 0.0397722 -0.0381544 0.0391701 -0.0378662 0.0379005 -0.0368305 0.0360039 -0.0351026 0.0335209 -0.0327454 0.0304909 -0.0298274 0.0269521 -0.0264215 0.0229412 -0.0226029 0.0184934 -0.0184481 0.0136438 -0.0140342 0.00842788 -0.00943786 0.00288309 -0.00473487 -0.00294953 1.04777e-14 -0.0090235 0.00469327 -0.0152849 0.00927285 -0.0216704 0.0136681 -0.028105 0.01781 -0.0345007 0.0216315 -0.0407541 0.0250675 -0.046746 0.0280559 -0.0523402 0.0305381 -0.0573838 0.0324601 -0.0617079 0.0337733 -0.0651295 0.0344362 -0.0674544 0.0344153 -0.068481 0.033687 -0.0680056 0.0322385 -0.0658286 0.0300695 -0.0617615 0.027193 -0.0556357 0.0236364 -0.0473107 0.0194419 -0.0366838 0.0146668 0.00938329 0.00827195 -0.00368182 -0.00414863 0.0119599 -0.00696234 0.0151748 -0.00991391 0.0178918 -0.0124924 0.0200981 -0.0146648 0.021791 -0.0164089 0.0229765 -0.0177126 0.0236676 -0.0185739 0.0238823 -0.0189994 0.0236428 -0.0190033 0.0229732 -0.0186068 0.0218994 -0.0178365 0.0204471 -0.0167236 0.0186422 -0.0153026 0.0165096 -0.0136107 0.0140737 -0.0116868 0.0113582 -0.00957086 0.00838675 -0.00730351 0.00518339 -0.00492549 0.00177366 -0.00247749 -0.00181453 -1.06562e-14 -0.00554969 0.00246683 -0.00939545 0.00488321 -0.0133093 0.00720977 -0.0172414 0.00940767 -0.0211332 0.0114387 -0.0249168 0.0132655 -0.0285138 0.0148521 -0.0318355 0.0161639 -0.0347826 0.0171688 -0.0372461 0.0178376 -0.0391087 0.0181448 -0.0402466 0.0180696 -0.0405327 0.0175965 -0.0398397 0.0167167 -0.0380447 0.0154285 -0.0350344 0.0137384 -0.0307104 0.0116615 -0.0249953 0.00922238 -0.0178392 0.00645484 0.00340227 0.00228045 -0.000835607 0.00358163 0.00472419 0.00569798 0.00649714 0.00711965 0.00756667 0.007842 0.00795142 0.00790223 0.00770265 0.00736151 0.00688782 0.00629061 0.00557874 0.00476087 0.00384553 0.00284124 0.00175672 0.000601235 -0.00061509 -0.00188085 -0.00318294 -0.00450607 -0.00583238 -0.00714102 -0.00840782 -0.00960507 -0.0107015 -0.0116621 -0.0124489 -0.0130209 -0.0133354 -0.0133485 -0.0130169 -0.0122991 -0.0111578 -0.00956115 -0.00748571 -0.00491829 -0.00617978 0.00399741 -0.0182036 0.0149617 -0.0345455 0.0316337 -0.0535948 0.0534646 -0.0737325 0.0797417 -0.0934051 0.10961 -0.111194 0.1421 -0.125873 0.176156 -0.136464 0.210671 -0.142266 0.244519 -0.142882 0.276595 -0.138228 0.30584 -0.128524 0.331285 -0.114271 0.352074 -0.0962231 0.36749 -0.0753351 0.376985 0.380188 -0.0106706 0.0055844 -0.0257643 0.0190985 -0.0438793 0.0370634 -0.0635885 0.0589407 -0.083499 0.0840806 -0.102307 0.111741 -0.118849 0.141107 -0.132142 0.171313 -0.141421 0.201472 -0.14616 0.23069 -0.146091 0.258101 -0.141197 0.282887 -0.131717 0.304298 -0.118114 0.321678 -0.101058 0.33448 -0.0813833 0.34228 0.344795 -0.0144728 0.00666633 -0.032051 0.021791 -0.051486 0.0402701 -0.0715456 0.0616055 -0.0910582 0.0852272 -0.108952 0.110507 -0.124294 0.136775 -0.136313 0.163335 -0.14443 0.189482 -0.148267 0.21452 -0.14766 0.237779 -0.142652 0.258632 -0.13349 0.276508 -0.120605 0.290912 -0.104594 0.301429 -0.0861833 0.307741 0.309632 -0.0175582 0.00730069 -0.037035 0.0232185 -0.0573508 0.0415614 -0.0774692 0.0618891 -0.0964278 0.0837174 -0.113368 0.106528 -0.127557 0.129781 -0.13841 0.152926 -0.145505 0.175413 -0.148588 0.196706 -0.147579 0.216295 -0.142569 0.233706 -0.133808 0.248512 -0.121699 0.260341 -0.106769 0.268887 -0.0896567 0.273915 0.275263 -0.019922 0.00755142 -0.0407256 0.0235743 -0.0615049 0.0412574 -0.0814115 0.0602263 -0.0996762 0.0800816 -0.115629 0.100406 -0.128714 0.120774 -0.138503 0.140756 -0.144706 0.159932 -0.147168 0.177897 -0.14588 0.194266 -0.140965 0.208689 -0.132677 0.220849 -0.121385 0.230475 -0.107563 0.237342 -0.0917652 0.24128 0.242173 -0.0215805 0.00748517 -0.0431661 0.0230558 -0.0640201 0.0396769 -0.0834685 0.0570409 -0.100915 0.0748274 -0.115855 0.0927085 -0.127884 0.110355 -0.136703 0.12744 -0.142129 0.143648 -0.144091 0.158677 -0.14263 0.172245 -0.137895 0.184093 -0.130136 0.193994 -0.119694 0.201752 -0.10699 0.207206 -0.092508 0.210236 0.210762 -0.022568 0.00716807 -0.0444284 0.0218556 -0.065002 0.037125 -0.0837721 0.0527314 -0.100294 0.0684249 -0.114203 0.083954 -0.12522 0.0990699 -0.133154 0.11353 -0.137908 0.1271 -0.139473 0.13956 -0.13793 0.150706 -0.133445 0.160355 -0.126259 0.168343 -0.116685 0.174533 -0.105098 0.178813 -0.0919197 0.181101 0.181344 -0.0229333 0.00666309 -0.0446067 0.0201549 -0.0645829 0.0338838 -0.0824822 0.0476609 -0.0979886 0.0612965 -0.110854 0.0746029 -0.120902 0.0873963 -0.128028 0.0994999 -0.1322 0.110745 -0.133457 0.120976 -0.131909 0.130047 -0.127727 0.137831 -0.121145 0.144213 -0.112447 0.149101 -0.101964 0.152419 -0.0900649 0.154112 0.154145 -0.0227358 0.00602797 -0.0438118 0.0181181 -0.0629135 0.0302057 -0.0797775 0.0421496 -0.0941942 0.0538098 -0.10601 0.0650501 -0.115129 0.0757384 -0.121514 0.0857492 -0.125181 0.0949643 -0.126206 0.103274 -0.124712 0.110581 -0.120876 0.116795 -0.114915 0.121842 -0.107089 0.125659 -0.0976881 0.128198 -0.0870328 0.129422 0.129314 -0.0220417 0.0053138 -0.042164 0.0158893 -0.0601554 0.0263088 -0.0758473 0.0364702 -0.0891154 0.0462737 -0.0998804 0.055623 -0.108108 0.0644261 -0.113809 0.0725963 -0.117038 0.0800531 -0.117889 0.0867229 -0.116498 0.0925394 -0.113034 0.0974449 -0.107702 0.10139 -0.100734 0.104336 -0.092384 0.106251 -0.0829296 0.107115 0.106919 -0.0209205 0.0045642 -0.0397876 0.0135902 -0.0564729 0.0223751 -0.0708825 0.0308474 -0.0829576 0.0389383 -0.0926746 0.046582 -0.100045 0.0537167 -0.105112 0.0602844 -0.107955 0.066232 -0.10868 0.0715115 -0.107425 0.0760805 -0.104351 0.0799024 -0.0996444 0.0829466 -0.0935113 0.0851893 -0.0861749 0.0866129 -0.0778718 0.0872069 0.0869675 -0.0194415 0.00381508 -0.0368053 0.0113201 -0.0520265 0.0185504 -0.0650676 0.025458 -0.075918 0.031997 -0.0845935 0.0381244 -0.0911358 0.0437998 -0.0956115 0.0489862 -0.0981106 0.05365 -0.0987452 0.0577612 -0.0976478 0.0612937 -0.0949692 0.0642257 -0.0908764 0.0665392 -0.0855504 0.068221 -0.0791839 0.0692619 -0.0719783 0.0696577 0.0694083 -0.017671 0.00309476 -0.0333326 0.00915652 -0.0469664 0.0149469 -0.0585746 0.0204349 -0.0681792 0.0255916 -0.0758218 0.0303897 -0.0815626 0.0348043 -0.0854795 0.0388127 -0.0876671 0.0423946 -0.0882353 0.0455323 -0.0873081 0.0482109 -0.0850219 0.0504178 -0.081524 0.0521438 -0.0769713 0.053382 -0.0715278 0.0541289 -0.0653634 0.0543835 0.0541481 -0.01567 0.00242458 -0.0294751 0.00715686 -0.0414282 0.0116456 -0.0515568 0.0158719 -0.0599028 0.0198182 -0.0665221 0.0234681 -0.0714831 0.0268072 -0.0748669 0.0298222 -0.0767656 0.0325017 -0.077282 0.0348359 -0.0765281 0.0368168 -0.0746239 0.0384382 -0.0716967 0.0396956 -0.0678797 0.0405865 -0.0633105 0.0411102 -0.0581301 0.0412676 0.0410619 -0.013492 0.0018197 -0.0253247 0.00536125 -0.0355288 0.00870142 -0.0441456 0.0118293 -0.0512262 0.0147347 -0.0568308 0.0174088 -0.0610288 0.0198433 -0.0638973 0.0220312 -0.0655211 0.0239666 -0.0659916 0.0256446 -0.0654064 0.0270613 -0.0638678 0.0282141 -0.0614829 0.0291014 -0.0583619 0.0297228 -0.0546179 0.0300791 -0.0503655 0.0301721 0.0300047 -0.0111829 0.0012901 -0.0209587 0.00379528 -0.0293655 0.00614735 -0.0364485 0.00834039 -0.0422594 0.0103691 -0.046856 0.0122287 -0.0503018 0.0139151 -0.0526652 0.015425 -0.0540197 0.0167554 -0.0544426 0.0179043 -0.0540149 0.0188701 -0.0528208 0.0196521 -0.0509468 0.0202501 -0.0484814 0.0206647 -0.0455142 0.0208971 -0.042136 0.020949 0.0208231 -0.00878009 0.000841614 -0.0164392 0.00247314 -0.0230146 0.0039997 -0.0285482 0.00541837 -0.0330857 0.00672655 -0.0366769 0.00792201 -0.0393748 0.00900289 -0.0412357 0.00996769 -0.0423185 0.0108153 -0.0426847 0.0115449 -0.0423978 0.0121562 -0.041523 0.0126492 -0.0401267 0.0130242 -0.0382764 0.013282 -0.0360399 0.0134237 -0.0334856 0.0134507 0.013365 -0.00631298 0.000476986 -0.0118141 0.00140056 -0.0165337 0.00226264 -0.0205049 0.00306194 -0.023763 0.00379733 -0.0263458 0.0044679 -0.0282928 0.0050729 -0.0296454 0.00561177 -0.0304464 0.00608416 -0.0307402 0.00648989 -0.0305721 0.00682898 -0.0299882 0.00710163 -0.0290353 0.00730824 -0.0277605 0.00744936 -0.0262113 0.00752578 -0.0244349 0.00753843 0.00748842 -0.00380423 0.000196749 -0.00711889 0.000577442 -0.00996349 0.000932285 -0.0123589 0.00126083 -0.0143272 0.00156271 -0.0158916 0.00183762 -0.0170763 0.00208533 -0.0179064 0.00230569 -0.0184078 0.00249861 -0.0186068 0.00266408 -0.0185305 0.00280216 -0.0182062 0.00291299 -0.0176615 0.00299678 -0.0169241 0.00305379 -0.0160219 0.00308437 -0.0149824 0.00308894 0.00306797 -0.00127119 0 -0.0023797 0 -0.00333214 0 -0.00413556 -1.89475e-19 -0.00479733 -4.25833e-19 -0.00532522 -2.36358e-19 -0.00572724 0 -0.0060117 0 -0.00618712 0 -0.00626222 0 -0.00624585 2.54336e-19 -0.00614696 -2.16546e-20 -0.00597459 -5.73258e-19 -0.0057378 -2.97268e-19 -0.00544564 3.38577e-19 -0.00510712 -1.99746e-20 -3.58551e-19 0.00127214 -0.000115066 0.00238341 -0.000337712 0.00334021 -0.000545243 0.00414938 -0.000737399 0.00481813 -0.00091396 0.00535399 -0.00107475 0.00576479 -0.00121964 0.00605865 -0.00134853 0.00624387 -0.00146137 0.00632897 -0.00155816 0.00632261 -0.00163894 0.00623354 -0.00170378 0.00607062 -0.0017528 0.00584271 -0.00178615 0.00555868 -0.00180406 0.00522736 -0.00180674 -0.00179449 0.00381284 -0.000150838 0.00715222 -0.000442909 0.010036 -0.000715545 0.0124832 -0.000968337 0.0145143 -0.00120093 0.0161505 -0.00141303 0.0174144 -0.0016044 0.0183293 -0.00177486 0.018919 -0.00192431 0.0192083 -0.00205268 0.0192223 -0.00215997 0.0189867 -0.00224626 0.0185273 -0.00231165 0.0178702 -0.00235634 0.0170415 -0.00238056 0.0160672 -0.0023846 -0.00236883 0.00633679 -0.000110202 0.0119063 -0.000323852 0.0167345 -0.000523777 0.0208495 -0.000709593 0.0242821 -0.000880958 0.0270648 -0.00103758 0.0292324 -0.00117921 0.0308212 -0.00130565 0.0318689 -0.00141675 0.0324149 -0.00151241 0.0324993 -0.00159258 0.0321635 -0.00165726 0.0314493 -0.00170648 0.0303991 -0.00174035 0.0290557 -0.00175901 0.0274618 -0.00176265 -0.0017515 0.00882642 3.32668e-06 0.0166189 9.76403e-06 0.0234064 1.57771e-05 0.0292216 2.13519e-05 0.0341011 2.64768e-05 0.0380852 3.11422e-05 0.0412171 3.53403e-05 0.0435433 3.90658e-05 0.0451128 4.23152e-05 0.0459771 4.5087e-05 0.0461898 4.73817e-05 0.045806 4.92017e-05 0.0448827 5.05513e-05 0.0434775 5.14359e-05 0.0416493 5.18638e-05 0.0394571 5.18438e-05 5.1386e-05 0.0112587 0.000185299 0.0212533 0.000545906 0.0300088 0.000885968 0.0375562 0.00120437 0.0439324 0.00150009 0.04918 0.00177221 0.0533464 0.00201991 0.0564841 0.00224248 0.0586498 0.00243931 0.0599043 0.0026099 0.0603119 0.00275389 0.0599399 0.002871 0.0588585 0.00296108 0.0571399 0.00302409 0.0548579 0.00306012 0.0520877 0.00306936 0.00305212 0.0136036 0.000429888 0.0257596 0.00126891 0.0364806 0.00206471 0.0457883 0.00281392 0.0537125 0.00351343 0.0602914 0.00416037 0.065571 0.00475214 0.0696044 0.00528642 0.0724517 0.00576118 0.074179 0.00617469 0.0748582 0.00652555 0.0745664 0.00681266 0.073385 0.00703523 0.0713992 0.00719283 0.0686973 0.00728533 0.0653701 0.00731293 0.00727618 0.0158228 0.000729364 0.0300727 0.00215795 0.04274 0.00352252 0.0538272 0.00481578 0.0633485 0.00603089 0.0713299 0.00716144 0.0778083 0.00820155 0.0828312 0.00914587 0.0864563 0.00998965 0.0887505 0.0107287 0.0897893 0.0113595 0.089656 0.0118792 0.088441 0.0122854 0.0862409 0.0125768 0.0831573 0.0127524 0.0792962 0.0128119 0.0127561 0.0178693 0.00107355 0.0341113 0.00318541 0.048682 0.00521992 0.061554 0.00716353 0.0727156 0.00900338 0.0821707 0.0107273 0.0899387 0.012324 0.0960535 0.013783 0.100564 0.0150949 0.10353 0.0162513 0.105028 0.0172448 0.105143 0.0180692 0.103971 0.0187196 0.101617 0.0191923 0.0981955 0.0194846 0.0938272 0.0195954 0.0195248 0.019688 0.00144933 0.0377778 0.00431545 0.0541789 0.00710496 0.0688214 0.00979516 0.0816557 0.0123642 0.0926526 0.0147911 0.101804 0.0170563 0.10912 0.0191414 0.114632 0.0210294 0.118389 0.0227053 0.120458 0.0241555 0.120922 0.0253684 0.119879 0.0263343 0.117442 0.0270457 0.113734 0.0274971 0.10889 0.027685 0.0276083 0.0212159 0.00184026 0.0409599 0.00550271 0.0590814 0.00911114 0.0754545 0.0126301 0.0899785 0.0160251 0.102579 0.0192626 0.113206 0.0223109 0.121839 0.0251399 0.12848 0.0277217 0.133156 0.0300309 0.135921 0.0320445 0.136848 0.0337425 0.136033 0.0351079 0.133592 0.036127 0.129656 0.0367893 0.124374 0.0370879 0.0370192 0.0223843 0.00222631 0.0435331 0.00669157 0.063222 0.0111559 0.0812546 0.015567 0.0974651 0.0198734 0.111719 0.0240246 0.123914 0.0279717 0.133981 0.0316685 0.141884 0.0350713 0.14762 0.0381398 0.151218 0.0408374 0.152735 0.0431316 0.152259 0.0449946 0.149904 0.0464032 0.145808 0.0473395 0.140131 0.0477908 0.0477496 0.0231211 0.00258388 0.0453648 0.00781591 0.0664195 0.0131399 0.0860044 0.0184825 0.103873 0.0237703 0.119816 0.0289302 0.133663 0.0338911 0.145283 0.0385843 0.15459 0.0429446 0.161535 0.0469111 0.166114 0.050428 0.16836 0.0534452 0.168345 0.0559191 0.166178 0.0578133 0.161998 0.0590985 0.155976 0.0597536 0.0597655 0.0233536 0.00288601 0.046319 0.00879956 0.0684857 0.0149474 0.0894748 0.021231 0.108944 0.0275496 0.126593 0.033802 0.142166 0.0398878 0.155458 0.0457092 0.166312 0.0511722 0.174625 0.0561882 0.180344 0.060675 0.183469 0.0645585 0.184049 0.0677733 0.18218 0.070264 0.178 0.0719858 0.171689 0.0729054 0.0730013 0.0230122 0.00310287 0.0462624 0.00955754 0.0692327 0.0164478 0.0914335 0.023646 0.112412 0.0310194 0.131761 0.0384319 0.149124 0.045747 0.164199 0.0528293 0.176747 0.0595477 0.186591 0.065777 0.19362 0.0714002 0.197786 0.0763106 0.199104 0.0804133 0.197653 0.0836273 0.193564 0.0858865 0.187025 0.0871406 0.0873568 0.022034 0.00320255 0.045071 0.00999799 0.0684811 0.0174976 0.091655 0.0255427 0.114016 0.0339638 0.135034 0.0425838 0.154231 0.0512219 0.171195 0.0596964 0.185582 0.0678288 0.197127 0.0754469 0.205641 0.0823885 0.211017 0.0885038 0.213226 0.0936593 0.212319 0.0977395 0.208418 0.10065 0.201716 0.102317 0.102694 0.0203665 0.00315214 0.0426367 0.010025 0.0660694 0.017945 0.0899302 0.0267223 0.113508 0.0361475 0.136134 0.045997 0.157192 0.0560373 0.176139 0.0660306 0.192508 0.0757395 0.205924 0.0849326 0.216104 0.0933896 0.222865 0.100906 0.226124 0.107296 0.225893 0.112402 0.222281 0.116089 0.215481 0.118257 0.118837 0.0179723 0.00291903 0.0388744 0.00954194 0.0618629 0.0176339 0.0860777 0.0269769 0.110667 0.0373211 0.134808 0.0483916 0.157733 0.0598947 0.178744 0.0715253 0.197231 0.0829749 0.212686 0.0939384 0.224716 0.104122 0.233043 0.113252 0.237513 0.121078 0.238094 0.127383 0.23487 0.131985 0.228037 0.134746 0.135571 0.0148321 0.00247245 0.0337289 0.00845587 0.0557622 0.0164102 0.079954 0.026097 0.105308 0.0372286 0.130841 0.0494762 0.155612 0.062479 0.178751 0.0758542 0.199483 0.0892074 0.217145 0.102144 0.231206 0.11428 0.24128 0.125253 0.247125 0.134731 0.24865 0.142423 0.245914 0.148088 0.239108 0.151538 0.152647 0.0109483 0.00178523 0.0271805 0.00668196 0.0477123 0.0141281 0.0714629 0.0238786 0.0972962 0.0356151 0.124061 0.0489559 0.150633 0.0634675 0.175947 0.0786786 0.199038 0.0940943 0.219065 0.109212 0.235339 0.123537 0.247338 0.136597 0.254718 0.14796 0.257319 0.157241 0.255161 0.164123 0.248438 0.168359 0.169785 0.00634781 0.0192506 0.0377084 0.0605642 0.0865539 0.114358 0.142655 0.170169 0.19572 0.218263 0.236923 0.25102 0.26009 0.263888 0.262394 0.255797 -0.251331 -0.0708289 0.236099 -0.25701 -0.0340872 -0.252042 0.00394853 -0.236227 0.0393887 -0.210284 0.0683351 -0.175751 0.0872933 -0.134802 0.0935199 -0.090023 0.085265 -0.0441775 0.0619028 -1.93065e-09 0.0239637 0.0399791 -0.0269101 0.07358 -0.0880642 0.0991022 -0.155981 0.115439 -0.226487 0.122171 -0.295021 0.119625 -0.356985 0.108864 -0.408144 0.0915966 -0.445039 0.0700021 -0.465359 -0.468188 0.0464788 -0.248041 -0.0630257 0.234211 -0.252647 -0.0285328 -0.247053 0.00676348 -0.231098 0.0393589 -0.205467 0.0657562 -0.171611 0.0828194 -0.131588 0.0880786 -0.0878703 0.0799534 -0.0431216 0.057882 -1.86247e-09 0.0223632 0.0390237 -0.0250769 0.0718214 -0.0819787 0.0967414 -0.145096 0.112722 -0.210602 0.119376 -0.274346 0.117031 -0.332174 0.106713 -0.380279 0.0900463 -0.415556 0.0690903 -0.4359 -0.440419 0.0461112 -0.243083 -0.0550312 0.230652 -0.24665 -0.0230092 -0.240494 0.00938848 -0.224498 0.0390318 -0.199323 0.062813 -0.166334 0.0779485 -0.127481 0.0822447 -0.0851068 0.0742977 -0.0417614 0.0536169 -1.78046e-09 0.02067 0.037793 -0.0231422 0.0695634 -0.0755713 0.093723 -0.133663 0.109259 -0.193953 0.115809 -0.252705 0.113693 -0.306199 0.103884 -0.351039 0.087913 -0.384446 0.0677133 -0.404515 -0.410377 0.0454145 -0.236525 -0.0470008 0.225482 -0.239099 -0.0176194 -0.232455 0.0117733 -0.216527 0.0384081 -0.19195 0.0595524 -0.160017 0.0727651 -0.122558 0.0761247 -0.0817898 0.0684056 -0.0401261 0.0491911 -1.68631e-09 0.0189176 0.0363133 -0.0211442 0.0668529 -0.0689677 0.0901057 -0.121901 0.105111 -0.176847 0.111528 -0.23048 0.109659 -0.279505 0.100415 -0.320911 0.0852253 -0.352233 0.0658905 -0.371749 -0.378624 0.0444003 -0.22846 -0.0390857 0.218782 -0.230094 -0.0124606 -0.223047 0.0138733 -0.207297 0.0374931 -0.183463 0.0560241 -0.152761 0.0673531 -0.116908 0.0698221 -0.0779803 0.0623804 -0.0382469 0.044684 -1.5818e-09 0.017138 0.0346128 -0.0191195 0.0637397 -0.0622865 0.0859527 -0.110016 0.100347 -0.159574 0.106599 -0.20804 0.104988 -0.252521 0.0963545 -0.290378 0.0820192 -0.319434 0.0636472 -0.338149 -0.345727 0.0430844 -0.218998 -0.0314286 0.210653 -0.219757 -0.0076224 -0.212396 0.0156506 -0.196939 0.0362969 -0.173985 0.0522793 -0.14468 0.0617951 -0.110622 0.0634364 -0.0737429 0.0563193 -0.0361564 0.0401699 -1.46877e-09 0.0153608 0.0327211 -0.0171016 0.0602765 -0.0556379 0.0813318 -0.0981996 0.0950396 -0.14241 0.101094 -0.185732 0.099744 -0.22566 0.0917562 -0.259901 0.0783375 -0.286556 0.0610143 -0.304255 -0.31225 0.0414866 -0.208271 -0.0241615 0.201216 -0.208226 -0.00318475 -0.200645 0.017075 -0.185593 0.0348339 -0.163652 0.0483706 -0.135893 0.0561711 -0.103796 0.0570613 -0.0691449 0.0503132 -0.0338886 0.0357174 -1.34911e-09 0.0136132 0.0306689 -0.0151214 0.0565185 -0.0491225 0.0763141 -0.0866293 0.0892684 -0.125605 0.0950916 -0.163879 0.0939995 -0.199307 0.0866819 -0.229922 0.0742295 -0.254083 0.0580283 -0.270586 -0.278739 0.0396305 -0.196426 -0.0174025 0.190608 -0.195655 0.000783931 -0.18795 0.0181244 -0.173412 0.0331234 -0.152606 0.0443505 -0.126525 0.0505574 -0.0965313 0.050784 -0.0642556 0.044445 -0.0314782 0.0313882 -1.22475e-09 0.0119195 0.0284875 -0.0132064 0.0525223 -0.0428304 0.0709733 -0.0754634 0.0831156 -0.109387 0.0886743 -0.142774 0.087832 -0.173815 0.0811991 -0.200846 0.0697501 -0.222467 0.0547302 -0.237634 -0.245717 0.0375434 -0.183626 -0.0112534 0.178982 -0.182212 0.00422811 -0.174479 0.0187858 -0.160561 0.0311889 -0.140997 0.0402717 -0.116707 0.045026 -0.0889306 0.0446844 -0.0591458 0.0387891 -0.0289605 0.0272373 -1.09759e-09 0.0103012 0.0262091 -0.0113809 0.0483458 -0.0368406 0.0653854 -0.0648409 0.0766665 -0.0939582 0.0819297 -0.122678 0.0813238 -0.149501 0.0753807 -0.173042 0.0649593 -0.192124 0.0511653 -0.205854 -0.213668 0.0352552 -0.170046 -0.00579793 0.166505 -0.168077 0.00710642 -0.160411 0.0190554 -0.147208 0.029058 -0.128981 0.0361857 -0.106571 0.0396433 -0.0810988 0.0388339 -0.0538868 0.0334106 -0.026371 0.0233121 -9.69559e-10 0.00877657 0.0238656 -0.00966534 0.0440472 -0.0312201 0.0596273 -0.0548802 0.0700087 -0.0794888 0.0749478 -0.103816 0.0745612 -0.126642 0.0693036 -0.146834 0.0599211 -0.163421 0.0473827 -0.175652 -0.183034 0.032799 -0.155873 -0.00109949 0.153356 -0.153438 0.00939259 -0.14593 0.018939 -0.133528 0.0267622 -0.116715 0.0321422 -0.0962532 0.0344698 -0.0731411 0.0332948 -0.04855 0.0283651 -0.023745 0.0196521 -8.42536e-10 0.00736079 0.0214891 -0.00807657 0.0396849 -0.0260236 0.0537765 -0.0456777 0.0632308 -0.0661202 0.0678209 -0.0863745 0.067633 -0.105469 0.063048 -0.122497 0.0547029 -0.136675 0.0434342 -0.147383 -0.154202 0.0302096 -0.141301 0.00279978 0.139719 -0.138492 0.0110761 -0.131228 0.0184521 -0.119702 0.0243366 -0.104361 0.0281891 -0.0858878 0.029559 -0.0651623 0.02812 -0.043206 0.0236979 -0.0211175 0.0162888 -7.18359e-10 0.00606566 0.0191112 -0.00662759 0.0353166 -0.0212932 0.0479101 -0.0373081 0.0564215 -0.0539616 0.060642 -0.0704981 0.0606298 -0.0861639 0.0566962 -0.100252 0.0493746 -0.112144 0.0393741 -0.121344 -0.127502 0.0275239 -0.126529 0.00588006 0.125789 -0.123437 0.0121626 -0.116497 0.0176197 -0.105907 0.0218191 -0.0920769 0.0243714 -0.0756088 0.0249573 -0.0572654 0.0233521 -0.037924 0.0194439 -0.0185225 0.0132457 -5.98803e-10 0.0048997 0.0167627 -0.00532758 0.0309991 -0.0170582 0.0421039 -0.0298232 0.0496689 -0.0430896 0.0535039 -0.0562911 0.0536425 -0.0688608 0.0503317 -0.080264 0.0440073 -0.090028 0.035258 -0.0977661 -0.103197 0.02478 -0.111759 0.00814421 0.111761 -0.108475 0.0126737 -0.101931 0.016476 -0.092323 0.0192503 -0.080021 0.0207306 -0.0655472 0.0207034 -0.0495509 0.0190239 -0.0327711 0.0156276 -0.015993 0.0105379 -4.8556e-10 0.00386814 0.0144735 -0.00418194 0.026787 -0.0133355 0.0364317 -0.0232526 0.043059 -0.0335486 0.0464982 -0.043815 0.0467618 -0.0536417 0.044038 -0.0626396 0.038673 -0.0704603 0.0311423 -0.0768141 -0.0814826 0.0220165 -0.0971943 0.00961776 0.0978317 -0.0938061 0.0126468 -0.087719 0.0150637 -0.0791242 0.0166728 -0.0683465 0.0173048 -0.0558299 0.0168279 -0.0421155 0.0151575 -0.0278118 0.0122631 -0.0135605 0.00817263 -3.80227e-10 0.00297298 0.0122722 -0.00319236 0.0227332 -0.0101296 0.0309647 -0.0176038 0.0366752 -0.0253506 0.039714 -0.0330894 0.0400761 -0.040538 0.0378977 -0.0474265 0.0334429 -0.0535107 0.0270834 -0.0585832 -0.0624827 0.0192723 -0.083033 0.0103484 0.0841974 -0.0796257 0.0121345 -0.0740484 0.0134338 -0.0664802 0.0141305 -0.0572009 0.0141277 -0.0465783 0.0133532 -0.0350513 0.0117649 -0.023107 0.00935445 -0.011255 0.00614941 -2.84289e-10 0.00221314 0.0101856 -0.00235694 0.0188874 -0.00743315 0.0257707 -0.0128631 0.0305974 -0.0184764 0.0332372 -0.0240928 0.0336715 -0.0295304 0.031991 -0.034614 0.0283869 -0.0391831 0.0231369 -0.0430986 -0.0462486 0.0165861 -0.0694691 0.0104049 0.0710485 -0.0661233 0.0112035 -0.061097 0.0116443 -0.0545528 0.0116683 -0.0467242 0.0112288 -0.0379069 0.0102937 -0.0284448 0.00884799 -0.0187139 0.00689569 -0.0091042 0.00446026 -1.99104e-10 0.00158455 0.00823917 -0.00167041 0.0152965 -0.00522746 0.0209132 -0.00899628 0.0249009 -0.0128769 0.0271492 -0.016764 0.0276299 -0.0205508 0.0263951 -0.024134 0.0235727 -0.0274175 0.0193568 -0.0303161 -0.032759 0.0139954 -0.0566879 0.00987618 0.0585688 -0.0534793 0.00993365 -0.0490339 0.00975943 -0.0434939 0.00933113 -0.0370475 0.00863272 -0.0299223 0.00765553 -0.0223759 0.00639912 -0.0146852 0.00487168 -0.00713378 0.00309024 -1.25893e-10 0.00108039 0.00645594 -0.00112434 0.0120033 -0.00348337 0.0164511 -0.00595046 0.0196555 -0.00847512 0.0215262 -0.0110044 0.0220283 -0.0134847 0.0211831 -0.0158637 0.0190646 -0.0180918 0.015795 -0.0201243 -0.0219221 0.0115367 -0.0448642 0.00886877 0.0469325 -0.0418623 0.00841588 -0.0380162 0.00784858 -0.0334443 0.00716337 -0.028291 0.00635909 -0.0227217 0.00543709 -0.0169175 0.00440135 -0.0110685 0.00325854 -0.00536688 0.00201794 -6.57267e-11 0.000691287 0.00485691 -0.000707376 0.00904705 -0.00216206 0.0124378 -0.00365518 0.0149253 -0.00516796 0.0164379 -0.00668092 0.0169381 -0.00817435 0.0164228 -0.00962883 0.0149228 -0.0110257 0.0125 -0.0123475 -0.0135783 0.00924414 -0.0341595 0.0363018 -0.0314276 -0.0281872 -0.0245314 -0.0205629 -0.0163921 -0.0121342 -0.00790605 -0.00382396 -1.95142e-11 0.00346059 0.00646213 0.00892094 0.0107674 0.0119474 0.0124237 0.0121764 0.0112027 0.00951706 0.00714984 0.0182757 0.00370164 0.0276686 0.0048554 0.0395324 0.00612548 0.0539835 0.00749272 0.0710699 0.00893646 0.0907686 0.0104348 0.112985 0.0119648 0.137551 0.0135032 0.16423 0.0150262 0.192719 0.0165102 0.222651 0.017932 0.253605 0.0192693 0.285109 0.0205009 0.316652 0.0216067 0.347692 0.0225686 0.377664 0.0233703 0.405996 0.0239979 0.432115 0.0244395 0.455461 0.0246862 0.0247315 0.0167035 0.000767311 0.0256261 0.00101974 0.036979 0.001299 0.0508791 0.00160056 0.0673704 0.0019195 0.0864218 0.00225055 0.107925 0.00258824 0.131695 0.00292688 0.157471 0.00326077 0.184922 0.00358418 0.213651 0.00389151 0.243199 0.00417737 0.273057 0.00443663 0.302673 0.00466454 0.331463 0.00485676 0.358821 0.00500949 0.384132 0.00511944 0.406786 0.00518396 0.426186 0.00520104 0.00516932 0.0150037 -0.00159461 0.0232695 -0.00214204 0.0338481 -0.00274973 0.0468507 -0.0034073 0.0623146 -0.00410345 0.0802 -0.00482611 0.100388 -0.00556263 0.12268 -0.00629998 0.146803 -0.00702492 0.172407 -0.0077242 0.199075 -0.0083848 0.226329 -0.00899407 0.253638 -0.00953995 0.280427 -0.0100112 0.306087 -0.0103974 0.329991 -0.0106893 0.351501 -0.0108791 0.369986 -0.01096 0.384832 -0.010927 -0.0107766 0.0131914 -0.00333765 0.0206333 -0.00452767 0.0301991 -0.00585308 0.0419897 -0.00729001 0.0560335 -0.00881229 0.0722838 -0.0103919 0.0906158 -0.0119992 0.110827 -0.0136039 0.132641 -0.0151748 0.155704 -0.0166808 0.1796 -0.0180914 0.203849 -0.0193768 0.22792 -0.0205087 0.251238 -0.0214606 0.273198 -0.0222082 0.293172 -0.02273 0.310529 -0.0230075 0.324639 -0.0230254 0.334896 -0.022772 -0.0222396 0.0112838 -0.00442881 0.0177589 -0.00605744 0.0261069 -0.00787621 0.0364144 -0.00985086 0.0487009 -0.0119436 0.0629156 -0.014114 0.0789349 -0.0163191 0.0965628 -0.0185145 0.115532 -0.020655 0.135506 -0.0226953 0.156086 -0.0245905 0.176816 -0.0262972 0.19719 -0.0277738 0.216663 -0.0289817 0.23466 -0.0298852 0.250586 -0.030453 0.263842 -0.0306579 0.273834 -0.0304778 0.279988 -0.029896 -0.0289015 0.00930021 -0.00484964 0.0146938 -0.00667757 0.0216592 -0.00872321 0.0302663 -0.0109466 0.0405264 -0.0133035 0.0523889 -0.0157463 0.0657391 -0.0182245 0.0803982 -0.0206858 0.0961245 -0.0230766 0.112616 -0.0253433 0.129514 -0.0274327 0.14641 -0.0292932 0.162851 -0.0308756 0.17835 -0.0321339 0.192392 -0.0330258 0.204448 -0.0335141 0.213983 -0.0335666 0.220468 -0.0331572 0.223393 -0.0322665 -0.0308816 0.00726102 -0.00459698 0.0114903 -0.00636261 0.0169541 -0.0083417 0.0237048 -0.0104945 0.0317472 -0.0127767 0.0410355 -0.0151408 0.0514717 -0.0175361 0.0629054 -0.01991 0.0751348 -0.0222087 0.0879086 -0.024378 0.100929 -0.0263644 0.113859 -0.0281159 0.126322 -0.0295827 0.137916 -0.0307183 0.148217 -0.0314801 0.156786 -0.0318304 0.163184 -0.0317369 0.166976 -0.0311734 0.167743 -0.0301205 -0.0285656 0.00518774 -0.00368329 0.00820381 -0.00511688 0.0120967 -0.0067256 0.0169016 -0.00847641 0.022619 -0.0103326 0.0292123 -0.0122545 0.0366071 -0.0141998 0.0446906 -0.0161246 0.0533125 -0.0179839 0.0622862 -0.0197325 0.0713916 -0.0213254 0.0803782 -0.022719 0.0889697 -0.0238717 0.0968686 -0.0247444 0.103762 -0.0253015 0.109328 -0.0255114 0.113243 -0.0253469 0.115188 -0.0247863 0.114856 -0.0238134 -0.022418 0.0031024 -0.0021366 0.00489155 -0.00297478 0.00719578 -0.00391598 0.0100344 -0.00494064 0.0134059 -0.00602699 0.0172868 -0.00715142 0.0216311 -0.00828886 0.0263698 -0.00941318 0.0314114 -0.0104976 0.0366431 -0.0115151 0.0419317 -0.0124391 0.0471262 -0.0132434 0.0520601 -0.0139033 0.0565545 -0.0143956 0.0604213 -0.0146988 0.0634673 -0.0147943 0.0654982 -0.0146659 0.0663229 -0.0143006 0.065758 -0.0136889 -0.0128248 0.00102709 -6.41692e-12 0.00161091 -2.14781e-11 0.00236016 -4.07541e-11 0.00328054 -6.37219e-11 0.00437105 -8.97754e-11 0.0056236 -1.18236e-10 0.00702281 -1.48363e-10 0.00854591 -1.79368e-10 0.0101629 -2.10428e-10 0.011837 -2.40697e-10 0.0135247 -2.69323e-10 0.0151769 -2.95461e-10 0.0167396 -3.1829e-10 0.0181546 -3.37025e-10 0.0193611 -3.50931e-10 0.0202965 -3.59339e-10 0.0208981 -3.61657e-10 0.021104 -3.57382e-10 0.0208553 -3.46109e-10 -3.27542e-10 -0.00101651 0.0026692 -0.00158225 0.00371635 -0.00230476 0.00489221 -0.0031889 0.00617233 -0.00423323 0.00752952 -0.00542965 0.00893428 -0.00676319 0.0103553 -0.00821199 0.0117599 -0.00974742 0.0131146 -0.0113344 0.0143857 -0.0129317 0.0155399 -0.0144929 0.0165447 -0.0159669 0.017369 -0.017299 0.0179837 -0.0184316 0.0183624 -0.0193059 0.0184814 -0.0198629 0.0183208 -0.0200446 0.0178642 -0.0197956 0.0170999 0.0160202 -0.00300755 0.0058008 -0.00463506 0.00805866 -0.00670037 0.0105924 -0.00921537 0.0133499 -0.0121746 0.0162734 -0.0155545 0.0193003 -0.0193125 0.0223641 -0.0233876 0.0253955 -0.0277 0.0283237 -0.0321527 0.0310773 -0.0366322 0.0335856 -0.0410105 0.03578 -0.0451472 0.0375948 -0.0488923 0.0389684 -0.0520885 0.0398449 -0.054575 0.0401744 -0.0561905 0.0399145 -0.0567769 0.0390307 -0.0561833 0.0374977 0.0352995 -0.00492651 0.00931327 -0.00749912 0.0128906 -0.0107379 0.0169005 -0.014658 0.0212623 -0.0192488 0.0258866 -0.024473 0.0306765 -0.0302655 0.0355296 -0.0365341 0.0403391 -0.0431595 0.0449959 -0.0499968 0.0493905 -0.0568778 0.0534141 -0.0636131 0.0569614 -0.0699956 0.0599315 -0.0758042 0.0622302 -0.0808079 0.0637714 -0.0847707 0.0644788 -0.0874562 0.064287 -0.088633 0.0631431 -0.0880804 0.0610078 0.0578559 -0.00675549 0.0131157 -0.0101317 0.0180598 -0.0143413 0.0235929 -0.0193985 0.0296068 -0.0252868 0.035982 -0.0319576 0.0425893 -0.0393298 0.0492922 -0.0472894 0.055949 -0.0556911 0.0624147 -0.0643595 0.068544 -0.0730915 0.0741933 -0.08166 0.0792228 -0.089817 0.0834993 -0.0972987 0.0868985 -0.10383 0.0893064 -0.109131 0.0906221 -0.11292 0.0907591 -0.114925 0.0896472 -0.114883 0.0872338 0.0834847 -0.00847863 0.0171099 -0.0124969 0.0234028 -0.017449 0.0304307 -0.0233445 0.038061 -0.0301602 0.0461479 -0.0378393 0.0545343 -0.0462906 0.0630546 -0.0553891 0.0715369 -0.064977 0.0798063 -0.0748656 0.0876872 -0.0848381 0.0950064 -0.0946529 0.101596 -0.104048 0.107295 -0.112744 0.111955 -0.120454 0.115438 -0.126882 0.117622 -0.131736 0.118405 -0.134731 0.1177 -0.135594 0.115443 0.111593 -0.0100823 0.0211927 -0.0145663 0.0287509 -0.020016 0.0371694 -0.0264326 0.0462967 -0.0337857 0.0559661 -0.0420129 0.0659992 -0.051019 0.0762081 -0.0606772 0.0863986 -0.0708297 0.0963731 -0.0812905 0.105934 -0.0918474 0.114886 -0.102266 0.123041 -0.112293 0.130218 -0.121661 0.136249 -0.130094 0.140981 -0.137313 0.144278 -0.143039 0.146022 -0.147003 0.146117 -0.148947 0.144491 0.141094 -0.0115555 0.0252585 -0.0163197 0.0339354 -0.0220145 0.0435689 -0.0286297 0.053994 -0.0361273 0.0650309 -0.0444412 0.0764874 -0.0534772 0.088162 -0.063114 0.0998467 -0.0732042 0.111331 -0.0835767 0.122403 -0.0940391 0.132856 -0.104381 0.142489 -0.114376 0.15111 -0.123788 0.158542 -0.132376 0.164621 -0.139895 0.169201 -0.146103 0.172159 -0.150768 0.17339 -0.153669 0.172818 0.170388 -0.0128897 0.0292013 -0.017745 0.0387938 -0.0234343 0.0494021 -0.0299334 0.0608552 -0.0371965 0.0729677 -0.0451553 0.0855422 -0.0537199 0.0983724 -0.0627797 0.111246 -0.0722047 0.123948 -0.0818472 0.136264 -0.0915445 0.147983 -0.101121 0.158901 -0.110391 0.168825 -0.119162 0.177572 -0.12724 0.184978 -0.13443 0.190895 -0.14054 0.195194 -0.14539 0.197772 -0.148806 0.198546 0.19746 -0.0140792 0.0329176 -0.0188388 0.0431744 -0.0242825 0.0544643 -0.0303713 0.0666175 -0.0370512 0.0794506 -0.0442528 0.092769 -0.0518925 0.10637 -0.0598732 0.120047 -0.0680859 0.133589 -0.0764111 0.146787 -0.0847203 0.159435 -0.0928785 0.171336 -0.100746 0.182299 -0.108181 0.192148 -0.115042 0.200721 -0.12119 0.207873 -0.126491 0.213479 -0.130819 0.217434 -0.134058 0.219655 0.220086 -0.015121 0.0363082 -0.0196055 0.0469416 -0.0245825 0.0585811 -0.0299985 0.0710644 -0.0357918 0.0842171 -0.0418927 0.0978553 -0.0482246 0.111788 -0.0547051 0.12582 -0.0612469 0.139753 -0.0677593 0.153392 -0.0741491 0.166543 -0.0803223 0.17902 -0.0861855 0.190645 -0.0916471 0.201251 -0.0966188 0.210686 -0.101017 0.218811 -0.104765 0.225506 -0.107791 0.23067 -0.110036 0.234222 0.236103 0.00951138 -0.0135806 -0.00714346 0.0111978 -0.0123497 0.0121724 -0.0110278 0.0124206 -0.00963082 0.0119451 -0.00817615 0.0107659 -0.00668247 0.00892006 -0.00516922 0.00646172 -0.00365611 0.00346048 -0.00216263 -1.95142e-11 -0.000707568 -0.00382406 0.000691479 -0.00790646 0.00201851 -0.012135 0.00325947 -0.0163937 0.00440262 -0.0205652 0.00543864 -0.0245345 0.00636089 -0.0281912 0.00716537 -0.0314324 0.00785072 -0.0341652 0.0084181 0.00887101 0.0124917 -0.0219251 -0.009235 0.0149155 -0.0201275 0.0164167 -0.0180951 0.0169332 -0.015867 0.0164343 -0.0134878 0.0149229 -0.0110071 0.0124364 -0.00847739 0.0090464 -0.00595216 0.00485674 -0.00348443 -6.57267e-11 -0.00112469 -0.00536705 0.00108074 -0.0110691 0.0030913 -0.0169189 0.00487339 -0.0227241 0.00640139 -0.0282946 0.00765827 -0.0334492 0.00863578 -0.0380223 0.0093344 -0.0418696 0.00976275 -0.0448725 0.00993689 0.00987921 0.0157834 -0.0327629 -0.0115243 0.0190543 -0.0303206 0.0211743 -0.0274223 0.0220212 -0.024139 0.0215209 -0.0205557 0.0196519 -0.0167684 0.0164489 -0.0128807 0.0120024 -0.00899913 0.00645569 -0.00522925 -1.25894e-10 -0.00167102 -0.00713403 0.00158516 -0.0146862 0.00446205 -0.0223781 0.00689854 -0.0299259 0.00885174 -0.0370528 0.0102981 -0.043501 0.0112337 -0.0490427 0.0116733 -0.0534896 0.0116491 -0.0566994 0.011208 0.0104088 0.0193417 -0.0462533 -0.0139795 0.023559 -0.0431045 0.0263832 -0.0391898 0.0276202 -0.0346212 0.0271419 -0.0295376 0.0248959 -0.0240995 0.0209102 -0.0184822 0.0152951 -0.0128675 0.00823882 -0.00743595 -1.99104e-10 -0.0023579 -0.00910455 0.0022141 -0.0187153 0.00615221 -0.0284478 0.0093589 -0.0379119 0.0117707 -0.0467315 0.0133599 -0.0545624 0.0141349 -0.0611089 0.0141377 -0.0661371 0.0134405 -0.0694842 0.0121403 0.010353 0.0231178 -0.0624881 -0.0165664 0.0283694 -0.0585906 0.0319757 -0.0535196 0.0336589 -0.0474364 0.0332277 -0.0405482 0.0305908 -0.0330991 0.0257667 -0.025359 0.0188856 -0.0176104 0.0101852 -0.0101338 -2.84289e-10 -0.00319378 -0.0112555 0.00297441 -0.0231088 0.00817679 -0.0350553 0.0122697 -0.0465849 0.0151659 -0.0572105 0.0168376 -0.0664928 0.0173149 -0.0740637 0.0166827 -0.0796432 0.0150726 -0.0830521 0.0126541 0.00962312 0.0270603 -0.0814884 -0.0192487 0.0334214 -0.0768231 0.0378787 -0.0704718 0.0400604 -0.0626527 0.0397019 -0.0536555 0.0366668 -0.0438283 0.0309597 -0.0335604 0.0227308 -0.0232619 0.0122716 -0.0133414 -3.80228e-10 -0.00418397 -0.0135611 0.00387016 -0.0278141 0.0105438 -0.0421205 0.0156369 -0.0558383 0.0190357 -0.0683586 0.0207168 -0.07914 0.0207444 -0.087738 0.0192635 -0.0938276 0.0164874 -0.0972173 0.0126826 0.0081501 0.0311152 -0.103203 -0.0219891 0.0386475 -0.0977767 0.0440153 -0.0900422 0.0467428 -0.0802809 0.0464835 -0.0688789 0.0430487 -0.0563089 0.0364255 -0.0431056 0.0267842 -0.0298358 0.0144728 -0.0170662 -4.8556e-10 -0.00533035 -0.0159937 0.00490247 -0.032774 0.0132537 -0.0495571 0.0194565 -0.0655575 0.0233681 -0.0800358 0.0249751 -0.092342 0.0243895 -0.101953 0.021836 -0.108501 0.017634 -0.111786 0.0121731 0.00588619 0.0352271 -0.127508 -0.0247492 0.0439779 -0.121356 0.0503052 -0.112161 0.0536202 -0.100273 0.0534866 -0.086187 0.0496567 -0.0705211 0.0420965 -0.0539823 0.0309956 -0.0373246 0.0167618 -0.0213038 -5.98803e-10 -0.00663125 -0.0185234 0.00606932 -0.0379274 0.0162995 -0.0572728 0.0237144 -0.075621 0.0281407 -0.0920943 0.029582 -0.105929 0.0282122 -0.116523 0.0243576 -0.123466 0.0184693 -0.126559 0.0110881 0.00280578 0.0393399 -0.154208 -0.0274902 0.0493416 -0.147396 0.0566662 -0.136695 0.0606043 -0.122523 0.0606221 -0.105497 0.0564075 -0.0864034 0.0479016 -0.0661465 0.0353127 -0.0456988 0.0191102 -0.0260372 -7.18359e-10 -0.00808126 -0.0211185 0.00736548 -0.04321 0.0196657 -0.0651708 0.0283861 -0.0859019 0.0333211 -0.104381 0.0344986 -0.119727 0.0321708 -0.131258 0.0267877 -0.138525 0.0189592 -0.141335 0.00940584 -0.00109406 0.0433972 -0.183038 -0.0301737 0.0546669 -0.175666 0.063015 -0.163444 0.0676047 -0.146864 0.0677986 -0.126677 0.063215 -0.103852 0.0537669 -0.0795212 0.0396804 -0.0549063 0.0214879 -0.031237 -8.42536e-10 -0.0096712 -0.0237462 0.00878243 -0.0485545 0.023329 -0.0731507 0.0334367 -0.096269 0.0388663 -0.116738 0.0396786 -0.133557 0.0362202 -0.145963 0.0290882 -0.153474 0.0190786 -0.15591 0.00712065 -0.00579358 0.0473437 -0.213671 -0.0327617 0.0598827 -0.205868 0.0692681 -0.19215 0.0745306 -0.173077 0.0749235 -0.149542 0.0699914 -0.122721 0.0596167 -0.0939974 0.0440422 -0.0648726 0.0238643 -0.0368612 -9.69559e-10 -0.011388 -0.0263723 0.0103083 -0.0538918 0.0272579 -0.0811094 0.0388208 -0.106588 0.0447236 -0.129005 0.0450683 -0.147238 0.0403126 -0.160446 0.031224 -0.168115 0.0188119 -0.170085 0.00424293 -0.0112507 0.0511253 -0.245717 -0.0352175 0.0649194 -0.237649 0.0753435 -0.222496 0.0812914 -0.200886 0.0819038 -0.173862 0.076648 -0.142824 0.065374 -0.109434 0.0483404 -0.0755011 0.0262077 -0.042855 -1.09759e-09 -0.0132149 -0.0289619 0.011928 -0.0591511 0.0314127 -0.0889419 0.0444827 -0.116725 0.0508304 -0.141023 0.0506071 -0.160593 0.044398 -0.174516 0.0331634 -0.182252 0.0181532 -0.183666 0.000798879 -0.0174021 0.0546902 -0.278736 -0.0375063 0.0697097 -0.2706 0.081161 -0.254114 0.0877986 -0.229967 0.0886475 -0.199361 0.0830963 -0.163936 0.0709615 -0.125659 0.0525167 -0.0866732 0.0284861 -0.0491512 -1.22475e-09 -0.0151313 -0.0314797 0.0136232 -0.0642612 0.0357461 -0.0965431 0.0503571 -0.126544 0.057115 -0.152633 0.0562283 -0.173446 0.0484246 -0.187988 0.0348787 -0.195696 0.017106 -0.196466 -0.00317022 -0.024164 0.0579895 -0.312243 -0.0395953 0.0741897 -0.304268 0.0866438 -0.286589 0.0939659 -0.259951 0.0950645 -0.225721 0.0892489 -0.185797 0.076302 -0.142471 0.0565128 -0.0982498 0.0306674 -0.0556708 -1.34912e-09 -0.017113 -0.0338901 0.0153723 -0.0691506 0.0402029 -0.103808 0.0563696 -0.135912 0.0634977 -0.163679 0.0618599 -0.185626 0.0523398 -0.200683 0.0363461 -0.208266 0.0156835 -0.20831 -0.00760887 -0.0314347 0.0609778 -0.345717 -0.0414542 0.0782994 -0.338161 0.0917193 -0.319468 0.0997111 -0.290431 0.101068 -0.252588 0.0950202 -0.208113 0.0813199 -0.159643 0.0602709 -0.110072 0.0327196 -0.0623237 -1.46877e-09 -0.0191324 -0.0361579 0.017151 -0.0737486 0.0447211 -0.110634 0.0624369 -0.144699 0.0698908 -0.174012 0.0674252 -0.196972 0.0560907 -0.212433 0.0375464 -0.219795 0.0139074 -0.219035 -0.0124487 -0.0390959 0.0636141 -0.378609 -0.043056 0.0819839 -0.371759 0.0963198 -0.352267 0.104957 -0.320968 0.106574 -0.279577 0.100328 -0.230559 0.0859412 -0.176922 0.0637342 -0.121964 0.0346114 -0.0690089 -1.5818e-09 -0.0211586 -0.0382483 0.018932 -0.0779858 0.0492323 -0.11692 0.0684682 -0.15278 0.0762004 -0.183488 0.0728442 -0.207329 0.0596247 -0.223082 0.0384648 -0.230129 0.011808 -0.228493 -0.0176097 -0.0470158 0.0658619 -0.410357 -0.0443769 0.0851939 -0.404522 0.100384 -0.384481 0.109631 -0.351098 0.111504 -0.306277 0.105094 -0.25279 0.090095 -0.194035 0.0668478 -0.133732 0.036312 -0.0756162 -1.68631e-09 -0.0231578 -0.0401274 0.0206856 -0.0817949 0.0536619 -0.122569 0.0743659 -0.160034 0.082327 -0.191974 0.078034 -0.216555 0.0628903 -0.232487 0.0390913 -0.23913 0.00942315 -0.236554 -0.0230024 -0.0550513 0.0676902 -0.440393 -0.0453969 0.0878865 -0.435904 0.103857 -0.41559 0.113668 -0.380341 0.115788 -0.332255 0.109243 -0.274437 0.0937135 -0.21069 0.0695589 -0.145169 0.0377918 -0.0820269 -1.78046e-09 -0.0250938 -0.0417625 0.0223801 -0.0851113 0.0579303 -0.12749 0.0800265 -0.16635 0.0881667 -0.199343 0.0829104 -0.224524 0.0658379 -0.240521 0.0394205 -0.246676 0.00679746 -0.243106 -0.0285294 -0.0630514 0.0690734 -0.468156 -0.0461001 0.0900255 -0.465358 0.106691 -0.445072 0.11701 -0.408207 0.119358 -0.35707 0.112709 -0.295117 0.0967334 -0.22658 0.0718176 -0.156059 0.0390228 -0.0881153 -1.86247e-09 -0.0269279 -0.0431226 0.0239816 -0.0878741 0.0619539 -0.131596 0.0853423 -0.171623 0.0936129 -0.205485 0.087389 -0.231119 0.0684201 -0.247075 0.0394515 -0.252668 0.00398116 -0.248058 -0.0340876 -0.0708602 0.0699921 -0.0464745 0.0915823 0.108847 0.119609 0.122157 0.115429 0.0990962 0.0735772 0.0399783 -1.93065e-09 -0.0441783 -0.0900259 -0.134808 -0.175761 -0.210298 -0.236243 -0.252058 -0.257024 -0.251341 -0.179616 0.208596 -0.175671 0.208983 -0.170407 0.207533 -0.163942 0.204305 -0.156404 0.199382 -0.147935 0.192868 -0.138686 0.184891 -0.128812 0.175598 -0.118476 0.165154 -0.107838 0.153738 -0.09706 0.141543 -0.0862984 0.128771 -0.075704 0.115633 -0.0654197 0.102339 -0.0555777 0.089105 -0.0462983 0.0761406 -0.0376882 0.0636517 -0.0298391 0.0518351 -0.022827 0.040876 0.0309457 -0.224884 0.168197 -0.219588 0.170711 -0.212206 0.171371 -0.202983 0.17023 -0.192182 0.167367 -0.180078 0.162885 -0.166952 0.156907 -0.153087 0.149579 -0.138764 0.141063 -0.124251 0.131538 -0.109806 0.121194 -0.0956678 0.110231 -0.0820548 0.0988556 -0.0691595 0.0872785 -0.0571472 0.0757095 -0.0461538 0.0643554 -0.0362839 0.0534171 -0.0276106 0.0430858 -0.0201747 0.0335404 0.0249449 -0.234982 0.122864 -0.230893 0.1266 -0.223966 0.128665 -0.214557 0.129103 -0.203047 0.127982 -0.189824 0.125392 -0.175283 0.121443 -0.159815 0.116263 -0.143798 0.109996 -0.127595 0.1028 -0.111541 0.0948434 -0.0959421 0.0863033 -0.0810693 0.0773623 -0.0671541 0.0682054 -0.0543858 0.0590171 -0.042909 0.0499785 -0.0328232 0.0412648 -0.0241821 0.033042 -0.0169949 0.0254645 0.018673 -0.211482 0.0793686 -0.209811 0.0830532 -0.204907 0.0854476 -0.197183 0.0865848 -0.187074 0.0865157 -0.175026 0.085308 -0.161486 0.0830453 -0.146893 0.0798251 -0.131671 0.0757572 -0.11622 0.0709616 -0.100908 0.0655671 -0.0860645 0.059708 -0.0719786 0.053523 -0.0588911 0.0471523 -0.0469933 0.0407353 -0.0364253 0.0344085 -0.0272746 0.0283036 -0.0195776 0.0225447 -0.0133208 0.0172469 0.0125144 -0.160513 0.041898 -0.160817 0.0444159 -0.158175 0.0461589 -0.152965 0.0471458 -0.145582 0.0474065 -0.13643 0.046981 -0.125914 0.045919 -0.114429 0.0442785 -0.102355 0.0421251 -0.0900462 0.0395302 -0.0778297 0.0365706 -0.0659953 0.0333263 -0.0547933 0.0298797 -0.0444307 0.0263139 -0.0350686 0.0227118 -0.0268211 0.019154 -0.0197554 0.0157182 -0.0138923 0.0124774 -0.00920868 0.00949926 0.00684455 -0.0886528 0.0120372 -0.0894536 0.012857 -0.0884269 0.0134385 -0.0858074 0.0137873 -0.0818408 0.0139124 -0.0767776 0.0138261 -0.0708678 0.0135436 -0.0643553 0.0130825 -0.0574734 0.0124631 -0.05044 0.0117072 -0.0434538 0.0108383 -0.0366909 0.00988094 -0.0303023 0.00886036 -0.0244115 0.007802 -0.0191136 0.00673113 -0.0144745 0.00567241 -0.0105308 0.00464952 -0.00729093 0.0036847 -0.00473631 0.00279851 0.00200938 4.25794e-09 -0.0101477 4.24491e-09 -0.0108389 4.15075e-09 -0.0113293 3.96287e-09 -0.0116234 3.71572e-09 -0.011729 3.42519e-09 -0.0116564 3.08303e-09 -0.0114182 2.73357e-09 -0.0110296 2.3677e-09 -0.0105074 2.00586e-09 -0.0098702 1.66279e-09 -0.00913768 1.33021e-09 -0.00833058 1.03741e-09 -0.00747015 7.74097e-10 -0.00657786 5.49098e-10 -0.00567501 3.67015e-10 -0.0047824 2.20436e-10 -0.00391999 1.13425e-10 -0.00310655 4.22826e-11 -0.0023594 -0.00169408 0.104191 -0.024688 0.104921 -0.0261725 0.10349 -0.0272004 0.100185 -0.0277828 0.0953042 -0.0279372 0.0891503 -0.0276872 0.0820254 -0.027062 0.0742227 -0.0260957 0.0660215 -0.0248271 0.0576815 -0.0232981 0.0494383 -0.0215541 0.0414994 -0.0196421 0.0340407 -0.0176109 0.0272049 -0.0155093 0.0210993 -0.0133862 0.0157956 -0.0112892 0.0113302 -0.0092641 0.00770502 -0.00735397 0.00488954 -0.00559864 -0.00403396 0.223267 -0.0307849 0.222742 -0.0322159 0.218073 -0.0331465 0.209829 -0.0335895 0.198602 -0.0335644 0.184989 -0.0330974 0.169586 -0.032221 0.152969 -0.0309728 0.135689 -0.0293954 0.118253 -0.0275354 0.101123 -0.0254428 0.0847047 -0.0231696 0.0693402 -0.0207698 0.0553054 -0.0182977 0.042806 -0.0158075 0.0319767 -0.0133523 0.0228817 -0.0109831 0.0155167 -0.00874824 0.00981244 -0.00669234 -0.00485583 0.353592 -0.0268958 0.348337 -0.0277166 0.337606 -0.0281714 0.322189 -0.02827 0.302906 -0.028027 0.280584 -0.0274621 0.256044 -0.0265993 0.230083 -0.0254664 0.203456 -0.0240951 0.176863 -0.0225199 0.150938 -0.0207777 0.126234 -0.0189073 0.103219 -0.0169488 0.0822664 -0.0149428 0.0636529 -0.0129297 0.0475544 -0.0109494 0.0340482 -0.00904015 0.0231154 -0.00723848 0.0146455 -0.00557826 -0.00409029 0.485601 -0.0118137 0.471964 -0.0119936 0.452425 -0.0120431 0.427899 -0.011966 0.399331 -0.0117676 0.367676 -0.0114551 0.333878 -0.0110369 0.29885 -0.0105234 0.263458 -0.00992589 0.228503 -0.00925687 0.19471 -0.00852979 0.162709 -0.00775878 0.13303 -0.00695843 0.106095 -0.00614361 0.0822115 -0.00532917 0.0615689 -0.00452975 0.0442416 -0.00375956 0.0301906 -0.00303212 0.0192685 -0.00236008 -0.001755 0.603371 0.0138276 0.579172 0.0138499 0.549511 0.0137507 0.515323 0.0135339 0.477572 0.013205 0.437226 0.0127712 0.395245 0.0122408 0.352551 0.0116237 0.310021 0.0109309 0.268462 0.0101742 0.228603 0.00936635 0.191077 0.00852072 0.156412 0.00765108 0.125027 0.00677146 0.0972196 0.00589591 0.0731703 0.00503832 0.0529373 0.00421222 0.0364612 0.00343057 0.0235699 0.0027056 0.00204859 0.687468 0.653268 0.614605 0.572354 0.527412 0.480675 0.433029 0.385323 0.33836 0.292881 0.249549 0.208938 0.171529 0.137693 0.107697 0.0816904 0.0597134 0.0416936 0.0274525 ) ; boundaryField { inlet { type calculated; value uniform 0; } outlet { type calculated; value uniform 0; } dymWall { type calculated; value nonuniform List<scalar> 73 ( -0.0111731 -0.0100268 -0.0088706 -0.00770564 -0.00653307 -0.00535406 -0.00416976 -0.00298134 -0.00178998 -0.000596857 0.000596857 0.00178998 0.00298134 0.00416976 0.00535406 0.00653307 0.00770564 0.0088706 0.0100268 0.0111731 0.00750525 0.00675099 0.0059849 0.00520831 0.00442258 0.0036291 0.00282926 0.00202445 0.00121609 0.000405601 -0.000405601 -0.00121609 -0.00202445 -0.00282926 -0.0036291 -0.00442258 -0.00520831 -0.0059849 -0.00675099 -0.00750525 -0.016711 -0.0139859 -0.0112281 -0.00844409 -0.00564037 -0.00282348 8.68712e-16 0.00282348 0.00564037 0.00844409 0.0112281 0.0139859 0.016711 0.00750679 0.0067524 0.00598617 0.00520942 0.00442354 0.0036299 0.00282988 0.0020249 0.00121636 0.000405691 -0.000405691 -0.00121636 -0.0020249 -0.00282988 -0.0036299 -0.00442354 -0.00520942 -0.00598617 -0.0067524 -0.00750679 ) ; } AMI1 { type cyclicAMI; value nonuniform List<scalar> 73 ( 0.0782833 0.0395658 -0.000998444 -0.0391249 -0.0705054 -0.0912868 -0.0984605 -0.0901216 -0.0655923 -0.0254362 0.0286012 0.0936964 0.166092 0.241292 0.314339 0.380186 0.434145 0.472383 0.492359 0.49314 0.475499 0.441767 0.395457 0.340722 0.281763 0.22228 0.165092 0.111959 0.0636325 0.0200968 -0.0190644 -0.0542693 -0.0855932 -0.112553 -0.134072 -0.148635 -0.154603 -0.150635 -0.136105 -0.111446 -0.493103 -0.492354 -0.472413 -0.434208 -0.380273 -0.314439 -0.241389 -0.166172 -0.0937496 -0.0286197 0.0254548 0.0656455 0.0902022 0.0985573 0.091386 0.0705929 0.0391881 0.00102912 -0.0395706 -0.0783205 0.182142 0.227869 0.235902 0.209537 0.156913 0.0858062 -4.15374e-09 -0.101032 -0.219117 -0.352626 -0.492471 -0.621219 -0.716368 ) ; } AMI2 { type cyclicAMI; value nonuniform List<scalar> 162 ( -0.0433665 -0.0346043 -0.0252437 -0.0155058 -0.00563129 0.00412688 0.0135104 0.022263 0.0301377 0.0369029 0.0423487 0.0462911 0.0485763 0.0490831 0.0477248 0.0444504 0.0392441 0.0321255 0.0231486 0.0124004 0 -0.0139034 -0.029132 -0.045481 -0.0627216 -0.0806029 -0.0988556 -0.117196 -0.13533 -0.152959 -0.169786 -0.185522 -0.199894 -0.21265 -0.223568 -0.232463 -0.23919 -0.243651 -0.245798 -0.245633 -0.24321 -0.24451 -0.237532 -0.228592 -0.217928 -0.205805 -0.192503 -0.178307 -0.163498 -0.148341 -0.133081 -0.117932 -0.103076 -0.0886577 -0.074783 -0.0615231 -0.0489153 -0.0369678 -0.0256654 -0.0149762 -0.00485853 0.00473216 0.0138361 0.0224835 0.0306887 0.0384474 0.0457333 0.0524978 0.0586711 0.0641647 0.0688753 0.0726908 0.0754964 0.0771824 0.0776512 0.0768253 0.0746541 0.0711198 0.0662422 0.0600818 0.0527412 0.243187 0.245618 0.24579 0.243651 0.239199 0.232481 0.223594 0.212683 0.199934 0.185567 0.169834 0.153008 0.135379 0.117243 0.0988998 0.0806421 0.0627547 0.0455068 0.0291496 0.0139124 3.65728e-15 -0.0124094 -0.0231662 -0.0321513 -0.0392771 -0.0444896 -0.0477689 -0.0491306 -0.0486256 -0.0463404 -0.0423964 -0.0369473 -0.0301771 -0.0222962 -0.0135363 -0.00414465 0.00562209 0.0155053 0.0252516 0.0346201 0.0433894 -0.0527117 -0.0600474 -0.0662042 -0.0710797 -0.0746133 -0.076785 -0.0776124 -0.0771459 -0.0754629 -0.0726606 -0.0688487 -0.0641417 -0.0586517 -0.0524817 -0.0457202 -0.0384372 -0.0306811 -0.0224782 -0.013833 -0.00473114 0.00485751 0.0149731 0.0256601 0.0369601 0.048905 0.06151 0.0747668 0.0886382 0.103054 0.117906 0.133051 0.148307 0.163461 0.178268 0.192463 0.205764 0.217888 0.228554 0.237498 0.244481 ) ; } walls { type calculated; value uniform 0; } front { type empty; value nonuniform 0(); } back { type empty; value nonuniform 0(); } } // ************************************************************************* //
fb7a445810b271d1b0394ba5684e2207267ca060
6d98c93d1ea7abac7f1dec9ae39d26cf352d8313
/b_dokushu_cpp/ch03/list_3.19/main.cpp
b6f6758f1998704979ccc590d20bc3fa414a2725
[]
no_license
cl-kn/cpp_study
df4fc6e4ee3acf38f19e9f0b123f6835dc2039df
423e62cfc42b3e607caa028900c2c83f4fb0153b
refs/heads/main
2023-04-16T16:25:17.981571
2021-04-26T00:56:19
2021-04-26T00:56:19
315,309,601
0
0
null
null
null
null
UTF-8
C++
false
false
907
cpp
main.cpp
//*************************************************** /** 21/2/11 * P172 list3.19 「共用体と構造体の違い」 */ //*************************************************** #include <iostream> #include <stdio.h> union U { public: //デフォルトは public float f; private: int i; public: U(); //コンスト定義可能 int get_i() const; }; //コンストラクタでは、戦闘以外のメンバ変数"で"初期化できる?? U::U() : i(0xdeadbeef) { std::cout << "&f: " << &f << std::endl << "&i:" << &i << std::endl; } int U::get_i() const { return this->i; //共用体のメンバもthisが使える } int main(void) { U u; //デフォコンストがint型で初期化する std::cout << std::hex << u.get_i() << std::endl; u.f = 2.71828F; //float値を代入 std::cout << std::hex << u.get_i() << std::endl; return 0; }
118454bac9f8bac98734652d5d220d6d63701b6a
611ad108658cc2cd06be410c7dc4ffb4c3c8cc19
/Classes/views/HSTitleLayer.cpp
5d82e6e0cefe21dc78eb2c9d23b275005168d218
[]
no_license
thedoritos/TomoMatch
a445a66e54a34f2977deba0c5b7bb7bc43a63b9f
d5d53594eafd701d006d96deec5b1c71b206ef29
refs/heads/master
2016-09-06T16:17:43.581010
2013-11-26T09:19:00
2013-11-26T09:19:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,447
cpp
HSTitleLayer.cpp
// // HSTitleLayer.cpp // TomoMatch // // Created by thedoritos on 2013/11/14. // // #include "HSTitleLayer.h" #include "HSGame.h" #include "HSAssets.h" #include "HSBackground.h" #include "HSPlayLayer.h" bool HSTitleLayer::init() { CCSize visSize = CCDirector::sharedDirector()->getVisibleSize(); CCPoint visOrigin = CCDirector::sharedDirector()->getVisibleOrigin(); // Create components. // Background. m_bgNode = HSBackground::create(); this->addChild(m_bgNode); // Logo. CCSprite *logo = HS_CREATE_SPRITE(HS_RES_IMG("title_logo")); logo->setPosition(ccp(visOrigin.x + visSize.width * 0.5f, visOrigin.y + visSize.height - logo->getContentSize().height)); this->addChild(logo); // Menu. CCMenuItemImage *startBtn = CCMenuItemImage::create(HS_RES_IMG("title_start"), HS_RES_IMG("title_start_hover"), this, menu_selector(HSTitleLayer::startGame)); CCMenuItemImage *exitBtn = CCMenuItemImage::create(HS_RES_IMG("title_exit"), HS_RES_IMG("title_exit_hover"), this, menu_selector(HSTitleLayer::exitGame)); CCMenu *menu = CCMenu::create(startBtn, exitBtn, NULL); menu->alignItemsVertically(); menu->setPosition(ccp(visOrigin.x + visSize.width * 0.5f, visOrigin.y + visSize.height * 0.25f)); this->addChild(menu); // Enable touch. this->setTouchMode(kCCTouchesOneByOne); this->setTouchEnabled(true); // Enable update. scheduleUpdate(); return true; } CCScene* HSTitleLayer::scene() { CCScene *scene = CCScene::create(); CCLayer *layer = HSTitleLayer::create(); scene->addChild(layer); return scene; } #pragma mark - Initialize void HSTitleLayer::onEnterTransitionDidFinish() { } #pragma mark - Update void HSTitleLayer::update(float dt) { m_bgNode->update(dt); } #pragma mark - Touch event handlers bool HSTitleLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { return true; } void HSTitleLayer::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) { } void HSTitleLayer::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent) { } void HSTitleLayer::ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent) { } #pragma mark - Menu button actions void HSTitleLayer::startGame() { CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(0.5f, HSPlayLayer::scene())); } void HSTitleLayer::exitGame() { }
7e0f111887ba507cd00d3ce0c0b00b780bb15041
e4abad832c79ad403f6a88950a0a46e4bcdce019
/Additionals/Grid/grid.cpp
db3c6bd4d620fe155a69066d119cf2c88014ebc7
[]
no_license
AlexFrania/CS-201
070176faa06f5fa31093d10fdcb97cda0745dbe0
403eb7a403c5bcb8c06007bbbaefa9be833118d5
refs/heads/master
2020-07-14T23:50:52.214019
2019-10-09T22:16:01
2019-10-09T22:16:01
205,418,453
0
0
null
null
null
null
UTF-8
C++
false
false
997
cpp
grid.cpp
#include <iostream> using std::cout; using std::cin; int main() { char grid[3][3] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'} }; char hit = 'x'; int row = 0; int col = 0; for (int label = 1; label <= 15; label++) { cout << " "; while (label == 3) { cout << "A"; break; } while (label == 7) { cout << "B"; break; } while (label == 11) { cout << "C"; break; } } cout << "\n"; cout << " "; int rownumb = 1; for (int div = 1; div <= 60; div++) //row dividers { cout << "-"; while (div % 15 == 0 && div < 60) //breaks line at 15th period and ends on 60th { cout << "\n"; cout << rownumb; rownumb++; for (int i = 1; i <= 3; i++) //content of rows, split into 3 sections { cout << "|"; cout << " "; for (int i = 1; i <= 1; i++) //work on this later, core of game { cout << grid[row][col]; } cout << " "; cout << "|"; } cout << "\n"; cout << " "; break; } } return 0; }
eaac3e83f53b89d85185168ddbd1abcc3ff2fa35
d3b52af0437f5c227bbc3a45877697ea8f80b7ae
/Framework99C/UIMgr.cpp
2afb1f5f36c146180b0d46363a2bed69725cf8ac
[]
no_license
suha1515/APITeamProject
1b2e16f89c16b9b5b9d64ef305771540cde6a55f
746f1452101787dc544c427131207b5c91c59e52
refs/heads/master
2022-02-13T23:25:55.271194
2019-07-28T07:56:52
2019-07-28T07:56:52
197,739,755
0
0
null
2019-07-27T12:21:51
2019-07-19T09:00:50
C++
UTF-8
C++
false
false
1,606
cpp
UIMgr.cpp
#include "stdafx.h" #include "UIMgr.h" DEFINE_SINGLE_TONE(CUserInterfaceMgr) void CUserInterfaceMgr::Initialize() { m_nNumOfLife; m_nNumOfSpecial; m_pTextureBoob = CResourceMgr::GetInstance()->LoadTexture("UI_Bomb", _T("Stage/Item/Item_Bomb.bmp")); m_pTextureBoob->SetColorKey(RGB(0, 128, 128)); m_pTextureLife = CResourceMgr::GetInstance()->LoadTexture("player_moveLeft", _T("Stage/Player/Player_left.bmp")); m_pTextureLife->SetColorKey(RGB(255, 255, 255)); m_pTextureScore = CResourceMgr::GetInstance()->LoadTexture("Score", _T("Stage/Score/Score.bmp")); m_pTextureScore->SetColorKey(RGB(255, 40, 255)); } void CUserInterfaceMgr::ShowUI(HDC hDC) { int nTmpScore = m_nScore; int nTmpResult = 0; for (int i = 0; i <= 5; ++i) { nTmpResult = 0; nTmpResult = CalModular(nTmpScore, pow(10, 5 - i)); if (nTmpResult != nTmpScore || nTmpResult < 10) { m_pTextureScore->DrawTexture(hDC, IMGINFO(40 * i, 0, 0, 0, 47, 47), 0, 47 * nTmpResult, 1, 10); } } for (int i = 1; i <= m_nNumOfLife; ++i) { m_pTextureLife->DrawTexture(hDC, IMGINFO(40 * i, 50, 0, 0, 40, 40), 0, 0, 2, 1); } for (int i = 1; i <= m_nNumOfSpecial; ++i) { m_pTextureBoob->DrawTexture(hDC, IMGINFO(60 * i, WINCY - 50, 0, 0, 54, 32), 54, 0, 4, 1); } } void CUserInterfaceMgr::SetLife(int nLife) { m_nNumOfLife = nLife; } void CUserInterfaceMgr::SetScore(int nScore) { m_nScore += nScore; } void CUserInterfaceMgr::SetSpecial(int nSpecial) { m_nNumOfSpecial = nSpecial; } int CUserInterfaceMgr::CalModular(int& number, int digit) { int nTmp = number / digit; number %= digit; return nTmp; }
86e6c1e7e0c6c13fc0ae7bef231d5baa79f2386c
546939137745647ce56184db4e5cf3a795ee3f2b
/kitti_read_utils.h
b9dbd4dd22287275170ec4b3fe04a558c1b977d9
[]
no_license
liuqi8827/Kitti_Read
471410f84caae21db6a4033dfdb1d789d9ec8962
6b90f0f9ac5b1ac06e1cb5ebf3c9ae251ae08e33
refs/heads/master
2020-05-19T18:27:36.507106
2018-01-03T06:49:26
2018-01-03T06:49:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,578
h
kitti_read_utils.h
// // Created by zhanghm on 17-12-26. // #ifndef KITTI_READ_KITTI_READ_UTILS_H #define KITTI_READ_KITTI_READ_UTILS_H #include <iostream> #include <fstream> #include <string> #include <vector> //OpenCV #include <opencv2/opencv.hpp> //PCL #include <pcl/point_cloud.h> #include <pcl/point_types.h> //Eigen #include <Eigen/Dense> namespace kitti_read{ //! \brief read the calib.txt file in odometry dataset //! \param calibFile //! \param projectionMatrix size 3X4, project 3D point in lidar to camera image coordinate //! \param cameraMatrix size 3X4,project 3D point under camera0 coordinate to other camera image,to image of camera2 by default //! \param velo2camera size 4X4,Tr,velodyne lidar point cloud to camera0 world coordinate //! \return bool readOdometryCalib(const std::string& calibFile,cv::Mat& projectionMatrix,cv::Mat& cameraMatrix,cv::Mat& velo2camera); //! \brief read image sequence //! \param imagePath image parent diretory name, include '/' //! \param imgIdx image sequence number //! \param imgRead[out] the image has read //! \return bool readImage(const std::string& imagePath,const int imgIdx,cv::Mat& imgRead); //! \brief read point cloud from binary file // veloCloudPtr[out] store all point cloud data bool readLidarBinData(const std::string& lidarFile,const int fileIdx,pcl::PointCloud<pcl::PointXYZ>::Ptr veloCloudPtr); bool project2Image(cv::Mat& rgbImg,pcl::PointCloud<pcl::PointXYZ>::Ptr veloCloudPtr,cv::Mat& projectionMatrix); } #endif //KITTI_READ_KITTI_READ_UTILS_H
1eba077c874b2a8ebd97f5389a9157a86d972163
9bcf72a8d80fe36155bc9a9c2acc23d9861a7315
/Parchis/LCD.cpp
5f8401f88786a867f102d457f40324ae9eb68ec3
[]
no_license
SebastiaNoceras/Embedded-Parcheesi-Game
42c37fd1e3ec53fa8803d4d2bd85165393323d08
d95bbe0bb0116958b24abd3ee4c8df26c8bf9162
refs/heads/main
2023-01-02T15:24:25.878790
2020-11-04T12:52:20
2020-11-04T12:52:20
309,998,673
1
0
null
null
null
null
UTF-8
C++
false
false
5,677
cpp
LCD.cpp
/** @file LCD.cpp @author Sebastià A. Noceras Anderson @date 06/03/2020 @brief LCD library. */ #include "LCD.h" #include "keypad.h" /******************************************************************************* ** Initializations ******************************************************************************/ LCD::LCD( uint8_t pin_rs, uint8_t pin_rw, uint8_t pin_en, uint8_t pin_db4, uint8_t pin_db5, uint8_t pin_db6, uint8_t pin_db7){ // save pins this->pin_rs = pin_rs; this->pin_rw = pin_rw; this->pin_en = pin_en; pin_db[0] = pin_db4; pin_db[1] = pin_db5; pin_db[2] = pin_db6; pin_db[3] = pin_db7; pinMode(pin_rs, OUTPUT); pinMode(pin_rw, OUTPUT); pinMode(pin_en, OUTPUT); digitalWrite(pin_en, LOW); } void LCD::init() { /* See page 46 */ delay(15); // Function set: 8 bits write4bits(0b0011); delayMicroseconds(5000); // Function set: 8 bits write4bits(0b0011); delayMicroseconds(100); // Function set: 8 bits write4bits(0b0011); wait(); // Function set: 4 bits write4bits(0b0010); wait(); // Funtion set: 4 bits, 2 lines and character font 5x8 send(INSTR, 0b00101000); // Display off off(); // Display clear clear(); // Entry mode set: Cursor move direction increment and no shifting send(INSTR, 0b00000110); /* INITIALIZATION FINISHED */ // Display on on(CURSOR_ON, BLINK_ON); } /******************************************************************************* ** Print ******************************************************************************/ void LCD::print(const char* text) { while(*text != '\0'){ send(DATA, *text); wait(); text++; } } /******************************************************************************* ** Display control ******************************************************************************/ void LCD::on(lcd_cursor_state_t cursor_state, lcd_blink_state_t blink_state) { if (cursor_state == CURSOR_OFF && blink_state == BLINK_OFF) send(INSTR,0b00001100); else if (cursor_state == CURSOR_OFF && blink_state == BLINK_ON) send(INSTR,0b00001101); else if (cursor_state == CURSOR_ON && blink_state == BLINK_OFF) send(INSTR,0b00001110); else if (cursor_state == CURSOR_ON && blink_state == BLINK_ON) send(INSTR,0b00001111); } void LCD::off() { send(INSTR,0b00001000); } void LCD::clear() { send(INSTR,0b00000001); } /******************************************************************************* ** Cursor control ******************************************************************************/ void LCD::setCursor(uint8_t row, uint8_t col) { uint8_t value; if (row == 1) value = 0b10000000 + col - 1; else if(row == 2) value = 0b11000000 + col - 1; send(INSTR,value); } void LCD::moveCursorRight() { send(INSTR,0b00010100); } void LCD::moveCursorLeft() { send(INSTR,0b00010000); } /******************************************************************************* ** Shift control ******************************************************************************/ void LCD::shiftDisplayRight() { send(INSTR,0b00011000); } void LCD::shiftDisplayLeft() { send(INSTR,0b00011100); } /******************************************************************************/ /** PRIVATE FUNCTIONS **/ /******************************************************************************/ void LCD::write4bits(uint8_t value) { // Set data pins as output pinMode(pin_db[0], OUTPUT); pinMode(pin_db[1], OUTPUT); pinMode(pin_db[2], OUTPUT); pinMode(pin_db[3], OUTPUT); // Set RS and RW to send instruction digitalWrite(pin_rs, LOW); digitalWrite(pin_rw, LOW); // Write value to data pins uint8_t mask = 1; for (uint8_t i = 0; i < 4 ; i++){ if((mask & value) == 0) digitalWrite(pin_db[i], HIGH);//AND BIT A BIT else digitalWrite(pin_db[i], LOW); mask = mask << 1; } enable_pulse(); } void LCD::send(lcd_send_mode_t mode, uint8_t value) { // Set data pins as output pinMode(pin_db[0], OUTPUT); pinMode(pin_db[1], OUTPUT); pinMode(pin_db[2], OUTPUT); pinMode(pin_db[3], OUTPUT); // Set RS and RW to send instruction/data depending on mode if (mode == INSTR) digitalWrite(pin_rs, 0); else if (mode == DATA ) digitalWrite(pin_rs, 1); digitalWrite(pin_rw, 0); uint8_t mask = 1; uint8_t value_bits[8]; for (uint8_t i=0; i<8 ; i++){ if((mask & value) == 0) value_bits[i] = LOW; else value_bits[i] = HIGH; mask = mask << 1; //Añade un cero a la derecha. } // Write first nibble (most significant) from value to data pins digitalWrite(pin_db[0], value_bits[4]); digitalWrite(pin_db[1], value_bits[5]); digitalWrite(pin_db[2], value_bits[6]); digitalWrite(pin_db[3], value_bits[7]); enable_pulse(); // Write second nibble (less significant) from value to data pins digitalWrite(pin_db[0], value_bits[0]); digitalWrite(pin_db[1], value_bits[1]); digitalWrite(pin_db[2], value_bits[2]); digitalWrite(pin_db[3], value_bits[3]); enable_pulse(); wait(); } void LCD::wait() { uint8_t busy; // Set data pins as input pinMode(pin_db[0], INPUT); pinMode(pin_db[1], INPUT); pinMode(pin_db[2], INPUT); pinMode(pin_db[3], INPUT); // Set RS and RW to read busy flag digitalWrite(pin_rs, 0); digitalWrite(pin_rw, 1); do { digitalWrite(pin_en, HIGH); // Read busy flag (db7) busy = digitalRead(pin_db[3]); enable_pulse(); } while (busy == HIGH); } void LCD::enable_pulse() { digitalWrite(pin_en, LOW); delayMicroseconds(1); digitalWrite(pin_en, HIGH); delayMicroseconds(1); digitalWrite(pin_en, LOW); delayMicroseconds(100); }
56fb2999a26295b54eed9562ff696b2662056b67
31ac07ecd9225639bee0d08d00f037bd511e9552
/externals/OCCTLib/inc/Storage_Error.hxx
e1bd8230b4f67fd1e78184358615eff3044b1569
[]
no_license
litao1009/SimpleRoom
4520e0034e4f90b81b922657b27f201842e68e8e
287de738c10b86ff8f61b15e3b8afdfedbcb2211
refs/heads/master
2021-01-20T19:56:39.507899
2016-07-29T08:01:57
2016-07-29T08:01:57
64,462,604
1
0
null
null
null
null
UTF-8
C++
false
false
1,949
hxx
Storage_Error.hxx
// This file is generated by WOK (CPPExt). // Please do not edit this file; modify original file instead. // The copyright and license terms as defined for the original file apply to // this header file considered to be the "object code" form of the original source. #ifndef _Storage_Error_HeaderFile #define _Storage_Error_HeaderFile //! Error codes returned by the ErrorStatus <br> //! function on a Storage_Data set of data during a <br> //! storage or retrieval operation : <br> //! - Storage_VSOk : no problem has been detected <br> //! - Storage_VSOpenError : an error has <br> //! occurred when opening the driver <br> //! - Storage_VSModeError : the driver has not <br> //! been opened in the correct mode <br> //! - Storage_VSCloseError : an error has <br> //! occurred when closing the driver <br> //! - Storage_VSAlreadyOpen : the driver is already open <br> //! - Storage_VSNotOpen : the driver is not open <br> //! - Storage_VSSectionNotFound : a section <br> //! has not been found in the driver <br> //! - Storage_VSWriteError : an error occurred when writing the driver <br> //! - Storage_VSFormatError : the file format is wrong <br> //! - Storage_VSUnknownType : a type is not known from the schema <br> //! - Storage_VSTypeMismatch : trying to read a wrong type <br> //! - Storage_VSInternalError : an internal error has been detected <br> //! - Storage_VSExtCharParityError : an error <br> //! has occurred while reading 16 bit characte <br> enum Storage_Error { Storage_VSOk, Storage_VSOpenError, Storage_VSModeError, Storage_VSCloseError, Storage_VSAlreadyOpen, Storage_VSNotOpen, Storage_VSSectionNotFound, Storage_VSWriteError, Storage_VSFormatError, Storage_VSUnknownType, Storage_VSTypeMismatch, Storage_VSInternalError, Storage_VSExtCharParityError, Storage_VSWrongFileDriver }; #ifndef _Standard_PrimitiveTypes_HeaderFile #include <Standard_PrimitiveTypes.hxx> #endif #endif
c79175ee3dae04ef9babca55a2d3916775ae14d5
fad78df3ec8b996e2286800ea919e3909eb7d722
/05/main.cpp
da5ca93d65c58007d219d144e81d404f7400d674
[]
no_license
arZamalyutdinov/msu_spring_2019
70b106a30ca12b3e756c9b1a129071d031efb964
c055c0e08763fd29ee6ae5628258a1d48c1ebf6d
refs/heads/master
2022-01-13T02:45:25.001377
2019-05-14T09:39:24
2019-05-14T09:39:24
176,367,093
0
0
null
null
null
null
UTF-8
C++
false
false
1,177
cpp
main.cpp
#include <iostream> #include <mutex> #include <thread> #include <functional> #include <condition_variable> constexpr uint64_t maxTimes = 1000000; void ping(std::mutex &mtx, std::condition_variable &cond, uint64_t &count) { for (; count < maxTimes;) { std::unique_lock<std::mutex> lock(mtx); cond.wait(lock, [&count]{ return count % 2 == 0; }); std::cout << "ping\n"; ++count; cond.notify_one(); std::this_thread::yield(); } } void pong(std::mutex &mtx, std::condition_variable &cond, uint64_t &count) { for (; count < maxTimes;) { std::unique_lock<std::mutex> lock(mtx); cond.wait(lock, [&count]{ return count % 2; }); std::cout << "pong\n"; ++count; cond.notify_one(); std::this_thread::yield(); } } int main(int argc, char const *argv[]) { std::mutex mtx; std::condition_variable cond; uint64_t count = 0; std::thread thr1(ping, std::ref(mtx), std::ref(cond), std::ref(count)); std::thread thr2(pong, std::ref(mtx), std::ref(cond), std::ref(count)); thr1.join(); thr2.join(); return 0; }
07daf23c6ceb2e88a0a8efb910bafa25c6b4129a
e5fe874722b1e5658d233a2cf751f5b87f401d29
/src/mapWorld.h
bf9b60e030398f53b4149195824fb91b3967d070
[]
no_license
CppBanden/Zap
2a803164062de695b68ecc4d5732e4ffa666def2
d594e7e4ec30b78662182d52878bfee4e107aa8e
refs/heads/master
2021-01-10T20:05:06.186964
2015-04-06T21:40:18
2015-04-06T21:40:18
31,385,167
0
0
null
null
null
null
UTF-8
C++
false
false
659
h
mapWorld.h
// // mapWorld.h // Zap // // Created by Martin Fasterholdt on 08/03/15. // // #ifndef __Zap__mapWorld__ #define __Zap__mapWorld__ #include <stdio.h> #include "ofMain.h" #include "location.h" #include "item.h" #include <vector> class MapWorld { public: float areaFraction; ofColor color; ofVec2f offset; ofVec2f pos; Location location; vector<Item> items; MapWorld(ofColor colorInput, float areaFractionInput, ofVec2f offsetInput, Location locationInput); MapWorld(ofColor colorInput, float areaFractionInput, ofVec2f offsetInput, Location locationInput, vector<Item> items); }; #endif /* defined(__Zap__mapWorld__) */
d22ecaf7213e2acbbd2607c55e19ec3e4a249dad
ec890e6479050f160f25978cafe5a7ab95d8269c
/SolidGroup/Window/MiddleWindowToolBar.h
c895acffe74ee8bf417713266ca6a4a70ba833b2
[]
no_license
Andrew90/1630_SolidGroup
5485fb25fc4e5b0d5de3e1e51fded01f1e7be20d
e838f8acf1591475aa1a69d2c3b2c81022fdee19
refs/heads/master
2021-05-04T09:15:22.395898
2016-10-11T11:25:50
2016-10-11T11:25:50
70,449,053
0
0
null
null
null
null
UTF-8
C++
false
false
534
h
MiddleWindowToolBar.h
#pragma once #include "../Resource.h" #include "InitToolBar.hpp" namespace MiddleWindowToolBar { void LeftArrowHandler(HWND h); void RightArrowHandler(HWND h); void UpArrowHandler(HWND h); void DownArrowHandler(HWND h); typedef TL::MkTlst< SeparatorToolbar<0> , ButtonToolbar<IDB_LeftArrow, LeftArrowHandler> , ButtonToolbar<IDB_RightArrow, RightArrowHandler> // , ButtonToolbar<IDB_UpArrow, UpArrowHandler> //, ButtonToolbar<IDB_DownArrow, DownArrowHandler> , SeparatorToolbar<1> >::Result detailied_tool_button_list; }
40a329b1219a83408e54fea5f97ef4aeb9cd0755
f6efcbbcbb2c3ae6af0f4cfccf0ae8cf293a8484
/Tools/PerlinTabsGen/IntNumGen.h
1df900ab7c3eb080d779beb4c32d9567c7849e76
[]
no_license
grossbear/gappdev-prev
fe7b4954586cd88d66bda1d554ed0d0b1a1113e6
3de2db957040ced787098ee9d3d7d334da004123
refs/heads/master
2021-09-24T08:17:26.287363
2018-05-26T22:27:42
2018-05-26T22:27:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,010
h
IntNumGen.h
//////////////////////////////////////////////////////////////////////////////////////////////// // IntNumGen.h // // Class generates integer value in ascending and descending order // //////////////////////////////////////////////////////////////////////////////////////////////// #ifndef __INTNUMGEN_H__ #define __INTNUMGEN_H__ #ifndef _PLATFORMTYPES_H_ typedef unsigned char ubyte; typedef unsigned short uint16t; #endif //_PLATFORMTYPES_H_ class CIntNumGen { public: CIntNumGen(uint16t seed); int GenNewIntValue(); int GetSequenceValue1() const; private: void InitSeriesValues(uint16t seed); // Base value that starts number generation process int mBaseValue1; int mBaseValue2; // Variables that are changed through iteration process of value generation int mSequenceValue1; int mSequenceValue2; // Used for adding to sequence value to produce new values int mAddValue1; int mAddValue2; }; #endif //__INTNUMGEN_H__
a79785edd7afc484198ac93be56f202475de5387
a924f08153821715ef937b70735757997a090b10
/animals2.cpp
81e381a2ca3523d378c89d052ee6d9e778191c5c
[]
no_license
beepscore/cpp_intro
0a6cef6877ec73383c5bc8d2f59160c3c625fd66
d6c0ee9031ae0325ef0ab80a53928c32614e5ac9
refs/heads/master
2020-12-25T19:03:30.514986
2018-11-13T05:14:00
2018-11-13T05:14:00
29,925,684
0
0
null
null
null
null
UTF-8
C++
false
false
1,386
cpp
animals2.cpp
# include <iostream> # include <string> using namespace std; class Animal2{ public: void getFamily() { cout << "We are animals" << endl; } // virtual keyword enables subclass to override virtual void getClass() { cout << "I'm an Animal" << endl; } }; class Dog2 : public Animal2{ public: void getClass() { cout << "I'm a Dog" << endl; } }; class GermanShepard : public Dog2{ public: void getClass() { cout << "I'm a German Shepard" << endl; } void getDerived() { cout << "I'm an Animal and Dog" << endl; } }; void whatClassAreYou(Animal2 *animal) { animal -> getClass(); } int main() { // instantiate as pointer variables Animal2 *animal = new Animal2; Dog2 *dog = new Dog2; // pointer can't use dot syntax // animal.getClass(); animal -> getClass(); dog -> getClass(); whatClassAreYou(dog); Dog2 spot; GermanShepard max; Animal2* dog2Ptr = &spot; Animal2* germanShepardPtr = &max; dog2Ptr -> getFamily(); germanShepardPtr -> getFamily(); // polymorphism example- calling the same method name on these Animal2 instances // calls the most specific implementation dog2Ptr -> getClass(); germanShepardPtr -> getClass(); return 0; }
e1f501e9d126f9992b4d38699bb78865ea85739b
2b71bfced43b719097bae182ceb52d73dbe27fac
/ascenddk/scripts/travis_scripts/comm/showCamera/showCamera.cpp
650d8d40040873d2fb371474c3e3c3a9ecfcb632
[]
no_license
buddytian/travis_test
190e9c1f9063a92fe5f706930bbb59489de7689c
eb4b3bab41d3ff3a32327231b9309426f4a861b0
refs/heads/master
2020-04-11T02:47:52.284821
2018-12-29T08:32:12
2018-12-29T08:32:12
161,456,455
1
0
null
null
null
null
UTF-8
C++
false
false
8,041
cpp
showCamera.cpp
extern "C" { #include "driver/peripheral_api.h" } #include "hiaiengine/engine.h" #include "hiaiengine/data_type.h" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <unistd.h> using namespace cv; using namespace hiai; using namespace std; //摄像头参数 #define WIDTH 1280 #define HEIGHT 720 int FPS=20; int allframe=300; uint32_t m_frameid; struct yuvfile { string file; int number; int readSize; uint8_t* pdata; }; //map & 锁 map<int, uint8_t*> mapmembuffer; map<int, string> maptimestamp; mutex g_lock; std::shared_ptr<BatchImagePara<uint8_t>> CreateBatchImageParaObj(int channel_ID) { std::shared_ptr < BatchImagePara < uint8_t >> pObj = std::make_shared<BatchImagePara<uint8_t>>(); pObj->b_info.is_first = (m_frameid == 0); pObj->b_info.is_last = false; pObj->b_info.batch_size = 1; pObj->b_info.max_batch_size = 1; pObj->b_info.batch_ID = 0; pObj->b_info.channel_ID = channel_ID; pObj->b_info.processor_stream_ID = 0; pObj->b_info.frame_ID.push_back(m_frameid++); pObj->b_info.timestamp.push_back(time(NULL)); ImageData < uint8_t > imgData; imgData.format = YUV420SP; imgData.width = WIDTH; imgData.height = HEIGHT; imgData.size = WIDTH * HEIGHT * 3 / 2; uint8_t * image_buffer_ptr1_ = (uint8_t*) (new uint8_t[imgData.size]); std::shared_ptr < uint8_t > data(image_buffer_ptr1_); imgData.data = data; pObj->v_img.push_back(imgData); return pObj; } static void* writeYUV420sp_thread(void *data) { sleep(1); yuvfile *param = (yuvfile *)data; map<int, uint8_t*>::iterator it; map<int, string>::iterator ittimestamp; int number=0; while(number<param->number) { number++; it = mapmembuffer.find(number); if (it != mapmembuffer.end()){ param->pdata=it->second; //写入本地YUV文件 ittimestamp=maptimestamp.find(number); int yuvsize=WIDTH * HEIGHT * 1.5;//1382400; char *yuvdata=new char[yuvsize]; memcpy(yuvdata,param->pdata,WIDTH * HEIGHT * 1.5); ofstream fout(ittimestamp->second.c_str()); //创建一个YUV文件 fout.write(yuvdata,param->readSize); //将图片写入文件 fout.close(); //关闭文件 //cout<<"write " << ittimestamp->second.c_str() <<" success"<<endl; //OPENCV处理且写本地bmp or jpg文件 Mat src(HEIGHT * 1.5, WIDTH, CV_8UC1), dst; // 如果不是从文件中读取yuv数据,从这里开始看 memcpy(src.data, param->pdata, WIDTH * HEIGHT * 1.5); cvtColor(src, dst, CV_YUV420sp2RGB); stringstream Resultfile; size_t index=ittimestamp->second.find("."); Resultfile << "Result-" << ittimestamp->second.substr(0,index) << ".jpg"; imwrite(Resultfile.str(), dst); cout<<"write " << Resultfile.str() <<" success"<<endl; //mapmembuffer中erase g_lock.lock(); int eraseReturn=mapmembuffer.erase(it->first); maptimestamp.erase(it->first); g_lock.unlock(); if(1==eraseReturn) { cout<<"erase num " << it->first <<" success"<<endl; }else{ cout<<"erase failed,erase num " << it->first <<" not in map"<<endl; } }else{ cout<<"wait 100ms"<<endl; usleep(100000); number--; } } } pthread_t writeYUV420sp_test_thread_create(int readSize, int number) { yuvfile *param = new yuvfile(); param->readSize = readSize; param->number = number; pthread_t thread_id; pthread_attr_t thread_attr; pthread_attr_init(&thread_attr); pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); pthread_create(&thread_id, &thread_attr, &writeYUV420sp_thread, param); return thread_id; } int main(int argc, char* argv[]) { if (argc < 3) //Usage:./hello -c [channel_ID] { printf("run command error!!!!!!!\n"); printf("Usage:./hello -c [channel_ID]\n"); exit(-1); } else if(argc > 3) { printf("Unknow command ,%s!!!!!!!\n",argv[3]); printf("Usage:./hello -c [channel_ID]\n"); exit(-1); } if(*argv[1] != 45 || *(argv[1]+1) != 99 || *(argv[1]+2) != 0) // -c/0 { printf("run command error!!!!!!!,%s\n",argv[1]); printf("Usage:./hello -c [channel_ID]\n"); exit(0); } if(*argv[2] != 0x30 && *argv[2] != 0x31 || *(argv[2]+1) != 0x0) //channel_ID=[0,1] { printf("channel_ID error!!!!!!!,%d,%d\n",*argv[2],*(argv[2]+1)); printf("channel_ID=[0,1]\n"); exit(0); } int channel_ID=atoi(argv[2]); int ret, para; struct CameraResolution resolution; resolution.height = HEIGHT; resolution.width = WIDTH; MediaLibInit(); ret = IsChipAlive(NULL); printf("IsChipAlive ret %d\r\n", ret); if(ret==0) { printf("Camera(%d) is not alive\n",channel_ID); exit(0); } ret=OpenCamera(channel_ID); printf("OpenCamera(%d) ret %d\r\n", channel_ID,ret); if(ret==0) { printf("Camera(%d) can not open\n",channel_ID); exit(0); } //设置摄像头参数 //fps para = FPS; SetCameraProperty(channel_ID, CAMERA_PROP_FPS, &para); //YUV420SP para = CAMERA_IMAGE_YUV420_SP; SetCameraProperty(channel_ID, CAMERA_PROP_IMAGE_FORMAT, &para); //1280*720 SetCameraProperty(channel_ID, CAMERA_PROP_RESOLUTION, &resolution); //主动模式 para = CAMERA_CAP_ACTIVE; SetCameraProperty(channel_ID, CAMERA_PROP_CAP_MODE, &para); printf("SetCameraProperty(%d) OK\r\n",channel_ID); //从摄像头获取图片 int readSize = 0; std::shared_ptr < BatchImagePara < uint8_t >> pObj = CreateBatchImageParaObj(channel_ID); ImageData < uint8_t > *pImgData = &pObj->v_img[0]; uint8_t* pdata = pImgData->data.get(); readSize = (int) pImgData->size; //起一个处理缓存mapmembuffer的线程 writeYUV420sp_test_thread_create(readSize,allframe); int index=0; while(index<allframe) //循环从摄像头读取200张YUV图片 1秒20帧 那么就是取10s的图片 { index++; //从摄像头读一张图片 suseconds_t timediffA; struct timeval beginA, endA; gettimeofday(&beginA, NULL); int readRet = ReadFrameFromCamera(channel_ID, (void*) pdata, &readSize); gettimeofday(&endA, NULL); timediffA = endA.tv_usec - beginA.tv_usec + (endA.tv_sec - beginA.tv_sec) * 1000000; printf("ReadFrameFromCamera %d wastes %d us total\n",index,(int)timediffA); //时间戳写入一个maptimestamp time_t timep; time (&timep); char tmp[64]; strftime(tmp, sizeof(tmp), "%Y%m%d%H%M%S",localtime(&timep) ); string cur_time=tmp; stringstream tmpfile; tmpfile <<cur_time.c_str()<< "-" << index << ".YUV420SP"; //拷贝一份 uint8_t* dpdata = (uint8_t*)malloc(readSize); memcpy(dpdata,pdata,readSize); //insert map 写入内存缓存mapmembuffer g_lock.lock(); mapmembuffer.insert({index,dpdata}); maptimestamp.insert({index,tmpfile.str()}); g_lock.unlock(); } //循环暂停1s,等待所有的处理线程处理完毕,才能退出程序 while(mapmembuffer.size()!=0) { cout<<"mapmembuffer size :" << mapmembuffer.size()<<endl; sleep(1); } //关闭摄像头 printf("CloseCamera(%d) ret %d\r\n", channel_ID,CloseCamera(channel_ID)); printf("Camera(%d)-result is Result1.jpg-Result%d.jpg\r\n",channel_ID,allframe); return 0; }
02c5d2e19b8e116a27493f88832155fb17b478fc
7cf77f209cf203680e3f1fc7a2eb2a2c48b1aebe
/2-3.cpp
c5e402e42eaf44d28265667494c1436ba42de4c5
[]
no_license
Cheldya/cpp
3bbc27490a0c5892301d85328b757858167dae4e
4f90be64b9707553c1846c39409feb014b9a7db8
refs/heads/master
2021-05-03T14:16:40.252404
2018-03-01T04:58:17
2018-03-01T04:58:17
120,520,654
0
0
null
null
null
null
UTF-8
C++
false
false
660
cpp
2-3.cpp
// // Created by obhat on 2/28/2018. // #include <iostream> using namespace std; int main() { int x; cout << "please enter a grade" << endl; cin >> x ; switch(x) { case 90 ... 100: cout << "A"<< endl; break; case 80 ... 89: cout << "B" << endl; break; case 70 ... 79: cout << "C" << endl; break; case 60 ... 69: cout << "D" << endl; cout << "Would you like to enter another grade ? Y/ N" << endl; break; default: cout << "you fail the class" << endl; } return 0; }
86d5700aebd2ede6e2c7c9866f694d05d789d2fa
6a0262e0820939af2b97808e9ac27bfe809ef1c9
/include/KingSort/KingSort.hpp
64cafe87b99d1a2cdc8c39060bdd00bb7e3ca953
[]
no_license
LucasFiorini/TesteLogica
11d75ba68e19705811b3da4419b8fc5829d59e80
abaaaf2fd7c4402bb26833917c39bac556cb271b
refs/heads/master
2022-03-21T01:37:10.965575
2019-12-04T18:35:51
2019-12-04T18:35:51
225,798,231
0
0
null
null
null
null
UTF-8
C++
false
false
856
hpp
KingSort.hpp
// // Created by Lucas Fiorini on 2019-12-04. // #ifndef KINGSORT_HPP #define KINGSORT_HPP 1 #include <string> using namespace std; class KingSort { public: /** * This method uses Bubble Sort logic to sort the array. As * the input size is not greater than 50, a simple sorting function * will perform better. * * @param the given array of strings * @param the number of elements * @return does not return anything, as the parameter is an array, * in c++, is passed a reference to that array instead of a copy. Therefore, * there is no need to return another string, it would be a waste of memory. * The sorting will happen into the given array itself. */ void getSortedList(string kings[], unsigned int size); private: }; #endif
54d968bfd7feadec23c6f81c1cfb8ae340e1548d
eb618b64f5af1ddec1647cb33ebacb545c03e8c2
/1. Algorithms/6.3 Next Permutation on Vector .cpp
2e8d79e4a190b801ff6a7e9f3c393fc8d9336e02
[]
no_license
TusharKukra/STL
918cabb8e5a6763069b4127d293cda699d452505
ed692a3bbff2504763cd283b429009e302051696
refs/heads/main
2023-02-10T00:03:59.139469
2021-01-08T18:11:07
2021-01-08T18:11:07
314,714,477
3
1
null
null
null
null
UTF-8
C++
false
false
873
cpp
6.3 Next Permutation on Vector .cpp
#include<iostream> #include<algorithm> #include<vector> using namespace std; int main(){ // Rotate method (rotating a container) int arr[] = {10,20,30,40,50}; int n = sizeof(arr)/sizeof(int); // Now for rotating from middle element rotate (arr,arr+2, arr+n); for(int i=0;i<n;i++) { cout<<arr[i]<<" "; } cout<<endl; // Applying on vector vector<int> v = {1,2,3 }; // Vector is an Dynamic Array rotate(v.begin(), v.begin()+3, v.end()); for(int i=0;i<v.size();i++) { cout<<v[i]<<" "; } // Next Permutation for vector next_permutation ( v.begin(),v.end()); // If you want more permutation then again write the above statement // next_permutation ( v.begin(),v.end()); like this cout<<endl; //for each loop for(int x:v){ cout<<x<<" "; } return 0; }
eb7d1a173bf337d6e79654e58bb52e9119ba922a
232bdf11e6d48d54876842f76e9e28d622590e83
/thirdpart/linux/qprofile/.svn/pristine/eb/eb7d1a173bf337d6e79654e58bb52e9119ba922a.svn-base
1a42f284c861e4d9ed00132617dd94c787356a55
[ "Apache-2.0" ]
permissive
c6supper/json_serialize_deserialize_qt
22a1c24a4d967a2ca9a8e9c8e6485f4ee581c62a
c70e89056900835221309f7c54dcca2e9fefe498
refs/heads/master
2023-05-27T06:13:39.867301
2021-06-15T01:47:49
2021-06-15T01:47:49
377,003,767
0
0
null
null
null
null
UTF-8
C++
false
false
15,185
eb7d1a173bf337d6e79654e58bb52e9119ba922a.svn-base
/* This file is part of qprofile * * Copyright (C) 2018 Calvin <c6supper@hotmail.com> */ #include "qabstractcontainer.h" #include "qobjectfactory.h" #include "qabstracttopic.h" #include <QMetaClassInfo> #include <QTimer> #include "qabstractipcclient.h" #include "qprofile_debug.h" #include "qgenerictopicevent.h" #include "qgenericmessage.h" #include "qgenericcommand.h" #include <QTimer> #if defined(BUILD_X86) #include "qjson/parser.h" #include "qjson/serializer.h" #include "qjson/qobjecthelper.h" #else #include <QJson/Parser> #include <QJson/Serializer> #include <QJson/QObjectHelper> #endif #include "qgenericstatus.h" #include "qabstractcompatibility.h" #include "qabstracttrigger.h" using namespace QProfile; QObjectFactory *QObjectFactory::instance = nullptr; QAbstractContainer::QAbstractContainer(QObject *parent, bool isRetainMessage) : QObject(parent), m_ipcClient(nullptr), m_topic(nullptr), m_mutex(new QMutex()), m_triggerMutex(new QMutex()), m_isRetainMessage(isRetainMessage) { Q_ASSERT(parent != nullptr); m_ipcClient = QAbstractIpcClient::Instance(); QTimer::singleShot(0, this, SLOT(postponeInit())); } void QAbstractContainer::postponeInit() { initPropertiesMap(); allocModel(); allocTopic(); } QAbstractContainer::QAbstractContainer(const QAbstractContainer &container) : QObject(container.parent()) { *this = container; m_ipcClient = QAbstractIpcClient::Instance(); } void QAbstractContainer::copyProperty(const QAbstractContainer &container) { for (int propertyIdx = 0; propertyIdx < metaObject()->propertyCount(); propertyIdx++) { QMetaProperty property = metaObject()->property(propertyIdx); int srcIdx = container.metaObject()->indexOfProperty(property.name()); if (srcIdx > 0) { if (!setProperty(property.name(), container.property(property.name()))) qprofileDebug(QtDebugMsg) << "set property " << property.name() << "Failed, for class " << metaObject()->className(); } else { qprofileDebug(QtDebugMsg) << "Miss property " << property.name() << ", for class" << metaObject()->className(); } } } const QString QAbstractContainer::tagName(const QString &key) { QVariant propertyVariant = property(key.toLower().toLatin1().constData()); if (propertyVariant.isValid()) { QVariantMap tagMap = propertyVariant.toMap(); if (tagMap.contains("tagName")) return tagMap["tagName"].toString(); } return QString(); } QVariantMap QAbstractContainer::serialize(QAbstractSerializer *serializer, bool *ok) { Q_ASSERT(serializer != nullptr); bool ret = false; QVariantMap serializerMap = property( serializer->tagKey().toLatin1().constData()).toMap(); QVariantMap propertiesMap = serializerMap["propertiesMap"].toMap(); QString tagName = serializerMap["tagName"].toString(); qprofileDebug(QtDebugMsg) << propertiesMap << tagName; QVariantMap serializeRetMap, serializedProperties; for (int propertyIdx = 0; propertyIdx < metaObject()->propertyCount(); propertyIdx++) { QMetaProperty property = metaObject()->property(propertyIdx); if (propertiesMap.keys().contains(QString(property.name()))) { serializedProperties[propertiesMap[property.name()].toString().trimmed().toLower()] = property.read(this); } } if (!tagName.isEmpty()) { serializeRetMap[tagName.trimmed().toLower()] = serializedProperties; } else { serializeRetMap = serializedProperties; } ret = true; if (ok != nullptr) *ok = ret; return serializeRetMap; } QAbstractContainer &QAbstractContainer::operator=(const QAbstractContainer &container) { copyProperty(container); foreach (QObject *child, children()) { delete child; } copyChildren(container); return *this; } QAbstractContainer::~QAbstractContainer() { delete m_mutex; delete m_triggerMutex; } void QAbstractContainer::customEvent(QEvent *event) { if (QGenericTopicEvent::topicEventType() == event->type()) { QGenericTopicEvent *topicEvent = static_cast<QGenericTopicEvent *>(event); QJson::Parser parser; bool ok = false; QVariant variant = parser.parse(topicEvent->message(), &ok); if (!ok) { qprofileDebug(QtWarningMsg) << "Get a unknown custom event! " << topicEvent->message(); return QObject::customEvent(event); } if (m_topic->getRestfulTopic(QAbstractTopic::command) == topicEvent->topic()) { if (QAbstractCommand::IsCommand(variant)) { model()->appendCommand(variant); } else { qprofileDebug(QtWarningMsg) << "Get a unknown command event! " << topicEvent->message(); } } else if (m_topic->getRestfulTopic(QAbstractTopic::trigger) == topicEvent->topic()) { if (QAbstractTrigger::IsTrigger(variant)) { model()->appendTrigger(variant); } else { qprofileDebug(QtWarningMsg) << "Get a unknown trigger event! " << topicEvent->message(); } } else if (m_topic->getRestfulTopic(QAbstractTopic::put) == topicEvent->topic()) { QGenericMessage message(this, topicEvent->topic(), variant); QString relativeTopic = QAbstractTopic::relativeTopic(topicEvent->topic()); const QMetaObject *meta = metaObject(); QString method = relativeTopic + "(QGenericMessage)"; int idx = meta->indexOfMethod(method.toLatin1().data()); if (idx > -1) { QMetaMethod restfulMethod = meta->method(idx); QByteArray ret; if (!restfulMethod.invoke(this, Qt::DirectConnection, Q_RETURN_ARG(QByteArray, ret), Q_ARG(QGenericMessage, message))) { qprofileDebug(QtDebugMsg) << "try restfulMethod.invoke " << relativeTopic << " failed in " << meta->className(); } else { // qprofileDebug(QtDebugMsg) << m_model.data() << m_model->toJson(); } } else { qprofileDebug(QtDebugMsg) << "Failed to find the method " << relativeTopic << " in " << meta->className(); } } } return QObject::customEvent(event); } bool QAbstractContainer::isCompatible(const QString feature) { QAbstractCompatibility *compatibility = QAbstractCompatibility::Instance(); if (compatibility != nullptr) { return compatibility->isCompatible(feature); } return false; } void QAbstractContainer::reportStatus(const QVariant &status) { QString topic = m_topic->getRestfulTopic(QAbstractTopic::status); bool ok = false; QJson::Serializer serializer; QVariantMap variantMap = status.toMap(); variantMap[QAbstractStatus::PropertyTopic] = topic; QByteArray json = serializer.serialize(variantMap, &ok); if (ok) { if (json.length() <= 0) { qprofileDebug(QtDebugMsg) << "Failed to serialize message " << topic << m_model->toJson() << " for " << metaObject()->className(); } else { if (0 == m_ipcClient->publish(topic, json, QAbstractIpcClient::QOS1)) { if (json.length() <= MAX_QPROFILE_DEBUG_LENGTH) { qprofileDebug(QtDebugMsg) << "Publish failed, topic = " << m_topic->getRestfulTopic( QAbstractTopic::status) << " message = " << json; } else { qprofileDebug(QtDebugMsg) << "Publish failed, topic = " << m_topic->getRestfulTopic(QAbstractTopic::status); } } else { if (json.length() <= MAX_QPROFILE_DEBUG_LENGTH) { qprofileDebug(QtDebugMsg) << this << "publish topic = " << topic << "content = " << json; } } } } else { qprofileDebug(QtCriticalMsg) << this << "Failed to json " << status; } } void QAbstractContainer::onCommand() { bool ok = m_mutex->tryLock(); if (ok) { QGenericCommand command(this); command.fromVariant(model()->takeCommand()); qprofileDebug(QtDebugMsg) << "id = " << command.id() << ", method = " << command.method(); QVariant statusVar; if (!processCommands(command.id(), command.method(), command.resource(), &statusVar)) { qprofileDebug(QtWarningMsg) << "processCommands failed!"; } if (statusVar.isValid()) { reportStatus(statusVar); } m_mutex->unlock(); } else { QTimer::singleShot(100, this, SLOT(onCommand())); } } bool QAbstractContainer::processCommands(const QString &commandId, const QString &commandType, QVariant commandVar, QVariant *status) { qprofileDebug(QtDebugMsg) << "This virtual function should be implemented in subclass." << commandType << commandVar; Q_ASSERT(false); return true; } void QAbstractContainer::onTrigger() { bool ok = m_triggerMutex->tryLock(); if (ok) { QVariant triggerVar = model()->takeTrigger(); qprofileDebug(QtDebugMsg) << "triggerVar = " << triggerVar; QVariant responseVar; if (triggerVar.isValid()) { if (!processTriggers(triggerVar, &responseVar)) { qprofileDebug(QtWarningMsg) << "processTriggers failed!"; } if (responseVar.isValid()) { reportResponse(responseVar); } } m_triggerMutex->unlock(); } else { QTimer::singleShot(100, this, SLOT(onTrigger())); } } bool QAbstractContainer::processTriggers(const QVariant triggerVar, QVariant *response) { qprofileDebug(QtDebugMsg) << "This virtual function should be implemented in subclass." << triggerVar; Q_ASSERT(false); return true; } void QAbstractContainer::reportResponse(const QVariant &response) { QString topic = m_topic->getRestfulTopic(QAbstractTopic::response); bool ok = false; QJson::Serializer serializer; QVariantMap variantMap = response.toMap(); QByteArray json = serializer.serialize(variantMap, &ok); if (ok) { if (json.length() <= 0) { qprofileDebug(QtDebugMsg) << "Failed to serialize message " << topic << m_model->toJson() << " for " << metaObject()->className(); } else { if (0 == m_ipcClient->publish(topic, json, QAbstractIpcClient::QOS1)) { if (json.length() <= MAX_QPROFILE_DEBUG_LENGTH) { qprofileDebug(QtDebugMsg) << "Publish failed, topic = " << topic << " message = " << json; } else { qprofileDebug(QtDebugMsg) << "Publish failed, topic = " << topic; } } else { if (json.length() <= MAX_QPROFILE_DEBUG_LENGTH) { qprofileDebug(QtDebugMsg) << this << "publish topic = " << topic << "content = " << json; } } } } else { qprofileDebug(QtCriticalMsg) << this << "Failed to json " << response; } } void QAbstractContainer::overwriteRetainModelMessage(quint32 api) { QString topic = m_topic->getRestfulTopic((QAbstractTopic::RestfulApi)api); if (!topic.isEmpty()) { QGenericMessage message(this); message.setTopic(topic); message.setContent(m_model->toVariant()); QByteArray json = message.toJson(); m_ipcClient->publish(topic, json, QAbstractIpcClient::QOS1, true); } } void QAbstractContainer::onModelChanged() { QString topic = m_topic->getRestfulTopic(QAbstractTopic::get); QGenericMessage message(this); message.setTopic(topic); message.setContent(m_model->toVariant()); QByteArray json = message.toJson(); if (json.length() <= 0) { qprofileDebug(QtDebugMsg) << "Failed to serialize message " << message.topic() << m_model->toJson() << " for " << metaObject()->className(); } else { if (0 == m_ipcClient->publish(topic, json, QAbstractIpcClient::QOS1, m_isRetainMessage)) { if (json.length() <= MAX_QPROFILE_DEBUG_LENGTH) { qprofileDebug(QtDebugMsg) << "Publish failed, topic = " << m_topic->getRestfulTopic( QAbstractTopic::get) << " message = " << json; } else { qprofileDebug(QtDebugMsg) << "Publish failed, topic = " << m_topic->getRestfulTopic( QAbstractTopic::get); } } else { if (json.length() <= MAX_QPROFILE_DEBUG_LENGTH) { if (qobject_cast<QTimer *>(sender()) == nullptr) { qprofileDebug(QtDebugMsg) << sender() << this << "publish topic = " << topic << "content = " << json; } } } } } const QByteArray QAbstractContainer::put(const QGenericMessage &message) { if (m_model != nullptr) { if (message.content() == model()->toVariant()) { return ""; } QJson::QObjectHelper::qvariant2qobject(message.content().toMap(), m_model.data()); return m_model->toJson(); } return QByteArray(); }
368c9123c3071305b8a5faa6969ef2299036d6b8
fd99b3c2c39589da1ef40c3397fedeb6cbef5558
/Code-chef/chef wars.cpp
31adf417a3d4b1569f2c5fbb77dc07266da52c32
[]
no_license
codeEmano/CompetitiveCodes
bc0e4f00e5f97bdd194b5e815521a05f4bdbaf0b
483f5900cf276039b3a52dd061655ff4201fbbb1
refs/heads/master
2020-08-29T15:59:35.159423
2020-08-16T15:01:02
2020-08-16T15:01:02
218,082,805
0
0
null
null
null
null
UTF-8
C++
false
false
418
cpp
chef wars.cpp
#include<bits/stdc++.h> using namespace std; void solve(long h,long p) { if(p>h) { cout<<"0 "<<endl; return; } while(h>0 && p>0) { h-=p; /*if(h==0) { cout<<"1"<<endl; return ; } */ //cout<<"h= "<<h<<" p= "<<p<<endl; p/=2; } if(h==0) { cout<<"1"<<endl; } else { cout<<"0"<<endl; } } int main() { int t; cin>>t; long h,p; while(t--) { cin>>h>>p; solve(h,p); } return 0; }
40a5f3895f32b84faad6b3490a0d69556438c0e9
55e143c0bbd2346b8573dba0c414babac7b8f4a5
/engine/lib/cpp-colors/include/cpp-colors/color_io.h
ca123739164982f2f69bde64e2dee335aa509e83
[ "Apache-2.0", "MIT" ]
permissive
ColinGilbert/noobwerkz-engine
27444332ff055ebb7c4b3a0594c23a22e7b730c5
f5670e98ca0dada8865be9ab82d25d3acf549ebe
refs/heads/master
2021-01-17T15:01:52.281427
2020-11-19T17:51:56
2020-11-19T17:51:56
34,536,649
21
3
null
null
null
null
UTF-8
C++
false
false
19,809
h
color_io.h
#pragma once #include <iosfwd> #include <iomanip> #include <string> #include <sstream> #include <limits> #include <type_traits> #include <cstdint> #include <cctype> #include <cassert> #include "color.h" #include "color_named.h" namespace colors { namespace { template <typename T> struct symbols; template <> struct symbols<char> { static const char sharp = '#'; static const char zero = '0'; static const char a = 'a'; static const char r = 'r'; static const char g = 'g'; static const char b = 'b'; static const char round_bracket_open = '('; static const char round_bracket_close = ')'; static const char comma = ','; static const char number_0 = '0'; static const char number_9 = '9'; static const char char_A = 'A'; static const char char_F = 'F'; static const char char_a = 'a'; static const char char_f = 'f'; static const char* const rgb_tag() { return "rgb"; } static const char* const argb_tag() { return "argb"; } static const char to_lower(char ch) { return static_cast<char>(std::tolower(ch)); } }; template <> struct symbols<wchar_t> { static const wchar_t sharp = L'#'; static const wchar_t zero = L'0'; static const wchar_t a = L'a'; static const wchar_t r = L'r'; static const wchar_t g = L'g'; static const wchar_t b = L'b'; static const wchar_t number_0 = L'0'; static const wchar_t number_9 = L'9'; static const wchar_t char_A = L'A'; static const wchar_t char_F = L'F'; static const wchar_t char_a = L'a'; static const wchar_t char_f = L'f'; static const wchar_t round_bracket_open = L'('; static const wchar_t round_bracket_close = L')'; static const wchar_t comma = L','; static const wchar_t* const rgb_tag() { return L"rgb"; } static const wchar_t* const argb_tag() { return L"argb"; } static const wchar_t to_lower(wchar_t ch) { return static_cast<wchar_t>(towlower(ch)); } }; // Convert to [Color RGB with Alpha argb(a,r,g,b)] template <typename CharT, typename T, typename PixelTraits, bool is_floating_point> struct to_argb_str_dispatch; template <typename CharT, typename T, typename PixelTraits> struct to_argb_str_dispatch<CharT, T, PixelTraits, false> { typedef basic_color<T, PixelTraits> color_type; typedef std::basic_string<CharT> string_type; color_type c; to_argb_str_dispatch(const color_type& ci) : c(ci) { } operator string_type() { typedef std::basic_ostringstream<CharT> ostringstream_type; ostringstream_type oss; oss << symbols<CharT>::argb_tag() << symbols<CharT>::round_bracket_open << static_cast<uint32_t>(c.a) << symbols<CharT>::comma << static_cast<uint32_t>(c.r) << symbols<CharT>::comma << static_cast<uint32_t>(c.g) << symbols<CharT>::comma << static_cast<uint32_t>(c.b) << symbols<CharT>::round_bracket_close; return oss.str(); } }; template <typename CharT, typename T, typename PixelTraits> struct to_argb_str_dispatch<CharT, T, PixelTraits, true> { typedef basic_color<uint8_t, PixelTraits> color_type; typedef basic_color<T, PixelTraits> color_double_type; typedef std::basic_string<CharT> string_type; color_type c; to_argb_str_dispatch(const color_double_type& cf) : c(cf) { } operator string_type() { return to_argb_str_dispatch<CharT, typename color_type::value_type, typename color_type::pixel_traits_type, false>(c); } }; // Convert to [Color RGB rgb(r,g,b)], ignore alpha template <typename CharT, typename T, typename PixelTraits, bool is_floating_point> struct to_rgb_str_dispatch; template <typename CharT, typename T, typename PixelTraits> struct to_rgb_str_dispatch<CharT, T, PixelTraits, false> { typedef basic_color<T, PixelTraits> color_type; typedef std::basic_string<CharT> string_type; color_type c; to_rgb_str_dispatch(const color_type& ci) : c(ci) { } operator string_type() { typedef std::basic_ostringstream<CharT> ostringstream_type; ostringstream_type oss; oss << symbols<CharT>::rgb_tag() << symbols<CharT>::round_bracket_open << static_cast<uint32_t>(c.r) << symbols<CharT>::comma << static_cast<uint32_t>(c.g) << symbols<CharT>::comma << static_cast<uint32_t>(c.b) << symbols<CharT>::round_bracket_close; return oss.str(); } }; template <typename CharT, typename T, typename PixelTraits> struct to_rgb_str_dispatch<CharT, T, PixelTraits, true> { typedef basic_color<uint8_t, PixelTraits> color_type; typedef basic_color<T, PixelTraits> color_double_type; typedef std::basic_string<CharT> string_type; color_type c; to_rgb_str_dispatch(const color_double_type& cf) : c(cf) { } operator string_type() { return to_rgb_str_dispatch<CharT, typename color_type::value_type, typename color_type::pixel_traits_type, false>(c); } }; // Convert to [Color HEX with Alpha (#AARRGGBB)] template <typename CharT, typename T, typename PixelTraits, bool is_floating_point> struct to_ahex_str_dispatch; template <typename CharT, typename T, typename PixelTraits> struct to_ahex_str_dispatch<CharT, T, PixelTraits, false> { typedef basic_color<T, PixelTraits> color_type; typedef std::basic_string<CharT> string_type; color_type c; to_ahex_str_dispatch(const color_type& ci) : c(ci) { } operator string_type() { typedef std::basic_ostringstream<CharT> ostringstream_type; ostringstream_type oss; oss << symbols<CharT>::sharp << std::hex << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.a) << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.r) << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.g) << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.b); return oss.str(); } }; template <typename CharT, typename T, typename PixelTraits> struct to_ahex_str_dispatch<CharT, T, PixelTraits, true> { typedef basic_color<uint8_t, PixelTraits> color_type; typedef basic_color<T, PixelTraits> color_double_type; typedef std::basic_string<CharT> string_type; color_type c; to_ahex_str_dispatch(const color_double_type& cf) : c(cf) { } operator string_type() { return to_ahex_str_dispatch<CharT, typename color_type::value_type, typename color_type::pixel_traits_type, false>(c); } }; // Convert to [Color HEX (#RRGGBB)], ignore alpha template <typename CharT, typename T, typename PixelTraits, bool is_floating_point> struct to_hex_str_dispatch; template <typename CharT, typename T, typename PixelTraits> struct to_hex_str_dispatch<CharT, T, PixelTraits, false> { typedef basic_color<T, PixelTraits> color_type; typedef std::basic_string<CharT> string_type; color_type c; to_hex_str_dispatch(const color_type& ci) : c(ci) { } operator string_type() { typedef std::basic_ostringstream<CharT> ostringstream_type; ostringstream_type oss; oss << symbols<CharT>::sharp << std::hex << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.r) << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.g) << std::setw(2) << std::setfill(symbols<CharT>::zero) << static_cast<uint32_t>(c.b); return oss.str(); } }; template <typename CharT, typename T, typename PixelTraits> struct to_hex_str_dispatch<CharT, T, PixelTraits, true> { typedef basic_color<uint8_t, PixelTraits> color_type; typedef basic_color<T, PixelTraits> color_double_type; typedef std::basic_string<CharT> string_type; color_type c; to_hex_str_dispatch(const color_double_type& cf) : c(cf) { } operator string_type() { return to_hex_str_dispatch<CharT, typename color_type::value_type, typename color_type::pixel_traits_type, false>(c); } }; template <typename T, typename PixelTraits> void assign_color_value(basic_color<T, PixelTraits>& c, size_t idx, typename basic_color<T, PixelTraits>::channel_type value) { assert(idx < 4 && "IndexOutOfRange"); switch (idx) { case 0: c.a = value; break; case 1: c.r = value; break; case 2: c.g = value; break; case 3: c.b = value; break; }; } } // end of anonymous namespace // Write named color template <typename ColorMapper, typename CharT, typename CharTraits, typename T, typename PixelTraits> inline std::basic_ostream<CharT, CharTraits>& write_named_color(std::basic_ostream<CharT, CharTraits>& os, const basic_color<T, PixelTraits>& c) { typedef basic_named_color_converter<ColorMapper> color_converter; if (color_converter::is_named(c.value())) { os << color_converter::name(c.value()); } return os; } // Read named color template <typename ColorMapper, typename CharT, typename CharTraits, typename T, typename PixelTraits> inline std::basic_istream<CharT, CharTraits>& read_named_color(std::basic_istream<CharT, CharTraits>& is, basic_color<T, PixelTraits>& c) { typedef std::basic_string<CharT, CharTraits> string_type; typedef basic_named_color_converter<ColorMapper> named_converter; string_type name; if (is >> name) { if (named_converter::is_named(name)) { c = basic_color<T, PixelTraits>(value_of(named_converter::value(name))); } else { is.setstate(std::ios_base::failbit); } } return is; } // Convert to [Color HEX (#RRGGBB)], ignore alpha template <typename CharT, typename T, typename PixelTraits> inline std::basic_string<CharT> to_hex_str(const basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; return to_hex_str_dispatch<CharT, T, PixelTraits, std::is_floating_point<typename color_type::value_type>::value >(c); } // Convert to [Color HEX with Alpha (#AARRGGBB)] template <typename CharT, typename T, typename PixelTraits> inline std::basic_string<CharT> to_ahex_str(const basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; return to_ahex_str_dispatch<CharT, T, PixelTraits, std::is_floating_point<typename color_type::value_type>::value >(c); } // Convert to [Color RGB rgb(r,g,b)], ignore alpha template <typename CharT, typename T, typename PixelTraits> inline std::basic_string<CharT> to_rgb_str(const basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; return to_rgb_str_dispatch<CharT, T, PixelTraits, std::is_floating_point<typename color_type::value_type>::value >(c); } // Convert to [Color RGB with Alpha argb(a,r,g,b)] template <typename CharT, typename T, typename PixelTraits> inline std::basic_string<CharT> to_argb_str(const basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; return to_argb_str_dispatch<CharT, T, PixelTraits, std::is_floating_point<typename color_type::value_type>::value >(c); } template <typename CharT, typename CharTraits, typename T, typename PixelTraits> inline std::basic_ostream<CharT, CharTraits>& operator<<(std::basic_ostream<CharT, CharTraits>& os, const basic_color<T, PixelTraits>& c) { std::basic_ostringstream<CharT, CharTraits, std::allocator<CharT> > oss; oss.flags(os.flags()); oss.imbue(os.getloc()); oss.precision(os.precision()); oss << to_argb_str<CharT>(c); return os << oss.str().c_str(); } template <typename CharT, typename CharTraits, typename T, typename PixelTraits> void parse_hex(std::basic_istream<CharT, CharTraits>& is, basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; typedef typename color_type::channel_type channel_type; typedef std::basic_stringstream<CharT, CharTraits, std::allocator<CharT> > stringstream_type; // allowed format #RRGGBB or #AARRGGBB CharT ch; if (is >> ch && ch != symbols<CharT>::sharp) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { bool is_argb = true; const size_t data_len = 4; for (size_t i = 0; i != data_len; ++i) { // parse HEX channel_type chv = 0; const size_t hex_len = 2; for (size_t j = 0; j != hex_len; ++j) { if (is >> ch && ((ch <= symbols<CharT>::number_9 && symbols<CharT>::number_0 <= ch) || (symbols<CharT>::char_a <= ch && ch <= symbols<CharT>::char_f) || (symbols<CharT>::char_A <= ch && ch <= symbols<CharT>::char_F))) { CharT ch1 = symbols<CharT>::to_lower(ch); channel_type val = 0; if (ch1 <= symbols<CharT>::number_9 && symbols<CharT>::number_0 <= ch1) { val = static_cast<channel_type>(ch1 - symbols<CharT>::number_0); } else { // ('a' <= ch1 && ch1 <= 'f') val = static_cast<channel_type>(10 + (ch1 - symbols<CharT>::char_a)); } chv <<= 4; chv |= val; } else { is.putback(ch); if (i < data_len - 1) { is.setstate(std::ios_base::failbit); } else { is.clear(); is_argb = false; } break; } } if (!is) break; // #AARRGGBB assign_color_value(c, i, chv); } // for if (!is_argb) { // we have RGB instead of ARGB, adjust colors c.b = c.g; c.g = c.r; c.r = c.a; c.a = color_type::element_traits_type::max_a(); } } } template <typename CharT, typename CharTraits, typename T, typename PixelTraits> void parse_argb(std::basic_istream<CharT, CharTraits>& is, basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; typedef typename color_type::channel_type channel_type; typedef std::basic_stringstream<CharT, CharTraits, std::allocator<CharT> > stringstream_type; CharT ch; if (is >> ch && ch != symbols<CharT>::a) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::r) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::g) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::b) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::round_bracket_open) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { const size_t data_len = 4; for (size_t i = 0; i != data_len; ++i) { unsigned int chv; bool is_stop = false; if (is >> std::ws >> chv >> ch && ch != symbols<CharT>::comma) { is.putback(ch); if (i < data_len - 1) is.setstate(std::ios_base::failbit); is_stop = true; } assign_color_value(c, i, static_cast<channel_type>(chv)); if (is_stop) break; } if (is >> ch && ch != symbols<CharT>::round_bracket_close) { is.putback(ch); is.setstate(std::ios_base::failbit); } } } } } } } template <typename CharT, typename CharTraits, typename T, typename PixelTraits> void parse_rgb(std::basic_istream<CharT, CharTraits>& is, basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; typedef typename color_type::channel_type channel_type; typedef std::basic_stringstream<CharT, CharTraits, std::allocator<CharT> > stringstream_type; CharT ch; if (is >> ch && ch != symbols<CharT>::r) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::g) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::b) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { if (is >> ch && ch != symbols<CharT>::round_bracket_open) { is.putback(ch); is.setstate(std::ios_base::failbit); } else if (!is.fail()) { const size_t data_len = 3; for (size_t i = 0; i != data_len; ++i) { unsigned int chv; bool is_stop = false; if (is >> std::ws >> chv >> ch && ch != symbols<CharT>::comma) { is.putback(ch); if (i < data_len - 1) is.setstate(std::ios_base::failbit); is_stop = true; } assign_color_value(c, i + 1, static_cast<channel_type>(chv)); // i==0 --- Alpha if (is_stop) break; } if (is >> ch && ch != symbols<CharT>::round_bracket_close) { is.putback(ch); is.setstate(std::ios_base::failbit); } } } } } } template <typename CharT, typename CharTraits, typename T, typename PixelTraits> inline std::basic_istream<CharT, CharTraits>& operator>>(std::basic_istream<CharT, CharTraits>& is, basic_color<T, PixelTraits>& c) { typedef basic_color<T, PixelTraits> color_type; typedef typename color_type::channel_type channel_type; typedef std::basic_stringstream<CharT, CharTraits, std::allocator<CharT> > stringstream_type; // Parse Formats: // * Color HEX -- #RRGGBB // * Color HEX with Alpha(AHEX) -- #AARRGGBB // * Color RGB -- rgb(r,g,b) // * Color RGB with Alpha(ARGB) -- argb(a,r,g,b) // OR // * We recognize one of the named colors. See: color_named.h CharT ch; if (is >> ch) { is.putback(ch); if (ch != symbols<CharT>::sharp && ch != symbols<CharT>::r && ch != symbols<CharT>::a) { //read_named_color<wpf_color_mapper>(is, c); is.setstate(std::ios_base::failbit); } else { if (ch == symbols<CharT>::sharp) { parse_hex(is, c); } else if (ch == symbols<CharT>::a) { parse_argb(is, c); } else if (ch == symbols<CharT>::r) { parse_rgb(is, c); } else { is.setstate(std::ios_base::failbit); } } } else { is.setstate(std::ios_base::failbit); } return is; } } // namespace colors
1ffc1337ca1f445c80075a9df12075d12b730b05
ce2f4436aaf2a5b329e6bde121f74ab2eb954341
/MS6/Menu.cpp
5285e49b1e091f4a39195d10df344ace6a5605fd
[]
no_license
PriyaKhatri7/BTP200-CPP-Summ2022
7cf032e653683c820efa0c21db4f62f4a900adb5
7daf16ae422e8ca0870e8c1d538bf699fa4440bb
refs/heads/master
2023-01-22T22:14:24.520413
2020-08-09T22:23:44
2020-08-09T22:23:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,018
cpp
Menu.cpp
/*I have done all the coding by myself and only copied the code that my professor provided to complete my workshops and assignments. Priya Khatri | 110149176 | pkhatri4@myseneca.ca*/ #include <iostream> #include <cstring> #include <iomanip> #include "Menu.h" using namespace std; namespace sdds { MenuItem::MenuItem() { m_menuItem = nullptr; } MenuItem::MenuItem(const char* item) { if (item != nullptr) { m_menuItem = new char[strlen(item) + 1]; //allocate new memory if needed strcpy(m_menuItem, item); } else { m_menuItem = nullptr; } } Menu::~Menu() { delete[] m_title; m_title = nullptr; } MenuItem::~MenuItem() { delete[] m_menuItem; m_menuItem = nullptr; } void MenuItem::display() { if (this->m_menuItem != nullptr) { cout << this->m_menuItem << "\n" << endl; } } Menu::Menu() { m_title = nullptr; m_indentation = 0; m_index = 0; //check to make sure MAX_NO_OF_ITEMS/menuItem is set to empty if array index is 0 for (int i = 0; i < MAX_NO_OF_ITEMS; i++) { m_items[i] = nullptr; } } Menu::Menu(const char* title, int indentation) : Menu() //call default ot set empty { if (title != nullptr) { //allocate new memory and copy values m_title = new char[strlen(title) + 1]; strcpy(m_title, title); m_indentation = indentation; } } Menu::Menu(const Menu& src) : Menu() //copy constructor { *this = src; } Menu& Menu::operator=(const Menu& src) { if (this != &src) //check for self-assignment { for (int i = 0; i < m_index; i++) { delete m_items[i]; m_items[i] = nullptr; } m_indentation = src.m_indentation; m_index = src.m_index; //deep copying for (int i = 0; i < m_index; i++) { m_items[i] = new MenuItem(src.m_items[i]->m_menuItem); } if (src.m_title != nullptr) //allocate new memory if needed { m_title = new char[strlen(src.m_title) + 1]; strcpy(m_title, src.m_title); } else { m_title = nullptr; } } return *this; } bool Menu::isEmpty() const { if (m_title == nullptr) { return false; } else { return true; } } void Menu::display() const { if (!isEmpty()) { cout << "Invalid Menu!" << endl; } else if (this->m_items[0] == nullptr) { cout.width(strlen(m_title) + 8); cout << this->m_title << endl; cout << "No Items to display!" << endl; } else { if (m_indentation == 2) { cout.width(strlen(m_title) + 8); cout << m_title << endl; int i; for (i = 0; i < m_index; i++) { cout.width(9); cout << i + 1 << "- " << m_items[i]->m_menuItem << "\n"; } cout.width(10); cout << "> "; } else if (m_indentation == 1) { cout.width(strlen(m_title) + 4); cout << m_title << endl; int i; for (i = 0; i < m_index; i++) { cout.width(5); cout << i + 1 << "- " << m_items[i]->m_menuItem << "\n"; } cout.width(6); cout << "> "; } else { cout << this->m_title << endl; int i; for (i = 0; i < m_index; i++) { cout << i + 1 << "- " << m_items[i]->m_menuItem << "\n"; } cout << "> "; } } } Menu::operator bool() const { if (isEmpty()) { return true; } else { return false; } } Menu::operator int() const { int mcast = run(); //if Menu is cased to interger then call run() and it's value is returned as int cast value return mcast; } void Menu::add(const char* newMenuItem) { if (newMenuItem != nullptr && m_index != MAX_NO_OF_ITEMS) { m_items[m_index] = new MenuItem(newMenuItem); this->m_index++; } else { *this = Menu(); } } Menu& Menu::operator<<(const char* newMenuItem) { if (newMenuItem != nullptr && m_index != MAX_NO_OF_ITEMS) { m_items[m_index] = new MenuItem(newMenuItem); this->m_index++; } else { *this = Menu(); } return *this; } int Menu::run() const { int option; //collect the user's input display(); if (m_index > 0 && isEmpty()) { cin >> option; cin.ignore(9000, '\n'); while (true) { if (cin.fail()) { //if user enters non-integer value. wait for user's response cout << "Invalid Integer, try again: "; cin.clear(); cin.ignore(9000, '\n'); } //input is int but out of boundary of the available options. wait for user else if (option <= 0 || option > m_index) { cout << "Invalid selection, try again: "; } else //valid option. return option { break; } cin >> option; cin.ignore(9000, '\n'); } } else { option = 0; //if menu has no menuitems then returns with no user interaction } return option; } }
ceb3cc48dd4cca1c30c33d6709d6c0501a5a7c9c
ca5f51c4fecdb3cca7ffc0544c17de0c412086f8
/Arrays/Subarray/Maximum sum subarray of size between a and b.cpp
e720270d5fa400080e9543bb554cba2ae4ed880c
[]
no_license
avinashw50w/ds_algo
f517bbb326a922258e6ef7816e6c06593a2d06aa
bc73bd617486ab8fcbbdd8a076cacd3761c6c954
refs/heads/master
2023-07-22T17:44:44.815336
2023-07-13T07:38:22
2023-07-13T07:38:22
193,303,550
0
3
null
null
null
null
UTF-8
C++
false
false
482
cpp
Maximum sum subarray of size between a and b.cpp
/*Find the maximum sum among all those subarrays whose size is between a and b.*/ int solve(vector<int> A, int a, int b) { int n = A.size(); int sum[n + 1] = {}; for (int i = 0; i < n; ++i) { sum[i + 1] = A[i] + sum[i]; } set<array<int, 2>> st; int ans = -1e9; for (int i = 0; i <= n; ++i) { if (i >= a) st.insert({sum[i - a], i - a}); if (st.size()) ans = max(ans, sum[i] - (*st.begin())[0]); if (i >= b) st.erase({sum[i - b], i - b}); } return ans; }
0d71f54661d20fc7496eda79988e64ee726608dd
3a436656efff41eb12e557f4bff091404515271e
/lesson-2/random-rgb.cpp
7fb18d76885ce2b6c95dd0a0758985e697ba621d
[ "MIT" ]
permissive
KSXGitHub/practice-opencv-at-the-lab
ed8e277c3f990f9255fa2effb988c951654f3186
f0258a7196c7107e4062e45eaf8d0cbf3f248089
refs/heads/master
2021-01-17T22:58:22.454338
2017-04-10T05:43:27
2017-04-10T05:43:27
84,207,888
0
0
null
null
null
null
UTF-8
C++
false
false
357
cpp
random-rgb.cpp
#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace std; using namespace cv; int main () { Mat mat(512, 512, CV_8UC3); randu(mat, 0, 255); const string title = "The Random Matrix"; cout << title << ":\n" << mat << endl; namedWindow(title); imshow(title, mat); waitKey(); return 0; }
7f66559cb5992956cbf95b96c48015bffffb16fd
635c344550534c100e0a86ab318905734c95390d
/wpinet/src/main/native/include/wpinet/WebSocket.h
6e886c39414f03e55d95e5da0e2f8f65aaa095f5
[ "BSD-3-Clause" ]
permissive
wpilibsuite/allwpilib
2435cd2f5c16fb5431afe158a5b8fd84da62da24
8f3d6a1d4b1713693abc888ded06023cab3cab3a
refs/heads/main
2023-08-23T21:04:26.896972
2023-08-23T17:47:32
2023-08-23T17:47:32
24,655,143
986
769
NOASSERTION
2023-09-14T03:51:22
2014-09-30T20:51:33
C++
UTF-8
C++
false
false
17,090
h
WebSocket.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 WPINET_WEBSOCKET_H_ #define WPINET_WEBSOCKET_H_ #include <stdint.h> #include <functional> #include <initializer_list> #include <memory> #include <span> #include <string> #include <string_view> #include <utility> #include <wpi/Signal.h> #include <wpi/SmallVector.h> #include "wpinet/uv/Buffer.h" #include "wpinet/uv/Error.h" #include "wpinet/uv/Timer.h" namespace wpi { namespace uv { class Stream; } // namespace uv /** * RFC 6455 compliant WebSocket client and server implementation. */ class WebSocket : public std::enable_shared_from_this<WebSocket> { struct private_init {}; static constexpr uint8_t kOpCont = 0x00; static constexpr uint8_t kOpText = 0x01; static constexpr uint8_t kOpBinary = 0x02; static constexpr uint8_t kOpClose = 0x08; static constexpr uint8_t kOpPing = 0x09; static constexpr uint8_t kOpPong = 0x0A; static constexpr uint8_t kOpMask = 0x0F; static constexpr uint8_t kFlagFin = 0x80; public: WebSocket(uv::Stream& stream, bool server, const private_init&); WebSocket(const WebSocket&) = delete; WebSocket(WebSocket&&) = delete; WebSocket& operator=(const WebSocket&) = delete; WebSocket& operator=(WebSocket&&) = delete; ~WebSocket(); /** * Connection states. */ enum State { /** The connection is not yet open. */ CONNECTING = 0, /** The connection is open and ready to communicate. */ OPEN, /** The connection is in the process of closing. */ CLOSING, /** The connection failed. */ FAILED, /** The connection is closed. */ CLOSED }; /** * Client connection options. */ struct ClientOptions { ClientOptions() : handshakeTimeout{(uv::Timer::Time::max)()} {} /** Timeout for the handshake request. */ uv::Timer::Time handshakeTimeout; // NOLINT /** Additional headers to include in handshake. */ std::span<const std::pair<std::string_view, std::string_view>> extraHeaders; }; /** * Frame. Used by SendFrames(). */ struct Frame { static constexpr uint8_t kText = kFlagFin | kOpText; static constexpr uint8_t kBinary = kFlagFin | kOpBinary; static constexpr uint8_t kTextFragment = kOpText; static constexpr uint8_t kBinaryFragment = kOpBinary; static constexpr uint8_t kFragment = kOpCont; static constexpr uint8_t kFinalFragment = kFlagFin | kOpCont; static constexpr uint8_t kPing = kFlagFin | kOpPing; static constexpr uint8_t kPong = kFlagFin | kOpPong; Frame(uint8_t opcode, std::span<const uv::Buffer> data) : opcode{opcode}, data{data} {} uint8_t opcode; std::span<const uv::Buffer> data; }; /** * Starts a client connection by performing the initial client handshake. * An open event is emitted when the handshake completes. * This sets the stream user data to the websocket. * @param stream Connection stream * @param uri The Request-URI to send * @param host The host or host:port to send * @param protocols The list of subprotocols * @param options Handshake options */ static std::shared_ptr<WebSocket> CreateClient( uv::Stream& stream, std::string_view uri, std::string_view host, std::span<const std::string_view> protocols = {}, const ClientOptions& options = {}); /** * Starts a client connection by performing the initial client handshake. * An open event is emitted when the handshake completes. * This sets the stream user data to the websocket. * @param stream Connection stream * @param uri The Request-URI to send * @param host The host or host:port to send * @param protocols The list of subprotocols * @param options Handshake options */ static std::shared_ptr<WebSocket> CreateClient( uv::Stream& stream, std::string_view uri, std::string_view host, std::initializer_list<std::string_view> protocols, const ClientOptions& options = {}) { return CreateClient(stream, uri, host, {protocols.begin(), protocols.end()}, options); } /** * Starts a server connection by performing the initial server side handshake. * This should be called after the HTTP headers have been received. * An open event is emitted when the handshake completes. * This sets the stream user data to the websocket. * @param stream Connection stream * @param key The value of the Sec-WebSocket-Key header field in the client * request * @param version The value of the Sec-WebSocket-Version header field in the * client request * @param protocol The subprotocol to send to the client (in the * Sec-WebSocket-Protocol header field). */ static std::shared_ptr<WebSocket> CreateServer( uv::Stream& stream, std::string_view key, std::string_view version, std::string_view protocol = {}); /** * Get connection state. */ State GetState() const { return m_state; } /** * Return if the connection is open. Messages can only be sent on open * connections. */ bool IsOpen() const { return m_state == OPEN; } /** * Get the underlying stream. */ uv::Stream& GetStream() const { return m_stream; } /** * Get the selected sub-protocol. Only valid in or after the open() event. */ std::string_view GetProtocol() const { return m_protocol; } /** * Set the maximum message size. Default is 128 KB. If configured to combine * fragments this maximum applies to the entire message (all combined * fragments). * @param size Maximum message size in bytes */ void SetMaxMessageSize(size_t size) { m_maxMessageSize = size; } /** * Set whether or not fragmented frames should be combined. Default is to * combine. If fragmented frames are combined, the text and binary callbacks * will always have the second parameter (fin) set to true. * @param combine True if fragmented frames should be combined. */ void SetCombineFragments(bool combine) { m_combineFragments = combine; } /** * Initiate a closing handshake. * @param code A numeric status code (defaults to 1005, no status code) * @param reason A human-readable string explaining why the connection is * closing (optional). */ void Close(uint16_t code = 1005, std::string_view reason = {}); /** * Send a text message. * @param data UTF-8 encoded data to send * @param callback Callback which is invoked when the write completes. */ void SendText( std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kFlagFin | kOpText, data, std::move(callback)); } /** * Send a text message. * @param data UTF-8 encoded data to send * @param callback Callback which is invoked when the write completes. */ void SendText( std::initializer_list<uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendText({data.begin(), data.end()}, std::move(callback)); } /** * Send a binary message. * @param data Data to send * @param callback Callback which is invoked when the write completes. */ void SendBinary( std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kFlagFin | kOpBinary, data, std::move(callback)); } /** * Send a binary message. * @param data Data to send * @param callback Callback which is invoked when the write completes. */ void SendBinary( std::initializer_list<uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendBinary({data.begin(), data.end()}, std::move(callback)); } /** * Send a text message fragment. This must be followed by one or more * SendFragment() calls, where the last one has fin=True, to complete the * message. * @param data UTF-8 encoded data to send * @param callback Callback which is invoked when the write completes. */ void SendTextFragment( std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kOpText, data, std::move(callback)); } /** * Send a text message fragment. This must be followed by one or more * SendFragment() calls, where the last one has fin=True, to complete the * message. * @param data UTF-8 encoded data to send * @param callback Callback which is invoked when the write completes. */ void SendTextFragment( std::initializer_list<uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendTextFragment({data.begin(), data.end()}, std::move(callback)); } /** * Send a text message fragment. This must be followed by one or more * SendFragment() calls, where the last one has fin=True, to complete the * message. * @param data Data to send * @param callback Callback which is invoked when the write completes. */ void SendBinaryFragment( std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kOpBinary, data, std::move(callback)); } /** * Send a text message fragment. This must be followed by one or more * SendFragment() calls, where the last one has fin=True, to complete the * message. * @param data Data to send * @param callback Callback which is invoked when the write completes. */ void SendBinaryFragment( std::initializer_list<uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendBinaryFragment({data.begin(), data.end()}, std::move(callback)); } /** * Send a continuation frame. This is used to send additional parts of a * message started with SendTextFragment() or SendBinaryFragment(). * @param data Data to send * @param fin Set to true if this is the final fragment of the message * @param callback Callback which is invoked when the write completes. */ void SendFragment( std::span<const uv::Buffer> data, bool fin, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kOpCont | (fin ? kFlagFin : 0), data, std::move(callback)); } /** * Send a continuation frame. This is used to send additional parts of a * message started with SendTextFragment() or SendBinaryFragment(). * @param data Data to send * @param fin Set to true if this is the final fragment of the message * @param callback Callback which is invoked when the write completes. */ void SendFragment( std::initializer_list<uv::Buffer> data, bool fin, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendFragment({data.begin(), data.end()}, fin, std::move(callback)); } /** * Send a ping frame with no data. * @param callback Optional callback which is invoked when the ping frame * write completes. */ void SendPing(std::function<void(uv::Error)> callback = nullptr) { SendPing({}, [f = std::move(callback)](auto bufs, uv::Error err) { if (f) { f(err); } }); } /** * Send a ping frame. * @param data Data to send in the ping frame * @param callback Callback which is invoked when the ping frame * write completes. */ void SendPing( std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kFlagFin | kOpPing, data, std::move(callback)); } /** * Send a ping frame. * @param data Data to send in the ping frame * @param callback Callback which is invoked when the ping frame * write completes. */ void SendPing( std::initializer_list<uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendPing({data.begin(), data.end()}, std::move(callback)); } /** * Send a pong frame with no data. * @param callback Optional callback which is invoked when the pong frame * write completes. */ void SendPong(std::function<void(uv::Error)> callback = nullptr) { SendPong({}, [f = std::move(callback)](auto bufs, uv::Error err) { if (f) { f(err); } }); } /** * Send a pong frame. * @param data Data to send in the pong frame * @param callback Callback which is invoked when the pong frame * write completes. */ void SendPong( std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { Send(kFlagFin | kOpPong, data, std::move(callback)); } /** * Send a pong frame. * @param data Data to send in the pong frame * @param callback Callback which is invoked when the pong frame * write completes. */ void SendPong( std::initializer_list<uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendPong({data.begin(), data.end()}, std::move(callback)); } /** * Send multiple frames. * * @param frames Frame type/data pairs * @param callback Callback which is invoked when the write completes. */ void SendFrames( std::span<const Frame> frames, std::function<void(std::span<uv::Buffer>, uv::Error)> callback); /** * Fail the connection. */ void Fail(uint16_t code = 1002, std::string_view reason = "protocol error"); /** * Forcibly close the connection. */ void Terminate(uint16_t code = 1006, std::string_view reason = "terminated"); /** * Gets user-defined data. * @return User-defined data if any, nullptr otherwise. */ template <typename T = void> std::shared_ptr<T> GetData() const { return std::static_pointer_cast<T>(m_data); } /** * Sets user-defined data. * @param data User-defined arbitrary data. */ void SetData(std::shared_ptr<void> data) { m_data = std::move(data); } /** * Shuts down and closes the underlying stream. */ void Shutdown(); /** * Open event. Emitted when the connection is open and ready to communicate. * The parameter is the selected subprotocol. */ sig::Signal<std::string_view> open; /** * Close event. Emitted when the connection is closed. The first parameter * is a numeric value indicating the status code explaining why the connection * has been closed. The second parameter is a human-readable string * explaining the reason why the connection has been closed. */ sig::Signal<uint16_t, std::string_view> closed; /** * Text message event. Emitted when a text message is received. * The first parameter is the data, the second parameter is true if the * data is the last fragment of the message. */ sig::Signal<std::string_view, bool> text; /** * Binary message event. Emitted when a binary message is received. * The first parameter is the data, the second parameter is true if the * data is the last fragment of the message. */ sig::Signal<std::span<const uint8_t>, bool> binary; /** * Ping event. Emitted when a ping message is received. A pong message is * automatically sent in response, so this is simply a notification. */ sig::Signal<std::span<const uint8_t>> ping; /** * Pong event. Emitted when a pong message is received. */ sig::Signal<std::span<const uint8_t>> pong; private: // user data std::shared_ptr<void> m_data; // constructor parameters uv::Stream& m_stream; bool m_server; // subprotocol, set via constructor (server) or handshake (client) std::string m_protocol; // user-settable configuration size_t m_maxMessageSize = 128 * 1024; bool m_combineFragments = true; // operating state State m_state = CONNECTING; // incoming message buffers/state SmallVector<uint8_t, 14> m_header; size_t m_headerSize = 0; SmallVector<uint8_t, 1024> m_payload; size_t m_frameStart = 0; uint64_t m_frameSize = UINT64_MAX; uint8_t m_fragmentOpcode = 0; // temporary data used only during client handshake class ClientHandshakeData; std::unique_ptr<ClientHandshakeData> m_clientHandshake; void StartClient(std::string_view uri, std::string_view host, std::span<const std::string_view> protocols, const ClientOptions& options); void StartServer(std::string_view key, std::string_view version, std::string_view protocol); void SendClose(uint16_t code, std::string_view reason); void SetClosed(uint16_t code, std::string_view reason, bool failed = false); void HandleIncoming(uv::Buffer& buf, size_t size); void Send(uint8_t opcode, std::span<const uv::Buffer> data, std::function<void(std::span<uv::Buffer>, uv::Error)> callback) { SendFrames({{Frame{opcode, data}}}, std::move(callback)); } }; } // namespace wpi #endif // WPINET_WEBSOCKET_H_
cced38b7a770e3b8eb265d3ab8db880133e04cc3
43083741d5eb9bc75e5bcafe5696bbfc0d79ef92
/CR694/A.cpp
d40671bcbf08d39810094d6527f6d6f03db73df3
[]
no_license
shubhamamsa/Code-Forces
bf6bdb57ef801bfe48aa218e60dd2beaa0997aa7
e45dbf4c70ae10abfd6960cffccd2d4242b695ac
refs/heads/master
2021-12-23T22:25:07.588221
2021-09-28T14:14:44
2021-09-28T14:14:44
187,487,958
0
0
null
null
null
null
UTF-8
C++
false
false
538
cpp
A.cpp
#include<bits/stdc++.h> #define mod 1000000007 using namespace std; void subMain() { long long n, x; cin >> n >> x; long long a[n]; for(int i=0;i<n;i++) cin >> a[i]; long long a1 = 0, a2 = 0, sum = 0; for(int i=0;i<n;i++) { sum+=a[i]; if(a[i]%x==0) a1+=a[i]/x; else a1+=a[i]/x+1; } if(sum%x == 0) a2 = (sum/x); else a2 = sum/x+1; cout << a2 << " " << a1; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; cin >> t; while(t--) { subMain(); cout << "\n"; } return 0; }
a6a69d771687d5dbac3c419abf1e8a80c0037ab6
deb7150cd9a35d4b995345aa43930c177ca89415
/EX02/prova02.cpp
cfac25d1289ee38a1015ec113cdf4c1ccb14df51
[ "MIT" ]
permissive
HomeniqueM/Atividades-LPA
27780839de8ccab59a8b974de4c82ffd10941541
1bc2f429d4d6afd807095be877145fbedf282329
refs/heads/master
2023-08-28T02:58:14.636156
2021-10-24T11:06:52
2021-10-24T11:06:52
401,107,305
0
0
null
null
null
null
UTF-8
C++
false
false
4,978
cpp
prova02.cpp
#include<iostream> #include<string> #include<vector> #include<bits/stdc++.h> typedef struct Edge{ std::string i, j; int w; Edge( std::string I, std::string J, int W ): i(I), j(J), w(W) { this->i = I; this->j = J; this->w = W; } bool operator < ( const Edge& e ) const { return w > e.w; } }Edge; //Struct do DisjoinSets typedef struct DisjoinSets { private: //Vetor de nós e seus parentes std::vector<std::pair<int,int>> nodes; public: //Iniciar o DisjointSets DisjoinSets(int n) { for(int i = 0; i < n ; i++) this->nodes.push_back({0,i}); } //Achar o pai do no index int find(int index) { if(index != this->nodes.at(index).second) this->nodes.at(index).second = find(this->nodes.at(index).second); return this->nodes.at(index).second; } //Fazer uma combinacao do no 'x' com o no 'y' void merge(int x,int y) { x = find(x); y = find(y); if(this->nodes.at(x).first > this->nodes.at(y).first) this->nodes.at(y).second = x; else this->nodes.at(x).second = y; if(this->nodes.at(x).first == this->nodes.at(y).first) this->nodes.at(y).first++; } }DisjoinSets; // Classe de grafos class Graph { private: // Num de vertices e arestas int vertices; int edges; // Armazenar arestas e seus respectivos pesos std::priority_queue<Edge> edges_weights; std::map<std::string,int> all_vertices; public: Graph() { this->vertices = 0; } int vertices_num() { return this->vertices; } int edges_num() { return this->edges; } //Adicionar a vertice no grafo void add_vertex(std::string vertex_name) { this->all_vertices[vertex_name] = this->vertices++; } /** Adicionar aresta ao grafo */ void add_edge(std::string first, std::string last, int value) { this->edges++; // Fazer par de vertices e peso e adicionar ao grafo auto edges_pair = std::make_pair(first,last); auto int_edges_pair = std::make_pair(value,edges_pair); this->edges_weights.push(Edge(first, last, value)); } // Algoritmo de kruskal, modificado para // calcular o peso da MST int kruskal() { if(this->vertices <= 1) { return 0; } int total_weight = 0; // Comecar o DisjointSet com o número de vertices // de grafos DisjoinSets ds(this->vertices); while (!edges_weights.empty()) { auto it = edges_weights.top(); // Armazenar os vertices da aresta atual std::string source = it.i; std::string destination = it.j; // Resgatar o pai das vertices int parent_source = ds.find(this->all_vertices[source]); int parent_destination = ds.find(this->all_vertices[destination]); // Se os pais das vertices nao sao os mesmos, significa // que junta-los nao formara um ciclo, logo, podemos // fazer o merge if (parent_source != parent_destination) { ds.merge(parent_source, parent_destination); total_weight += it.w; if(--this->vertices <=1) return total_weight; } edges_weights.pop(); } return -1; } }; int main() { int num_stations; int num_connections; std::cin >> num_stations >> num_connections; while (num_stations != 0 && num_connections != 0) { Graph g; std::string station_name; // Adicionar vertices for(int i = 0; i < num_stations; i++) { std::cin >> station_name; g.add_vertex(station_name); } // Leitura das arestas for(int i =0; i < num_connections ; i++) { std::string source, destination; int weight; std::cin >> source >> destination >> weight; g.add_edge(source,destination,weight); } std::string start; std::cin >> start; int minimal_weight = g.kruskal(); // -1 = eh impossivel atravessar o grafo if(minimal_weight == -1) std::cout << "Impossible" << std::endl; else std::cout << minimal_weight << std::endl; std::cin >> num_stations >> num_connections; } }
2f915948255f9d7101b53daeed8986f3d140dff1
5d1ca443b4751bd67290f95f0d1022c52809574e
/src/XPHit.cpp
b7258296bf3e4a586c05a31bf22b034c29480ab3
[]
no_license
aogaki/XrayPinhole
e04419a0203ae161a8d5fe641cbc2c1257f95d81
1c63d07e65c893f8d80d9e09421aa68f60d58542
refs/heads/master
2021-01-19T18:43:40.669728
2017-09-05T12:00:14
2017-09-05T12:00:14
101,159,033
0
0
null
null
null
null
UTF-8
C++
false
false
393
cpp
XPHit.cpp
#include <iomanip> #include "G4SystemOfUnits.hh" #include "G4UnitsTable.hh" #include "XPHit.hpp" G4ThreadLocal G4Allocator<XPHit> *XPHitAllocator = 0; XPHit::XPHit() : G4VHit() {} XPHit::~XPHit() {} XPHit::XPHit(const XPHit & /*right*/) : G4VHit() {} XPHit &XPHit::operator=(const XPHit & /*right*/) { return *this; } int XPHit::operator==(const XPHit & /*right*/) const { return 0; }
cea4dc7353af8d34e1067ee3c30fde7b505923fc
52eef5bec2b7178c3d9c4e2679c7f02ce29ffd31
/src/EnvUtils.h
7389eccedc76afb4948ecf626a3282e11c945e62
[ "BSD-3-Clause" ]
permissive
Krzmbrzl/mumble
e26907feebd0a8d50baf6a0b9744579fb7c491f9
e828ef0458927b21df590f84efce051abd33b2b0
refs/heads/master
2023-08-08T19:43:38.596567
2023-06-30T19:51:40
2023-06-30T19:51:40
201,645,035
1
1
NOASSERTION
2020-06-05T16:26:40
2019-08-10T15:01:51
C++
UTF-8
C++
false
false
837
h
EnvUtils.h
// Copyright 2017-2023 The Mumble Developers. All rights reserved. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file at the root of the // Mumble source tree or at <https://www.mumble.info/LICENSE>. #ifndef MUMBLE_MUMBLE_ENVUTILS_H_ #define MUMBLE_MUMBLE_ENVUTILS_H_ #include <QString> namespace EnvUtils { // getenv is a wrapper around _wgetenv_s (on Windows) // and getenv (on everything else). // // On Windows, it expects a Unicode environment -- so variables // are expected to be UTF16. // // On everything else, it expects environment variables to use the // locale-defined encoding. (From a Qt-perspective, we use toLocal8Bit/fromLocal8Bit.) QString getenv(QString name); bool setenv(QString name, QString value); bool waylandIsUsed(); }; // namespace EnvUtils #endif
518bbbda7b5e852670af717aafc86a1008c58037
cfc920c6f428a0bb92b430448df4af38cd7bc971
/GOF/Prototype/cpp/maze/maze.cpp
eecabea12701a1c8d40926f538064714f4edc5c2
[]
no_license
whywhywhywhygo/Design-Patterns
386af210fdce40462bbbd967bd2a8487caac4a89
8d89569890277df6955569258be4d1dce5ef52af
refs/heads/master
2020-04-28T14:44:19.315438
2019-04-02T01:12:53
2019-04-02T01:12:53
175,347,250
0
0
null
null
null
null
UTF-8
C++
false
false
359
cpp
maze.cpp
// // Created by gaojian on 19-2-27. // #include "maze.h" using std::make_shared; Maze::Maze(std::shared_ptr<Maze> maze) { std::copy(maze->m_rooms.begin(), maze->m_rooms.end(), std::back_inserter(m_rooms)); } void Maze::addRoom(std::shared_ptr<Room> room) { m_rooms.push_back(room); } std::shared_ptr<Maze> Maze::clone() { return shared_from_this(); }
6f0547e7c8059457dc9e6980c672734a7674c3c2
06d8b77df9db207f087a2b511817e05bed8f5b02
/snake/src/game.cc
11562bebf49b0d78c73558745a887e98c2603548
[]
no_license
superxcgm/terminal_game_center
fb8f10bc8c8f870b9aafe5aa049a825bde05b7b3
d97075e2444ecc579237eac135f58f698887b508
refs/heads/master
2021-06-26T16:00:38.089710
2021-06-11T02:03:29
2021-06-11T02:03:29
96,505,624
3
2
null
2021-06-08T08:48:36
2017-07-07T06:17:44
C++
UTF-8
C++
false
false
5,647
cc
game.cc
#include "./game.h" /* NOLINT */ #include <ncurses.h> #include <sys/time.h> #include <ctime> #include "./log.h" void Game::Init() { initscr(); if (COLS < WIN_COLS || LINES < WIN_LINES) { endwin(); fprintf(stderr, "Your console screen is smaller than %dx%d\n", WIN_COLS, WIN_LINES); fprintf(stderr, "Please resize your window and try again\n"); exit(1); } Log::Init(); cbreak(); /* donot buffer input */ noecho(); curs_set(0); /* donot display cursor */ keypad(stdscr, TRUE); /* enable arrow key */ /* ignore INT and QUIT signals */ signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); } void Game::Run() { while (true) { config_ = menu_.DrawMain(); OnGame(); } } void Game::Destroy() { curs_set(1); /* display cursor */ endwin(); } static Game *game_; void RedrawSnack(int signum) { if (!game_->queue_dir_.empty()) { Log::Debug("Extract direction from queue.\n"); int new_direction = game_->queue_dir_.front(); Log::Debug("Receive new direction: %d\n", new_direction); game_->queue_dir_.pop(); game_->snake_.ChangeDirection(new_direction); } game_->snake_.Update(game_->rect_); if (game_->is_hit_wall()) { // Log::Debug("is real border: %d\n", // game_->config_.is_real_border()); Log::Debug("Hit the wall.\n"); if (game_->config_.is_real_wall()) { Log::Debug("Real wall, game over.\n"); game_->GameOver(); } else { game_->AddBorderBack(); auto head = game_->snake_.head(); // Log::Debug("head(%d, %d), rect_.right: %d, rect_.bottom: // %d\n", head.x_, head.y_, game_->rect_.right(), // game_->rect_.bottom()); Point new_point_on_other_side{0, 0}; if (head.x >= game_->rect_.right()) { new_point_on_other_side = {1, head.y}; } if (head.x <= 0) { new_point_on_other_side = {game_->rect_.right() - 1, head.y}; } if (head.y >= game_->rect_.bottom()) { new_point_on_other_side = {head.x, 1}; } if (head.y <= 0) { new_point_on_other_side = {head.x, game_->rect_.bottom() - 1}; } game_->snake_.AddHead(new_point_on_other_side); game_->snake_.AddHead(new_point_on_other_side); } } if (game_->is_hit_fruit()) { // todo: duplicate tail add two node to snake which is not really good game_->snake_.DuplicateTail(); game_->DrawFruit(); } if (game_->is_hit_body()) { Log::Debug("Hit the body, game over!\n"); game_->GameOver(); } game_->snake_.print_snake(); refresh(); } void Game::AddBorderBack() { mvaddch(game_->snake_.head().y, game_->snake_.head().x, '.'); } void Game::OnGame() { int set_ticker(int n_msecs); int ch; int pre_ch; int delay; is_game_over_ = false; clear(); rect_.Draw(config_.is_real_wall()); snake_ = Snake(); snake_.Draw(); DrawFruit(); game_ = this; signal(SIGALRM, RedrawSnack); delay = 20 * (10 - config_.get_level()); set_ticker(delay); /* speed of Snake would not change during play */ pre_ch = ' '; while (true) { ch = getch(); Log::Debug("User press %c\n", ch); if (ch == pre_ch) /* ignore duplication key press */ continue; pre_ch = ch; if (is_game_over_) { switch (ch) { case 'm': case 'M':return; /* back to menu_ */ case '\n':OnGame(); /* just recursion */ return; default:break; } } switch (ch) { case 'w': case 'W': case KEY_UP: /* use queue to buffer direction change request, if change snake_.direction directly, later request will cover the previous request. */ queue_dir_.push(DIR_UP); break; case 's': case 'S': case KEY_DOWN:queue_dir_.push(DIR_DOWN); break; case 'a': case 'A': case KEY_LEFT:queue_dir_.push(DIR_LEFT); break; case 'd': case 'D': case KEY_RIGHT:queue_dir_.push(DIR_RIGHT); break; case 'q': case 'Q':Destroy(); exit(0); default:break; } } } Game::Game() : rect_(0, 0, WIN_COLS, WIN_LINES), menu_(rect_), res_game_over_("res/game_over.res") {} void Game::GameOver() { int set_ticker(int n_msecs); int left_offset; attron(A_BOLD); mvaddch(game_->snake_.head().y, game_->snake_.head().x, 'x'); attroff(A_BOLD); signal(SIGALRM, SIG_IGN); set_ticker(0); /* do not redraw Snake any more */ left_offset = (rect_.get_width() - strlen(res_game_over_.get_line(0).c_str())) / 2; for (int i = 0; i < res_game_over_.line_count(); ++i) mvaddstr(3 + i, left_offset, res_game_over_.get_line(i).c_str()); is_game_over_ = true; refresh(); } void Game::DrawFruit() { do { std::uniform_int_distribution<int> dis_x(1, rect_.right() - 1); std::uniform_int_distribution<int> dis_y(1, rect_.bottom() - 1); fruit_.x = rect_.left() + dis_x(random_engine_); fruit_.y = rect_.top() + dis_y(random_engine_); } while (is_hit_snake(fruit_)); mvaddch(fruit_.y, fruit_.x, SYMBOL_FRUIT); refresh(); } bool Game::is_hit_body() { return snake_.is_hit(snake_.head(), true, rect_, config_.is_real_wall()); } bool Game::is_hit_wall() { auto head = snake_.head(); return head.x == rect_.left() || head.y == rect_.top() || head.x == rect_.right() || head.y == rect_.bottom(); } bool Game::is_hit_fruit() { return snake_.head().x == fruit_.x && snake_.head().y == fruit_.y; } bool Game::is_hit_snake(const Point &point) { return snake_.is_hit(point, false, rect_, config_.is_real_wall()); }
c0a6a7ab8ff55f435eeb2570a2c46b0abd3e3a1e
0bb8652dae10d8d66f34f861d36fc57dc5b0d75a
/BasicCalculator.cpp
039615e8d45234fd06745318e2496145e4fcf926
[]
no_license
fangyw/LeetCode
f75c3a489bf8ae51561c66ee60c189dbda447e66
352776861311df2bfb8f7d49fa0ac845947fa175
refs/heads/master
2020-08-07T12:40:40.432623
2015-09-14T11:08:10
2015-09-14T11:08:10
41,598,354
0
0
null
null
null
null
UTF-8
C++
false
false
3,240
cpp
BasicCalculator.cpp
// Source : https://leetcode.com/problems/basic-calculator/ // Author : Yuwei Fang // Date : 2015-08-30 /********************************************************************************** * * Implement a basic calculator to evaluate a simple expression string. * * The expression string may contain open ( and closing parentheses ), the plus + or * minus sign -, non-negative integers and empty spaces . * * You may assume that the given expression is always valid. * * Some examples: * * "1 + 1" = 2 * " 2-1 + 2 " = 3 * "(1+(4+5+2)-3)+(6+8)" = 23 * * Note: Do not use the eval built-in library function. * * * * * **********************************************************************************/ #include <string> #include <iostream> #include <stack> #include <vector> using namespace std; class Solution { public: int calculate(string s) { stack<char> optr; stack<int> opnd; s += "+0"; const int n = s.length(); for(int i=0; i<n; ++i) { if (isOperator(s[i])) { if (optr.empty() || s[i] == '(' || precedence(s[i]) > precedence(optr.top())) { optr.push(s[i]); } else { // need calculate int y = opnd.top(); opnd.pop(); int x = opnd.top(); opnd.pop(); opnd.push(calculate(optr.top(), x, y)); optr.pop(); --i; } } else if (s[i] == ')') { char op = optr.top(); optr.pop(); while (op != '(') { int y = opnd.top(); opnd.pop(); int x = opnd.top(); opnd.pop(); opnd.push(calculate(op,x,y)); op = optr.top(); optr.pop(); } } else if (isdigit(s[i])) { int num = 0; while (isdigit(s[i])) { num = num * 10 + s[i] - '0'; ++i; } opnd.push(num); --i; } } int y = opnd.top(); opnd.pop(); int x = opnd.top(); opnd.pop(); return calculate(optr.top(), x,y); } private: int precedence(char op) { if(op == '(') return 1; else if (op == '+' || op == '-') return 2; else if (op == '*' || op == '/') return 3; return 4; } int calculate(char op, int x ,int y) { if (op == '+') x += y; else if (op == '-') x -= y; else if (op == '*') x *= y; else if (op == '/') x /= y; return x; } bool isOperator(char op) { return op == '(' || op == '+' || op == '-' || op == '*' || op == '/'; } }; int main() { Solution sol; //vector<string> expr{"3+2*2", " 3/2 ", " 3+5 / 2 "}; vector<string> expr{"3+2*2"}; for(const auto &str : expr) cout << sol.calculate(str) << endl; return 0; }
c8e2e7c89f56c606616faedd20a8a9ae0ea4127e
45967cb52b3d0c1cf02e554af00eb62b2731b33b
/SPOJ/MST.cpp
3c4e96e88d10c6590905ebf96e3d2f6b6218dd35
[]
no_license
shubhi-singh/Coding--Practice
f71f46dfa157a94c2e4755426288f730dad72fa0
715ff4be80e157396a77941deb167e541eba26e4
refs/heads/master
2021-01-07T10:54:57.569319
2020-03-09T17:49:24
2020-03-09T17:49:24
241,669,611
0
0
null
null
null
null
UTF-8
C++
false
false
1,076
cpp
MST.cpp
#include <bits/stdc++.h> #define ll long long int using namespace std; vector<int> parent; vector<int> sz; struct Edge{ int u, v, w; }; bool compare(Edge a, Edge b) { return a.w < b.w; } int find_set(int v) { while(v != parent[v]) v = parent[v]; return v; } void make_set(int v) { parent[v] = v; sz[v] = 1; return; } void union_sets(int a, int b) { a = find_set(a); b = find_set(b); if(a != b) { if(sz[a] < sz[b]) swap(a, b); parent[b] = a; sz[a] += sz[b]; } } int main() { int n, m; scanf("%d %d", &n, &m); parent.resize(n + 1); sz.resize(n + 1); vector<Edge> ar; ll ans = 0; for(int x = 0;x < m;x++) { int u, v, w; scanf("%d %d %d", &u, &v, &w); ar.push_back((Edge){u, v, w}); } sort(ar.begin(), ar.end(), compare); for(int x = 1;x <= n;x++) make_set(x); for(int x = 0;x < m;x++) { int pu = find_set(ar[x].u); int pv = find_set(ar[x].v); if(pu == pv) continue; ans += ar[x].w; union_sets(pu, pv); } cout<<ans<<endl; return 0; }
ed5f55f256f1464dfa0df459f59ed421ae417a41
26df6604faf41197c9ced34c3df13839be6e74d4
/src/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.cpp
c3fc259afd9bec347b3e1b117c8cbf596d0230bb
[ "Apache-2.0" ]
permissive
pebble2015/cpoi
58b4b1e38a7769b13ccfb2973270d15d490de07f
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
refs/heads/master
2021-07-09T09:02:41.986901
2017-10-08T12:12:56
2017-10-08T12:12:56
105,988,119
0
0
null
null
null
null
UTF-8
C++
false
false
18,822
cpp
ColumnInfoRecordsAggregate.cpp
// Generated from /POI/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java #include <org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.hpp> #include <java/lang/Boolean.hpp> #include <java/lang/Class.hpp> #include <java/lang/ClassCastException.hpp> #include <java/lang/IllegalArgumentException.hpp> #include <java/lang/Integer.hpp> #include <java/lang/Math.hpp> #include <java/lang/NullPointerException.hpp> #include <java/lang/Object.hpp> #include <java/lang/RuntimeException.hpp> #include <java/lang/Short.hpp> #include <java/lang/String.hpp> #include <java/lang/StringBuilder.hpp> #include <java/util/ArrayList.hpp> #include <java/util/Collections.hpp> #include <java/util/Comparator.hpp> #include <java/util/Iterator.hpp> #include <java/util/List.hpp> #include <org/apache/poi/hssf/model/RecordStream.hpp> #include <org/apache/poi/hssf/record/ColumnInfoRecord.hpp> #include <org/apache/poi/hssf/record/Record.hpp> #include <org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate_CIRComparator.hpp> #include <org/apache/poi/hssf/record/aggregates/RecordAggregate_RecordVisitor.hpp> template<typename T, typename U> static T java_cast(U* u) { if(!u) return static_cast<T>(nullptr); auto t = dynamic_cast<T>(u); if(!t) throw new ::java::lang::ClassCastException(); return t; } template<typename T> static T* npc(T* t) { if(!t) throw new ::java::lang::NullPointerException(); return t; } poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::ColumnInfoRecordsAggregate(const ::default_init_tag&) : super(*static_cast< ::default_init_tag* >(0)) { clinit(); } poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::ColumnInfoRecordsAggregate() : ColumnInfoRecordsAggregate(*static_cast< ::default_init_tag* >(0)) { ctor(); } poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::ColumnInfoRecordsAggregate(::poi::hssf::model::RecordStream* rs) : ColumnInfoRecordsAggregate(*static_cast< ::default_init_tag* >(0)) { ctor(rs); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::ctor() { super::ctor(); records = new ::java::util::ArrayList(); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::ctor(::poi::hssf::model::RecordStream* rs) { ctor(); auto isInOrder = true; ::poi::hssf::record::ColumnInfoRecord* cirPrev = nullptr; while (static_cast< ::java::lang::Object* >(npc(rs)->peekNextClass()) == static_cast< ::java::lang::Object* >(::poi::hssf::record::ColumnInfoRecord::class_())) { auto cir = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(rs)->getNext()); npc(records)->add(static_cast< ::java::lang::Object* >(cir)); if(cirPrev != nullptr && ColumnInfoRecordsAggregate_CIRComparator::compareColInfos(cirPrev, cir) > 0) { isInOrder = false; } cirPrev = cir; } if(npc(records)->size() < 1) { throw new ::java::lang::RuntimeException(u"No column info records found"_j); } if(!isInOrder) { ::java::util::Collections::sort(records, ColumnInfoRecordsAggregate_CIRComparator::instance()); } } poi::hssf::record::aggregates::ColumnInfoRecordsAggregate* poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::clone() { auto rec = new ColumnInfoRecordsAggregate(); for (auto _i = npc(records)->iterator(); _i->hasNext(); ) { ::poi::hssf::record::ColumnInfoRecord* ci = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(_i->next()); { npc(npc(rec)->records)->add(static_cast< ::java::lang::Object* >(npc(ci)->clone())); } } return rec; } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::insertColumn(::poi::hssf::record::ColumnInfoRecord* col) { npc(records)->add(static_cast< ::java::lang::Object* >(col)); ::java::util::Collections::sort(records, ColumnInfoRecordsAggregate_CIRComparator::instance()); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::insertColumn(int32_t idx, ::poi::hssf::record::ColumnInfoRecord* col) { npc(records)->add(idx, col); } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::getNumColumns() { return npc(records)->size(); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::visitContainedRecords(RecordAggregate_RecordVisitor* rv) { auto nItems = npc(records)->size(); if(nItems < 1) { return; } ::poi::hssf::record::ColumnInfoRecord* cirPrev = nullptr; for (auto i = int32_t(0); i < nItems; i++) { auto cir = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(i)); npc(rv)->visitRecord(cir); if(cirPrev != nullptr && ColumnInfoRecordsAggregate_CIRComparator::compareColInfos(cirPrev, cir) > 0) { throw new ::java::lang::RuntimeException(u"Column info records are out of order"_j); } cirPrev = cir; } } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::findStartOfColumnOutlineGroup(int32_t pIdx) { auto columnInfo = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(pIdx)); auto level = npc(columnInfo)->getOutlineLevel(); auto idx = pIdx; while (idx != 0) { auto prevColumnInfo = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(idx - int32_t(1))); if(!npc(prevColumnInfo)->isAdjacentBefore(columnInfo)) { break; } if(npc(prevColumnInfo)->getOutlineLevel() < level) { break; } idx--; columnInfo = prevColumnInfo; } return idx; } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::findEndOfColumnOutlineGroup(int32_t colInfoIndex) { auto columnInfo = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(colInfoIndex)); auto level = npc(columnInfo)->getOutlineLevel(); auto idx = colInfoIndex; while (idx < npc(records)->size() - int32_t(1)) { auto nextColumnInfo = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(idx + int32_t(1))); if(!npc(columnInfo)->isAdjacentBefore(nextColumnInfo)) { break; } if(npc(nextColumnInfo)->getOutlineLevel() < level) { break; } idx++; columnInfo = nextColumnInfo; } return idx; } poi::hssf::record::ColumnInfoRecord* poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::getColInfo(int32_t idx) { return java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(idx)); } bool poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::isColumnGroupCollapsed(int32_t idx) { auto endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx); auto nextColInfoIx = endOfOutlineGroupIdx + int32_t(1); if(nextColInfoIx >= npc(records)->size()) { return false; } auto nextColInfo = getColInfo(nextColInfoIx); if(!npc(getColInfo(endOfOutlineGroupIdx))->isAdjacentBefore(nextColInfo)) { return false; } return npc(nextColInfo)->getCollapsed(); } bool poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::isColumnGroupHiddenByParent(int32_t idx) { auto endLevel = int32_t(0); auto endHidden = false; auto endOfOutlineGroupIdx = findEndOfColumnOutlineGroup(idx); if(endOfOutlineGroupIdx < npc(records)->size()) { auto nextInfo = getColInfo(endOfOutlineGroupIdx + int32_t(1)); if(npc(getColInfo(endOfOutlineGroupIdx))->isAdjacentBefore(nextInfo)) { endLevel = npc(nextInfo)->getOutlineLevel(); endHidden = npc(nextInfo)->getHidden(); } } auto startLevel = int32_t(0); auto startHidden = false; auto startOfOutlineGroupIdx = findStartOfColumnOutlineGroup(idx); if(startOfOutlineGroupIdx > 0) { auto prevInfo = getColInfo(startOfOutlineGroupIdx - int32_t(1)); if(npc(prevInfo)->isAdjacentBefore(getColInfo(startOfOutlineGroupIdx))) { startLevel = npc(prevInfo)->getOutlineLevel(); startHidden = npc(prevInfo)->getHidden(); } } if(endLevel > startLevel) { return endHidden; } return startHidden; } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::collapseColumn(int32_t columnIndex) { auto colInfoIx = findColInfoIdx(columnIndex, 0); if(colInfoIx == -int32_t(1)) { return; } auto groupStartColInfoIx = findStartOfColumnOutlineGroup(colInfoIx); auto columnInfo = getColInfo(groupStartColInfoIx); auto lastColIx = setGroupHidden(groupStartColInfoIx, npc(columnInfo)->getOutlineLevel(), true); setColumn(lastColIx + int32_t(1), nullptr, nullptr, nullptr, nullptr, ::java::lang::Boolean::TRUE()); } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::setGroupHidden(int32_t pIdx, int32_t level, bool hidden) { auto idx = pIdx; auto columnInfo = getColInfo(idx); while (idx < npc(records)->size()) { npc(columnInfo)->setHidden(hidden); if(idx + int32_t(1) < npc(records)->size()) { auto nextColumnInfo = getColInfo(idx + int32_t(1)); if(!npc(columnInfo)->isAdjacentBefore(nextColumnInfo)) { break; } if(npc(nextColumnInfo)->getOutlineLevel() < level) { break; } columnInfo = nextColumnInfo; } idx++; } return npc(columnInfo)->getLastColumn(); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::expandColumn(int32_t columnIndex) { auto idx = findColInfoIdx(columnIndex, 0); if(idx == -int32_t(1)) { return; } if(!isColumnGroupCollapsed(idx)) { return; } auto startIdx = findStartOfColumnOutlineGroup(idx); auto endIdx = findEndOfColumnOutlineGroup(idx); auto columnInfo = getColInfo(endIdx); if(!isColumnGroupHiddenByParent(idx)) { auto outlineLevel = npc(columnInfo)->getOutlineLevel(); for (auto i = startIdx; i <= endIdx; i++) { auto ci = getColInfo(i); if(outlineLevel == npc(ci)->getOutlineLevel()) npc(ci)->setHidden(false); } } setColumn(npc(columnInfo)->getLastColumn() + int32_t(1), nullptr, nullptr, nullptr, nullptr, ::java::lang::Boolean::FALSE()); } poi::hssf::record::ColumnInfoRecord* poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::copyColInfo(::poi::hssf::record::ColumnInfoRecord* ci) { clinit(); return npc(ci)->clone(); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::setColumn(int32_t targetColumnIx, ::java::lang::Short* xfIndex, ::java::lang::Integer* width, ::java::lang::Integer* level, ::java::lang::Boolean* hidden, ::java::lang::Boolean* collapsed) { ::poi::hssf::record::ColumnInfoRecord* ci = nullptr; auto k = int32_t(0); for (k = 0; k < npc(records)->size(); k++) { auto tci = java_cast< ::poi::hssf::record::ColumnInfoRecord* >(npc(records)->get(k)); if(npc(tci)->containsColumn(targetColumnIx)) { ci = tci; break; } if(npc(tci)->getFirstColumn() > targetColumnIx) { break; } } if(ci == nullptr) { auto nci = new ::poi::hssf::record::ColumnInfoRecord(); npc(nci)->setFirstColumn(targetColumnIx); npc(nci)->setLastColumn(targetColumnIx); setColumnInfoFields(nci, xfIndex, width, level, hidden, collapsed); insertColumn(k, nci); attemptMergeColInfoRecords(k); return; } auto styleChanged = xfIndex != nullptr && npc(ci)->getXFIndex() != npc(xfIndex)->shortValue(); auto widthChanged = width != nullptr && npc(ci)->getColumnWidth() != npc(width)->shortValue(); auto levelChanged = level != nullptr && npc(ci)->getOutlineLevel() != npc(level)->intValue(); auto hiddenChanged = hidden != nullptr && npc(ci)->getHidden() != npc(hidden)->booleanValue(); auto collapsedChanged = collapsed != nullptr && npc(ci)->getCollapsed() != npc(collapsed)->booleanValue(); auto columnChanged = styleChanged || widthChanged || levelChanged|| hiddenChanged|| collapsedChanged; if(!columnChanged) { return; } if(npc(ci)->getFirstColumn() == targetColumnIx && npc(ci)->getLastColumn() == targetColumnIx) { setColumnInfoFields(ci, xfIndex, width, level, hidden, collapsed); attemptMergeColInfoRecords(k); return; } if(npc(ci)->getFirstColumn() == targetColumnIx || npc(ci)->getLastColumn() == targetColumnIx) { if(npc(ci)->getFirstColumn() == targetColumnIx) { npc(ci)->setFirstColumn(targetColumnIx + int32_t(1)); } else { npc(ci)->setLastColumn(targetColumnIx - int32_t(1)); k++; } auto nci = copyColInfo(ci); npc(nci)->setFirstColumn(targetColumnIx); npc(nci)->setLastColumn(targetColumnIx); setColumnInfoFields(nci, xfIndex, width, level, hidden, collapsed); insertColumn(k, nci); attemptMergeColInfoRecords(k); } else { auto ciStart = ci; auto ciMid = copyColInfo(ci); auto ciEnd = copyColInfo(ci); auto lastcolumn = npc(ci)->getLastColumn(); npc(ciStart)->setLastColumn(targetColumnIx - int32_t(1)); npc(ciMid)->setFirstColumn(targetColumnIx); npc(ciMid)->setLastColumn(targetColumnIx); setColumnInfoFields(ciMid, xfIndex, width, level, hidden, collapsed); insertColumn(++k, ciMid); npc(ciEnd)->setFirstColumn(targetColumnIx + int32_t(1)); npc(ciEnd)->setLastColumn(lastcolumn); insertColumn(++k, ciEnd); } } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::setColumnInfoFields(::poi::hssf::record::ColumnInfoRecord* ci, ::java::lang::Short* xfStyle, ::java::lang::Integer* width, ::java::lang::Integer* level, ::java::lang::Boolean* hidden, ::java::lang::Boolean* collapsed) { clinit(); if(xfStyle != nullptr) { npc(ci)->setXFIndex(npc(xfStyle)->shortValue()); } if(width != nullptr) { npc(ci)->setColumnWidth(npc(width)->intValue()); } if(level != nullptr) { npc(ci)->setOutlineLevel(npc(level)->shortValue()); } if(hidden != nullptr) { npc(ci)->setHidden(npc(hidden)->booleanValue()); } if(collapsed != nullptr) { npc(ci)->setCollapsed(npc(collapsed)->booleanValue()); } } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::findColInfoIdx(int32_t columnIx, int32_t fromColInfoIdx) { if(columnIx < 0) { throw new ::java::lang::IllegalArgumentException(::java::lang::StringBuilder().append(u"column parameter out of range: "_j)->append(columnIx)->toString()); } if(fromColInfoIdx < 0) { throw new ::java::lang::IllegalArgumentException(::java::lang::StringBuilder().append(u"fromIdx parameter out of range: "_j)->append(fromColInfoIdx)->toString()); } for (auto k = fromColInfoIdx; k < npc(records)->size(); k++) { auto ci = getColInfo(k); if(npc(ci)->containsColumn(columnIx)) { return k; } if(npc(ci)->getFirstColumn() > columnIx) { break; } } return -int32_t(1); } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::attemptMergeColInfoRecords(int32_t colInfoIx) { auto nRecords = npc(records)->size(); if(colInfoIx < 0 || colInfoIx >= nRecords) { throw new ::java::lang::IllegalArgumentException(::java::lang::StringBuilder().append(u"colInfoIx "_j)->append(colInfoIx) ->append(u" is out of range (0.."_j) ->append((nRecords - int32_t(1))) ->append(u")"_j)->toString()); } auto currentCol = getColInfo(colInfoIx); auto nextIx = colInfoIx + int32_t(1); if(nextIx < nRecords) { if(mergeColInfoRecords(currentCol, getColInfo(nextIx))) { npc(records)->remove(nextIx); } } if(colInfoIx > 0) { if(mergeColInfoRecords(getColInfo(colInfoIx - int32_t(1)), currentCol)) { npc(records)->remove(colInfoIx); } } } bool poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::mergeColInfoRecords(::poi::hssf::record::ColumnInfoRecord* ciA, ::poi::hssf::record::ColumnInfoRecord* ciB) { clinit(); if(npc(ciA)->isAdjacentBefore(ciB) && npc(ciA)->formatMatches(ciB)) { npc(ciA)->setLastColumn(npc(ciB)->getLastColumn()); return true; } return false; } void poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::groupColumnRange(int32_t fromColumnIx, int32_t toColumnIx, bool indent) { auto colInfoSearchStartIdx = int32_t(0); for (auto i = fromColumnIx; i <= toColumnIx; i++) { auto level = int32_t(1); auto colInfoIdx = findColInfoIdx(i, colInfoSearchStartIdx); if(colInfoIdx != -int32_t(1)) { level = npc(getColInfo(colInfoIdx))->getOutlineLevel(); if(indent) { level++; } else { level--; } level = ::java::lang::Math::max(int32_t(0), level); level = ::java::lang::Math::min(int32_t(7), level); colInfoSearchStartIdx = ::java::lang::Math::max(int32_t(0), colInfoIdx - int32_t(1)); } setColumn(i, nullptr, nullptr, ::java::lang::Integer::valueOf(level), nullptr, nullptr); } } poi::hssf::record::ColumnInfoRecord* poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::findColumnInfo(int32_t columnIndex) { auto nInfos = npc(records)->size(); for (auto i = int32_t(0); i < nInfos; i++) { auto ci = getColInfo(i); if(npc(ci)->containsColumn(columnIndex)) { return ci; } } return nullptr; } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::getMaxOutlineLevel() { auto result = int32_t(0); auto count = npc(records)->size(); for (auto i = int32_t(0); i < count; i++) { auto columnInfoRecord = getColInfo(i); result = ::java::lang::Math::max(npc(columnInfoRecord)->getOutlineLevel(), result); } return result; } int32_t poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::getOutlineLevel(int32_t columnIndex) { auto ci = findColumnInfo(columnIndex); if(ci != nullptr) { return npc(ci)->getOutlineLevel(); } else { return 0; } } extern java::lang::Class *class_(const char16_t *c, int n); java::lang::Class* poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::class_() { static ::java::lang::Class* c = ::class_(u"org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate", 64); return c; } java::lang::Class* poi::hssf::record::aggregates::ColumnInfoRecordsAggregate::getClass0() { return class_(); }
52862d40366d1fcd3f27855750782efa8fe18a87
26a8609ea4a110aced94a4e7f1f0ec375eecd689
/mapmap/header/timer.h
4df3cee593392bfaf10da63372fc8810e5f42f4e
[ "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
dthuerck/mapmap_cpu
2c4676c0b94d134d57d698173faa9d372a45df10
fa526e0963ca3e431a02aa7b9e87b85ba8a8e304
refs/heads/master
2023-07-09T05:20:17.583047
2023-07-04T07:44:05
2023-07-04T07:44:05
75,747,968
92
45
BSD-3-Clause
2023-05-03T05:23:33
2016-12-06T16:06:55
C++
UTF-8
C++
false
false
1,049
h
timer.h
/** * Copyright (C) 2016, Daniel Thuerck * TU Darmstadt - Graphics, Capture and Massively Parallel Computing * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD license. See the LICENSE file for details. */ #ifndef __MAPMAP_TIMER_H_ #define __MAPMAP_TIMER_H_ #include <mapmap/header/defines.h> NS_MAPMAP_BEGIN using t_point = std::chrono::time_point<std::chrono::system_clock>; struct _timer { _timer(); ~_timer(); void start(const std::string& s); void stop(const std::string& s); double get_ms(const std::string& s); std::map<std::string, t_point> m_t_start; std::map<std::string, t_point> m_t_end; }; extern _timer * __T; #define START_TIMER(str) (__T->start(str)); #define STOP_TIMER(str) (__T->stop(str)); #define PRINT_TIMER(str) (printf("(Timing) %s: %f ms\n", str, __T->get_ms(str))); #define GET_TIMER(str) (__T->get_ms(str)); NS_MAPMAP_END /* include timer implementation */ #include <mapmap/source/timer.impl.h> #endif /* __MAPMAP_TIMER_H_ */
f812ba07309e28ae4a908ddc88efe3c0a98d282b
a3e625d9a9116e58edcd5bb1a0f4cdcda4154343
/src/detail/hooks.hpp
c2ed474f4b1eb43bdd42537b810cd572ea4761b6
[]
no_license
rpahl/permory
c8714d6db1702499878909c3d24ed1501bbd5e8c
74ab6d2d17f0fa1f9d0c9bcbfb66668470728f7e
refs/heads/master
2021-06-03T01:11:27.337818
2018-05-16T08:54:23
2018-05-16T08:54:23
38,930,390
1
0
null
null
null
null
UTF-8
C++
false
false
1,437
hpp
hooks.hpp
// Copyright (c) 2011 Volker Steiß // 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 permory_detail_hooks_hpp #define permory_detail_hooks_hpp #include "detail/config.hpp" // // Definition of static hooks. // Hooks are points of entry for custumization of control flow. Static hooks are // compile time hooks. Only one implementation of a hook is called. To call // multiple implementations composition of the different implementations is needed. // // In this file hooks are defined only. Concrete implementations should be done // in "detail/config.hpp". // // An example for a static hook implementation is support for MPI. // namespace Permory { namespace hook { // Global definitions for hooks // NIL hook. class None { }; } namespace hook { // Static hooks for namespace "Permory" // // Argument hook is called at the start of the application. This hook // can be used to alter the arguments passed from commandline. // template<class T> struct Argument_hook_impl { public: void operator()(int *argc, char ***argv); }; template<> void Argument_hook_impl<None>::operator() (int *argc, char ***argv) { } } // namespace hook } // namespace Permory #endif // include guard
becb9bd304064dec56c8ad4a839f98920a28095a
32e35be42f367e36c3a8e57f18df5d88560cf862
/sccdll2/prerace.cpp
a403e25d379d5245cbe7a364eaa090809a4f94b1
[]
no_license
LodePublishing/StarCraft-Calculator
b19c53f0c92bdaccade73b68b4fc71af814d6fd0
a547f276c563420baabffd53cf51176d56eff0fb
refs/heads/master
2021-03-27T10:54:19.521151
2016-09-10T12:52:33
2016-09-10T12:52:33
67,313,519
0
0
null
null
null
null
UTF-8
C++
false
false
12,951
cpp
prerace.cpp
#include "prerace.h" #include "debug.h" MAP* PRERACE::getMap() { return(pMap); }; int PRERACE::setMins(int num) { if((num<0)||(num>MAX_MINS)) { debug.toLog(0,"DEBUG: (PRERACE::setMins): Value [%i] out of range.",num); return(0); } mins=num; return(1); }; int PRERACE::setGas(int num) { if((num<0)||(num>MAX_GAS)) { debug.toLog(0,"DEBUG: (PRERACE::setGas): Value [%i] out of range.",num); return(0); } gas=num; return(1); }; int PRERACE::setTimer(int num) { if((num<0)||(num>MAX_TIME)) { debug.toLog(0,"DEBUG: (PRERACE::setTimer): Value [%i] out of range.",num); return(0); } timer=num; return(1); }; int PRERACE::setSupply(int num) { if((num>MAX_SUPPLY)||(num<0)) { debug.toLog(0,"DEBUG: (PRERACE::setSupply): Value [%i] out of range.",num); return(0); } supply=num; return(1); }; int PRERACE::setMaxSupply(int num) { if((num>MAX_SUPPLY)||(num<0)) { debug.toLog(0,"DEBUG: (PRERACE::setMaxSupply): Value [%i] out of range.",num); return(0); } maxSupply=num; return(1); }; int PRERACE::setMap(MAP* map) { if(!map) { debug.toLog(0,"DEBUG: (PRERACE::setMap): Map not initialized."); return(0); } pMap=map; mapInitialized=1; return(1); }; int PRERACE::getPlayerNum() { if((playerNum<0)||(playerNum>=MAX_PLAYER)) { debug.toLog(0,"DEBUG: (PRERACE::getPlayer): Variable not initialized [%i].",playerNum); return(0); } return(playerNum); }; int PRERACE::getSupply() { if((supply<0)||(supply>200)) { debug.toLog(0,"DEBUG: (PRERACE::getSupply): Variable not initialized [%i].",supply); return(0); } return(supply); }; int PRERACE::getMaxSupply() { if((maxSupply<0)||(maxSupply>200)) { debug.toLog(0,"DEBUG: (PRERACE::getMaxSupply): Variable not initialized [%i].",maxSupply); return(0); } return(maxSupply); }; int PRERACE::getMins() { if((mins<0)||(mins>MAX_MINS)) { debug.toLog(0,"DEBUG: (PRERACE::getMins): Variable not initialized [%i].",mins); return(0); } return(mins); }; int PRERACE::getGas() { if((gas<0)||(gas>MAX_GAS)) { debug.toLog(0,"DEBUG: (PRERACE::getGas): Variable not initialized [%i].",gas); return(0); } return(gas); }; int PRERACE::getTimer() { if((timer<0)||(timer>MAX_TIME)) { debug.toLog(0,"DEBUG: (PRERACE::getTimer): Variable not initialized [%i].",timer); return(0); } return(timer); }; int PRERACE::adjustMineralHarvest(int num) { if((num<0)||(num>=MAX_LOCATIONS)) { debug.toLog(0,"DEBUG: (PRERACE::adjustMineralHarvest): Value [%i] out of range.",num); return(0); } int i,j; if((num==0)||((!location[num].force[COMMAND_CENTER])&&(!loc[0][num].force[MINERALS]))) { for(j=45;j--;) mineralHarvestPerSecond[num][j]=0; } /*else if((!pMap->location[num].force[playerNum][COMMAND_CENTER])&&(pMap->location[num].force[0][MINERALS])) { //nach naehestem command_center suchen } else if((pMap->location[num].force[playerNum][COMMAND_CENTER])&&(!pMap->location[num].force[0][MINERALS])) { //nach naehesten Mineralien suchen }*/ //TODO: Wenn 2 SPieler an einem sammeln, beide einberechnen! else if(player->getBasicMineralHarvestPerSecond(1)>0) //??? { // int k; for(i=45;i--;) { // k=0; // for(j=0;j<45;j++) // if(i*8<=j*pMap->location[num].force[0][MINERALS]) // { k=j;j=45;}; mineralHarvestPerSecond[num][i]=player->getBasicMineralHarvestPerSecond(i/*k*/);//*pMap->location[num].force[0][MINERALS])/8; } //ab hier funzt alles... nur scheint player->getBasic... nicht richtig initialisiert zu sein... } return(1); }; int PRERACE::adjustGasHarvest(int num) { if((num<0)||(num>=MAX_LOCATIONS)) { debug.toLog(0,"DEBUG: (PRERACE::adjustGasHarvest): Value [%i] out of range.",num); return(0); } int i,j; if((num==0)||((!location[num].force[COMMAND_CENTER])&&(!location[num].force[REFINERY]))) { for(j=5;j--;) gasHarvestPerSecond[num][j]=0; } /* else if((!pMap->location[num].force[playerNum][COMMAND_CENTER])&&(pMap->location[num].force[playerNum][REFINERY])) { //nach naehestem command_center suchen } else if((pMap->location[num].force[playerNum][COMMAND_CENTER])&&(!pMap->location[num].force[playerNum][REFINERY])) { //nach naehesten Mineralien suchen }*/ else { int k; for(i=5;i--;) { k=0; // for(j=0;j<5;j++) // if(i<=j*pMap->location[num].force[playerNum][REFINERY]) { k=j;j=5;} gasHarvestPerSecond[num][i]=(player->getBasicGasHarvestPerSecond(i/*k*/)*location[num].force[REFINERY]); // hier liegts problem wegen gas // gasharvestps ist zu gross, evtl wegen zu vieler refineries! } } return(1); }; int PRERACE::setPlayerNum(int num) { if((num<0)||(num>=MAX_PLAYER)) { debug.toLog(0,"DEBUG: (PRERACE::setPlayerNum): Value [%i] out of range.",num); return(0); } playerNum=num; //~```~ player[0]? location=(loc[num]); return(1); }; PLAYER* PRERACE::getPlayer() { if(!player->getInitialized()) { debug.toLog(0,"DEBUG: (PRERACE::getPlayer): Variable not initialized."); return(0); } return(player); }; int PRERACE::setPlayer(PLAYER* player) { if(!player->getInitialized()) { debug.toLog(0,"DEBUG: (PRERACE::setPlayer): Variable not initialized."); return(0); } this->player=player; return(1); }; int PRERACE::setpStats(const UNIT_STATISTICS* pStats) { if(pStats[0].mins!=0)//~~ { debug.toLog(0,"DEBUG: (PRERACE::setpStats): Variable not initialized."); return(0); } this->pStats=pStats; return(1); }; int PRERACE::loadPlayer(int num) { setPlayerNum(num); setPlayer(&pMap->player[num]); setpStats(player->goal->getpStats()); setMins(player->getMins()); setGas(player->getGas()); setTimer(player->getTimer()); return(1); }; int PRERACE::adjustHarvest() { if(!mapInitialized) { debug.toLog(0,"DEBUG: (PRERACE::adjustHarvest): Map was not initialized."); return(0); } int i; for(i=0;i<MAX_LOCATIONS;i++) { adjustMineralHarvest(i); adjustGasHarvest(i); } return(1); } void PRERACE::harvestResources() { int i,s; // int t=(rand()%10)-5; for(i=1;i<MAX_LOCATIONS;i++)//~~ if(s=location[i].availible[SCV]) { //availible is 0, harvestSpeed ist ok! if(s<56) //~~ { mins+=mineralHarvestPerSecond[i][s]; //~~~ neu berechnen / Tabelle anlegen! sind ja nicht bei jeder Exe gleichviel Mineralien... harvestedMins+=mineralHarvestPerSecond[i][s]; //~~~ } else { mins+=mineralHarvestPerSecond[i][56]; harvestedMins+=mineralHarvestPerSecond[i][56]; } s=location[i].availible[GAS_SCV]; if(s<4) { setGas(getGas()+gasHarvestPerSecond[i][s]); harvestedGas+=gasHarvestPerSecond[i][s]; } else { setGas(getGas()+gasHarvestPerSecond[i][4]); harvestedGas+=gasHarvestPerSecond[i][4]; } } }; int PRERACE::getCalculated() { if((calculated<0)||(calculated>1)) { debug.toLog(0,"DEBUG: (PRERACE::getCalculated): Variable is not initialized [%i].",calculated); return(0); } return(calculated); }; int PRERACE::setCalculated(int num) { if((num<0)||(num>1)) { debug.toLog(0,"DEBUG: (PRERACE::setCalculated): Value [%i] out of range.",num); return(0); } calculated=num; return(1); }; int PRERACE::resetSupply() { if(!mapInitialized) { debug.toLog(0,"DEBUG: (PRERACE::resetSupply): Map was not initialized."); return(0); } setSupply(0); setMaxSupply(0); int i,j; for(i=1;i<MAX_LOCATIONS;i++) for(j=UNIT_TYPE_COUNT;j--;) { if(pStats[j].supply<0) { if(getMaxSupply()-pStats[j].supply*location[i].force[j]>MAX_SUPPLY) { if(getMaxSupply()<MAX_SUPPLY) { setSupply(getMaxSupply()+(MAX_SUPPLY-getMaxSupply())); setMaxSupply(MAX_SUPPLY); } } else { setSupply(getSupply()-pStats[j].supply*location[i].force[j]); setMaxSupply(getMaxSupply()-pStats[j].supply*location[i].force[j]); } } else setSupply(getSupply()-pStats[j].supply*location[i].force[j]); } return(1); }; int PRERACE::getIP() { if((IP<0)||(IP>MAX_LENGTH)) { debug.toLog(0,"DEBUG: (PRERACE::getIP): Variable not initialized [%i].",IP); return(0); } return(IP); } int PRERACE::getMineralHarvestPerSecond(int tloc,int worker) { if((tloc<0)||(tloc>=MAX_LOCATIONS)||(worker<0)||(worker>=45)) { debug.toLog(0,"DEBUG: (PRERACE::getMineralHarvestPerSecond): Value [%i/%i] out of range.",tloc,worker); return(0); } if((mineralHarvestPerSecond[tloc][worker]<0)||(mineralHarvestPerSecond[tloc][worker]>MAX_MINS)) { debug.toLog(0,"DEBUG: (PRERACE::getMineralHarvestPerSecond): Variable not initialized [%i].",mineralHarvestPerSecond[tloc][worker]); return(0); } return(mineralHarvestPerSecond[tloc][worker]); } int PRERACE::getGasHarvestPerSecond(int tloc,int worker) { if((tloc<0)||(tloc>=MAX_LOCATIONS)||(worker<0)||(worker>=5)) { debug.toLog(0,"DEBUG: (PRERACE::getGasHarvestPerSecond): Value [%i/%i] out of range.",tloc,worker); return(0); } if((gasHarvestPerSecond[tloc][worker]<0)||(gasHarvestPerSecond[tloc][worker]>MAX_GAS)) { debug.toLog(0,"DEBUG: (PRERACE::getGasHarvestPerSecond): Variable not initialized [%i].",gasHarvestPerSecond[tloc][worker]); return(0); } return(gasHarvestPerSecond[tloc][worker]); } int PRERACE::getHarvestedMins() { if((harvestedMins<0)||(harvestedMins>MAX_MINS)) { debug.toLog(0,"DEBUG: (PRERACE::getHarvestedMins): Variable not initialized [%i].",harvestedMins); return(0); } return(harvestedMins); }; int PRERACE::getHarvestedGas() { if((harvestedGas<0)||(harvestedGas>MAX_GAS)) { debug.toLog(0,"DEBUG: (PRERACE::getHarvestedGas): Variable not initialized [%i].",harvestedGas); return(0); } return(harvestedGas); }; int PRERACE::getFinalTime(int goal) { if((goal<0)||(goal>=UNIT_TYPE_COUNT)) { debug.toLog(0,"DEBUG: (PRERACE::getFinalTime): Value [%i] out of range.",goal); return(0); } if((ftime[goal]<0)||(ftime[goal]>MAX_TIME)) { debug.toLog(0,"DEBUG: (PRERACE::getFinalTime): Variable not initialized [%i].",ftime[goal]); return(0); } return(ftime[goal]); }; int PRERACE::getLength() { if((length<0)||(length>MAX_LENGTH)) { debug.toLog(0,"DEBUG: (PRERACE::getLength): Variable not initialized [%i].",length); return(0); } return(length); }; int PRERACE::setIP(int num) { if((num<0)||(num>=MAX_LENGTH)) { debug.toLog(0,"DEBUG: (PRERACE::setIP): Value [%i] out of range.",num); return(0); } IP=num; return(1); }; int PRERACE::setMineralHarvestPerSecond(int tloc,int worker,int num) { if((num<0)||(num>=MAX_MINS)||(tloc<0)||(tloc>=MAX_LOCATIONS)||(worker<0)||(worker>=45)) { debug.toLog(0,"DEBUG: (PRERACE::setMineralHarvestPerSecond): Value [%i/%i/%i] out of range.",tloc,worker,num); return(0); } mineralHarvestPerSecond[tloc][worker]=num; return(1); }; int PRERACE::setGasHarvestPerSecond(int tloc,int worker,int num) { if((num<0)||(num>=MAX_GAS)||(tloc<0)||(tloc>=MAX_LOCATIONS)||(worker<0)||(worker>=5)) { debug.toLog(0,"DEBUG: (PRERACE::setGasHarvestPerSecond): Value [%i/%i/%i] out of range.",tloc,worker,num); return(0); } gasHarvestPerSecond[tloc][worker]=num; return(1); }; int PRERACE::setHarvestedMins(int num) { if((num<0)||(num>=MAX_MINS)) { debug.toLog(0,"DEBUG: (PRERACE::setHarvestedMins): Value [%i] out of range.",num); return(0); } harvestedMins=num; return(1); }; int PRERACE::setHarvestedGas(int num) { if((num<0)||(num>=MAX_GAS)) { debug.toLog(0,"DEBUG: (PRERACE::setHarvestedGas): Value [%i] out of range.",num); return(0); } harvestedGas=num; return(1); }; int PRERACE::setFinalTime(int goal, int num) { if((num<0)||(num>MAX_TIME)||(goal<0)||(goal>=UNIT_TYPE_COUNT)) { debug.toLog(0,"DEBUG: (PRERACE::setFinalTime): Value [%i/%i] out of range.",goal,num); return(0); } ftime[goal]=num; return(1); }; int PRERACE::setLength(int num) { if((num<0)||(num>MAX_LENGTH)) { debug.toLog(0,"DEBUG: (PRERACE::setLength): Value [%i] out of range.",num); return(0); } length=num; return(1); }; PRERACE::PRERACE() { int i,j; calculated=0; player=0; mins=0; gas=0; lastcounter=0; lastunit=0; timer=MAX_TIME; setSupply(0); setMaxSupply(0); harvestedGas=0; harvestedMins=0; length=0; //todo: mehr auf 0 setzen! for(i=0;i<MAX_LOCATIONS;i++) { for(j=0;j<45;j++) mineralHarvestPerSecond[i][j]=0; for(j=0;j<5;j++) gasHarvestPerSecond[i][j]=0; }; for(i=0;i<MAX_LENGTH;i++) { Code[0][i]=0; Code[1][i]=0; last[i].unit=0; last[i].location=0; last[i].count=0; }; }; int PRERACE::setTimeOut(int num) { if((num<0)||(num>MAX_TIMEOUT)) { debug.toLog(0,"DEBUG: (PRERACE::setTimeOut): Value [%i] out of range.",num); return(0); } timeout=num; return(1); }; int PRERACE::getTimeOut() { if((timeout<0)||(timeout>MAX_TIMEOUT)) { debug.toLog(0,"DEBUG: (PRERACE::getTimeOut): Variable not initialized [%i].",timeout); return(0); } return(timeout); }; void PRERACE::resetMapInitialized() { mapInitialized=0; }; void PRERACE::resetMapInitialized(); int PRERACE::setMap(MAP* map); MAP* PRERACE::getMap(); MAP* PRERACE::pMap; GA* PRERACE::ga; int PRERACE::mapInitialized; MAP_LOCATION PRERACE::loc[MAX_PLAYER][MAX_LOCATIONS];
2cfd39e06348475e014109fef315efedc71b6bc8
cbd553df5e5ab01d06f5591510d13f80cdd4f7ee
/main/test_lambda.cpp
7a27896fec2279333a0a6c818d11b3b8f3dc41bf
[]
no_license
pgmabv99/cpp_cmake2
9b832af109eef974046327adc874c2e9bb7180c6
286c21ef1094abcde047aa15d28c5ffdb470981f
refs/heads/master
2023-02-21T00:03:29.665440
2021-01-26T17:46:34
2021-01-26T17:46:34
325,173,446
0
0
null
null
null
null
UTF-8
C++
false
false
2,148
cpp
test_lambda.cpp
#include "util.h" #include "test.h" class test_lambda_t::impl_t { private: string fname = "hello"; }; test_lambda_t::test_lambda_t() { X2_CRT; impl_p = make_unique < test_lambda_t::impl_t>(); }; test_lambda_t::~test_lambda_t() { X2_DST; } bool fun_comp(int a, int b) { auto i = 1; return (abs(a) < abs(b)); } void test_lambda_t::run() { cout << "lambda run" << endl; int z = 100; auto lmb1 = [z](int a, int b) { auto x = a + b + z; cout << "lmb1 called " << x << endl; return x; }; lmb1(2, 3); auto lmb2 = [](int a) { cout << "lmb2 called " << a << endl; }; lmb1(2, 3); auto lmb_comp = [](auto a, auto b) { return(abs(a) < abs(b)); }; auto lst1 = new vector<int>({ 1,2 }); lst1->push_back(-3); int ar1[] = { 1,2,3 }; cout << " iter via begin/end" << endl; for (auto it = lst1->begin(); it != lst1->end(); it++) { lmb2(*it); } cout << " iter via range" << endl; for (const auto& v : *lst1) { lmb2(v); } cout << " iter via for_each with lambda defined previuosly " << endl; for_each(lst1->begin(), lst1->end(), lmb2); cout << " iter via for_each with lambda defined inline " << endl; for_each(lst1->begin(), lst1->end(), [](int a) {cout << a * 10 << endl; }); cout << "sort with default comp" << endl; sort(lst1->begin(), lst1->end()); for (auto v : *lst1) cout << v << endl; cout << "sort with lamda predefined override comp" << endl; sort(lst1->begin(), lst1->end(), lmb_comp); for (auto v : *lst1) cout << v << endl; cout << "sort with non lambda function predefined override comp" << endl; sort(lst1->begin(), lst1->end(), fun_comp); for (auto v : *lst1) cout << v << endl; // !!!! this is the real value of lambda . pass the function and the data handle !!!!!!!!!!!!!!!!! // for example you can pass the handle to the current sort collation object cout << "sort with lamda inline override comp passing this !!!" << endl; sort(lst1->begin(), lst1->end(), [this] // (auto a, auto b) { cout << " access this of caller from inline lamda " << this->sample_public_field << endl; return (abs(a) < abs(b)); }); for (auto v : *lst1) cout << v << endl; }
98fcd1b58809e1f2fbf27f52c991eeca14b99cd8
8750d8d980ef4ad950e9bad8ce5b43eb96b0275c
/src/Commands/Auto/AutoRightGearDelivery.cpp
1051e650e4a081e522428e0bb2a71a2a86a6fbeb
[]
no_license
FRC-4476-WAFFLES/Robot2017
3b5e8b9945e4f2e3078cc45532ab29ea7fca04b8
47020e91fb7325f39064b5cc03ced7d4566bde01
refs/heads/master
2022-01-29T09:45:27.073882
2018-06-18T00:18:49
2018-06-18T00:18:49
78,303,057
0
0
null
null
null
null
UTF-8
C++
false
false
458
cpp
AutoRightGearDelivery.cpp
#include "AutoRightGearDelivery.h" #include "Commands/Drive/DriveAuto.h" #include "Commands/Drive/DriveAutoRelative.h" #include "Commands/Drive/DriveHalfRelative.h" #include "Commands/Intake/ConveyorAuto.h" AutoRightGearDelivery::AutoRightGearDelivery() { SetTimeout(15.0); // AddParallel(new ConveyorAuto(1.0,1.0)); AddSequential(new DriveAuto(3.4,0)); AddSequential(new DriveHalfRelative(-45, 0.0)); AddSequential(new DriveAutoRelative(1.0, 0.0)); }
a7d9ce017a9a71bb9c7d7fb8dcec7beea5ca171d
23052253ddcb6611a100ae070b4c81c58763c5eb
/LogicalAND.cpp
97aaa09a785df5bb6c29d09e122721212212f4a5
[]
no_license
Chpaone09/CPP-Program-to-demonstrate-Logical-AND-Operator
077fc7696d3497268ac39c9525b34e50d5aeb3ec
f7cdf541f446205fd2f4aa42ede663c4fb43bd83
refs/heads/main
2023-01-01T01:50:29.380693
2020-10-18T21:48:11
2020-10-18T21:48:11
305,202,732
0
0
null
null
null
null
UTF-8
C++
false
false
747
cpp
LogicalAND.cpp
/* *********************************************************** Topic : Program to demonstrate Logical AND ( && ) Operator in cpp. Author : Chpaone09® Date : Oct 19, 2020 ************************************************************ */ #include <iostream> using namespace std; int main() { bool a = true; bool b = true; bool c = false; bool d = false; if(a && b){ cout<<"\n\n\t Both A and B are True. "; } if(a && c){ cout<<"\n\n\t A is True and C is False. "; } if(b && c){ cout<<"\n\n\t B is True and C is False. "; } if(c && d){ cout<<"\n\n\t Both C and D are FALSE. "; } }
1d7107d9501788b0bcf0fbe424872d735d81347f
c6d109a9bf019e29aa07c5cd5159eb5f3b407fe3
/sheaves/maps/name_multimap.cc
99aa8e8fea2ba50935dd9683ec872f4cceca59c8
[ "Apache-2.0" ]
permissive
LimitPointSystems/SheafSystem
883effa60ec9533a085e2d1442c83df721e8d264
617faf00175b1422be648b85146e43d2fc54f662
refs/heads/master
2020-09-12T20:01:59.763743
2017-05-02T20:48:52
2017-05-02T20:48:52
16,596,740
2
3
null
2017-05-02T20:48:52
2014-02-06T22:44:58
C++
UTF-8
C++
false
false
12,819
cc
name_multimap.cc
// // Copyright (c) 2014 Limit Point Systems, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /// @file /// Implementation for class name_multimap #include "SheafSystem/name_multimap.h" #include "SheafSystem/sheaf_dll_spec.h" #include "SheafSystem/assert_contract.h" #include "SheafSystem/deep_size.h" using namespace std; // ============================================================================= // NAME_MULTIMAP FACET // ============================================================================= // PUBLIC FUNCTIONS sheaf::name_multimap:: name_multimap() { // Preconditions: // Body: // Nothing to do. // Postconditions: ensure(invariant()); // Exit: return; } sheaf::name_multimap:: name_multimap(const name_multimap& xother) { // Preconditions: // Body: (*this) = xother; // Postconditions: ensure(invariant()); ensure(*this == xother); // Exit: return; } sheaf::name_multimap:: name_multimap(const std::string xnames[], size_type xnames_ub) { // Preconditions: // Body: for(index_type i = 0; i < xnames_ub; ++i) { if(!xnames[i].empty()) { _index_to_name_map[i].push_back(xnames[i]); _name_to_index_map[xnames[i]] = i; } } // Postconditions: ensure(invariant()); ensure_for_all(i, 0, xnames_ub, !xnames[i].empty() ? name(index_type(i)) == xnames[i] : true); // Exit: return; } sheaf::name_multimap:: ~name_multimap() { // Preconditions: // Body: // Nothing to do. // Postconditions: // Exit: return; } std::string sheaf::name_multimap:: name(index_type xindex) const { // Preconditions: // Body: index_to_name_map_type::const_iterator map_result = _index_to_name_map.find(xindex); if(map_result != _index_to_name_map.end()) { // This index has a name. // Exit return map_result->second.front(); } else { // This index has no name. string result; // empty string // Postcondition: ensure(result.empty() == !contains_index(xindex)); // Exit return result; } } std::string sheaf::name_multimap:: name(index_type xindex, int xi) const { // Preconditions: // Body: string result; const name_list_type& lnames = all_names(xindex); const_name_iterator litr = lnames.begin(); int i = 0; while(litr != lnames.end()) { if(i == xi) { result = *litr; break; } ++litr; ++i; } // Postconditions: ensure((!result.empty()) == ((0 <= xi) && (xi < name_ct(xindex))) ); // Exit: return result; } const sheaf::name_multimap::name_list_type& sheaf::name_multimap:: all_names(index_type xindex) const { // Preconditions: // Body: static const name_list_type empty_list; const_iterator map_result = _index_to_name_map.find(xindex); const name_list_type& result = (map_result != _index_to_name_map.end()) ? map_result->second : empty_list; // Postconditions: // Exit: return result; } void sheaf::name_multimap:: all_names(index_type xindex, block<std::string>& xresult) const { // Preconditions: // Body: xresult.reserve(4); // Arbitrary; will resize as needed. xresult.set_ct(0); const name_list_type& lnames = all_names(xindex); for(const_name_iterator itr = lnames.begin(); itr != lnames.end(); ++itr) { xresult.push_back(*itr); } // Postconditions: ensure(xresult.ct() == name_ct(xindex)); // Exit: return; } sheaf::name_multimap::index_type sheaf::name_multimap:: index(const std::string& xname) const { index_type result; // Preconditions: require(!xname.empty()); // Body: // Lookup the name in the name-to-index map. typedef name_to_index_map_type::const_iterator itr_type; itr_type litr = _name_to_index_map.find(xname); if(litr != _name_to_index_map.end()) { // Name is in the map; result is the value of the map. result = litr->second; } else { // Name not in the map; result is invalid. result = invalid_pod_index(); } // Postconditions: // Must be unexecutable or create infinite recursion. ensure(unexecutable(is_valid(result) == !contains_name(xname))); // Exit return result; } void sheaf::name_multimap:: put_entry(const entry_type& xentry, bool xunique) { // Preconditions: require(!xentry.second.empty()); require(!contains_name(xentry.second)); // Body: if(xunique) { // Delete all other entries for this index. delete_index(xentry.first); } _index_to_name_map[xentry.first].push_back(xentry.second); _name_to_index_map[xentry.second] = xentry.first; // Postconditions: ensure(contains_entry(xentry)); // Exit } void sheaf::name_multimap:: put_entry(index_type xindex, const std::string& xname, bool xunique) { // Preconditions: require(!xname.empty()); require(!contains_name(xname)); // Body: entry_type ltmp(xindex, xname); put_entry(ltmp, xunique); // Postconditions: ensure(contains_entry(xindex, xname)); // Exit: return; } bool sheaf::name_multimap:: contains_name(const std::string& xname) const { bool result; // Preconditions: require(!xname.empty()); // Body: result = _name_to_index_map.find(xname) != _name_to_index_map.end(); // Postconditions: // Exit return result; } bool sheaf::name_multimap:: contains_index(index_type xindex) const { // Preconditions: // Body: // Postconditions: // Exit: return _index_to_name_map.find(xindex) != _index_to_name_map.end(); } bool sheaf::name_multimap:: contains_entry(index_type xindex, const std::string& xname) const { // Preconditions: require(!xname.empty()); // Body: bool result; entry_type entry(xindex, xname); result = contains_entry(entry); // Postconditions: // Exit: return result; } bool sheaf::name_multimap:: contains_entry(const entry_type& xentry) const { // Preconditions: require(!xentry.second.empty()); // Body: bool result; result = contains_name(xentry.second) && (index(xentry.second) == xentry.first); // Postconditions: // Exit: return result; } void sheaf::name_multimap:: delete_index(index_type xindex) { // Preconditions: // Body: // Remove xindex from the name to index map. const name_list_type& lnames = all_names(xindex); for(const_name_iterator itr = lnames.begin(); itr != lnames.end(); ++itr) { _name_to_index_map.erase(*itr); } // Remove xindex from the index to name map. _index_to_name_map.erase(xindex); // Postcondition ensure(!contains_index(xindex)); // Exit return; } void sheaf::name_multimap:: delete_name(const std::string& xname) { // Preconditions: require(!xname.empty()); // Find entry in name to index map. name_to_index_map_type::iterator itr = _name_to_index_map.find(xname); if(itr != _name_to_index_map.end()) { // Found name to index entry; // find and delete corresponding index to name entry. iterator lindex_entry = _index_to_name_map.find(itr->second); name_list_type& lnames = lindex_entry->second; name_iterator lname_itr = lnames.begin(); while(lname_itr != lnames.end()) { if((*lname_itr) == xname) { lnames.erase(lname_itr); break; } ++lname_itr; } if(lnames.empty()) { // List of names for this index is now empty; // delete the entry. _index_to_name_map.erase(lindex_entry); } // Now erase the name to index entry. _name_to_index_map.erase(itr); } // Postcondition ensure(!contains_name(xname)); // Exit return; } void sheaf::name_multimap:: clear() { // cout << endl << "Entering name_multimap::clear." << endl; // Preconditions: // Body: _name_to_index_map.clear(); _index_to_name_map.clear(); // Postconditions: ensure(empty()); // Exit: // cout << "Leaving name_multimap::clear." << endl; return; } bool sheaf::name_multimap:: empty() const { // cout << endl << "Entering name_multimap::empty." << endl; // Preconditions: // Body: bool result = (_name_to_index_map.empty() && _index_to_name_map.empty()); // Postconditions: // Exit: // cout << "Leaving name_multimap::empty." << endl; return result; } sheaf::name_multimap::const_iterator sheaf::name_multimap:: begin() const { return _index_to_name_map.begin(); } sheaf::name_multimap::const_iterator sheaf::name_multimap:: end() const { return _index_to_name_map.end(); } int sheaf::name_multimap:: ct() const { return _index_to_name_map.size(); } void sheaf::name_multimap:: print() const { print(cout, *this); } void sheaf::name_multimap:: print(std::ostream& xos, const name_multimap& xm) const { // Preconditions: // Body: name_multimap::const_iterator itr = xm.begin(); while(itr != xm.end()) { xos << "index: " << itr->first << "\tnames: " ; const name_multimap::name_list_type& lnames = itr->second; name_multimap::const_name_iterator name_itr = lnames.begin(); while(name_itr != lnames.end()) { xos << " \"" << *name_itr << "\""; ++name_itr; } xos << endl; ++itr; } // Postconditions: // Exit: return; } sheaf::size_type sheaf::name_multimap:: name_ct(const index_type& xindex) const { return all_names(xindex).size(); } // PROTECTED FUNCTIONS // PRIVATE FUNCTIONS // =========================================================== // ANY FACET // =========================================================== // PUBLIC FUNCTIONS sheaf::name_multimap* sheaf::name_multimap:: clone() const { name_multimap* result; // Preconditions: // Body: result = new name_multimap(*this); // Postconditions: ensure(result != 0); ensure(is_same_type(result)); // Exit: return result; } bool sheaf::name_multimap:: invariant() const { bool result = true; // Preconditions: // Body: // Must satisfy base class invariant result = result && any::invariant(); if(invariant_check()) { // Prevent recursive calls to invariant disable_invariant_check(); invariance(_index_to_name_map.size() <= _name_to_index_map.size()); // Finished, turn invariant checking back on. enable_invariant_check(); } // Postconditions: // Exit return result; } bool sheaf::name_multimap:: is_ancestor_of(const any* xother) const { // Preconditions: require(xother != 0); // Body: // True if other conforms to this. bool result = dynamic_cast<const name_multimap*>(xother) != 0; // Postconditions: return result; } bool sheaf::name_multimap:: operator==(const name_multimap& xother) { // Preconditions: // Body: bool result = (_name_to_index_map == xother._name_to_index_map) && (_index_to_name_map == xother._index_to_name_map); // Postconditions: // Exit return result; } sheaf::name_multimap& sheaf::name_multimap:: operator=(const name_multimap& xother) { // Preconditions: // Body: _name_to_index_map = xother._name_to_index_map; _index_to_name_map = xother._index_to_name_map; // Postconditions: ensure(invariant()); ensure(*this == xother); // Exit return *this; } // PROTECTED FUNCTIONS // PRIVATE FUNCTIONS // =========================================================== // NON-MEMBER FUNCTIONS // =========================================================== ostream& sheaf:: operator<<(ostream& xos, const name_multimap& xm) { // Preconditions: // Body: xm.print(xos, xm); return xos; // Postconditions: // Exit: return xos; } size_t sheaf:: deep_size(const name_multimap& xp, bool xinclude_shallow) { size_t result; // Preconditions: // Body: result = xinclude_shallow ? sizeof(xp) : 0; // Add the deep size of the data members. typedef name_multimap::index_type index_type; typedef key_deep_size_policy<map<string, index_type> > name_to_index_policy; result += deep_size<string, index_type, name_to_index_policy> (xp._name_to_index_map, false); typedef value_deep_size_policy<map<index_type, list<string> > > index_to_name_policy; result += deep_size<index_type, list<string>, index_to_name_policy> (xp._index_to_name_map, false); // Postconditions: ensure(result >= 0); // Exit return result; }
c79f1b2ed132fd579c68eccc92fb2254940ca01d
1f4f393dbeca10cf4a16515cf31045a71450faf0
/MiracleLib/MiracleException.cpp
98f24f506ae03d61c2076f6c300ba4fe3cb8b65a
[]
no_license
hozgur/Colorway
e3d8ba36d12fb72239b8c6d69efdd05e1653158a
34e712d228a393573547f95d44261b14c136731a
refs/heads/master
2016-09-05T23:37:11.631592
2011-02-28T14:04:11
2011-02-28T14:04:11
1,420,980
0
0
null
null
null
null
UTF-8
C++
false
false
586
cpp
MiracleException.cpp
// MiracleException.cpp: implementation of the CMiracleException class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "MiracleException.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CMiracleException::CMiracleException():CMiracleObj("MiracleException") { } CMiracleException::~CMiracleException() { }
9598eef308fad2bf0a0c833d8046d0b7c92298df
8c1fe85cf353af702c2a16350bb7ced311e44103
/src/core/utils/search_path.cc
0e8a26f05e6f7349f930d129d25ca9d67856610d
[ "MIT" ]
permissive
ilariom/wildcat
02b0f71a118927885724f100f49cbe427ee6db14
814f054e0cf3ef0def1f6481005ffd3f0ac42d1b
refs/heads/master
2021-07-10T03:48:43.223015
2020-07-15T09:01:13
2020-07-15T09:01:13
156,458,138
16
1
null
null
null
null
UTF-8
C++
false
false
758
cc
search_path.cc
#include "search_path.h" #include <unordered_map> #include <vector> #include <cstdio> namespace { std::unordered_map<std::string, std::string> paths; std::vector<std::string> searchPaths; } namespace wkt { namespace path { void add(const std::string& path) { searchPaths.push_back(path); } std::string locate(const std::string& filename) { if (paths.find(filename) == paths.end()) { for (const std::string& basepath : searchPaths) { std::string fullpath = basepath + "/" + filename; if (FILE* f = fopen(fullpath.c_str(), "r")) { fclose(f); paths[filename] = fullpath; break; } } } return paths[filename]; } }}
7a4cc35324d8519a4e7451014212a4d3251b2b6e
a23ec145b281e72a2906b20d94049950ab1466cb
/day03/ex02/FragTrap.cpp
fbf6fb86043ab7e5d489e22e51ef589f85cc3707
[]
no_license
oghobhainn/19_cpp_modules
87c8efc8df59b25f0282d5c63fdcf3d620469e19
a8f7b679c183df4ce86d57222bebf5fdb77da895
refs/heads/master
2023-05-07T10:13:14.619060
2021-05-20T13:44:34
2021-05-20T13:44:34
253,504,665
0
0
null
null
null
null
UTF-8
C++
false
false
1,769
cpp
FragTrap.cpp
#include "FragTrap.hpp" //=========== CONSTRUCTORS / DESTRUCTORS ==============// FragTrap::FragTrap(std::string const &name) : ClapTrap(name) { m_meleeAttackDamage = 30; m_rangedAttackDamage = 20; m_armorDamageReduction = 5; std::cout << "FR4G-TP New " << name << ": here to kick some donkeys" << std::endl; } FragTrap::FragTrap(FragTrap const &src) { std::cout << "FR4G-TP copy from " << src.m_name << std::endl; *this = src; } FragTrap::~FragTrap ( void ) { std::cout << "FR4G-TP Delete " << m_name << ": out of donkeys to kick" << std::endl; return; } FragTrap::FragTrap() {} //=========== FONCTIONS MEMBRES ==============// void FragTrap::vaulthunter_dot_exe(std::string const &target) { if (m_energyPoints < 25) { std::cout << "FR4G-TP " << m_name << " needs a redbull 'coz he doesn't have enough energy..." << std::endl; return ; } m_energyPoints -= 25; std::string attacks[5] = { "'swings his lightsaber'", "'boring him to death with philospohy explanations'", "'calling his mom that destroys him'", "'convincing him to swallow his own tongue through good persuasion'", "'giving him some nuts... too bad, he's allergic'" }; std::cout << "FR4G-TP " << m_name << " attacks " << target << " by " << attacks[rand() % 5] << std::endl; } //=========== OPERATEURS MEMBRES ==============// FragTrap &FragTrap::operator=(FragTrap const &other) { m_hitPoints = other.m_hitPoints; m_maxHitPoints = other.m_maxHitPoints; m_energyPoints = other.m_energyPoints; m_maxEnergyPoints = other.m_maxEnergyPoints; m_level = other.m_level; m_meleeAttackDamage = other.m_meleeAttackDamage; m_rangedAttackDamage = other.m_rangedAttackDamage; m_armorDamageReduction = other.m_armorDamageReduction; return *this; }
86d0348241128a10c9cbfb56186363282170e472
922a76fa7dd5b57a3fa83f2a38db906254ee145c
/src/Spotify/SpotifyAPITypes.h
f93109ca8883f0a354707db880079d3afb619e92
[]
no_license
wurmmi/VirtualJukebox
323144ea8ba1cce1b7b8887297bf4fed6f35c401
fdd478770d64f53e477bea16ce183013fb3c4465
refs/heads/master
2021-01-02T18:30:32.824669
2019-12-18T21:19:19
2019-12-18T21:19:19
239,744,287
1
0
null
2020-02-11T11:20:19
2020-02-11T11:20:19
null
UTF-8
C++
false
false
9,016
h
SpotifyAPITypes.h
/** * @file SpotifyAPITypes.h * @author Stefan Jahn <stefan.jahn332@gmail.com> * @brief Contains Structures for the Spotify Api * @details These Structures are implemented as described the Spotify Object * Model Link: * https://developer.spotify.com/documentation/web-api/reference/object-model/ * Some structures doesn't contain the whole information given in the * object model */ #ifndef SPOTIFYAPITYPES_H_INCLUDED #define SPOTIFYAPITYPES_H_INCLUDED #include <string> #include <vector> #include "json/json.hpp" namespace SpotifyApi { /** * @brief Possible Autorization Flows (until now only AuthorizationCode gets * implemented) */ enum GrantType { AuthorizationCode, ClientCredentials, ImplicitGrant }; /** * @brief return type on valid token request */ class Token { public: Token() = default; Token(nlohmann::json const &tokenJson); void setRefreshToken(std::string const &token); std::string const &getAccessToken() const; std::string const &getRefreshToken() const; std::string const &getTokenType() const; std::string const &getScope() const; size_t getExpiresIn() const; private: std::string mAccesToken; /**< Access token to interact with the SpotifyWebAPI */ std::string mRefreshToken; /**< Can be used to refresh the accessToken when expired */ std::string mTokenType; /**< Type of the token (always "Bearer" */ std::string mScope; /**< a list of space seperated scopes granted for this acces token */ size_t mExpiresIn; /**< time period (in seconds) for which the access token is valid */ }; /** * @brief Device Object */ class Device { public: Device() = default; Device(nlohmann::json const &deviceJson); std::string const &getID() const; bool isActive() const; bool isPrivateSession() const; bool isRestricted() const; std::string const &getName() const; std::string const &getType() const; size_t getVolume() const; private: std::string mId; /**< the device id. may be empty */ bool mIsActive; /**< if this device is the currently active device */ bool mIsPrivateSession; /**< if this device is currently in a private session */ bool mIsRestricted; /**< if true, no web api commands will be accepted by this device */ std::string mName; /**< name of the device */ std::string mType; /**< type of the device (Computer, Smartphone, Speaker, ...) */ size_t mVolume; /**< current volume in percent */ }; /** * @brief Wrapper class for multiple devices */ class Devices { public: Devices() = default; Devices(nlohmann::json const &devicesJson) { if (devicesJson.find("devices") != devicesJson.end()) { for (nlohmann::json const &elem : devicesJson["devices"]) { mDevices.emplace_back(Device(elem)); } } } std::vector<Device> mDevices; }; /** * @brief Simplified artist object */ class Artist { public: Artist() = default; Artist(nlohmann::json const &artistJson); std::string const &getHref() const; std::string const &getID() const; std::string const &getName() const; std::string const &getType() const; std::string const &getUri() const; private: std::string mHref; /**< A link to the Web API endpoint providing full details of the artist */ std::string mId; /**< the Spotify ID for the artist */ std::string mName; /**< the name of the artist */ std::string mType; /**< object type (always "artist") */ std::string mUri; /**< Spotify URI for the artist */ }; /** * @brief Spotify Image Class */ class Image { public: Image() = default; Image(nlohmann::json const &imageJson); int getHeight(); int getWidth(); std::string const &getUrl() const; private: int mHeight; /**< the image height in pixels, if unknown 0 */ int mWidth; /**< the image width in pixels, if unknown 0 */ std::string mUrl; /**< the source url of the image */ }; /** * @brief Simplified Spotify Album class */ class Album { public: Album() = default; Album(nlohmann::json const &albumJson); std::vector<Artist> const &getArtists() const; std::vector<Image> const &getImages() const; std::string const &getAlbumType() const; std::string const &getHref() const; std::string const &getId() const; std::string const &getName() const; std::string const &getReleaseDate() const; std::string const &getType() const; std::string const &getUri() const; private: std::string mAlbumType; /**< type of album (can contain album, single, compilation) */ std::vector<Artist> mArtists; /**< array of simplified artists */ std::string mHref; /**< a link to the wep api endpoint providing full details of the album */ std::string mId; /**< Spotify ID for the album */ std::string mName; /**< name of the album (can be an empty string) */ std::string mReleaseDate; /**< release date ( can be 1981, 1981-12 or 1981-12-15) */ std::string mType; /**< the object type, always "album" */ std::string mUri; /**< spotify uri for the album */ std::vector<Image> mImages; /**< array of cover arts in various sizes */ }; /** * @brief Simplified track object */ class Track { public: Track() = default; Track(nlohmann::json const &trackJson); std::vector<Artist> const &getArtists() const; Album const &getAlbum() const; size_t getDuration() const; std::string const &getHref() const; std::string const &getId() const; std::string const &getName() const; std::string const &getUri() const; private: std::vector<Artist> mArtists; /**< the artists who performed the track */ Album mAlbum; size_t mDurationMs; /**< the track length in milliseconds */ std::string mHref; /**< a link to the wep api endpoint providing full details of the track */ std::string mId; /**< Spotify ID for the track */ std::string mName; /**< name of the track */ std::string mUri; /**< spotify URI for the track */ }; /** * @brief Contains infos about the actual playback */ class Playback { public: Playback() = default; Playback(nlohmann::json const &playbackJson); Device const &getDevice() const; std::string const &getRepeatState() const; bool getShuffleState() const; size_t getTimestamp() const; size_t getProgressMs() const; bool isPlaying() const; std::string const &getCurrentPlayingType() const; std::optional<Track> const &getCurrentPlayingTrack() const; private: Device mDevice; /**< device that is currently active */ std::string mRepeatState; /**< current repeat state status ("off", "track", "context") */ bool mShuffleState; /**< if shuffle is on or off */ size_t mTimestamp; /**< unix millisecond timestamp when data was fetched */ size_t mProgressMs; /**< progress into the currently playing track */ bool mIsPlaying; /**< if something is currently playing */ std::string mCurrentPlayingType; /**< current playing type, can be "track", "episode", "ad", "unknown" */ std::optional<Track> mTrack; /**< currently playing track */ }; /** * @brief Represents one page of search results. */ class SpotifyPaging { public: SpotifyPaging() = default; SpotifyPaging(nlohmann::json const &pagingJson); std::vector<Track> const &getTracks() const; std::vector<Artist> const &getArtists() const; std::vector<Album> const &getAlbums() const; std::string const &getHref() const; int getLimit() const; std::string const &getNext() const; int getOffset() const; std::string const &getPrevious() const; int getTotal() const; private: std::vector<Track> mTracks; /**< array of tracks */ std::vector<Artist> mArtists; /**< array of artists */ std::vector<Album> mAlbums; /**< array of albums */ std::string mHref; /**< a link to the web api endpoint returning the full result of the request */ int mLimit; /**< the maximum number of items in the response */ std::string mNext; /**< url to the next page of items (can be left empty) */ int mOffset; /**< offset of the items returned (as set in the query) */ std::string mPrevious; /**< url to the previos page of items */ int mTotal; /**< total number of items available */ }; /** * @brief Error type */ class SpotifyError { public: SpotifyError(nlohmann::json const &errorJson); int getStatus() const; std::string const &getMessage() const; private: int mStatus; /**< http status code */ std::string mMessage; /**< a short description of the cause of the error */ }; /** * @brief Type gets used, when no content data or Error is received */ class SpotifyDummy { public: SpotifyDummy() = default; SpotifyDummy(nlohmann::json const &dummyJson) { (void)dummyJson; } }; } // namespace SpotifyApi #endif // VIRTUALJUKEBOX_SPOTIFYAPITYPES_H
52c47537dc4e94b7c636dce6272cdee10ed7c9d8
dbcf4efd6a38bff97e3d2aa521c3a07bdeaa6f22
/LoRa_MutiSensorforSTM32/LoRa_Weather_StationV1.0.2.191115_beta_LiuJiaHui/LoRa_Weather_StationV1.0.2.191115_beta_LiuJiaHui/BCD_CON.cpp
bfcb8cb3356ead6527d92d9305caf4ad5daa01d7
[]
no_license
Arrogantyunya/LoRa_MutiSensorforSTM32
55b2a27947df0817121f034d7434fde8d36dcdf3
02b21670c9c431ed8e15d93e606aa150c0d91828
refs/heads/master
2020-09-11T02:09:41.364252
2019-11-23T08:22:59
2019-11-23T08:22:59
221,905,012
2
0
null
null
null
null
UTF-8
C++
false
false
9,561
cpp
BCD_CON.cpp
/************************************************************************************************** Filename: BCD_CON.c Description: BCD Code conversion function **************************************************************************************************/ /****************************************************************************** * INCLUDES */ //#include "BCD_CON.h" #include "math.h" #include "stdlib.h" #include <string.h> #include <ctype.h> #include <stdio.h> /*************************************************************************************************** * CONSTANTS ***************************************************************************************************/ /*************************************************************************************************** * GLOBAL VARIABLES ***************************************************************************************************/ //基于查表实现BCD与Ascii之间的转换 static const unsigned char bcd2ascii[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; static const unsigned char ascii2bcd1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; static const unsigned char ascii2bcd2[6] = {0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; /****************************************************************************** * FUNCTIONS */ /*******************************************************************************/ /****************************************************************************** * @fn ToBCD * * @brief conversion tow Byte to one BCD * * @param n - out BCD * p0- one byte point * P1- tow byte point * flag - num flag * @return none */ void ToBCD(int n,unsigned char *p1,unsigned char *p0,unsigned char *flag) { char ch3,ch2,ch1,ch0; int m; if(n<0) { *flag=1; m=-n; } else { *flag=0; m=n; } if(m>9999 ) { *p1=0x99; *p0=0x99; } else { ch3=m/1000; //取最高位 ch2=(m-ch3*1000)/100; //取次高位 ch1=(m-ch3*1000-ch2*100)/10; ch0=m%10; //取最低位 *p1=((ch3 & 0x0f)<<4) | (ch2 & 0x0f); *p0=((ch1 & 0x0f)<<4) | (ch0 & 0x0f); } } /****************************************************************************** * @fn ByteTOBcd * * @brief conversion one Byte to one BCD * * @param OneByte - dec * @return BCD code */ unsigned char ByteTOBcd(unsigned char OneByte) { unsigned char temp,ch1,ch2; ch1=OneByte/10; ch2=OneByte%10; //temp = ((OneByte>>4)&0x0F)*10 + (OneByte&0x0F); temp=((ch1 & 0x0f)<<4) | (ch2 & 0x0f); return temp; } /*BCD 与 ASCII码转换*/ /******************************************************************* 函数名: asc2bcd 功能描述:将ascii码转换为bcd码 参数: bcd:转换后的BCD码 asc:需转换的ASCII码串 len:需转换的ascii码串长度 返回值: uint32 0:成功 其他:失败 ********************************************************************/ unsigned int ASC2BCD(unsigned char *bcd, char *asc, unsigned int len) { unsigned char c = 0; unsigned char index = 0; unsigned char i = 0; if(len%2!=0) { len+=1; } len >>= 1; for(; i < len; i++) { //first BCD if(*asc >= 'A' && *asc <= 'F') { index = *asc - 'A'; c = ascii2bcd2[index] << 4; } else if(*asc >= '0' && *asc <= '9') { index = *asc - '0'; c = ascii2bcd1[index] << 4; } asc++; //second BCD if(*asc >= 'A' && *asc <= 'F') { index = *asc - 'A'; c |= ascii2bcd2[index]; } else if(*asc >= '0' && *asc <= '9') { index = *asc - '0'; c |= ascii2bcd1[index]; } asc++; *bcd++ = c; } /* int j=len-1; unsigned char temp; do { if(bcd[j]==0x00) { temp=bcd[0]; bcd[0]=bcd[j]; } else { break; } j--; }while(j>0); */ return 0; } /******************************************************************* 函数名: bcd2asc 功能描述:将bcd码转换为ascii码串 参数: asc:转换的ASCII码串 bcd:需转换的BCD码 len:需转换的BCD码长度 返回值: uint32 0:成功 其他:失败 ********************************************************************/ unsigned int BCD2ASC ( char *asc, const char *bcd, unsigned int len) { unsigned char c = 0; unsigned char i; for(i = 0; i < len; i++) { //first BCD c = *bcd >> 4; *asc++ = bcd2ascii[c]; //second c = *bcd & 0x0f; *asc++ = bcd2ascii[c]; bcd++; } return 0; } /****************************************************************************** * @fn FloatStringToIntString * * @brief 把一个带小数据的字符串转换成一个整型数的字符串,并返回小数位数 * * @param fstring-小数字符串 Istring-整型数据字符串 * NumOfDot-小数位数变量指针 sringLen-小数字符串的长度 * @return None */ void FloatStringToIntString( char *fstring, char *Istring, unsigned char *NumOfDot,int sringLen) { unsigned char L1,L2,Slen; unsigned char i,j; int offset=0; Slen=strlen((char*)fstring); j=0; for(i=0;i<=Slen;i++) { if(fstring[i]==0x2E)//小数点 { L1=i; } else if(fstring[i]==0x2C) //,号 { L2=i; *NumOfDot=L2-L1-1; } //结束符 else if(fstring[i]==0x00) //结束符 { Istring[j++]='\0'; break; } else { Istring[j++]=fstring[i]; } } } void ulongtoString(char buffer[],unsigned long a) { int i,j; i=0; while(a) { buffer[i++]=a%10+'0'; a/=10; } for(j=0;j<=i/2;j++) { int t=buffer[j]; buffer[j]=buffer[i-j-1]; buffer[i-j-1]=t; } buffer[i]='\0'; } // 压缩BCD码一个字符所表示的十进制数据范围为0 ~ 99,进制为100 // 先求每个字符所表示的十进制值,然后乘以权 ////////////////////////////////////////////////////////// unsigned int BCDtoDec(unsigned char *bcd, int length) { int i, tmp; unsigned int dec = 0; for(i=0; i<length; i++) { tmp = ((bcd[i]>>4)&0x0F)*10 + (bcd[i]&0x0F); dec += tmp*pow(100,length-1-i); } return dec; } unsigned int inttoBCD(int m) { unsigned int r=0,n=1; int a; while(m) { a=m %10; m=m/10; r=r+n*a; a=a<<4; } return r; } /*---------------------------------------------------------------------- * BCD编码 * char* buff : 目标缓冲区 * float value : 值 * int width : 目标宽度 * int decimal: 目标小数位数 *--------------------------------------------------------------------*/ void PackBCD(char* buff, float value, int width, int decimal) { int i; if ((float)value >= pow(10.0, width-decimal)) { memset(buff, 0, width); return; } for (i=0; i<(width-decimal)/2; i++) { buff[i] = (int)(value/pow(10.0, width-decimal-i*2-1)) % 10*16 + (int)(value/pow(10.0, width-decimal-i*2-2)) % 10; } for (i=(width-decimal)/2; i<width/2; i++) { buff[i] = (int)(value*pow(10, i*2+decimal-width+1)) % 10 *16 + (int)(value*pow(10, i*2+decimal-width+2)) % 10; } } /*---------------------------------------------------------------------- * BCD解码 * char* buff : BCD码 缓冲区 * int width : 目标宽度 * int decimal: 目标小数位数 * 返回:转换后的浮点数 *--------------------------------------------------------------------*/ float UnPackBCD(char* buff, int width, int decimal) { float value = 0; int i; for (i=0; i<(width-decimal)/2; i++) { value+=(buff[i]/16 * pow(10, width-decimal-i*2-1) + buff[i]%16 * pow(10, width-decimal-i*2-2)); } for (i=(width-decimal)/2; i<width/2; i++) { value+=(buff[i]/16 / pow(10, i*2+decimal-width+1) + buff[i]%16 / pow(10, i*2+decimal-width+2)); } return value; } int FindDecimal(char *str) { int len = 0, i; for(i = 0; i < strlen(str); i ++) { if(str[i]!='.') { len ++; } else { break; } } return strlen(str) - len - 1; } void long_to_bcd(unsigned long sec) { unsigned char a[10]; a[0] = sec % 10; // 获得个位 a[1] = sec / 10 % 10; // 获得十位 a[2] = sec / 100 % 10; // 获得百位 a[3] = sec / 1000 % 10; // 获得千位 a[4] = sec / 10000 % 10; // 获得万位 a[5] = sec / 100000 % 10; // 获得十万位 a[6] = sec / 1000000 % 10; // 获得百万位 a[7] = sec / 10000000 % 10; // 获得千万位 a[8] = sec / 100000000 % 10; // 获得亿位 a[9] = sec / 1000000000 % 10; // 获得十亿位 }
3fc2056f30bfb5332642147ed1f5b20ad830ec34
3f155f2399709ae63f4ee8f8e865be0223652cf8
/hdnes/mapper1.h
51337c7a9baf35c5c3106c3875c9bacff5460712
[]
no_license
mkwong98/HDNes
ccbee98482d90d4c32b65808c6689550c9cfc02b
ad4f571cd14e467d98528eb7f56b3e66de4d8158
refs/heads/master
2021-06-24T10:16:08.687557
2021-01-12T16:43:39
2021-01-12T16:43:39
21,164,505
32
2
null
null
null
null
UTF-8
C++
false
false
1,003
h
mapper1.h
#pragma once #include "mapper.h" //mmc1 class mapper1 : public mapper { private: Uint8 writeRegBuffer; Uint8 writeNum; Uint8 reg[4]; boolean chr8KMode; boolean prg32KMode; boolean slotCSwap; Uint8 chrReg0; Uint8 chrReg1; boolean wramDisable; Uint8 prgReg; Uint32 lastPrgRead; Uint8* chrPtr[2]; Uint8* prgPtr[2]; void setMirroring(); void setBankSwitching(); void writeReg0(Uint8 data); void writeReg1(Uint8 data); void writeReg2(Uint8 data); void writeReg3(Uint8 data); public: mapper1(void); ~mapper1(void); void runCatchUp(unsigned int cycle); void resetCycleCount(); void writeCPUData(Uint16 address, Uint8 data); Uint8 readCPUData(Uint16 address, bool opRead); void writePPUData(Uint16 address, Uint8 data); Uint8 readPPUData(Uint16 address); void getPattern(Uint16 address, Uint8 row, bool isFirst, Uint8& data, Uint32& patternAddress, Uint32& ramAddress); void saveState(fstream* statefile); void loadState(fstream* statefile); };
23033cd3ee6f8210fb34b39b5aed4d1b73fc4860
a58e563e300aebe8a49c45c912824ae41de3f607
/include/sleepy_discord/server.h
7ad462c5b24bcaec1fad3936fdbeb87489787dec
[ "MIT" ]
permissive
braindigitalis/sleepy-discord
e2db04e6a6f1dbae7e6ad786b6e9d4a82a61188c
b075a5ca1b1f7c372ba6d2533bd2a5ca8d99bb05
refs/heads/master
2020-08-26T13:23:07.683805
2020-05-20T09:15:43
2020-05-20T09:15:43
217,024,010
2
0
MIT
2020-05-20T09:15:44
2019-10-23T09:52:13
C++
UTF-8
C++
false
false
3,523
h
server.h
#pragma once #include <string> #include <list> #include "discord_object_interface.h" #include "user.h" #include "channel.h" #include "snowflake.h" namespace SleepyDiscord { enum Permission : int64_t; struct Role; /*Guild Member Structure Field Type Description user object user object nick string? this users guild nickname (if one is set) roles array array of role object id's joined_at datetime date the user joined the guild deaf bool if the user is deafened mute bool if the user is muted */ struct ServerMember : public IdentifiableDiscordObject<User> { ServerMember(); ServerMember(const std::string * rawJson); ServerMember(const std::vector<std::string> values); User user; std::string nick; //nullable std::vector<Snowflake<Role>> roles; std::string joinedAt; bool deaf; bool mute; operator User&() { return user; } private: const static std::initializer_list<const char*const> fields; }; struct Server : public IdentifiableDiscordObject<Server> { ~Server(); Server(); Server(const std::string * rawJson); Server(const std::vector<std::string> values); std::string name; std::string icon; std::string splash; Snowflake<User> ownerID; Permission permissions; std::string region; std::string AFKchannelID; int AFKTimeout; bool embedEnable; std::string embedChannelID; int verficationLevel; int defaultMessageNotifications; std::vector<Role> roles; //voice_states //emojis //features bool unavailable; //presences int MFALevel; std::string joinedAt; //those are only filled in from the onServer event bool large; std::vector<ServerMember> members; std::vector<Channel> channels; std::vector<ServerMember>::iterator findMember(Snowflake<User> userID); std::vector<Channel>::iterator findChannel(Snowflake<Channel> channelID); private: const static std::initializer_list<const char*const> fields; }; struct UnavailableServer : public IdentifiableDiscordObject<Server> { UnavailableServer(const std::string * rawJson); UnavailableServer(const std::vector<std::string> values); bool unavailable; private: const static std::initializer_list<const char*const> fields; }; struct ServerCache : public std::list<Server> { using std::list<Server>::list; ServerCache() : list() {} //for some odd reason the default constructor isn't inherited ServerCache(std::list<Server> list) : std::list<Server>(list) {} template<class Container, class Object> iterator findOnetWithObject(Container Server::*list, const Snowflake<Object>& objectID) { return std::find_if(begin(), end(), [&objectID, list](Server& server) { auto result = objectID.findObject(server.*list); return result != std::end(server.*list); }); } inline iterator findSeverWith(const Snowflake<Channel>& channelID) { return findOnetWithObject(&Server::channels, channelID); } inline iterator findServerWith(const Snowflake<Role> roleID) { return findOnetWithObject(&Server::roles, roleID); } inline iterator findServer(const Snowflake<Server> serverID) { return std::find_if(begin(), end(), [&serverID](Server& server) { return server.ID == serverID; }); } }; struct ServerEmbed : public DiscordObject { ServerEmbed(const std::string * rawJson); ServerEmbed(const std::vector<std::string> values); bool enabled; Snowflake<ServerEmbed> channelID; private: const static std::initializer_list<const char*const> fields; }; }
3707a545115d8c2680aa6e86cd229f094fb689cb
c3e71c55c2eeac3b6cc8dcca9f4aafe3fa7f4747
/Src/Ntrip/Src/tcp_server.cpp
4c103eca078497c4ef5dee7cb438b87c02b0516e
[]
no_license
pvvovan/VrsTunnel
00e3e14c4ce72b89c3c9c6b022782adb4dc659df
16d6b821a89c1fd40249f582aec771502fdccc4b
refs/heads/master
2023-05-27T19:19:41.784076
2023-05-07T06:33:17
2023-05-07T06:33:17
198,570,416
6
2
null
null
null
null
UTF-8
C++
false
false
2,324
cpp
tcp_server.cpp
#include <sys/types.h> #include <cstring> #include <sys/socket.h> #include <netdb.h> #include <string> #include <sys/un.h> #include <fcntl.h> #include <chrono> #include <thread> #include <atomic> #include <future> #include "tcp_server.hpp" namespace VrsTunnel::Ntrip { void tcp_server::task(uint16_t port, std::function<void(async_io)> client_connected, std::promise<bool>&& promise) { addrinfo hints{}; ::memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = SOCK_STREAM; /* TCP socket */ hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ hints.ai_protocol = 0; /* Any protocol */ hints.ai_canonname = nullptr; hints.ai_addr = nullptr; hints.ai_next = nullptr; std::string port_str = std::to_string(port); addrinfo* result{nullptr}; if (::getaddrinfo(nullptr, port_str.c_str(), &hints, &result) != 0) { promise.set_value(false); return; } /* getaddrinfo() returns a list of address structures. Try each address until we successfully bind(2). If socket(2) (or bind(2)) fails, we (close the socket and) try the next address. */ addrinfo* rp{nullptr}; int srv_fd{-1}; for (rp = result; rp != nullptr; rp = rp->ai_next) { srv_fd = ::socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (srv_fd == -1) { continue; } int optval{1}; int optname = SO_REUSEADDR | SO_REUSEPORT; if (::setsockopt(srv_fd, SOL_SOCKET, optname, &optval, sizeof(optval)) == -1) { continue; } if (::bind(srv_fd, rp->ai_addr, rp->ai_addrlen) == 0) { break; /* Success */ } ::close(srv_fd); } ::freeaddrinfo(result); if (rp == nullptr) { /* No address succeeded */ promise.set_value(false); return; } constexpr int BACKLOG{25}; if (::listen(srv_fd, BACKLOG) == -1) { promise.set_value(false); return; } promise.set_value(true); for ( ; ; ) { int cl_fd = ::accept(srv_fd, nullptr, nullptr); if (cl_fd > 0) { client_connected(async_io(cl_fd)); } } } [[nodiscard]] bool tcp_server::start(uint16_t port, std::function<void(async_io)> client_connected) { std::promise<bool> barrier{}; std::future<bool> future = barrier.get_future(); m_thread = std::thread{&tcp_server::task, this, port, std::move(client_connected), std::move(barrier)}; future.wait(); return future.get(); } }
dac9ff52f635f880295b96bc1bbb54194e010750
e59162db5c206173ecc277b0c00654f1ccefa1ab
/Modules/Loadable/Annotations/MRMLDM/vtkMRMLAnnotationDisplayableManagerHelper.h
a582c8e6e76e4a6e9af412e5e519b69e6755a35f
[]
no_license
zoulianmp/Slicer2SRPlan
29bd115236d3584748e582b17db310a9363d6648
041820fb7fc998878d4fc61fd720c06fd5295ff4
refs/heads/master
2020-07-11T16:41:36.828898
2016-04-12T01:46:25
2016-04-12T01:46:25
49,615,826
1
0
null
null
null
null
UTF-8
C++
false
false
6,481
h
vtkMRMLAnnotationDisplayableManagerHelper.h
/*=auto========================================================================= Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved. See COPYRIGHT.txt or http://www.slicer.org/copyright/copyright.txt for details. Program: 3D Slicer Module: $RCSfile: vtkMRMLAnnotationDisplayableManagerHelper,v $ Date: $Date: Aug 4, 2010 10:44:52 AM $ Version: $Revision: 1.0 $ =========================================================================auto=*/ #ifndef VTKMRMLANNOTATIONDISPLAYABLEMANAGERHELPER_H_ #define VTKMRMLANNOTATIONDISPLAYABLEMANAGERHELPER_H_ // Annotations includes #include "vtkSRPlanAnnotationsModuleMRMLDisplayableManagerExport.h" // Annotations MRML includes class vtkMRMLAnnotationDisplayNode; class vtkMRMLAnnotationNode; // MRML includes class vtkMRMLInteractionNode; // VTK includes #include <vtkHandleWidget.h> #include <vtkLineWidget2.h> #include <vtkSeedWidget.h> #include <vtkSmartPointer.h> // STD includes #include <map> /// \ingroup Slicer_QtModules_Annotation class VTK_SRPlan_ANNOTATIONS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLAnnotationDisplayableManagerHelper : public vtkObject { public: static vtkMRMLAnnotationDisplayableManagerHelper *New(); vtkTypeMacro(vtkMRMLAnnotationDisplayableManagerHelper, vtkObject); void PrintSelf(ostream& os, vtkIndent indent); /// Lock/Unlock all widgets based on the state of the nodes void UpdateLockedAllWidgetsFromNodes(); /// Lock/Unlock all widgets from interaction node void UpdateLockedAllWidgetsFromInteractionNode(vtkMRMLInteractionNode* interactionNode); /// Lock/Unlock all widgets void UpdateLockedAllWidgets(bool locked); /// Lock/Unlock a widget void UpdateLocked(vtkMRMLAnnotationNode* node); /// Hide/Show a widget according to node's visible flag and if it can be /// displayed in this viewer void UpdateVisible(vtkMRMLAnnotationNode* node, bool displayableInViewer = true); /// Update lock and visibility of a widget void UpdateWidget(vtkMRMLAnnotationNode* node); /// Get a vtkAbstractWidget* given a node vtkAbstractWidget * GetWidget(vtkMRMLAnnotationNode * node); /// ...an its associated vtkAbstractWidget* for Slice intersection representation vtkAbstractWidget * GetIntersectionWidget(vtkMRMLAnnotationNode * node); /// ...an its associated vtkAbstractWidget* for Slice projection representation vtkAbstractWidget * GetOverLineProjectionWidget(vtkMRMLAnnotationNode * node); /// ...an its associated vtkAbstractWidget* for Slice projection representation vtkAbstractWidget * GetUnderLineProjectionWidget(vtkMRMLAnnotationNode * node); /// ...an its associated vtkAbstractWidget* for Slice projection representation vtkAbstractWidget * GetPointProjectionWidget(vtkMRMLAnnotationNode * node); /// Remove all widgets, intersection widgets, nodes void RemoveAllWidgetsAndNodes(); /// Remove a node, its widget and its intersection widget void RemoveWidgetAndNode(vtkMRMLAnnotationNode *node); /// Search the annotation node list and return the annotation node that has this display node vtkMRMLAnnotationNode * GetAnnotationNodeFromDisplayNode(vtkMRMLAnnotationDisplayNode *displayNode); //---------------------------------------------------------------------------------- // The Lists!! // // An annotation which is managed by a displayableManager consists of // a) the Annotation MRML Node (AnnotationNodeList) // b) the vtkWidget to show this annotation (Widgets) // c) a vtkWidget to represent sliceIntersections in the slice viewers (WidgetIntersections) // /// List of Nodes managed by the DisplayableManager std::vector<vtkMRMLAnnotationNode*> AnnotationNodeList; /// .. and its associated convenient typedef typedef std::vector<vtkMRMLAnnotationNode*>::iterator AnnotationNodeListIt; /// Map of vtkWidget indexed using associated node ID std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> Widgets; /// .. and its associated convenient typedef typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetsIt; /// Map of vtkWidgets to reflect the Slice intersections indexed using associated node ID std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetIntersections; /// .. and its associated convenient typedef typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetIntersectionsIt; /// Map of vtkWidgets to reflect the Slice projection indexed using associated node ID std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetOverLineProjections; /// .. and its associated convenient typedef typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetOverLineProjectionsIt; /// Map of vtkWidgets to reflect the Slice projection indexed using associated node ID std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetUnderLineProjections; /// .. and its associated convenient typedef typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetUnderLineProjectionsIt; /// Map of vtkWidgets to reflect the Slice projection indexed using associated node ID std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*> WidgetPointProjections; /// .. and its associated convenient typedef typedef std::map<vtkMRMLAnnotationNode*, vtkAbstractWidget*>::iterator WidgetPointProjectionsIt; // // End of The Lists!! // //---------------------------------------------------------------------------------- /// Placement of seeds for widget placement void PlaceSeed(double x, double y, vtkRenderWindowInteractor * interactor, vtkRenderer * renderer); /// Get a placed seed vtkHandleWidget * GetSeed(int index); /// Remove all placed seeds void RemoveSeeds(); protected: vtkMRMLAnnotationDisplayableManagerHelper(); virtual ~vtkMRMLAnnotationDisplayableManagerHelper(); private: vtkMRMLAnnotationDisplayableManagerHelper(const vtkMRMLAnnotationDisplayableManagerHelper&); /// Not implemented void operator=(const vtkMRMLAnnotationDisplayableManagerHelper&); /// Not Implemented /// SeedWidget for point placement vtkSmartPointer<vtkSeedWidget> SeedWidget; /// List of Handles for the SeedWidget std::vector<vtkSmartPointer<vtkHandleWidget> > HandleWidgetList; /// .. and its associated convenient typedef typedef std::vector<vtkSmartPointer<vtkHandleWidget> >::iterator HandleWidgetListIt; }; #endif /* VTKMRMLANNOTATIONDISPLAYABLEMANAGERHELPER_H_ */
14594e56e7866cebd9219a336217522d92f1210a
cb336c51d1f5f09b7c7e0bcbc89403453a7c5e5c
/Framework/BaseDemo.cpp
0a5ac4a4f026e53d94299ff0d7e5cd700990b44a
[]
no_license
Vinssou/ParticleEngine
25e84f50350031062f174791a71b9cc23b24cc0e
8244a1d472953a327cbcd769d6e9cd5d86da7b51
refs/heads/master
2020-05-31T13:07:41.664197
2019-06-06T01:30:16
2019-06-08T02:31:21
190,296,522
0
1
null
null
null
null
UTF-8
C++
false
false
16,898
cpp
BaseDemo.cpp
#include "BaseDemo.h" #include <slmath/slmath.h> #include <iostream> #include <sstream> #include <fstream> #include <vector> #include <iomanip> #include <windows.h> #include <tchar.h> #include <stdio.h> #include <stdlib.h> #include <locale> #include <codecvt> #include "Parser/tinyxml.h" slmath::vec4 BaseDemo::s_Colors[] = { slmath::vec4(1.0f, 0.1f, 0.1f, 0.45f), slmath::vec4(0.1f, 1.0f, 0.1f, 0.45f), slmath::vec4(0.1f, 0.1f, 1.0f, 0.45f), slmath::vec4(1.0f, 1.0f, 0.1f, 0.45f), slmath::vec4(1.0f, 0.1f, 1.0f, 0.45f), slmath::vec4(0.1f, 1.0f, 1.0f, 0.45f) }; const int BaseDemo::s_ColorCount = 6; BaseDemo::BaseDemo() : m_LightPosition(0.0f) { } void BaseDemo::Simulate(float /*delatT = 1 / 60.0f*/) { m_PhysicsParticle.Simulate(); } void BaseDemo::IputKey(unsigned int /*wParam*/) { } void BaseDemo::Release() { m_PhysicsParticle.Release(); } slmath::vec4 *BaseDemo::GetParticlePositions() const { return reinterpret_cast<slmath::vec4 *>(m_PhysicsParticle.GetParticlePositions()); } int BaseDemo::GetParticlesCount() const { return m_PhysicsParticle.GetParticlesCount(); } bool BaseDemo::IsUsingInteroperability() const { return false; } const slmath::vec3& BaseDemo::GetLightPosition() const { return m_LightPosition; } void BaseDemo::InitializeGraphicsObjectToRender(DX11Renderer &renderer) { renderer.InitializeParticles(GetParticlePositions(), GetParticlesCount(), 0, 0); } // By default all physics particles but 0 mesh void BaseDemo::InitializeRenderer(DX11Renderer &renderer) { const bool isUsingInteroperability = IsUsingInteroperability(); renderer.SetIsUsingInteroperability(isUsingInteroperability); m_PhysicsParticle.SetIsUsingInteroperability(isUsingInteroperability); InitializeGraphicsObjectToRender(renderer); InitializeOpenCL(renderer); } void BaseDemo::InitializeOpenCL(DX11Renderer &renderer) { m_PhysicsParticle.InitializeOpenCL(renderer.GetID3D11Device(), renderer.GetID3D11Buffer()); } void BaseDemo::InitializeOpenClData() { m_PhysicsParticle.InitializeOpenClData(); } void BaseDemo::Draw(DX11Renderer &renderer) const { renderer.Render(GetParticlePositions(), GetParticlesCount()); } float BaseDemo::Compress(const slmath::vec4 &vector) { // Supported compression assert(vector.x >= 0.0f && vector.x <= 1.0f); assert(vector.y >= 0.0f && vector.y <= 1.0f); assert(vector.z >= 0.0f && vector.z <= 1.0f); // Size support from 0.0f to 51.0f assert(vector.w >= 0.0f && vector.w <= 51.0f); slmath::vec4 toCompress = vector; unsigned int v1 = unsigned int (toCompress.x * 0xFF); unsigned int v2 = unsigned int(toCompress.y * 0xFF); unsigned int v3 = unsigned int(toCompress.z * 0xFF); unsigned int v4 = unsigned int (toCompress.w * 5.0f); v1 = v1 > 255 ? 255 : v1; v2 = v2 > 255 ? 255 : v2; v3 = v3 > 255 ? 255 : v3; v4 = v4 > 255 ? 255 : v4; unsigned int store = ((v1 & 0xFF) << 0) | ((v2 & 0xFF) << 8) | ((v3 & 0xFF) << 16) | ((v4 & 0xFF) << 24); float returnValue = *reinterpret_cast<float*>(&store); #ifdef DEBUG slmath::vec4 original = UnCompress(returnValue); const slmath::vec4 epsiolon(1.0f); assert(original <= toCompress + epsiolon && original >= toCompress - epsiolon ); #endif // DEBUG return returnValue; } slmath::vec4 BaseDemo::UnCompress(float value) { unsigned int uncompress = *reinterpret_cast<unsigned int*>(&value); unsigned int o1, o2, o3, o4; o1 = (unsigned int) uncompress & 0xFF; o2 = (unsigned int)(uncompress >> 8) & 0xFF; o3 = (unsigned int)(uncompress >> 16) & 0xFF; o4 = (unsigned int)(uncompress >> 24) & 0xFF; slmath::vec4 vector(float(o1) / 255.0f, float(o2) / 255.0f, float(o3) / 255.0f, float(o4) / 5.0f); return vector; } int BaseDemo::FillPositionFromXml(const std::string& fileName, const std::string& tag, slmath::vec4* positions, int positionsCount) { const std::string assetFolder ="Asset/"; const std::string xmlExtension =".xml"; std::string fullPath = assetFolder + fileName + xmlExtension; TiXmlDocument doc(fullPath.c_str()); doc.LoadFile(); int index = 0; float depth = 0.0f; positions[1] = slmath::vec4(0.0f); TiXmlElement* currentPositionElement = doc.FirstChildElement( tag.c_str() ); TiXmlElement* firstPositionElement = currentPositionElement; if ( currentPositionElement ) { while (currentPositionElement != NULL && index < positionsCount) { TiXmlAttribute* attribute = currentPositionElement->FirstAttribute(); float x = 0, y = 0, z = 0; while (attribute != NULL) { std::stringstream stream(attribute->Value()); if (stream.fail()) { continue; } if (strcmp( attribute->Name(), "x") == 0) { stream >> x; } if (strcmp( attribute->Name(), "y") == 0) { stream >> y; } if (strcmp( attribute->Name(), "z") == 0) { stream >> z; } attribute = attribute->Next(); } positions[index] = slmath::vec4(x, z + 200.0f, y + depth); positions[index] -= positions[0]; positions[index] *= 0.2f; currentPositionElement = currentPositionElement->NextSiblingElement(); if (currentPositionElement == NULL) { currentPositionElement = firstPositionElement; depth += 2.0f; } index++; } } return index; } void BaseDemo::ConvertFiles() { /* Convert ***************** <trackLapPoints> <Sl_x0020_No>2050</Sl_x0020_No> <Latitude>45.51007</Latitude> <Longitude>-73.525185</Longitude> <Altitude>10</Altitude> <Speed>35.25</Speed> <Heart_x0020_Rate>0</Heart_x0020_Rate> <Interval_x0020_Time>2</Interval_x0020_Time> <Index>59213038</Index> <Cadence>0</Cadence> <PwrCadence>0</PwrCadence> <Power>0</Power> </trackLapPoints> in ******************** <trkpt lat="45.348693" lon="-73.191907" ><ele>44</ele><speed>12.07</speed><time>2015-04-25T13:33:45Z</time> </trkpt> */ HANDLE hFind; WIN32_FIND_DATA data; hFind = FindFirstFile(L"E:\\Programmation\\ParticlesEngine\\Output\\Data\\*", &data); if (hFind != INVALID_HANDLE_VALUE) { do { const std::string folder ="Data/"; const std::string xmlExtension =".xml"; std::wstring ws(data.cFileName); if (ws.size() < 4) { continue; } std::wstring wFileName(ws.begin(), ws.end() - 4); using convert_type = std::codecvt_utf8<wchar_t>; std::wstring_convert<convert_type, wchar_t> converter; //use converter (.to_bytes: wstr->str, .from_bytes: str->wstr) std::string fileName = converter.to_bytes(wFileName); std::string fullPath = folder + fileName + xmlExtension; TiXmlDocument doc(fullPath.c_str()); doc.LoadFile(); TiXmlElement* header = doc.FirstChildElement("GH-505_Dataform"); // TiXmlElement* firstPositionElement = currentPositionElement; std::string date, startTime, time; float distance = 0.0f; std::vector<std::string> latitudes, longitudes, altitudes, speeds; std::vector<float> intervals; if ( header ) { // Time TiXmlElement* currentPositionElement = header->FirstChildElement("trackHeader"); if ( currentPositionElement ) { if (currentPositionElement != NULL) { { TiXmlElement* dateElement = currentPositionElement->FirstChildElement("TrackName"); std::stringstream stream(dateElement->GetText()); stream >> date; } { TiXmlElement* startTimeElement = currentPositionElement->FirstChildElement("StartTime"); std::stringstream stream(startTimeElement->GetText()); stream >> startTime; } { TiXmlElement* startTimeElement = currentPositionElement->FirstChildElement("TotalDist"); std::stringstream stream(startTimeElement->GetText()); stream >> distance; } { TiXmlElement* startTimeElement = currentPositionElement->FirstChildElement("During"); std::stringstream stream(startTimeElement->GetText()); stream >> time; } } } // Position { TiXmlElement* currentPositionElement = header->FirstChildElement("trackLapPoints"); if ( currentPositionElement ) { while (currentPositionElement != NULL) { std::string latitude, longitude, altitude, speed, intervalString; float interval = 0; { TiXmlElement* element = currentPositionElement->FirstChildElement("Latitude"); std::stringstream stream(element->GetText()); stream >> latitude; } { TiXmlElement* element = currentPositionElement->FirstChildElement("Longitude"); std::stringstream stream(element->GetText()); stream >> longitude; } { TiXmlElement* element = currentPositionElement->FirstChildElement("Altitude"); std::stringstream stream(element->GetText()); stream >> altitude; } { TiXmlElement* element = currentPositionElement->FirstChildElement("Speed"); std::stringstream stream(element->GetText()); stream >> speed; } { TiXmlElement* element = currentPositionElement->FirstChildElement("Interval_x0020_Time"); std::stringstream stream(element->GetText()); stream >> intervalString; } latitudes.push_back(latitude); longitudes.push_back(longitude); altitudes.push_back(altitude); speeds.push_back(speed); size_t pos = intervalString.find_first_of(','); if (pos != std::string::npos) { intervalString.replace(pos, 1,"."); } std::istringstream convert(intervalString); convert >> interval; intervals.push_back(interval); currentPositionElement = currentPositionElement->NextSiblingElement(); } } } int hours = 0, minutes = 0, seconds = 0; { size_t hoursPosition = startTime.find_first_of(":"); std::string hoursString = startTime.substr(0, hoursPosition); std::string minutesSecondsString = startTime.substr(hoursPosition + 1); size_t minutesPosition = minutesSecondsString.find_first_of(":"); std::string minutesString = minutesSecondsString.substr(0, minutesPosition); std::string secondsString = minutesSecondsString.substr(minutesPosition + 1); std::istringstream convertH(hoursString); convertH >> hours; std::istringstream convertM(minutesString); convertM >> minutes; std::istringstream convertS(secondsString); convertS >> seconds; } hours += 4; int year = 0, month = 0, day = 0; { size_t hoursPosition = date.find_first_of("-"); std::string hoursString = date.substr(0, hoursPosition); std::string minutesSecondsString = date.substr(hoursPosition + 1); size_t minutesPosition = minutesSecondsString.find_first_of("-"); std::string minutesString = minutesSecondsString.substr(0, minutesPosition); std::string secondsString = minutesSecondsString.substr(minutesPosition + 1); std::istringstream convertH(hoursString); convertH >> year; std::istringstream convertM(minutesString); convertM >> month; std::istringstream convertS(secondsString); convertS >> day; } day -= 1; month += 1; std::ofstream gpxFile; gpxFile.open ("GPX/" + fileName + ".gpx"); gpxFile << "<?xml version=\"1.0\"?>\n"; gpxFile << "<gpx version=\"1.1\" creator=\"GlobalSat GS-Sport PC Software\" xmlns:st=\"urn:uuid:D0EB2ED5-49B6-44e3-B13C-CF15BE7DD7DD\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/1\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\" >\n"; gpxFile << "<extensions>\n"; gpxFile << "<st:activity id=\"1\" created=\"2015-5-22,23:17:05\" startTime=\""; gpxFile << year << "-"; if (month < 10) { gpxFile << "0"; } gpxFile << month << "-"; if (day < 10) { gpxFile << "0"; } gpxFile << day << "T"; if (hours < 10) { gpxFile << "0"; } gpxFile << hours << ":"; if (minutes < 10) { gpxFile << "0"; } gpxFile << minutes << ":"; if (seconds < 10) { gpxFile << "0"; } gpxFile << seconds; gpxFile << "Z\" hasStartTime=\"true\" distanceEntered=\""<< int(distance / 1000.0) << "," << int((distance / 1000.0 - int(distance / 1000.0)) * 1000) << "\" timeEntered=\""<< time <<"\" calories=\"0\">\n"; gpxFile << "</st:activity>\n"; gpxFile << "</extensions>\n"; gpxFile << "<trk>\n"; gpxFile << "<Name>" << date << "," << startTime << "</Name>\n"; gpxFile << "<number>1</number>\n"; gpxFile << "<trkseg>\n"; float intervalCumul = 0.0; intervals[0] = 2.0; // Hack for (size_t i = 0; i < latitudes.size(); ++i) { if (intervalCumul >= 1.0f) { seconds += int(intervalCumul); intervalCumul = (intervalCumul - int(intervalCumul)); } if (seconds >= 60) { minutes++; seconds = seconds % 60; } if (minutes >= 60) { hours++; minutes = minutes % 60; } if (hours >= 24) { day++; hours = hours % 24; } std::cout << std::setprecision(8); gpxFile << "<trkpt lat=\""<< std::setprecision(8) << latitudes[i] << "\" lon=\"" << std::setprecision(8) << longitudes[i] <<"\" ><ele>" << std::setprecision(3) << altitudes[i] << "</ele><speed>" << speeds[i] <<"</speed><time>"; gpxFile << year << "-"; if (month < 10) { gpxFile << "0"; } gpxFile << month << "-"; if (day < 10) { gpxFile << "0"; } gpxFile << day << "T"; if (hours < 10) { gpxFile << "0"; } gpxFile << hours << ":"; if (minutes < 10) { gpxFile << "0"; } gpxFile << minutes << ":"; if (seconds < 10) { gpxFile << "0"; } gpxFile << seconds << "Z</time>\n"; gpxFile << "</trkpt>\n"; intervalCumul += (intervals[i] - int(intervals[i])); int elapsedSeconds = int(intervals[i]); seconds += elapsedSeconds; } gpxFile << "</trkseg>\n"; gpxFile << "</trk>\n"; gpxFile << "</gpx>\n"; gpxFile.close(); } } while (FindNextFile(hFind, &data)); FindClose(hFind); } // exit(0); }
7adf2158d49e3dc45969477d198f207bb9a09f72
1788eb9d06baad179eaff25c4b451ec87b190167
/Base/src/resolver/expression/ResolvedTextLiteral.cpp
ca668672667ae0da1382cfd9f1e57bb2dad8b399
[]
no_license
ReedOei/Enki-Old
3fb5d3d85c642ade510b9d9348faaa113aaae86f
17694c2e95a3531d68dcd5364f2795fb169932a9
refs/heads/master
2020-03-30T14:18:33.174114
2019-01-17T17:45:55
2019-01-17T17:45:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
539
cpp
ResolvedTextLiteral.cpp
// // Created by roei on 22/10/18. // #include "ResolvedTextLiteral.h" namespace enki { ResolvedTextLiteral::ResolvedTextLiteral(const std::string &v) : v(v) {} const std::string ResolvedTextLiteral::nodeName() const { return "ResolvedTextLiteral"; } void ResolvedTextLiteral::accept(AbstractResolvedNodeVisitor &visitor) const { visitor.visit(*this); } const std::string &ResolvedTextLiteral::value() const { return v; } ResolvedTextLiteral::~ResolvedTextLiteral() { } }
68df598622e3e2c8146e5ca2bc177a7613d8c2f9
8f6c90ccdc665902a8685c0721596b3016005b81
/dia/codeCPP_classes de base - pour dia2code - SUITE - etape 3 ( bouton a cocher )/DnCaseACoher.cpp
db54e3a4b754bc3acfbe36894ee7a7ec6552c0b3
[]
no_license
c-pages/gui
680636880049f97e98ee2f06d9129b445f33f72f
bcc06972ba3cdaa631702c9c1c73ad15fa2952a3
refs/heads/master
2021-01-10T12:55:58.224743
2016-04-20T14:43:45
2016-04-20T14:43:45
47,876,401
0
0
null
null
null
null
UTF-8
C++
false
false
659
cpp
DnCaseACoher.cpp
///////////////////////////////////////////////// // Headers ///////////////////////////////////////////////// #include <DnCaseACoher.h> namespace gui { ///////////////////////////////////////////////// DnCaseACoher::DnCaseACoher () : m_valeur ( true ) , m_bouton ( ) , m_coche ( ) { } ///////////////////////////////////////////////// bool DnCaseACoher::getValeur () const { } ///////////////////////////////////////////////// void DnCaseACoher::actualiser () { } ///////////////////////////////////////////////// void DnCaseACoher::draw (sf::RenderTarget& target, sf::RenderStates states) const { } } // fin namespace gui
a28ff52acf774f94f9d909b91a3c2c80adc4b10e
e02c0c48d27e0f95fb5140f9455aa6c03fe06a70
/window.h
994b3e1bbeb4d8b51463b70ce6b3c61cf0906a6a
[]
no_license
SimoneDut/Orbiter
a18e36d6390fb230d9d8d3286c18febb47fa7991
b660067e7788d0b50691c6f8971bd5734da90bfa
refs/heads/master
2020-06-26T16:12:23.898084
2019-07-30T17:59:58
2019-07-30T17:59:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,719
h
window.h
#ifndef WINDOW_H #define WINDOW_H #include <cstdlib> #include <SDL.h> #include "surface.h" class SWindow { public: SWindow(); ~SWindow(); bool init(const char* title, int x, int y, int w, int h, Uint32 windowFlags, int renderIndex, Uint32 rendererFlags, Uint8 r, Uint8 g, Uint8 b, Uint8 a, SDL_BlendMode blendMode); //Initialize the window void free(); //Free the window bool render(); //Clear the background (clear the current rendering target with the drawing color) void present(); //Present the rendered bool updateInternals(); //Update the internal variables of the window void setIcon(SSurface& iconSurface); //Set the icon of the window bool setTitle(const char* title); //Set the title of the window bool setPosition(int x, int y); //Set the position of the window bool setSize(int w, int h); //Set the size of the window bool setBackgroundColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a); //Set the background color of the window bool setBlendMode(SDL_BlendMode blendMode); //Set the blend mode of the renderer SDL_Renderer* getRenderer() const; //Get the rendered associated to the window Uint32 getWindowID() const; //Get the window ID of the window int getWindowDisplayID() const; //Get the window display ID of the window int getWidth() const; //Get the width of the window int getHeight() const; //Get the height of the window int getX() const; //Get the x position of the window int getY() const; //Get the y position of the window private: SDL_Window* mWindow; SDL_Renderer* mRenderer; Uint32 mWindowID; int mWindowDisplayID; int mWidth; int mHeight; int mX; int mY; }; #endif
9a958985d06d4fe7e5102712e3e469b1bf0c635e
85f0de2c523c75dffd834421636b36d792f6cc8e
/src/util.h
0d9e83ba5902c049fdc1e8110a0f3b57be9668a2
[]
no_license
things-i-want-to-forget/lua-flex
411d377d3fc3b5cfdf5fb6ad9be3611c08f42226
476f1381417d9b22feaed7a9436aac46ce62554b
refs/heads/master
2021-06-01T19:29:56.558240
2016-04-19T22:04:32
2016-04-19T22:04:32
35,054,759
2
0
null
null
null
null
UTF-8
C++
false
false
875
h
util.h
#include <stdio.h> namespace util { typedef void *(__cdecl *CreateInterfaceFn)(const char *name, int *found); template<class t> t GetInterface(const char *module, const char *name) { HMODULE hmodule = GetModuleHandleA(module); CreateInterfaceFn create = (CreateInterfaceFn)GetProcAddress(hmodule, "CreateInterface"); void *ret = 0; char temp_name[256]; // up this if it causes problems for (unsigned short i = 0; i < 1000; i++) { sprintf_s(temp_name, 256, "%s%03i", name, i); ret = create(temp_name, 0); if (ret) break; } return t(ret); } template<class t> t GetInterfaceSingle(const char *module, const char *name) { auto fn = CreateInterfaceFn(GetProcAddress(GetModuleHandleA(module), "CreateInterface")); return fn(name, 0); } inline char *getvfunc(void *obj, unsigned short which) { return (*(char ***)obj)[which]; } }
b5a4d1ff2f6b3e74152e69b5f2b3aedf225d06de
f97e9fc287624f78da673a8708eb0ef5468bccbc
/old/2156.cpp
067c816b2fdaaeb632c7562932a61c2b5bee70b2
[]
no_license
Minssc/BJA
8a199e2aebe7b5c9a1de1c2b08ec4e4e97936e3f
b6bf93feac133e06e21949d4413f64302808e6b8
refs/heads/master
2023-01-12T00:32:27.316118
2020-11-15T07:17:09
2020-11-15T07:17:09
312,974,596
0
0
null
null
null
null
UTF-8
C++
false
false
349
cpp
2156.cpp
#include<iostream> using namespace std; short C[10001]; int D[10001]; int main(){ int N; cin>>N; for(int i=1; i<=N; ++i) cin>>C[i]; D[1] = C[1]; D[2] = C[1]+C[2]; for(int i=3; i<=N; ++i){ D[i] = max(D[i-2]+C[i], D[i-3] + C[i-1] + C[i]); D[i] = max(D[i], D[i-1]); } cout<<D[N]; return 0; }
ca833ac945affe423cfd8f3a9d9e610942bff67f
88d8d7b147e68bd4913fe05081cdb1574d933fca
/Source/Managers/LevelManager.cpp
29f2ab6e1fc9bec69edfc7a7e77db3a9bdcae270
[]
no_license
JimbobKR18/JFramework
d8acc577e81c6bbaf362a84061612d55f040f57a
17563250df026425d91622cf7119727af78dc9e0
refs/heads/master
2020-04-04T05:41:28.162914
2019-09-28T07:36:16
2019-09-28T07:36:16
5,645,960
0
0
null
null
null
null
UTF-8
C++
false
false
4,803
cpp
LevelManager.cpp
#include "LevelManager.h" #include "InputManager.h" #include "LuaIncludes.h" #include "LevelChangeMessage.h" unsigned const LevelManager::sUID = Common::StringHashFunction("LevelManager"); LevelManager::LevelManager(GameApp *aApp) : Manager(aApp, "LevelManager", LevelManager::sUID), mActiveLevel(nullptr) { } LevelManager::~LevelManager() { for(LevelIT it = mLevels.begin(); it != mLevels.end(); ++it) { delete *it; } } /** * @brief Create a level from a filename * @param aFilename * @param aFolderName * @return */ Level *LevelManager::CreateLevel(HashString const &aFilename, HashString const &aFolderName) { Level *ret = GetLevel(aFilename); if(!ret) { ret = new Level(this, aFilename, aFolderName, true); AddLevel(ret); } return ret; } /** * @brief Get a level by its name * @param aLevelName * @return */ Level *LevelManager::GetLevel(HashString const &aLevelName) { for(LevelIT it = mLevels.begin(); it != mLevels.end(); ++it) { if((*it)->GetFileName() == aLevelName || (*it)->GetName() == aLevelName) { return *it; } } return nullptr; } /** * @brief Delete a level, the right way. * @param aLevel */ void LevelManager::DeleteLevel(Level *aLevel) { RemoveLevel(aLevel); delete aLevel; } /** * @brief Push back loading a level to the next frame. * @param aLevelName * @param aReset */ void LevelManager::LoadLevelDelayed(HashString const &aLevelName, bool aReset) { GetOwningApp()->GET<InputManager>()->DeclineInputs(); LevelChangeMessage *msg = new LevelChangeMessage(aLevelName, (aReset ? "true" : "false")); ProcessDelayedMessage(msg); } /** * @brief Load a level immediately. * @param aLevelName * @param aReset * Note that deleting previous level in pre or post reset functions in level will cause crash bug. */ void LevelManager::LoadLevel(HashString const &aLevelName, bool aReset) { for(LevelConstIT it = mLevels.begin(); it != mLevels.end(); ++it) { if((*it)->GetFileName() == aLevelName || (*it)->GetName() == aLevelName) { Level* prevLevel = mActiveLevel; mActiveLevel = *it; #ifdef _DEBUG HashString prevLevelName = (prevLevel != nullptr) ? prevLevel->GetName() : ""; #endif if(prevLevel) prevLevel->Unload(mActiveLevel); if(aReset) mActiveLevel->ResetLevel(); #ifdef _DEBUG // Avoid crash bug where you accidentally delete previous level assert(prevLevelName.Empty() || GetLevel(prevLevelName) != nullptr); #endif mActiveLevel->Load(prevLevel); GetOwningApp()->GET<InputManager>()->AcceptInputs(); return; } } assert(!"Level name specified not found."); } /** * @brief Get currently running level. * @return */ Level *LevelManager::GetActiveLevel() { return mActiveLevel; } /** * @brief Basic update loop. */ void LevelManager::Update() { if(mActiveLevel) mActiveLevel->Update(); MessageIT msgEnd = mDelayedMessages.end(); for(MessageIT it = mDelayedMessages.begin(); it != msgEnd; ++it) { if((*it)->GetDescription() == "ResetLevel") { mActiveLevel->ResetLevel(); } else { LevelChangeMessage *msg = (LevelChangeMessage*)*it; LoadLevel(msg->GetDescription(), (msg->GetContent() == "true" ? true : false)); } delete *it; } mDelayedMessages.clear(); } /** * @brief Relays a message to current active level. * @param aMessage */ void LevelManager::SendMessage(Message const &aMessage) { if(mActiveLevel) mActiveLevel->ReceiveMessage(aMessage); } /** * @brief Post a message to the delay queue. * @param aMessage */ void LevelManager::ProcessDelayedMessage(Message *aMessage) { mDelayedMessages.push_back(aMessage); } /** * @brief Make this manager visible in LUA. */ void LevelManager::SerializeLUA() { SLB::Class<LevelManager>("LevelManager").inherits<Manager>() .set("CreateLevel", &LevelManager::CreateLevel) .set("LoadLevel", &LevelManager::LoadLevelDelayed) .set("GetActiveLevel", &LevelManager::GetActiveLevel); } /** * @brief Add a level to our levels vector. * @param aLevel */ void LevelManager::AddLevel(Level *aLevel) { // Check to see if object is in our list for(LevelIT it = mLevels.begin(); it != mLevels.end(); ++it) { if(*it == aLevel || (*it)->GetFileName() == aLevel->GetFileName()) { return; } } mLevels.insert(aLevel); } /** * @brief Remove a level from our levels vector. * @param aLevel */ void LevelManager::RemoveLevel(Level *aLevel) { if(mActiveLevel == aLevel) mActiveLevel = nullptr; for(LevelIT it = mLevels.begin(); it != mLevels.end(); ++it) { if(*it == aLevel) { mLevels.erase(it); break; } } }
903bbad7beda3f1cad504517c21f4c5004cfaa27
5d438d08139f68f1a1e3fb0a03bde34dfaaa85d3
/ant/2-3-4/main.cpp
e392a609e13cc3067a8092a81fab3ddf0fc19095
[]
no_license
kooooohe/competitive-programming-study
1432dc429294be17fd38511ad1add217dd1ef238
0b098c40e76b22bc3e2e5b431ca722a1666effcb
refs/heads/main
2023-08-10T18:44:40.899052
2021-09-09T11:17:24
2021-09-09T11:17:24
323,051,062
0
0
null
null
null
null
UTF-8
C++
false
false
576
cpp
main.cpp
//typedef long long ll; #include <cstdio> #include<algorithm> #include <iostream> #include <string.h> using namespace std; int n = 4; int m = 4; char s[5] = "abcd"; char t[5] = "becd"; int dp[5][5]; void solve() { for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (s[i] == t[j]) { dp[i+1][j+1] = dp[i][j] + 1; } else { dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]); } } } //memset(dp, -1, sizeof(dp)); printf("%d\n", dp[n][m]); } int main() { solve(); }
0435e4f07a5f6bfed7d8dab43706f1ad97203dae
31e94c27019298386cc739f8b0788560ca3b7a25
/viewer/VrMain.h
e302864edaf70101eb651ace9707b3933ec44e8a
[]
no_license
firwind/Ammyy-v3
f7d5df9d0d4ea01fa4be6b96242fbedaef5e6e91
8bf063085550f522f4197d8a530801292a482179
refs/heads/master
2020-04-22T20:26:35.679847
2017-01-10T02:18:22
2017-01-10T02:18:22
170,641,720
5
3
null
null
null
null
UTF-8
C++
false
false
592
h
VrMain.h
#ifndef _VR_MAIN_H__INCLUDED_ #define _VR_MAIN_H__INCLUDED_ #include "res/resource.h" #include "vrHelp.h" #include "vrHotKeys.h" #include "../main/InteropViewer.h" #define WM_REGIONUPDATED WM_USER+2 class VrMain { public: VrMain(); ~VrMain(); static void CentreWindow(HWND hwnd); static void OnExitProcess(); HINSTANCE m_hInstance; VrHelp* m_pHelp; VrHotKeys* m_pHotkeys; // Global logger - may be used by anything private: static DWORD WINAPI ConnectThreadProc(LPVOID lpParameter); }; extern VrMain vrMain; #endif // _VR_MAIN_H__INCLUDED_
941502578322479b88902a0379b69fc273df5a45
b9d23d662e89fe101a07fef1b3937f1c80450f3b
/research/dollbot_rc_test/dollbot_rc_test.ino
150c060c8e7870454acf4b37ac17286b6bd2dcaf
[ "BSD-2-Clause" ]
permissive
llmora/dollbot
ca3a4a0a8eaa33ffe9213d0743b9049c3c0dae77
96dc78cf7013bec94a19ff97ec60264d1a2857d8
refs/heads/master
2021-01-21T13:48:28.174645
2016-05-08T14:37:10
2016-05-08T14:37:10
36,959,477
0
0
null
null
null
null
UTF-8
C++
false
false
4,721
ino
dollbot_rc_test.ino
/* dollbot_rc_test: Control dollbot using like an RC boat This sketch uses a RC receiver to control the direction and rotation of the dollbot. The discrete X/Y/Rotation values received from the transmitter are converted into vectors that are used by the propulsion system to move the boat in a holonomic fashion. http://splashbots.blogspot.com/ Based on Sparkfun's "RC Hobby Controllers and Arduino": https://www.sparkfun.com/tutorials/348 Requires Adafruit MotorShield v2: http://www.adafruit.com/products/1438 */ #include <Wire.h> #include <Adafruit_MotorShield.h> #define DEBUG #define PIN_CH1 7 #define PIN_CH2 6 #define PIN_CH3 5 #define PIN_CH4 4 #define MOTOR_FL 1 #define MOTOR_FR 2 #define MOTOR_BL 3 #define MOTOR_BR 4 #define PWM_LOW 1000 #define PWM_HIGH 2000 #define MOTOR_MAX 255 void vehicleMove(int valX, int valY, int valRotate); void HolonomicMove(int xComponent, int yComponent, int rotationComponent); void HolonomicSpin(int mm[4]); void HolonomicSimplify(int mm[4]); // Holonomic matrix int horizontalMove[4] = {+1, +1, +1, +1}; int verticalMove[4] = {+1, -1, -1, +1}; int rotationMove[4] = {+1, +1, -1, -1}; // Create the motor shield object with the default I2C address Adafruit_MotorShield AFMS = Adafruit_MotorShield(); Adafruit_DCMotor *motor[4] = {AFMS.getMotor(MOTOR_FL), AFMS.getMotor(MOTOR_FR), AFMS.getMotor(MOTOR_BL), AFMS.getMotor(MOTOR_BR)}; void setup() { // Initialize serial communications Serial.begin(9600); Serial.println("Initializing input..."); AFMS.begin(); // create with the default frequency 1.6KHz // Initialize the ports where we will read receiver input pinMode(PIN_CH1, INPUT); pinMode(PIN_CH2, INPUT); pinMode(PIN_CH3, INPUT); pinMode(PIN_CH4, INPUT); } void HolonomicSpin(int mm[4]) { HolonomicSimplify(&mm); for(int i = 0; i < 4; i++) { // Expand range to motor limits mm[i] = map(mm[i], -100, 100, -1 * MOTOR_MAX, MOTOR_MAX); if(abs(mm[i]) > (10 * MOTOR_MAX) / 100) { motor[i]->setSpeed(abs(mm[i])); motor[i]->run(mm[i] > 0? FORWARD : BACKWARD); #ifdef DEBUG Serial.print("Motor #"); Serial.print(i); Serial.print(": "); Serial.println(mm[i]); #endif } else { motor[i]->setSpeed(0); motor[i]->run(RELEASE); #ifdef DEBUG Serial.print("Motor #"); Serial.print(i); Serial.print(": "); Serial.println("STOP"); #endif } } } void HolonomicSimplify(int **mm) { int max = 0; for(int i = 0; i < 4; i++) { int currentValue = abs(*mm[i]); if(currentValue > max) { max = currentValue; } } // Scale the values so that we stay within the -100 .. 100 range if(max > 100) { for(int i = 0; i < 4; i++) { *mm[i] = map(*mm[i], -1 * max, max, -100, 100); } } } void HolonomicMove(int xComponent, int yComponent, int rotationComponent) { int mm[4] = {0, 0, 0, 0}; if(xComponent) { for(int i = 0; i < 4; i++) { mm[i] += horizontalMove[i] * xComponent; } } if(yComponent) { for(int i = 0; i < 4; i++) { mm[i] += verticalMove[i] * yComponent; } } if(rotationComponent) { for(int i = 0; i < 4; i++) { mm[i] += rotationMove[i] * rotationComponent; } } HolonomicSpin(mm); } /* Helper function to move the vehicle */ void vehicleMove(int valX, int valY, int valRotate) { HolonomicMove(valX, valY, valRotate); } void loop() { // Read three of the channels of the RC receiver, we only use three - but you can add a fourth one if needed int channelHorizontal = pulseIn(PIN_CH4, HIGH, 25000); // X avis movement int channelVertical = pulseIn(PIN_CH2, HIGH, 25000); // Y axis movement int channelRotate = pulseIn(PIN_CH1, HIGH, 25000); // Rotation // If we are receiving control commands from the RC controller bypass autonomous mode if(channelHorizontal || channelVertical || channelRotate) { // Map all readings to a -100 .. +100 range so it is easy to deal with int directionHorizontal = map(channelHorizontal, PWM_LOW, PWM_HIGH, -100, 100); int directionVertical = map(channelVertical, PWM_LOW, PWM_HIGH, -100, 100); int angleRotate = map(channelRotate, PWM_LOW, PWM_HIGH, -100, 100); #ifdef DEBUG Serial.print("Manual control "); Serial.print("H: "); Serial.print(directionHorizontal); Serial.print(" V: "); Serial.print(directionVertical); Serial.print(" R: "); Serial.println(angleRotate); #endif vehicleMove(directionHorizontal, directionVertical, angleRotate); } else { #ifdef DEBUG Serial.println("TODO: Autonomous control"); #endif vehicleMove(0, 0, 0); } #ifdef DEBUG delay(500); #endif }
67b741f9aa00cf3aad3110a17936a9e71bc5313f
66088f05332b83a2c46df6c53eb02070b9384971
/evgen/newep/grid.inc
ad3ffa332c0f5996635628c769cc6b825fbe9c98
[]
no_license
xbai0624/PRadSim
6583913f816e6917e707a726a54896b0446fe668
a3fde3ee2fb50eaecb77a2fb813add919ffc4218
refs/heads/master
2021-01-20T15:42:11.370978
2017-05-12T19:54:45
2017-05-12T19:54:45
90,789,936
0
0
null
2017-05-09T20:41:03
2017-05-09T20:41:03
null
UTF-8
C++
false
false
172
inc
grid.inc
parameter(nt1=210) parameter(nt2=140) parameter(nvv=240) parameter(nph=180) common/grid/grt1(nt1),grt2(nt2),grv(nvv,0:7),grv0(nvv),grphi(nph)
51aea014320f267b3e89d6fe7708556a4c0805a8
08b6882160a1d926bfe2f441dd031055e753a6fa
/test_spider/server/Core.cpp
b3f6267de35fdfbdf58fd4033a2f967f5935c5bf
[]
no_license
delespj/Spider
416c2ca5a30ca237906ad81e29052f186205d3cd
264f7ea1d64e63bdb0e4d17d5a47cdfa6710b5f3
refs/heads/master
2021-08-14T05:59:11.219575
2017-11-14T17:40:21
2017-11-14T17:40:21
105,150,820
0
0
null
null
null
null
UTF-8
C++
false
false
290
cpp
Core.cpp
#include "Core.hh" Core::Core() { this->network = 0; } Core::~Core() { } Core::init() { try { boost::asio::io_service io_service; this->network = Network(io_service, 4243); io_service.run(); } catch (std::exception& e) { std::cerr << e.what() << std::endl; } }
8398baac9af92c7f81057b8c28f429dfc31c614b
c6bddd88916e6c8697a9e02485bd22c58d76bcec
/GeneratedPlaceholders/AIModule/BTDecorator_CheckGameplayTagsOnActor.cpp
9d2397056fa78f7d781e70c5e9fb41eba7e64b50
[]
no_license
GIRU-GIRU/Mordhau-Unofficial-SDK
18d13d62d746a838820e387907d13b0a37aed654
f831d7355cf553b81fb6e82468b3abf68f7955aa
refs/heads/master
2020-07-06T03:36:48.908227
2020-04-22T13:54:00
2020-04-22T13:54:00
202,872,898
7
4
null
null
null
null
UTF-8
C++
false
false
51
cpp
BTDecorator_CheckGameplayTagsOnActor.cpp
#include "BTDecorator_CheckGameplayTagsOnActor.h"
d34caeebb59216741df36659b00152c86dbfbc8b
bf0b03beeb326a36990d93f6e20d6ef123fccbe0
/VirtualMachine/Primitives/Array.cpp
65359db056961b3a3ab3975efb2258f9fed3d52b
[]
no_license
Crawping/Cyclone
451a4eccf0487d306fa8e0cb3880a8746e2857f3
410c80a965824039f53fd9afa9291b5084427915
refs/heads/master
2021-01-01T04:02:49.879405
2017-07-12T21:58:42
2017-07-12T21:58:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,179
cpp
Array.cpp
#include "Primitives/Array.h" namespace Cyclone { namespace Virtual { /** CONSTRUCTOR **/ Array::Array(ReferenceTypes type, uint capacity): _data(capacity), _type(type) { } /** UTILITIES **/ Number& Array::Access(Reference location) { static Number null(ReferenceTypes::Null); return location.Offset() < Count() ? _data(location.Offset()) : null; } void Array::Insert(Reference location, Number value) { _data.Insert(location.Offset(), value); } void Array::Insert(Reference location, const ICollection<Number>& values) { _data.Insert(location.Offset(), values); } //Array Array::Calculate(Instructions operation, const Array& other) //{ // return Array(); //} //Reference& Array::Get(uint index) //{ // return _data(index); //} //void Array::Set(uint index, const Reference& value) //{ // if (index >= Count()) { return; } // _data(index) = value; //} } }
17441a9e72762d7b41171ad0793a5aac14b198a4
5100674f94aca3f0a0e9c4f3bcb16006d11e5c6b
/basic/vector.cpp
3c6b0f9e22a9edd4b54eeeff0704f53f9338c0b9
[]
no_license
erikliu123/algorithm_problems
0702655ed61d60702395390e377d4e480aae75dc
7cab9006dc37a745ac9a5f96a9d4265508b712af
refs/heads/master
2023-08-11T13:01:07.235840
2021-09-27T03:28:41
2021-09-27T03:28:41
357,453,683
0
0
null
null
null
null
UTF-8
C++
false
false
1,740
cpp
vector.cpp
#include <iostream> #include <array> #include <vector> #include <cstring> using namespace std; void Print(vector<vector<int>> a) { vector<vector<int> >::iterator p1; vector<int>::iterator p2; for (p1 = a.begin(); p1 != a.end(); p1++) { for (p2 = p1->begin(); p2 != p1->end(); p2++) { cout << "[" << *p2 << "]"; } cout <<endl; } cout <<endl; } int main() { int i = 0; vector <int> asd(4,2); //将含有4个数据的一维动态数组初始为2 vector<std::vector<int> > asd1(4,vector<int>(4,0)); //初始化row*column二维动态数组,初始化值为0 vector<std::vector<int> >::iterator p1; vector <int>::iterator p2; //简单初始化 for (p1 = asd1.begin(); p1 != asd1.end(); p1++) { for (p2 = p1->begin(); p2 != p1->end(); p2++) { *p2 = i++; } } cout << "Init:" <<endl; Print(asd1); //插入列元素用push_back asd1[1].push_back(23); asd1.push_back(asd); //设置行列数 int size_row = asd1.size(); //获取行数 cout << "size_row:" << size_row <<endl; asd1.resize(10); //设置行数 size_row = asd1.size(); //获取行数 cout << "size_row:" << size_row <<endl; int size_col = asd1[0].size(); cout << "size_col:" << size_col <<endl; asd1[1].resize(10); //设置列数 size_col = asd1[1].size(); cout << "size_col:" << size_col <<endl; cout << "Push_back:" <<endl; Print(asd1); cout << "Erase:" <<endl; auto test1 = asd1.begin(); test1 = test1 + 3; asd1.erase(test1); Print(asd1); return 0; }
dbdb32c16f503e6b9f37b3dfd96aadaabea86eaa
270937d32c2bc8e33622d96c045b43b8a23bc086
/ion/port/timer.h
592fa0613dd7ef29ccb0eca10ad2de670a9b3d17
[ "Apache-2.0" ]
permissive
google/ion
32491fc26a0a2a5fd602e4008296ccba5017d689
514ce797458d02e7cd3a1b2d0b5c7ff8ccb5f5d1
refs/heads/master
2023-09-04T18:10:40.343013
2022-06-09T07:56:18
2022-06-09T07:56:18
50,387,855
1,651
132
Apache-2.0
2018-05-12T02:16:47
2016-01-25T23:13:46
C++
UTF-8
C++
false
false
2,358
h
timer.h
/** Copyright 2017 Google 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 ION_PORT_TIMER_H_ #define ION_PORT_TIMER_H_ #include <chrono> // NOLINT #include <type_traits> #include "base/integral_types.h" namespace ion { namespace port { class Timer { public: #if defined(ION_PLATFORM_WINDOWS) // The Microsoft implementation of steady_clock is not actually steady in // Visual Studio 2013. This is patterned after the implementation in VS 2015. struct steady_clock { typedef int64 rep; typedef std::nano period; typedef std::chrono::duration<rep, period> duration; typedef std::chrono::time_point<steady_clock> time_point; static const bool is_steady = true; static time_point now(); }; #else // Use the high_resolution_clock if it is steady, otherwise use the // steady_clock. typedef std::conditional<std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock>::type steady_clock; #endif typedef steady_clock Clock; Timer() { Reset(); } // Resets the timer. void Reset(); // Returns the elapsed time since construction or the last Reset(). Clock::duration Get() const; // Returns the elapsed time since construction or the last Reset() in seconds. // Convenience wrapper for Get(). double GetInS() const; // Returns the elapsed time since construction or the last Reset() in // milliseconds. Convenience wrapper for Get(). double GetInMs() const; // Sleeps for the passed number of seconds. static void SleepNSeconds(unsigned int seconds); // Sleeps for n milliseconds. static void SleepNMilliseconds(unsigned int milliseconds); private: steady_clock::time_point start_; }; } // namespace port } // namespace ion #endif // ION_PORT_TIMER_H_
8fd36cc2a885a35b78cde83a67508bc1f953941c
208c908b3baa65dfcabb2e1369d8619a1ada1e15
/lib/winss/supervise/state_file.cpp
2bbf01addc9526acf7f43b97bd8183a39b32f4c9
[ "MIT", "Apache-2.0" ]
permissive
toenuff/winss
41197f7698551d994cdba47cde0804a4e87ec143
05c912afb0de1c0cd08929333473fab0b81dcc73
refs/heads/master
2021-01-12T02:36:05.383456
2017-12-13T18:37:16
2017-12-13T18:37:16
78,072,735
1
0
null
null
null
null
UTF-8
C++
false
false
5,428
cpp
state_file.cpp
/* * Copyright 2016-2017 Morgan Stanley * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define NOMINMAX #include "state_file.hpp" #include <filesystem> #include <sstream> #include <chrono> #include <string> #include "easylogging/easylogging++.hpp" #include "../filesystem_interface.hpp" #include "../utils.hpp" #include "json/json.hpp" #include "supervise.hpp" namespace fs = std::experimental::filesystem; const char winss::SuperviseStateFile::kStateFile[] = "state"; winss::SuperviseStateFile::SuperviseStateFile(fs::path service_dir) : state_file(service_dir / fs::path(winss::Supervise::kMutexName) / fs::path(kStateFile)) {} const fs::path& winss::SuperviseStateFile::GetPath() const { return state_file; } bool winss::SuperviseStateFile::Notify( winss::SuperviseNotification notification, const winss::SuperviseState& state) { try { nlohmann::json json = { { "time", winss::Utils::ConvertToISOString(state.time) }, { "last", winss::Utils::ConvertToISOString(state.last) }, { "proc", state.is_run_process ? winss::Supervise::kRunFile : winss::Supervise::kFinishFile }, { "state", state.is_up ? "up" : "down" }, { "initial", state.initially_up ? "up" : "down" }, { "count", state.up_count }, { "remaining", state.remaining_count }, { "pid", state.pid }, { "exit", state.exit_code } }; FILESYSTEM.Write(state_file, json.dump()); } catch (const std::exception& e) { VLOG(1) << "Failed to write state file " << state_file << " because: " << e.what(); } return true; } bool winss::SuperviseStateFile::Read(winss::SuperviseState* state) const { if (state == nullptr) { return false; } try { std::string content = FILESYSTEM.Read(state_file); if (content.empty()) { return false; } auto ss = std::stringstream(content); auto json = nlohmann::json::parse(ss); for (auto it = json.begin(); it != json.end(); ++it) { std::string key = it.key(); auto value = it.value(); if (key == "time" && value.is_string()) { state->time = winss::Utils::ConvertFromISOString(value); } else if (key == "last" && value.is_string()) { state->last = winss::Utils::ConvertFromISOString(value); } else if (key == "proc" && value.is_string() && value == std::string("run")) { state->is_run_process = true; } else if (key == "state" && value.is_string() && value == std::string("up")) { state->is_up = true; } else if (key == "initial" && value.is_string() && value == std::string("up")) { state->initially_up = true; } else if (key == "count" && value.is_number()) { state->up_count = value; } else if (key == "remaining" && value.is_number()) { state->remaining_count = value; } else if (key == "pid" && value.is_number()) { state->pid = value; } else if (key == "exit" && value.is_number()) { state->exit_code = value; } } } catch (const std::exception& e) { VLOG(1) << "Failed to read state file " << state_file << " because: " << e.what(); return false; } return true; } std::string winss::SuperviseStateFile::Format( const winss::SuperviseState& state, bool is_up) const { std::stringstream ss; bool is_run = state.is_up && state.is_run_process; if (is_run) { ss << "up (pid " << state.pid << ")"; } else { ss << "down"; if (state.exit_code != 0) { ss << " (exit code " << state.exit_code << ")"; } } auto now = std::chrono::system_clock::now(); auto delay = std::chrono::duration_cast<std::chrono::seconds>( now - state.last).count(); if (delay >= 0) { ss << " " << delay << " seconds"; } if (is_up) { if (state.up_count > 1) { ss << ", started " << state.up_count << " times"; } if (is_run) { if (!state.initially_up) { ss << ", normally down"; } if (state.remaining_count == 0) { ss << ", want down"; } } else { if (state.initially_up) { ss << ", normally up"; } if (state.remaining_count != 0) { ss << ", want up"; } else if (state.up_count > 0) { ss << ", paused"; } } } return ss.str(); }
a7682e29ed954e7c7e1772317634969191f57d11
f090bb5ce3d353327d573062230643f609ad6d33
/5_9.cpp
2f79f8ddd22cf8baca953c8ac07c8276a22fee8f
[]
no_license
rogersentongo/CPPSolutions
f5fc851b435043e32ab9017b131f921f05009aa2
7a3cd922271d565e31e4b15fcff2db4325145919
refs/heads/master
2020-06-04T10:02:18.225849
2019-06-18T00:29:10
2019-06-18T00:29:10
191,977,777
0
0
null
null
null
null
UTF-8
C++
false
false
506
cpp
5_9.cpp
/* * Product of Odd Integers: Write a program that uses a for statement to calculate * and print the product of the odd integers from 1 to 15. By Roger Sentongo */ #include <iostream> using namespace std; int main() { int odd{1}, product{1}; //There are 7 odd integers between 1 and 15 for(int i{1}; i <=7; ++i){ odd = (2*i)+1; cout << odd<< endl; product *=odd; } cout << "The product of odd integers from 1 to 15 is "<< product<<endl; return 0; }
a2214372b609069712901cb2714f8c97e753f836
35b42dc4f273857503accd7a6b8dcf1ee58d92ea
/src/Demo/Demo.hpp
0586b8f2a7c23a9b6c5805460b266fe1cef53cbb
[]
no_license
ChornyiLys/SGE
767378ab848f583489c32f95765aa3ef60195773
cc97db0a1a1ad99a06db7b03c77e184dfa79327f
refs/heads/master
2016-09-05T17:57:57.364793
2015-09-15T21:58:40
2015-09-15T21:58:40
42,205,173
0
0
null
null
null
null
UTF-8
C++
false
false
153
hpp
Demo.hpp
/* * Demo.hpp * * Created on: Sep 16, 2015 * Author: chlys */ #ifndef DEMO_DEMO_HPP_ #define DEMO_DEMO_HPP_ #endif /* DEMO_DEMO_HPP_ */
81993f09a06155682e4fa05ce532b2221023a542
88ae8695987ada722184307301e221e1ba3cc2fa
/third_party/openscreen/src/cast/streaming/bandwidth_estimator.h
f8ce7af2088c392fcfee557abc67f552db5d2c6f
[ "BSD-3-Clause", "Apache-2.0", "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C++
false
false
7,518
h
bandwidth_estimator.h
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CAST_STREAMING_BANDWIDTH_ESTIMATOR_H_ #define CAST_STREAMING_BANDWIDTH_ESTIMATOR_H_ #include <stdint.h> #include <limits> #include "platform/api/time.h" namespace openscreen { namespace cast { // Tracks send attempts and successful receives, and then computes a total // network bandwith estimate. // // Two metrics are tracked by the BandwidthEstimator, over a "recent history" // time window: // // 1. The number of packets sent during bursts (see SenderPacketRouter for // explanation of what a "burst" is). These track when the network was // actually in-use for transmission and the magnitude of each burst. When // computing bandwidth, the estimator assumes the timeslices where the // network was not in-use could have been used to send even more bytes at // the same rate. // // 2. Successful receipt of payload bytes over time, or a lack thereof. // Packets that include acknowledgements from the Receivers are providing // proof of the successful receipt of payload bytes. All other packets // provide proof of network connectivity over time, and are used to // identify periods of time where nothing was received. // // The BandwidthEstimator assumes a simplified model for streaming over the // network. The model does not include any detailed knowledge about things like // protocol overhead, packet re-transmits, parasitic bufferring, network // reliability, etc. Instead, it automatically accounts for all such things by // looking at what's actually leaving the Senders and what's actually making it // to the Receivers. // // This simplified model does produce some known inaccuracies in the resulting // estimations. If no data has recently been transmitted (or been received), // estimations cannot be provided. If the transmission rate is near (or // exceeding) the network's capacity, the estimations will be very accurate. In // between those two extremes, the logic will tend to under-estimate the // network's capacity. However, those under-estimates will still be far larger // than the current transmission rate. // // Thus, these estimates can be used effectively as a control signal for // congestion control in upstream code modules. The logic computing the media's // encoding target bitrate should be adjusted in realtime using a TCP-like // congestion control algorithm: // // 1. When the estimated bitrate is less than the current encoding target // bitrate, aggressively and immediately decrease the encoding bitrate. // // 2. When the estimated bitrate is more than the current encoding target // bitrate, gradually increase the encoding bitrate (up to the maximum // that is reasonable for the application). class BandwidthEstimator { public: // |max_packets_per_timeslice| and |timeslice_duration| should match the burst // configuration in SenderPacketRouter. |start_time| should be a recent // point-in-time before the first packet is sent. BandwidthEstimator(int max_packets_per_timeslice, Clock::duration timeslice_duration, Clock::time_point start_time); ~BandwidthEstimator(); // Returns the duration of the fixed, recent-history time window over which // data flows are being tracked. Clock::duration history_window() const { return history_window_; } // Records |when| burst-sending was active or inactive. For the active case, // |num_packets_sent| should include all network packets sent, including // non-payload packets (since both affect the modeled utilization/capacity). // For the inactive case, this method should be called with zero for // |num_packets_sent|. void OnBurstComplete(int num_packets_sent, Clock::time_point when); // Records when a RTCP packet was received. It's important for Senders to call // this any time a packet comes in from the Receivers, even if no payload is // being acknowledged, since the time windows of "nothing successfully // received" is also important information to track. void OnRtcpReceived(Clock::time_point arrival_time, Clock::duration estimated_round_trip_time); // Records that some number of payload bytes has been acknowledged (i.e., // successfully received). void OnPayloadReceived(int payload_bytes_acknowledged, Clock::time_point ack_arrival_time, Clock::duration estimated_round_trip_time); // Computes the current network bandwith estimate. Returns 0 if this cannot be // determined due to a lack of sufficiently-recent data. int ComputeNetworkBandwidth() const; private: // FlowTracker (below) manages a ring buffer of size 256. It simplifies the // index calculations to use an integer data type where all arithmetic is mod // 256. using index_mod_256_t = uint8_t; static constexpr int kNumTimeslices = static_cast<int>(std::numeric_limits<index_mod_256_t>::max()) + 1; // Tracks volume (e.g., the total number of payload bytes) over a fixed // recent-history time window. The time window is divided up into a number of // identical timeslices, each of which represents the total number of bytes // that flowed during a certain period of time. The data is accumulated in // ring buffer elements so that old data points drop-off as newer ones (that // move the history window forward) are added. class FlowTracker { public: FlowTracker(Clock::duration timeslice_duration, Clock::time_point begin_time); ~FlowTracker(); Clock::time_point begin_time() const { return begin_time_; } Clock::time_point end_time() const { return begin_time_ + timeslice_duration_ * kNumTimeslices; } // Advance the end of the time window being tracked such that the // most-recent timeslice includes |until|. Too-old timeslices are dropped // and new ones are initialized to a zero amount. void AdvanceToIncludeTime(Clock::time_point until); // Accumulate the given |amount| into the timeslice that includes |when|. void Accumulate(int32_t amount, Clock::time_point when); // Return the sum of all the amounts in recent history. This clamps to the // valid range of int32_t, if necessary. int32_t Sum() const; private: const Clock::duration timeslice_duration_; // The beginning of the oldest timeslice in the recent-history time window, // the one pointed to by |tail_|. Clock::time_point begin_time_; // A ring buffer tracking the accumulated amount for each timeslice. int32_t history_ring_[kNumTimeslices]{}; // The index of the oldest timeslice in the |history_ring_|. This can also // be thought of, equivalently, as the index just after the most-recent // timeslice. index_mod_256_t tail_ = 0; }; // The maximum number of packet sends that could possibly be attempted during // the recent-history time window. const int max_packets_per_history_window_; // The range of time being tracked. const Clock::duration history_window_; // History tracking for send attempts, and success feeback. These timeseries // are in terms of when packets have left the Senders. FlowTracker burst_history_; FlowTracker feedback_history_; }; } // namespace cast } // namespace openscreen #endif // CAST_STREAMING_BANDWIDTH_ESTIMATOR_H_
0af53c789183a18b3516909dd9c9a1d0e50ca2b7
92623f41efd452129cba9940556cca4fafb9e8fa
/Backtracking/05 - Generate IP Addresses.cpp
865809b6ffb54657cac99ac1e8dd6c61dd1c5ad1
[]
no_license
Vikas-Jethwani/Geeks4Geeks-Solutions
a693d4855f914cd6d2d594735524e742b9de8cb8
0118337870d6dab6bcda76aa04b9f2cf2bd149d7
refs/heads/master
2021-09-26T22:51:15.208863
2020-08-05T14:52:34
2020-08-05T14:52:34
192,599,371
0
0
null
null
null
null
UTF-8
C++
false
false
1,844
cpp
05 - Generate IP Addresses.cpp
// Fall 7 times and Stand-up 8 #include <bits/stdc++.h> // StAn using namespace std; vector<string> split(string s, char ch=' ') { vector<string> ans; ans.clear(); string temp = ""; for (int i=0; i<s.size(); i++) { if (s[i] == ch) { if (temp != "") ans.push_back(temp); temp = ""; } else temp += s[i]; } // if (temp != "") // Commented out to catch "10.0.0.1." ans.push_back(temp); return ans; } bool validateIP4(string ip) { vector<string> ans = split(ip, '.'); if (ans.size() != 4) return false; for (int i=0; i<ans.size(); i++) { if (ans[i].size() == 0) return false; if (ans[i].size() > 3) // Avoiding stoi throwing out of bound errors "1234567899" return false; if (ans[i].size() > 1 && ans[i][0] == '0') // Leading 0 return false; for (int j=0; j<ans[i].size(); j++) { if (ans[i][j] < '0' || ans[i][j] > '9') return false; } int val = stoi(ans[i]); if (val < 0 || val > 255) return false; } return true; } vector<string> genIp(string &s) { vector<string> ans; ans.clear(); int n = s.size(); for (int i=1; i<n; i++) { for (int j=i+1; j<n; j++) { for (int k=j+1; k<n; k++) { string temp = ""; for (int l=0; l<n; l++) { if (l == i || l == j || l == k) { temp += "."; } temp += s[l]; } if (validateIP4(temp)) ans.push_back(temp); } } } return ans; }
cc45d246de09c277f2b8c4540abb0f99074ca8a4
adbfbfe185c8e682406127041032bc4f715c1b0b
/src/main.cpp
a7f0821334f5534ab01f4e2e3d582f464860a6b9
[ "MIT" ]
permissive
quesnel/mitm
709becbf87939650173a0faf8b7ce72427e8e5de
50c82fcdfbc17bb13d8c2cfd7b63943d68f5c46c
refs/heads/master
2021-01-10T04:51:33.891887
2015-12-16T18:14:10
2015-12-16T18:14:10
46,709,123
1
1
null
null
null
null
UTF-8
C++
false
false
6,304
cpp
main.cpp
/* Copyright (C) 2015 INRA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <mitm/mitm.hpp> #include <fstream> #include <iostream> #include <cerrno> #include <cstdlib> #include <climits> #include <cmath> #include <getopt.h> namespace { void help_show() noexcept { std::cout << "mitm [options...]\n" << "-m method h_classic, h_gpgpu\n" << "-l limit number of loop\n" << "-k kappa kappa init value [0..1[ (float)\n" << "-d delta delta value [0..+oo[ (float)\n" << "-t theta theta value [0..1] (float)\n" << '\n' << "File format: (text file)\n" << " # ... are comments\n" << " [format (int), default 0]\n" << " [m constraints (int)] [n variables (int)]\n" << " [constraint matrix (m * n boolean)]\n" << " [equality vector (m int)]\n" << " [cost vector (n int)]\n" << '\n' << "Example:\n" << "0 # model index\n" << "2 3 # constraints and variables numbers\n" << "1 0 0 1 1 1 # 2*3 constraints matrix A\n" << "1 1 # 2 vector B\n" << "27.3 48.1 0.19 # 3 vector C (costs)\n" << std::endl; } } int main(int argc, char *argv[]) { std::string option_method; long int option_limit = 100; float kappa = 0.001; float delta = 0.0001; float theta = 0.001; int option; char *c; while ((option = ::getopt(argc, argv, "l:k:d:t:m:h")) != -1) { switch (option) { case 'l': errno = 0; option_limit = std::strtol(::optarg, &c, 10); if ((errno == ERANGE && (option_limit == LONG_MAX || option_limit == LONG_MIN)) || (errno != 0 && option_limit == 0) || (c == ::optarg) || (option_limit < 0)) { std::cerr << "fail to convert parameter `" << ::optarg << " for parameter l\n"; exit(EXIT_FAILURE); } case 'k': errno = 0; kappa = std::strtof(::optarg, &c); if ((errno == ERANGE && (kappa == HUGE_VALF || kappa == -HUGE_VALF)) || (errno != 0 && kappa == 0) || (c == ::optarg) || (kappa < 0) || (kappa > 1)) { std::cerr << "fail to convert parameter `" << ::optarg << " for parameter kappa (or k)\n"; exit(EXIT_FAILURE); } case 'd': errno = 0; delta = std::strtof(::optarg, &c); if ((errno == ERANGE && (delta == HUGE_VALF || delta == -HUGE_VALF)) || (errno != 0 && delta == 0) || (c == ::optarg) || (delta < 0)) { std::cerr << "fail to convert parameter `" << ::optarg << " for parameter delta (or l)\n"; exit(EXIT_FAILURE); } case 't': errno = 0; theta = std::strtof(::optarg, &c); if ((errno == ERANGE && (delta == HUGE_VALF || delta == -HUGE_VALF)) || (errno != 0 && delta == 0) || (c == ::optarg) || (theta < 0 || theta > 1)) { std::cerr << "fail to convert parameter `" << ::optarg << " for parameter theta\n"; exit(EXIT_FAILURE); } case 'm': option_method = ::optarg; break; case 'h': ::help_show(); return EXIT_SUCCESS; } } for (int i = ::optind; i < argc; ++i) { std::ifstream ifs(argv[i]); if (not ifs.is_open()) { std::cerr << "fail to open '" << argv[i] << "'\n"; continue; } try { mitm::SimpleState state; ifs >> state; if (ifs.fail()) { std::cerr << "/!\\ fail: to read SimpleState\n"; continue; } mitm::result r = mitm::heuristic_algorithm(state, option_limit, delta, kappa, theta, std::string{}); std::cout << "solution found in " << r.loop << " loops\n"; for (mitm::index i = 0; i != state.variables(); ++i) { std::cout << r.x[i] << ' '; if ((i + 1) % (state.constraints() / 2) == 0) std::cout << '\n'; } std::cout << '\n'; for (mitm::index i = 0; i != state.variables(); ++i) { std::cout << state.c[i] << ' '; if ((i + 1) % (state.constraints() / 2) == 0) std::cout << '\n'; } } catch (const std::exception &e) { std::cerr << "/!\\ fail: " << e.what() << '\n'; } } return EXIT_SUCCESS; }
19278a2f41651e8dd747fad6e4c81abc706d8ace
e15d528560e66806df67b0d3a7df071bffe0d5de
/ThomasCore/src/thomas/Physics.cpp
f110f052e35d435f07376ddcf5792348d7ba6732
[ "MIT" ]
permissive
Bojzen-I-Mitten/thomas
a9fbb628b3582c4855483bd0e9cb0e224fcb05ec
f5ecbdf7e3e205f9a9f37392f0a58dc3159c5dd8
refs/heads/master
2021-01-23T00:20:21.070961
2019-06-17T17:50:49
2019-06-17T17:50:49
85,717,110
4
1
MIT
2018-04-18T14:27:58
2017-03-21T15:13:08
C++
UTF-8
C++
false
false
4,572
cpp
Physics.cpp
#include "Physics.h" #include "ThomasTime.h" #include "object\component\physics\Rigidbody.h" #include "object\GameObject.h" #include "object\component\Camera.h" #include "graphics\BulletDebugDraw.h" namespace thomas { std::unique_ptr<btDefaultCollisionConfiguration> Physics::s_collisionConfiguration; std::unique_ptr<btCollisionDispatcher> Physics::s_dispatcher; std::unique_ptr<btBroadphaseInterface> Physics::s_broadPhase; std::unique_ptr<btSequentialImpulseConstraintSolver> Physics::s_solver; std::unique_ptr<graphics::BulletDebugDraw> Physics::s_debugDraw; std::unique_ptr<btDiscreteDynamicsWorld> Physics::s_world; float Physics::s_timeStep = 1.0f / 60.0f; //Limit physics timestep to 60 FPS float Physics::s_timeSinceLastPhysicsStep = 0.0f; std::vector<object::component::Rigidbody*> Physics::s_rigidBodies; float Physics::s_accumulator; bool Physics::Init() { //Init Bullet s_collisionConfiguration = std::make_unique<btDefaultCollisionConfiguration>(); s_dispatcher = std::make_unique<btCollisionDispatcher>(s_collisionConfiguration.get()); s_broadPhase = std::make_unique<btDbvtBroadphase>(); s_solver = std::make_unique<btSequentialImpulseConstraintSolver>(); s_world = std::make_unique<btDiscreteDynamicsWorld>(s_dispatcher.get(), s_broadPhase.get(), s_solver.get(), s_collisionConfiguration.get()); s_debugDraw = std::make_unique<graphics::BulletDebugDraw>(); //Set states s_world->setGravity(btVector3(0, -9.82f, 0)); s_debugDraw->setDebugMode(btIDebugDraw::DBG_DrawWireframe); s_world->setDebugDrawer(s_debugDraw.get()); return true; } void Physics::AddRigidBody(object::component::Rigidbody * rigidBody) { s_rigidBodies.push_back(rigidBody); s_world->addRigidBody(rigidBody); } void Physics::RemoveRigidBody(object::component::Rigidbody * rigidBody) { for (unsigned i = 0; i < s_rigidBodies.size(); ++i) { object::component::Rigidbody* rb = s_rigidBodies[i]; if (rb == rigidBody) { s_rigidBodies.erase(s_rigidBodies.begin() + i); break; } } s_world->removeRigidBody(rigidBody); } void Physics::UpdateRigidbodies() { for (object::component::Rigidbody* rb : s_rigidBodies) { rb->UpdateTransformToRigidBody(); } } //Update physics collision void Physics::Simulate() { s_timeSinceLastPhysicsStep += ThomasTime::GetDeltaTime(); if (s_timeSinceLastPhysicsStep < s_timeStep) return; s_world->stepSimulation(s_timeSinceLastPhysicsStep, 5, s_timeStep); int numManifolds = s_world->getDispatcher()->getNumManifolds(); for (unsigned i = 0; i < numManifolds; ++i) { if (numManifolds > s_world->getDispatcher()->getNumManifolds()) break; btPersistentManifold* contactManifold = s_world->getDispatcher()->getManifoldByIndexInternal(i); btCollisionObject* obA = (btCollisionObject*)contactManifold->getBody0(); btCollisionObject* obB = (btCollisionObject*)contactManifold->getBody1(); object::component::Rigidbody* rbA = static_cast<object::component::Rigidbody*>(obA); object::component::Rigidbody* rbB = static_cast<object::component::Rigidbody*>(obB); if (rbA->isActive() && rbB->isActive()) { object::component::Rigidbody::Collision colA; object::component::Rigidbody::Collision colB; colA.thisRigidbody = rbA; colA.otherRigidbody = rbB; colB.thisRigidbody = rbB; colB.otherRigidbody = rbA; /*rbA->m_gameObject->OnCollision(colA); rbB->m_gameObject->OnCollision(colB);*/ } } for (object::component::Rigidbody* rb : s_rigidBodies) { rb->UpdateRigidbodyToTransform(); } s_timeSinceLastPhysicsStep = 0.f; } void Physics::DrawDebug(object::component::Camera* camera) { s_debugDraw->Update(camera); s_world->debugDrawWorld(); s_debugDraw->drawLineFinal(); } void Physics::Destroy() { btCollisionObjectArray arr = s_world->getCollisionObjectArray(); arr.clear(); s_collisionConfiguration.reset(); s_debugDraw.reset(); s_dispatcher.reset(); s_solver.reset(); s_world.reset(); } graphics::BulletDebugDraw * Physics::getDebugDraw() { if (s_debugDraw) return s_debugDraw.get(); else return nullptr; } btVector3 Physics::ToBullet(const math::Vector3 & vector) { return *(btVector3*)&vector; } math::Vector3 Physics::ToSimple(const btVector3 & vector) { return (math::Vector3)vector; } btQuaternion Physics::ToBullet(const math::Quaternion& quaternion) { return *(btQuaternion*)&quaternion; } math::Quaternion Physics::ToSimple(const btQuaternion & quaternion) { return (math::Quaternion)quaternion; } }
ad034739417c10be4e735ae1ada74ce8e0ea8105
8287f66600fe2ac5691f320aa4c4952f437f37cb
/src/MuhaSlon.cpp
bbdb8b302bd4ce4a2d58075e3f52eed6efd7697c
[]
no_license
drafgrakula/muhaslon
8a2fff2e52d892110b86abf9548edded8de66d0d
94622e1227c0e7c4f37637d2bc8ae95b75e142f6
refs/heads/master
2020-04-22T21:12:06.221635
2019-02-14T09:53:50
2019-02-14T09:53:50
170,666,041
0
0
null
null
null
null
UTF-8
C++
false
false
1,247
cpp
MuhaSlon.cpp
#include <iostream> #include "Tree.h" #ifndef TESTING int main(int argc, char *argv[]) { std::locale::global(std::locale("")); if( argc != 3 ) { std::cout << "формат использования:\n MuhaSlon <файл с исходным и конечным словами> <файл со словарём>" << std::endl; return 0; } // подготовить словарь Dictionary dictionary; TextFileReader requirementsReader( argv[1] ); if( !dictionary.readRequirements( requirementsReader ) ) return 0; TextFileReader dictionaryReader( argv[2] ); if( !dictionary.readDictionary( dictionaryReader ) ) return 0; // создать дерево Tree tree( dictionary ); Node* finalNode = nullptr; bool isFault = false; bool isLastWordFound = tree.createTree( finalNode, isFault ); if( isFault ) { std::cout << "ошибка при создании дерева" << std::endl; return 0; } // распечатать дерево, если конечное слово найдено if( isLastWordFound ) { tree.printPath( finalNode ); } else { std::cout << "цепочка не может быть построена для данного словаря" << std::endl; } return 0; } #endif
8a92d31bca3d962cd0991a7e5d452558eff9b585
d313a67d684103b0ee7058c63a304c1b975abc0f
/open64/osprey1.0/be/opt/opt_fold.h
6dd550d2247a86a0cde76d9a9d8a4d5089313e0c
[ "BSD-2-Clause" ]
permissive
xusx595/upc
0bbef930d0f76926f049a034ba8d8e851559d0d1
e17f40219d8594ab6bd281b2ff36d542798deac5
refs/heads/master
2021-01-17T05:28:28.941066
2015-03-22T21:39:40
2015-03-22T21:39:40
32,696,839
0
0
null
null
null
null
UTF-8
C++
false
false
6,180
h
opt_fold.h
//-*-c++-*- // ==================================================================== // ==================================================================== // // Module: opt_fold.h // $Revision: 1.2 $ // $Date: 2003/03/04 06:16:03 $ // $Author: wychen $ // $Source: bitbucket.org:berkeleylab/upc-translator.git/open64/osprey1.0/be/opt/opt_fold.h $ // // Revision history: // 31-MAY-95 dahl - Original Version // // ==================================================================== // // Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. // // This program is free software; you can redistribute it and/or modify // it under the terms of version 2 of the GNU General Public License as // published by the Free Software Foundation. // // This program is distributed in the hope that it would be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // Further, this software is distributed without any warranty that it // is free of the rightful claim of any third person regarding // infringement or the like. Any license provided herein, whether // implied or otherwise, applies only to this software file. Patent // licenses, if any, provided herein do not apply to combinations of // this program with other software, or any other product whatsoever. // // You should have received a copy of the GNU General Public License // along with this program; if not, write the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. // // Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, // Mountain View, CA 94043, or: // // http://www.sgi.com // // For further information regarding this notice, see: // // http://oss.sgi.com/projects/GenInfo/NoticeExplan // // ==================================================================== // // Description: // defines FOLD class and member functions for the interface to // the simplifier called by copy propagation // // ==================================================================== // ==================================================================== #ifndef opt_fold_INCLUDED #define opt_fold_INCLUDED "opt_fold.h" #ifdef _KEEP_RCS_ID static char *opt_foldrcs_id = opt_fold_INCLUDED"$Revision: 1.2 $"; #endif /* _KEEP_RCS_ID */ #ifndef opt_htable_INCLUDED #include "opt_htable.h" // for CODEREP #endif #ifndef config_INCLUDED #include "config.h" // for Force_IEEE_Comparisons #endif class FOLD { public: FOLD(void); // sets tracing flag // main entry points for folding to a constant CODEREP *Fold_Expr(CODEREP *); // one level CODEREP *Fold_Tree(CODEREP *); // entire tree private: // a pointer is returned #define NOHASH NULL // did nothing #define CONST NULL // folded to a constant // debugging print void Print(const char *, const CODEREP *); // routines to interface to simplifier CODEREP *CR_Simplify_Tree(CODEREP *); CODEREP *CR_Simplify_Expr(CODEREP *); // allow expr simplifier to look one level past CVT and CVTL BOOL check_convert(CODEREP *, CODEREP **, INT); // don't carry along or maintain any maps WN_MAP CR_SimpParentMap(void) { return (WN_MAP)0; } }; // type definitions for wn_simp_code.h, a simpnode is a CODEREP not a WN now typedef CODEREP * simpnode; /* Accessors */ #define SIMPNODE_opcode CR_opcode #define SIMPNODE_operator CR_operator #define SIMPNODE_rtype(x) (x)->Dtyp() #define SIMPNODE_desc(x) (x)->Dsctyp() #define SIMPNODE_load_offset(x) (x)->Offset() #define SIMPNODE_cvtl_bits(x) (x)->Offset() #define SIMPNODE_st CR_st #define SIMPNODE_st_idx(x) ST_st_idx(CR_st(x)) #define SIMPNODE_ty CR_ty #define SIMPNODE_kid0 CR_kid0 // kid 1 means nothing to IVAR, only to OP #define SIMPNODE_kid1(x) (((x)->Kind() == CK_OP) ? \ (x)->Opnd(1) : NULL) #define SIMPNODE_kid CR_kid #define SIMPNODE_kid_count CR_kid_count #define SIMPNODE_element_size(x) (x)->Elm_siz() #define SIMPNODE_idname_offset(x) (x)->Offset() #define SIMPNODE_lda_offset(x) (x)->Offset() #define SIMPNODE_num_dim(x) (x)->Num_dim() #define SIMPNODE_array_base(x) (x)->Opnd(0) #define SIMPNODE_array_index(x,y) (x)->Opnd((x)->Num_dim()+y+1) #define SIMPNODE_array_dim(x,y) (x)->Opnd(y+1) #define SIMPNODE_intrinsic(x) (x)->Intrinsic() #define SIMPNODE_const_val(x) (x)->Const_val() #define SIMPNODE_fconst_val(x) (x)->Const_ftcon2(fold_htable) #define SIMPNODE_field_id(x) (x)->Field_id() #define SIMPNODE_i_field_id(x) (x)->I_field_id() #define SIMPNODE_bit_offset(x) (x)->Bit_offset() #define SIMPNODE_i_bit_offset(x) (x)->I_bit_offset() #define SIMPNODE_op_bit_offset(x) (x)->Op_bit_offset() #define SIMPNODE_op_bit_size(x) (x)->Op_bit_size() /* on/off switch and trace file */ #define SIMPNODE_enable WOPT_Enable_CRSIMP #define TRACEFILE TFile /* Functions */ #define SIMPNODE_SimpCreateExp1 CR_SimpCreateExp1 #define SIMPNODE_SimpCreateExp2 CR_SimpCreateExp2 #define SIMPNODE_SimpCreateExp3 CR_SimpCreateExp3 #define SIMPNODE_SimpCreateCvtl CR_SimpCreateCvtl #define SIMPNODE_SimpCreateExtract CR_SimpCreateExtract #define SIMPNODE_SimpCreateDeposit CR_SimpCreateDeposit #define SIMPNODE_TREE_DELETE(x) (x)->DecUsecnt_rec() #define SIMPNODE_DELETE(x) (x)->DecUsecnt() #define SIMPNODE_CopyNode(x) (((x)->Coderep_id() == 0) ? \ fold_htable->Rehash(x) : (x)) #define SIMPNODE_CreateIntconst CR_CreateIntconst #define SIMPNODE_CreateFloatconstFromTcon CR_CreateFPconst #define SIMPNODE_Simplify_Initialize CR_Simplify_Initialize #define SIMPNODE_Compare_Symbols CR_Compare_Symbols extern simpnode SIMPNODE_SimplifyExp1(OPCODE, simpnode); extern simpnode SIMPNODE_SimplifyExp2(OPCODE, simpnode, simpnode); extern simpnode SIMPNODE_SimplifyExp3(OPCODE, simpnode, simpnode, simpnode); extern simpnode SIMPNODE_SimplifyCvtl(OPCODE, INT16, simpnode); extern simpnode SIMPNODE_SimplifyIntrinsic(OPCODE, UINT32, INT32, simpnode *); // to interface for coderep rehash mechanism extern void Initialize_CR_simp(CODEMAP*); extern INT32 CR_Compare_Symbols(CODEREP*, CODEREP*); extern INT32 CR_Compare_Trees(CODEREP*, CODEREP*); #endif // opt_fold_INCLUDED
063744d9ba292b49621cc567a7886511571d42e2
452e11aeaf52a420b8e687b4888cbae9bd05bc61
/2016/October/194_Max_Points_on_a_Line.cpp
54806b84610e2deaf749cbb05aa82d2b0857c8b0
[]
no_license
heshenghuan/leetcode-exercise
5ae75ba446f48997e307649563df935b81684a97
a4753f50ade11270d6c2e31f219a25862955ae4e
refs/heads/master
2021-01-17T02:41:53.806286
2017-03-29T07:24:04
2017-03-29T07:24:04
58,852,150
0
0
null
null
null
null
UTF-8
C++
false
false
1,090
cpp
194_Max_Points_on_a_Line.cpp
/** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(0), y(0) {} * Point(int a, int b) : x(a), y(b) {} * }; */ class Solution { public: int maxPoints(vector<Point>& points) { int result = 0; int samePoint; for(int i = 0; i < points.size(); ++i) { samePoint = 1; unordered_map<double, int> slope; for(int j = i+1; j < points.size(); ++j) { if(points[i].x == points[j].x) { if (points[i].y == points[j].y) ++samePoint; else ++slope[INT_MAX]; } else { double k = double(points[i].y - points[j].y) /double(points[i].x - points[j].x); slope[k]++; } } int max = 0; for(auto t : slope) max = max > t.second?max:t.second; max += samePoint; result = result > max?result:max; } return result; } };
49c9317735549ae691611718bd04abf7423ce346
a61739604139b6afae25617b062be28b3344da44
/wizualizer/robotcontroller.cpp
30df306a900110f58296878fd3d28f2bc6f19744
[]
no_license
dorianJaniak/wds_sonar
2d00f561b78b796e520a6324bbb77bc80e681729
1a2fc3cd1ef9012b60335e21884b58d723cd8640
refs/heads/master
2021-01-01T15:24:42.056597
2015-06-23T22:23:27
2015-06-23T22:23:27
32,487,416
0
1
null
null
null
null
UTF-8
C++
false
false
9,027
cpp
robotcontroller.cpp
#include "robotcontroller.h" #include <QtSerialPort/QSerialPortInfo> #include <QEventLoop> #include <QCoreApplication> RobotController::RobotController() : MessageController() // QSerialPort() { RobotOrientation empty; empty.position = QVector4D(0,0,0,1); empty.angleY = 0; m_robotActualOrient = empty; m_robotExpectedOrient = empty; } RobotController::~RobotController() { } RobotOrientation RobotController::getActualOrientation() { return m_robotActualOrient; } RobotOrientation RobotController::getExpectedOrientation() { return m_robotExpectedOrient; } bool RobotController::moveRobot(RobotOrientation displacement, unsigned vCMperSspeed, bool toSerial) { bool status = false; clearSerialBuffers(); double distanceCM, rotBeforeMove = 0, rotAfterMove = 0; distanceCM = 100* sqrt( displacement.position[0]*displacement.position[0] + displacement.position[2]*displacement.position[2] ); unsigned timeMS = (1000* distanceCM)/ vCMperSspeed; if(timeMS == 0) timeMS = 1; if(distanceCM >= 1) { rotBeforeMove = 180.0*acos((-100*displacement.position[2])/distanceCM)/g_pi; if(displacement.position[0] > 0) rotBeforeMove *= -1; rotBeforeMove -= m_robotExpectedOrient.angleY; } rotAfterMove = displacement.angleY - rotBeforeMove; if(rotAfterMove > 180.0f) rotAfterMove -= 360.0f; else if(rotAfterMove < -180.0f) rotAfterMove += 360.0f; if(rotBeforeMove > 180.0f) rotBeforeMove -= 360.0f; else if(rotBeforeMove < -180.0f) rotBeforeMove += 360.0f; QString msgSend = prepareStringFromList( prepareW05( vCMperSspeed, (unsigned)distanceCM, (int)rotBeforeMove, (int)rotAfterMove)); if(toSerial) { serial.write(msgSend.toLocal8Bit()); emit blockWindow(tr("Poczekaj %1 s, powinieneś zobaczyć poruszającego się robota.").arg(QString::number(timeMS/1000)),timeMS); QCoreApplication::processEvents(QEventLoop::AllEvents); QString msgResponse = readMessageFromSerial(timeMS); emit sendLog(tr("WIADOMOŚĆ: ") + msgResponse); QVector<int> result = reinterpretW06(prepareListFromString(msgResponse)); if(result.size()==3) { status = true; emit sendLog(tr("Operacja przemieszczenia robota zakończona powodzeniem.")); float angle_move = (float)result.at(1) + m_robotExpectedOrient.angleY; float x_move = -1.0f*(float)result.at(0)*sin((angle_move * g_pi )/ 180.0f)/100; float z_move = -1.0f*(float)result.at(0)*cos((angle_move * g_pi)/ 180.0f)/100; m_robotExpectedOrient.angleY += (result.at(1) + result.at(2)); while(m_robotExpectedOrient.angleY > 180.0f) m_robotExpectedOrient.angleY -= 360.0f; while(m_robotExpectedOrient.angleY < -180.0f) m_robotExpectedOrient.angleY += 360.0f; m_robotExpectedOrient.position[0] += x_move; m_robotExpectedOrient.position[2] += z_move; } } else{ status = true; m_robotExpectedOrient.angleY += displacement.angleY; for(int i=0; i<3; i++) m_robotExpectedOrient.position[i] += displacement.position[i]; } return status; } bool RobotController::moveStepperMotor(bool directionRight, unsigned angle, unsigned vDegreeSpeed) { clearSerialBuffers(); unsigned timeMS = (angle*1000)/vDegreeSpeed; QString msgSend = prepareStringFromList(prepareW04(directionRight,angle,vDegreeSpeed)); serial.write(msgSend.toLocal8Bit()); emit blockWindow(tr("Poczekaj %1 s, powinieneś zobaczyć obracający się czujnik zamieszczony na silniku krokowym.").arg(QString::number(timeMS/1000)),timeMS); QCoreApplication::processEvents(QEventLoop::AllEvents); QString msgResponse = readMessageFromSerial(timeMS); emit sendLog(tr("WIADOMOŚĆ: ") + msgResponse); if(reinterpretW00(prepareListFromString(msgResponse))) { emit sendLog(tr("Operacja obrotu sonaru zakończona powodzeniem.")); return true; } return true; } QVector<QVector<QVector4D>*> * RobotController::scanTerritory(unsigned cMeasurements ,unsigned vDegreeSpeed) { clearSerialBuffers(); QString msgResponse; QString msgSend; unsigned timeMS = (2*g_scanAngle*1000)/vDegreeSpeed; msgSend = prepareStringFromList(prepareW02(cMeasurements,vDegreeSpeed)); serial.write(msgSend.toLocal8Bit()); emit blockWindow(tr("Poczekaj %1 s, powinieneś zobaczyć obracający się czujnik zamieszczony na silniku krokowym").arg(QString::number(timeMS/1000)),timeMS); QCoreApplication::processEvents(QEventLoop::AllEvents); msgResponse = readMessageFromSerial(timeMS); emit sendLog(tr("WIADOMOŚĆ: ") + msgResponse); QStringList allFields = prepareListFromString(msgResponse); return reinterpretW03(allFields); } bool RobotController::openSerial() { QString caption = MessageController::tr("Problem COM %1:").arg(serial.portName()); QVector<ErrorType> errors; if(serial.portName().isEmpty()) { QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts(); errors.append(e13_serial_not_configured); if(ports.size()) { serial.setPort(ports.at(0)); } else { errors.append(e10_serial_not_opened); emit sendLog(caption,errors); return false; } } if(!serial.open(QSerialPort::ReadWrite)) { errors.append(e10_serial_not_opened); emit sendLog(caption,errors); return false; } emit sendLog(tr("Udało się połączyć z portem: %1").arg(serial.portName())); return true; } bool RobotController::closeSerial() { serial.close(); emit sendLog(tr("Port %1 zamknięty").arg(serial.portName())); return true; } void RobotController::reconfigureSerial(const QSerialPortInfo& port, QSerialPort::BaudRate br, QSerialPort::DataBits db, QSerialPort::FlowControl fc, QSerialPort::Parity p, QSerialPort::StopBits sb) { serial.setBaudRate(br,QSerialPort::AllDirections); serial.setDataBits(db); serial.setFlowControl(fc); serial.setParity(p); serial.setStopBits(sb); serial.setPort(port); } QString RobotController::getInfoAboutSerial() { QString info; info += tr("Port: %1\n").arg(serial.portName()); info += tr("Bodów: %1\n").arg(QString::number(serial.baudRate())); QSerialPort::DataBits db = serial.dataBits(); info += tr("Bity danych: "); switch(db) { case QSerialPort::Data7 : info += "8"; break; case QSerialPort::Data8 : info += "7"; break; default: info += "Unknown"; break; } info += "\n"; QSerialPort::FlowControl fc = serial.flowControl(); info += tr("Kontrola przepływu: "); switch(fc) { case QSerialPort::NoFlowControl : info += "None"; break; case QSerialPort::HardwareControl : info += "RTS/CTS"; break; case QSerialPort::SoftwareControl : info += "XON/XOFF"; break; default: info += "Unknown"; break; } info += "\n"; QSerialPort::Parity p = serial.parity(); info += tr("Parzystość: "); switch(p) { case QSerialPort::NoParity : info += "None"; break; case QSerialPort::EvenParity : info += "Even"; break; case QSerialPort::OddParity : info += "Odd"; break; case QSerialPort::SpaceParity : info += "Space"; break; case QSerialPort::MarkParity : info += "Mark"; break; default: info += "Unknown"; break; } info += "\n"; QSerialPort::StopBits sb = serial.stopBits(); info += tr("Bity stopu: "); switch(sb) { case QSerialPort::OneStop : info += "1"; break; case QSerialPort::TwoStop : info += "2"; break; default: info += "Unknown"; break; } info += "\n"; return info; } void RobotController::initializeSerial() { serial.setBaudRate(9600,QSerialPort::AllDirections); serial.setDataBits(QSerialPort::Data8); serial.setFlowControl(QSerialPort::NoFlowControl); serial.setParity(QSerialPort::NoParity); QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts(); if(ports.size()) serial.setPort(ports.at(0)); else serial.setPortName(""); serial.setStopBits(QSerialPort::OneStop); } void RobotController::clearSerialBuffers() { serial.clear(); serial.clearError(); } QString RobotController::readMessageFromSerial(unsigned timeMS) { unsigned loopCount = (timeMS/g_intervalMSwaitingForMsg)+1; loopCount *= 3; QString msg = serial.readAll(); bool msgFull = false; for(int i=0; i<loopCount && !msgFull; i++) { while(serial.waitForReadyRead(g_intervalMSwaitingForMsg)) { msg.append(serial.readAll()); if(msg.contains("\x0A") && msg.size()>= g_minLengthOfMessage) msgFull = true; } } return msg; }
e250164584d16d6b66863da40761645cd4b6b071
10bac563fc7e174d8f7c79c8777e4eb8460bc49e
/sense/bumblebee_driver_t.h
97645e9128ea15b3123b083eb8a769693fe3aee0
[]
no_license
chenbk85/alcordev
41154355a837ebd15db02ecaeaca6726e722892a
bdb9d0928c80315d24299000ca6d8c492808f1d5
refs/heads/master
2021-01-10T13:36:29.338077
2008-10-22T15:57:50
2008-10-22T15:57:50
44,953,286
0
1
null
null
null
null
UTF-8
C++
false
false
3,859
h
bumblebee_driver_t.h
#ifndef bumblebee_driver_t_H_INCLUDED #define bumblebee_driver_t_H_INCLUDED //BumblebeeB.ini //[config] //name=aristarco //unitnumber=5160167 //digiclopsini=config\digiclopsB.ini //triclopsini=config\triclopsB.cal //framerate=50;valori 12 25 50 100 //--------------------------------------------------------------------------- #include "alcor/sense/i_device_driver.h" //--------------------------------------------------------------------------- #include "alcor/core/core.h" //--------------------------------------------------------------------------- #include <boost/shared_ptr.hpp> //--------------------------------------------------------------------------- namespace all{ namespace sense { ///A Point Grey Bumblebee digital camera. class bumblebee_driver_t; class bumblebee_parameters_t; typedef boost::shared_ptr<all::sense::bumblebee_driver_t> bumblebee_sptr; //--------------------------------------------------------------------------- typedef boost::shared_ptr<all::sense::bumblebee_driver_t> bumblebee_driver_ptr_t; ///backward compatibility typedef boost::shared_ptr<all::sense::bumblebee_driver_t> bumblebee_driver_ptr; //--------------------------------------------------------------------------- namespace detail{ class bumblebee_driver_impl; } } } //--------------------------------------------------------------------------- ///Structure for defining the open() parameters of the camera. class all::sense::bumblebee_parameters_t { public: ///Constructor. Add here the parameters for the open(). bumblebee_parameters_t(): _unit_number(0) { // parameters initialization default? _unit_number = 0; } ///Parameters unsigned int _unit_number; // int _framerate; /// std::string _digiclopsini; /// std::string _triclopsini; /// std::string _name; /// bool load(const std::string &); }; //--------------------------------------------------------------------------- class all::sense::bumblebee_driver_t : public i_device_driver { public: ///Constructor. bumblebee_driver_t(); ///DTOR ~bumblebee_driver_t(); /// static boost::shared_ptr<all::sense::bumblebee_driver_t> create() { boost::shared_ptr<all::sense::bumblebee_driver_t> px(new all::sense::bumblebee_driver_t); // use px as 'this_' return px; } /// //boost::mutex mutex; ///Inherited bool open(const std::string &); ///Inherited bool close(); ///Grabs Stereo Color Image. bool grab(); /// long serialnum () const; /// size_t nrows() const; /// size_t ncols() const; /// float focal() const; /// float center_row() const; /// float center_col() const; /// std::string name() const; /// void set_zbound(float); ///Set the output format for the depth map void set_interleaved(); ///Set the output format for the depth map (default) void set_planar(); /// size_t color_buffer_size() const; /// size_t depth_buffer_size() const; /// size_t valid_3d_points() const; /// all::core::uint8_sarr get_color_buffer(core::left_img_t , bool shared = true); /// all::core::uint8_sarr get_color_buffer(core::right_img_t , bool shared = true); /// all::core::single_sarr get_depth_buffer( bool shared = true); /// //all::core::single_sarr get_depth_buffer(core::interleaved_t, bool shared = true); ///// //all::core::single_sarr get_depth_buffer_sandbox_(bool shared = true); protected: ///PIMPL Idiom boost::shared_ptr<detail::bumblebee_driver_impl> impl; bumblebee_parameters_t params; size_t color_buffer_size_; size_t depth_buffer_size_; }; //--------------------------------------------------------------------------- #endif //bumblebee_t_H_INCLUDED
5023e8ad83efe08dffad668f2bb8d2a11442c5cc
f20e965e19b749e84281cb35baea6787f815f777
/LHCb/Kernel/LHCbMath/src/Spline.cpp
529737bf269d710d011e46d17a2decbf1ff76b85
[]
no_license
marromlam/lhcb-software
f677abc9c6a27aa82a9b68c062eab587e6883906
f3a80ecab090d9ec1b33e12b987d3d743884dc24
refs/heads/master
2020-12-23T15:26:01.606128
2016-04-08T15:48:59
2016-04-08T15:48:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
35,937
cpp
Spline.cpp
// $Id$ // =========================================================================== // Include files // =========================================================================== // STD & STL // =========================================================================== #include <algorithm> // =========================================================================== // GaudiGSL // =========================================================================== #include "GaudiMath/Splines.h" // =========================================================================== // local // =========================================================================== #include "LHCbMath/LHCbMath.h" #include "LHCbMath/Spline.h" // =========================================================================== // Boost // =========================================================================== #include "boost/tuple/tuple.hpp" #include "boost/multi_array.hpp" #include "boost/type_traits/is_same.hpp" #include "boost/static_assert.hpp" // =========================================================================== // ROOT // =========================================================================== #include "TAxis.h" #include "TH1.h" #include "TH2.h" #include "TGraph.h" #include "TGraphErrors.h" // =========================================================================== /** @file * Implementation file for class Gaudi::Math::Spline * @see Gaudi::Math::Spline * * @date 2013-03-14 * @author Vanya Belyaev Ivan.Belyaev@itep.ru * * $Revision$ * Last modification $Date$ * by $author$ */ // ============================================================================ namespace { /// equality criteria for doubles LHCb::Math::Equal_To<double> s_equal ; // equality criteria for doubles // ========================================================================== // check the match of basic types /// the type from GaudiGSL typedef Genfun::GaudiMathImplementation::SplineBase::Data2D _DATA_1_ ; /// locally defined type typedef Gaudi::Math::Splines::DATA _DATA_2_ ; typedef boost::is_same<_DATA_1_,_DATA_2_> _CHECK_ ; BOOST_STATIC_ASSERT( _CHECK_::value ) ; // ========================================================================== } // =========================================================================== // get the values from the histogram // =========================================================================== Gaudi::Math::Splines::DATA Gaudi::Math::Splines::getValues ( const TH1& histo ) { // const TAxis* axis = histo.GetXaxis() ; const unsigned int nbins = axis->GetNbins() ; // DATA result ; result.reserve ( nbins ) ; // for ( unsigned int i = 1 ; i <= nbins ; ++i ) { const double x = axis->GetBinCenter ( i ) ; const double y = histo.GetBinContent ( i ) ; result.push_back ( std::make_pair ( x , y ) ) ; } // return result ; } // =========================================================================== // get the errors from the histogram // =========================================================================== Gaudi::Math::Splines::DATA Gaudi::Math::Splines::getErrors ( const TH1& histo ) { // const TAxis* axis = histo.GetXaxis() ; const unsigned int nbins = axis->GetNbins() ; // DATA result ; result.reserve ( nbins ) ; // for ( unsigned int i = 1 ; i <= nbins ; ++i ) { const double x = axis->GetBinCenter ( i ) ; const double ey = histo.GetBinError ( i ) ; result.push_back ( std::make_pair ( x , ey ) ) ; } // return result ; } // =========================================================================== // get the data from the histogram // =========================================================================== Gaudi::Math::Splines::DATAERR Gaudi::Math::Splines::getData ( const TH1& histo ) { const TAxis* axis = histo.GetXaxis() ; const unsigned int nbins = axis->GetNbins() ; // DATAERR result ; result.reserve ( nbins ) ; // for ( unsigned int i = 1 ; i <= nbins ; ++i ) { const double x = axis->GetBinCenter ( i ) ; const double y = histo.GetBinContent ( i ) ; const double ey = histo.GetBinError ( i ) ; result.push_back ( std::make_pair ( x , Gaudi::Math::ValueWithError ( y , ey * ey) ) ) ; } // return result ; } // =========================================================================== // get the values from data vector // =========================================================================== Gaudi::Math::Splines::DATA Gaudi::Math::Splines::getValues ( const Gaudi::Math::Splines::DATAERR& data ) { DATA result ; result.reserve ( data.size() ) ; // for ( DATAERR::const_iterator i = data.begin() ; data.end() != i ; ++i ) { const double x = i->first ; const double y = i->second.value() ; result.push_back ( std::make_pair ( x , y ) ) ; } // return result ; } // =========================================================================== // get the errors from data vector // =========================================================================== Gaudi::Math::Splines::DATA Gaudi::Math::Splines::getErrors ( const Gaudi::Math::Splines::DATAERR& data ) { DATA result ; result.reserve ( data.size() ) ; // for ( DATAERR::const_iterator i = data.begin() ; data.end() != i ; ++i ) { const double x = i->first ; const double ey = i->second.error() ; result.push_back ( std::make_pair ( x , ey ) ) ; } // return result ; } // =========================================================================== // get the value from graph // =========================================================================== Gaudi::Math::Splines::DATA Gaudi::Math::Splines::getValues ( const TGraph& graph ) { // const unsigned int npoints = graph.GetN() ; // DATA result ; result.reserve ( npoints ) ; // for ( unsigned int i = 0 ; i < npoints ; ++i ) { double x = 0 ; double y = 0 ; graph.GetPoint ( i , x , y ) ; // result.push_back ( std::make_pair ( x , y ) ) ; } // return result ; } // =========================================================================== // get the errors from graph // =========================================================================== Gaudi::Math::Splines::DATA Gaudi::Math::Splines::getErrors ( const TGraphErrors& graph ) { // const unsigned int npoints = graph.GetN() ; // DATA result ; result.reserve ( npoints ) ; // for ( unsigned int i = 0 ; i < npoints ; ++i ) { double x = 0 ; double y = 0 ; graph.GetPoint ( i , x , y ) ; const double ey = graph.GetErrorY ( i ) ; // result.push_back ( std::make_pair ( x , ey ) ) ; } // return result ; } // =========================================================================== // get the data from graph // =========================================================================== Gaudi::Math::Splines::DATAERR Gaudi::Math::Splines::getData ( const TGraphErrors& graph ) { const unsigned int npoints = graph.GetN() ; // DATAERR result ; result.reserve ( npoints ) ; // for ( unsigned int i = 0 ; i < npoints ; ++i ) { double x = 0 ; double y = 0 ; graph.GetPoint ( i , x , y ) ; const double ey = graph.GetErrorY ( i ) ; // result.push_back ( std::make_pair ( x , Gaudi::Math::ValueWithError ( y , ey * ey) ) ) ; } // return result ; } // =========================================================================== /* simple lagrange interpolation * @attention it can be CPU-inefficient! * @author Vanya BELYAEV Ivan.Belyaev@itep.ru * @date 2013-03-15 */ // =========================================================================== double Gaudi::Math::Splines::interpolate ( const Gaudi::Math::Splines::DATA& data , const double x ) { // double value = 0 ; // for ( DATA::const_iterator i = data.begin() ; data.end() != i ; ++i ) { // const double xi = i->first ; const double yi = i->second ; // double L = 1 ; for ( DATA::const_iterator j = data.begin() ; data.end() != j ; ++j ) { // if ( i == j ) { continue ; } // const double xj = j->first ; // L *= ( x - xj ) / ( xi - xj ) ; } // value += yi * L ; } // return value ; } // =========================================================================== /* simple lagrange interpolation * @attention it can be CPU-inefficient! * @author Vanya BELYAEV Ivan.Belyaev@itep.ru * @date 2013-03-15 */ // =========================================================================== Gaudi::Math::ValueWithError Gaudi::Math::Splines::interpolate ( const Gaudi::Math::Splines::DATAERR& data , const double x ) { // double value = 0 ; double error = 0 ; // for ( DATAERR::const_iterator i = data.begin() ; data.end() != i ; ++i ) { // const double xi = i->first ; const Gaudi::Math::ValueWithError& y = i->second ; // double L = 1 ; for ( DATAERR::const_iterator j = data.begin() ; data.end() != j ; ++j ) { // if ( i == j ) { continue ; } // const double xj = j->first ; // L *= ( x - xj ) / ( xi - xj ) ; } // value += y.value() * L ; error += y.error() * L ; } // return Gaudi::Math::ValueWithError( value , error * error ) ; } // =========================================================================== // =========================================================================== // simple spline // =========================================================================== // =========================================================================== // destructor // =========================================================================== Gaudi::Math::Spline::~Spline(){} // =========================================================================== // get the value // =========================================================================== double Gaudi::Math::Spline::operator() ( const double x ) const { // scale and shift the variable const double y = x * m_scale + m_shift ; // check the limits if ( m_null && ( y < m_xmin || y > m_xmax ) ) { return 0 ; } // return m_spline->eval ( y ) ; } // =========================================================================== // get the derivative // =========================================================================== double Gaudi::Math::Spline::derivative ( const double x ) const { // scale and shift the variable const double y = x * m_scale + m_shift ; // check the limits if ( m_null && ( y < m_xmin || y > m_xmax ) ) { return 0 ; } // return m_spline->deriv ( y ) / m_scale ; } // =========================================================================== // get the second derivative // =========================================================================== double Gaudi::Math::Spline::derivative2 ( const double x ) const { // scale and shift the variable const double y = x * m_scale + m_shift ; // check the limits if ( m_null && ( y < m_xmin || y > m_xmax ) ) { return 0 ; } // return m_spline->deriv2 ( y ) / m_scale ; } // =========================================================================== // get the integral // =========================================================================== double Gaudi::Math::Spline::integral ( const double xmin , const double xmax ) const { // if ( xmin > xmax ) { return - integral ( xmax ,xmin ) ; } else if ( s_equal ( xmin , xmax ) ) { return 0 ; } // // scale and shift the variable double ymin = xmin * m_scale + m_shift ; double ymax = xmax * m_scale + m_shift ; // if ( s_equal ( ymin , ymax ) ) { return 0 ; } // RETURN // if ( m_null ) { ymin = std::max ( ymin , m_xmin ) ; ymax = std::min ( ymax , m_xmax ) ; } // return m_spline->integ ( ymin , ymax ) * m_scale ; } // =========================================================================== // get the integral // =========================================================================== double Gaudi::Math::Spline::integral () const { return m_spline->integ ( m_xmin , m_xmax ) * m_scale ; } // ====================================================================== /* Standard constructor * @param data data to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ====================================================================== Gaudi::Math::Spline::Spline ( const Gaudi::Math::Spline::DATA& data , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,double>() , m_null ( null ) , m_scale ( scale ) , m_shift ( shift ) , m_xmin ( 0 ) , m_xmax ( 0 ) , m_spline ( ) { // Gaudi::Math::Splines::DATA _data ( data ) ; // std::sort ( _data.begin() , _data.end() ) ; // m_spline.reset ( new SPLINE ( _data , type ) ) ; // m_xmin = data.front ().first ; m_xmax = data.back ().first ; // } // ====================================================================== /* Standard constructor * @param data data to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ====================================================================== Gaudi::Math::Spline::Spline ( const Gaudi::Math::Spline::DATAERR& data , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,double>() , m_null ( null ) , m_scale ( scale ) , m_shift ( shift ) , m_xmin ( 0 ) , m_xmax ( 0 ) , m_spline ( ) { // Gaudi::Math::Splines::DATA _data ( Gaudi::Math::Splines::getValues ( data ) ) ; // std::sort ( _data.begin() , _data.end() ) ; // m_spline.reset ( new SPLINE ( _data , type ) ) ; // m_xmin = _data.front ().first ; m_xmax = _data.back ().first ; // } // =============================================================================== /* Standard constructor * @param histo the histogram to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ============================================================================ Gaudi::Math::Spline::Spline ( const TH1& histo , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,double>() , m_null ( null ) , m_scale ( scale ) , m_shift ( shift ) , m_xmin ( histo.GetXaxis() -> GetXmin () ) , m_xmax ( histo.GetXaxis() -> GetXmax () ) , m_spline ( ) { // SPLINE::Data2D data = Gaudi::Math::Splines::getValues ( histo ) ; // m_spline.reset ( new SPLINE ( data , type ) ) ; // } // ============================================================================ /* Standard constructor * @param graph the graph to be interpolated * @param type interpolation type * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ============================================================================ Gaudi::Math::Spline::Spline ( const TGraph& graph , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,double>() , m_null ( null ) , m_scale ( scale ) , m_shift ( shift ) , m_xmin ( 0 ) , m_xmax ( 0 ) , m_spline ( ) { // SPLINE::Data2D data = Gaudi::Math::Splines::getValues ( graph ) ; // m_spline.reset ( new SPLINE ( data , type ) ) ; // const unsigned int np = graph.GetN() ; // double x = 0 ; double y = 0 ; // graph.GetPoint ( 0 , x , y ) ; m_xmin = x ; graph.GetPoint ( np - 1 , x , y ) ; m_xmax = x ; // } // =========================================================================== // =========================================================================== // Spline with errors // =========================================================================== // =========================================================================== // destructor // =========================================================================== Gaudi::Math::SplineErrors::~SplineErrors () {} // =========================================================================== /* Standard constructor * @param data data to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // =========================================================================== Gaudi::Math::SplineErrors::SplineErrors ( const Gaudi::Math::SplineErrors::DATAERR& data , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,Gaudi::Math::ValueWithError> () , m_spline ( Gaudi::Math::Splines::getValues ( data ) , type , null , scale , shift ) , m_errors ( Gaudi::Math::Splines::getErrors ( data ) , type , null , scale , shift ) {} // ====================================================================== /* Standard constructor * @param histo the histogram to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ====================================================================== Gaudi::Math::SplineErrors::SplineErrors ( const TH1& histo , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,Gaudi::Math::ValueWithError> () , m_spline ( histo , type , null , scale , shift ) , m_errors ( Gaudi::Math::Splines::getErrors ( histo ) , type , false , scale , shift ) {} // ====================================================================== /* Standard constructor * @param histo the histogram to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ====================================================================== Gaudi::Math::SplineErrors::SplineErrors ( const TGraphErrors& graph , const GaudiMath::Interpolation::Type& type , const bool null , const double scale , const double shift ) : std::unary_function<double,Gaudi::Math::ValueWithError> () , m_spline ( graph , type , null , scale , shift ) , m_errors ( Gaudi::Math::Splines::getErrors ( graph ) , type , false , scale , shift ) {} // =========================================================================== // get the value // =========================================================================== Gaudi::Math::ValueWithError Gaudi::Math::SplineErrors::operator() ( const double x ) const { const double v = m_spline ( x ) ; const double e = m_errors ( x ) ; return Gaudi::Math::ValueWithError ( v , e * e ) ; } // ============================================================================== namespace { typedef Gaudi::Math::ValueWithError VE ; // ============================================================================ inline VE bin ( const TH2& histo , const int ibinx , const int ibiny ) { const double v = histo.GetBinContent ( ibinx , ibiny ) ; const double e = histo.GetBinError ( ibinx , ibiny ) ; return VE ( v , e * e ) ; } // ========================================================================= // interpolate 2D-histo along y-axis template <class AXIS> VE lagrange_y ( const TH2& histo , const unsigned int ix , // fixed const unsigned int y0 , // first y-bin const unsigned int ny , // number of bins in y const AXIS& yaxis , const double y ) { // double value = 0 ; double error = 0 ; // for ( unsigned int iy = 0 ; iy < ny ; ++iy ) { // const double yi = yaxis [iy] ; const VE ve = bin ( histo , ix , iy + y0 ) ; // double L = 1 ; for ( unsigned int jy = 0 ; jy < ny ; ++jy ) { // if ( iy == jy ) { continue ; } // const double yj = yaxis[jy] ; // L *= ( y - yj ) / ( yi - yj ) ; } // value += ve.value () * L ; error += ve.error () * L ; } // return VE ( value , error * error ) ; } // ========================================================================== // interpolate 2D-histo along x-axis template <class AXIS> VE lagrange_x ( const TH2& histo , const unsigned int x0 , // first x-bin const unsigned int nx , // number of x-bins const unsigned int iy , // fixed const AXIS& xaxis , const double x ) { // double value = 0 ; double error = 0 ; // for ( unsigned int ix = 0 ; ix < nx ; ++ix ) { // const double xi = xaxis [ix] ; const VE ve = bin ( histo , ix + x0 , iy ) ; // double L = 1 ; for ( unsigned int jx = 0 ; jx < nx ; ++jx ) { // if ( ix == jx ) { continue ; } // const double xj = xaxis[jx] ; // L *= ( x - xj ) / ( xi - xj ) ; } // value += ve.value () * L ; error += ve.error () * L ; } // return VE ( value , error * error ) ; } } // ====================================================================== // destructor // ====================================================================== Gaudi::Math::Interp2D::~Interp2D () {} // ============================================================================ /* Standard constructor * @param data data to be interpolated * @param type interpolation type * @param null set to null outside the range? * @param scale the scale for the input variable * @param shift the bias for the input variable */ // ============================================================================ Gaudi::Math::Interp2D::Interp2D ( const TH2& histo , const Type& typex , const Type& typey , const bool null , const double scalex , const double scaley , const double shiftx , const double shifty ) : std::binary_function<double,double,Gaudi::Math::ValueWithError> () // , m_histo ( &histo ) , m_null ( null ) // , m_typex ( typex ) , m_typey ( typey ) , m_scalex ( scalex ) , m_scaley ( scaley ) , m_shiftx ( shiftx ) , m_shifty ( shifty ) { const TAxis* xaxis = histo.GetXaxis() ; const TAxis* yaxis = histo.GetYaxis() ; // const int xbins = xaxis->GetNbins() ; const int ybins = yaxis->GetNbins() ; // if ( m_typex > Last ) { m_typex = Last ; } if ( m_typey > Last ) { m_typey = Last ; } if ( m_typex >= xbins ) { m_typex = Type ( xbins - 1 ) ; } if ( m_typey >= ybins ) { m_typey = Type ( ybins - 1 ) ; } if ( m_typex > Last ) { m_typex = Last ; } if ( m_typey > Last ) { m_typey = Last ; } if ( m_typex < Nearest ) { m_typex = Nearest ; } if ( m_typey < Nearest ) { m_typey = Nearest ; } // } // ============================================================================ // get the value // ============================================================================ Gaudi::Math::ValueWithError Gaudi::Math::Interp2D::Interp2D::operator() ( const double x , const double y ) const { // const double zx = x * m_scalex + m_shiftx ; const double zy = y * m_scaley + m_shifty ; // const TAxis* xaxis = m_histo -> GetXaxis () ; const TAxis* yaxis = m_histo -> GetYaxis() ; // const int xbins = xaxis -> GetNbins () ; const int ybins = yaxis -> GetNbins () ; // const int xbin = xaxis -> FindFixBin ( zx ) ; const int ybin = yaxis -> FindFixBin ( zy ) ; // if ( m_null ) { if ( 0 >= xbin || xbin > xbins ) { return 0 ; } // RETURN if ( 0 >= ybin || ybin > ybins ) { return 0 ; } // RETURN } // if ( Nearest == m_typex && Nearest == m_typey ) { return bin ( *m_histo , xbin , ybin ) ; } // RETURN // // find the proper data range & fill the store // const double xc = xaxis -> GetBinCenter ( xbin ) ; const double yc = yaxis -> GetBinCenter ( ybin ) ; // int iStartX = xbin ; int iStartY = ybin ; if ( 1 == m_typex % 2 ) { const int leftx = zx < xc ? 1 : -1 ; iStartX -= ( m_typex + leftx ) / 2 ; } else { iStartX -= m_typex / 2 ; } // if ( 1 == m_typey % 2 ) { const int lefty = zy < yc ? 1 : -1 ; iStartY -= ( m_typey + lefty ) / 2 ; } else { iStartY -= m_typey / 2 ; } // iStartX = std::max ( 1 , iStartX ) ; iStartY = std::max ( 1 , iStartY ) ; // iStartX = std::min ( xbins - m_typex , iStartX ) ; iStartY = std::min ( ybins - m_typey , iStartY ) ; // typedef Gaudi::Math::Splines::DATAERR STORE ; typedef std::vector<double> AXIS ; // STORE y_int ( m_typex + 1 ) ; // intepolated Y-values for X-columns AXIS y_axis ( m_typey + 1 ) ; // // fill Y-axis for ( int iy = 0 ; iy <= m_typey ; ++iy ) { y_axis [iy] = yaxis->GetBinCenter ( iy + iStartY ) ; } // // loop for column and perform 1D-interpolation for each column: for ( int ix = 0 ; ix <= m_typex ; ++ix ) { // const double xi = xaxis->GetBinCenter ( ix + iStartX ) ; // // for each column find the interpolated value of "y" const VE ya = lagrange_y ( *m_histo , iStartX + ix , iStartY , m_typey + 1 , y_axis , zy ) ; // fill the local store y_int [ix] = std::make_pair ( xi , ya ) ; } // // finally interpolate X return Gaudi::Math::Splines::interpolate ( y_int , zx ) ; } // =========================================================================== // =========================================================================== // few oversimplified cases // =========================================================================== /* constructor from two points * @param x1 the first abscissa * @param x2 the second abscissa * @param y1 function value at x1 * @param y2 function value at x2 */ // =========================================================================== Gaudi::Math::Linear::Linear ( const double x1 , const double y1 , const double x2 , const double y2 ) : std::unary_function<double,double> () , m_a ( ( y2 - y1 ) / ( x2 - x1 ) ) , m_b ( ( y1 * x2 - y2 * x1 ) / ( x2 - x1 ) ) {} // =========================================================================== /// destructor // =========================================================================== Gaudi::Math::Linear::~Linear(){} // =========================================================================== // =========================================================================== /* constructor from two points * @param x1 the first abscissa * @param y1 function value at x1 * @param x2 the second abscissa * @param y2 function value at x2 */ // =========================================================================== Gaudi::Math::LinearErr::LinearErr ( const double x1 , const Gaudi::Math::ValueWithError& y1 , const double x2 , const Gaudi::Math::ValueWithError& y2 ) : std::unary_function<double,Gaudi::Math::ValueWithError>() , m_x1 ( x1 ) , m_x2 ( x2 ) , m_y1 ( y1 ) , m_y2 ( y2 ) {} // =========================================================================== /// destructor // =========================================================================== Gaudi::Math::LinearErr::~LinearErr(){} // ============================================================================ // y = a*x + b // ============================================================================ double Gaudi::Math::LinearErr::a () const { return ( m_y2.value() - m_y1.value() ) / ( m_x2 - m_x1 ) ; } // ============================================================================ // y = a*x + b // ============================================================================ double Gaudi::Math::LinearErr::b () const { return ( m_y1.value() * m_x2 - m_y2.value() * m_x1 ) / ( m_x2 - m_x1 ) ; } // ============================================================================ // get the value: // ============================================================================ Gaudi::Math::ValueWithError Gaudi::Math::LinearErr::operator() ( const double x ) const { return ( m_y2 * ( x - m_x1 ) - m_y1 * ( x - m_x2 ) ) / ( m_x2 - m_x1 ) ; } // ============================================================================ // ============================================================================ /* constructor from three points * @param x1 the first abscissa * @param y1 function value at x1 * @param x2 the second abscissa * @param y2 function value at x2 * @param x3 the third abscissa * @param y3 function value at x3 */ // ============================================================================ Gaudi::Math::Parabola::Parabola ( const double x1 , const double y1 , const double x2 , const double y2 , const double x3 , const double y3 ) : std::unary_function<double,double>() , m_a ( 0 ) , m_b ( 0 ) , m_c ( 0 ) { // const double d12 = x1 - x2 ; const double d23 = x2 - x3 ; const double d13 = x1 - x3 ; // const double d1 = 1.0 / ( d12 * d13 ) ; const double d2 = 1.0 / ( d12 * d23 ) ; const double d3 = 1.0 / ( d13 * d23 ) ; m_a = y1 * d1 ; m_a -= y2 * d2 ; m_a += y3 * d3 ; // m_b = - y1 * ( x2 + x3 ) * d1 ; m_b -= - y2 * ( x1 + x3 ) * d2 ; m_b += - y3 * ( x1 + x2 ) * d3 ; // m_c = y1 * x2 * x3 * d1 ; m_c -= y2 * x1 * x3 * d2 ; m_c += y3 * x1 * x2 * d3 ; // } // ============================================================================ // destructor // ============================================================================ Gaudi::Math::Parabola::~Parabola(){} // ============================================================================ // ============================================================================ /* constructor from three points * @param x1 the first abscissa * @param y1 function value at x1 * @param x2 the second abscissa * @param y2 function value at x2 * @param x3 the third abscissa * @param y3 function value at x3 */ // ============================================================================ Gaudi::Math::ParabolaErr::ParabolaErr ( const double x1 , const Gaudi::Math::ValueWithError& y1 , const double x2 , const Gaudi::Math::ValueWithError& y2 , const double x3 , const Gaudi::Math::ValueWithError& y3 ) : std::unary_function<double,Gaudi::Math::ValueWithError> () , m_x1 ( x1 ) , m_x2 ( x2 ) , m_x3 ( x3 ) , m_y1 ( y1 ) , m_y2 ( y2 ) , m_y3 ( y3 ) , m_d1 () , m_d2 () , m_d3 () { const double d12 = x1 - x2 ; const double d23 = x2 - x3 ; const double d13 = x1 - x3 ; // m_d1 = 1.0 / ( d12 * d13 ) ; m_d2 = 1.0 / ( d12 * d23 ) ; m_d3 = 1.0 / ( d13 * d23 ) ; // } // ============================================================================ // destructor // ============================================================================ Gaudi::Math::ParabolaErr::~ParabolaErr(){} // ============================================================================ // y = a*x^2 + b*x + c // ============================================================================ double Gaudi::Math::ParabolaErr::a () const { double _a = m_y1.value () * m_d1 ; _a -= m_y2.value () * m_d2 ; _a += m_y3.value () * m_d3 ; return _a ; } // ============================================================================ // y = a*x^2 + b*x + c // ============================================================================ double Gaudi::Math::ParabolaErr::b () const { double _b = - m_y1.value () * ( ( m_x2 + m_x3 ) * m_d1 ) ; _b -= - m_y2.value () * ( ( m_x1 + m_x3 ) * m_d2 ) ; _b += - m_y3.value () * ( ( m_x1 + m_x2 ) * m_d3 ) ; return _b ; } // ============================================================================ // y = a*x^2 + b*x + c // ============================================================================ double Gaudi::Math::ParabolaErr::c () const { double _c = m_y1.value () * ( m_x2 * m_x3 * m_d1 ) ; _c -= m_y2.value () * ( m_x1 * m_x3 * m_d2 ) ; _c += m_y3.value () * ( m_x1 * m_x2 * m_d3 ) ; return _c ; } // ============================================================================ // get the value: // ============================================================================ Gaudi::Math::ValueWithError Gaudi::Math::ParabolaErr::operator() ( const double x ) const { // const double d1 = x - m_x1 ; const double d2 = x - m_x2 ; const double d3 = x - m_x3 ; // Gaudi::Math::ValueWithError result ; result = m_y1 * ( d2 * d3 * m_d1 ) ; result -= m_y2 * ( d1 * d3 * m_d2 ) ; result += m_y3 * ( d1 * d2 * m_d3 ) ; // return result ; } // ============================================================================ // =========================================================================== // The END // ===========================================================================
2fecbcfc56cb82d07599823690dcfaea3b758bd3
b7c9b2125d4862e7e77de884c8051540fafff441
/VideoEditor/VideoTrack.cpp
6e97e0ddccd15f8626b5ebed3b479ccc97f8c687
[]
no_license
zeneksashy/VideoEditor
2b6740dc7c1d97cb93e57b13189d0954c55cd8c3
64663fe663adc9eff26754e3132dc16c099071fc
refs/heads/master
2020-03-27T15:42:21.329089
2018-10-31T13:37:41
2018-10-31T13:37:41
146,733,947
3
0
null
null
null
null
UTF-8
C++
false
false
2,001
cpp
VideoTrack.cpp
#include "VideoTrack.h" VideoTrack::VideoTrack(QWidget *parent) : MediaTrack(parent) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setFixedHeight(32); setMinimumWidth(120); isSelected = false; } VideoTrack::~VideoTrack() { capture.release(); } void VideoTrack::paintEvent(QPaintEvent*) { QPainter painter(this); painter.fillRect(rect(), Qt::gray); QSize size(rect().size()); size.setWidth(size.height()*1.7); painter.drawImage(QPoint(0, 0), img[0].scaled(size)); painter.drawImage(QPoint(templenght /2, 0), img[1].scaled(size)); painter.drawImage(QPoint(templenght -size.width(), 0), img[2].scaled(size)); if (isSelected) { QPen pen(QColor::fromRgb(126, 253, 61)); painter.setPen(pen); painter.drawRoundedRect(0, 0, width() - 1, height() - 1, 0, 0); } } void VideoTrack::Initliaize(QString filename) { setPlayer(filename, MediaType::Video); capture.open(filename.toStdString()); if (capture.isOpened()) { framecount= (long)capture.get(CV_CAP_PROP_FRAME_COUNT); img[0] = loadFrame(100); img[1] = loadFrame(framecount / 2); img[2] = loadFrame(framecount - 1); framerate = capture.get(CV_CAP_PROP_FPS); lenght = framecount/framerate; templenght = lenght; setFixedWidth(lenght); } } QImage VideoTrack::loadFrame(long pos) { capture.set(CV_CAP_PROP_POS_MSEC, pos); QImage img; if (capture.read(frame)) { if (frame.channels() == 3) { cv::cvtColor(frame, RGBframe, CV_BGR2RGB); img = QImage((const unsigned char*)(RGBframe.data), RGBframe.cols, RGBframe.rows, QImage::Format_RGB888); } else { img = QImage((const unsigned char*)(frame.data), frame.cols, frame.rows, QImage::Format_Indexed8); } } return img; } void VideoTrack::drawOutline() { isSelected = true; repaint(); } void VideoTrack::ResizeFrame(int p) { try { templenght = lenght * p; setFixedWidth(templenght); repaint(); } catch (const std::exception& e ) { e.what(); } } void VideoTrack::deleteOutline() { isSelected = false; repaint(); }
0ff32e222fa452f937c720b4cf344bf022164ec4
601bc9d53c5f39cbf16b08bf26019fbc4f9ae1ac
/SwitchBox/03 Mega Code/Single-Trigger-Timer/Single-Trigger-Timer.ino
82046b71216c78d398daffde4e22ca76e6262382
[]
no_license
MitchellStride/DataCapture
714d4d0b0945996c4c40454f43cb3e92cd69761c
1ed85d98b1bbfbccb91b4ca8a27de656031c0c95
refs/heads/master
2021-09-07T11:04:16.559887
2018-02-22T01:31:02
2018-02-22T01:31:02
118,975,115
0
0
null
null
null
null
UTF-8
C++
false
false
6,552
ino
Single-Trigger-Timer.ino
/*Lauch Sequence - Toggle 1 > Pot 1 > Button 1 > Toggle 2 > Button 2 >Timer Begin Code Update List - Configure code for Joysticks, Encoder, Sd card - test seven seg - test code reiliability - add lcd instructions - make it only run once - take video once parts come in, use transistor and taser for launch. */ #include "Adafruit_LiquidCrystal.h" #include "SevSeg.h" //Piezo Buzzer #define beeper 12 //LEDs #define redLED 34 #define yellowLED 35 #define greenLED 36 //Controls Switches #define pushButton1 37 #define pushButton2 38 #define missleToggle1 39 #define missleToggle2 40 //#define rocker1 7 //#define rocker2 8 //#define rocker3 9 //Dip Switches /*#define Dip1 3 #define Dip2 4 #define Dip3 5 #define Dip4 6 #define Dip5 7 #define Dip6 8 #define Dip7 9 #define Dip8 10*/ //Joysticks //Poteniometers #define pot1 A0 //#define pot2 A1 //Encoder //microSD //I2C LCD Adafruit_LiquidCrystal lcd(0); byte StraightH[] = {0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x04}; byte TLCorner[] = {0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04}; byte TRCorner[] = {0x00, 0x00, 0x00, 0x1C, 0x04, 0x04, 0x04, 0x04}; byte BLCorner[] = {0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00}; byte BRCorner[] = {0x04, 0x04, 0x04, 0x1C, 0x00, 0x00, 0x00, 0x00}; byte progressFull[] = {0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}; byte progressEmpty[] = {0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; byte progressEnd[] = {0x1F, 0x01, 0x01, 0x01F, 0x01, 0x01, 0x01, 0x01}; /*//Init LCD without i2c #define LCD-RS 22 #define LCD-EN 23 #define LCD-D4 24 #define LCD-D5 25 #define LCD-D6 26 #define LCD-D7 27 LiquidCrystal lcd(LCD-RS, LCD-EN, LCD-D4, LCD-D5, LCD-D6, LCD-D7);*/ //Init Seven Seg byte numDigits = 4; byte digitPins[] = {22, 23, 24, 25}; byte segmentPins[] = {26, 27, 28, 29, 30, 31, 32, 33}; SevSeg TimerSeg; int countDown; unsigned long last_milliSeconds; void setup() { //LEDs pinMode(redLED, OUTPUT); pinMode(yellowLED, OUTPUT); pinMode(greenLED, OUTPUT); //Controls Switches pinMode(pushButton1, INPUT_PULLUP); pinMode(pushButton2, INPUT_PULLUP); pinMode(missleToggle1, INPUT_PULLUP); pinMode(missleToggle2, INPUT_PULLUP); //pinMode(rocker1,INPUT_PULLUP); //pinMode(rocker2,INPUT_PULLUP); //pinMode(rocker3,INPUT_PULLUP); /*pinMode(Dip1,INPUT_PULLUP); pinMode(Dip2,INPUT_PULLUP); pinMode(Dip3,INPUT_PULLUP); pinMode(Dip4,INPUT_PULLUP); pinMode(Dip5,INPUT_PULLUP); pinMode(Dip6,INPUT_PULLUP); pinMode(Dip7,INPUT_PULLUP); pinMode(Dip8,INPUT_PULLUP);*/ pinMode(pot1, INPUT); //pinMode(pot2, INPUT); //LCD lcd.begin(20, 4); lcd.createChar(0, StraightH); lcd.createChar(1, TLCorner); lcd.createChar(2, TRCorner); lcd.createChar(3, BLCorner); lcd.createChar(4, BRCorner); lcd.createChar(5, progressFull); lcd.createChar(6, progressEmpty); lcd.createChar(7, progressEnd); outlineLCD(); lcd.setCursor(1, 0); lcd.print("Stride Electronics"); lcd.setCursor(3, 2); lcd.print("Control Panel"); TimerSeg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins); TimerSeg.setBrightness(90); // Setup 100Hz timer (100ms) cli(); TCCR0A = 0; //set entire TCCR0A register to 0 TCCR0B = 0; //same for TCCR0B TCNT0 = 0; //initialize counter value to 0 OCR0A = 155; //set compare match register for 1khz increments TCCR0A |= (1 << WGM01); //turn on CTC mode TCCR0B |= (1 << CS02) | (1 << CS00); //Set CS01 and CS00 bits for 1024 prescaler TIMSK0 |= (1 << OCIE0A); //enable timer compare interrupt } void loop() { LaunchSequence(); } void LaunchSequence() { progressBar(0); while (digitalRead(missleToggle1) == HIGH) {} progressBar(1); delay(20); //wait and debounce digitalWrite(redLED, HIGH); setSevSeg(); progressBar(2); digitalWrite(yellowLED, HIGH); tone(beeper, 1000, 50); delay(100); tone(beeper, 1000, 50); delay(100); tone(beeper, 1000, 50); while (digitalRead(missleToggle2) == HIGH) {} progressBar(3); digitalWrite(greenLED, HIGH); while (digitalRead(pushButton2) == HIGH) {} tone(beeper, 1000, 50); progressBar(4); LaunchTime(); tone(beeper, 440, 1000); //Launch } void setSevSeg() { while (digitalRead(pushButton1) == HIGH) { countDown = map(analogRead(pot1), 0, 1023, 5, 60); countDown *= 10; TimerSeg.setNumber(countDown, 2); TimerSeg.refreshDisplay(); // might need small delay here } } void LaunchTime() { sei(); while (countDown != 0) { TimerSeg.setNumber(countDown, 2); TimerSeg.refreshDisplay(); if (countDown >= 30) { if (countDown % 10 == 0) tone(beeper, 1000, 50); } else if (countDown % 2 == 0) { tone(beeper, 1000, 50); } } } ISR(TIMER0_COMPA_vect) { countDown--; if (countDown == 0) cli(); } void outlineLCD(){ //TL Corner lcd.home(); lcd.write(1); //TR Corner lcd.setCursor(19, 0); lcd.write(2); //BL Corner lcd.setCursor(0, 3); lcd.write(3); //BR Corner lcd.setCursor(19, 3); lcd.write(4); //Horizontal Lines for(int i = 1; i < 20; i++){ lcd.setCursor(i, 0); lcd.write(0); lcd.setCursor(i, 3); lcd.write(0); } //Vertical Lines for(int j = 1; j < 4; j++){ lcd.setCursor(0, j); lcd.print("l"); lcd.setCursor(19, j); lcd.print("l"); } } void progressBar(int progress){ switch (progress) { case 0: //Clear Screen lcd.clear(); outlineLCD(); //Step 0 lcd.setCursor(6, 1); lcd.print("Flip TS1"); //Progress Bar Setup lcd.setCursor(7, 2); lcd.write(5); lcd.setCursor(11, 2); lcd.write(7); for(int x = 8; x < 11; x++){ lcd.setCursor(x, 2); lcd.write(6); } break; case 1: //Progress Update lcd.setCursor(8, 2); lcd.write(5); //Step 1 lcd.setCursor(3, 1); lcd.print("Pot1 > PB1"); break; case 2: //Progress Update lcd.setCursor(9, 2); lcd.write(5); //Step 2 lcd.setCursor(6, 1); lcd.print("Flip TS2"); break; case 3: //Progress Update lcd.setCursor(10, 2); lcd.write(5); lcd.setCursor(2, 1); lcd.print("!PB2 to launch!"); break; case 4: //Progress Complete lcd.setCursor(5, 2); lcd.write(5); lcd.setCursor(2, 1); lcd.print("Countdown!"); break; } }