blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
986 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
145 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
122 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
80bb8ae4c9ec178827be6c80e1be8bbd7f0bf583
690330c86dce9812894891c7d90e80d052372b5b
/anyfx/api/lowlevel/base/varblockbase.cc
c0b15bcef3d29c5f1f56879857d5046d96145341
[ "BSD-3-Clause", "LicenseRef-scancode-nvidia-2002" ]
permissive
Duttenheim/fips-anyfx
948fef1593501d874647bf56c4ccb137ed38ac62
71617128d7ec5ba85f229e88bb00325b5fb9015e
refs/heads/master
2023-08-22T09:22:03.426472
2023-08-12T18:55:06
2023-08-12T18:55:06
97,407,640
1
3
null
2020-11-28T20:42:56
2017-07-16T19:57:47
C++
UTF-8
C++
false
false
1,425
cc
//------------------------------------------------------------------------------ // varblockbase.cc // (C) 2016 Individual contributors, see AUTHORS file //------------------------------------------------------------------------------ #include "varblockbase.h" #include "variablebase.h" namespace AnyFX { //------------------------------------------------------------------------------ /** */ VarblockBase::VarblockBase() : byteSize(0), binding(0), set(0), qualifiers(0) { // empty } //------------------------------------------------------------------------------ /** */ VarblockBase::~VarblockBase() { unsigned i; for (i = 0; i < this->variables.size(); i++) { delete this->variables[i]; } this->variables.clear(); this->variablesByName.clear(); } //------------------------------------------------------------------------------ /** */ void VarblockBase::OnLoaded() { // setup this varblock unsigned i; for (i = 0; i < this->variables.size(); i++) { this->byteSize += this->variables[i]->byteSize; } // create a signature for the varblock this->signature.append(this->name + "{"); // format signature by retrieving all variable signatures and making a string mask for (i = 0; i < this->variables.size(); i++) { VariableBase* variable = this->variables[i]; this->signature.append(variable->signature); this->signature.append(";"); } this->signature.append("}"); } } // namespace AnyFX
[ "gustav.sterbrant@gmail.com" ]
gustav.sterbrant@gmail.com
d380bbbdbc3202cb7f40a1e0709f7fc589393a87
40f7252051a70991840e72d062887209c973f4b7
/Coding Ninja/Files/Implementation Of Priority Queue/inbuilt-Min-Priority-Queue.txt
923c249b181ce9f9fd72fbad953f2526b06aa940
[]
no_license
goel-aman/Self_Learning_Reference_Material
97d88038acebae5974ec5288299bebae6a68c9eb
47ff509b366800fb46fb2a75181ed52d547cd9a5
refs/heads/main
2023-06-04T03:31:30.779377
2021-06-17T13:34:10
2021-06-17T13:34:10
301,749,833
0
0
null
null
null
null
UTF-8
C++
false
false
352
txt
#include <iostream> using namespace std; #include <queue> int main() { priority_queue<int, vector<int>, greater<int> > p; p.push(100); p.push(21); p.push(7); p.push(165); p.push(78); p.push(4); cout << p.size() << endl; cout << p.empty() << endl; cout << p.top() << endl; while(!p.empty()) { cout << p.top() << endl; p.pop(); } }
[ "amangoel9873572693@gmail.com" ]
amangoel9873572693@gmail.com
1567f6dc7429a778c3f186f10ee8f1926680f9cc
ece29cdeb72617063c52dee00e8b7ea958b1a16a
/disk_scan_client/disk_scan_util.cpp
4808e2b19cd3a83cc77f9b19add07bb801af55c2
[]
no_license
neilnee/disk_scan
ffab7500fefc78a86400159bebe7aea5a8d4eec6
e832237a72de8d7b0cd28d585d4acdfc09b1c851
refs/heads/master
2016-09-16T07:31:25.909654
2014-08-28T17:01:00
2014-08-28T17:01:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,207
cpp
#include "stdafx.h" #include "disk_scan_util.h" std::wstring GetProcessPath() { TCHAR path[MAX_PATH]; GetModuleFileName(NULL, path, MAX_PATH); std::wstring processPath = path; processPath = processPath.substr(0, processPath.rfind(L"\\")); return processPath; } std::string ToMultiByte(const wchar_t* src) { int cch2 = ::WideCharToMultiByte(CP_UTF8, 0, src, ::wcslen(src), 0, 0, 0, 0); char* str2 = new char[cch2 + 1]; ::WideCharToMultiByte(CP_UTF8, 0, src, ::wcslen(src), str2, cch2 + 1, 0, 0); str2[cch2] = '\0'; std::string destStr = str2; delete []str2; return destStr; } std::wstring ToWideChar(const char* src) { int cch2 = ::MultiByteToWideChar(CP_UTF8, 0, src, ::strlen(src), NULL, 0); wchar_t* str2 = new wchar_t[cch2 + 1]; ::MultiByteToWideChar(CP_UTF8, 0, src, ::strlen(src), str2, cch2); str2[cch2] = L'\0'; std::wstring destStr = str2; delete []str2; return destStr; } BOOL CreateDownloadTask(std::vector<xl_ds_api::CScanFileInfo> files) { return TRUE; } BOOL SetDownloadInfo(xl_ds_api::CScanFileInfo fileInfo) { return TRUE; } std::string CIDCalculate(std::wstring path) { return ToMultiByte(path.c_str()); }
[ "neilnee324@gmail.com" ]
neilnee324@gmail.com
697aad35ac253663f9b7cb0a807e9e47be580d0d
1eebf39c08716814de4196919e470fcfb61e54ed
/src/attitudePropagator.cpp
b13d41a72d681a6b7ebc7bd5e4d6ca85e4470424
[]
no_license
nearlab/nearlab_utils
71af95732af87f779a92c036b937d82111f0e954
7b12cfdb7920251a5133cc87acd1d80615433963
refs/heads/master
2020-04-17T16:09:26.851518
2019-01-25T01:38:57
2019-01-25T01:38:57
166,728,796
0
0
null
null
null
null
UTF-8
C++
false
false
2,421
cpp
#include "attitudePropagator.h" #include "rungeKutta.h" #include "quatMath.h" #include <math.h> void attProp(Eigen::MatrixXd& stateHist, const Eigen::Vector4d& q0, const Eigen::Vector3d& w0, const Eigen::MatrixXd& control, const double& tf, const int& intervals, const AttitudeParams& p){ Eigen::VectorXd state = Eigen::VectorXd::Zero(6); double dt = tf/(intervals)/100; double dtConst = tf/intervals; double t = 0; double err = 1e-7; int iter = 0; double s = 1; while(iter<intervals){ // double tIterLow = std::floor(t/dtConst); // double tIterHigh = std::ceil(t/dtConst); // Eigen::VectorXd u; // if(tIterHigh<intervals){ // u = (t/dtConst-tIterLow)*control.col((int)tIterLow) + (tIterHigh-t/dtConst)*control.col((int)tIterHigh); // }else{ // u = control.col((int)tIterLow); // } Eigen::VectorXd u = control.col(iter); Eigen::VectorXd state4 = state; Eigen::VectorXd state5 = state; rungeKutta(state4,t,t+dt,dt,u,p,attDeriv,4); rungeKutta(state5,t,t+dt,dt,u,p,attDeriv,5); //ROS_INFO_STREAM("Time: " << t <<"\titer:"<<iter<< "\tdelta-t: "<< dt <<"\tDifference: " << (state5-state4).norm() <<"\nState4\n"<<state4<<"\nState5\n"<<state5); double sLast = s; s = pow(err*dt/2/(state5-state4).norm(),.25); if(std::isinf(s)){ s = 1.2;//Heuristic } if((state5-state4).cwiseAbs().minCoeff()>err){ dt = s*dt; continue; } double tStar = (iter)*dtConst; if(t>tStar){ // TODO: THIS IS NOT OPTIMAL FOR QUATERNIONS Eigen::VectorXd stateFixed = ((t-tStar)*state5 + (tStar-(t-dt/sLast))*state)/(dt/sLast); stateFixed.head(4).normalize(); stateHist.col(iter++) << stateFixed; } state = state5; t += dt; dt = std::min(dtConst,s*dt); } stateHist.col(intervals) << state; } Eigen::VectorXd attDeriv(const double& t, const Eigen::VectorXd& y, const Eigen::VectorXd& u, const Params& params){ const AttitudeParams& p = dynamic_cast<const AttitudeParams&>(params); Eigen::Vector4d q = y.head(4); Eigen::Vector3d w = y.tail(3); Eigen::VectorXd yDot = Eigen::VectorXd::Zero(y.size()); yDot.tail(3) = p.J.inverse()*u; yDot.head(4) = quatDot(q,w); return yDot; }
[ "jtb2013@gmail.com" ]
jtb2013@gmail.com
506cdca87583435533b40edf0bd92d31841ceb11
4032667ca76494a5bcc427faa9599b98df5af60f
/src/rpc/client_config.h
9969268ea1d9996f6c886efc6c07b06cd02ba0d0
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
shphrd/bitcoin-sv
7eb3dbec84338101dd3581045ce7688657767e03
0ab72c65ae492376e6fe1ec3a27532fd7cafc7b1
refs/heads/master
2021-06-28T07:31:24.916704
2021-02-10T23:48:30
2021-02-10T23:48:30
317,419,401
1
0
NOASSERTION
2021-02-10T23:48:31
2020-12-01T03:58:23
null
UTF-8
C++
false
false
1,607
h
// Copyright (c) 2020 Bitcoin Association // Distributed under the Open BSV software license, see the accompanying file LICENSE. #pragma once #include <rpc/client_utils.h> #include <string> namespace rpc::client { /** * Wrapper for RPC client config. */ class RPCClientConfig { public: // Some default config values (here so they can be checked from unit tests) static constexpr int DEFAULT_DS_AUTHORITY_PORT { 80 }; static constexpr int DEFAULT_DS_AUTHORITY_TIMEOUT { 60 }; // Factory methods static RPCClientConfig CreateForBitcoind(); static RPCClientConfig CreateForDSA(); static RPCClientConfig CreateForDSA(const std::string& url); // Accessors const std::string& GetServerIP() const { return mServerIP; } int GetServerPort() const { return mServerPort; } int GetConnectionTimeout() const { return mConnectionTimeout; } const std::string& GetCredentials() const { return mUsernamePassword; } const std::string& GetWallet() const { return mWallet; } const std::string& GetEndpoint() const { return mEndpoint; } bool UsesAuth() const { return ! mUsernamePassword.empty(); } private: // Server address details std::string mServerIP {}; int mServerPort {-1}; // Connection timeout int mConnectionTimeout { DEFAULT_HTTP_CLIENT_TIMEOUT }; // Server username:password, or auth cookie std::string mUsernamePassword {}; // Special wallet endpoint std::string mWallet {}; // The configured endpoint (may be extended elsewhere) std::string mEndpoint {}; }; } // namespace rpc::client
[ "r.mills@nchain.com" ]
r.mills@nchain.com
bdad114b1cc8d8f94088c725b12dc56e92d926f2
bd1fea86d862456a2ec9f56d57f8948456d55ee6
/000/109/403/CWE606_Unchecked_Loop_Condition__wchar_t_listen_socket_72b.cpp
78ec6b0ce220f47dc672bcf9f258ae41990e1cb0
[]
no_license
CU-0xff/juliet-cpp
d62b8485104d8a9160f29213368324c946f38274
d8586a217bc94cbcfeeec5d39b12d02e9c6045a2
refs/heads/master
2021-03-07T15:44:19.446957
2020-03-10T12:45:40
2020-03-10T12:45:40
246,275,244
0
1
null
null
null
null
UTF-8
C++
false
false
2,923
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE606_Unchecked_Loop_Condition__wchar_t_listen_socket_72b.cpp Label Definition File: CWE606_Unchecked_Loop_Condition.label.xml Template File: sources-sinks-72b.tmpl.cpp */ /* * @description * CWE: 606 Unchecked Input For Loop Condition * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Input a number less than MAX_LOOP * Sinks: * GoodSink: Use data as the for loop variant after checking to see if it is less than MAX_LOOP * BadSink : Use data as the for loop variant without checking its size * Flow Variant: 72 Data flow: data passed in a vector from one function to another in different source files * * */ #include "std_testcase.h" #include <vector> #define MAX_LOOP 10000 #ifndef _WIN32 #include <wchar.h> #endif using namespace std; namespace CWE606_Unchecked_Loop_Condition__wchar_t_listen_socket_72 { #ifndef OMITBAD void badSink(vector<wchar_t *> dataVector) { /* copy data out of dataVector */ wchar_t * data = dataVector[2]; { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* POTENTIAL FLAW: user-supplied value 'n' could lead to very large loop iteration */ intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void goodG2BSink(vector<wchar_t *> dataVector) { wchar_t * data = dataVector[2]; { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* POTENTIAL FLAW: user-supplied value 'n' could lead to very large loop iteration */ intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } } /* goodB2G uses the BadSource with the GoodSink */ void goodB2GSink(vector<wchar_t *> dataVector) { wchar_t * data = dataVector[2]; { int i, n, intVariable; if (swscanf(data, L"%d", &n) == 1) { /* FIX: limit loop iteration counts */ if (n < MAX_LOOP) { intVariable = 0; for (i = 0; i < n; i++) { /* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */ intVariable++; /* avoid a dead/empty code block issue */ } printIntLine(intVariable); } } } } #endif /* OMITGOOD */ } /* close namespace */
[ "frank@fischer.com.mt" ]
frank@fischer.com.mt
a1b419057877ee75fc710958b3932b6ba204ac7d
e9dfc5f66f649c8e11110d4211c57f575471f2fb
/programa 6/main.cpp
d27008fd5faf37c5b461ac4b0c0bf79abf66ed83
[]
no_license
erickmerlo/programacion2
dad59092695ee876865cfd5d9baa00ac9fdcb8c0
53fd8fedec004c8ed7a8e0363552d01790a56068
refs/heads/master
2020-04-16T04:32:06.153781
2013-12-12T21:17:55
2013-12-12T21:17:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,108
cpp
#include <iostream> using namespace std; /* ingresar nombre del empleado,turno y las horas. luego determianar el pago por hora, el pago bruto, ihss y total a pagar turno1= 100 turno2= 150 turno3= 190 para el seguro si el salario es arriba de 7000 es igual a 245 y si no deducir del salario bruto el 3.5% */ int main() { char nombre[30]; int horas, turno, pxh; double ihss, tp, pb; cout<< "Ingresar el nombre: "; cin.getline(nombre,30); cout << "Ingresar turno: "; cin >> turno; cout << "Ingresar horas: "; cin >> horas; if (turno==1){ pxh=100; } else if(turno==2){ pxh=150; } else if( turno==3){ pxh=190; } else{ pxh=0; } pb= pxh*horas; if (pb >= 7000){ ihss=245; } else{ ihss= pb * 0.035; } tp=pb-ihss; cout << endl <<"Nombre de Empleado: " << nombre << endl; cout << "Pago por hora: " << pxh << endl; cout << "Pago bruto: " << pb << endl; cout << "Seguro Social: " << ihss << endl; cout << "Total a pagar: " << tp << endl; return 0; }
[ "erick.merlo13@hotmail.com" ]
erick.merlo13@hotmail.com
23bdd2c4557b51d0fb22b8de18e9d24f9187f640
faf706266f72ac6c335662d63c8e31b0e87da3b2
/modules/trasan/include/TLine0.h
d339af0e33f82af5f27c62c834802ba50ae9385f
[]
no_license
zombiesquirrel/vxdtf
4ba3284df6ba6a87039eaa38d4faff4baccd4076
a42de988245f471b0faa20659b3d8ab2a6a53a29
refs/heads/master
2021-01-01T05:38:05.122550
2013-09-10T13:47:06
2013-09-10T13:47:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,994
h
//----------------------------------------------------------------------------- // $Id: TLine0.h 10021 2007-03-03 05:43:02Z katayama $ //----------------------------------------------------------------------------- // Filename : TLine0.h // Section : Tracking // Owner : Yoshihito Iwasaki // Email : yoshihito.iwasaki@kek.jp //----------------------------------------------------------------------------- // Description : A class to represent a line in tracking. // See http://bsunsrv1.kek.jp/~yiwasaki/tracking/ //----------------------------------------------------------------------------- // $Log$ // Revision 1.7 2002/01/03 11:04:58 katayama // HepGeom::Point3D<double> and other header files are cleaned // // Revision 1.6 2001/12/23 09:58:56 katayama // removed Strings.h // // Revision 1.5 2001/12/19 02:59:55 katayama // Uss find,istring // // Revision 1.4 2001/12/14 02:54:50 katayama // For gcc-3.0 // // Revision 1.3 2001/04/11 01:10:03 yiwasaki // Trasan 3.00 RC2.1 : bugs in RC2 fixed // // Revision 1.2 2000/10/05 23:54:31 yiwasaki // Trasan 2.09 : TLink has drift time info. // // Revision 1.1 1999/11/19 09:13:15 yiwasaki // Trasan 1.65d : new conf. finder updates, no change in default conf. finder // // Revision 1.11 1999/10/30 10:12:49 yiwasaki // Trasan 1.65c : new conf finder with 3D // // Revision 1.10 1999/03/11 23:27:27 yiwasaki // Trasan 1.24 release : salvaging improved // // Revision 1.9 1999/01/11 03:03:26 yiwasaki // Fitters added // // Revision 1.8 1998/12/24 08:46:58 yiwasaki // stereo building modified by J.Suzuki // // Revision 1.7 1998/08/12 16:33:01 yiwasaki // Trasan 1.08 release : stereo finder updated by J.Suzuki, new MC classes added by Y.Iwasaki // // Revision 1.6 1998/07/29 04:35:22 yiwasaki // Trasan 1.06 release : back to Trasan 1.02 // // Revision 1.4 1998/07/02 09:04:46 yiwasaki // Trasan 1.0 official release // // Revision 1.3 1998/06/19 12:17:12 yiwasaki // Trasan 1 beta 4.1 release, TBuilder::buildStereo updated // // Revision 1.2 1998/06/14 11:09:58 yiwasaki // Trasan beta 3 release, TBuilder and TSelector added // // Revision 1.1 1998/06/11 08:15:47 yiwasaki // Trasan 1 beta 1 release // //----------------------------------------------------------------------------- #ifndef TLine0_FLAG_ #define TLine0_FLAG_ #ifdef TRASAN_DEBUG_DETAIL #ifndef TRASAN_DEBUG #define TRASAN_DEBUG #endif #endif #include <string> #define HEP_SHORT_NAMES #include "tracking/modules/trasan/TTrackBase.h" #include "tracking/modules/trasan/TLink.h" #include "tracking/modules/trasan/TLineFitter.h" namespace Belle { /// A class to represent a track in tracking. class TLine0 : public TTrackBase { public: /// Constructor. TLine0(); /// Constructor. TLine0(const AList<TLink> &); /// Destructor virtual ~TLine0(); public:// Selectors /// returns type. virtual unsigned objectType(void) const; /// dumps debug information. void dump(const std::string& message = std::string(""), const std::string& prefix = std::string("")) const; /// returns coefficient a. double a(void) const; /// returns coefficient b. double b(void) const; /// returns chi2. double chi2(void) const; /// returns reduced-chi2. double reducedChi2(void) const; public:// Utilities /// returns distance to a position of TLink itself. (not to a wire) double distance(const TLink&) const; public:// Modifiers /// fits itself. Error was happened if return value is not zero. // int fitx(void); /// fits itself using isolated hits. Error was happened if return value is not zero. int fit2(); /// fits itself using single hits in a wire-layer. Error was happened if return value is not zero. int fit2s(); /// fits itself using isolated hits. Error was happened if return value is not zero. int fit2p(); /// fits itself using single hits in a wire-layer. Error was happened if return value is not zero. int fit2sp(); /// remove extremly bad points. void removeChits(); /// remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. void refine(AList<TLink> & list, float maxSigma); /// void removeSLY(AList<TLink> & list); /// void appendSLY(AList<TLink> & list); /// void appendByszdistance(AList<TLink> & list, unsigned isl, float maxSigma); /// sets circle properties. void property(double a, double b, double det); private:// Always updated mutable bool _fittedUpdated; private:// Updated when fitted double _a; double _b; double _det; static const TLineFitter _fitter; private:// Updated when fitted and accessed mutable double _chi2; mutable double _reducedChi2; }; //----------------------------------------------------------------------------- #ifdef TLine0_NO_INLINE #define inline #else #undef inline #define TLine0_INLINE_DEFINE_HERE #endif #ifdef TLine0_INLINE_DEFINE_HERE inline double TLine0::a(void) const { #ifdef TRASAN_DEBUG if (! _fitted) std::cout << "TLine0::a !!! fit not performed" << std::endl; #endif return _a; } inline double TLine0::b(void) const { #ifdef TRASAN_DEBUG if (! _fitted) std::cout << "TLine0::b !!! fit not performed" << std::endl; #endif return _b; } inline double TLine0::distance(const TLink& l) const { #ifdef TRASAN_DEBUG if (! _fitted) std::cout << "TLine0::distance !!! fit not performed" << std::endl; #endif double dy = fabs(_a * l.position().x() + _b - l.position().y()); double invCos = sqrt(1. + _a * _a); return dy / invCos; } inline void TLine0::property(double a, double b, double det) { _a = a; _b = b; _det = det; } inline unsigned TLine0::objectType(void) const { return Line; } #endif #undef inline } // namespace Belle #endif /* TLine0_FLAG_ */
[ "jkl@lettenbichlerAtWork.(none)" ]
jkl@lettenbichlerAtWork.(none)
1c0e45eafc14ced46901f7243a4fe5be5cb644c8
8365e80590978513f9be184787e3f9c2dbaf0af5
/tests/HopscotchHashTest.cpp
c0d9c4ca25819a6b97ffcfd983d62d6feceb452f
[]
no_license
IvanRamyk/oop_exam
5392963924daaedfa649767354569839322269a9
00b099682cef93485b5d52d75494e25ec8b16f3d
refs/heads/master
2022-10-11T10:40:56.300928
2020-06-10T22:02:32
2020-06-10T22:02:32
270,590,419
0
2
null
2020-06-10T10:05:49
2020-06-08T08:30:04
C++
UTF-8
C++
false
false
566
cpp
// // Created by hryhorchuk117 on 10/06/2020. // #include <iostream> #include <gtest/gtest.h> #include "../src/Hash/HopscotchHash.h" TEST(Hash, HopscotchHash) { HopscotchHash<date_time::Time> table({date_time::Time(1, 1, 1),date_time::Time(1, 1, 5) }); auto n = table.getData(); EXPECT_TRUE(table.getData() == n); } TEST(Hash, HopscotchHash2) { HopscotchHash<date_time::Time> table({date_time::Time(2, 1, 5), date_time::Time(1, 1, 5) }); auto n = table.getData(); EXPECT_TRUE(table.getData() == n); }
[ "hryhorchuk117@gmail.com" ]
hryhorchuk117@gmail.com
34837822144cb99657d3a5e524afc046de9468f6
6035bc4bf8ca0993cf372bbf4b2a2deaee37e156
/cpp_d09/ex01/Warrior.cpp
5d809b53994837507d771deae3f9534928a837c6
[]
no_license
Clemsx/Cpp_pool
0853bc000c9e6585dd96acdc58c9760c8637cc85
43ebf6af098408c23291595817167a3d0240bc59
refs/heads/master
2023-02-08T05:57:26.524042
2020-12-28T18:54:23
2020-12-28T18:54:23
325,091,972
0
0
null
null
null
null
UTF-8
C++
false
false
1,439
cpp
// // Warrior.cpp for d09_ex01 in /home/clemsx/CPP/Pool/cpp_d09/ex01 // // Made by clement xia // Login <clemsx@epitech.net> // // Started on Thu Jan 12 16:04:23 2017 clement xia // Last update Fri Jan 13 08:52:01 2017 clement xia // #include <string> #include <iostream> #include "Warrior.hh" Warrior::Warrior(const std::string &name, int lvl, std::string weaponName) : Character(name, lvl), weaponName(weaponName) { this->strength = 12; this->stamina = 12; this->intel = 6; this->spirit = 5; this->agility = 7; std::cout << "I'm " << name; std::cout << " KKKKKKKKKKRRRRRRRRRRRRRREEEEEEEEOOOOOOORRRRGGGGGGG" << std::endl; } Warrior::~Warrior(){ } int Warrior::CloseAttack(){ if (this->power >= 30) { this->power -= 30; std::cout << this->name << " strikes with his " << this->weaponName; std::cout << std::endl; return (this->strength + 20); } std::cout << this->name << " out of power" << std::endl; this->power = 0; return (0); } int Warrior::RangeAttack(){ if (this->power >= 10) { this->power -= 10; std::cout << this->name << " intercepts" << std::endl; Range = Character::CLOSE; return (0); } std::cout << this->name << " out of power" << std::endl; this->power = 0; return (0); } /* int main() { Warrior w("jimmy", 42, "bamboo"); w.CloseAttack(); w.TakeDamage(50); w.Heal(); w.TakeDamage(200); return (0); } */
[ "clemsx@clemsx.local" ]
clemsx@clemsx.local
9e8dd85e1cdd5ab7042f4cc35ffdeece407d21d3
5125e2efdf589fc87936665a0be12abe6b224786
/p2_1_Woodard.h
1e7f2e227527d3ace603b0e2882a946c31ab2dd3
[]
no_license
BJWOODS/Reverse-Polish-Notation-Calculator
df0c5139a9bf12f4aed416f657a64b2e84af5174
9691038e3a23f6336b351243abeb6f9d1f3eff82
refs/heads/master
2020-12-24T19:36:29.855840
2016-06-07T21:35:32
2016-06-07T21:35:32
56,015,282
0
0
null
null
null
null
UTF-8
C++
false
false
836
h
// // main.cpp // CST238Project2 // // Created by Brandon Woodard on 11/11/15. // Copyright (c) 2015 Brandon Woodard. All rights reserved. // #include <iostream> #include <string> #include <cstdlib> #include <stdio.h> /* printf, fgets */ #include <stdlib.h> /* atof */ #include <math.h> #include <iomanip> #include <sstream> #include <cmath> using namespace std; typedef double ElementType; const unsigned SIZE_OF_STACK = 50; class Calculator { private: double a[SIZE_OF_STACK]; unsigned t = 0; int z = 0; public: void push(ElementType b); void pop(); bool empty(); void read(string txt); void print(string x,string i); void evaluate(string x); ElementType top(); }; class Start : Calculator { private: Calculator stack; string txt; public: void startcalculate(); };
[ "bwoodard@csumb.edu" ]
bwoodard@csumb.edu
0222ed51a20edadc6cc87f60e63abadf6f9b9340
ae9ff784b524610de9abebea61a59df1152c3aad
/CH05/13.cpp
7378a968b770042c4efec2b63d28ebdb77a1d2dd
[]
no_license
headmastersquall/Cpp
489ea7757d9b0a64b929fece3b1152121f69cdc8
daca75461ca00bb9f5af7550554e32d024d335d8
refs/heads/master
2020-05-17T22:39:57.086887
2015-11-09T20:12:31
2015-11-09T20:12:31
42,877,932
0
1
null
null
null
null
UTF-8
C++
false
false
521
cpp
/* * 13. Celsius to Fahrenheit Table * * This program outputs a table showing the conversion values * of Celsius degress to Fahrenheit degrees from the values * of 0 through 20. */ #include <iostream> using namespace std; int main() { double fahrenheit; const double CONVERSION = 9.0 / 5.0; cout << "C\tF" << endl; cout << "------------" << endl; for (int celsius = 0; celsius < 21; celsius++) { fahrenheit = (CONVERSION * celsius) + 32; cout << celsius << "\t" << fahrenheit << endl; } return 0; }
[ "headmastersquall@hushmail.com" ]
headmastersquall@hushmail.com
5fb9528e25adc070c0d8917da92e1229db3c7320
f6e9b79854238d40335d7f80bad75e057c12c4eb
/src/Hedera/Entry.cpp
60dfc7e124a41eb82da4ee9a38891a3c4001986d
[ "BSD-3-Clause", "LicenseRef-scancode-protobuf", "LGPL-2.1-only", "Swift-exception", "MIT", "BSL-1.0", "Apache-2.0" ]
permissive
scrtlabs/wallet-core
82cfc9587c23c824a9568cdc511500adaab63d18
a623e13cb0bea20019acf078fba4117d3e85a441
refs/heads/master
2022-12-14T21:36:56.668907
2022-12-04T15:30:31
2022-12-04T15:30:31
272,007,408
0
1
MIT
2022-11-28T15:27:47
2020-06-13T12:47:24
C++
UTF-8
C++
false
false
904
cpp
// Copyright © 2017-2022 Trust Wallet. // // This file is part of Trust. The full Trust copyright notice, including // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. #include "Entry.h" #include "Address.h" #include "Signer.h" namespace TW::Hedera { bool Entry::validateAddress([[maybe_unused]] TWCoinType coin, const std::string& address, [[maybe_unused]] const PrefixVariant& addressPrefix) const { return Address::isValid(address); } std::string Entry::deriveAddress([[maybe_unused]] TWCoinType coin, const PublicKey& publicKey, TW::byte, const char*) const { return Address(publicKey).string(); } void Entry::sign([[maybe_unused]] TWCoinType coin, const TW::Data& dataIn, TW::Data& dataOut) const { signTemplate<Signer, Proto::SigningInput>(dataIn, dataOut); } } // namespace TW::Hedera
[ "noreply@github.com" ]
scrtlabs.noreply@github.com
b2c0b0dd233e9f37c149e115ca54f94f8b4f3fd6
a00315b4799ced889ddd0ca00321cfdfdbafd43b
/Lesson6/Part2/icpc_7752.cpp
470cfa544ffa84ca2cf5cb3e2bcb88fe9bd50f74
[]
no_license
yakirhelets/234901_CP
928bd963882ad7f875a35317767688ae53322ecc
92dd1e17d43091c873bf302edeaf333a4f240f6b
refs/heads/master
2020-05-09T03:41:52.547440
2019-07-07T14:40:49
2019-07-07T14:40:49
180,982,276
0
0
null
null
null
null
UTF-8
C++
false
false
2,111
cpp
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> // clang-format off #ifndef LOAD_TEST // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define DO_LOAD_TEST(N) do {} while (false) #else #include "../load_test.hpp" // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define DO_LOAD_TEST(N) auto re_ref = load_test(__FILE__, (N)) #endif // clang-format on using namespace std; using ll = long long; using ull = unsigned long long; using sz = size_t; int releaseFirstAndPut(int init, vector<int>& before, vector<int>& after) { int numOfActions=0; int n=init; while(before[n] == after[n] && before[before[n]-1] != 0) { n = before[n]-1; } if (before[before[n]-1] == 0) { numOfActions++; } before[n] = 0; return numOfActions; } /// XXXXX - Name int main() { DO_LOAD_TEST(0); int n; while (cin >> n) { vector<int> before(n); for (int i=0 ; i<n ; i++) { int p; cin >> p; before[i] = p; } vector<int> after(n); for (int i=0 ; i<n ; i++) { int p; cin >> p; after[i] = p; } int numOfActions = 0; for (int i=0 ; i<n ; i++) { if (before[i] != after[i]) { if (before[i] != 0 && after[i] != 0) { numOfActions+=releaseFirstAndPut(i, before, after); } } } for (int i=0 ; i<n ; i++) { if (before[i] != after[i]) { if (before[i] == 0) { before[i] = after[i]; numOfActions++; } else { if(after[i]==0) { before[i] = after[i]; numOfActions++; } } } } cout << numOfActions << endl; } }
[ "yakir.helets@gmail.com" ]
yakir.helets@gmail.com
70d4f740aa4ddc3cf7d14bb9818906bc612454ca
3cd8c944a212048db42541f53a030ddc2fdffa24
/glesstudy/jni/main/DiResource.cpp
88979ea94ac0935b849b7f08414c1097e24ade47
[ "MIT" ]
permissive
eastcowboy2002/gles-study
6f2f4d6c4bf99f97080a16a51c5094b63883f025
e715ea76e41c8dc73cfff1c32a2bdf24aa3b73f9
refs/heads/master
2020-05-19T21:56:12.325860
2015-07-23T02:03:27
2015-07-23T02:03:27
19,304,149
0
0
null
null
null
null
UTF-8
C++
false
false
14,942
cpp
#include "DiResource.h" #include "SDL_image.h" #include <ctime> namespace di { unique_ptr<ResourceManager> ResourceManager::s_singleton; ResourceManager::ResourceManager() : m_fields(new Fields) { m_fields->threadWillEnd = false; shared_ptr<Fields> fields = m_fields; ThreadEventHandlers handlers; handlers.onInit = []() { // ilInit(); // ilEnable(IL_ORIGIN_SET); // ilOriginFunc(IL_ORIGIN_LOWER_LEFT); }; handlers.onLoop = [fields](bool* willEndThread, uint32_t* willWaitMillis) { // onLoop lambda begin Fields* f = fields.get(); *willWaitMillis = 0; vector<ResourcePtr> vec; f->cvToWorker.WaitUntil( f->lockToWorker, [f]() { return f->threadWillEnd || !f->queueToWorker.empty(); }, [willEndThread, f, &vec]() { *willEndThread = f->threadWillEnd; if (*willEndThread) { LogInfo("willEndThread"); return; } // while (!f->queueToWorker.empty()) if (!f->queueToWorker.empty()) { vec.push_back(f->queueToWorker.top()); f->queueToWorker.pop(); } }); for (auto iter = vec.begin(); iter != vec.end(); ++iter) { if (*willEndThread) { return; } ResourcePtrCR r = *iter; r->Load(); ThreadLockGuard lock(f->lockToGL); f->queueToGL.push_back(r); } // onLoop lambda end }; handlers.threadName = "Resource Loader"; StartThread(handlers); } ResourceManager::~ResourceManager() { m_fields->threadWillEnd = true; } void ResourceManager::AsyncLoadResource(ResourcePtrCR resource) { DI_SAVE_CALLSTACK(); Resource::State state = resource->GetState(); if (state != Resource::State::Init && state != Resource::State::Timeout) { if (state == Resource::State::Finished) { resource->UpdateTimeoutTick(); } else { // note: // Normally we only need to call cvToWorker.Notify() after queueToWorker.push(), // which is done at the end of this function. // // But if cvToWorker.Notify() is called before worker thread's "cvToWorker.WaitUntil" called, // we need to call cvToWorker.Notify() somewhere again. // Or the worker thread will wait for a long time ThreadLockGuard lock(m_fields->lockToWorker); if (!m_fields->queueToWorker.empty()) { m_fields->cvToWorker.Notify(); } } return; } LogInfo("AsyncLoadResource '%s'", resource->GetName().c_str()); resource->Prepare(); if (resource->GetState() != Resource::State::Prepared) { return; } ThreadLockGuard lock(m_fields->lockToWorker); m_fields->queueToWorker.push(resource); m_fields->cvToWorker.Notify(); } void ResourceManager::CheckAsyncFinishedResources() { DI_SAVE_CALLSTACK(); ThreadLockGuard lock(m_fields->lockToGL); deque<ResourcePtr> queueToGL; queueToGL.swap(m_fields->queueToGL); lock.Unlock(); for (auto iter = queueToGL.begin(); iter != queueToGL.end(); ++iter) { ResourcePtrCR resource = *iter; if (resource->GetState() == Resource::State::Loaded) { resource->Finish(); if (resource->GetState() == Resource::State::Finished) { resource->UpdateTimeoutTick(); } } } } void ResourceManager::CheckTimeoutResources() { DI_SAVE_CALLSTACK(); auto& resourceHash = m_fields->resourceHash; for (auto iter = resourceHash.begin(); iter != resourceHash.end(); ++iter) { ResourcePtrCR resource = (*iter).second; // if (resource.unique()) // { resource->CheckTimeout(); // } } } const ResourcePtr* ResourceManager::HashFindResource(const string& name) { DI_SAVE_CALLSTACK(); auto& hash = m_fields->resourceHash; auto iter = hash.find(name); if (iter == hash.end()) { return nullptr; } ResourcePtrCR resource = (*iter).second; Resource::State state = resource->GetState(); DI_ASSERT(state != Resource::State::Init); AsyncLoadResource(resource); return &resource; } void ResourceManager::AddResource(ResourcePtrCR resource) { DI_SAVE_CALLSTACK(); DI_ASSERT(resource->GetState() == Resource::State::Init); m_fields->resourceHash[resource->GetName()] = resource; AsyncLoadResource(resource); } class SDLTextureLoader : public BaseTextureLoader { public: SDLTextureLoader(const string& name) : BaseTextureLoader(name), m_imageSurface(nullptr) {} ~SDLTextureLoader() { glDeleteTextures(1, &m_glTexture); SDL_FreeSurface(m_imageSurface); m_imageSurface = nullptr; } private: virtual bool Prepare_InGlThread() { DI_SAVE_CALLSTACK(); if (m_glTexture == 0) { glGenTextures(1, &m_glTexture); glBindTexture(GL_TEXTURE_2D, m_glTexture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); DI_DBG_CHECK_GL_ERRORS(); } return true; } virtual bool Load_InWorkThread() { DI_SAVE_CALLSTACK(); if (m_imageSurface) { LogWarn("load new SDL surface while the old surface is still exist. resource: '%s'", GetName().c_str()); m_imageSurface = nullptr; } m_imageSurface = IMG_Load(GetName().c_str()); if (m_imageSurface) { m_width = m_imageSurface->w; m_height = m_imageSurface->h; if (m_imageSurface->format->Amask != 0 || SDL_GetColorKey(m_imageSurface, NULL)) { m_innerFormat = TextureProtocol::RGBA_8888; } else { m_innerFormat = TextureProtocol::RGB_888; } return true; } else { LogError("IMG_Load('%s') failed", GetName().c_str()); return false; } } virtual bool Finish_InGlThread() { DI_SAVE_CALLSTACK(); DI_ASSERT(m_imageSurface); DI_ASSERT(m_glTexture); Uint32 sdlFormat; GLenum glFormat; if (m_imageSurface->format->Amask != 0 || SDL_GetColorKey(m_imageSurface, NULL) == 0) { sdlFormat = SDL_PIXELFORMAT_ABGR8888; // surface has alpha, so use GL_RGBA glFormat = GL_RGBA; } else { sdlFormat = SDL_PIXELFORMAT_RGB24; // surface has no alpha, so use GL_RGB glFormat = GL_RGB; } SDL_Surface* readingSurface; SDL_Surface* tmpSurface = nullptr; if (sdlFormat == m_imageSurface->format->format) // no need to change format { readingSurface = m_imageSurface; } else // need to change format // Normally we don't go here because blit operation has some performance cost // maybe move SDL_BlitSurface to ResourceManager's work thread is an optimization { LogWarn("SDL surface type need change. origin: %s, destination: %s", SDL_GetPixelFormatName(m_imageSurface->format->format), SDL_GetPixelFormatName(sdlFormat)); int pixelDepth; Uint32 Rmask, Gmask, Bmask, Amask; SDL_PixelFormatEnumToMasks(sdlFormat, &pixelDepth, &Rmask, &Gmask, &Bmask, &Amask); tmpSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, m_width, m_height, pixelDepth, Rmask, Gmask, Bmask, Amask); if (!tmpSurface) { LogError("SDL_CreateRGBSurface failed, resource: '%s'", GetName().c_str()); SDL_FreeSurface(m_imageSurface); m_imageSurface = nullptr; return false; } SDL_BlitSurface(m_imageSurface, nullptr, tmpSurface, nullptr); readingSurface = tmpSurface; } if (readingSurface->pitch % 4 != 0) { glPixelStorei(GL_PACK_ALIGNMENT, 1); } if (SDL_MUSTLOCK(readingSurface)) { SDL_UnlockSurface(readingSurface); } glTexImage2D(GL_TEXTURE_2D, 0, glFormat, m_width, m_height, 0, glFormat, GL_UNSIGNED_BYTE, readingSurface->pixels); if (SDL_MUSTLOCK(readingSurface)) { SDL_UnlockSurface(readingSurface); } if (readingSurface->pitch % 4 != 0) { glPixelStorei(GL_PACK_ALIGNMENT, 4); } SDL_FreeSurface(tmpSurface); SDL_FreeSurface(m_imageSurface); m_imageSurface = nullptr; return true; } virtual void Timeout_InGlThread() { glDeleteTextures(1, &m_glTexture); m_glTexture = 0; m_width = 0; m_height = 0; SDL_FreeSurface(m_imageSurface); m_imageSurface = nullptr; } SDL_Surface* m_imageSurface; }; class KTXTextureLoader : public BaseTextureLoader { public: KTXTextureLoader(const string& name) : BaseTextureLoader(name) {} private: virtual bool Prepare_InGlThread() { return true; } virtual bool Load_InWorkThread() { DI_SAVE_CALLSTACK(); if (!m_bytes.empty()) { LogWarn("load new KTX bytes while the old bytes is still exist. resource: '%s'", GetName().c_str()); m_bytes.clear(); } SDL_RWops* rw = SDL_RWFromFile(GetName().c_str(), "rb"); if (!rw) { LogError("SDL_RWFromFile('%s') failed", GetName().c_str()); return false; } auto rwDeleter = MakeCallAtScopeExit([rw](){ SDL_RWclose(rw); }); m_bytes.resize(size_t(SDL_RWsize(rw))); if (!m_bytes.empty()) { if (SDL_RWread(rw, &m_bytes[0], m_bytes.size(), 1) != 1) { vector<uint8_t>().swap(m_bytes); LogError("SDL_RWread('%s') failed", GetName().c_str()); return false; } } else { LogError("KTX file '%s' is empty", GetName().c_str()); return false; } return true; } virtual bool Finish_InGlThread() { DI_SAVE_CALLSTACK(); DI_ASSERT(!m_bytes.empty()); GLuint tex; GLenum target; GLenum glerr; GLboolean isMipmap; KTX_dimensions dimensions; KTX_error_code ktxErr = ktxLoadTextureM(&m_bytes[0], m_bytes.size(), &tex, &target, &dimensions, &isMipmap, &glerr, 0, NULL); vector<uint8_t>().swap(m_bytes); if (ktxErr != KTX_SUCCESS || glerr != GL_NO_ERROR) { LogError("ktxLoadTextureM('%s') failed. ktxErr = 0x%X, glerr = 0x%X", GetName().c_str(), ktxErr, glerr); return false; } if (target != GL_TEXTURE_2D) { glBindTexture(target, 0); glDeleteTextures(1, &target); LogError("ktxLoadTextureM('%s') not a 2D texture", GetName().c_str()); return false; } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, isMipmap ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); m_width = dimensions.width; m_height = dimensions.height; m_glTexture = tex; m_innerFormat = InnerFormat::RGB_888; return true; } virtual void Timeout_InGlThread() { DI_SAVE_CALLSTACK(); glDeleteTextures(1, &m_glTexture); m_glTexture = 0; m_width = 0; m_height = 0; vector<uint8_t>().swap(m_bytes); } vector<uint8_t> m_bytes; }; ImageAsTexture::ImageAsTexture(const string& name, float priority /* = 0 */ ) : Resource(name, priority), m_loader(nullptr) { size_t pos = name.find_last_of('.'); if (pos != string::npos && SDL_strncasecmp(name.c_str() + pos + 1, "ktx", 3) == 0) { m_loader.reset(new KTXTextureLoader(name)); } else { m_loader.reset(new SDLTextureLoader(name)); } } bool ImageAsTexture::Prepare_InGlThread() { return m_loader->Prepare_InGlThread(); } bool ImageAsTexture::Load_InWorkThread() { return m_loader->Load_InWorkThread(); } bool ImageAsTexture::Finish_InGlThread() { return m_loader->Finish_InGlThread(); } void ImageAsTexture::Timeout_InGlThread() { m_loader->Timeout_InGlThread(); } }
[ "eastcowboy2002@163.com" ]
eastcowboy2002@163.com
dc3ca7412ccab7a04083c79ba69b0ae3fb410be8
6b0345821fcefa528f9382eed8c0a3fbb95f60c8
/ethernet.cpp
10b726cc57ef752af2163b6b8ac4e1f895381cf6
[]
no_license
rnetuka/cpp-networking
d58b2428daca5b8e26d745425b813eba2cbccd08
2948631aa85b20bbcec7d19c73e7cf301e9d28a8
refs/heads/master
2021-07-07T03:31:45.487885
2017-10-03T08:55:05
2017-10-03T08:55:05
105,631,159
0
0
null
null
null
null
UTF-8
C++
false
false
4,400
cpp
/* */ #include <cstdint> #include <ostream> #include <sstream> #include <string> #include <vector> #include "ethernet.h" #include "mac.h" using namespace eth; using namespace mac; using namespace std; Frame::Frame() : ether_type_(0), checksum_(0) { } void Frame::set_source_address(const Address& address) { source_address_ = address; } void Frame::set_destination_address(const Address& address) { destination_address_ = address; } void Frame::set_ether_type(int type) { ether_type_ = type; } void Frame::set_payload(const vector<uint8_t>& payload) { payload_ = payload; } void Frame::set_checksum(int checksum) { checksum_ = checksum; } Address Frame::source_address() const { return source_address_; } Address Frame::destination_address() const { return destination_address_; } uint16_t Frame::ether_type() const { return ether_type_; } vector<uint8_t> Frame::payload() const { return payload_; } uint32_t Frame::checksum() const { return checksum_; } vector<uint8_t> Frame::bytes() const { vector<uint8_t> source_address_bytes = source_address_.bytes(); vector<uint8_t> destination_address_bytes = destination_address_.bytes(); vector<uint8_t> bytes; bytes.insert(bytes.end(), destination_address_bytes.begin(), destination_address_bytes.end()); bytes.insert(bytes.end(), source_address_bytes.begin(), source_address_bytes.end()); bytes.push_back(ether_type_ >> 8); bytes.push_back(ether_type_ & 0b11111111); bytes.insert(bytes.end(), payload_.begin(), payload_.end()); /* bytes.push_back(checksum_ >> 24); bytes.push_back((checksum_ >> 16) & 255); bytes.push_back((checksum_ >> 8) & 255); bytes.push_back(checksum_ & 255); for (int i = bytes.size(); i < 64; i++ bytes.push_back(0); */ return bytes; } string Frame::str() const { stringstream stream; stream << "Src MAC: " << source_address_ << endl; stream << "Dest MAC: " << destination_address_ << endl; return stream.str(); } string Frame::info() const { stringstream stream; stream << "+-----------------------" << endl; stream << "| Dest MAC: " << destination_address_ << endl; stream << "| Src MAC: " << source_address_ << endl; stream << "| Ether type: " << ether_type_ << endl; stream << "| Payload of " << payload_.size() << " bytes" << endl; stream << "| Checksum: " << checksum_ << endl; stream << "+-----------------------" << endl; return stream.str(); } Frame Frame::parse(const vector<uint8_t>& bytes) { Frame frame; frame.destination_address_ = Address(vector<uint8_t>(bytes.begin(), bytes.begin() + 6)); frame.source_address_ = Address(vector<uint8_t>(bytes.begin() + 6, bytes.begin() + 12)); frame.ether_type_ = (((uint16_t) bytes[12]) << 8) + bytes[13]; vector<uint8_t> remaining_bytes(bytes.begin() + 14, bytes.end()); int payload_length; if (frame.ether_type_ <= 1500) { payload_length = frame.ether_type_; } else if (frame.ether_type_ == EtherType::IPv4) { payload_length = (((int) remaining_bytes[2]) << 8) + remaining_bytes[3]; } else if (frame.ether_type_ == EtherType::IPv6) { // TODO: implement this payload_length = 0; } else if (frame.ether_type_ == EtherType::ARP) { //payload_length = remaining_bytes.size(); payload_length = 28; } else { // TODO: implement this } frame.payload_.insert(frame.payload_.end(), remaining_bytes.begin(), remaining_bytes.begin() + payload_length); return frame; } FrameFactory::FrameFactory() : ether_type(0) { } void FrameFactory::set_source_address(const Address& address) { source_address = address; } void FrameFactory::set_destination_address(const Address& address) { destination_address = address; } void FrameFactory::set_ether_type(uint16_t type) { ether_type = type; } Frame FrameFactory::create_frame(const vector<uint8_t>& payload) const { Frame frame; frame.set_source_address(source_address); frame.set_destination_address(destination_address); frame.set_ether_type(ether_type); frame.set_payload(payload); //frame.set_checksum(crc_checksum(frame.bytes())); return frame; } ostream& operator <<(ostream& stream, const Frame& frame) { return stream << frame.str(); }
[ "rnetuka@redhat.com" ]
rnetuka@redhat.com
9aea31e3d63f2e83f080fb755f7f0559fd44456d
a736610d8913db0e10548f4920b37b6c2b5acd53
/source_code/KMedoidsTreeClustering.cpp
78f59ebccf3747be2d3a52af5d1bc83b4b9055a2
[]
no_license
NadiaTahiri/CKMedoidsTreeClustering
31bc5fdea898ced9c3a707fd07d12089c5e322a3
c50732543a1aa35332cad3ebe37f36c07c01aef0
refs/heads/master
2021-01-21T14:16:41.814179
2017-06-23T21:38:12
2017-06-23T21:38:12
95,260,674
2
0
null
2017-06-23T22:25:09
2017-06-23T22:25:09
null
UTF-8
C++
false
false
21,911
cpp
#include <iostream> #include <fstream> #include <vector> #include <string> #include <boost/regex.hpp> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <string.h> #include <vector> #include <fstream> #include <sstream> #ifdef _OPENMP #include <omp.h> #endif #include "hgt_int.cpp" #include "Super-trees.cc" using namespace std; struct TNode{ int NoNoeud; char *seq; TNode * gauche; TNode * droit; int nbFils; }; //==Prototypes des fonctions void SAVEASNewick(double *LONGUEUR, long int *ARETE,int nn,const char* t); void createTree(int nbSpecies,double l,const char* t); void GenererMatrice(TNode **TabNoeud, double **DISS); void Tree_edges(double **,long int *,double *); int floor1(double x); void odp1ct(double**,int*,int*,int*,int); void tree_generation(double **DA, double **DI, int n, double Sigma); string longueur (string tree2); int ExtraireDonneesLC(const char * chaine, char *champs, char * contenu); void validation(int &intParam); #define INFINI 999999.99 #define MaxRF 0 double MaxLong=0; double MinLong = INFINI; double seuil; double epsilona = 0.00005; int n; void presenterProgramme(){ printf ("KMTC - Clustering phylogenetic trees using k-medoids\n"); printf("Nadia Tahiri and Vladimir Makarenkov - Departement d'informatique - Universite du Quebec a Montreal\n"); printf("Choose the criterion to perform the k-medoids clustering of trees:\n"); printf("option 1 - Calinski-Harabasz with RF\n"); printf("option 2 - Calinski-Harabasz with RF squared\n"); printf("option 3 - Silhouette with RF\n"); printf("option 4 - Silhouette with RF squared\n"); } //============================================================= //=========================== MAIN ============================ //============================================================= int main(int nargs,char ** argv){ presenterProgramme(); printf("Traitement in progress... \n"); char champs[100]; char contenu[100]; if(nargs < 2){ printf("\nbad input..\nusage:%s {-simulation|-matrice|-tree}\n",argv[0]); exit(1); } if(ExtraireDonneesLC(argv[1],champs,contenu)==1){ if(strcmp("tree",champs) == 0){ if(nargs != 4){ printf("\nbad input..\nusage:%s {-tree} nameFile Parametre\n",argv[0]); exit(1); } fstream fichier(argv[2]); int intParam = atoi(argv[3]); validation(intParam); vector <string> mesTrees; int ligne = 1; char ** cl2 = new char*[4]; for (int i=0;i<4;i++){ cl2[i] = new char[10]; } strcpy(cl2[0], "*"); strcpy(cl2[1], "?"); strcpy(cl2[2], "?"); strcpy(cl2[3], "?"); vector <int> tabIndices; //read input file (tree file) if( !fichier ){ cout << "File "<<argv[2]<<" no exist."<<endl; }else{ while( !fichier.eof()){ mesTrees.push_back("");//creation d'une ligne vide getline(fichier, mesTrees.back());//lecture d'une ligne du fichier ligne = mesTrees.size() - 1;//je recupere la taille du tableau (-1 pour la ligne 0) if(mesTrees[ligne].empty())//si la ligne est vide mesTrees.pop_back();//on la retire du tableau } tabIndices.push_back(mesTrees.size()); //call the method which compute Robinson and Foulds distance between each pair of trees main_consense(cl2,tabIndices,mesTrees,intParam); //vider les vecteurs mesTrees.clear(); tabIndices.clear(); } } } printf("end of computation\n"); return 0; } string longueur (string tree2){ //en cours........ string lg =""; int cp = 0; int pours = 0; while(cp<tree2.length() && pours==0){ if(tree2.at(cp)==':'){ cp++; while((tree2.at(cp)>='0' && tree2.at(cp)<='9') || tree2.at(cp)>='.'){ lg += tree2.at(cp); cp++; } pours = 1; } cp++; } return lg; } //============================================= // //============================================= void createTree (int nbSpecies,double l, const char * outputfilename){ int i,j; double *LONGUEUR,Sigma; //= Longueurs des aretes long int *ARETE; //= Liste des aretes de l'arbre double **DA,**DI; //= Distance d'arbre n = nbSpecies; // Allocation dynamique pour les matrices DI = (double **) malloc((n+1)*sizeof(double*)); DA=(double **) malloc((2*n-1)*sizeof(double*)); for (i=0;i<=n;i++){ DI[i]=(double*)malloc((n+1)*sizeof(double)); if (DI[i]==NULL) { printf(" Data matrix is too large(2)\n"); exit(1); } } for(i=0;i<=2*n-2;i++){ DA[i]=(double*)malloc((2*n-1)*sizeof(double)); } ARETE=(long int *) malloc((4*n)*sizeof(long int)); LONGUEUR=(double *) malloc((2*n)*sizeof(double)); //===== CA COMMENCE ICI ===== //================================== //= CREATION D'UN ARBRE ALEATOIRE //================================== tree_generation(DA, DI, n, Sigma = 0.0); Tree_edges(DA, ARETE, LONGUEUR); MaxLong = 0; MinLong = INFINI; for(int j=1;j<=2*n-3;j++){ MaxLong += LONGUEUR[j-1]; } //printf("\nlongueur moyenne des branches = %lf",MaxLong/(2*n-3)); double facteur = 1.0/(MaxLong/(2*n-3)); MaxLong = 0; for(int j=1;j<=2*n-3;j++){ LONGUEUR[j-1] = (LONGUEUR[j-1]*facteur)*l; MaxLong += LONGUEUR[j-1]; } //printf("\nl= %lf,facteur = %lf,longueur moyenne des branches = %lf\n",l,facteur,MaxLong/(2*n-3)); //============================================================================= //= SAUVEGARDE DE L'ARBRE //============================================================================= SAVEASNewick(LONGUEUR,ARETE,n,outputfilename); for (i=0;i<=n;i++){ free(DI[i]); } free(DI); for(i=0;i<=2*n-2;i++){ free(DA[i]); } free(DA); free(ARETE); free(LONGUEUR); } //================================= // //================================= double P(double l){ return 0.25*(1.0+3.0*exp(-4.0*1*l)); } // This C++ function is meant to generate a random tree distance matrix DA // of size (nxn) and a distance (i.e. dissimilarity) matrix DI obtained // from DA by adding a random normally distributed noise with mean 0 // and standard deviation Sigma. For more detail, see Makarenkov and // Legendre (2004), Journal of Computational Biology. void tree_generation(double **DA, double **DI, int n, double Sigma) { struct TABLEAU { int V; } **NUM, **A; int i,j,k,p,a,a1,a2,*L,*L1,n1; double *LON,X0,X,U; //time_t t; n1=n*(n-1)/2; L=(int *)malloc((2*n-2)*sizeof(int)); L1=(int *)malloc((2*n-2)*sizeof(int)); LON=(double *)malloc((2*n-2)*sizeof(double)); NUM=(TABLEAU **)malloc((2*n-2)*sizeof(TABLEAU*)); A=(TABLEAU **)malloc((n1+1)*sizeof(TABLEAU*)); for (i=0;i<=n1;i++) { A[i]=(TABLEAU*)malloc((2*n-2)*sizeof(TABLEAU)); if (i<=2*n-3) NUM[i]=(TABLEAU*)malloc((n+1)*sizeof(TABLEAU)); if ((A[i]==NULL)||((i<=2*n-3)&&(NUM[i]==NULL))) { printf("\nData matrix is too large\n"); exit(1); } } /* Generation of a random additive tree topology T*/ for (j=1;j<=2*n-3;j++) { for (i=1;i<=n;i++) { A[i][j].V=0; NUM[j][i].V=0; } for (i=n+1;i<=n1;i++) A[i][j].V=0; } A[1][1].V=1; L[1]=1; L1[1]=2; NUM[1][1].V=1; NUM[1][2].V=0; // srand((unsigned) time(&t)); for (k=2;k<=n-1;k++) { p=(rand() % (2*k-3))+1; for (i=1;i<=(n*(k-2)-(k-1)*(k-2)/2+1);i++) A[i][2*k-2].V=A[i][p].V; for (i=1;i<=k;i++) { a=n*(i-1)-i*(i-1)/2+k+1-i; if (NUM[p][i].V==0) A[a][2*k-2].V=1; else A[a][p].V=1; } for (i=1;i<=k;i++) { a=n*(i-1)-i*(i-1)/2+k+1-i; A[a][2*k-1].V=1; } for (j=1;j<=k;j++) { if (j==L[p]) { for (i=1;i<=2*k-3;i++) { if (i!=p) { if (L1[p]>L[p]) a=floor1((n-0.5*L[p])*(L[p]-1)+L1[p]-L[p]); else a=floor1((n-0.5*L1[p])*(L1[p]-1)+L[p]-L1[p]); if (A[a][i].V==1) { if (NUM[i][L[p]].V==0) a=floor1((n-0.5*L[p])*(L[p]-1)+k+1-L[p]); else a=floor1((n-0.5*L1[p])*(L1[p]-1)+k+1-L1[p]); A[a][i].V=1; } } } } else if (j!=L1[p]) { a=floor1((n-0.5*j)*(j-1)+k+1-j); if (j<L[p]) a1=floor1((n-0.5*j)*(j-1)+L[p]-j); else a1=floor1((n-0.5*L[p])*(L[p]-1)+j-L[p]); if (j<L1[p]) a2=floor1((n-0.5*j)*(j-1)+L1[p]-j); else a2=floor1((n-0.5*L1[p])*(L1[p]-1)+j-L1[p]); for (i=1;i<=2*k-3;i++) { if ((i!=p)&&((A[a1][i].V+A[a2][i].V==2)||((NUM[i][j].V+NUM[i][L[p]].V==0)&&(A[a2][i].V==1))||((NUM[i][j].V+NUM[i][L1[p]].V==0)&&(A[a1][i].V==1)))) A[a][i].V=1; } } } for (i=1;i<=k;i++) NUM[2*k-2][i].V=NUM[p][i].V; NUM[2*k-2][k+1].V=1; for (i=1;i<=k;i++) NUM[2*k-1][i].V=1; for (i=1;i<=2*k-3;i++) { if (((NUM[i][L[p]].V+NUM[i][L1[p]].V)!=0)&&(i!=p)) NUM[i][k+1].V=1; } L[2*k-2]=k+1; L1[2*k-2]=L1[p]; L[2*k-1]=L1[p]; L1[2*k-1]=k+1; L1[p]=k+1; } //srand((unsigned) time(&t)); // Exponential distribution generator with expectation 1/(2n-3) // 1. Generate U~U(0,1) // 2. Compute X = -ln(U)/lambda // 3. To obtain an exponential distribution with theoretical mean (= "expected // value") of 1/(2n-3), use lambda = 1 and multiply X by 1/(2n-3): // Thus, X = -(1/(2n-3))*ln(U) // This formula is given in Numerical Recipes, p.200.*/ // Every branch length of the tree T is then multiplied by 1+aX, // where X followed the standard exponential distribution (P(X>n)=exp(-n)) and // "a" is a tuning factor to adjust the deviation from the molecular clock; "a" is set at 0.8. // 4. LON[i] = LON[i]*(1+0.8*-ln(U)) U = 0.1; while (U<0.1) U = 1.0*rand()/RAND_MAX; for (i=1;i<=2*n-3;i++) LON[i] = -1.0/(2*n-3)*log(U); //for (i=1;i<=2*n-3;i++) i=1; while (i<=2*n-3) { U = 1.0*rand()/RAND_MAX; LON[i] = 1.0*LON[i]*(1.0+0.8*(-log(U))); LON[i] = LON[i]*0.8; ///5.0 ;//0.8 if (LON[i]>2*epsilona) i++;/*printf("U=%f LON[%d]=%f \n",U,i,LON[i]);*/} // Computation of a tree distance matrix (tree metric matrix) for (i=1;i<=n;i++) { DA[i][i]=0; for (j=i+1;j<=n;j++) { DA[i][j]=0; a=floor1((n-0.5*i)*(i-1)+j-i); for (k=1;k<=2*n-3;k++) if (A[a][k].V==1) DA[i][j]=DA[i][j]+LON[k]; DA[j][i]=DA[i][j]; } } // Normalisation of the tree distance matrix /* Addition of noise to the tree metric */ //srand((unsigned) time(&t)); for (i=1;i<=n;i++) { DI[i][i]=0.0; for (j=i+1;j<=n;j++) { X=0.0; for (k=1;k<=5;k++) { X0 = 1.0*rand()/RAND_MAX; X=X+0.0001*X0; } X=2*sqrt(0.6)*(X-2.5); U=X-0.01*(3*X-X*X*X); DI[i][j]=DA[i][j]+Sigma*U; if (DI[i][j]<0) DI[i][j]=0.01; DI[j][i]=DI[i][j]; } } free (L); free(L1); free(LON); for (i=0;i<=n1;i++) { free(A[i]); if (i<=2*n-3) free(NUM[i]); } free(NUM); free(A); } int floor1(double x) { int i; if (ceil(x)-floor(x)==2) i=(int)x; else if (fabs(x-floor(x)) > fabs(x-ceil(x))) i=(int)ceil(x); else i=(int)floor(x); return i; } /**************************************************** * application de la m�thode NJ pour construire * une matrice additive ****************************************************/ void NJ(double **D1,double **DA) { double **D,*T1,*S,*LP,Som,Smin,Sij,L,Lii,Ljj,l1,l2,l3,epsilona = 0.00005; int *T,i,j,ii,jj,n1; D=(double **) malloc((n+1)*sizeof(double*)); T1=(double *) malloc((n+1)*sizeof(double)); S=(double *) malloc((n+1)*sizeof(double)); LP=(double *) malloc((n+1)*sizeof(double)); T=(int *) malloc((n+1)*sizeof(int)); for (i=0;i<=n;i++) { D[i]=(double*)malloc((n+1)*sizeof(double)); if (D[i]==NULL) { { printf("Data matrix is too large"); return;} } } L=0; Som=0; for (i=1;i<=n;i++) { S[i]=0; LP[i]=0; for (j=1;j<=n;j++) { D[i][j]=D1[i][j]; S[i]=S[i]+D[i][j]; } Som=Som+S[i]/2; T[i]=i; T1[i]=0; } /* Procedure principale */ for (n1=n;n1>3;n1--) { /* Recherche des plus proches voisins */ Smin=2*Som; for (i=1;i<=n1-1;i++) { for (j=i+1;j<=n1;j++) { Sij=2*Som-S[i]-S[j]+D[i][j]*(n1-2); if (Sij<Smin) { Smin=Sij; ii=i; jj=j; } } } /* Nouveau groupement */ Lii=(D[ii][jj]+(S[ii]-S[jj])/(n1-2))/2-LP[ii]; Ljj=(D[ii][jj]+(S[jj]-S[ii])/(n1-2))/2-LP[jj]; /* Mise a jour de D */ if (Lii<2*epsilona) Lii=2*epsilona; if (Ljj<2*epsilona) Ljj=2*epsilona; L=L+Lii+Ljj; LP[ii]=0.5*D[ii][jj]; Som=Som-(S[ii]+S[jj])/2; for (i=1;i<=n1;i++) { if ((i!=ii)&&(i!=jj)) { S[i]=S[i]-0.5*(D[i][ii]+D[i][jj]); D[i][ii]=(D[i][ii]+D[i][jj])/2; D[ii][i]=D[i][ii]; } } D[ii][ii]=0; S[ii]=0.5*(S[ii]+S[jj])-D[ii][jj]; if (jj!=n1) { for (i=1;i<=n1-1;i++) { D[i][jj]=D[i][n1]; D[jj][i]=D[n1][i]; } D[jj][jj]=0; S[jj]=S[n1]; LP[jj]=LP[n1]; } /* Mise a jour de DA */ for (i=1;i<=n;i++) { if (T[i]==ii) T1[i]=T1[i]+Lii; if (T[i]==jj) T1[i]=T1[i]+Ljj; } for (j=1;j<=n;j++) { if (T[j]==jj) { for (i=1;i<=n;i++) { if (T[i]==ii) { DA[i][j]=T1[i]+T1[j]; DA[j][i]=DA[i][j]; } } } } for (j=1;j<=n;j++) if (T[j]==jj) T[j]=ii; if (jj!=n1) { for (j=1;j<=n;j++) if (T[j]==n1) T[j]=jj; } } /*Il reste 3 sommets */ l1=(D[1][2]+D[1][3]-D[2][3])/2-LP[1]; l2=(D[1][2]+D[2][3]-D[1][3])/2-LP[2]; l3=(D[1][3]+D[2][3]-D[1][2])/2-LP[3]; if (l1<2*epsilona) l1=2*epsilona; if (l2<2*epsilona) l2=2*epsilona; if (l3<2*epsilona) l3=2*epsilona; L=L+l1+l2+l3; for (j=1;j<=n;j++) { for (i=1;i<=n;i++) { if ((T[j]==1)&&(T[i]==2)) { DA[i][j]=T1[i]+T1[j]+l1+l2; DA[j][i]=DA[i][j]; } if ((T[j]==1)&&(T[i]==3)) { DA[i][j]=T1[i]+T1[j]+l1+l3; DA[j][i]=DA[i][j]; } if ((T[j]==2)&&(T[i]==3)) { DA[i][j]=T1[i]+T1[j]+l2+l3; DA[j][i]=DA[i][j]; } } DA[j][j]=0; } free(T); free(T1); free(S); free(LP); for (i=0;i<=n;i++) { free(D[i]); } free(D); } /* La recherche d'un ordre diagonal plan */ void odp(double **D,int *X,int *i1,int *j1) { double S1,S; int i,j,k,a,*Y1; Y1=(int *) malloc((n+1)*sizeof(int)); for(i=1;i<=n;i++) Y1[i]=1; X[1]=*i1; X[n]=*j1; if (n==2) return; Y1[*i1]=0; Y1[*j1]=0; for(i=0;i<=n-3;i++) { a=2; S=0; for(j=1;j<=n;j++) { if (Y1[j]>0) { S1= D[X[n-i]][X[1]]-D[j][X[1]]+D[X[n-i]][j]; if ((a==2)||(S1<=S)) { S=S1; a=1; X[n-i-1]=j; k=j; } } } Y1[k]=0; } free(Y1); } /* Calcule les tableaux ARETE et LONGUEUR contenant les aretes et leur longueurs a partir d'une matrice de distance d'arbre DI de taille n par n; la fonction auxiliaire odp est appell�e une fois */ void Tree_edges (double **DI, long int *ARETE, double *LONGUEUR) { struct EDGE { unsigned int U; unsigned int V; double LN;}; struct EDGE *Path,*Tree; int i,j,k,p,P,*X; double S,DIS,DIS1,*L,**D; X=(int *)malloc((n+1)*sizeof(int)); L=(double *)malloc((n+1)*sizeof(double)); Tree=(EDGE *)malloc((2*n-2)*sizeof(EDGE)); Path=(EDGE *)malloc((n+2)*sizeof(EDGE)); D=(double **) malloc((n+1)*sizeof(double*)); for (i=0;i<=n;i++) { D[i]=(double*)malloc((n+1)*sizeof(double)); if (D[i]==NULL) { printf("Data matrix is too large"); exit(1); } } i=1; j=n; odp1ct(DI,X,&i,&j,n); for (i=1;i<=n;i++) { for (j=1;j<=n;j++) D[i][j]=DI[i][j]; } /* Verification de l'equivalence des topologies */ L[1]=D[X[1]][X[2]]; Path[1].U=X[1]; Path[1].V=X[2]; p=0; P=1; for(k=2;k<=n-1;k++) { DIS=(D[X[1]][X[k]]+D[X[1]][X[k+1]]-D[X[k]][X[k+1]])/2; DIS1=(D[X[1]][X[k+1]]+D[X[k]][X[k+1]]-D[X[1]][X[k]])/2; S=0.0; i=0; if (DIS>2*epsilona) { while (S<DIS-epsilona) { i=i+1; S=S+L[i]; } } else { DIS=0; i=1; } Tree[p+1].U=n+k-1; Tree[p+1].V=Path[i].V; Tree[p+1].LN=S-DIS; if (Tree[p+1].LN<2*epsilona) Tree[p+1].LN=epsilona; for (j=i+1;j<=P;j++) { Tree[p+j-i+1].U=Path[j].U; Tree[p+j-i+1].V=Path[j].V; Tree[p+j-i+1].LN=L[j]; if (L[j]<2*epsilona) L[j]=2*epsilona; } p=p+P-i+1; Path[i].V=n+k-1; Path[i+1].U=n+k-1; Path[i+1].V=X[k+1]; L[i]=L[i]+DIS-S; L[i+1]=DIS1; P=i+1; } for (i=1;i<=P;i++) { Tree[p+i].U=Path[i].U; Tree[p+i].V=Path[i].V; Tree[p+i].LN=L[i]; } for (i=1;i<=2*n-3;i++) { if (fabs(Tree[i].LN-epsilona)<=2*epsilona) Tree[i].LN=0.0; ARETE[2*i-2]=Tree[i].U; ARETE[2*i-1]=Tree[i].V; LONGUEUR[i-1]=Tree[i].LN; if (LONGUEUR[i-1]<2*epsilona) LONGUEUR[i-1] = 2*epsilona; } free(X); free(Tree); free(L); free(Path); for (i=0;i<=n;i++) free(D[i]); free(D); } /* Fonction auxiliaire odp. La recherche d'un ordre diagonal plan */ void odp1ct(double **D, int *X, int *i1, int *j1, int n) { double S1,S; int i,j,k,a,*Y1; Y1=(int *) malloc((n+1)*sizeof(int)); for(i=1;i<=n;i++) Y1[i]=1; X[1]=*i1; X[n]=*j1; if (n==2) return; Y1[*i1]=0; Y1[*j1]=0; for(i=0;i<=n-3;i++) { a=2; S=0; for(j=1;j<=n;j++) { if (Y1[j]>0) { S1= D[X[n-i]][X[1]]-D[j][X[1]]+D[X[n-i]][j]; if ((a==2)||(S1<=S)) { S=S1; a=1; X[n-i-1]=j; k=j; } } } Y1[k]=0; } free(Y1); } void SAVEASNewick(double *LONGUEUR, long int *ARETE,int nn,const char* t) { int n,root,a; int Ns; int i, j, sd, sf, *Suc, *Fre, *Tree, *degre, *Mark; double *Long; int *boot; char *string = (char*)malloc(100000); n = nn; Ns=2*n-3; double * bootStrap= NULL; Suc =(int*) malloc((2*n) * sizeof(int)); Fre =(int*) malloc((2*n) * sizeof(int)); degre =(int*) malloc((2*n) * sizeof(int)); Long = (double*) malloc((2*n) * sizeof(double)); boot = (int*) malloc((2*n) * sizeof(int)); Tree = (int*) malloc((2*n) * sizeof(int)); Mark =(int*) malloc((2*n) * sizeof(int)); if ((degre==NULL)||(Mark==NULL)||(string==NULL)||(Suc==NULL)||(Fre==NULL)||(Long==NULL)||(Tree==NULL)||(ARETE==NULL)||(LONGUEUR==NULL)) { printf("Tree is too large to be saved"); return;} for (i=1;i<=2*n-3;i++) { if (i<=n) degre[i]=1; else degre[i]=3; } degre[2*n-2]=3; root=Ns+1; int cpt=0; for (;;) { cpt++; if(cpt > 1000000) exit(1); a=0; a++; for (j=1;j<=2*n-2;j++) Mark[j]=0; for (i=1;i<=2*n-3;i++) { if ((degre[ARETE[2*i-2]]==1)&&(degre[ARETE[2*i-1]]>1)&&(Mark[ARETE[2*i-1]]==0)&&(Mark[ARETE[2*i-2]]==0)) { Tree[ARETE[2*i-2]]=ARETE[2*i-1]; degre[ARETE[2*i-1]]--; degre[ARETE[2*i-2]]--; Mark[ARETE[2*i-1]]=1; Mark[ARETE[2*i-2]]=1; Long[ARETE[2*i-2]]=LONGUEUR[i-1]; if(bootStrap != NULL) boot[ARETE[2*i-2]] = (int) bootStrap[i-1]; } else if ((degre[ARETE[2*i-1]]==1)&&(degre[ARETE[2*i-2]]>1)&&(Mark[ARETE[2*i-1]]==0)&&(Mark[ARETE[2*i-2]]==0)) { Tree[ARETE[2*i-1]]=ARETE[2*i-2]; degre[ARETE[2*i-1]]--; degre[ARETE[2*i-2]]--; Mark[ARETE[2*i-1]]=1; Mark[ARETE[2*i-2]]=1; Long[ARETE[2*i-1]]=LONGUEUR[i-1]; if(bootStrap != NULL) boot[ARETE[2*i-1]] = (int) bootStrap[i-1]; } else if ((degre[ARETE[2*i-2]]==1)&&(degre[ARETE[2*i-1]]==1)&&(Mark[ARETE[2*i-2]]==0)&&(Mark[ARETE[2*i-1]]==0)) { Tree[ARETE[2*i-2]]=ARETE[2*i-1]; root=ARETE[2*i-1]; degre[ARETE[2*i-1]]--; degre[ARETE[2*i-2]]--; a=-1; Long[ARETE[2*i-2]]=LONGUEUR[i-1]; if(bootStrap != NULL) boot[ARETE[2*i-2]] = (int) bootStrap[i-1]; } if (a==-1) break; } if (a==-1) break; } /* On decale et on complete la structure d'arbre avec Successeurs et Freres */ for (i=Ns+1;i>0;i--) { Fre[i]=0; Suc[i]=0; } Tree[root]=0;/*Tree[Ns+1]=0;*/ for (i=1;i<=Ns+1/*Ns*/;i++) { if (i!=root) { sd=i; sf=Tree[i]; if (Suc[sf]==0) Suc[sf]=sd; else { sf=Suc[sf]; while (Fre[sf]>0) sf=Fre[sf]; Fre[sf]=sd; } } } /* On compose la chaine parenthesee */ string[0]=0; i=root;/*i=Ns+1;*/ cpt=0; for (;;) { if(cpt > 1000000) exit(1); if (Suc[i]>0) { sprintf(string,"%s(",string); Suc[i]=-Suc[i]; i=-Suc[i]; } else if (Fre[i]!=0) { if (Suc[i]==0) sprintf(string,"%s%d:%.4f,",string,i,Long[i]); else { if(bootStrap != NULL) sprintf(string,"%s%d:%.4f,",string,boot[i],Long[i]); else sprintf(string,"%s:%.4f,",string,Long[i]); } i=Fre[i]; } else if (Tree[i]!=0) { if (Suc[i]==0) sprintf(string,"%s%d:%.4f)",string,i,Long[i]); else { if(bootStrap != NULL) sprintf(string,"%s%d:%.4f)",string,boot[i],Long[i]); else sprintf(string,"%s:%.4f)",string,Long[i]); } i=Tree[i]; } else break; } strcat(string,";"); FILE *pt_t = fopen(t,"a+"); fprintf(pt_t,"%s\n",string); fclose(pt_t); free(Suc); free(Fre); free(Tree); free(Long); free(degre); free(Mark); free(string); } //===================================================================== // //===================================================================== int ExtraireDonneesLC(const char * chaine, char *champs, char * contenu){ int cpt=0; int tailleChaine; if(chaine[0] != '-'){ return 0; }else{ tailleChaine = (int)strlen(chaine); for(int i=0;i<tailleChaine;i++){ champs[i] = chaine[i+1]; } } return 1; } void validation(int &intParam){ while(intParam<0 || intParam>19){ cout<<endl; cout<<"Invalid Parameter. Please enter again. "<<endl; cout<<"1 : K-medoid (with criterion CH) "<<endl; cout<<"2 : K-medoid (with criterion CH and RF squared) "<<endl; cout<<"3 : K-medoid (with criterion SH) "<<endl; cout<<"4 : K-medoid (with criterion SH and RF squared) "<<endl; cout<<"0 : EXIT"<<endl; cin>>intParam; } if(intParam==0){ cout<<"====END OF PROGRAM!===="<<endl; exit(0); } }
[ "noreply@github.com" ]
NadiaTahiri.noreply@github.com
d356ecf9dd8f7fefe72a671bb30fc7b53627697b
46a270c50ca6d41d92c085aad2d8f8dfa3dc55df
/tafjce/Zone/Include/Legion/IBossFactory.h
14db6e602c33ba0cf1b2d486e52aa2d1eea180cb
[]
no_license
PenpenLi/YXLDGameServer
74e4eb05215373121029beefb9712f94b0488aea
6f6e709271a0f47aa8d55226fed436308aae2365
refs/heads/master
2022-10-20T15:49:13.793932
2020-07-15T07:50:00
2020-07-15T07:50:00
279,802,517
0
0
null
2020-07-15T07:49:15
2020-07-15T07:49:14
null
GB18030
C++
false
false
1,317
h
#ifndef __IBOSS_FACTORY_H__ #define __IBOSS_FACTORY_H__ #include "IFightSystem.h" typedef TC_Functor<void, TL::TLMaker<taf::Int32, const ServerEngine::BattleData&, int>::Result> DelegateBossFight; struct BossDamageRecord { BossDamageRecord():iDamageValue(0){} ServerEngine::PKRole roleKey; string strName; int iDamageValue; }; class IBoss:public IObject, public Detail::EventHandle { public: virtual bool AsynFightBoss(Uint32 dwActor, const ServerEngine::AttackBossCtx& attackCtx, DelegateBossFight cb) = 0; virtual int getBossHP() = 0; virtual int getBossMaxHP() = 0; virtual void getDamageRankList(int iLimitSize, vector<BossDamageRecord>& rankList) = 0; virtual bool getKiller(ServerEngine::PKRole& roleKey, string& strName) = 0; virtual int getDamage(const string& strName) = 0; virtual Uint32 getCreateTime() = 0; virtual int getVisibleMonsterID() = 0; }; class IBossFactory:public IComponent { public: // 功能: 创建BOSS // 参数: [iMonsterGrp] 怪物组 // 参数: [pFixCtx] 创建现场 virtual IBoss* createBoss(int iMonsterGrp, const ServerEngine::CreateBossCtx& bossCtx) = 0; // 功能: 删除BOSS // 参数: [pBoss] BOSS对象 virtual void delBoss(IBoss* pBoss) = 0; virtual void saveWorldBossData(bool bSync) = 0; virtual bool isInitFinish() = 0; }; #endif
[ "fengmm521@gmail.com" ]
fengmm521@gmail.com
d809389284d1125c6e06d7e5143e3cfb38134a2d
b71b8bd385c207dffda39d96c7bee5f2ccce946c
/testcases/CWE23_Relative_Path_Traversal/s01/CWE23_Relative_Path_Traversal__char_console_fopen_16.cpp
d1183abff81de5caaf9ecac276335f94d9014abf
[]
no_license
Sporknugget/Juliet_prep
e9bda84a30bdc7938bafe338b4ab2e361449eda5
97d8922244d3d79b62496ede4636199837e8b971
refs/heads/master
2023-05-05T14:41:30.243718
2021-05-25T16:18:13
2021-05-25T16:18:13
369,334,230
0
0
null
null
null
null
UTF-8
C++
false
false
3,554
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__char_console_fopen_16.cpp Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-16.tmpl.cpp */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: console Read input from the console * GoodSource: Use a fixed file name * Sink: fopen * BadSink : Open the file named in data using fopen() * Flow Variant: 16 Control flow: while(1) * * */ #include "std_testcase.h" #ifdef _WIN32 #define BASEPATH "c:\\temp\\" #else #include <wchar.h> #define BASEPATH "/tmp/" #endif #ifdef _WIN32 #define FOPEN fopen #else #define FOPEN fopen #endif namespace CWE23_Relative_Path_Traversal__char_console_fopen_16 { #ifndef OMITBAD void bad() { char * data; char dataBuffer[FILENAME_MAX] = BASEPATH; data = dataBuffer; { { /* Read input from the console */ size_t dataLen = strlen(data); /* if there is room in data, read into it from the console */ if (FILENAME_MAX-dataLen > 1) { /* POTENTIAL FLAW: Read data from the console */ if (fgets(data+dataLen, (int)(FILENAME_MAX-dataLen), stdin) != NULL) { /* The next few lines remove the carriage return from the string that is * inserted by fgets() */ dataLen = strlen(data); if (dataLen > 0 && data[dataLen-1] == '\n') { data[dataLen-1] = '\0'; } } else { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } } } } { FILE *pFile = NULL; /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */ pFile = FOPEN(data, "wb+"); if (pFile != NULL) { fclose(pFile); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() - use goodsource and badsink by changing the conditions on the while statements */ static void goodG2B() { char * data; char dataBuffer[FILENAME_MAX] = BASEPATH; data = dataBuffer; { /* FIX: Use a fixed file name */ strcat(data, "file.txt"); } { FILE *pFile = NULL; /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */ pFile = FOPEN(data, "wb+"); if (pFile != NULL) { fclose(pFile); } } } void good() { goodG2B(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE23_Relative_Path_Traversal__char_console_fopen_16; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
[ "jaredzap@rams.colostate.edu" ]
jaredzap@rams.colostate.edu
48b9597c1bd3810886c1983ec1cbde7f9da23dbe
3749d5ff88b72f7c729e2efb9e31f3fe459010e9
/ThrusterDirection.cpp
1dfe83de44c0c2ac3f89444df9d82b9fe9fd1538
[]
no_license
j-rushton/AUVSeniorDesign
953c119e2f46de4cf93611d288d11169595e0315
b6d07a894e67546d2e47773b143959478b2c9493
refs/heads/master
2021-09-26T08:55:39.475989
2020-04-10T03:53:44
2020-04-10T03:53:44
112,866,248
1
0
null
null
null
null
UTF-8
C++
false
false
4,200
cpp
#include<iostream> #include<cmath> #include<fstream> #include<sstream> #include<vector> #include<typeinfo> #include<time.h> using namespace std; void CSV_file_reader(vector<double> &t, vector<double> &gx, vector<double> &gy, vector<double> &gz, vector<double> &ax, vector<double> &ay, vector<double> &az); int max_angular_vel_mag(vector<double> gyrox, vector<double> gyroy, vector<double> gyroz); int max_linear_acc_mag(vector<double> accelx, vector<double> accely, vector<double> accelz); int main() { int i, av_pos, la_pos; vector<double> t, gx, gy, gz, ax, ay, az; CSV_file_reader(t,gx,gy,gz,ax,ay,az);//This will collect all the data from the csv file. av_pos = max_angular_vel_mag(gx,gy,gz);//This will give us the position where the angular velocity vector's magnitude is maximum la_pos = max_linear_acc_mag(ax,ay,az);//This will give us the position where the linear acceleration vector's magnitude is maximum cout<<"The av position is: "<<av_pos<<endl;//Just printing the position of angular velocity(av) cout<<"The la position is: "<<la_pos<<endl;//same as above cout<<"The angular velocity vector whose magnitude is maximum is: "<<gx[av_pos]<<"i + "<<gy[av_pos]<<"j + "<<gz[av_pos]<<"k"<<" at time t = "<<t[av_pos]/1000000<<" seconds"<<endl; cout<<"The linear acceleration vector whose magnitude is maximum is: "<<ax[la_pos]<<"i + "<<ay[la_pos]<<"j + "<<az[la_pos]<<"k"<<" at time t = "<<t[la_pos]/1000000<<" seconds"<<endl; return 0; } //This will read the data file. void CSV_file_reader(vector<double> &t, vector<double> &gx, vector<double> &gy, vector<double> &gz, vector<double> &ax, vector<double> &ay, vector<double> &az) { int i; double temp=0,angular_velocity_vector[3],linear_acceleration_vector[3]; string time,gyrox,gyroy,gyroz,accelx,accely,accelz; ifstream ip("data.csv"); if(!ip.is_open()) std::cout<<"ERROR: FILE DIDN'T OPEN"<<endl; while(!ip.eof()) { getline(ip,time,','); istringstream stream(time); while (stream >> temp) t.push_back(temp); getline(ip,gyrox,','); istringstream stream1(gyrox); while (stream1 >> temp) gx.push_back(temp); getline(ip,gyroy,','); istringstream stream2(gyroy); while (stream2 >> temp) gy.push_back(temp); getline(ip,gyroz,','); istringstream stream3(gyroz); while (stream3 >> temp) gz.push_back(temp); getline(ip,accelx,','); istringstream stream4(accelx); while (stream4 >> temp) ax.push_back(temp); getline(ip,accely,','); istringstream stream5(accely); while (stream5 >> temp) ay.push_back(temp); getline(ip,accelz,'\n'); istringstream stream6(accelz); while (stream6 >> temp) az.push_back(temp); } } // This will return the position of the maximum magnitude of the angular velocity vector int max_angular_vel_mag(vector<double> gyrox, vector<double> gyroy, vector<double> gyroz) { double max_item; int maxIndex=0,i; for (i = 0; i < gyrox.size(); ++i) { if (i == 0) max_item = gyrox[i]*gyrox[i] + gyroy[i]*gyroy[i] + gyroz[i]*gyroz[i]; else if ( gyrox[i]*gyrox[i] + gyroy[i]*gyroy[i] + gyroz[i]*gyroz[i] >= max_item) { maxIndex = i; max_item = gyrox[i]*gyrox[i] + gyroy[i]*gyroy[i] + gyroz[i]*gyroz[i]; } } return maxIndex; } // This will return the position of the maximum magnitude of the linear acceleration vector int max_linear_acc_mag(vector<double> accelx, vector<double> accely, vector<double> accelz) { double max_item; int maxIndex=0,i; for (i = 0; i < accelx.size(); ++i) if (i == 0) max_item = accelx[i]*accelx[i] + accely[i]*accely[i] + accelz[i]*accelz[i] ; else if ( accelx[i]*accelx[i] + accely[i]*accely[i] + accelz[i]*accelz[i] >= max_item) { maxIndex = i; max_item = accelx[i]*accelx[i] + accely[i]*accely[i] + accelz[i]*accelz[i]; } return maxIndex; }
[ "ishanchavan@users.noreply.github.com" ]
ishanchavan@users.noreply.github.com
2f1f1516354911255e29c9eafce4a53066719d6e
24454e373001e49db71c5048615e039e019ca51e
/vendor/github.com/discordapp/lilliput/deps/osx/include/opencv2/imgcodecs.hpp
e4e858492791c0c75709524abdaf94dc4efc63fc
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
steevee/picfit
b4b6b4c3805352603e8bc1a99c85edfb8840de26
172f24158d0d3ef6e86d77b2475242fc9b83b6c7
refs/heads/master
2021-05-23T07:52:15.471748
2020-02-17T15:40:40
2020-02-17T15:40:40
241,121,910
0
1
MIT
2020-02-17T14:41:15
2020-02-17T14:03:27
null
UTF-8
C++
false
false
20,704
hpp
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #ifndef OPENCV_IMGCODECS_HPP #define OPENCV_IMGCODECS_HPP #include "opencv2/core.hpp" /** @defgroup imgcodecs Image file reading and writing @{ @defgroup imgcodecs_c C API @defgroup imgcodecs_ios iOS glue @} */ //////////////////////////////// image codec //////////////////////////////// namespace cv { //! @addtogroup imgcodecs //! @{ //! Imread flags enum ImreadModes { IMREAD_UNCHANGED = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image. IMREAD_COLOR = 1, //!< If set, always convert image to the 3 channel BGR color image. IMREAD_ANYDEPTH = 2, //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit. IMREAD_ANYCOLOR = 4, //!< If set, the image is read in any possible color format. IMREAD_LOAD_GDAL = 8, //!< If set, use the gdal driver for loading the image. IMREAD_REDUCED_GRAYSCALE_2 = 16, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/2. IMREAD_REDUCED_COLOR_2 = 17, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2. IMREAD_REDUCED_GRAYSCALE_4 = 32, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/4. IMREAD_REDUCED_COLOR_4 = 33, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4. IMREAD_REDUCED_GRAYSCALE_8 = 64, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/8. IMREAD_REDUCED_COLOR_8 = 65, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8. IMREAD_IGNORE_ORIENTATION = 128 //!< If set, do not rotate the image according to EXIF's orientation flag. }; //! Imwrite flags enum ImwriteFlags { IMWRITE_JPEG_QUALITY = 1, //!< For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95. IMWRITE_JPEG_PROGRESSIVE = 2, //!< Enable JPEG features, 0 or 1, default is False. IMWRITE_JPEG_OPTIMIZE = 3, //!< Enable JPEG features, 0 or 1, default is False. IMWRITE_JPEG_RST_INTERVAL = 4, //!< JPEG restart interval, 0 - 65535, default is 0 - no restart. IMWRITE_JPEG_LUMA_QUALITY = 5, //!< Separate luma quality level, 0 - 100, default is 0 - don't use. IMWRITE_JPEG_CHROMA_QUALITY = 6, //!< Separate chroma quality level, 0 - 100, default is 0 - don't use. IMWRITE_PNG_COMPRESSION = 16, //!< For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3. Also strategy is changed to IMWRITE_PNG_STRATEGY_DEFAULT (Z_DEFAULT_STRATEGY). IMWRITE_PNG_STRATEGY = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_DEFAULT. IMWRITE_PNG_BILEVEL = 18, //!< Binary level PNG, 0 or 1, default is 0. IMWRITE_PXM_BINARY = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1. IMWRITE_WEBP_QUALITY = 64, //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used. IMWRITE_PAM_TUPLETYPE = 128,//!< For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format }; //! Imwrite PNG specific flags used to tune the compression algorithm. /** These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage. - The effect of IMWRITE_PNG_STRATEGY_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between IMWRITE_PNG_STRATEGY_DEFAULT and IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY. - IMWRITE_PNG_STRATEGY_RLE is designed to be almost as fast as IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY, but give better compression for PNG image data. - The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. - IMWRITE_PNG_STRATEGY_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. */ enum ImwritePNGFlags { IMWRITE_PNG_STRATEGY_DEFAULT = 0, //!< Use this value for normal data. IMWRITE_PNG_STRATEGY_FILTERED = 1, //!< Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2, //!< Use this value to force Huffman encoding only (no string match). IMWRITE_PNG_STRATEGY_RLE = 3, //!< Use this value to limit match distances to one (run-length encoding). IMWRITE_PNG_STRATEGY_FIXED = 4 //!< Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. }; //! Imwrite PAM specific tupletype flags used to define the 'TUPETYPE' field of a PAM file. enum ImwritePAMFlags { IMWRITE_PAM_FORMAT_NULL = 0, IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1, IMWRITE_PAM_FORMAT_GRAYSCALE = 2, IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3, IMWRITE_PAM_FORMAT_RGB = 4, IMWRITE_PAM_FORMAT_RGB_ALPHA = 5, }; /** * @brief Picture orientation which may be taken from EXIF * Orientation usually matters when the picture is taken by * smartphone or other camera with orientation sensor support * Corresponds to EXIF 2.3 Specification */ enum ImageOrientation { IMAGE_ORIENTATION_TL = 1, ///< Horizontal (normal) IMAGE_ORIENTATION_TR = 2, ///< Mirrored horizontal IMAGE_ORIENTATION_BR = 3, ///< Rotate 180 IMAGE_ORIENTATION_BL = 4, ///< Mirrored vertical IMAGE_ORIENTATION_LT = 5, ///< Mirrored horizontal & rotate 270 CW IMAGE_ORIENTATION_RT = 6, ///< Rotate 90 CW IMAGE_ORIENTATION_RB = 7, ///< Mirrored horizontal & rotate 90 CW IMAGE_ORIENTATION_LB = 8 ///< Rotate 270 CW }; /** @brief Decodes an image so that it can be rendered as pixels * * This class should not be constructed directly. Instead, use * one of the findDecoder methods to create a new decoder. * * Once created, the decoder should have setSource called * with the source of the image. * * Next, call readHeader() to load the image metadata. This * populates the height/width/type fields. * * Finally, use readData() to decode the image into a * Mat where the pixels should be stored */ class CV_EXPORTS ImageDecoder { public: ImageDecoder(); ImageDecoder(const ImageDecoder& d); ImageDecoder& operator = (const ImageDecoder& d); /** @brief Create an ImageDecoder that can decode the contents pointed at by filename * @param[in] filename File to search * * This method *does not* inspect the extension of the filename, only the contents * in the file itself. So if image.jpg actually contains PNG data, then the * appropriate PNG decoder will be returned when ImageDecoder("image.jpg") is called. * * @return Image decoder to parse image file. */ ImageDecoder( const String& filename ); /** @brief Create an ImageDecoder that can decode the encoded contents of buf * @param[in] buf vector of encoded bytes * * @return Image decoder to parse image file. */ ImageDecoder( const Mat& buf ); ~ImageDecoder(); /** Read the image metadata from the decoder source. * Call after setSource has been called * Sets decoder width, height, type * Returns true on success */ bool readHeader(); /** Read the image data from the decoder source. * Loads deserialized pixels into img, which should be large enough * to store entire image. * Returns true on success */ bool readData( Mat& img ); /** Get image width. Only returns successfully after readHeader() has been called. */ int width() const; /** Get image height. Only returns successfully after readHeader() has been called. */ int height() const; /** Get image pixel data type. Only returns successfully after readHeader() has been called. */ int type() const; /** Get the image's orientation, as set by its metadata, if any */ int orientation() const; int setScale( const int& scale_denom ); /// Called after readData to advance to the next page, if any. bool nextPage(); /* Get the description for this instance of ImageDecoder */ String getDescription() const; bool empty() const; operator bool() const; bool operator!() const; class Impl; ImageDecoder(const String& filename, Ptr<Impl> i); ImageDecoder(const Mat& buf, Ptr<Impl> i); protected: Ptr<Impl> p; }; /** @brief Encodes pixels into an image format * * This class should not be constructed directly. Instead, use * findEncoder to construct an Encoder for a particular type of image. */ class CV_EXPORTS ImageEncoder { public: ImageEncoder(); ImageEncoder(const ImageEncoder& d); ImageEncoder& operator = (const ImageEncoder& d); /** @brief Create an ImageEncoder that can encode pixels into a specific format * @param[in] _ext hint for encoder type * @param[in] filename where to save encoded image * * @return Image encoder to encode image file. */ ImageEncoder( const String& _ext, const String& filename ); /** @brief Create an ImageEncoder that can encode pixels into a specific format * @param[in] _ext hint for encoder type * @param[in] buf where to save encoded image * * @return Image encoder to encode image file. */ ImageEncoder( const String& _ext, Mat& buf ); ~ImageEncoder(); bool isFormatSupported( int depth ) const; /** Write the pixels contained by img into the image destination. * params accepts the same params as imwrite */ bool write( const Mat& img, InputArray params ); /* Get the description for this instance of ImageEncoder */ String getDescription() const; void throwOnEror() const; bool empty() const; operator bool() const; bool operator!() const; class Impl; ImageEncoder(const String& filename, Ptr<Impl> i); ImageEncoder(Mat& buf, Ptr<Impl> i); protected: Ptr<Impl> p; }; /** @brief Applies the orientation transform specified by orientation * @param[in] orientation a valid orientation value * @param[in] img a Mat containing an image to orient */ CV_EXPORTS_W void OrientationTransform(int orientation, Mat& img); /** @brief Loads an image from a file. @anchor imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported: - Windows bitmaps - \*.bmp, \*.dib (always supported) - JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Notes* section) - JPEG 2000 files - \*.jp2 (see the *Notes* section) - Portable Network Graphics - \*.png (see the *Notes* section) - WebP - \*.webp (see the *Notes* section) - Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported) - Sun rasters - \*.sr, \*.ras (always supported) - TIFF files - \*.tiff, \*.tif (see the *Notes* section) - OpenEXR Image files - \*.exr (see the *Notes* section) - Radiance HDR - \*.hdr, \*.pic (always supported) - Raster and Vector geospatial data supported by Gdal (see the *Notes* section) @note - The function determines the type of an image by the content, not by the file extension. - In the case of color images, the decoded images will have the channels stored in **B G R** order. - On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware that currently these native image loaders give images with different pixel values because of the color management embedded into MacOSX. - On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake. - In the case you set *WITH_GDAL* flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image, then [GDAL](http://www.gdal.org) driver will be used in order to decode the image by supporting the following formats: [Raster](http://www.gdal.org/formats_list.html), [Vector](http://www.gdal.org/ogr_formats.html). - If EXIF information are embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flag @ref IMREAD_IGNORE_ORIENTATION is passed. @param filename Name of file to be loaded. @param flags Flag that can take values of cv::ImreadModes */ CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR ); /** @brief Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects. @param filename Name of file to be loaded. @param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR. @param mats A vector of Mat objects holding each page, if more than one. @sa cv::imread */ CV_EXPORTS_W bool imreadmulti(const String& filename, std::vector<Mat>& mats, int flags = IMREAD_ANYCOLOR); /** @brief Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). Only 8-bit (or 16-bit unsigned (CV_16U) in case of PNG, JPEG 2000, and TIFF) single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function. If the format, depth or channel order is different, use Mat::convertTo , and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O functions to save the image to XML or YAML format. It is possible to store PNG images with an alpha channel using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535. The sample below shows how to create such a BGRA image and store to PNG file. It also demonstrates how to set custom compression parameters : @code #include <opencv2/opencv.hpp> using namespace cv; using namespace std; void createAlphaMat(Mat &mat) { CV_Assert(mat.channels() == 4); for (int i = 0; i < mat.rows; ++i) { for (int j = 0; j < mat.cols; ++j) { Vec4b& bgra = mat.at<Vec4b>(i, j); bgra[0] = UCHAR_MAX; // Blue bgra[1] = saturate_cast<uchar>((float (mat.cols - j)) / ((float)mat.cols) * UCHAR_MAX); // Green bgra[2] = saturate_cast<uchar>((float (mat.rows - i)) / ((float)mat.rows) * UCHAR_MAX); // Red bgra[3] = saturate_cast<uchar>(0.5 * (bgra[1] + bgra[2])); // Alpha } } } int main(int argv, char **argc) { // Create mat with alpha channel Mat mat(480, 640, CV_8UC4); createAlphaMat(mat); vector<int> compression_params; compression_params.push_back(IMWRITE_PNG_COMPRESSION); compression_params.push_back(9); try { imwrite("alpha.png", mat, compression_params); } catch (cv::Exception& ex) { fprintf(stderr, "Exception converting image to PNG format: %s\n", ex.what()); return 1; } fprintf(stdout, "Saved PNG file with alpha data.\n"); return 0; } @endcode @param filename Name of the file. @param img Image to be saved. @param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags */ CV_EXPORTS_W bool imwrite( const String& filename, InputArray img, const std::vector<int>& params = std::vector<int>()); /** @brief Reads an image from a buffer in memory. The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or contains invalid data, the function returns an empty matrix ( Mat::data==NULL ). See cv::imread for the list of supported formats and flags description. @note In the case of color images, the decoded images will have the channels stored in **B G R** order. @param buf Input array or vector of bytes. @param flags The same flags as in cv::imread, see cv::ImreadModes. */ CV_EXPORTS_W Mat imdecode( InputArray buf, int flags ); /** @overload @param buf @param flags @param dst The optional output placeholder for the decoded matrix. It can save the image reallocations when the function is called repeatedly for images of the same size. */ CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst); /** @brief Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description. @param ext File extension that defines the output format. @param img Image to be written. @param buf Output buffer resized to fit the compressed image. @param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags. */ CV_EXPORTS_W bool imencode( const String& ext, InputArray img, CV_OUT std::vector<uchar>& buf, const std::vector<int>& params = std::vector<int>()); //! @} imgcodecs } // cv #endif //OPENCV_IMGCODECS_HPP
[ "m@edouard.paris" ]
m@edouard.paris
f6ee5d1a08f2f5724887d965f702d175a8b3549e
be290e9e622a69280e6780862775d1ef9570d1d9
/Assignment 1/Solution/Queue.cpp
21d7c47de222ea4820388659ae57afc187f13624
[]
no_license
nch8501/DSA2
25937ff44bbf520e6dc894db30328eba3aa6eb5b
2b9f7e123c63b0ff679faf5001dd279e688ef563
refs/heads/master
2021-05-11T07:36:41.841080
2018-04-23T01:03:24
2018-04-23T01:03:24
118,022,275
0
0
null
null
null
null
UTF-8
C++
false
false
2,015
cpp
#include "Queue.h" Queue::Queue() { //set all pointers to default values pArray[0] = v1; pArray[1] = v2; pArray[2] = v3; } Queue::Queue(Queue const & other) { //double the size of the queue pArraysize = other.pArraysize*2; //create the queue pArray = new int[pArraysize]; //copy the number of elements and the index elements = other.elements; lastElementIndex = other.lastElementIndex; //copy over all elements for (int i = 0; i < elements; i++) { pArray[i] = other.pArray[i]; } } Queue & Queue::operator=(Queue const & other) { if (this != &other) { //double the size of the queue pArraysize = other.pArraysize; //create the queue pArray = new int[pArraysize]; //copy the number of elements and the index elements = other.elements; lastElementIndex = other.lastElementIndex; //copy over all elements for (int i = 0; i < elements; i++) { pArray[i] = other.pArray[i]; } } return *this; } Queue::~Queue() { } void Queue::Push(int element, Queue original) { //check if the queue is full if (isFull()) { //make a new Queue Queue temp(original); original = temp; } pArray[lastElementIndex + 1] = element; lastElementIndex++; elements++; } void Queue::Pop() { //check if queue is empty if (isEmpty()) { std::cout << "Nothing to Pop" << std::endl; return; } //go through each element for (int i = 0; i < lastElementIndex; i++) { //set their index back one pArray[i] = pArray[i + 1]; } //update the index of the last element lastElementIndex--; //update the amount of elements elements--; } int Queue::GetSize() { return elements; } bool Queue::isEmpty() { //check if empty if (elements == 0) { return true; } return false; } bool Queue::isFull() { //check if last element is at the end of the queue if (pArraysize == elements) { return true; } return false; } void Queue::Print() { //print each element for (int i = 0; i < elements; i++) { std::cout << pArray[i] << std::endl; } }
[ "nch8501@rit.edu" ]
nch8501@rit.edu
5623caecb094e42d7a1f9cb165f76470eb68be9d
0976b0df057b01422b1b7bdbe23934b3254f8e05
/MM3.KScanBarWrapper/MM3.KScanBarWrapper/MM3.KScanBarWrapper.cpp
e98343745b3482e96b193ff3c632b859a70ee21f
[]
no_license
popovegor/shtrihm
0b8493dda86562f7f821031f7b7934f1e9000e00
e44bdf58b39eb9fdb644e3cedc11a0797d8b54d4
refs/heads/master
2021-01-10T04:36:46.373690
2012-04-21T21:02:53
2012-04-21T21:02:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,789
cpp
// MM3.KScanBarWrapper.cpp : Defines the entry point for the DLL application. // #pragma once #include "stdafx.h" #include <windows.h> #include "KScanBar.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } typedef struct _MC1DBarCodeType { // 1D BarCode 18 BOOL bCodabar; BOOL bCode11; BOOL bCode39; BOOL bCode93; BOOL bCode128; BOOL bGs1_128; BOOL bUpca; BOOL bUpce; BOOL bUpce1; BOOL bEan8; BOOL bEan13; BOOL bGs1; BOOL bI2of5; BOOL bMatrix2of5; BOOL bMsi; BOOL bPlessey; BOOL bStandard2of5; BOOL bTelepen; }MC1DBarCodeType,* P1DBarCodeType; typedef struct _MC2DBarCodeType { //2D BarCode 14 BOOL bBpo; BOOL bDatamatrix; BOOL bMaxicode; BOOL bPdf417; BOOL bMicroPdf417; BOOL bPlanet; BOOL bQrCode; BOOL bTlc39; BOOL bPostnet; BOOL bAusPost; BOOL bCanadaPost; BOOL bDutchPost; BOOL bJapanPost; BOOL bSwedenPost; }MC2DBarCodeType,* P2DBarCodeType; //CReg m_Reg; DWORD m_nDisplayType; BOOL m_bKeyFlag; BOOL m_bReading; BOOL m_bBeep; DWORD m_nSyncMode; DWORD m_nTimeOut; DWORD m_nSecurityLevel; BOOL m_bXCD; BOOL m_bCenterDecode; BOOL m_b1DDecode; MC1DBarCodeType m_1DBarCode; MC2DBarCodeType m_2DBarCode; extern "C" { typedef void (*OnScanData) (int type, char * data); OnScanData ScanCallback; KSCANREAD kRead; KSCANREADEX kReadEx; int KSCANAPI KScanReadCallBack(LPVOID pRead) { if(ScanCallback != NULL) { ScanCallback(((PKSCANREAD)pRead)->out_Type, ((PKSCANREAD)pRead)->out_Barcode); } return TRUE; } _declspec(dllexport) BOOL ScanInit(OnScanData callback) { BOOL bRet = KScanOpen(6, FALSE, 57600, FALSE, NULL); if(bRet == FALSE) { KScanClose(); Sleep(100); } else { m_nTimeOut = 2; m_nSecurityLevel = 1; // Option m_nSyncMode = 0; m_bXCD = 1; m_bBeep = FALSE; m_bCenterDecode = 0; m_b1DDecode = 0; // 1D BarCode 18 m_1DBarCode.bCodabar = FALSE; m_1DBarCode.bCode11 = FALSE; m_1DBarCode.bCode39 = TRUE; m_1DBarCode.bCode93 = FALSE; m_1DBarCode.bCode128 = TRUE; m_1DBarCode.bGs1_128 = TRUE; m_1DBarCode.bUpca = TRUE; m_1DBarCode.bUpce = TRUE; m_1DBarCode.bUpce1 = FALSE; m_1DBarCode.bEan8 = TRUE; m_1DBarCode.bEan13 = TRUE; m_1DBarCode.bGs1 = FALSE; m_1DBarCode.bI2of5 = FALSE; m_1DBarCode.bMatrix2of5 = FALSE; m_1DBarCode.bMsi = FALSE; m_1DBarCode.bPlessey = FALSE; m_1DBarCode.bStandard2of5 = FALSE; m_1DBarCode.bTelepen = FALSE; // 2D BarCode 14 m_2DBarCode.bBpo = FALSE; m_2DBarCode.bDatamatrix = TRUE; m_2DBarCode.bMaxicode = FALSE; m_2DBarCode.bPdf417 = TRUE; m_2DBarCode.bMicroPdf417 = FALSE; m_2DBarCode.bPlanet = FALSE; m_2DBarCode.bQrCode = FALSE; m_2DBarCode.bTlc39 = FALSE; m_2DBarCode.bPostnet = FALSE; m_2DBarCode.bAusPost = FALSE; m_2DBarCode.bCanadaPost = FALSE; m_2DBarCode.bDutchPost = FALSE; m_2DBarCode.bJapanPost = FALSE; m_2DBarCode.bSwedenPost = FALSE; memset(&kRead, 0, sizeof(kRead)); // initialization kRead.nSize = sizeof(kRead); // initialization // KScanReadCallBack //kRead.pUserData = this; kRead.fnCallBack = KScanReadCallBack; // ReadOption kRead.nTimeInSeconds = m_nTimeOut; kRead.nSecurity = m_nSecurityLevel; // Option if(m_bXCD == TRUE) kRead.dwFlags |= KSCAN_FLAG_RETURNCHECK; if(m_bCenterDecode == TRUE) kRead.dwFlags |= KSCAN_FLAG_CENTERDECODE; if(m_b1DDecode == TRUE) kRead.dwFlags |= KSCAN_FLAG_1DDECODEMODE; // 1D BarCode 18 if(m_1DBarCode.bCodabar) kRead.dwReadType |= KSCAN_READ_TYPE_CODABAR; if(m_1DBarCode.bCode11) kRead.dwReadType |= KSCAN_READ_TYPE_CODE11; if(m_1DBarCode.bCode39) kRead.dwReadType |= KSCAN_READ_TYPE_CODE39; if(m_1DBarCode.bCode93) kRead.dwReadType |= KSCAN_READ_TYPE_CODE93; if(m_1DBarCode.bCode128) kRead.dwReadType |= KSCAN_READ_TYPE_CODE128; if(m_1DBarCode.bGs1_128) kRead.dwReadType |= KSCAN_READ_TYPE_GS1_128; if(m_1DBarCode.bUpca) kRead.dwReadType |= KSCAN_READ_TYPE_UPCA; if(m_1DBarCode.bUpce) kRead.dwReadType |= KSCAN_READ_TYPE_UPCE; if(m_1DBarCode.bUpce1) kRead.dwReadType |= KSCAN_READ_TYPE_UPCE1; if(m_1DBarCode.bEan8) kRead.dwReadType |= KSCAN_READ_TYPE_EAN8; if(m_1DBarCode.bEan13) kRead.dwReadType |= KSCAN_READ_TYPE_EAN13; if(m_1DBarCode.bGs1) kRead.dwReadType |= KSCAN_READ_TYPE_GS1; if(m_1DBarCode.bI2of5) kRead.dwReadType |= KSCAN_READ_TYPE_I2OF5; if(m_1DBarCode.bMatrix2of5) kRead.dwReadType |= KSCAN_READ_TYPE_MATRIX2OF5; if(m_1DBarCode.bMsi) kRead.dwReadType |= KSCAN_READ_TYPE_MSI; if(m_1DBarCode.bPlessey) kRead.dwReadType |= KSCAN_READ_TYPE_PLESSEY; if(m_1DBarCode.bStandard2of5) kRead.dwReadType |= KSCAN_READ_TYPE_STANDARD2OF5; if(m_1DBarCode.bTelepen) kRead.dwReadType |= KSCAN_READ_TYPE_TELEPEN; // 2D BarCode 14 if(m_2DBarCode.bBpo) kRead.dwReadType |= KSCAN_READ_TYPE_BPO; if(m_2DBarCode.bDatamatrix) kRead.dwReadType |= KSCAN_READ_TYPE_DATAMATRIX; if(m_2DBarCode.bMaxicode) kRead.dwReadType |= KSCAN_READ_TYPE_MAXICODE; if(m_2DBarCode.bPdf417) kRead.dwReadType |= KSCAN_READ_TYPE_PDF417; if(m_2DBarCode.bMicroPdf417) kRead.dwReadType |= KSCAN_READ_TYPE_MICROPDF417; if(m_2DBarCode.bPlanet) kRead.dwReadType |= KSCAN_READ_TYPE_PLANET; if(m_2DBarCode.bQrCode) kRead.dwReadType |= KSCAN_READ_TYPE_QRCODE; if(m_2DBarCode.bTlc39) kRead.dwReadType |= KSCAN_READ_TYPE_TLC39; if(m_2DBarCode.bPostnet) kRead.dwReadType |= KSCAN_READ_TYPE_POSTNET; if(m_2DBarCode.bAusPost) kRead.dwReadType |= KSCAN_READ_TYPE_AUSPOST; if(m_2DBarCode.bCanadaPost) kRead.dwReadType |= KSCAN_READ_TYPE_CANADAPOST; if(m_2DBarCode.bDutchPost) kRead.dwReadType |= KSCAN_READ_TYPE_DUTCHPOST; if(m_2DBarCode.bJapanPost) kRead.dwReadType |= KSCAN_READ_TYPE_JAPANPOST; if(m_2DBarCode.bSwedenPost) kRead.dwReadType |= KSCAN_READ_TYPE_SWEDENPOST; kRead.dwReadType = KSCAN_READ_TYPE_ALL; SetOption(&kRead); SetReturn(1, *KScanReadCallBack); //set an extern callback function ScanCallback = callback; } return bRet; } _declspec(dllexport) void ScanCancel() { KScanReadCancel(); } _declspec(dllexport) void ScanRead() { KScanRead(); } _declspec(dllexport) void ScanClose() { KScanClose(); Sleep(100); ScanCallback = NULL; } };
[ "popovegor@gmail.com" ]
popovegor@gmail.com
f0a1042838a5c51b1b6f4155d31961c3dbe3a5dc
0828d56b510a64bec46b8b19f37c869011af4368
/minimal_subscriber/src/lambda_custom.cpp
3a124f5cebddeee3ac80f892bae8c2634eea5c4d
[]
no_license
letterso/ros2_minimal_project
4d302626de7b329e1545ee3f2d679b3ae95053fd
2cf75d18352cb166bb18268b90f34fee4b2e058c
refs/heads/master
2023-07-30T07:31:43.928475
2021-09-18T03:02:43
2021-09-18T03:02:43
400,383,894
0
0
null
null
null
null
UTF-8
C++
false
false
1,374
cpp
// Copyright 2016 Open Source Robotics Foundation, 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. #include <iostream> #include <memory> #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" #include "minimal_interfaces/msg/num.hpp" class MinimalSubscriber : public rclcpp::Node { public: MinimalSubscriber() : Node("minimal_subscriber") { subscription_ = this->create_subscription<minimal_interfaces::msg::Num>( "topic_custom", 10, [this](minimal_interfaces::msg::Num::UniquePtr msg) { RCLCPP_INFO(this->get_logger(), "I heard: '%d'", msg->data); }); } private: rclcpp::Subscription<minimal_interfaces::msg::Num>::SharedPtr subscription_; }; int main(int argc, char * argv[]) { rclcpp::init(argc, argv); rclcpp::spin(std::make_shared<MinimalSubscriber>()); rclcpp::shutdown(); return 0; }
[ "lettersony00@gmail.com" ]
lettersony00@gmail.com
6d5462d3642874349ae2440ecd3042b9d69897a4
0dca3325c194509a48d0c4056909175d6c29f7bc
/dataworks-public/src/model/DeleteQualityRelativeNodeRequest.cc
db27f6bb8248edd58ce626939b260b7b51b6818d
[ "Apache-2.0" ]
permissive
dingshiyu/aliyun-openapi-cpp-sdk
3eebd9149c2e6a2b835aba9d746ef9e6bef9ad62
4edd799a79f9b94330d5705bb0789105b6d0bb44
refs/heads/master
2023-07-31T10:11:20.446221
2021-09-26T10:08:42
2021-09-26T10:08:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,305
cc
/* * Copyright 2009-2017 Alibaba Cloud 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. */ #include <alibabacloud/dataworks-public/model/DeleteQualityRelativeNodeRequest.h> using AlibabaCloud::Dataworks_public::Model::DeleteQualityRelativeNodeRequest; DeleteQualityRelativeNodeRequest::DeleteQualityRelativeNodeRequest() : RpcServiceRequest("dataworks-public", "2020-05-18", "DeleteQualityRelativeNode") { setMethod(HttpRequest::Method::Post); } DeleteQualityRelativeNodeRequest::~DeleteQualityRelativeNodeRequest() {} std::string DeleteQualityRelativeNodeRequest::getProjectName()const { return projectName_; } void DeleteQualityRelativeNodeRequest::setProjectName(const std::string& projectName) { projectName_ = projectName; setBodyParameter("ProjectName", projectName); } long DeleteQualityRelativeNodeRequest::getTargetNodeProjectId()const { return targetNodeProjectId_; } void DeleteQualityRelativeNodeRequest::setTargetNodeProjectId(long targetNodeProjectId) { targetNodeProjectId_ = targetNodeProjectId; setBodyParameter("TargetNodeProjectId", std::to_string(targetNodeProjectId)); } std::string DeleteQualityRelativeNodeRequest::getMatchExpression()const { return matchExpression_; } void DeleteQualityRelativeNodeRequest::setMatchExpression(const std::string& matchExpression) { matchExpression_ = matchExpression; setBodyParameter("MatchExpression", matchExpression); } std::string DeleteQualityRelativeNodeRequest::getEnvType()const { return envType_; } void DeleteQualityRelativeNodeRequest::setEnvType(const std::string& envType) { envType_ = envType; setBodyParameter("EnvType", envType); } std::string DeleteQualityRelativeNodeRequest::getTargetNodeProjectName()const { return targetNodeProjectName_; } void DeleteQualityRelativeNodeRequest::setTargetNodeProjectName(const std::string& targetNodeProjectName) { targetNodeProjectName_ = targetNodeProjectName; setBodyParameter("TargetNodeProjectName", targetNodeProjectName); } std::string DeleteQualityRelativeNodeRequest::getTableName()const { return tableName_; } void DeleteQualityRelativeNodeRequest::setTableName(const std::string& tableName) { tableName_ = tableName; setBodyParameter("TableName", tableName); } long DeleteQualityRelativeNodeRequest::getNodeId()const { return nodeId_; } void DeleteQualityRelativeNodeRequest::setNodeId(long nodeId) { nodeId_ = nodeId; setBodyParameter("NodeId", std::to_string(nodeId)); } long DeleteQualityRelativeNodeRequest::getProjectId()const { return projectId_; } void DeleteQualityRelativeNodeRequest::setProjectId(long projectId) { projectId_ = projectId; setBodyParameter("ProjectId", std::to_string(projectId)); }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
bf16f148efdac9cf3b356d7da444aebb08ecc7d6
8ec5482489a05f29172dae9b95b70b03d386af03
/sources/xray_re/xr_sdk_version.h
28e9fd35af21fbeefa8233c01685d6dd552c43f7
[]
no_license
abramcumner/xray_re-tools
ed4d364a3d3aeda31cfebeb5df03a3d724f1f531
2222ad023c0656cbbdbe7e93d59f7bed29387e5d
refs/heads/master
2023-05-27T01:30:07.434712
2023-05-20T11:56:05
2023-05-20T11:57:23
65,939,733
31
17
null
2023-05-21T13:07:14
2016-08-17T20:30:04
C++
UTF-8
C++
false
false
1,154
h
#ifndef __GNUC__ #pragma once #endif #ifndef __XR_SDK_VERSION_H__ #define __XR_SDK_VERSION_H__ namespace xray_re { enum sdk_version { SDK_VER_756, SDK_VER_1098, SDK_VER_1850, SDK_VER_0_4, SDK_VER_0_5, SDK_VER_0_6, SDK_VER_0_7, SDK_VER_UNKNOWN = -1 }; inline sdk_version sdk_version_from_string(const std::string& str) { if(str == "756") return SDK_VER_756; if(str == "1098") return SDK_VER_1098; if(str == "1850") return SDK_VER_1850; if(str == "0.4") return SDK_VER_0_4; if(str == "0.5") return SDK_VER_0_5; if(str == "0.6") return SDK_VER_0_6; if(str == "0.7") return SDK_VER_0_7; return SDK_VER_UNKNOWN; } inline std::string sdk_version_to_string(sdk_version ver) { switch(ver) { case SDK_VER_756: return "756"; break; case SDK_VER_1098: return "1098"; break; case SDK_VER_1850: return "1850"; break; case SDK_VER_0_4: return "0.4"; break; case SDK_VER_0_5: return "0.5"; break; case SDK_VER_0_6: return "0.6"; break; case SDK_VER_0_7: return "0.7"; break; default: return "<unknown>"; } } } // end of namespace xray_re #endif
[ "abramcumner@yandex.ru" ]
abramcumner@yandex.ru
3c38b6ac1b54f92620a2ac59c905beea41361683
70cfbcb6a23f607a8e15c60b0d5afdd27b09e6e0
/Envelope.Core/Calc/CalculationParameters.cpp
ae6410bad0f38601ce06d9c44d5247c093267d85
[]
no_license
Hengle/AirCushionSimulation
3e87077ef0cfc9731c7e8badf517e223e99a6ca9
fa7a0c50edf16a8223a0fb94ddc7191ffd2f673b
refs/heads/master
2023-03-17T16:28:24.714791
2020-10-11T19:08:03
2020-10-11T19:08:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,004
cpp
#include "stdafx.h" #include "CalculationParameters.h" namespace EnvelopeCore { CalculationParameters::CalculationParameters(void) { n_x = 100; n_y = 100; n_phi = 32; n_zeta = 31; timeMin = 0.0; timeMax = 90.0; t = timeMin; dt = 1; dtOutput = 10; cycleNumber = -1; calcScheme[FORCE_GR_INDEX].ignore = false; calcScheme[FORCE_GR_INDEX].sch = EXPLICIT; calcScheme[FORCE_ST_INDEX].ignore = false; calcScheme[FORCE_ST_INDEX].sch = EXPLICIT; calcScheme[FORCE_FL_INDEX].ignore = false; calcScheme[FORCE_FL_INDEX].sch = EXPLICIT; calcScheme[FORCE_PR_INDEX].ignore = false; calcScheme[FORCE_PR_INDEX].sch = EXPLICIT; calcScheme[FORCE_FR_INDEX].ignore = false; calcScheme[FORCE_FR_INDEX].sch = EXPLICIT; solver = INTERNAL; outputToTecplot = false; outputLandscapeToTecplot = false; outputEachStep = false; } CalculationParameters::~CalculationParameters(void) { } bool CalculationParameters::Read(const char * fileName , const char * section) { CIniReader iniReader(fileName); this->dt = iniReader.ReadFloat(section, "dt"); this->timeMax = iniReader.ReadFloat(section, "timeMax"); this->timeMin = iniReader.ReadFloat(section, "timeMin"); this->n_x = iniReader.ReadInteger(section, "n_x"); this->n_y = iniReader.ReadInteger(section, "n_y"); this->n_phi = iniReader.ReadInteger(section, "n_phi"); this->n_zeta = iniReader.ReadInteger(section, "n_zeta"); return true; } bool CalculationParameters::Save(const char * fileName , const char * section) const { CIniWriter iniWriter(fileName); iniWriter.WriteFloat(section, "dt", this->dt ); iniWriter.WriteFloat(section, "timeMax", this->timeMax ); iniWriter.WriteFloat(section, "timeMin", this->timeMin ); iniWriter.WriteInteger(section, "n_x", this->n_x ); iniWriter.WriteInteger(section, "n_y", this->n_y ); iniWriter.WriteInteger(section, "n_phi", this->n_phi ); iniWriter.WriteInteger(section, "n_zeta", this->n_zeta ); return true; } }
[ "vsalosyatov@acumatica.com" ]
vsalosyatov@acumatica.com
e4290815d5b785441c8b409b920b1bb91162a747
90f9301da33fc1e5401ca5430a346610a9423877
/300+/539_Minimum_Time_Difference.h
64f8ff9c7b2316f6ea82bf305fde93ae279ec007
[]
no_license
RiceReallyGood/Leetcode
ff19d101ca7555d0fa79ef746f41da2e5803e6f5
dbc432aeeb7bbd4af30d4afa84acbf6b9f5a16b5
refs/heads/master
2021-01-25T22:58:56.601117
2020-04-10T06:27:31
2020-04-10T06:27:31
243,217,359
0
0
null
null
null
null
UTF-8
C++
false
false
868
h
#include <vector> #include <string> using namespace std; class Solution { public: int findMinDifference(vector<string>& timePoints) { if(timePoints.size() > 1440) return 0; vector<bool> exist(1440, false); for(int i = 0; i < timePoints.size(); i++){ int t = stoi(timePoints[i].substr(0, 2)) * 60 + stoi(timePoints[i].substr(3, 2)); if(exist[t]) return 0; exist[t] = true; } int earliesttime = -1; int i = 0, j = 0; while(!exist[j]) j++; earliesttime = j; int mindiff = 1440; for(i = j, j++;; j++){ while(j < 1440 && !exist[j]) j++; if(j == 1440) break; mindiff = min(mindiff, j - i); i = j; } mindiff = min(mindiff, earliesttime + 1440 - i); return mindiff; } };
[ "1601110073@pku.edu.cn" ]
1601110073@pku.edu.cn
5c0e6ebcec5382d8219e660cfbefd23a32b2de2d
6025d1ad10143b1b3586c032e7e69ac92d9d9c63
/src/test/data/base58_keys_valid.json.h
b1a864d685afabca0c9db4d8f114dd3157015f5b
[ "MIT" ]
permissive
yanghouhao/thesiscode
eb088b70d67eb515ef302766be54de36b06e463f
9b47e756c788d06efecb920ce347916d371531f2
refs/heads/main
2023-01-24T03:53:50.756123
2020-12-10T14:57:09
2020-12-10T14:57:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
70,507
h
namespace json_tests{ static unsigned const char base58_keys_valid[] = { 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x54, 0x38, 0x79, 0x61, 0x4c, 0x56, 0x68, 0x4e, 0x71, 0x78, 0x41, 0x35, 0x4b, 0x4a, 0x63, 0x6d, 0x69, 0x71, 0x71, 0x46, 0x4e, 0x38, 0x38, 0x65, 0x38, 0x44, 0x4e, 0x70, 0x32, 0x50, 0x42, 0x66, 0x46, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x36, 0x35, 0x61, 0x31, 0x36, 0x30, 0x35, 0x39, 0x38, 0x36, 0x34, 0x61, 0x32, 0x66, 0x64, 0x62, 0x63, 0x37, 0x63, 0x39, 0x39, 0x61, 0x34, 0x37, 0x32, 0x33, 0x61, 0x38, 0x33, 0x39, 0x35, 0x62, 0x63, 0x36, 0x66, 0x31, 0x38, 0x38, 0x65, 0x62, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x56, 0x44, 0x79, 0x47, 0x48, 0x6e, 0x39, 0x6d, 0x62, 0x79, 0x43, 0x66, 0x34, 0x34, 0x38, 0x6d, 0x32, 0x63, 0x48, 0x54, 0x75, 0x35, 0x75, 0x58, 0x76, 0x73, 0x4a, 0x70, 0x4b, 0x48, 0x62, 0x69, 0x5a, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x37, 0x34, 0x66, 0x32, 0x30, 0x39, 0x66, 0x36, 0x65, 0x61, 0x39, 0x30, 0x37, 0x65, 0x32, 0x65, 0x61, 0x34, 0x38, 0x66, 0x37, 0x34, 0x66, 0x61, 0x65, 0x30, 0x35, 0x37, 0x38, 0x32, 0x61, 0x65, 0x38, 0x61, 0x36, 0x36, 0x35, 0x32, 0x35, 0x37, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x6d, 0x48, 0x4d, 0x42, 0x65, 0x65, 0x59, 0x52, 0x75, 0x63, 0x32, 0x65, 0x56, 0x69, 0x63, 0x4c, 0x4e, 0x66, 0x50, 0x31, 0x35, 0x59, 0x4c, 0x78, 0x62, 0x51, 0x73, 0x6f, 0x6f, 0x43, 0x41, 0x36, 0x6a, 0x62, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x35, 0x33, 0x63, 0x30, 0x33, 0x30, 0x37, 0x64, 0x36, 0x38, 0x35, 0x31, 0x61, 0x61, 0x30, 0x63, 0x65, 0x37, 0x38, 0x32, 0x35, 0x62, 0x61, 0x38, 0x38, 0x33, 0x63, 0x36, 0x62, 0x64, 0x39, 0x61, 0x64, 0x32, 0x34, 0x32, 0x62, 0x34, 0x38, 0x36, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x32, 0x46, 0x62, 0x6f, 0x36, 0x44, 0x42, 0x4b, 0x4b, 0x56, 0x59, 0x77, 0x31, 0x53, 0x66, 0x72, 0x59, 0x38, 0x62, 0x45, 0x67, 0x7a, 0x35, 0x36, 0x68, 0x59, 0x45, 0x68, 0x79, 0x77, 0x68, 0x45, 0x4e, 0x36, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x36, 0x33, 0x34, 0x39, 0x61, 0x34, 0x31, 0x38, 0x66, 0x63, 0x34, 0x35, 0x37, 0x38, 0x64, 0x31, 0x30, 0x61, 0x33, 0x37, 0x32, 0x62, 0x35, 0x34, 0x62, 0x34, 0x35, 0x63, 0x32, 0x38, 0x30, 0x63, 0x63, 0x38, 0x63, 0x34, 0x33, 0x38, 0x32, 0x66, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x4b, 0x64, 0x33, 0x4e, 0x42, 0x55, 0x41, 0x64, 0x55, 0x6e, 0x68, 0x79, 0x7a, 0x65, 0x6e, 0x45, 0x77, 0x56, 0x4c, 0x79, 0x39, 0x70, 0x42, 0x4b, 0x78, 0x53, 0x77, 0x58, 0x76, 0x45, 0x39, 0x46, 0x4d, 0x50, 0x79, 0x52, 0x34, 0x55, 0x4b, 0x5a, 0x76, 0x70, 0x65, 0x36, 0x45, 0x33, 0x41, 0x67, 0x4c, 0x72, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x64, 0x64, 0x62, 0x64, 0x63, 0x31, 0x31, 0x36, 0x38, 0x66, 0x31, 0x64, 0x61, 0x65, 0x61, 0x64, 0x62, 0x64, 0x33, 0x65, 0x34, 0x34, 0x63, 0x31, 0x65, 0x33, 0x66, 0x38, 0x66, 0x35, 0x61, 0x32, 0x38, 0x34, 0x63, 0x32, 0x30, 0x32, 0x39, 0x66, 0x37, 0x38, 0x61, 0x64, 0x32, 0x36, 0x61, 0x66, 0x39, 0x38, 0x35, 0x38, 0x33, 0x61, 0x34, 0x39, 0x39, 0x64, 0x65, 0x35, 0x62, 0x31, 0x39, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x4b, 0x7a, 0x36, 0x55, 0x4a, 0x6d, 0x51, 0x41, 0x43, 0x4a, 0x6d, 0x4c, 0x74, 0x61, 0x51, 0x6a, 0x35, 0x41, 0x33, 0x4a, 0x41, 0x67, 0x65, 0x34, 0x6b, 0x56, 0x54, 0x4e, 0x51, 0x38, 0x67, 0x62, 0x76, 0x58, 0x75, 0x77, 0x62, 0x6d, 0x43, 0x6a, 0x37, 0x62, 0x73, 0x61, 0x61, 0x62, 0x75, 0x64, 0x62, 0x33, 0x52, 0x44, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x35, 0x63, 0x39, 0x62, 0x63, 0x63, 0x62, 0x39, 0x65, 0x64, 0x36, 0x38, 0x34, 0x34, 0x36, 0x64, 0x31, 0x62, 0x37, 0x35, 0x32, 0x37, 0x33, 0x62, 0x62, 0x63, 0x65, 0x38, 0x39, 0x64, 0x37, 0x66, 0x65, 0x30, 0x31, 0x33, 0x61, 0x38, 0x61, 0x63, 0x64, 0x31, 0x36, 0x32, 0x35, 0x35, 0x31, 0x34, 0x34, 0x32, 0x30, 0x66, 0x62, 0x32, 0x61, 0x63, 0x61, 0x31, 0x61, 0x32, 0x31, 0x63, 0x34, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x39, 0x32, 0x31, 0x33, 0x71, 0x4a, 0x61, 0x62, 0x32, 0x48, 0x4e, 0x45, 0x70, 0x4d, 0x70, 0x59, 0x4e, 0x42, 0x61, 0x37, 0x77, 0x48, 0x47, 0x46, 0x4b, 0x4b, 0x62, 0x6b, 0x44, 0x6e, 0x32, 0x34, 0x6a, 0x70, 0x41, 0x4e, 0x44, 0x73, 0x32, 0x68, 0x75, 0x4e, 0x33, 0x79, 0x69, 0x34, 0x4a, 0x31, 0x31, 0x6b, 0x6f, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x33, 0x36, 0x63, 0x62, 0x39, 0x33, 0x62, 0x39, 0x61, 0x62, 0x31, 0x62, 0x64, 0x61, 0x62, 0x66, 0x37, 0x66, 0x62, 0x39, 0x66, 0x32, 0x63, 0x30, 0x34, 0x66, 0x31, 0x62, 0x39, 0x63, 0x63, 0x38, 0x37, 0x39, 0x39, 0x33, 0x33, 0x35, 0x33, 0x30, 0x61, 0x65, 0x37, 0x38, 0x34, 0x32, 0x33, 0x39, 0x38, 0x65, 0x65, 0x66, 0x35, 0x61, 0x36, 0x33, 0x61, 0x35, 0x36, 0x38, 0x30, 0x30, 0x63, 0x32, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x54, 0x70, 0x42, 0x34, 0x59, 0x69, 0x79, 0x4b, 0x69, 0x42, 0x63, 0x50, 0x78, 0x6e, 0x65, 0x66, 0x73, 0x44, 0x70, 0x62, 0x6e, 0x44, 0x78, 0x46, 0x44, 0x66, 0x66, 0x6a, 0x71, 0x4a, 0x6f, 0x62, 0x38, 0x77, 0x47, 0x43, 0x45, 0x44, 0x58, 0x78, 0x67, 0x51, 0x37, 0x7a, 0x51, 0x6f, 0x4d, 0x58, 0x4a, 0x64, 0x48, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x39, 0x66, 0x34, 0x38, 0x39, 0x32, 0x63, 0x39, 0x65, 0x38, 0x32, 0x38, 0x32, 0x30, 0x32, 0x38, 0x66, 0x65, 0x61, 0x31, 0x64, 0x32, 0x36, 0x36, 0x37, 0x63, 0x34, 0x64, 0x63, 0x35, 0x32, 0x31, 0x33, 0x35, 0x36, 0x34, 0x64, 0x34, 0x31, 0x66, 0x63, 0x35, 0x37, 0x38, 0x33, 0x38, 0x39, 0x36, 0x61, 0x30, 0x64, 0x38, 0x34, 0x33, 0x66, 0x63, 0x31, 0x35, 0x30, 0x38, 0x39, 0x66, 0x33, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x54, 0x70, 0x66, 0x67, 0x75, 0x4a, 0x6a, 0x35, 0x7a, 0x78, 0x4b, 0x55, 0x66, 0x57, 0x63, 0x73, 0x4e, 0x54, 0x72, 0x68, 0x36, 0x65, 0x6f, 0x64, 0x32, 0x58, 0x58, 0x73, 0x54, 0x4b, 0x74, 0x76, 0x42, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x36, 0x64, 0x32, 0x33, 0x31, 0x35, 0x36, 0x63, 0x62, 0x62, 0x64, 0x63, 0x63, 0x38, 0x32, 0x61, 0x35, 0x61, 0x34, 0x37, 0x65, 0x65, 0x65, 0x34, 0x63, 0x32, 0x63, 0x37, 0x63, 0x35, 0x38, 0x33, 0x63, 0x31, 0x38, 0x62, 0x36, 0x62, 0x66, 0x34, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x68, 0x63, 0x39, 0x59, 0x32, 0x73, 0x74, 0x75, 0x45, 0x57, 0x6a, 0x53, 0x32, 0x64, 0x52, 0x44, 0x74, 0x47, 0x64, 0x69, 0x75, 0x33, 0x65, 0x6e, 0x4d, 0x70, 0x78, 0x41, 0x62, 0x65, 0x55, 0x69, 0x4b, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x66, 0x63, 0x63, 0x35, 0x34, 0x36, 0x30, 0x64, 0x64, 0x36, 0x65, 0x32, 0x34, 0x38, 0x37, 0x63, 0x37, 0x64, 0x37, 0x35, 0x62, 0x31, 0x39, 0x36, 0x33, 0x36, 0x32, 0x35, 0x64, 0x61, 0x30, 0x65, 0x38, 0x66, 0x34, 0x63, 0x35, 0x39, 0x37, 0x35, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x6d, 0x58, 0x6d, 0x32, 0x67, 0x35, 0x6f, 0x75, 0x55, 0x38, 0x50, 0x7a, 0x6b, 0x73, 0x6d, 0x71, 0x78, 0x33, 0x4b, 0x59, 0x6d, 0x65, 0x6f, 0x65, 0x61, 0x57, 0x72, 0x41, 0x76, 0x6a, 0x33, 0x72, 0x42, 0x35, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x66, 0x31, 0x64, 0x34, 0x37, 0x30, 0x66, 0x39, 0x62, 0x30, 0x32, 0x33, 0x37, 0x30, 0x66, 0x64, 0x65, 0x63, 0x32, 0x65, 0x36, 0x62, 0x37, 0x30, 0x38, 0x62, 0x30, 0x38, 0x61, 0x63, 0x34, 0x33, 0x31, 0x62, 0x66, 0x37, 0x61, 0x35, 0x66, 0x37, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x32, 0x51, 0x59, 0x78, 0x48, 0x6a, 0x4d, 0x38, 0x62, 0x74, 0x7a, 0x74, 0x57, 0x54, 0x73, 0x4d, 0x6e, 0x46, 0x6e, 0x5a, 0x4e, 0x75, 0x72, 0x6d, 0x37, 0x52, 0x58, 0x45, 0x4e, 0x6b, 0x39, 0x5a, 0x68, 0x52, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x63, 0x35, 0x37, 0x39, 0x33, 0x34, 0x32, 0x63, 0x32, 0x63, 0x34, 0x63, 0x39, 0x32, 0x32, 0x30, 0x32, 0x30, 0x35, 0x65, 0x32, 0x63, 0x64, 0x63, 0x32, 0x38, 0x35, 0x36, 0x31, 0x37, 0x30, 0x34, 0x30, 0x63, 0x39, 0x32, 0x34, 0x61, 0x30, 0x61, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x4b, 0x34, 0x39, 0x34, 0x58, 0x5a, 0x77, 0x70, 0x73, 0x32, 0x62, 0x47, 0x79, 0x65, 0x4c, 0x37, 0x31, 0x70, 0x57, 0x69, 0x64, 0x34, 0x6e, 0x6f, 0x69, 0x53, 0x4e, 0x41, 0x32, 0x63, 0x66, 0x43, 0x69, 0x62, 0x72, 0x76, 0x52, 0x57, 0x71, 0x63, 0x48, 0x53, 0x70, 0x74, 0x6f, 0x46, 0x6e, 0x37, 0x72, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x33, 0x32, 0x36, 0x62, 0x39, 0x35, 0x65, 0x62, 0x61, 0x65, 0x33, 0x30, 0x31, 0x36, 0x34, 0x32, 0x31, 0x37, 0x64, 0x37, 0x61, 0x37, 0x66, 0x35, 0x37, 0x64, 0x37, 0x32, 0x61, 0x62, 0x32, 0x62, 0x35, 0x34, 0x65, 0x33, 0x62, 0x65, 0x36, 0x34, 0x39, 0x32, 0x38, 0x61, 0x31, 0x39, 0x64, 0x61, 0x30, 0x32, 0x31, 0x30, 0x62, 0x39, 0x35, 0x36, 0x38, 0x64, 0x34, 0x30, 0x31, 0x35, 0x65, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x4c, 0x31, 0x52, 0x72, 0x72, 0x6e, 0x58, 0x6b, 0x63, 0x4b, 0x75, 0x74, 0x35, 0x44, 0x45, 0x4d, 0x77, 0x74, 0x44, 0x74, 0x68, 0x6a, 0x77, 0x52, 0x63, 0x54, 0x54, 0x77, 0x45, 0x44, 0x33, 0x36, 0x74, 0x68, 0x79, 0x4c, 0x31, 0x44, 0x65, 0x62, 0x56, 0x72, 0x4b, 0x75, 0x77, 0x76, 0x6f, 0x68, 0x6a, 0x4d, 0x4e, 0x69, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x64, 0x39, 0x39, 0x38, 0x62, 0x34, 0x35, 0x63, 0x32, 0x31, 0x39, 0x61, 0x31, 0x65, 0x33, 0x38, 0x65, 0x39, 0x39, 0x65, 0x37, 0x63, 0x62, 0x64, 0x33, 0x31, 0x32, 0x65, 0x66, 0x36, 0x37, 0x66, 0x37, 0x37, 0x61, 0x34, 0x35, 0x35, 0x61, 0x39, 0x62, 0x35, 0x30, 0x63, 0x37, 0x33, 0x30, 0x63, 0x32, 0x37, 0x66, 0x30, 0x32, 0x63, 0x36, 0x66, 0x37, 0x33, 0x30, 0x64, 0x66, 0x62, 0x34, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x39, 0x33, 0x44, 0x56, 0x4b, 0x79, 0x46, 0x59, 0x77, 0x53, 0x4e, 0x36, 0x77, 0x45, 0x6f, 0x33, 0x45, 0x32, 0x66, 0x43, 0x72, 0x46, 0x50, 0x55, 0x70, 0x31, 0x37, 0x46, 0x74, 0x72, 0x74, 0x4e, 0x69, 0x32, 0x4c, 0x66, 0x37, 0x6e, 0x34, 0x47, 0x33, 0x67, 0x61, 0x72, 0x46, 0x62, 0x31, 0x36, 0x43, 0x52, 0x6a, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x64, 0x36, 0x62, 0x63, 0x61, 0x32, 0x35, 0x36, 0x62, 0x35, 0x61, 0x62, 0x63, 0x35, 0x36, 0x30, 0x32, 0x65, 0x63, 0x32, 0x65, 0x31, 0x63, 0x31, 0x32, 0x31, 0x61, 0x30, 0x38, 0x62, 0x30, 0x64, 0x61, 0x32, 0x35, 0x35, 0x36, 0x35, 0x38, 0x37, 0x34, 0x33, 0x30, 0x62, 0x63, 0x66, 0x37, 0x65, 0x31, 0x38, 0x39, 0x38, 0x61, 0x66, 0x32, 0x32, 0x32, 0x34, 0x38, 0x38, 0x35, 0x32, 0x30, 0x33, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x54, 0x44, 0x56, 0x4b, 0x74, 0x4d, 0x47, 0x56, 0x59, 0x57, 0x54, 0x48, 0x43, 0x62, 0x31, 0x41, 0x46, 0x6a, 0x6d, 0x56, 0x62, 0x45, 0x62, 0x57, 0x6a, 0x76, 0x4b, 0x70, 0x4b, 0x71, 0x4b, 0x67, 0x4d, 0x61, 0x52, 0x33, 0x51, 0x4a, 0x78, 0x54, 0x6f, 0x4d, 0x53, 0x51, 0x41, 0x68, 0x6d, 0x43, 0x65, 0x54, 0x4e, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x38, 0x31, 0x63, 0x61, 0x34, 0x65, 0x38, 0x66, 0x39, 0x30, 0x31, 0x38, 0x31, 0x65, 0x63, 0x34, 0x62, 0x36, 0x31, 0x62, 0x36, 0x61, 0x37, 0x65, 0x62, 0x39, 0x39, 0x38, 0x61, 0x66, 0x31, 0x37, 0x62, 0x32, 0x63, 0x62, 0x30, 0x34, 0x64, 0x65, 0x38, 0x61, 0x30, 0x33, 0x62, 0x35, 0x30, 0x34, 0x62, 0x39, 0x65, 0x33, 0x34, 0x63, 0x34, 0x63, 0x36, 0x31, 0x64, 0x62, 0x37, 0x64, 0x39, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x55, 0x78, 0x43, 0x54, 0x34, 0x52, 0x72, 0x43, 0x62, 0x47, 0x48, 0x33, 0x36, 0x65, 0x74, 0x66, 0x51, 0x61, 0x50, 0x46, 0x31, 0x73, 0x76, 0x4e, 0x74, 0x5a, 0x56, 0x68, 0x73, 0x71, 0x73, 0x35, 0x41, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x37, 0x39, 0x38, 0x37, 0x63, 0x63, 0x61, 0x61, 0x35, 0x33, 0x64, 0x30, 0x32, 0x63, 0x38, 0x38, 0x37, 0x33, 0x34, 0x38, 0x37, 0x65, 0x66, 0x39, 0x31, 0x39, 0x36, 0x37, 0x37, 0x63, 0x64, 0x33, 0x64, 0x62, 0x37, 0x61, 0x36, 0x39, 0x31, 0x32, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x54, 0x65, 0x79, 0x78, 0x76, 0x31, 0x67, 0x46, 0x38, 0x46, 0x5a, 0x39, 0x4d, 0x57, 0x38, 0x57, 0x4e, 0x34, 0x4d, 0x76, 0x54, 0x78, 0x51, 0x34, 0x4a, 0x53, 0x63, 0x41, 0x42, 0x73, 0x4b, 0x66, 0x4c, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x36, 0x33, 0x62, 0x63, 0x63, 0x35, 0x36, 0x35, 0x66, 0x39, 0x65, 0x36, 0x38, 0x65, 0x65, 0x30, 0x31, 0x38, 0x39, 0x64, 0x64, 0x35, 0x63, 0x63, 0x36, 0x37, 0x66, 0x31, 0x62, 0x30, 0x65, 0x35, 0x66, 0x30, 0x32, 0x66, 0x34, 0x35, 0x63, 0x62, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x6d, 0x58, 0x59, 0x42, 0x4c, 0x65, 0x32, 0x51, 0x39, 0x4d, 0x62, 0x58, 0x66, 0x67, 0x47, 0x62, 0x32, 0x51, 0x71, 0x64, 0x4e, 0x37, 0x52, 0x57, 0x64, 0x69, 0x37, 0x74, 0x51, 0x32, 0x7a, 0x38, 0x79, 0x61, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x65, 0x66, 0x36, 0x36, 0x34, 0x34, 0x34, 0x62, 0x35, 0x62, 0x31, 0x37, 0x66, 0x31, 0x34, 0x65, 0x38, 0x66, 0x61, 0x65, 0x36, 0x65, 0x37, 0x65, 0x31, 0x39, 0x62, 0x30, 0x34, 0x35, 0x61, 0x37, 0x38, 0x63, 0x35, 0x34, 0x66, 0x64, 0x37, 0x39, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x32, 0x51, 0x51, 0x63, 0x58, 0x41, 0x4c, 0x7a, 0x34, 0x37, 0x34, 0x35, 0x4a, 0x45, 0x67, 0x7a, 0x75, 0x41, 0x45, 0x73, 0x4a, 0x4e, 0x67, 0x74, 0x36, 0x6e, 0x42, 0x51, 0x70, 0x73, 0x71, 0x65, 0x67, 0x75, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x63, 0x33, 0x65, 0x35, 0x35, 0x66, 0x63, 0x65, 0x63, 0x65, 0x61, 0x61, 0x34, 0x33, 0x39, 0x31, 0x65, 0x64, 0x32, 0x61, 0x39, 0x36, 0x37, 0x37, 0x66, 0x34, 0x61, 0x34, 0x64, 0x33, 0x34, 0x65, 0x61, 0x63, 0x64, 0x30, 0x32, 0x31, 0x61, 0x30, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x4b, 0x61, 0x42, 0x57, 0x39, 0x76, 0x4e, 0x74, 0x57, 0x4e, 0x68, 0x63, 0x33, 0x5a, 0x45, 0x44, 0x79, 0x4e, 0x43, 0x69, 0x58, 0x4c, 0x50, 0x64, 0x56, 0x50, 0x48, 0x43, 0x69, 0x6b, 0x52, 0x78, 0x53, 0x42, 0x57, 0x77, 0x56, 0x39, 0x4e, 0x72, 0x70, 0x4c, 0x4c, 0x61, 0x34, 0x4c, 0x73, 0x58, 0x69, 0x39, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x37, 0x35, 0x64, 0x39, 0x33, 0x36, 0x64, 0x35, 0x36, 0x33, 0x37, 0x37, 0x66, 0x34, 0x33, 0x32, 0x66, 0x34, 0x30, 0x34, 0x61, 0x61, 0x62, 0x62, 0x34, 0x30, 0x36, 0x36, 0x30, 0x31, 0x66, 0x38, 0x39, 0x32, 0x66, 0x64, 0x34, 0x39, 0x64, 0x61, 0x39, 0x30, 0x65, 0x62, 0x36, 0x61, 0x63, 0x35, 0x35, 0x38, 0x61, 0x37, 0x33, 0x33, 0x63, 0x39, 0x33, 0x62, 0x34, 0x37, 0x32, 0x35, 0x32, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x4c, 0x31, 0x61, 0x78, 0x7a, 0x62, 0x53, 0x79, 0x79, 0x6e, 0x4e, 0x59, 0x41, 0x38, 0x6d, 0x43, 0x41, 0x68, 0x7a, 0x78, 0x6b, 0x69, 0x70, 0x4b, 0x6b, 0x66, 0x48, 0x74, 0x41, 0x58, 0x59, 0x46, 0x34, 0x59, 0x51, 0x6e, 0x68, 0x53, 0x4b, 0x63, 0x4c, 0x56, 0x38, 0x59, 0x58, 0x41, 0x38, 0x37, 0x34, 0x66, 0x67, 0x54, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x38, 0x32, 0x34, 0x38, 0x62, 0x64, 0x30, 0x33, 0x37, 0x35, 0x66, 0x32, 0x66, 0x37, 0x35, 0x64, 0x37, 0x65, 0x32, 0x37, 0x34, 0x61, 0x65, 0x35, 0x34, 0x34, 0x66, 0x62, 0x39, 0x32, 0x30, 0x66, 0x35, 0x31, 0x37, 0x38, 0x34, 0x34, 0x38, 0x30, 0x38, 0x36, 0x36, 0x62, 0x31, 0x30, 0x32, 0x33, 0x38, 0x34, 0x31, 0x39, 0x30, 0x62, 0x31, 0x61, 0x64, 0x64, 0x66, 0x62, 0x61, 0x61, 0x35, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x39, 0x32, 0x37, 0x43, 0x6e, 0x55, 0x6b, 0x55, 0x62, 0x61, 0x73, 0x59, 0x74, 0x44, 0x77, 0x59, 0x77, 0x56, 0x6e, 0x32, 0x6a, 0x38, 0x47, 0x64, 0x54, 0x75, 0x41, 0x43, 0x4e, 0x6e, 0x4b, 0x6b, 0x6a, 0x5a, 0x31, 0x72, 0x70, 0x5a, 0x64, 0x32, 0x79, 0x42, 0x42, 0x31, 0x43, 0x4c, 0x63, 0x6e, 0x58, 0x70, 0x6f, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x34, 0x34, 0x63, 0x34, 0x66, 0x36, 0x61, 0x30, 0x39, 0x36, 0x65, 0x61, 0x63, 0x35, 0x32, 0x33, 0x38, 0x32, 0x39, 0x31, 0x61, 0x39, 0x34, 0x63, 0x63, 0x32, 0x34, 0x63, 0x30, 0x31, 0x65, 0x33, 0x62, 0x31, 0x39, 0x62, 0x38, 0x64, 0x38, 0x63, 0x65, 0x66, 0x37, 0x32, 0x38, 0x37, 0x34, 0x61, 0x30, 0x37, 0x39, 0x65, 0x30, 0x30, 0x61, 0x32, 0x34, 0x32, 0x32, 0x33, 0x37, 0x61, 0x35, 0x32, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x55, 0x63, 0x66, 0x43, 0x4d, 0x52, 0x6a, 0x69, 0x51, 0x66, 0x38, 0x35, 0x59, 0x4d, 0x7a, 0x7a, 0x51, 0x45, 0x6b, 0x39, 0x64, 0x31, 0x73, 0x35, 0x41, 0x34, 0x4b, 0x37, 0x78, 0x4c, 0x35, 0x53, 0x6d, 0x42, 0x43, 0x4c, 0x72, 0x65, 0x7a, 0x71, 0x58, 0x46, 0x75, 0x54, 0x56, 0x65, 0x66, 0x79, 0x68, 0x59, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x64, 0x31, 0x64, 0x65, 0x37, 0x30, 0x37, 0x30, 0x32, 0x30, 0x61, 0x39, 0x30, 0x35, 0x39, 0x64, 0x36, 0x64, 0x33, 0x61, 0x62, 0x61, 0x66, 0x38, 0x35, 0x65, 0x31, 0x37, 0x39, 0x36, 0x37, 0x63, 0x36, 0x35, 0x35, 0x35, 0x31, 0x35, 0x31, 0x31, 0x34, 0x33, 0x64, 0x62, 0x31, 0x33, 0x64, 0x62, 0x62, 0x30, 0x36, 0x64, 0x62, 0x37, 0x38, 0x64, 0x66, 0x30, 0x66, 0x31, 0x35, 0x63, 0x36, 0x39, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x5a, 0x69, 0x4d, 0x34, 0x6f, 0x4c, 0x46, 0x37, 0x68, 0x76, 0x62, 0x6f, 0x46, 0x34, 0x4c, 0x50, 0x71, 0x68, 0x62, 0x42, 0x67, 0x37, 0x52, 0x4c, 0x67, 0x4a, 0x43, 0x43, 0x4a, 0x43, 0x36, 0x54, 0x6a, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x61, 0x64, 0x63, 0x31, 0x63, 0x63, 0x32, 0x30, 0x38, 0x31, 0x61, 0x32, 0x37, 0x32, 0x30, 0x36, 0x66, 0x61, 0x65, 0x32, 0x35, 0x37, 0x39, 0x32, 0x66, 0x32, 0x38, 0x62, 0x62, 0x63, 0x35, 0x35, 0x62, 0x38, 0x33, 0x31, 0x35, 0x34, 0x39, 0x64, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x4c, 0x6f, 0x56, 0x38, 0x71, 0x38, 0x52, 0x34, 0x34, 0x66, 0x53, 0x62, 0x65, 0x38, 0x34, 0x44, 0x42, 0x4b, 0x44, 0x6b, 0x33, 0x73, 0x41, 0x45, 0x6f, 0x59, 0x75, 0x6d, 0x34, 0x68, 0x51, 0x59, 0x6a, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x31, 0x38, 0x38, 0x66, 0x39, 0x31, 0x61, 0x39, 0x33, 0x31, 0x39, 0x34, 0x37, 0x65, 0x64, 0x64, 0x64, 0x37, 0x34, 0x33, 0x32, 0x64, 0x36, 0x65, 0x36, 0x31, 0x34, 0x33, 0x38, 0x37, 0x65, 0x33, 0x32, 0x62, 0x32, 0x34, 0x34, 0x37, 0x30, 0x39, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x6d, 0x42, 0x6d, 0x6b, 0x65, 0x4a, 0x6d, 0x77, 0x46, 0x33, 0x55, 0x67, 0x56, 0x58, 0x71, 0x4a, 0x4c, 0x7a, 0x45, 0x69, 0x6e, 0x34, 0x39, 0x66, 0x74, 0x4b, 0x31, 0x48, 0x6d, 0x73, 0x71, 0x59, 0x75, 0x70, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x31, 0x36, 0x39, 0x34, 0x66, 0x35, 0x62, 0x63, 0x31, 0x61, 0x37, 0x32, 0x39, 0x35, 0x62, 0x36, 0x30, 0x30, 0x66, 0x34, 0x30, 0x30, 0x31, 0x38, 0x61, 0x36, 0x31, 0x38, 0x61, 0x36, 0x65, 0x61, 0x34, 0x38, 0x65, 0x65, 0x62, 0x34, 0x39, 0x38, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x32, 0x42, 0x79, 0x79, 0x70, 0x6e, 0x62, 0x78, 0x68, 0x32, 0x50, 0x66, 0x6b, 0x37, 0x56, 0x71, 0x4c, 0x4d, 0x7a, 0x59, 0x66, 0x69, 0x4e, 0x65, 0x44, 0x37, 0x32, 0x6f, 0x36, 0x79, 0x76, 0x74, 0x71, 0x58, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x33, 0x62, 0x39, 0x62, 0x33, 0x66, 0x64, 0x37, 0x61, 0x35, 0x30, 0x64, 0x34, 0x66, 0x30, 0x38, 0x64, 0x31, 0x61, 0x35, 0x62, 0x30, 0x66, 0x36, 0x32, 0x66, 0x36, 0x34, 0x34, 0x66, 0x61, 0x37, 0x31, 0x31, 0x35, 0x61, 0x65, 0x32, 0x66, 0x33, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x48, 0x74, 0x48, 0x36, 0x47, 0x64, 0x63, 0x77, 0x43, 0x4a, 0x41, 0x34, 0x67, 0x67, 0x57, 0x45, 0x4c, 0x31, 0x42, 0x33, 0x6a, 0x7a, 0x42, 0x42, 0x55, 0x42, 0x38, 0x48, 0x50, 0x69, 0x42, 0x69, 0x39, 0x53, 0x42, 0x63, 0x35, 0x68, 0x39, 0x69, 0x34, 0x57, 0x6b, 0x34, 0x50, 0x53, 0x65, 0x41, 0x70, 0x52, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x30, 0x39, 0x31, 0x30, 0x33, 0x35, 0x34, 0x34, 0x35, 0x65, 0x66, 0x31, 0x30, 0x35, 0x66, 0x61, 0x31, 0x62, 0x62, 0x31, 0x32, 0x35, 0x65, 0x63, 0x63, 0x66, 0x62, 0x31, 0x38, 0x38, 0x32, 0x66, 0x33, 0x66, 0x65, 0x36, 0x39, 0x35, 0x39, 0x32, 0x32, 0x36, 0x35, 0x39, 0x35, 0x36, 0x61, 0x64, 0x65, 0x37, 0x35, 0x31, 0x66, 0x64, 0x30, 0x39, 0x35, 0x30, 0x33, 0x33, 0x64, 0x38, 0x64, 0x30, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x4c, 0x32, 0x78, 0x53, 0x59, 0x6d, 0x4d, 0x65, 0x56, 0x6f, 0x33, 0x5a, 0x65, 0x6b, 0x33, 0x5a, 0x54, 0x73, 0x76, 0x39, 0x78, 0x55, 0x72, 0x58, 0x56, 0x41, 0x6d, 0x72, 0x57, 0x78, 0x4a, 0x38, 0x55, 0x61, 0x34, 0x63, 0x77, 0x38, 0x70, 0x6b, 0x66, 0x62, 0x51, 0x68, 0x63, 0x45, 0x46, 0x68, 0x6b, 0x58, 0x54, 0x38, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x62, 0x32, 0x62, 0x34, 0x62, 0x63, 0x64, 0x66, 0x63, 0x39, 0x31, 0x64, 0x33, 0x34, 0x64, 0x65, 0x65, 0x30, 0x61, 0x65, 0x32, 0x61, 0x38, 0x63, 0x36, 0x62, 0x36, 0x36, 0x36, 0x38, 0x64, 0x61, 0x64, 0x61, 0x65, 0x62, 0x33, 0x61, 0x38, 0x38, 0x62, 0x39, 0x38, 0x35, 0x39, 0x37, 0x34, 0x33, 0x31, 0x35, 0x36, 0x66, 0x34, 0x36, 0x32, 0x33, 0x32, 0x35, 0x31, 0x38, 0x37, 0x61, 0x66, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x39, 0x32, 0x78, 0x46, 0x45, 0x76, 0x65, 0x31, 0x5a, 0x39, 0x4e, 0x38, 0x5a, 0x36, 0x34, 0x31, 0x4b, 0x51, 0x51, 0x53, 0x37, 0x42, 0x79, 0x43, 0x53, 0x62, 0x38, 0x6b, 0x47, 0x6a, 0x73, 0x44, 0x7a, 0x77, 0x36, 0x66, 0x41, 0x6d, 0x6a, 0x48, 0x4e, 0x31, 0x4c, 0x5a, 0x47, 0x4b, 0x51, 0x58, 0x79, 0x4d, 0x71, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x34, 0x32, 0x30, 0x34, 0x33, 0x38, 0x39, 0x63, 0x65, 0x66, 0x31, 0x38, 0x62, 0x62, 0x65, 0x32, 0x62, 0x33, 0x35, 0x33, 0x36, 0x32, 0x33, 0x63, 0x62, 0x66, 0x39, 0x33, 0x65, 0x38, 0x36, 0x37, 0x38, 0x66, 0x62, 0x63, 0x39, 0x32, 0x61, 0x34, 0x37, 0x35, 0x62, 0x36, 0x36, 0x34, 0x61, 0x65, 0x39, 0x38, 0x65, 0x64, 0x35, 0x39, 0x34, 0x65, 0x36, 0x63, 0x66, 0x30, 0x38, 0x35, 0x36, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x56, 0x4d, 0x36, 0x35, 0x74, 0x64, 0x59, 0x75, 0x31, 0x59, 0x4b, 0x33, 0x37, 0x74, 0x4e, 0x6f, 0x41, 0x79, 0x47, 0x6f, 0x4a, 0x54, 0x52, 0x31, 0x33, 0x56, 0x42, 0x59, 0x46, 0x76, 0x61, 0x31, 0x76, 0x67, 0x39, 0x46, 0x4c, 0x75, 0x50, 0x41, 0x73, 0x4a, 0x69, 0x6a, 0x47, 0x76, 0x47, 0x36, 0x4e, 0x45, 0x41, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x37, 0x62, 0x32, 0x33, 0x30, 0x31, 0x33, 0x33, 0x66, 0x31, 0x62, 0x35, 0x34, 0x38, 0x39, 0x38, 0x34, 0x33, 0x32, 0x36, 0x30, 0x32, 0x33, 0x36, 0x62, 0x30, 0x36, 0x65, 0x64, 0x63, 0x61, 0x32, 0x35, 0x66, 0x36, 0x36, 0x61, 0x64, 0x62, 0x31, 0x62, 0x65, 0x34, 0x35, 0x35, 0x66, 0x62, 0x64, 0x33, 0x38, 0x64, 0x34, 0x30, 0x31, 0x30, 0x64, 0x34, 0x38, 0x66, 0x61, 0x65, 0x65, 0x66, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x62, 0x6f, 0x78, 0x57, 0x57, 0x75, 0x55, 0x73, 0x33, 0x64, 0x56, 0x55, 0x46, 0x65, 0x55, 0x4d, 0x69, 0x50, 0x71, 0x43, 0x64, 0x77, 0x44, 0x34, 0x51, 0x74, 0x4c, 0x31, 0x41, 0x4d, 0x78, 0x39, 0x47, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x63, 0x34, 0x63, 0x31, 0x62, 0x37, 0x32, 0x34, 0x39, 0x31, 0x65, 0x64, 0x65, 0x31, 0x65, 0x65, 0x64, 0x61, 0x63, 0x61, 0x30, 0x30, 0x36, 0x31, 0x38, 0x34, 0x30, 0x37, 0x65, 0x65, 0x30, 0x62, 0x37, 0x37, 0x32, 0x63, 0x61, 0x64, 0x30, 0x64, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x68, 0x35, 0x62, 0x76, 0x7a, 0x6b, 0x43, 0x58, 0x6b, 0x69, 0x4d, 0x74, 0x74, 0x6d, 0x51, 0x53, 0x63, 0x4b, 0x35, 0x36, 0x55, 0x6a, 0x56, 0x63, 0x71, 0x65, 0x44, 0x33, 0x4e, 0x6e, 0x52, 0x65, 0x57, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x66, 0x36, 0x66, 0x65, 0x36, 0x39, 0x62, 0x63, 0x62, 0x35, 0x34, 0x38, 0x61, 0x38, 0x32, 0x39, 0x63, 0x63, 0x65, 0x34, 0x63, 0x35, 0x37, 0x62, 0x66, 0x36, 0x66, 0x66, 0x66, 0x38, 0x61, 0x66, 0x33, 0x61, 0x35, 0x39, 0x38, 0x31, 0x66, 0x39, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x6d, 0x44, 0x42, 0x76, 0x6d, 0x32, 0x53, 0x35, 0x79, 0x41, 0x6a, 0x35, 0x70, 0x56, 0x41, 0x76, 0x42, 0x34, 0x74, 0x68, 0x31, 0x44, 0x44, 0x56, 0x70, 0x4c, 0x71, 0x33, 0x4b, 0x75, 0x4e, 0x38, 0x53, 0x31, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x32, 0x36, 0x31, 0x66, 0x38, 0x33, 0x35, 0x36, 0x38, 0x61, 0x30, 0x39, 0x38, 0x61, 0x38, 0x36, 0x33, 0x38, 0x38, 0x34, 0x34, 0x62, 0x64, 0x37, 0x61, 0x65, 0x63, 0x61, 0x30, 0x33, 0x39, 0x64, 0x35, 0x66, 0x32, 0x33, 0x35, 0x32, 0x63, 0x30, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x32, 0x54, 0x6f, 0x6f, 0x79, 0x5a, 0x37, 0x42, 0x6d, 0x51, 0x54, 0x42, 0x6b, 0x67, 0x43, 0x56, 0x68, 0x64, 0x4e, 0x51, 0x73, 0x50, 0x66, 0x65, 0x56, 0x64, 0x51, 0x6f, 0x57, 0x71, 0x73, 0x48, 0x51, 0x61, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x65, 0x39, 0x33, 0x30, 0x65, 0x31, 0x38, 0x33, 0x34, 0x61, 0x34, 0x64, 0x32, 0x33, 0x34, 0x37, 0x30, 0x32, 0x37, 0x37, 0x33, 0x39, 0x35, 0x31, 0x64, 0x36, 0x32, 0x37, 0x63, 0x63, 0x65, 0x38, 0x32, 0x66, 0x62, 0x62, 0x35, 0x64, 0x32, 0x65, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x4b, 0x51, 0x6d, 0x44, 0x72, 0x79, 0x4d, 0x4e, 0x44, 0x63, 0x69, 0x73, 0x54, 0x7a, 0x52, 0x70, 0x33, 0x7a, 0x45, 0x71, 0x39, 0x65, 0x34, 0x61, 0x77, 0x52, 0x6d, 0x4a, 0x72, 0x45, 0x56, 0x55, 0x31, 0x6a, 0x35, 0x76, 0x46, 0x52, 0x54, 0x4b, 0x70, 0x52, 0x4e, 0x59, 0x50, 0x71, 0x59, 0x72, 0x4d, 0x67, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x64, 0x31, 0x66, 0x61, 0x62, 0x37, 0x61, 0x62, 0x37, 0x33, 0x38, 0x35, 0x61, 0x64, 0x32, 0x36, 0x38, 0x37, 0x32, 0x32, 0x33, 0x37, 0x66, 0x31, 0x65, 0x62, 0x39, 0x37, 0x38, 0x39, 0x61, 0x61, 0x32, 0x35, 0x63, 0x63, 0x39, 0x38, 0x36, 0x62, 0x61, 0x63, 0x63, 0x36, 0x39, 0x35, 0x65, 0x30, 0x37, 0x61, 0x63, 0x35, 0x37, 0x31, 0x64, 0x36, 0x63, 0x64, 0x61, 0x63, 0x38, 0x62, 0x63, 0x30, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x4c, 0x33, 0x39, 0x46, 0x79, 0x37, 0x41, 0x43, 0x32, 0x48, 0x68, 0x6a, 0x39, 0x35, 0x67, 0x68, 0x33, 0x59, 0x62, 0x32, 0x41, 0x55, 0x35, 0x59, 0x48, 0x68, 0x31, 0x6d, 0x51, 0x53, 0x41, 0x48, 0x67, 0x70, 0x4e, 0x69, 0x78, 0x76, 0x6d, 0x32, 0x37, 0x70, 0x6f, 0x69, 0x7a, 0x63, 0x4a, 0x79, 0x4c, 0x74, 0x55, 0x69, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x62, 0x30, 0x62, 0x62, 0x65, 0x64, 0x65, 0x33, 0x33, 0x65, 0x66, 0x32, 0x35, 0x34, 0x65, 0x38, 0x33, 0x37, 0x36, 0x61, 0x63, 0x65, 0x62, 0x31, 0x35, 0x31, 0x30, 0x32, 0x35, 0x33, 0x66, 0x63, 0x33, 0x35, 0x35, 0x30, 0x65, 0x66, 0x64, 0x30, 0x66, 0x63, 0x66, 0x38, 0x34, 0x64, 0x63, 0x64, 0x30, 0x63, 0x39, 0x39, 0x39, 0x38, 0x62, 0x32, 0x38, 0x38, 0x66, 0x31, 0x36, 0x36, 0x62, 0x33, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x39, 0x31, 0x63, 0x54, 0x56, 0x55, 0x63, 0x67, 0x79, 0x64, 0x71, 0x79, 0x5a, 0x4c, 0x67, 0x61, 0x41, 0x4e, 0x70, 0x66, 0x31, 0x66, 0x76, 0x4c, 0x35, 0x35, 0x46, 0x48, 0x35, 0x33, 0x51, 0x4d, 0x6d, 0x34, 0x42, 0x73, 0x6e, 0x43, 0x41, 0x44, 0x56, 0x4e, 0x59, 0x75, 0x57, 0x75, 0x71, 0x64, 0x56, 0x79, 0x73, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x30, 0x33, 0x37, 0x66, 0x34, 0x31, 0x39, 0x32, 0x63, 0x36, 0x33, 0x30, 0x66, 0x33, 0x39, 0x39, 0x64, 0x39, 0x32, 0x37, 0x31, 0x65, 0x32, 0x36, 0x63, 0x35, 0x37, 0x35, 0x32, 0x36, 0x39, 0x62, 0x31, 0x64, 0x31, 0x35, 0x62, 0x65, 0x35, 0x35, 0x33, 0x65, 0x61, 0x31, 0x61, 0x37, 0x32, 0x31, 0x37, 0x66, 0x30, 0x63, 0x62, 0x38, 0x35, 0x31, 0x33, 0x63, 0x65, 0x66, 0x34, 0x31, 0x63, 0x62, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x51, 0x73, 0x70, 0x66, 0x53, 0x7a, 0x73, 0x67, 0x4c, 0x65, 0x69, 0x4a, 0x47, 0x42, 0x32, 0x75, 0x38, 0x76, 0x72, 0x41, 0x69, 0x57, 0x70, 0x43, 0x55, 0x34, 0x4d, 0x78, 0x55, 0x54, 0x36, 0x4a, 0x73, 0x65, 0x57, 0x6f, 0x32, 0x53, 0x6a, 0x58, 0x79, 0x34, 0x51, 0x62, 0x7a, 0x6e, 0x32, 0x66, 0x77, 0x44, 0x77, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x36, 0x32, 0x35, 0x31, 0x65, 0x32, 0x30, 0x35, 0x65, 0x38, 0x61, 0x64, 0x35, 0x30, 0x38, 0x62, 0x61, 0x62, 0x35, 0x35, 0x39, 0x36, 0x62, 0x65, 0x65, 0x30, 0x38, 0x36, 0x65, 0x66, 0x31, 0x36, 0x63, 0x64, 0x34, 0x62, 0x32, 0x33, 0x39, 0x65, 0x30, 0x63, 0x63, 0x30, 0x63, 0x35, 0x64, 0x37, 0x63, 0x34, 0x65, 0x36, 0x30, 0x33, 0x35, 0x34, 0x34, 0x31, 0x65, 0x37, 0x64, 0x35, 0x64, 0x65, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x53, 0x57, 0x44, 0x62, 0x48, 0x44, 0x54, 0x61, 0x74, 0x52, 0x31, 0x61, 0x67, 0x38, 0x79, 0x54, 0x46, 0x4c, 0x64, 0x56, 0x57, 0x64, 0x31, 0x65, 0x72, 0x66, 0x75, 0x37, 0x50, 0x62, 0x62, 0x6a, 0x6b, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x35, 0x65, 0x61, 0x64, 0x61, 0x66, 0x39, 0x62, 0x62, 0x37, 0x31, 0x32, 0x31, 0x66, 0x30, 0x66, 0x31, 0x39, 0x32, 0x35, 0x36, 0x31, 0x61, 0x35, 0x61, 0x36, 0x32, 0x66, 0x35, 0x65, 0x35, 0x66, 0x35, 0x34, 0x32, 0x31, 0x30, 0x32, 0x39, 0x32, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x51, 0x4b, 0x52, 0x36, 0x6d, 0x4c, 0x42, 0x77, 0x50, 0x59, 0x36, 0x44, 0x65, 0x71, 0x48, 0x77, 0x6a, 0x4a, 0x43, 0x78, 0x55, 0x77, 0x53, 0x73, 0x47, 0x55, 0x54, 0x6f, 0x42, 0x35, 0x73, 0x57, 0x4a, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x33, 0x66, 0x32, 0x31, 0x30, 0x65, 0x37, 0x32, 0x37, 0x37, 0x63, 0x38, 0x39, 0x39, 0x63, 0x33, 0x61, 0x31, 0x35, 0x35, 0x63, 0x63, 0x31, 0x63, 0x39, 0x30, 0x66, 0x34, 0x31, 0x30, 0x36, 0x63, 0x62, 0x64, 0x64, 0x65, 0x65, 0x63, 0x36, 0x65, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x6d, 0x55, 0x31, 0x45, 0x65, 0x6f, 0x4e, 0x48, 0x43, 0x66, 0x6d, 0x57, 0x70, 0x65, 0x5a, 0x57, 0x65, 0x52, 0x6e, 0x4b, 0x6d, 0x4e, 0x65, 0x56, 0x64, 0x48, 0x4a, 0x67, 0x5a, 0x6a, 0x73, 0x65, 0x35, 0x47, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x63, 0x38, 0x61, 0x33, 0x63, 0x32, 0x61, 0x30, 0x39, 0x61, 0x32, 0x39, 0x38, 0x35, 0x39, 0x32, 0x63, 0x33, 0x65, 0x31, 0x38, 0x30, 0x66, 0x30, 0x32, 0x34, 0x38, 0x37, 0x63, 0x64, 0x39, 0x31, 0x62, 0x61, 0x33, 0x34, 0x30, 0x30, 0x62, 0x35, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x32, 0x4c, 0x5a, 0x56, 0x77, 0x42, 0x35, 0x41, 0x32, 0x6e, 0x35, 0x55, 0x39, 0x6f, 0x64, 0x77, 0x4d, 0x62, 0x4c, 0x64, 0x31, 0x67, 0x35, 0x42, 0x7a, 0x39, 0x5a, 0x33, 0x5a, 0x46, 0x6f, 0x43, 0x4a, 0x48, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x39, 0x39, 0x62, 0x33, 0x31, 0x64, 0x66, 0x37, 0x63, 0x39, 0x30, 0x36, 0x38, 0x64, 0x31, 0x34, 0x38, 0x31, 0x62, 0x35, 0x39, 0x36, 0x35, 0x37, 0x38, 0x64, 0x64, 0x62, 0x62, 0x34, 0x64, 0x33, 0x62, 0x64, 0x39, 0x30, 0x62, 0x61, 0x65, 0x62, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x35, 0x4b, 0x4c, 0x36, 0x7a, 0x45, 0x61, 0x4d, 0x74, 0x50, 0x52, 0x58, 0x5a, 0x4b, 0x6f, 0x31, 0x62, 0x62, 0x4d, 0x71, 0x37, 0x4a, 0x44, 0x6a, 0x6a, 0x6f, 0x31, 0x62, 0x4a, 0x75, 0x51, 0x63, 0x73, 0x67, 0x4c, 0x33, 0x33, 0x6a, 0x65, 0x33, 0x6f, 0x59, 0x38, 0x75, 0x53, 0x4a, 0x43, 0x52, 0x35, 0x62, 0x34, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x37, 0x36, 0x36, 0x36, 0x38, 0x34, 0x32, 0x35, 0x30, 0x33, 0x64, 0x62, 0x36, 0x64, 0x63, 0x36, 0x65, 0x61, 0x30, 0x36, 0x31, 0x66, 0x30, 0x39, 0x32, 0x63, 0x66, 0x62, 0x39, 0x63, 0x33, 0x38, 0x38, 0x34, 0x34, 0x38, 0x36, 0x32, 0x39, 0x61, 0x36, 0x66, 0x65, 0x38, 0x36, 0x38, 0x64, 0x30, 0x36, 0x38, 0x63, 0x34, 0x32, 0x61, 0x34, 0x38, 0x38, 0x62, 0x34, 0x37, 0x38, 0x61, 0x65, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x4b, 0x77, 0x56, 0x39, 0x4b, 0x41, 0x66, 0x77, 0x62, 0x77, 0x74, 0x35, 0x31, 0x76, 0x65, 0x5a, 0x57, 0x4e, 0x73, 0x63, 0x52, 0x54, 0x65, 0x5a, 0x73, 0x39, 0x43, 0x4b, 0x70, 0x6f, 0x6a, 0x79, 0x75, 0x31, 0x4d, 0x73, 0x50, 0x6e, 0x61, 0x4b, 0x54, 0x46, 0x35, 0x6b, 0x7a, 0x36, 0x39, 0x48, 0x31, 0x55, 0x4e, 0x32, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x30, 0x37, 0x66, 0x30, 0x38, 0x30, 0x33, 0x66, 0x63, 0x35, 0x33, 0x39, 0x39, 0x65, 0x37, 0x37, 0x33, 0x35, 0x35, 0x35, 0x61, 0x62, 0x31, 0x65, 0x38, 0x39, 0x33, 0x39, 0x39, 0x30, 0x37, 0x65, 0x39, 0x62, 0x61, 0x64, 0x61, 0x63, 0x63, 0x31, 0x37, 0x63, 0x61, 0x31, 0x32, 0x39, 0x65, 0x36, 0x37, 0x61, 0x32, 0x66, 0x35, 0x66, 0x32, 0x66, 0x66, 0x38, 0x34, 0x33, 0x35, 0x31, 0x64, 0x64, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x39, 0x33, 0x4e, 0x38, 0x37, 0x44, 0x36, 0x75, 0x78, 0x53, 0x42, 0x7a, 0x77, 0x58, 0x76, 0x70, 0x6f, 0x6b, 0x70, 0x7a, 0x67, 0x38, 0x46, 0x46, 0x6d, 0x66, 0x51, 0x50, 0x6d, 0x76, 0x58, 0x34, 0x78, 0x48, 0x6f, 0x57, 0x51, 0x65, 0x33, 0x70, 0x4c, 0x64, 0x59, 0x70, 0x62, 0x69, 0x77, 0x54, 0x35, 0x59, 0x56, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x65, 0x61, 0x35, 0x37, 0x37, 0x61, 0x63, 0x66, 0x62, 0x35, 0x64, 0x31, 0x64, 0x31, 0x34, 0x64, 0x33, 0x62, 0x37, 0x62, 0x31, 0x39, 0x35, 0x63, 0x33, 0x32, 0x31, 0x35, 0x36, 0x36, 0x66, 0x31, 0x32, 0x66, 0x38, 0x37, 0x64, 0x32, 0x62, 0x37, 0x37, 0x65, 0x61, 0x33, 0x61, 0x35, 0x33, 0x66, 0x36, 0x38, 0x64, 0x66, 0x37, 0x65, 0x62, 0x66, 0x38, 0x36, 0x30, 0x34, 0x61, 0x38, 0x30, 0x31, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x4d, 0x78, 0x58, 0x75, 0x73, 0x53, 0x69, 0x68, 0x61, 0x58, 0x35, 0x38, 0x77, 0x70, 0x4a, 0x33, 0x74, 0x4e, 0x75, 0x75, 0x55, 0x63, 0x5a, 0x45, 0x51, 0x47, 0x74, 0x36, 0x44, 0x4b, 0x4a, 0x31, 0x77, 0x45, 0x70, 0x78, 0x79, 0x73, 0x38, 0x38, 0x46, 0x46, 0x61, 0x51, 0x43, 0x59, 0x6a, 0x6b, 0x75, 0x39, 0x68, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x30, 0x62, 0x33, 0x62, 0x33, 0x34, 0x66, 0x30, 0x39, 0x35, 0x38, 0x64, 0x38, 0x61, 0x32, 0x36, 0x38, 0x31, 0x39, 0x33, 0x61, 0x39, 0x38, 0x31, 0x34, 0x64, 0x61, 0x39, 0x32, 0x63, 0x33, 0x65, 0x38, 0x62, 0x35, 0x38, 0x62, 0x34, 0x61, 0x34, 0x33, 0x37, 0x38, 0x61, 0x35, 0x34, 0x32, 0x38, 0x36, 0x33, 0x65, 0x33, 0x34, 0x61, 0x63, 0x32, 0x38, 0x39, 0x63, 0x64, 0x38, 0x33, 0x30, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x31, 0x4c, 0x67, 0x63, 0x6a, 0x34, 0x6d, 0x35, 0x72, 0x37, 0x65, 0x44, 0x57, 0x63, 0x74, 0x57, 0x51, 0x4d, 0x37, 0x65, 0x74, 0x65, 0x38, 0x35, 0x68, 0x48, 0x69, 0x76, 0x51, 0x78, 0x4d, 0x6a, 0x42, 0x5a, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x37, 0x36, 0x61, 0x39, 0x31, 0x34, 0x31, 0x65, 0x64, 0x34, 0x36, 0x37, 0x30, 0x31, 0x37, 0x66, 0x30, 0x34, 0x33, 0x65, 0x39, 0x31, 0x65, 0x64, 0x34, 0x63, 0x34, 0x34, 0x62, 0x34, 0x65, 0x38, 0x64, 0x64, 0x36, 0x37, 0x34, 0x64, 0x62, 0x32, 0x31, 0x31, 0x63, 0x34, 0x65, 0x36, 0x38, 0x38, 0x61, 0x63, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x74, 0x33, 0x54, 0x43, 0x75, 0x48, 0x55, 0x78, 0x48, 0x33, 0x4c, 0x47, 0x6e, 0x73, 0x46, 0x59, 0x54, 0x55, 0x62, 0x53, 0x77, 0x48, 0x72, 0x52, 0x58, 0x78, 0x54, 0x61, 0x45, 0x41, 0x38, 0x68, 0x41, 0x61, 0x66, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x61, 0x39, 0x31, 0x34, 0x35, 0x65, 0x63, 0x65, 0x30, 0x63, 0x61, 0x64, 0x64, 0x64, 0x63, 0x34, 0x31, 0x35, 0x62, 0x31, 0x39, 0x38, 0x30, 0x66, 0x30, 0x30, 0x31, 0x37, 0x38, 0x35, 0x39, 0x34, 0x37, 0x31, 0x32, 0x30, 0x61, 0x63, 0x64, 0x62, 0x33, 0x36, 0x66, 0x63, 0x38, 0x37, 0x22, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x69, 0x73, 0x50, 0x72, 0x69, 0x76, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x6e, 0x65, 0x74, 0x22, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5d, 0x0a, 0x5d, 0x0a, };};
[ "chenxu@wutongchain.com" ]
chenxu@wutongchain.com
80b438bcf2c9e73da42a3430bda380a7d4c5d7b4
ac7b69e543b9aa2d5214b7a981a84aebce10dc26
/src/HandbookDataItem.h
f7619f2cbd5f8c01d9c363a6088a2b94084eec16
[]
no_license
zeh/argos
95d54d1eb25023632fcfd9601fe5e9b2c48b008a
b8fec767a492e33414c7bd1a96cc6ca8da8f534a
refs/heads/master
2021-01-19T09:01:59.674547
2014-04-22T19:46:40
2014-04-22T19:46:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,730
h
#pragma once #include "InputView.h" #include "ARGOSButtonView.h" #include "DataViewTitle.h" #include "DataViewContentBase.h" #include "HandbookViewOverview.h" #include "HandbookViewDataList.h" #include "HandbookViewWaypoint.h" #include "DataNode.h" #include "HandbookBackgroundView.h" typedef boost::shared_ptr<class HandbookDataItem> HandbookDataItemRef; class HandbookDataItem : public InputView { typedef boost::shared_ptr<HandbookViewOverview> HandbookViewOverviewRef; typedef boost::shared_ptr<DataViewTitle> DVTitleDisplayObjectRef; typedef boost::shared_ptr<DataViewContentBase> DVContentDisplayObjectRef; protected: HandbookBackgroundViewRef background; DataNodeRef dataNode; std::vector<ButtonViewRef> buttons; std::vector<DVContentDisplayObjectRef> views; DVContentDisplayObjectRef data; DVContentDisplayObjectRef waypoint; ButtonViewRef overviewBtn; ButtonViewRef dataBtn; ButtonViewRef waypointBtn; HandbookView3dObjectRef object3D; DVTitleDisplayObjectRef mTitle; DVContentDisplayObjectRef mCurrentContent; std::map<ButtonViewRef, DVContentDisplayObjectRef> mContentMap; void hideOffscreenViews(); int getViewIndex(DVContentDisplayObjectRef view); public: HandbookDataItem(HandbookBackgroundViewRef background, DataNodeRef node, Assets* assets); ~HandbookDataItem(void); virtual void prerender(); virtual void onAnimateIn(); virtual void onAnimateOut(); virtual void setSelection( ci::Vec2i selection ); virtual void handleInput( INPUT_TYPE type ); #ifdef _WIN32 virtual void handleGamepad( XINPUT_GAMEPAD gamepad ); #endif HandbookView3dObjectRef getObject3D(){return object3D;}; };
[ "anthony.tripaldi@nyc03atripaldi.corp.local" ]
anthony.tripaldi@nyc03atripaldi.corp.local
a1fc721403bd65b97aed05eceff83b7083cbdc1e
3728db88d8f8268ded2af24c4240eec9f9dc9068
/mln/core/image/image1d.hh
89e93e78c13c4117da4c61142f90212fa9bbbb24
[]
no_license
KDE/kolena
ca01613a49b7d37f0f74953916a49aceb162daf8
0e0eff22f44e3834e8ebaf2c226eaba602b1ebf6
refs/heads/master
2021-01-19T06:40:53.365100
2011-03-29T11:53:16
2011-03-29T11:53:16
42,732,429
2
0
null
null
null
null
UTF-8
C++
false
false
15,538
hh
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // // Olena 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, version 2 of the License. // // Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. // // As a special exception, you may use this file as part of a free // software project without restriction. Specifically, if other files // instantiate templates or use macros or inline functions from this // file, or you compile this file and link it with other files to produce // an executable, this file does not by itself cause the resulting // executable to be covered by the GNU General Public License. This // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. #ifndef MLN_CORE_IMAGE_IMAGE1D_HH # define MLN_CORE_IMAGE_IMAGE1D_HH /// \file /// /// Definition of the basic mln::image1d class. /// /// \todo Rewrite from_to(histo, image1d) after Etienne's work. # include <mln/core/internal/fixme.hh> # include <mln/core/internal/image_primary.hh> # include <mln/core/alias/box1d.hh> # include <mln/border/thickness.hh> # include <mln/value/set.hh> # include <mln/fun/i2v/all_to.hh> // FIXME: // # include <mln/core/pixter1d.hh> // # include <mln/core/dpoints_pixter.hh> namespace mln { // Forward declaration. template <typename T> struct image1d; namespace internal { /// Data structure for \c mln::image1d<T>. template <typename T> struct data< image1d<T> > { data(const box1d& b, unsigned bdr); ~data(); T* buffer_; T* array_; box1d b_; // theoretical box unsigned bdr_; box1d vb_; // virtual box, i.e., box including the virtual border void update_vb_(); void allocate_(); void deallocate_(); void swap_ (data< image1d<T> >& other_); void reallocate_(unsigned new_border); }; } // end of namespace mln::internal namespace trait { template <typename T> struct image_< image1d<T> > : default_image_< T, image1d<T> > { // misc typedef trait::image::category::primary category; typedef trait::image::speed::fastest speed; typedef trait::image::size::regular size; // value typedef trait::image::vw_io::none vw_io; typedef trait::image::vw_set::none vw_set; typedef trait::image::value_access::direct value_access; typedef trait::image::value_storage::one_block value_storage; typedef trait::image::value_browsing::site_wise_only value_browsing; typedef trait::image::value_alignment::with_grid value_alignment; typedef trait::image::value_io::read_write value_io; // site / domain typedef trait::image::pw_io::read_write pw_io; typedef trait::image::localization::basic_grid localization; typedef trait::image::dimension::one_d dimension; // extended domain typedef trait::image::ext_domain::extendable ext_domain; typedef trait::image::ext_value::multiple ext_value; typedef trait::image::ext_io::read_write ext_io; }; } // end of namespace mln::trait // Forward declaration. template <typename T> struct image1d; namespace convert { namespace over_load { // histo::array -> image1d. template <typename V, typename T> void from_to_(const histo::array<V>& from, image1d<T>& to); // util::array -> image1d. template <typename V, typename T> void from_to_(const util::array<V>& from, image1d<T>& to); } // end of namespace mln::convert::over_load } // end of namespace mln::convert /// Basic 1D image class. /// /// The parameter \c T is the type of pixel values. This image class /// stores data in memory and has a virtual border with constant /// thickness before and after data. /// /// \ingroup modimageconcrete // template <typename T> struct image1d : public internal::image_primary< T, box1d, image1d<T> > { typedef internal::image_primary< T, mln::box1d, image1d<T> > super_; /// Value associated type. typedef T value; /// Return type of read-only access. typedef const T& rvalue; /// Return type of read-write access. typedef T& lvalue; /// Skeleton. typedef image1d< tag::value_<T> > skeleton; /// Constructor without argument. image1d(); /// Constructor with the number of indices and the border /// thickness. image1d(unsigned ninds, unsigned bdr = border::thickness); /// Constructor with a box and the border thickness. image1d(const box1d& b, unsigned bdr = border::thickness); /// Initialize an empty image. void init_(const box1d& b, unsigned bdr = border::thickness); /// Test if \p p is valid. bool has(const point1d& p) const; /// Give the definition domain. const box1d& domain() const; /// Give the bounding box domain. const box1d& bbox() const; /// Give the border thickness. unsigned border() const; /// Read-only access to the image value located at point \p p. const T& operator()(const point1d& p) const; /// Read-write access to the image value located at point \p p. T& operator()(const point1d& p); // Specific methods: // ----------------- /// Read-only access to the image value located at (\p index). const T& at_(def::coord index) const; /// Read-write access to the image value located at (\p index). T& at_(def::coord index); /// Give the number of indexes. unsigned ninds() const; /// Fast Image method // Give the index of a point. using super_::index_of_point; /// Give the offset corresponding to the delta-point \p dp. int delta_index(const dpoint1d& dp) const; /// Give the point corresponding to the offset \p o. point1d point_at_index(unsigned i) const; /// Give a hook to the value buffer. const T* buffer() const; /// Give a hook to the value buffer. T* buffer(); /// Read-only access to the \p i-th image value (including the /// border). const T& element(unsigned i) const; /// Read-write access to the \p i-th image value (including the /// border). T& element(unsigned i); /// Give the number of cells (points including border ones). unsigned nelements() const; /// Resize image border with new_border. void resize_(unsigned new_border); }; template <typename T, typename J> void init_(tag::image_t, mln::image1d<T>& target, const J& model); # ifndef MLN_INCLUDE_ONLY // init_ template <typename T> inline void init_(tag::border_t, unsigned& b, const image1d<T>& model) { b = model.border(); } template <typename T, typename J> inline void init_(tag::image_t, image1d<T>& target, const J& model) { box1d b; init_(tag::bbox, b, model); unsigned bdr; init_(tag::border, bdr, model); target.init_(b, bdr); } // internal::data< image1d<T> > namespace internal { template <typename T> inline data< image1d<T> >::data(const box1d& b, unsigned bdr) : buffer_(0), array_ (0), b_ (b), bdr_ (bdr) { allocate_(); } template <typename T> inline data< image1d<T> >::~data() { deallocate_(); } template <typename T> inline void data< image1d<T> >::update_vb_() { dpoint1d dp(all_to(bdr_)); vb_.pmin() = b_.pmin() - dp; vb_.pmax() = b_.pmax() + dp; } template <typename T> inline void data< image1d<T> >::allocate_() { update_vb_(); unsigned ni = vb_.len(0); buffer_ = new T[ni]; array_ = buffer_ - vb_.pmin().ind(); mln_postcondition(vb_.len(0) == b_.len(0) + 2 * bdr_); } template <typename T> inline void data< image1d<T> >::deallocate_() { if (buffer_) { delete[] buffer_; buffer_ = 0; } } template <typename T> inline void data< image1d<T> >::swap_(data< image1d<T> >& other_) { data< image1d<T> > self_ = *this; *this = other_; other_ = self_; } template <typename T> inline void data< image1d<T> >::reallocate_(unsigned new_border) { data< image1d<T> >& tmp = *(new data< image1d<T> >(this->b_, new_border)); this->swap_(tmp); } } // end of namespace mln::internal // image1d<T> template <typename T> inline image1d<T>::image1d() { } template <typename T> inline image1d<T>::image1d(const box1d& b, unsigned bdr) { init_(b, bdr); } template <typename T> inline image1d<T>::image1d(unsigned ninds, unsigned bdr) { mln_precondition(ninds != 0); init_(make::box1d(ninds), bdr); } template <typename T> inline void image1d<T>::init_(const box1d& b, unsigned bdr) { mln_precondition(! this->is_valid()); this->data_ = new internal::data< image1d<T> >(b, bdr); } template <typename T> inline const box1d& image1d<T>::domain() const { mln_precondition(this->is_valid()); return this->data_->b_; } template <typename T> inline const box1d& image1d<T>::bbox() const { mln_precondition(this->is_valid()); return this->data_->b_; } template <typename T> inline unsigned image1d<T>::border() const { mln_precondition(this->is_valid()); return this->data_->bdr_; } template <typename T> inline unsigned image1d<T>::nelements() const { mln_precondition(this->is_valid()); return this->data_->vb_.nsites(); } template <typename T> inline bool image1d<T>::has(const point1d& p) const { mln_precondition(this->is_valid()); return this->data_->vb_.has(p); } template <typename T> inline const T& image1d<T>::operator()(const point1d& p) const { mln_precondition(this->has(p)); return this->data_->array_[p.ind()]; } template <typename T> inline T& image1d<T>::operator()(const point1d& p) { mln_precondition(this->has(p)); return this->data_->array_[p.ind()]; } template <typename T> inline const T& image1d<T>::at_(def::coord index) const { mln_precondition(this->has(point1d(index))); return this->data_->array_[index]; } template <typename T> inline unsigned image1d<T>::ninds() const { mln_precondition(this->is_valid()); return this->data_->b_.len(0); } template <typename T> inline T& image1d<T>::at_(def::coord index) { mln_precondition(this->has(point1d(index))); return this->data_->array_[index]; } template <typename T> inline const T& image1d<T>::element(unsigned i) const { mln_precondition(i < nelements()); return this->data_->buffer_[i]; } template <typename T> inline T& image1d<T>::element(unsigned i) { mln_precondition(i < nelements()); return this->data_->buffer_[i]; } template <typename T> inline const T* image1d<T>::buffer() const { mln_precondition(this->is_valid()); return this->data_->buffer_; } template <typename T> inline T* image1d<T>::buffer() { mln_precondition(this->is_valid()); return this->data_->buffer_; } template <typename T> inline int image1d<T>::delta_index(const dpoint1d& dp) const { mln_precondition(this->is_valid()); int o = dp[0]; return o; } template <typename T> inline point1d image1d<T>::point_at_index(unsigned i) const { mln_precondition(i < nelements()); def::coord ind = static_cast<def::coord>(i + this->data_->vb_.min_ind()); point1d p = point1d(ind); mln_postcondition(& this->operator()(p) == this->data_->buffer_ + i); return p; } template <typename T> inline void image1d<T>::resize_(unsigned new_border) { this->data_->reallocate_(new_border); } # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln # include <mln/core/trait/pixter.hh> # include <mln/core/dpoints_pixter.hh> # include <mln/core/pixter1d.hh> # include <mln/core/w_window.hh> namespace mln { namespace convert { namespace over_load { // histo::array -> image1d. template <typename V, typename T> inline void from_to_(const histo::array<V>& from, image1d<T>& to) { // FIXME: The code should looks like: // box1d b(point1d(mln_min(V)), point1d(mln_max(V))); // ima.init_(b, 0); // for_all(v) // from_to(h(v), ima.at_( index_of(v) )); to.init_(make::box1d(from.nvalues())); for (unsigned i = 0; i < from.nvalues(); ++i) from_to(from[i], to(point1d(i))); } // util::array -> image1d. template <typename V, typename T> inline void from_to_(const util::array<V>& from, image1d<T>& to) { to.init_(make::box1d(from.nelements())); for (unsigned i = 0; i < from.nelements(); ++i) from_to(from[i], to(point1d(i))); } } // end of namespace mln::convert::over_load } // end of namespace mln::convert namespace trait { // pixter template <typename T> struct fwd_pixter< image1d<T> > { typedef fwd_pixter1d< image1d<T> > ret; }; template <typename T> struct fwd_pixter< const image1d<T> > { typedef fwd_pixter1d< const image1d<T> > ret; }; template <typename T> struct bkd_pixter< image1d<T> > { typedef bkd_pixter1d< image1d<T> > ret; }; template <typename T> struct bkd_pixter< const image1d<T> > { typedef bkd_pixter1d< const image1d<T> > ret; }; // qixter template <typename T, typename W> struct fwd_qixter< image1d<T>, W > { typedef dpoints_fwd_pixter< image1d<T> > ret; }; template <typename T, typename W> struct fwd_qixter< const image1d<T>, W > { typedef dpoints_fwd_pixter< const image1d<T> > ret; }; template <typename T, typename W> struct bkd_qixter< image1d<T>, W > { typedef dpoints_bkd_pixter< image1d<T> > ret; }; template <typename T, typename W> struct bkd_qixter< const image1d<T>, W > { typedef dpoints_bkd_pixter< const image1d<T> > ret; }; // nixter template <typename T, typename W> struct fwd_nixter< image1d<T>, W > { typedef dpoints_fwd_pixter< image1d<T> > ret; }; template <typename T, typename W> struct fwd_nixter< const image1d<T>, W > { typedef dpoints_fwd_pixter< const image1d<T> > ret; }; template <typename T, typename W> struct bkd_nixter< image1d<T>, W > { typedef dpoints_bkd_pixter< image1d<T> > ret; }; template <typename T, typename W> struct bkd_nixter< const image1d<T>, W > { typedef dpoints_bkd_pixter< const image1d<T> > ret; }; } // end of namespace mln::trait } // end of namespace mln # include <mln/make/image.hh> #endif // ! MLN_CORE_IMAGE_IMAGE1D_HH
[ "trueg@kde.org" ]
trueg@kde.org
837de69fbcd34f458795b1846c871e7a5e96ce96
7a39a87916606615073c1b9aa374876b1ad5fce5
/11_16520436_02.ino
3fef1cf8770b5068e3abb31c08c7f401ae42fd97
[]
no_license
Ilsarstn/KU1202-K20-16520436
6fb7dedf97d6841bc57350d5f6dc885c9e3c2ecb
adaa3a8817048e7cc4de02b469c584eface0ab31
refs/heads/main
2023-04-19T14:55:44.845205
2021-04-29T09:22:42
2021-04-29T09:22:42
359,570,138
0
0
null
null
null
null
UTF-8
C++
false
false
334
ino
void setup() { pinMode(11, OUTPUT); pinMode(10, OUTPUT); pinMode(9, OUTPUT); } void loop() { analogWrite(11, 255); analogWrite(10, 0); analogWrite(9, 0); delay(1000); // Wait for 1000 millisecond(s) analogWrite(11, 255); analogWrite(10, 255); analogWrite(9, 102); delay(1000); // Wait for 1000 millisecond(s) }
[ "noreply@github.com" ]
Ilsarstn.noreply@github.com
3bd594deec1703bc4a8a66f5b92f89715af164db
fb8a3eecfd7ccf86daa5eedda31817b217207f9e
/test/Test.cpp
4c47c030d52bd48a0e0d9b26fc60b2969ef11b31
[ "Apache-2.0" ]
permissive
dipu-bd/tupin
7ae0bb093a5705b005d06447652eca8a2f733148
d5bca1cd7c9ecc54950a69a6477ac483a8307d1d
refs/heads/master
2021-01-13T12:50:22.908237
2017-02-03T13:24:27
2017-02-03T13:24:27
78,443,445
2
0
null
null
null
null
UTF-8
C++
false
false
1,173
cpp
#include <bits/stdc++.h> #include <execinfo.h> #include "../lib/tupin.h" #include "Data.hpp" #define FAILE_SAFE_MODE false typedef void (*FUNCTION)(void); typedef pair<FUNCTION, const char*> PFS; void runTests(bool failSafe, PFS all_tests[]) { int pass = 0, fail = 0; for (int i = 0; all_tests[i].first; i++) { FUNCTION f = all_tests[i].first; if (!failSafe) { f(); ++pass; printf("%s -- passed.", all_tests[i].second); } else { try { f(); ++pass; printf("%s -- passed.", all_tests[i].second); } catch (...) { ++fail; printf("%s -- failed.", all_tests[i].second); } } puts(""); } printf("\n-- Test Over: %d passed. %d failed.\n", pass, fail); } int main(int argc, char **argv) { PFS all_tests[] = { {&testNumber, "testNumber"}, {&testBool, "testBool"}, {&testString, "testString"}, {0, "null"}, }; runTests(FAILE_SAFE_MODE, all_tests); return 0; }
[ "dipu.sudipta@gmail.com" ]
dipu.sudipta@gmail.com
48387ffc04028c1b77de8ae31f7df090aef6d7d1
c774ccfd604caf197c411e45a81b73fb472cb10e
/src/functions/xlibfunctions.cpp
f2ea3f094ca7b06e9623d71c96d246df3411bfcf
[]
no_license
data-niklas/trac
2e9ea9363d1f2e848a0ed89aacd33b6ca67a0c39
6d7992e60a3165023add5c5fa50e6ad03d85cda8
refs/heads/main
2023-03-30T17:55:42.970948
2023-03-18T19:34:39
2023-03-18T19:34:39
348,401,685
0
1
null
2021-03-21T16:54:28
2021-03-16T15:37:33
C++
UTF-8
C++
false
false
1,406
cpp
#include "./xlibfunctions.h" #include "../libraries/xlib.h" #include "../variables/literal.h" #include <string> void registerXLibFunctions(Registry* r){ r->rFunction(new Function("window_name",[](vector<shared_ptr<Variable>> variables)->shared_ptr<Variable>{ XLib * xlib = XLib::getInstance(); shared_ptr<Variable> var = variables[0]; if (IS_TYPE(Int, intvalue, var)){ Window window = intvalue->value; if (window == 0){ return Void::noreturn(); } XTextProperty prop; XGetWMName(xlib->dpy, window, &prop); return shared_ptr<Variable>(new String(string((char*)prop.value))); } return Void::noreturn(); })); r->rFunction(new Function("is_active",[](vector<shared_ptr<Variable>> variables)->shared_ptr<Variable>{ XLib * xlib = XLib::getInstance(); static Atom ACTIVE_WINDOW = XInternAtom(xlib->dpy, "_NET_ACTIVE_WINDOW",false); Window window = xlib->getWindowProperty(xlib->root, ACTIVE_WINDOW); if (variables.size() != 1)return shared_ptr<Variable>(new Boolean(false)); else if (shared_ptr<Int> var = dynamic_pointer_cast<Int>(variables[0])){ return shared_ptr<Variable>(new Boolean(window == (long unsigned int)var->value)); } else return Void::noreturn(); })); }
[ "51879435+data-niklas@users.noreply.github.com" ]
51879435+data-niklas@users.noreply.github.com
be80a0dae6ce65a39017b5e1501cdeaf106e257b
79e1178d00bfa1b68ea5757e88a2737c5a97bd15
/examples/example_panel.cpp
11fed79395bf6e3722f13556ad63ec8283423bfb
[]
no_license
gtarim/libcppcurses
211bb7e68f1d5bfdba8dcbeb5c60cfdd5d5f5b7a
2a8453ebb9cabb8fe75013b2a37306a1d56d9f76
refs/heads/main
2023-01-07T01:49:11.948241
2020-11-11T20:16:50
2020-11-11T20:16:50
310,836,083
0
0
null
null
null
null
UTF-8
C++
false
false
2,312
cpp
#include <iostream> #include "curses/curses.hpp" int main(int argc, char const *argv[]) { int colsMin {40}, linesMin {23}; CursesUI::Curses curses { colsMin, linesMin }; curses.startColor(); curses.initColor(0, COLOR_WHITE, COLOR_BLACK); curses.initColor(1, COLOR_GREEN, COLOR_BLACK); CursesUI::Text text {}; text.write(0,LINES-2,"[ -> to hide panel",false); text.write(0,LINES-1,"] -> to show panel",false); if(!curses.isSizeFit()) { curses.refreshWin(); curses.enableItalic(true); text.write(0, 0, "Curses size is should be greater then" + std::to_string(colsMin) + "x" + std::to_string(linesMin), true); curses.enableItalic(false); getch(); curses.clearWin(); curses.endWin(); return -1; } CursesUI::Window window {0 ,0, COLS, 30}; CursesUI::Panel panelWindow {window.getWindow()}; CursesUI::Form form {1, COLS-4, 0, 1, 0, 0, A_UNDERLINE, O_STATIC }; window.create(form.getForm()); window.keypadEnable(true); curses.refreshWin(); form.post(); window.refresh(); CursesUI::Window nestedWindow {10 ,10, 10, 10}; CursesUI::Panel nestedPanel {nestedWindow.getWindow()}; CursesUI::Form nestedForm {1, COLS-4, 0, 1, 0, 0, A_UNDERLINE, O_STATIC}; nestedWindow.create(nestedForm.getForm()); nestedWindow.keypadEnable(true); nestedForm.post(); nestedWindow.refresh(); hide_panel(nestedPanel.getPanel()); int c; while((c = wgetch(window.getWindow())) != KEY_F(1)) { switch(c) { case '[': hide_panel(nestedPanel.getPanel()); nestedPanel.updatePanel(); break; case ']': show_panel(nestedPanel.getPanel()); nestedPanel.updatePanel(); break; case KEY_DC : //KEY_DELETE form.driveForm(REQ_CLR_FIELD); break; case 127: // KEY_BACKSPACE case KEY_BACKSPACE: form.driveForm(REQ_DEL_PREV); break; default: form.driveForm(REQ_END_LINE); form.driveForm(c); break; } window.refresh(); } form.unpost(); curses.clearWin(); curses.endWin(); return 0; }
[ "tarim.gokhan@gmail.com" ]
tarim.gokhan@gmail.com
6f816b29bd16ceaf157635f883afe223eda5a067
c2bce931866c14a3e1f1ab7172200437f30dab6c
/components/omnibox/browser/contextual_suggestions_service.cc
eae95a98f8ddf88df529ac93ec720c30feaeadc0
[ "BSD-3-Clause" ]
permissive
SnowCherish/chromium
a75107cdb9de144b6defb36907c603e50ded0720
61c360d1c6daf19e54c4f80af2644cf0ef9aecf9
refs/heads/master
2023-02-26T04:19:46.835972
2018-02-27T01:43:33
2018-02-27T01:43:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,695
cc
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/omnibox/browser/contextual_suggestions_service.h" #include <memory> #include <utility> #include "base/feature_list.h" #include "base/json/json_writer.h" #include "base/metrics/field_trial_params.h" #include "base/strings/stringprintf.h" #include "base/values.h" #include "components/data_use_measurement/core/data_use_user_data.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/search_engines/template_url_service.h" #include "components/sync/base/time.h" #include "components/variations/net/variations_http_headers.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/http/http_response_headers.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_context_getter.h" namespace { // Server address for the experimental suggestions service. const char kDefaultExperimentalServerAddress[] = "https://cuscochromeextension-pa.googleapis.com/v1/omniboxsuggestions"; void AddVariationHeaders(const std::unique_ptr<net::URLFetcher>& fetcher) { net::HttpRequestHeaders headers; // Add Chrome experiment state to the request headers. // Note: It's OK to pass SignedIn::kNo if it's unknown, as it does not affect // transmission of experiments coming from the variations server. // // Note: It's OK to pass InIncognito::kNo since we are expected to be in // non-incognito state here (i.e. contextual sugestions are not served in // incognito mode). variations::AppendVariationHeaders(fetcher->GetOriginalURL(), variations::InIncognito::kNo, variations::SignedIn::kNo, &headers); for (net::HttpRequestHeaders::Iterator it(headers); it.GetNext();) { fetcher->AddExtraRequestHeader(it.name() + ":" + it.value()); } } // Returns API request body. The final result depends on the following input // variables: // * <current_url>: The current url visited by the user. // * <experiment_id>: the experiment id associated with the current field // trial group. // // The format of the request body is: // // urls: { // url : <current_url> // // timestamp_usec is the timestamp for the page visit time, measured // // in microseconds since the Unix epoch. // timestamp_usec: <visit_time> // } // // stream_type = 1 corresponds to zero suggest suggestions. // stream_type: 1 // // experiment_id is only set when <experiment_id> is well defined. // experiment_id: <experiment_id> // std::string FormatRequestBodyExperimentalService(const std::string& current_url, const base::Time& visit_time) { auto request = std::make_unique<base::DictionaryValue>(); auto url_list = std::make_unique<base::ListValue>(); auto url_entry = std::make_unique<base::DictionaryValue>(); url_entry->SetString("url", current_url); url_entry->SetString( "timestamp_usec", std::to_string((visit_time - base::Time::UnixEpoch()).InMicroseconds())); url_list->Append(std::move(url_entry)); request->Set("urls", std::move(url_list)); // stream_type = 1 corresponds to zero suggest suggestions. request->SetInteger("stream_type", 1); const int experiment_id = OmniboxFieldTrial::GetZeroSuggestRedirectToChromeExperimentId(); if (experiment_id >= 0) request->SetInteger("experiment_id", experiment_id); std::string result; base::JSONWriter::Write(*request, &result); return result; } } // namespace ContextualSuggestionsService::ContextualSuggestionsService( SigninManagerBase* signin_manager, OAuth2TokenService* token_service, net::URLRequestContextGetter* request_context) : request_context_(request_context), signin_manager_(signin_manager), token_service_(token_service), token_fetcher_(nullptr) {} ContextualSuggestionsService::~ContextualSuggestionsService() {} void ContextualSuggestionsService::CreateContextualSuggestionsRequest( const std::string& current_url, const base::Time& visit_time, const TemplateURLService* template_url_service, net::URLFetcherDelegate* fetcher_delegate, ContextualSuggestionsCallback callback) { const GURL experimental_suggest_url = ExperimentalContextualSuggestionsUrl(current_url, template_url_service); if (experimental_suggest_url.is_valid()) CreateExperimentalRequest(current_url, visit_time, experimental_suggest_url, fetcher_delegate, std::move(callback)); else CreateDefaultRequest(current_url, template_url_service, fetcher_delegate, std::move(callback)); } void ContextualSuggestionsService::StopCreatingContextualSuggestionsRequest() { std::unique_ptr<identity::PrimaryAccountAccessTokenFetcher> token_fetcher_deleter(std::move(token_fetcher_)); } // static GURL ContextualSuggestionsService::ContextualSuggestionsUrl( const std::string& current_url, const TemplateURLService* template_url_service) { if (template_url_service == nullptr) { return GURL(); } const TemplateURL* search_engine = template_url_service->GetDefaultSearchProvider(); if (search_engine == nullptr) { return GURL(); } const TemplateURLRef& suggestion_url_ref = search_engine->suggestions_url_ref(); const SearchTermsData& search_terms_data = template_url_service->search_terms_data(); base::string16 prefix; TemplateURLRef::SearchTermsArgs search_term_args(prefix); if (!current_url.empty()) { search_term_args.current_page_url = current_url; } return GURL(suggestion_url_ref.ReplaceSearchTerms(search_term_args, search_terms_data)); } GURL ContextualSuggestionsService::ExperimentalContextualSuggestionsUrl( const std::string& current_url, const TemplateURLService* template_url_service) const { if (current_url.empty()) { return GURL(); } if (!base::FeatureList::IsEnabled(omnibox::kZeroSuggestRedirectToChrome) || template_url_service == nullptr) { return GURL(); } // Check that the default search engine is Google. const TemplateURL& default_provider_url = *template_url_service->GetDefaultSearchProvider(); const SearchTermsData& search_terms_data = template_url_service->search_terms_data(); if (default_provider_url.GetEngineType(search_terms_data) != SEARCH_ENGINE_GOOGLE) { return GURL(); } const std::string server_address_param = OmniboxFieldTrial::GetZeroSuggestRedirectToChromeServerAddress(); GURL suggest_url(server_address_param.empty() ? kDefaultExperimentalServerAddress : server_address_param); // Check that the suggest URL for redirect to chrome field trial is valid. if (!suggest_url.is_valid()) { return GURL(); } // Check that the suggest URL for redirect to chrome is HTTPS. if (!suggest_url.SchemeIsCryptographic()) { return GURL(); } return suggest_url; } void ContextualSuggestionsService::CreateDefaultRequest( const std::string& current_url, const TemplateURLService* template_url_service, net::URLFetcherDelegate* fetcher_delegate, ContextualSuggestionsCallback callback) { const GURL suggest_url = ContextualSuggestionsUrl(current_url, template_url_service); DCHECK(suggest_url.is_valid()); net::NetworkTrafficAnnotationTag traffic_annotation = net::DefineNetworkTrafficAnnotation("omnibox_zerosuggest", R"( semantics { sender: "Omnibox" description: "When the user focuses the omnibox, Chrome can provide search or " "navigation suggestions from the default search provider in the " "omnibox dropdown, based on the current page URL.\n" "This is limited to users whose default search engine is Google, " "as no other search engines currently support this kind of " "suggestion." trigger: "The omnibox receives focus." data: "The URL of the current page." destination: GOOGLE_OWNED_SERVICE } policy { cookies_allowed: YES cookies_store: "user" setting: "Users can control this feature via the 'Use a prediction service " "to help complete searches and URLs typed in the address bar' " "settings under 'Privacy'. The feature is enabled by default." chrome_policy { SearchSuggestEnabled { policy_options {mode: MANDATORY} SearchSuggestEnabled: false } } })"); const int kFetcherID = 1; std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(kFetcherID, suggest_url, net::URLFetcher::GET, fetcher_delegate, traffic_annotation); fetcher->SetRequestContext(request_context_); data_use_measurement::DataUseUserData::AttachToFetcher( fetcher.get(), data_use_measurement::DataUseUserData::OMNIBOX); AddVariationHeaders(fetcher); fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); std::move(callback).Run(std::move(fetcher)); } void ContextualSuggestionsService::CreateExperimentalRequest( const std::string& current_url, const base::Time& visit_time, const GURL& suggest_url, net::URLFetcherDelegate* fetcher_delegate, ContextualSuggestionsCallback callback) { DCHECK(suggest_url.is_valid()); // This traffic annotation is nearly identical to the annotation for // `omnibox_zerosuggest`. The main difference is that the experimental traffic // is not allowed cookies. net::NetworkTrafficAnnotationTag traffic_annotation = net::DefineNetworkTrafficAnnotation("omnibox_zerosuggest_experimental", R"( semantics { sender: "Omnibox" description: "When the user focuses the omnibox, Chrome can provide search or " "navigation suggestions from the default search provider in the " "omnibox dropdown, based on the current page URL.\n" "This is limited to users whose default search engine is Google, " "as no other search engines currently support this kind of " "suggestion." trigger: "The omnibox receives focus." data: "The user's OAuth2 credentials and the URL of the current page." destination: GOOGLE_OWNED_SERVICE } policy { cookies_allowed: NO setting: "Users can control this feature via the 'Use a prediction service " "to help complete searches and URLs typed in the address bar' " "settings under 'Privacy'. The feature is enabled by default." chrome_policy { SearchSuggestEnabled { policy_options {mode: MANDATORY} SearchSuggestEnabled: false } } })"); const int kFetcherID = 1; std::string request_body = FormatRequestBodyExperimentalService(current_url, visit_time); std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(kFetcherID, suggest_url, /*request_type=*/net::URLFetcher::POST, fetcher_delegate, traffic_annotation); fetcher->SetUploadData("application/json", request_body); fetcher->SetRequestContext(request_context_); data_use_measurement::DataUseUserData::AttachToFetcher( fetcher.get(), data_use_measurement::DataUseUserData::OMNIBOX); AddVariationHeaders(fetcher); fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); const bool should_fetch_access_token = (signin_manager_ != nullptr) && (token_service_ != nullptr); // If authentication services are unavailable or if this request is still // waiting for an oauth2 token, run the contextual service without access // tokens. if (!should_fetch_access_token || (token_fetcher_ != nullptr)) { std::move(callback).Run(std::move(fetcher)); return; } // Create the oauth2 token fetcher. const OAuth2TokenService::ScopeSet scopes{ "https://www.googleapis.com/auth/cusco-chrome-extension"}; token_fetcher_ = std::make_unique<identity::PrimaryAccountAccessTokenFetcher>( "contextual_suggestions_service", signin_manager_, token_service_, scopes, base::BindOnce(&ContextualSuggestionsService::AccessTokenAvailable, base::Unretained(this), std::move(fetcher), std::move(callback)), identity::PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable); } void ContextualSuggestionsService::AccessTokenAvailable( std::unique_ptr<net::URLFetcher> fetcher, ContextualSuggestionsCallback callback, const GoogleServiceAuthError& error, const std::string& access_token) { DCHECK(token_fetcher_); std::unique_ptr<identity::PrimaryAccountAccessTokenFetcher> token_fetcher_deleter(std::move(token_fetcher_)); // If there were no errors obtaining the access token, append it to the // request as a header. if (error.state() == GoogleServiceAuthError::NONE) { DCHECK(!access_token.empty()); fetcher->AddExtraRequestHeader( base::StringPrintf("Authorization: Bearer %s", access_token.c_str())); } std::move(callback).Run(std::move(fetcher)); }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
e7c0bda4c7b3716f31632a149168cbc1e609c514
4af341026c371c8e25d37780c3d2a85063ec60ea
/CSES-Tree Algorithm- P 4 - Tree Distance 1 - DP on Trees - Interesting subproblem - THINK.cpp
d99f55c9f043b424b21a9b81f1328536cede0595
[]
no_license
i-am-arvinder-singh/CP
46a32f9235a656e7d777a16ccbce980cb1eb1c63
e4e79e4ffc636f078f16a25ce81a3095553fc060
refs/heads/master
2023-07-12T19:20:41.093734
2021-08-29T06:58:55
2021-08-29T06:58:55
266,883,239
1
1
null
2020-10-04T14:00:29
2020-05-25T21:25:39
C++
UTF-8
C++
false
false
3,660
cpp
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds;//which means policy based DS #define endl "\n" #define ll long long #define int long long #define ff first #define ss second #define fl(i,a,b) for(int i=(int)a; i<(int)b; i++) #define bfl(i,a,b) for(int i=(int)a-1; i>=(int)b; i--) #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define vt(type) vector<type> #define omniphantom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define mii map<int,int> #define pqb priority_queue<int> //Below is implementation of min heap #define pqs priority_queue<int,vi,greater<int> > #define setbits(x) __builtin_popcountll(x) #define zrobits(x) __builtin_ctzll(x) #define mod 1000000007 #define inf 1e18 #define ps(x,y) fixed<<setprecision(y)<<x #define mk(arr,n,type) type *arr=new type[n]; #define w(x) int x; cin>>x; while(x--) #define pw(b,p) pow(b,p) + 0.1 #define ini const int #define sz(v) ((int)(v).size()) #define ppii pair<int,pii> #define tup tuple<int,int,int> #define LEFT(x) 2*x+1 #define RIGHT(x) 2*x+2 const double pi = acos(-1.0); typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; class dpOnTrees{ vector<vector<int>> edges; vector<vector<int>> dp; vector<int> depth; vector<int> ans; int n, dia; public: dpOnTrees(vector<vector<int>> edges, int n){ this->edges = edges; this->n = n; depth = vector<int> (n+2); ans = vector<int> (n+2,0); } void solve(){ depthDfs(1,-1); solve(1,-1,-1); for(int i=1;i<=n;i++) cout<<ans[i]<<" "; cout<<endl; } int depthDfs(int node, int par){ int ans = 0; for(auto child : edges[node]){ if(child==par) continue; ans = max(ans,1+depthDfs(child,node)); } return depth[node] = ans; } void solve(int node, int par, int par_ans){ vector<int> pref,suff; for(auto child:edges[node]){ if(child==par) continue; pref.pb(depth[child]); suff.pb(depth[child]); } for(int i=1;i<(int)pref.size();i++) pref[i] = max(pref[i-1] , pref[i]); for(int i=(int)suff.size()-2;i>=0;i--) suff[i] = max(suff[i+1] , suff[i]); int c_cnt = 0; for(auto child:edges[node]){ if(child==par) continue; int left = (c_cnt==0) ? -inf : pref[c_cnt-1]; int right = (c_cnt==(int)pref.size()-1) ? -inf : suff[c_cnt+1]; int top = par_ans + 1; solve(child,node,max({left+1,right+1,top})); c_cnt++; } ans[node] = max({ans[node], (pref.empty()?0:pref.back()+1), par_ans+1}); } }; void solve() { int n; cin>>n; vector<vector<int>> edges(n+2); for(int i=2;i<=n;i++){ int x,y; cin>>x>>y; edges[x].pb(y); edges[y].pb(x); } dpOnTrees t(edges,n); t.solve(); } int32_t main() { omniphantom #if 0 w(t) #endif // 0 solve(); return 0; }
[ "arvinderavy@ymail.com" ]
arvinderavy@ymail.com
13a7c018ed6584312d3b8b29b7360bc007b104f4
d7a22f2cc02cf75f96a41b8fdbffb894efb973aa
/include/competicion.h
3d923c1b4333e4ab7c0645c66c0892dd3241033c
[]
no_license
jacedleon/DyAA-P6
a2ed7b18132905b76b41bc8941e95fc14c291f64
431016a9593715fb8d43b88be76c3db4b3fefad0
refs/heads/master
2022-10-05T17:12:33.000720
2020-03-23T22:00:33
2020-03-23T22:00:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
426
h
#pragma once #include <iostream> #include <cmath> #include <vector> class Competicion { public: Competicion(); ~Competicion(); void formarTabla(std::vector<std::vector<int>> &tabla, int inf, int sup); void completarTabla(std::vector<std::vector<int>> &tabla, int infTeam, int supTeam, int infDay, int supDay, int initialTeam); void calendario(std::vector<std::vector<int>> &tabla); };
[ "acevedodeleonjorge@gmail.com" ]
acevedodeleonjorge@gmail.com
88c56760a720b3248d42e5176c58bfeddc33d4eb
0d906075ab29e3e0d48f985007db6d1d2e78caf9
/android/testsurface/app/src/main/cpp/OpenGLHelper.h
33884aba89ce91c767bede4f3f2992582e0bc4b9
[]
no_license
chenyue0102/mytestchenyue
b3010bf84f46f8b285c3a4bfe926b63bcf5ecb51
ce4dc403dcbbaee513150c823f3a26501ef1ff55
refs/heads/master
2023-08-30T23:31:33.419958
2023-08-25T09:53:05
2023-08-25T09:53:05
32,462,298
0
0
null
2023-07-20T12:15:34
2015-03-18T14:03:46
C++
UTF-8
C++
false
false
1,997
h
#ifndef OPENGLHELPER_H #define OPENGLHELPER_H #include <assert.h> #include <GLES3/gl3.h> extern "C"{ #include <android/log.h> }; #define BUFFER_OFFSET(offset) ((void*)(offset)) #define GLLOG(fmt, ...) \ __android_log_print(ANDROID_LOG_ERROR, "opengles", fmt, __VA_ARGS__) inline void CHECKERR() { int err = 0; if (GL_NO_ERROR != (err = glGetError())){ GLLOG("glGetError=%d\n", err); assert(false); } } #define CHECK_BREAK \ if (GL_NO_ERROR != (ret = glGetError())) { \ GLLOG("glGetError=%x\n", ret); \ assert(false); \ break; \ } namespace OpenGLHelper { void outputCompileShader(GLuint shader); void outputProgramLog(GLuint program); //bool SaveBitmap(const char* pFileName, int width, int height, int biBitCount, const void* pBuf, int nBufLen); GLenum attachShader(GLuint program, GLenum type, const char *source, GLint len); GLenum createTexture2D(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint filterParam, GLuint& tex); GLenum createArrayBuffer(const void* vertexPointsBuffer, GLsizei vlen, const void* colorPointsBuffer, GLsizei clen, GLuint& buf); template<typename VEC2, typename VEC3> static void getTangent(const VEC3 &vertexPos1, const VEC3 &vertexPos2, const VEC3 &vertexPos3, const VEC2 &uv1, const VEC2 &uv2, const VEC2 &uv3, const VEC3 &normal, VEC3 &tangent, VEC3 &bitangent) { VEC3 edge1 = vertexPos2 - vertexPos1; VEC3 edge2 = vertexPos3 - vertexPos1; VEC2 deltaUV1 = uv2 - uv1; VEC2 deltaUV2 = uv3 - uv1; float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y); tangent.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);//x tangent.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);//y tangent.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);//z bitangent.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);//x bitangent.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);//y bitangent.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);//z } }; #endif
[ "chenyue@ksjgs.com" ]
chenyue@ksjgs.com
37bc5b1b5c7a73c11fe1472b79553a1c25ddc856
16e69f48b3891ba36f52d0961dbf620613d31810
/QCDraw/Graphics/altermatorgraphic.cpp
7392fcc4f099b5cd392e3aacb0f61286761ca41a
[]
no_license
zrhcheer/QCDraw
7852bd6238908868870ded56926ba5b2aaef8ea8
6c91871d5ae6349847c94f194a54acce7cd6e267
refs/heads/master
2020-12-31T00:11:04.310183
2017-03-29T05:06:01
2017-03-29T05:06:01
86,538,623
0
0
null
null
null
null
GB18030
C++
false
false
2,454
cpp
#include "altermatorgraphic.h" #include "codeconvertor.h" const QString AlterMatorGraphic::_devName = CodeConvertor::fromLocal("发电机"); AlterMatorGraphic::AlterMatorGraphic() { setType(Graphic::GRAPHIC_ALTERMATOR); this->setColor(QColor(22,149,19)); _bOpen = true; this->setDirect(Graphic::POS_UP); _portPoints.resize(1); } void AlterMatorGraphic::setSize(const int &height) { if(height < ELE_MIN_SIZE) { _size.setHeight(ELE_MIN_SIZE); } else { _size.setHeight(height); } _size.setWidth(height * 2 / 3); } QPointF AlterMatorGraphic::getPortPos(int pos) { switch(pos) { case Graphic::JOIN_BEGIN: return _portPoints[Graphic::JOIN_BEGIN].getJoinPoint(); break; default: assert(false); break; } } void AlterMatorGraphic::loadPortPos() { float halfHeight = _size.height() / 2.0; switch(this->getDirect()) { case POS_UP: _portPoints[Graphic::JOIN_BEGIN].setJoinPoint(QPointF(0, -halfHeight)); return; case POS_RIGHT: _portPoints[Graphic::JOIN_BEGIN].setJoinPoint(QPointF(halfHeight,0)); return; case POS_DOWN: _portPoints[Graphic::JOIN_BEGIN].setJoinPoint(QPointF(0, halfHeight)); return; case POS_LEFT: _portPoints[Graphic::JOIN_BEGIN].setJoinPoint(QPointF(-halfHeight,0)); return; } } void AlterMatorGraphic::prepareGraphic(QPainter *painter) { GraphicBase::prepareGraphic(painter); switch(this->getDirect()) { case POS_UP: break; case POS_RIGHT: painter->rotate(90); break; case POS_DOWN: painter->rotate(180); break; case POS_LEFT: painter->rotate(270); break; } } void AlterMatorGraphic::drawGraphic(QPainter *painter) { float radius = _size.height() / 3;//半径 painter->drawLine(0, - radius*3/2, 0, - radius/2); painter->setBrush(Qt::NoBrush); painter->drawEllipse(QPointF(0, radius / 2),radius ,radius); // 绘制贝塞尔曲线 QPoint start_pos(0,- radius/2 + CONTROLSTYLE); QPoint end_pos(0, radius*3/2 - CONTROLSTYLE); //drawPath; QPainterPath path(start_pos); QPoint c1(radius * (1.73)/2 + CONTROLSTYLE,0 + 2*CONTROLSTYLE); QPoint c2(-radius * (1.73)/2 - CONTROLSTYLE,radius*3/4 - CONTROLSTYLE); path.cubicTo(c1 ,c2 ,end_pos ); painter->drawPath(path); }
[ "zrhcheer@126.com" ]
zrhcheer@126.com
666a2132ee1b0817d7cc9ba6352fe721881ff0e0
6b40e9cba1dd06cd31a289adff90e9ea622387ac
/Develop/CSCommon/include/CServerApplication.h
d42b0ce7610b0aab5a12a848725eec8085796ed1
[]
no_license
AmesianX/SHZPublicDev
c70a84f9170438256bc9b2a4d397d22c9c0e1fb9
0f53e3b94a34cef1bc32a06c80730b0d8afaef7d
refs/heads/master
2022-02-09T07:34:44.339038
2014-06-09T09:20:04
2014-06-09T09:20:04
null
0
0
null
null
null
null
UHC
C++
false
false
1,768
h
#pragma once #include <windows.h> #include "CSCommonLib.h" #include "MCommandLine.h" #define MAX_SERVER_TICK_DELTA (1.0f) ///< 아무리 랙이 걸려도 delta값은 1초를 초과하지 않는다. /// 서버 실행 타입 enum CServerAppType { APPTYPE_WINDOW = 0, ///< 윈도우 어플리케이션 APPTYPE_CONSOLE, ///< 콘솔 어플리케이션 APPTYPE_SERVICE ///< 서비스 어플리케이션 }; class CSCOMMON_API CServerApplication { private: CServerAppType m_nAppType; bool m_bRun; DWORD m_dwMainThreadID; unsigned int m_nLastTime; static LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static CServerApplication* m_pInstance; static void SignalHandler( int signo); void Update(); bool InitMainWnd(int x, int y, int width, int height, const char* szClassName, const char* szName, UINT nMenuID, UINT nIconID); void CatchTerminationSignal(void handler(int)); protected: HWND m_hWnd; cml2::MCommandLine m_CommandLine; virtual bool OnCreate() { return true; } virtual void OnUpdate(float fDelta) { } virtual void OnDestroy() { } virtual void OnPaint() { } virtual void OnMsg( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); void Destroy(); int Run_Window(); int Run_Console(); bool IsMainThread(DWORD dwCurThreadID) { return (m_dwMainThreadID == dwCurThreadID); } public: CServerApplication(); virtual ~CServerApplication(); int Run(); void Quit() { m_bRun = false; } bool Create(int x, int y, int width, int height, const char* szClassName, const char* szName, UINT nMenuID, UINT nIconID); bool CreateConsole(const char* szName); const cml2::MCommandLine& GetCommandLine() { return m_CommandLine; } };
[ "shzdev@8fd9ef21-cdc5-48af-8625-ea2f38c673c4" ]
shzdev@8fd9ef21-cdc5-48af-8625-ea2f38c673c4
cd6eb1650a093d67c8126118096d359e7fc9c5c8
58a70d809b9cd9676ea5e1746c68533f3e3c7750
/src/C_lineFighter_Server/lineFighter/CGameMaster.h
25c36ac567f4e750df039b9817de1fad6a6d13e1
[]
no_license
liodo198592/linefighter
3b66fa265d6c47e3a228285fd88dba8bceb7d22f
54ff8b0e4b30da622c6eceab08bf44b306207a16
refs/heads/master
2020-04-11T06:16:45.337075
2018-12-13T03:08:47
2018-12-13T03:08:47
161,576,563
0
0
null
null
null
null
GB18030
C++
false
false
312
h
#ifndef CGameMaster_H #define CGameMaster_H #include "global.h" #include "RingBuf.h" #include "CProtocol.h" class CGameMaster : public ACE_Task<ACE_MT_SYNCH> { public: CGameMaster(){}//默认补召数据时间间隔 virtual ~CGameMaster(){} ACE_INT64 run(); protected: ACE_INT32 svc(); private: }; #endif
[ "hrj_zhouyu@163.com" ]
hrj_zhouyu@163.com
ef3838af01e154e1a71ba59f2a2653a1edb8951a
333b58a211c39f7142959040c2d60b69e6b20b47
/Odyssey/IsmScsiServer/ScsiXfer.cpp
34e874a1e4522f56e33c5e3a679d85726c1ea85f
[]
no_license
JoeAltmaier/Odyssey
d6ef505ade8be3adafa3740f81ed8d03fba3dc1a
121ea748881526b7787f9106133589c7bd4a9b6d
refs/heads/master
2020-04-11T08:05:34.474250
2015-09-09T20:03:29
2015-09-09T20:03:29
42,187,845
0
0
null
null
null
null
UTF-8
C++
false
false
2,715
cpp
/*************************************************************************/ // This material is a confidential trade secret and proprietary // information of ConvergeNet Technologies, Inc. which may not be // reproduced, used, sold or transferred to any third party without the // prior written consent of ConvergeNet Technologies, Inc. This material // is also copyrighted as an unpublished work under sections 104 and 408 // of Title 17 of the United States Code. Law prohibits unauthorized // use, copying or reproduction. // // File: ScsiXfer.c // // Description: // This file implements Transfer methods for the SCSI Server // // Update Log // $Log: /Gemini/Odyssey/IsmScsiServer/ScsiXfer.cpp $ // // 3 11/15/99 4:03p Mpanas // Re-organize sources // - Add new files: ScsiInquiry.cpp, ScsiReportLUNS.cpp, // ScsiReserveRelease.cpp // - Remove unused headers: ScsiRdWr.h, ScsiMessage.h, ScsiXfer.h // - New Listen code // - Use Callbacks // - All methods part of SCSI base class // // // 12/14/98 Michael G. Panas: Create file /*************************************************************************/ #include "SCSIServ.h" #include "ScsiSense.h" #include "Scsi.h" #include <string.h> /*************************************************************************/ // Forward References /*************************************************************************/ //************************************************************************ // // ScsiSendData() // Copy the data at the location pSrc to the address in the SGL. // The SGL is contained in the original message. //************************************************************************ U32 ScsiServerIsm::ScsiSendData(SCSI_CONTEXT *p_context, U8 *pSrc, U32 Length) { U32 result; Message *pMsg = p_context->pMsg; TRACE_ENTRY(ScsiSendData); // Copy data to the SGL return buffer, starting at the given offset // within the return buffer. Truncates data if it won't fit. // Handles multiple return buffer fragments. // Returns the number of bytes NOT returned (hopefully 0). result = pMsg->CopyToSgl(0, 0, (void *) pSrc, (long) Length); if (result != 0) return (result); return(0); } // ScsiSendData //************************************************************************ // // ScsiGetData() // Copy data from the address in the SGL to the location at pDst //************************************************************************ U32 ScsiServerIsm::ScsiGetData(SCSI_CONTEXT *p_context, U8 *pDst, U32 Length) { // TODO Message *pMsg = p_context->pMsg; TRACE_ENTRY(ScsiGetData); return(0); } // ScsiGetData
[ "joe.altmaier@sococo.com" ]
joe.altmaier@sococo.com
bfd4cdd6198fe1a1a7ff46f91713055b2d015b00
a9ab72c3dd7fdfe8b6e0b1b5e296bf4c39b9989d
/round2/leetcode106.cpp
03174b52716707495b1b4f75e4bd6c346d217cf9
[]
no_license
keqhe/leetcode
cd82fc3d98b7fc71a9a08c5e438aa1f82737d76f
86b2a453255c909f94f9ea3be7f2a97a6680a854
refs/heads/master
2020-12-24T06:38:15.444432
2016-12-07T19:15:02
2016-12-07T19:15:02
48,405,123
0
0
null
null
null
null
UTF-8
C++
false
false
1,031
cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: struct TreeNode * helper(vector<int>&inorder, vector<int>&postorder, int s1, int e1, int s2, int e2) { if (s1 > e1 || s2 > e2) return NULL; struct TreeNode * root = new TreeNode(postorder[e2]); if (s2 == e2) return root; int index; for (int i = s1; i <= e1; i ++) { if (inorder[i] == root->val) { index = i; break; } } root->left = helper(inorder, postorder, s1, index-1, s2, s2+index-s1-1); root->right = helper(inorder, postorder, index+1, e1, s2+index-s1, e2-1); return root; } TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) { return helper(inorder, postorder, 0, inorder.size()-1, 0, postorder.size()-1); } };
[ "keqhe@cs.wisc.edu" ]
keqhe@cs.wisc.edu
62a8704249ab345c972c35ce95bd9272ac375bdd
442cb88aa69ea9f8c85bf476d3afb130da886e9c
/src/PathBuilder.cpp
a8fad0d33e92f2a9c8619441468eaaf946b7d746
[ "Apache-2.0" ]
permissive
jim-bcom/xpcf
bcb4e3b6a76e2266a86a68f1f36a0dad313bab08
26ce21929ff6209ef69117270cf49844348c988f
refs/heads/master
2023-09-01T15:22:02.488646
2021-10-04T11:56:09
2021-10-04T11:56:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,018
cpp
/** * @copyright Copyright (c) 2017 B-com http://www.b-com.com/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @author Loïc Touraine * * @file * @brief description of file * @date 2017-11-23 */ #include "PathBuilder.h" #include <boost/filesystem/detail/utf8_codecvt_facet.hpp> #include <boost/predef/os.h> #ifdef WIN32 #include <stdlib.h> #else #include <pwd.h> #include <sys/types.h> #endif #include <regex> #include <boost/filesystem/detail/utf8_codecvt_facet.hpp> namespace fs = boost::filesystem; namespace org { namespace bcom { namespace xpcf { PathBuilder::PathBuilder() { } fs::path PathBuilder::findRegistries() { return ""; } fs::path PathBuilder::getUTF8PathObserver(const char * sourcePath) { fs::detail::utf8_codecvt_facet utf8; fs::path utf8ObservedPath(sourcePath, utf8); return utf8ObservedPath; } fs::path PathBuilder::getUTF8PathObserver(const std::string & sourcePath) { return getUTF8PathObserver(sourcePath.c_str()); } fs::path PathBuilder::replaceRootEnvVars(const std::string & sourcePath) { // find any $ENVVAR and substitut fs::path completePath = getUTF8PathObserver(sourcePath); // howto manage i18n on env vars ? : env vars don't support accented characters std::string regexStr="^\\$([a-zA-Z0-9_]*)/"; std::regex envVarRegex(regexStr, std::regex_constants::extended); std::smatch sm; if (std::regex_search(sourcePath, sm, envVarRegex)) { std::string matchStr = sm.str(1); char * envVar = getenv(matchStr.c_str()); if (envVar != nullptr) { fs::path envStr (envVar); std::string replacedStr = std::regex_replace(sourcePath, envVarRegex, ""); fs::path subdir (replacedStr); completePath = envStr / subdir; } } return completePath; } fs::path PathBuilder::buildModuleFolderPath(const std::string & filePathStr) { fs::path filePath(replaceRootEnvVars(filePathStr)); #ifdef XPCFSUBDIRSEARCH fs::path modeSubDir = XPCFSUBDIRSEARCH; if ( fs::exists( filePath / modeSubDir ) ) { filePath /= modeSubDir; } #endif return filePath; } fs::path PathBuilder::buildModuleFilePath(const std::string & moduleName, const std::string & filePathStr) { fs::path filePath = buildModuleFolderPath(filePathStr); fs::path moduleFileName = getUTF8PathObserver(moduleName.c_str()); filePath /= moduleFileName; return filePath; } fs::path PathBuilder::getHomePath() { char * homePathStr; fs::path homePath; #ifdef WIN32 homePathStr = getenv("USERPROFILE"); if (homePathStr == nullptr) { homePathStr = getenv("HOMEDRIVE"); if (homePathStr) { homePath = getUTF8PathObserver(homePathStr); homePath /= getenv("HOMEPATH"); } } else { homePath = getUTF8PathObserver(homePathStr); } #else struct passwd* pwd = getpwuid(getuid()); if (pwd) { homePathStr = pwd->pw_dir; } else { // try the $HOME environment variable homePathStr = getenv("HOME"); } homePath = getUTF8PathObserver(homePathStr); #endif return homePath; } fs::path PathBuilder::getXPCFHomePath() { fs::path xpcfHomePath = getHomePath(); xpcfHomePath /= ".xpcf"; return xpcfHomePath; } static fs::path suffix() { // https://sourceforge.net/p/predef/wiki/OperatingSystems/ #if BOOST_OS_MACOS || BOOST_OS_IOS return ".dylib"; #elif BOOST_OS_WINDOWS return L".dll"; #else return ".so"; #endif } fs::path PathBuilder::appendModuleDecorations(const fs::path & sl) { fs::path actual_path = sl; if ( actual_path.stem() == actual_path.filename() ) { // there is no suffix actual_path += suffix().native(); } #if BOOST_OS_WINDOWS if (!fs::exists(actual_path)) { // MinGW loves 'lib' prefix and puts it even on Windows platform actual_path = (actual_path.has_parent_path() ? actual_path.parent_path() / L"lib" : L"lib").native() + actual_path.filename().native(); } #else //posix actual_path = (std::strncmp(actual_path.filename().string().c_str(), "lib", 3) ? (actual_path.has_parent_path() ? actual_path.parent_path() / L"lib" : L"lib").native() + actual_path.filename().native() : actual_path); #endif return actual_path; } fs::path PathBuilder::appendModuleDecorations(const char * sl) { fs::path currentPath = getUTF8PathObserver(sl); return appendModuleDecorations(currentPath); } }}}
[ "loic.touraine@gmail.com" ]
loic.touraine@gmail.com
0ad2930738b2d36552c958b5d92398d80b283bca
45ed614a494c70c55340a7fd5c178fd0d62bc15e
/004_Median_of_Two_Sorted_Arrays/Solution.cpp
3e403ae225ac1c1dca8710f243c7eaa1ae9a5c15
[]
no_license
ericaliu0610/XcodeLeetcode
04ac31931d2a1a7aeb73275b9df8356261caa01d
478ee97fdba6a46008660692d2f85a2bf0506b0d
refs/heads/master
2021-01-13T06:07:03.635570
2015-06-18T01:25:08
2015-06-18T01:25:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,242
cpp
// // Solution.cpp // 004_Median_of_Two_Sorted_Arrays // // Created by Chao Li on 6/11/15. // Copyright (c) 2015 Chao Li. All rights reserved. // // Solution shared at https://leetcode.com/discuss/35275/c-implementation-o-log-m-n-with-vector-int-as-parameters #include "Solution.h" double Solution::findMedianSortedArrays(vector<int> &nums1, vector<int> &nums2) { size_t size_1 = nums1.size(); size_t size_2 = nums2.size(); int k = int((size_1 + size_2) / 2); int res1 = Kth(nums1.begin(), size_1, nums2.begin(), size_2, k+1); if ((size_1 + size_2) % 2 == 0) { int res2 = Kth(nums1.begin(), size_1, nums2.begin(), size_2, k); return ( (double) res1 + res2) / 2.0; } return res1; } int Solution::Kth(Iter start1, size_t size_1, Iter start2, size_t size_2, int kth) { if (size_1 > size_2) return Kth(start2 , size_2, start1, size_1, kth); if (size_1 == 0) return *(start2 + kth - 1); if (kth == 1) return min(*start1, *start2); int index_1 = min(int(size_1), kth / 2); int index_2 = kth - index_1; if (*(start1 + index_1 - 1) > *(start2 + index_2 - 1)) return Kth(start1, size_1 ,start2 + index_2, size_2 - index_2, kth - index_2); return Kth(start1 + index_1, size_1 - index_1, start2, index_2, kth - index_1); }
[ "lichaorodxx@gmail.com" ]
lichaorodxx@gmail.com
1631e1dd63922d9874b20b2e6ab2182dd9808c76
5125c4e2e090715715b514b1a2ebf2fe1ccd625c
/src/OpenCV244vc11/OpenCV244vc11/test.h
c293e46c0effae1508472fb862ed2528d1e07600
[]
no_license
NecroArt/Diploma
33883375acd4d4dfdda90d032d85be137cf0b939
ef848d2aeb7de5b29d2e2c2742cea44dde8a6bb6
refs/heads/master
2016-09-06T05:47:49.668705
2013-07-13T14:12:29
2013-07-13T14:12:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
80
h
#ifndef TEST_H #define TEST_H #include "stdafx.h" using namespace std; #endif
[ "necroart@myopera.com" ]
necroart@myopera.com
f4187407d4a86d84d902fe9e1b597f53a33878ab
d2a1055a1d29e31e7f8b768d38a5581a3989474b
/c++ projects/my-projects/STL/vector/vector.cpp
bc4a7220651a8b82a82b7d4546b2c2477e361a78
[]
no_license
ZiadElgammal/data-structure-c-
52adca46584e5be1dd8e3101a5e66d3583b2adea
da9843d1b327a951d16543ec60a174c1032c69c3
refs/heads/master
2020-06-13T01:05:12.923507
2019-06-30T06:30:57
2019-06-30T06:30:57
194,483,149
0
0
null
null
null
null
UTF-8
C++
false
false
1,328
cpp
//vector #include <iostream> #include <vector> #include<algorithm> using namespace std; int main() { std::vector<int> v1; // decleare vector v1: for (int i = 0; i < 20; i++) v1.push_back(rand() % 100); //push 20 random integers std::cout << "v1 contains:"; //return elements using iterator for (auto i = v1.begin(); i != v1.end(); ++i) std::cout << *i << " "; //remove elements at index 3 v1.erase(v1.begin() + 3); //return all elements with iterator std::cout << "\nv1 contains:"; for (auto i = v1.begin(); i != v1.end(); ++i) std::cout << *i << " "; // sort vector std::stable_sort(v1.begin(),v1.end()); cout<<"\n sorted v1:"; for (auto i = v1.begin(); i != v1.end(); ++i) std::cout << *i << " "; cout<<"\n"; // search for an element that exists std::vector<int>::iterator it = std::find(v1.begin(),v1.end(),92); int index = std::distance(v1.begin(), it); if (it != v1.end()) std::cout << "Element Found at index "<< index << std::endl; else std::cout << "Element Not Found" << std::endl; //search for an element that doesn't exists it = std::find(v1.begin(),v1.end(),2000); if (it != v1.end()) std::cout << "Element Found at index"<<index << std::endl; else std::cout << "Element Not Found" << std::endl; return 0; }
[ "noreply@github.com" ]
ZiadElgammal.noreply@github.com
a30d5a15f8128abba3f72c36c29b7ceb8f1724be
6de1e4199216517c9247bd5103476c33a7c98c22
/AdvanceLevel/1041. Be Unique.cpp
2315e1b6d55ccd6642086b487e0fedeb8e975ede
[]
no_license
Aiden68/PAT
9da832b5999afc5d55c3f58a39bb07dad76c89f9
a01df198ff75bc1209b86ced79a34a5155efc11d
refs/heads/master
2021-01-12T10:08:38.073835
2017-03-03T07:46:16
2017-03-03T07:46:16
76,371,489
0
0
null
null
null
null
UTF-8
C++
false
false
399
cpp
#include<iostream> using namespace std; int main() { int n; int cnt[10001] = { 0 }; int input[100001] = { 0 }; cin >> n; for (int i = 0; i < n; i++) { int tmp; scanf("%d", &tmp); cnt[tmp]++; input[i] = tmp; } int flag = 0; for (int i = 0; i < n; i++) { if (cnt[input[i]] == 1) { cout << input[i]; flag = 1; break; } } if (flag == 0) cout << "None"; return 0; }
[ "jllsjtu@163.com" ]
jllsjtu@163.com
efb42262e8a7618d943bf3d21cfc06bbde129a58
d569de1ec79431670dc2d4edec169d7e42fafdb0
/POJ/String/3461.cpp
de862691a4f16807aa7979f1bd09f9a15a67dd90
[]
no_license
peter0749/OnlineJudge
469026b3f6a6d810668e03d1b93a7055af990b8e
d60759cf53acaa58e34345b261640a1069bcda2a
refs/heads/master
2023-01-29T08:12:27.615260
2023-01-14T10:06:15
2023-01-14T10:06:15
81,049,761
1
0
null
null
null
null
UTF-8
C++
false
false
1,175
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #define STRL 1000010 using namespace std; int failure[STRL]; char pattern[STRL]; char tstring[STRL]; int Pos[STRL]; int MorrisPratt(char *t, char *p, int *stk){ int i, j, top=0; int tlen = strlen(t); int plen = strlen(p); if(plen > tlen) return 0; for(i=1, j=failure[0]=-1; i<plen; ++i){ while(j>=0 && p[j+1]!=p[i]) j = failure[j]; if(p[j+1]==p[i]) ++j; failure[i] = j; } for(i=0, j=-1; i<tlen; ++i){ while(j>=0 && p[j+1]!=t[i]) j = failure[j]; if(p[j+1]==t[i]) ++j; if(j==plen-1){ //printf("at: %d\n", i-plen+1); j=failure[j];//Optional stk[top++] = i-plen+1; } } return top; } int main(void){ int succCount, i; int T; ios::sync_with_stdio(false); cin>>T; while(T--){ cin >> pattern >> tstring; succCount = MorrisPratt(tstring, pattern, Pos); cout << succCount << '\n'; /* for(i=0; i<succCount; ++i){ cout << Pos[i] << '\n'; } */ } return 0; }
[ "peter" ]
peter
9916a2a5b757c7ae37fe48a9d4c5d8af7a9cc2ad
c60b1221b9b14b773feda4ee45a2eba13c416354
/KernelIPC/Sources/VComponentLibrary.cpp
b4bfbfab98e8ffd31699de1613d78a6fe82d89c6
[]
no_license
sanyaade-iot/core-XToolbox
ff782929e0581970834f3a2f9761c3ad8c01ec38
507914e3f1b973fc8d372bcf1eeba23d16f2d096
refs/heads/master
2021-01-17T13:26:13.179402
2013-05-16T15:05:10
2013-05-16T15:05:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
16,296
cpp
/* * This file is part of Wakanda software, licensed by 4D under * (i) the GNU General Public License version 3 (GNU GPL v3), or * (ii) the Affero General Public License version 3 (AGPL v3) or * (iii) a commercial license. * This file remains the exclusive property of 4D and/or its licensors * and is protected by national and international legislations. * In any event, Licensee's compliance with the terms and conditions * of the applicable license constitutes a prerequisite to any use of this file. * Except as otherwise expressly stated in the applicable license, * such license does not include any other license or rights on this file, * 4D's and/or its licensors' trademarks and/or other proprietary rights. * Consequently, no title, copyright or other proprietary rights * other than those specified in the applicable license is granted. */ // CodeWarrior seems to 'loose' some flags with Mach-O compiler - JT 6/08/2002 #ifndef USE_AUTO_MAIN_CALL #define USE_AUTO_MAIN_CALL 0 // Set to 1 to let the system init/deinit the lib (via main) #endif #include "VKernelIPCPrecompiled.h" #include "VComponentLibrary.h" // Receipe: // // 1) To write a component library, define your component class deriving it // from CComponent. You will provide this class with your library as a header file. // // class CComponent1 : public CComponent // { // public: // enum { Component_Type = 'cmp1' }; // // Blah, blah - Public Interface // }; // // Note that a component has no constructor, no data and only pure virtuals (= 0) // // 2) Then define a custom class deriving from VComponentImp<YourComponent> // and implement your public and private functions. If you want to receive messages, // override ListenToMessage(). You may define several components using the same pattern. // // class VComponentImp1 : public VComponentImp<CComponent1> // { // public: // Blah, blah - Public Interface // // protected: // Blah, blah - Private Stuff // }; // // 3) Declare a kCOMPONENT_TYPE_LIST constant. // This constant will automate the CreateComponent() in the dynamic lib: // // const sLONG kCOMPONENT_TYPE_COUNT = 1; // const CImpDescriptor kCOMPONENT_TYPE_LIST[] = { { CComponent1::Component_Type, // VImpCreator<VComponentImp1>::CreateImp } }; // // 4) Finally define a xDllMain and instantiate a VComponentLibrary* object (with the new operator). // You'll pass your kCOMPONENT_TYPE_LIST array to the constructor. If you need custom library // initialisations, you can write your own class and override contructor, DoRegister, DoUnregister... // // On Mac remember to customize library (PEF) entry-points with __EnterLibrary and __LeaveLibrary // User's main declaration // You should define it in your code and instanciate a VComponentLibrary* object. // // void xbox::ComponentMain (void) // { // new VComponentLibrary(kCOMPONENT_TYPE_LIST, kCOMPONENT_TYPE_COUNT); // } // Statics declaration VComponentLibrary* VComponentLibrary::sComponentLibrary = NULL; Boolean VComponentLibrary::sQuietUnloadLibrary = false; // Shared lib initialisation // On Windows, all job is done by the DllMain function // On Mac/CFM, __initialize and __terminate PEF entries must be set to __EnterLibrary and __LeaveLibrary // On Mac/Mach-O, job is done in the main entry point. // // NOTE: currently the ComponentManager call the main entry-point manually to ensure // the Toolbox is initialized before components (USE_AUTO_MAIN_CALL flag) #if VERSIONWIN BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { BOOL result = true; #if USE_AUTO_MAIN_CALL switch (fdwReason) { case DLL_PROCESS_ATTACH: xDllMain(); // To be renamed ComponentMain(); result = (VComponentLibrary::GetComponentLibrary() != NULL); break; case DLL_PROCESS_DETACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: break; } #else if (fdwReason == DLL_PROCESS_ATTACH) XWinStackCrawl::RegisterUser( hinstDLL); #endif return result; } #elif VERSION_LINUX //jmo - Be coherent with code in XLinuxDLLMain.cpp extern "C" { void __attribute__ ((constructor)) LibraryInit(); void __attribute__ ((destructor)) LibraryFini(); } void LibraryInit() { #if USE_AUTO_MAIN_CALL xDllMain(); bool ok=VComponentLibrary::GetComponentLibrary()!=NULL; //jmo - I lack ideas, but I'm sure we can do something clever with this 'ok' result ! #endif } void LibraryFini() { //Nothing to do. } #elif VERSION_MACHO #if USE_AUTO_MAIN_CALL #error "Mach-O main entry point isn't defined" #endif #elif VERSIONMAC // Version CFM // L.E. 11/10/01 Drop-Ins MUST have their private destructor chain. // but the global __global_destructor_chain is in global_destructor_chain.c // which is compiled for both MSL DropInRuntime and MSL All-ShlbRuntime... // So I have to define a private chain list and swap the value of the global one when needed. // see MSL StartupDropIn.c extern "C" { // See StartupSharedLib.c for complete PEF entry points informations pascal OSErr __initialize (const CFragInitBlock* theInitBlock); pascal OSErr __EnterLibrary (const CFragInitBlock* theInitBlock); pascal void __terminate (void); pascal void __LeaveLibrary (void); } struct DestructorChain; static DestructorChain* __private_global_destructor_chain; extern DestructorChain* __global_destructor_chain; pascal OSErr __EnterLibrary (const CFragInitBlock* theInitBlock) { DestructorChain *oldChain = __global_destructor_chain; __global_destructor_chain = NULL; OSErr error = __initialize(theInitBlock); __private_global_destructor_chain = __global_destructor_chain; __global_destructor_chain = oldChain; #if USE_AUTO_MAIN_CALL // Call the user's main to allow custom initialization xDllMain(); if (VComponentLibrary::GetComponentLibrary() == NULL) error = cfragInitFunctionErr; #endif return error; } pascal void __LeaveLibrary (void) { DestructorChain *oldChain = __global_destructor_chain; __global_destructor_chain = __private_global_destructor_chain; __terminate(); __global_destructor_chain = oldChain; } #endif // VERSIONMAC // Unmangled export mecanism // #if USE_UNMANGLED_EXPORTS EXPORT_UNMANGLED_API(VError) Main (OsType inEvent, VLibrary* inLibrary); EXPORT_UNMANGLED_API(void) Lock (); EXPORT_UNMANGLED_API(void) Unlock (); EXPORT_UNMANGLED_API(Boolean) CanUnloadLibrary (); EXPORT_UNMANGLED_API(CComponent*) CreateComponent (CType inType, CType inFamily); EXPORT_UNMANGLED_API(Boolean) GetNthComponentType (sLONG inTypeIndex, CType& outType); EXPORT_UNMANGLED_API(CComponent*) CreateComponent (CType inType, CType inFamily) { return VComponentLibrary::CreateComponent(inType, inFamily); } EXPORT_UNMANGLED_API(Boolean) GetNthComponentType (sLONG inTypeIndex, CType& outType) { return VComponentLibrary::GetNthComponentType(inTypeIndex, outType); } EXPORT_UNMANGLED_API(void) Lock () { VComponentLibrary::Lock(); } EXPORT_UNMANGLED_API(void) Unlock () { VComponentLibrary::Unlock(); } EXPORT_UNMANGLED_API(Boolean) CanUnloadLibrary () { return VComponentLibrary::CanUnloadLibrary(); } EXPORT_UNMANGLED_API(VError) Main (OsType inEvent, VLibrary* inLibrary) { return VComponentLibrary::Main(inEvent, inLibrary); } #endif // USE_UNMANGLED_EXPORTS // --------------------------------------------------------------------------- // VComponentLibrary::VComponentLibrary // --------------------------------------------------------------------------- // VComponentLibrary::VComponentLibrary() { Init(); } // --------------------------------------------------------------------------- // VComponentLibrary::VComponentLibrary // --------------------------------------------------------------------------- // VComponentLibrary::VComponentLibrary(const CImpDescriptor* inTypeList, sLONG inTypeCount) { Init(); fComponentTypeList = inTypeList; fComponentTypeCount = inTypeCount; } // --------------------------------------------------------------------------- // VComponentLibrary::~VComponentLibrary // --------------------------------------------------------------------------- // VComponentLibrary::~VComponentLibrary() { xbox_assert(sComponentLibrary == this); sComponentLibrary = NULL; // Make sure all instances has been released if (!sQuietUnloadLibrary) { xbox_assert(fDebugInstanceCount == 0); } } // --------------------------------------------------------------------------- // VComponentLibrary::Main [static][exported] // --------------------------------------------------------------------------- // Cross-platform main entry point // VError VComponentLibrary::Main(OsType inEvent, VLibrary* inLibrary) { VError error = VE_COMP_CANNOT_LOAD_LIBRARY; #if !USE_AUTO_MAIN_CALL // Call the user's main to allow custom initialization // This is done here if not handled automatically if (inEvent == kDLL_EVENT_REGISTER) xDllMain(); #endif VComponentLibrary* componentLibrary = VComponentLibrary::GetComponentLibrary(); if (componentLibrary == NULL) DebugMsg(L"You must instantiate a VComponentLibrary* in your xDllMain\n"); if (componentLibrary != NULL) { switch (inEvent) { case kDLL_EVENT_REGISTER: componentLibrary->fLibrary = inLibrary; componentLibrary->Register(); error = VE_OK; break; case kDLL_EVENT_UNREGISTER: componentLibrary->Unregister(); error = VE_OK; break; } } return error; } // --------------------------------------------------------------------------- // VComponentLibrary::Lock [static][exported] // --------------------------------------------------------------------------- // Call when you want to block component creation (typically before // releasing the library) // void VComponentLibrary::Lock() { if (sComponentLibrary == NULL) { DebugMsg(L"You must customize library entry points\n"); return; } VTaskLock locker(&sComponentLibrary->fCreatingCriticalSection); sComponentLibrary->fLockCount++; } // --------------------------------------------------------------------------- // VComponentLibrary::Unlock [static][exported] // --------------------------------------------------------------------------- // Call if you no longer want to block component creation // void VComponentLibrary::Unlock() { if (sComponentLibrary == NULL) { DebugMsg(L"You must customize library entry points\n"); return; } VTaskLock locker(&sComponentLibrary->fCreatingCriticalSection); sComponentLibrary->fLockCount--; } // --------------------------------------------------------------------------- // VComponentLibrary::CanUnloadLibrary [static][exported] // --------------------------------------------------------------------------- // Call to known if library can be unloaded. Make sure you locked before. // // This code is automatically called while the library is unloading: // 1) if the library is unloaded by the toolbox, we're called from VLibrary's destructor // 2) if the library is unloaded by the OS, the VLibrary hasn't been deleted // In any cases library has still valid datas (globals). Boolean VComponentLibrary::CanUnloadLibrary() { if (sComponentLibrary == NULL) { DebugMsg(L"You must customize library entry points\n"); return false; } // Each component in the library as increased the refcount (will be decreased later // by the Component Manager). A greater refcount means some component instances are // still running. VLibrary* library = sComponentLibrary->fLibrary; return ((library != NULL) ? library->GetRefCount() == sComponentLibrary->fComponentTypeCount : true); } // --------------------------------------------------------------------------- // VComponentLibrary::CreateComponent [static][exported] // --------------------------------------------------------------------------- // Entry point in the library for creating any component it defines // CComponent* VComponentLibrary::CreateComponent(CType inType, CType inGroup) { if (sComponentLibrary == NULL) { DebugMsg(L"You must customize library entry points\n"); return NULL; } if (sComponentLibrary->fComponentTypeList == NULL) { DebugMsg(L"You must specify a TypeList for your lib\n"); return NULL; } CComponent* component = NULL; sLONG typeIndex = 0; // Look for the type index while (sComponentLibrary->fComponentTypeList[typeIndex].componentType != inType && typeIndex < sComponentLibrary->fComponentTypeCount) { typeIndex++; } // If found, instanciate the component using factory's member address if (sComponentLibrary->fComponentTypeList[typeIndex].componentType == inType) { VTaskLock locker(&sComponentLibrary->fCreatingCriticalSection); // Make sure component creation isn't locked if (sComponentLibrary->fLockCount == 0) component = (sComponentLibrary->fComponentTypeList[typeIndex].impCreator)(inGroup); } return component; } // --------------------------------------------------------------------------- // VComponentLibrary::GetNthComponentType [static][exported] // --------------------------------------------------------------------------- // Return the list of component types it may create /// Boolean VComponentLibrary::GetNthComponentType(sLONG inTypeIndex, CType& outType) { if (sComponentLibrary == NULL) { DebugMsg(L"You must customize library entry points\n"); return false; } if (sComponentLibrary->fComponentTypeList == NULL) { DebugMsg(L"You must specify a TypeList for your lib\n"); return false; } if (inTypeIndex < 1 || inTypeIndex > sComponentLibrary->fComponentTypeCount) return false; outType = sComponentLibrary->fComponentTypeList[inTypeIndex - 1].componentType; return true; } // --------------------------------------------------------------------------- // VComponentLibrary::RegisterOneInstance(CType inType) // --------------------------------------------------------------------------- // Increase component instance count // VIndex VComponentLibrary::RegisterOneInstance(CType /*inType*/) { // Increase library's refcount as the component may use global datas if (fLibrary != NULL) fLibrary->Retain(); fDebugInstanceCount++; return VInterlocked::Increment(&fUniqueInstanceIndex); } // --------------------------------------------------------------------------- // VComponentLibrary::UnRegisterOneInstance(CType inType) // --------------------------------------------------------------------------- // Decrease component instance count // void VComponentLibrary::UnRegisterOneInstance(CType /*inType*/) { // Decrease library's refcount as the component no longer need it if (fLibrary != NULL) fLibrary->Release(); fDebugInstanceCount--; } // --------------------------------------------------------------------------- // VComponentLibrary::Register // --------------------------------------------------------------------------- // Entry point for library initialisation // void VComponentLibrary::Register() { DoRegister(); } // --------------------------------------------------------------------------- // VComponentLibrary::Unregister // --------------------------------------------------------------------------- // Entry point for library termination // void VComponentLibrary::Unregister() { DoUnregister(); } // --------------------------------------------------------------------------- // VComponentLibrary::DoRegister // --------------------------------------------------------------------------- // Override to handle custom initialisation // void VComponentLibrary::DoRegister() { } // --------------------------------------------------------------------------- // VComponentLibrary::DoUnregister // --------------------------------------------------------------------------- // Override to handle custom termination // void VComponentLibrary::DoUnregister() { } // --------------------------------------------------------------------------- // VComponentLibrary::Init [private] // --------------------------------------------------------------------------- // void VComponentLibrary::Init() { fLockCount = 0; fUniqueInstanceIndex = 0; fComponentTypeList = NULL; fComponentTypeCount = 0; fLibrary = NULL; fDebugInstanceCount = 0; if (sComponentLibrary != NULL) DebugMsg(L"You must instanciate only ONE VComponentLibrary object\n"); sComponentLibrary = this; }
[ "stephane.hamel@4d.com" ]
stephane.hamel@4d.com
1e831cbad998d779d579c3156a5d11df186f2215
5bd6fc2977e142e146c98f582cd048fe385a5243
/src/dd_glpk.h
469957a85aa4afa1f9ccc43277879d6672a9bc87
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
krzysztof-turowski/duplication-divergence
7f3d5ddfc5d600086b3c24afeae36a9ba9ac05e7
e9e246bc1eab380652c7d8bc5dec95a02165cf51
refs/heads/master
2022-12-10T08:34:15.309267
2022-11-14T16:55:18
2022-11-14T16:55:18
168,884,844
0
1
MIT
2021-05-15T01:46:05
2019-02-02T22:22:54
C
UTF-8
C++
false
false
13,635
h
// Header for LP computation of the temporal upper bound using GLPK. #pragma once #include <glpk.h> #include <map> #include <random> #include <sstream> #include <string> #include <utility> #include <tuple> #include <vector> const int64_t MAX_CONSTRAINTS = 5000000000L; std::string LP_name(const std::string &prefix, const std::initializer_list<int> &vertices) { std::ostringstream out; out << prefix; if (vertices.size() > 0) { out << "_{"; for (const auto &v : vertices) { out << std::to_string(v) << ","; } out.seekp(-1, std::ios_base::end), out << "}"; } return out.str(); } inline int LP_get_variable_index(const int &u, const int &v, const int &n, const int &n0) { return (u - n0) * (n - n0) + (v - n0); } inline int LP_get_variable_index( const int &u, const int &i, const int &v, const int &j, const int &n, const int &n0) { int x = LP_get_variable_index(u, i, n, n0), y = LP_get_variable_index(v, j, n, n0); return LP_get_variable_index(n, n0, n, n0) + x * (n - n0) * (n - n0) + y; } inline void add_transitivity_constraint( glp_prob *LP, std::vector<int> &X, std::vector<int> &Y, std::vector<double> &A, int &row, const int &n, const int &n0, const int &i, const int &j, const int &k) { glp_add_rows(LP, 1); glp_set_row_name(LP, row, LP_name("T", {i, j, k}).c_str()); X.push_back(row), Y.push_back(LP_get_variable_index(i, j, n, n0) + 1); X.push_back(row), Y.push_back(LP_get_variable_index(j, k, n, n0) + 1); X.push_back(row), Y.push_back(LP_get_variable_index(i, k, n, n0) + 1); A.push_back(1), A.push_back(1), A.push_back(-1); } inline void add_density_constraint( glp_prob *LP, std::vector<int> &X, std::vector<int> &Y, std::vector<double> &A, int &row, const double &density, const int &n, const int &n0) { glp_add_rows(LP, 1); glp_set_row_name(LP, row, LP_name("D", {}).c_str()); for (int i = n0; i < n; i++) { for (int j = n0; j < n; j++) { if (i != j) { X.push_back(row), Y.push_back(LP_get_variable_index(i, j, n, n0) + 1), A.push_back(1); } } } glp_set_row_bnds(LP, row, GLP_UP, density, density), row++; } std::map<std::pair<int, int>, double> retrieve_solution( glp_prob *LP, const int &n, const int &n0, const double &s) { std::map<std::pair<int, int>, double> solution; for (int i = n0; i < n; i++) { for (int j = n0; j < n; j++) { if (i == j) { continue; } double y_ij = glp_get_col_prim(LP, LP_get_variable_index(i, j, n, n0) + 1); solution.insert(std::make_pair(std::make_pair(i, j), y_ij / s)); } } return solution; } std::tuple<double, std::map<std::pair<int, int>, double>> LP_ordering_solve( const std::map<std::pair<int, int>, long double> &p_uv, const int &n, const int &n0, const double &epsilon, const bool get_solution = false) { glp_prob *LP = glp_create_prob(); glp_set_prob_name(LP, ("Solve " + std::to_string(epsilon)).c_str()); glp_set_obj_dir(LP, GLP_MAX); double density = epsilon * (n - n0) * (n - n0 - 1) / 2; // Objective function glp_add_cols(LP, (n - n0) * (n - n0) + 1); int s_index = (n - n0) * (n - n0); for (int i = n0; i < n; i++) { for (int j = n0; j < n; j++) { auto index = LP_get_variable_index(i, j, n, n0); glp_set_col_name(LP, index + 1, LP_name("y", {i, j}).c_str()); if (i != j) { const auto &p_ij = p_uv.find(std::make_pair(i, j)); glp_set_col_bnds(LP, index + 1, GLP_LO, 0.0, 1.0); glp_set_obj_coef( LP, index + 1, p_ij != p_uv.end() ? static_cast<double>(p_ij->second) : 0.0); } } } glp_set_col_name(LP, s_index + 1, "s"); glp_set_col_bnds(LP, s_index + 1, GLP_DB, 0.0, 1 / density); std::vector<int> X, Y; std::vector<double> A; int row = 1; glp_add_rows(LP, (n - n0) * (n - n0 - 1) / 2); // Antisymmetry #pragma omp parallel for for (int i = n0; i < n; i++) { for (int j = i + 1; j < n; j++) { #pragma omp critical { glp_set_row_name(LP, row, LP_name("A", {i, j}).c_str()); X.push_back(row), Y.push_back(LP_get_variable_index(i, j, n, n0) + 1), A.push_back(1); X.push_back(row), Y.push_back(LP_get_variable_index(j, i, n, n0) + 1), A.push_back(1); X.push_back(row), Y.push_back(s_index + 1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_UP, 0.0, 0.0), row++; } } } // Transitivity if (MAX_CONSTRAINTS >= pow(n - n0, 3.0)) { #pragma omp parallel for for (int i = n0; i < n; i++) { for (int j = n0; j < n; j++) { for (int k = n0; k < n; k++) { if (i != j && j != k && i != k) { #pragma omp critical { add_transitivity_constraint(LP, X, Y, A, row, n, n0, i, j, k); X.push_back(row), Y.push_back(s_index + 1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_UP, 0.0, 0.0), row++; } } } } } } else { std::random_device device; std::mt19937 generator(device()); std::uniform_int_distribution<int> index_distribution(n0, n - 1); #pragma omp parallel for for (int64_t constraint = 0; constraint < MAX_CONSTRAINTS; constraint++) { int i = index_distribution(generator), j = index_distribution(generator), k = index_distribution(generator); if (i == j || j == k || i == k) { continue; } #pragma omp critical { add_transitivity_constraint(LP, X, Y, A, row, n, n0, i, j, k); X.push_back(row), Y.push_back(s_index + 1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_UP, 0.0, 0.0), row++; } } } // Density add_density_constraint(LP, X, Y, A, row, 1.0, n, n0); glp_load_matrix(LP, A.size(), &X[0] - 1, &Y[0] - 1, &A[0] - 1); glp_term_out(0); glp_simplex(LP, NULL); double objective = glp_get_obj_val(LP); std::map<std::pair<int, int>, double> solution; if (get_solution) { solution = retrieve_solution(LP, n, n0, glp_get_col_prim(LP, s_index + 1)); } glp_delete_prob(LP); glp_free_env(); return std::make_tuple(objective, solution); } std::tuple<double, std::map<std::pair<int, int>, double>> LP_binning_solve( const std::map<std::pair<int, int>, long double> &p_uv, const int &n, const int &n0, const double &epsilon, const bool get_solution = false) { (void)get_solution; glp_prob *LP = glp_create_prob(); glp_set_prob_name(LP, ("Solve " + std::to_string(epsilon)).c_str()); glp_set_obj_dir(LP, GLP_MAX); double density = epsilon * (n - n0) * (n - n0 - 1) / 2; // Objective function int var_count = pow(n - n0, 4.0) + pow(n - n0, 2.0) + 1; glp_add_cols(LP, var_count); for (int u = n0; u < n; u++) { for (int i = n0; i < n; i++) { auto index = LP_get_variable_index(u, i, n, n0); glp_set_col_name(LP, index + 1, LP_name("y", {u, i}).c_str()); glp_set_col_bnds(LP, index + 1, GLP_LO, 0.0, 1.0); } } for (int u = n0; u < n; u++) { for (int i = n0; i < n; i++) { for (int v = n0; v < n; v++) { for (int j = n0; j < n; j++) { auto index = LP_get_variable_index(u, i, v, j, n, n0); glp_set_col_name(LP, index + 1, LP_name("w", {u, i, v, j}).c_str()); glp_set_col_bnds(LP, index + 1, GLP_LO, 0.0, 1.0); if (u != v && i < j) { const auto &p_ij = p_uv.find(std::make_pair(u, v)); glp_set_obj_coef( LP, index + 1, (p_ij != p_uv.end()) ? static_cast<double>(p_ij->second) : 0.0); } } } } } int s_index = var_count - 1; glp_set_col_name(LP, s_index + 1, "s"); glp_set_col_bnds(LP, s_index + 1, GLP_DB, 0.0, 1 / density); std::vector<int> X, Y; std::vector<double> A; int row = 1; // Identity glp_add_rows(LP, (n - n0) * (n - n0)); for (int u = n0; u < n; u++) { for (int i = n0; i < n; i++) { glp_set_row_name(LP, row, LP_name("I", {u, i}).c_str()); X.push_back(row), Y.push_back(LP_get_variable_index(u, i, n, n0) + 1), A.push_back(1); X.push_back(row), Y.push_back(LP_get_variable_index(u, i, u, i, n, n0) + 1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_FX, 0.0, 0.0), row++; } } // Symmetry glp_add_rows(LP, pow(n - n0, 4.0)); for (int u = n0; u < n; u++) { for (int i = n0; i < n; i++) { for (int v = n0; v < n; v++) { for (int j = i + 1; j < n; j++) { glp_set_row_name(LP, row, LP_name("S", {u, i, v, j}).c_str()); X.push_back(row), Y.push_back(LP_get_variable_index(u, i, v, j, n, n0) + 1); X.push_back(row), Y.push_back(LP_get_variable_index(v, j, u, i, n, n0) + 1); A.push_back(1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_FX, 0.0, 0.0), row++; } } } } // y-density glp_add_rows(LP, n - n0); for (int u = n0; u < n; u++) { glp_set_row_name(LP, row, LP_name("yD", {u}).c_str()); for (int i = n0; i < n; i++) { X.push_back(row), Y.push_back(LP_get_variable_index(u, i, n, n0) + 1), A.push_back(1); } X.push_back(row), Y.push_back(s_index + 1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_FX, 0.0, 0.0), row++; } // w-density glp_add_rows(LP, pow(n - n0, 3.0)); for (int u = n0; u < n; u++) { for (int i = n0; i < n; i++) { for (int v = n0; v < n; v++) { glp_set_row_name(LP, row, LP_name("wD", {u, i, v}).c_str()); for (int j = n0; j < n; j++) { X.push_back(row), Y.push_back(LP_get_variable_index(u, i, v, j, n, n0) + 1); A.push_back(1); } X.push_back(row), Y.push_back(LP_get_variable_index(u, i, n, n0) + 1), A.push_back(-1); glp_set_row_bnds(LP, row, GLP_FX, 0.0, 0.0), row++; } } } // Density glp_add_rows(LP, 1); glp_set_row_name(LP, row, LP_name("D", {}).c_str()); for (int u = n0; u < n; u++) { for (int i = n0; i < n; i++) { for (int v = n0; v < n; v++) { for (int j = i + 1; j < n; j++) { if (u != v) { X.push_back(row), Y.push_back(LP_get_variable_index(u, i, v, j, n, n0) + 1); A.push_back(1); } } } } } glp_set_row_bnds(LP, row, GLP_FX, 1.0, 1.0), row++; glp_load_matrix(LP, A.size(), &X[0] - 1, &Y[0] - 1, &A[0] - 1); glp_term_out(0); glp_simplex(LP, NULL); double objective = glp_get_obj_val(LP); std::map<std::pair<int, int>, double> solution; glp_delete_prob(LP); glp_free_env(); return std::make_tuple(objective, solution); } std::tuple<double, std::map<std::pair<int, int>, double>> IP_ordering_solve( const std::map<std::pair<int, int>, long double> &p_uv, const int &n, const int &n0, const double &epsilon, const bool get_solution = false) { glp_prob *IP = glp_create_prob(); glp_set_prob_name(IP, ("Solve " + std::to_string(epsilon)).c_str()); glp_set_obj_dir(IP, GLP_MAX); int density = epsilon * (n - n0) * (n - n0 - 1) / 2; // Objective function glp_add_cols(IP, (n - n0) * (n - n0)); for (int i = n0; i < n; i++) { for (int j = n0; j < n; j++) { auto index = LP_get_variable_index(i, j, n, n0); glp_set_col_name(IP, index + 1, LP_name("y", {i, j}).c_str()); if (i != j) { const auto &p_ij = p_uv.find(std::make_pair(i, j)); glp_set_col_kind(IP, index + 1, GLP_BV); glp_set_obj_coef( IP, index + 1, p_ij != p_uv.end() ? static_cast<double>(p_ij->second) : 0.0); } } } std::vector<int> X, Y; std::vector<double> A; int row = 1; glp_add_rows(IP, (n - n0) * (n - n0 - 1) / 2); // Antisymmetry #pragma omp parallel for for (int i = n0; i < n; i++) { for (int j = i + 1; j < n; j++) { #pragma omp critical { glp_set_row_name(IP, row, LP_name("A", {i, j}).c_str()); X.push_back(row), Y.push_back(LP_get_variable_index(i, j, n, n0) + 1), A.push_back(1); X.push_back(row), Y.push_back(LP_get_variable_index(j, i, n, n0) + 1), A.push_back(1); glp_set_row_bnds(IP, row, GLP_UP, 1, 1), row++; } } } // Transitivity if (MAX_CONSTRAINTS >= pow(n - n0, 3.0)) { #pragma omp parallel for for (int i = n0; i < n; i++) { for (int j = n0; j < n; j++) { for (int k = n0; k < n; k++) { if (i != j && j != k && i != k) { #pragma omp critical { add_transitivity_constraint(IP, X, Y, A, row, n, n0, i, j, k); glp_set_row_bnds(IP, row, GLP_UP, 1, 1), row++; } } } } } } else { std::random_device device; std::mt19937 generator(device()); std::uniform_int_distribution<int> index_distribution(n0, n - 1); #pragma omp parallel for for (int64_t constraint = 0; constraint < MAX_CONSTRAINTS; constraint++) { int i = index_distribution(generator), j = index_distribution(generator), k = index_distribution(generator); if (i == j || j == k || i == k) { continue; } #pragma omp critical { add_transitivity_constraint(IP, X, Y, A, row, n, n0, i, j, k); glp_set_row_bnds(IP, row, GLP_UP, 1, 1), row++; } } } // Density add_density_constraint(IP, X, Y, A, row, density, n, n0); glp_load_matrix(IP, A.size(), &X[0] - 1, &Y[0] - 1, &A[0] - 1); glp_term_out(0); glp_simplex(IP, NULL); glp_intopt(IP, NULL); double objective = glp_mip_obj_val(IP) / density; std::map<std::pair<int, int>, double> solution; if (get_solution) { solution = retrieve_solution(IP, n, n0, 1); } glp_delete_prob(IP); glp_free_env(); return std::make_tuple(objective, solution); }
[ "noreply@github.com" ]
krzysztof-turowski.noreply@github.com
3b955d196234bd062c3085bcd2e0b1ef5d365189
a7a0d98dba2bc19a0bdc7a28cd732cd105e3b02f
/BAEKJOON/1085.cpp
06e6b4252c3136eb8c2cd3639116d97915e8af40
[]
no_license
stalker5217/algorithm
905317b9b24f26bfac2f50a250698d057e21be62
b635b13512c0057b81d714f14857fc3a9cd84582
refs/heads/master
2021-06-26T19:47:10.980335
2020-11-18T14:54:35
2020-11-18T14:54:35
190,971,508
2
0
null
null
null
null
UTF-8
C++
false
false
470
cpp
#define DEBUG 0 #define LOG(string) cout << string #include <iostream> #include <cstring> #include <vector> #include <algorithm> #include <functional> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int w, h, x, y; cin >> x >> y >> w >> h; int minWidth = ((w-x) > x) ? x : (w-x); int minHeight = ((h-y) > y) ? y : (h-y); int min = (minWidth > minHeight) ? minHeight : minWidth; cout << min; return 0; }
[ "stalker5217@gmail.com" ]
stalker5217@gmail.com
f2c1269a7d30a2d3cbcafa5c517b5988336674ed
948f4e13af6b3014582909cc6d762606f2a43365
/testcases/juliet_test_suite/testcases/CWE762_Mismatched_Memory_Management_Routines/s03/CWE762_Mismatched_Memory_Management_Routines__delete_int_malloc_52c.cpp
44a1b82471275852fbdde508e093a7a39572adf9
[]
no_license
junxzm1990/ASAN--
0056a341b8537142e10373c8417f27d7825ad89b
ca96e46422407a55bed4aa551a6ad28ec1eeef4e
refs/heads/master
2022-08-02T15:38:56.286555
2022-06-16T22:19:54
2022-06-16T22:19:54
408,238,453
74
13
null
2022-06-16T22:19:55
2021-09-19T21:14:59
null
UTF-8
C++
false
false
1,533
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__delete_int_malloc_52c.cpp Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete.label.xml Template File: sources-sinks-52c.tmpl.cpp */ /* * @description * CWE: 762 Mismatched Memory Management Routines * BadSource: malloc Allocate data using malloc() * GoodSource: Allocate data using new * Sinks: * GoodSink: Deallocate data using free() * BadSink : Deallocate data using delete * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include "std_testcase.h" namespace CWE762_Mismatched_Memory_Management_Routines__delete_int_malloc_52 { #ifndef OMITBAD void badSink_c(int * data) { /* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may * require a call to free() to deallocate the memory */ delete data; } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void goodG2BSink_c(int * data) { /* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may * require a call to free() to deallocate the memory */ delete data; } /* goodB2G uses the BadSource with the GoodSink */ void goodB2GSink_c(int * data) { /* FIX: Deallocate the memory using free() */ free(data); } #endif /* OMITGOOD */ } /* close namespace */
[ "yzhang0701@gmail.com" ]
yzhang0701@gmail.com
45d8f77f01e12ce0f5b35cac2858994492a6b56f
e6d4a87dcf98e93bab92faa03f1b16253b728ac9
/algorithms/cpp/maximum69Number/maximum69Number.cpp
980ace4b93fa6960456ded11061ef3f86c3bfd94
[]
no_license
MichelleZ/leetcode
b5a58e1822e3f6ef8021b29d9bc9aca3fd3d416f
a390adeeb71e997b3c1a56c479825d4adda07ef9
refs/heads/main
2023-03-06T08:16:54.891699
2023-02-26T07:17:47
2023-02-26T07:17:47
326,904,500
3
0
null
null
null
null
UTF-8
C++
false
false
387
cpp
// Source: https://leetcode.com/problems/maximum-69-number/ // Author: Miao Zhang // Date: 2021-04-23 class Solution { public: int maximum69Number (int num) { string s = to_string(num); for (int i = 0; i < s.length(); i++) { if (s[i] == '6') { s[i] = '9'; break; } } return stoi(s); } };
[ "zhangdaxiaomiao@163.com" ]
zhangdaxiaomiao@163.com
486c5337fd6c0aa99774c3cacb2ffd46af69334b
347b9647c77ae619ea7627b7f25113117ff4e34e
/graphs/dfs.cpp
e4b5c69ee70931b0303ed26617ae59d92182daea
[ "MIT" ]
permissive
gktejus/cpp
49741f019e7b09ba48e0ac54eed4c55db9395379
10809eae257ec396226bd8a65ef712de390386d0
refs/heads/master
2020-03-30T13:52:47.830559
2018-10-02T17:05:48
2018-10-02T17:05:48
151,291,677
1
1
MIT
2018-10-02T17:02:49
2018-10-02T17:02:48
null
UTF-8
C++
false
false
1,167
cpp
#include<iostream> #include<list> using namespace std; // Graph class represents a directed graph // using adjacency list representation class Graph { int V; list<int> *adj; void DFSUtil(int v, bool visited[]); public: Graph(int V); void addEdge(int v, int w); void DFS(int v); }; Graph::Graph(int V) { this->V = V; adj = new list<int>[V]; } void Graph::addEdge(int v, int w) { adj[v].push_back(w); // Add w to v’s list. } void Graph::DFSUtil(int v, bool visited[]) { visited[v] = true; cout << v << " "; list<int>::iterator i; for (i = adj[v].begin(); i != adj[v].end(); ++i) if (!visited[*i]) DFSUtil(*i, visited); } void Graph::DFS(int v) { bool *visited = new bool[V]; for (int i = 0; i < V; i++) visited[i] = false; DFSUtil(v, visited); } int main() { Graph g(4); g.addEdge(0, 1); g.addEdge(0, 2); g.addEdge(1, 2); g.addEdge(2, 0); g.addEdge(2, 3); g.addEdge(3, 3); cout << "Following is Depth First Traversal (starting from vertex 2)\n"; g.DFS(2); return 0; }
[ "noreply@github.com" ]
gktejus.noreply@github.com
d09c9a9f8f710801c76fb4e0fd13fde3933b3aa4
bff39d66e3f49e7e560f9ec03f12b15a6f244ed8
/src/SoAppRunner/SoProgram.cpp
17af1cb05dee79eeb265b90c77bcec9c2e26f7c6
[]
no_license
sololxy/solo-apprunner
2efe8695a00a558e8f27544e9d8206be7d9a786f
e3c2316aef0b37361d889c6ecef85bbd6ad5eb7b
refs/heads/master
2021-01-01T04:28:50.663908
2017-07-21T05:15:44
2017-07-21T05:15:44
97,184,768
0
1
null
2017-07-21T05:15:45
2017-07-14T02:34:12
C++
UTF-8
C++
false
false
559
cpp
#include <SoAppRunner/SoProgram.h> SoProgram::SoProgram() { _name = "Unknown Program"; _path = "/none/test.exe"; _web = "https://github.com/sololxy"; } SoProgram::SoProgram(QString name) { _name = name; _path = "/none/test.exe"; _web = "https://github.com/sololxy"; }; SoProgram::SoProgram(QString name, QString path, QString desc, QString detailDesc, QString icon, QString doc, QString web) { _name = name; _path = path; _desc = desc; _detailDesc = detailDesc; _icon = icon; _doc = doc; _web = web; } SoProgram::~SoProgram() { }
[ "solo_lxy@126.com" ]
solo_lxy@126.com
652f1876c863909db583af1688029ce2e768562b
88a47e88a59cfbe818168f8fb9d4cbb5bfcbb8b5
/src/piece.cpp
a52d538d83c6f2d6d3fd76699b4deabd9d8565c4
[]
no_license
fiedosiukr/reversi
7c0a0bf5f560ceb09e151055cd304f86d91e0faf
4719bb1cc6214339817ef09b2ea8dd4ac005b996
refs/heads/master
2020-05-27T10:53:27.811693
2019-05-27T16:02:32
2019-05-27T16:02:32
187,537,250
0
0
null
null
null
null
UTF-8
C++
false
false
260
cpp
#include "../include/piece.hpp" #include <iostream> Piece::Piece(char representation) { this->representation = representation; } char Piece::get_representation() { return representation; } void Piece::render() { std::cout << representation; }
[ "fiedosiukr@gmail.com" ]
fiedosiukr@gmail.com
7edb3256a3d9089da01609239823bef2b2a37296
34c83941628382c9e6e514abd634f693af7f12da
/MagicTheFileFormat/MagicImporter/MoleImporterAPI-master/MoleImporterAPI_TestVersion/MoleReader.cpp
37215b1d38208c01e70767418fa7c88a935ded1b
[]
no_license
Fanny94/ParticleEditorExport
c347ae16cee7f1be785a76834eeaa1deeb093c1e
9af040ef753607eeb2502ee832925a7ad764dc71
refs/heads/master
2021-01-15T13:18:45.076104
2019-09-15T08:16:31
2019-09-15T08:16:31
78,723,510
0
0
null
null
null
null
ISO-8859-1
C++
false
false
16,819
cpp
#include <fstream> #include <vector> #include <iostream> //#include "ReadHeaderData.h" #include "MoleReader.h" using namespace std; void MoleReader::readFromBinary(const char* filePath) { /*Reading the binary file that we just have been written to.*/ std::ifstream infile(filePath, std::ifstream::binary); cout << ">>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<" << "\n" << "\n" << endl; cout << "Binary Reader" << endl; cout << "\n" << endl; /*Reading the first block of memory that is the main header. This will read information about how much of each node type we have from a imported scene and how memory they will take up in the binary file.*/ infile.read((char*)&pmRead_mainHeader, sizeof(read_sMainHeader)); cout << "______________________" << endl; cout << "Main Header" << endl; cout << "meshCount: " << pmRead_mainHeader.meshCount << endl; cout << "materialCount: " << pmRead_mainHeader.materialCount << endl; cout << "lightCount: " << pmRead_mainHeader.lightCount << endl; cout << "cameraCount: " << pmRead_mainHeader.cameraCount << endl; cout << "______________________" << endl; if (pmRead_mainHeader.meshCount >= 1) { pmRead_meshList.resize(pmRead_mainHeader.meshCount + prevMeshes); //Reize to be the same length as the mesh list. Must be this way to work "in parallell" //with the mesh list pmRead_meshJointHolder.resize(pmRead_mainHeader.meshCount + prevMeshes); pmRead_meshChildList.resize(pmRead_mainHeader.meshCount + prevMeshes); //The vertex lists will be filled so that they are the same length as the mesh list. pmRead_mList.resize(pmRead_mainHeader.meshCount + prevMeshes); pmRead_mkList.resize(pmRead_mainHeader.meshCount + prevMeshes); for (int i = 0; i < pmRead_mainHeader.meshCount; i++) { /*Reading the block of memory that is the meshes. The information from the meshes will be read here, that includes for example vertex count for a normal mesh and a skinned mesh. What we do is reserving memory for all the data that is in the struct. For example, Vertex count is a integer and will take up to 4 bytes in the memory when reading.*/ infile.read((char*)&pmRead_meshList[i + prevMeshes], sizeof(read_sMesh)); int currMeshIndex = i + prevMeshes; { cout << "Mesh: " << currMeshIndex << endl; cout << "Name: " << pmRead_meshList[currMeshIndex].meshName << endl; cout << "\t"; cout << "Material ID: "; cout << pmRead_meshList[currMeshIndex].materialID << endl; cout << "Mesh vector: " << endl; cout << "\t"; cout << "xyz: "; cout << pmRead_meshList[currMeshIndex].translate[0] << " "; cout << pmRead_meshList[currMeshIndex].translate[1] << " "; cout << pmRead_meshList[currMeshIndex].translate[2] << " " << endl; cout << "\t"; cout << "rot: "; cout << pmRead_meshList[currMeshIndex].rotation[0] << " "; cout << pmRead_meshList[currMeshIndex].rotation[1] << " "; cout << pmRead_meshList[currMeshIndex].rotation[2] << " " << endl; cout << "\t"; cout << "scale: "; cout << pmRead_meshList[currMeshIndex].scale[0] << " "; cout << pmRead_meshList[currMeshIndex].scale[1] << " "; cout << pmRead_meshList[currMeshIndex].scale[2] << " " << endl; cout << "\t"; cout << "Vertex Count: "; cout << pmRead_meshList[currMeshIndex].vertexCount << endl; cout << "\t"; cout << "SkelAnimVert Count: "; cout << pmRead_meshList[currMeshIndex].skelAnimVertexCount << endl; cout << "\t"; cout << "Joint Count: "; cout << pmRead_meshList[currMeshIndex].jointCount << endl; } if (pmRead_meshList[currMeshIndex].isAnimated == true) { { cout << "\n"; cout << "Skeleton Vertex vector: " << endl; cout << "mkList: " << endl; pmRead_mkList[currMeshIndex].vskList.resize(pmRead_meshList[currMeshIndex].skelAnimVertexCount); cout << "\t"; cout << pmRead_mkList[currMeshIndex].vskList.data(); cout << "\t"; cout << "Allocated memory for: " << pmRead_meshList[i].skelAnimVertexCount << " skel vertices" << endl << endl; } const int jointCount = pmRead_meshList[currMeshIndex].jointCount; /*Reading all the vertex lists for each mesh. For example if a mesh have 200 vertices, we can multiply the count of vertices with the sizes in bytes that the sVertex struct have. This means that we will be reading the pos, nor, uv, tan, bitan 200 times.*/ infile.read((char*)pmRead_mkList[currMeshIndex].vskList.data(), sizeof(read_sSkelAnimVertex) * pmRead_meshList[currMeshIndex].skelAnimVertexCount); /*Reading the joint list for each mesh. Every joint in the list have individual data that we have to process when reading from the file.*/ pmRead_meshJointHolder[currMeshIndex].jointList.resize(jointCount); pmRead_meshJointHolder[currMeshIndex].perJoint.resize(jointCount); { cout << "\n"; cout << "Joint vector: " << endl; cout << "\t"; // cout << pmRead_jointList.data() << endl; cout << "\t"; cout << "Allocated memory for: " << pmRead_meshList[currMeshIndex].jointCount << " joints" << endl; } /*Reading the data for all the joints that a skinned mesh have.*/ infile.read((char*)pmRead_meshJointHolder[currMeshIndex].jointList.data(), sizeof(read_sJoint) * jointCount); for (int jointCounter = 0; jointCounter < jointCount; jointCounter++) { //pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].meshChildren.resize() const int animStateCount = pmRead_meshJointHolder[currMeshIndex].jointList[jointCounter].animationStateCount; pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].animationStateTracker.resize(animStateCount); infile.read((char*)pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].animationStateTracker.data(), sizeof(read_sAnimationStateTracker) * animStateCount); const int meshChildCount = pmRead_meshJointHolder[currMeshIndex].jointList[jointCounter].meshChildCount; //here crash infile.read((char*)pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].meshChildren.data(), sizeof(int) * meshChildCount); pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].animationStates.resize(animStateCount); for (int animStateCounter = 0; animStateCounter < animStateCount; animStateCounter++) { const int keyCount = pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].animationStateTracker[animStateCounter].keyCount; pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].animationStates[animStateCounter].keyFrames.resize(keyCount); infile.read((char*)pmRead_meshJointHolder[currMeshIndex].perJoint[jointCounter].animationStates[animStateCounter].keyFrames.data(), sizeof(read_sKeyFrame) * keyCount); } } } else { pmRead_mList[currMeshIndex].vList.resize(pmRead_meshList[currMeshIndex].vertexCount); cout << "\n"; cout << "Vertex vector: " << endl; cout << "mList: " << endl; cout << "\t"; cout << pmRead_mList[currMeshIndex].vList.data() << endl; cout << "\t"; cout << "Allocated memory for " << pmRead_meshList[currMeshIndex].vertexCount << " vertices" << endl << endl; pmRead_mList[currMeshIndex].vList.resize(pmRead_meshList[currMeshIndex].vertexCount); /*Reading all the vertex lists for each mesh. For example if a mesh have 200 vertices, we can multiply the count of vertices with the sizes in bytes that the sVertex struct have. This means that we will be reading the pos, nor, uv, tan, bitan 200 times.*/ infile.read((char*)pmRead_mList[currMeshIndex].vList.data(), sizeof(read_sVertex) * pmRead_meshList[currMeshIndex].vertexCount); } const int childMeshCount = pmRead_meshList[currMeshIndex].meshChildCount; pmRead_meshChildList[currMeshIndex].meshChildList.resize(childMeshCount); infile.read((char*)pmRead_meshChildList[currMeshIndex].meshChildList.data(), sizeof(read_sMeshChild) * childMeshCount); } prevMeshes += pmRead_mainHeader.meshCount; } if (pmRead_mainHeader.materialCount >= 1) { pmRead_materialList.resize(pmRead_mainHeader.materialCount + prevMaterials); for (int i = 0; i < pmRead_mainHeader.materialCount; i++) { int currIndex = i + prevMaterials; /*Reading all the materials from the list with the size in bytes in mind.*/ infile.read((char*)&pmRead_materialList[currIndex], sizeof(read_sMaterial)); { cout << "Material: " << i << " Name: " << pmRead_materialList[currIndex].materialName << endl; cout << "Material vector: " << endl; cout << "\t"; cout << &pmRead_materialList[currIndex] << endl; cout << "\t"; cout << "Allocated memory for " << pmRead_mainHeader.materialCount << " materials" << endl; cout << "\t"; cout << "Ambient color: "; cout << pmRead_materialList[currIndex].ambientColor[0] << " " << pmRead_materialList[currIndex].ambientColor[1] << " " << pmRead_materialList[currIndex].ambientColor[2] << " " << endl; cout << "\t"; cout << "Diffuse color: "; cout << pmRead_materialList[currIndex].diffuseColor[0] << " " << pmRead_materialList[currIndex].diffuseColor[1] << " " << pmRead_materialList[currIndex].diffuseColor[2] << " " << endl; cout << "\t"; cout << "Specular color: "; cout << pmRead_materialList[currIndex].specularColor[0] << " " << pmRead_materialList[currIndex].specularColor[1] << " " << pmRead_materialList[currIndex].specularColor[2] << " " << endl; cout << "\t"; cout << "Shiny factor: "; cout << pmRead_materialList[currIndex].shinyFactor << endl; cout << "\t"; cout << "Diffuse texture: " << pmRead_materialList[currIndex].diffuseTexture << endl; cout << "\t"; cout << "Specular texture: " << pmRead_materialList[currIndex].specularTexture << endl; cout << "\t"; cout << "Normal texture: " << pmRead_materialList[currIndex].normalTexture << endl; cout << "______________________" << endl; } } prevMaterials += pmRead_mainHeader.materialCount; } if (pmRead_mainHeader.lightCount >= 1) { pmRead_lightList.resize(pmRead_mainHeader.lightCount + prevLights); for (int i = 0; i < pmRead_mainHeader.lightCount; i++) { int currIndex = i + prevLights; /*Reading all the lights from the list with the size in bytes in mind.*/ infile.read((char*)&pmRead_lightList[currIndex], sizeof(read_sLight)); { cout << "Light: " << i << endl; cout << "Light vector: " << endl; cout << "\t"; cout << &pmRead_lightList[currIndex] << endl; cout << "\t"; cout << "Allocated memory for " << pmRead_mainHeader.lightCount << " lights" << endl; cout << "\t"; cout << "Light ID: " << pmRead_lightList[currIndex].lightID << endl; cout << "\t"; cout << "Light position: " << pmRead_lightList[currIndex].lightPos[0] << " " << pmRead_lightList[currIndex].lightPos[1] << " " << pmRead_lightList[currIndex].lightPos[2] << endl; cout << "\t"; cout << "Light rotation: " << pmRead_lightList[currIndex].lightRot[0] << " " << pmRead_lightList[currIndex].lightRot[1] << " " << pmRead_lightList[currIndex].lightRot[2] << endl; cout << "\t"; cout << "Light scale: " << pmRead_lightList[currIndex].lightScale[0] << " " << pmRead_lightList[currIndex].lightScale[1] << " " << pmRead_lightList[currIndex].lightScale[2] << endl; cout << "\t"; cout << "Light color: " << pmRead_lightList[currIndex].color[0] << " " << pmRead_lightList[currIndex].color[1] << " " << pmRead_lightList[currIndex].color[2] << " " << endl; cout << "\t"; cout << "Light intensity: " << pmRead_lightList[currIndex].intensity << endl; cout << "______________________" << endl; } } prevLights = pmRead_mainHeader.lightCount; } if (pmRead_mainHeader.cameraCount >= 1) { pmRead_cameraList.resize(pmRead_mainHeader.cameraCount + prevCameras); for (int i = 0; i < pmRead_mainHeader.cameraCount; i++) { int currIndex = i + prevCameras; /*Reading all the cameras from the list with the size in bytes in mind.*/ infile.read((char*)&pmRead_cameraList[currIndex], sizeof(read_sCamera)); { cout << "Camera: " << i << endl; cout << "Camera vector: " << endl; cout << "\t"; cout << &pmRead_cameraList[currIndex] << endl; cout << "\t"; cout << "Allocated memory for " << pmRead_mainHeader.cameraCount << " cameras" << endl; cout << "\t"; cout << "Camera position: " << pmRead_cameraList[currIndex].camPos[0] << " " << pmRead_cameraList[currIndex].camPos[1] << " " << pmRead_cameraList[currIndex].camPos[2] << endl; cout << "\t"; cout << "Camera Up vector: " << pmRead_cameraList[currIndex].upVector[0] << " " << pmRead_cameraList[currIndex].upVector[1] << " " << pmRead_cameraList[currIndex].upVector[2] << endl; cout << "\t"; cout << "FOV: " << pmRead_cameraList[currIndex].fieldOfView << endl; cout << "\t"; cout << "Near plane: " << pmRead_cameraList[currIndex].nearPlane << endl; cout << "\t"; cout << "Far plane: " << pmRead_cameraList[currIndex].farPlane << endl; cout << "______________________" << endl; } } prevCameras += pmRead_mainHeader.cameraCount; } //contains the meshes pmRead_meshList; //Contains the vertices for each mesh pmRead_mList; //contains skeletal vertices for each mesh pmRead_mkList; //contains mesh children for each mesh pmRead_meshChildList; //Contains joint and animLayer-data pmRead_meshJointHolder; //contains the cameras pmRead_cameraList; //contains the lights pmRead_lightList; //contains the materials pmRead_materialList; infile.close(); } //const std::vector<read_sMesh>* MoleReader::getMeshList() //{ // return nullptr; //} const std::vector<read_sMesh>* MoleReader::getMeshList() { return &pmRead_meshList; } const std::vector<read_sMChildHolder>* MoleReader::getMeshChildList() { return &pmRead_meshChildList; } //const std::vector<read_m>* MoleReader::getVertexList() //{ // return &pmRead_mList; //} // //const std::vector<read_mk>* MoleReader::getSkeletalVertexList() //{ // return &pmRead_mkList; //} const std::vector<read_sMaterial>* MoleReader::getMaterialList() { return &pmRead_materialList; } const std::vector<read_sCamera>* MoleReader::getCameraList() { return &pmRead_cameraList; } const std::vector<read_sLight>* MoleReader::getLightList() { return &pmRead_lightList; } const std::vector<read_sMJHolder>* MoleReader::getJointKeyList() { return &pmRead_meshJointHolder; } const read_sMainHeader * MoleReader::getMainHeader() { return &pmRead_mainHeader; } const int MoleReader::getMeshIndex(string meshName) { for (int meshIndex = 0; meshIndex < pmRead_mainHeader.meshCount; meshIndex++) { int check = meshName.compare(pmRead_meshList[meshIndex].meshName); if (check == 0) { return meshIndex; } } return -1337; } const read_sMesh * MoleReader::getMesh(int meshIndex) { return &pmRead_meshList[meshIndex]; } const std::vector<read_sKeyFrame>* MoleReader::getKeyList(int meshIndex, int jointIndex, int animationState) { return &pmRead_meshJointHolder[meshIndex].perJoint[jointIndex].animationStates[animationState].keyFrames; } const std::vector<read_sMeshChild>* MoleReader::getMeshChildList(int meshIndex) { return &pmRead_meshChildList[meshIndex].meshChildList; } const read_sMaterial * MoleReader::getMaterial(int materialIndex) { return &pmRead_materialList[materialIndex]; } const read_sJoint * MoleReader::getJoint(int meshIndex, int jointIndex) { return &pmRead_meshJointHolder[meshIndex].jointList[jointIndex]; } const std::vector<read_sMeshChild> MoleReader::getJointMeshChildList(int meshIndex, int jointIndex) { return pmRead_meshJointHolder[jointIndex].perJoint[jointIndex].meshChildren; } const std::vector<read_sSkelAnimVertex>* MoleReader::getSkelVertexList(int meshIndex) { return &pmRead_mkList[meshIndex].vskList; } const std::vector<read_sVertex>* MoleReader::getVertexList(int meshIndex) { return &pmRead_mList[meshIndex].vList; } MoleReader::MoleReader() { prevMeshes = 0; prevCameras = 0; prevLights = 0; prevMaterials = 0; prevJoints = 0; } MoleReader::~MoleReader() { } //cout << "______________________" << endl; //GLuint vertexBuff; //glGenVertexArrays(1, &vao); //glBindVertexArray(vao); //// It wörks //glEnableVertexAttribArray(0); //glEnableVertexAttribArray(1); //glEnableVertexAttribArray(2); //glEnableVertexAttribArray(3); //glEnableVertexAttribArray(4); //glGenBuffers(1, &vertexBuff); //glBindBuffer(GL_ARRAY_BUFFER, vertexBuff); //glBufferData(GL_ARRAY_BUFFER, sizeof(read_sVertex) * read_mList[i].vList.size(), read_mList[i].vList.data(), GL_STATIC_DRAW); //cout << "______________________" << endl;
[ "funnei@hotmail.com" ]
funnei@hotmail.com
16092d95a04d92472d52fa6346eacc9c34d223af
d643ff48cdd4661e2a924a02a8458819b9aa23ac
/chapter3/3.36/main.cpp
0ac0a0fb4ec6dfa88d0293fa7fa1eda119761e64
[]
no_license
grayondream/Primer-Learing
d9bc1116d0b562b3650b7df22ae64d640c54f0a5
a0f4acb47770c11d3c1eb34e70f4f770d0255957
refs/heads/master
2021-05-11T04:09:33.206964
2018-01-24T06:30:12
2018-01-24T06:30:12
117,933,818
0
0
null
null
null
null
UTF-8
C++
false
false
696
cpp
/************************************************************************* > File Name: main.cpp > Author: > Mail: > Created Time: 2018年01月05日 星期五 23时40分57秒 ************************************************************************/ #include <iostream> using namespace std; bool com(int *a,size_t len1,int *b,size_t len2) { if(len1 != len2) return false; for(size_t i = 0;i < len1;i ++) { if(*(a + i) != *(b + i)) { return false; } } return true; } int main(int argc, char **argv) { cout<<"primer 3.36\n"; int a[4] = {12,13,4,5}; int b[4] = {12,13,4,5}; cout<<com(a,4,b,4); return 0; }
[ "GrayOnDream@outlook.com" ]
GrayOnDream@outlook.com
280bd1f107b71a0cf4e5d2ecc60163d0d6471d7e
5d69e513e1518739c5d5cdd569999ec0c19ef803
/src/mac/pxWindowNative.cpp
7c40b5f55fdf9c1d92844c00f4e75755cd539334
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-other-permissive" ]
permissive
rrao002c/pxCore
5541827abe3256bbf9fc8e4c25b300f6e20b27b1
b9b35600c291e3a39a16e0959060ff1511631f70
refs/heads/master
2021-01-17T11:03:28.457364
2016-04-22T16:47:22
2016-04-22T16:47:22
59,513,283
0
0
null
2016-05-23T19:42:56
2016-05-23T19:42:56
null
UTF-8
C++
false
false
15,363
cpp
// pxCore CopyRight 2007 John Robinson // Portable Framebuffer and Windowing Library // pwWindowNative.cpp #include "pxWindow.h" #include "pxWindowNative.h" // pxWindow pxError pxWindow::init(int left, int top, int width, int height) { Rect r; r.top = top; r.left = left; r.bottom = top+height; r.right = left+width; CreateNewWindow(kDocumentWindowClass, kWindowCloseBoxAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute | kWindowResizeTransitionAction | kWindowCollapseBoxAttribute | kWindowStandardHandlerAttribute, &r, &mWindowRef); if (mWindowRef) { EventTypeSpec eventType; EventHandlerUPP handlerUPP; EventHandlerRef handler; eventType.eventClass = kEventClassKeyboard; eventType.eventKind = kEventRawKeyDown; handlerUPP = NewEventHandlerUPP(doKeyDown); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventRawKeyUp; handlerUPP = NewEventHandlerUPP(doKeyUp); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventRawKeyRepeat; handlerUPP = NewEventHandlerUPP(doKeyDown); // 'key repeat' is translated to 'key down' InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); eventType.eventKind = kEventRawKeyModifiersChanged; handlerUPP = NewEventHandlerUPP(doKeyModifierChanged); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventWindowDrawContent; eventType.eventClass = kEventClassWindow; handlerUPP = NewEventHandlerUPP(doWindowDrawContent); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventWindowBoundsChanging; eventType.eventClass = kEventClassWindow; handlerUPP = NewEventHandlerUPP(doWindowResizeComplete); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventWindowResizeCompleted; //kEventWindowBoundsChanged; eventType.eventClass = kEventClassWindow; handlerUPP = NewEventHandlerUPP(doWindowResizeComplete); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventWindowClose; handlerUPP = NewEventHandlerUPP(doWindowCloseRequest); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventWindowClosed; eventType.eventClass = kEventClassWindow; handlerUPP = NewEventHandlerUPP(doWindowClosed); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventMouseDown; eventType.eventClass = kEventClassMouse; handlerUPP = NewEventHandlerUPP(doMouseDown); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventMouseUp; eventType.eventClass = kEventClassMouse; handlerUPP = NewEventHandlerUPP(doMouseUp); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventMouseMoved; eventType.eventClass = kEventClassMouse; handlerUPP = NewEventHandlerUPP(doMouseMove); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventMouseExited; eventType.eventClass = kEventClassMouse; handlerUPP = NewEventHandlerUPP(doMouseLeave); InstallWindowEventHandler (mWindowRef, handlerUPP, 1, &eventType, this, &handler); eventType.eventKind = kEventMouseDragged; eventType.eventClass = kEventClassMouse; handlerUPP = NewEventHandlerUPP(doMouseMove); InstallApplicationEventHandler (handlerUPP, 1, &eventType, this, nil); { Rect r; GetWindowBounds(mWindowRef,kWindowContentRgn ,&r); onSize(r.right-r.left, r.bottom-r.top); } createMouseTrackingRegion(); onCreate(); } return mWindowRef?PX_OK:PX_FAIL; } pxError pxWindow::term() { if (mWindowRef) { DisposeWindow(mWindowRef); mWindowRef = NULL; } return PX_OK; } void pxWindow::invalidateRect(pxRect* pxr) { Rect r; if (!pxr) { GetWindowBounds(mWindowRef,kWindowContentRgn ,&r); r.right -= r.left; r.bottom -= r.top; r.left = 0; r.top = 0; } else { r.left = pxr->left(); r.right = pxr->right(); r.top = pxr->top(); r.bottom = pxr->bottom(); } InvalWindowRect(mWindowRef,&r); } bool pxWindow::visibility() { return IsWindowVisible(mWindowRef); } void pxWindow::setVisibility(bool visible) { if (visible) ShowWindow(mWindowRef); else HideWindow(mWindowRef); } pxError pxWindow::setAnimationFPS(long fps) { if (theTimer) { RemoveEventLoopTimer(theTimer); } if (fps > 0) { EventLoopRef mainLoop; EventLoopTimerUPP timerUPP; mainLoop = GetMainEventLoop(); timerUPP = NewEventLoopTimerUPP (doPeriodicTask); InstallEventLoopTimer (mainLoop, 0, (1000/fps) * kEventDurationMillisecond, timerUPP, this, &theTimer); } return PX_OK; } void pxWindow::setTitle(char* title) { SetWindowTitleWithCFString(mWindowRef,CFStringCreateWithCString(nil,title,kCFStringEncodingASCII)); } pxError pxWindow::beginNativeDrawing(pxSurfaceNative& s) { s = GetWindowPort(this->mWindowRef); return PX_OK; } pxError pxWindow::endNativeDrawing(pxSurfaceNative& s) { // Don't need to do anything return PX_OK; } // pxWindowNative void pxWindowNative::createMouseTrackingRegion() { if (mTrackingRegion) { ReleaseMouseTrackingRegion(mTrackingRegion); mTrackingRegion = NULL; } { RgnHandle windowRgn = NewRgn(); //RgnHandle sizeBoxRgn = NewRgn(); GetWindowRegion(mWindowRef, kWindowContentRgn, windowRgn); //GetWindowRegion(mWindowRef, kWindowGrowRgn, sizeBoxRgn); //UnionRgn(windowRgn, sizeBoxRgn, windowRgn); //DisposeRgn(sizeBoxRgn); MouseTrackingRegionID mTrackingRegionId; mTrackingRegionId.signature = 'blah'; mTrackingRegionId.id = 1; CreateMouseTrackingRegion (mWindowRef, windowRgn, NULL, kMouseTrackingOptionsGlobalClip, mTrackingRegionId, NULL, NULL, &mTrackingRegion); DisposeRgn(windowRgn); } } pascal OSStatus pxWindowNative::doKeyDown (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { char key_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); UInt32 kc; GetEventParameter (theEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &kc); if (kc == 0x24) kc = 0x4c; pxWindowNative* w = (pxWindowNative*)userData; unsigned long flags = 0; if (modifier & shiftKey) flags |= PX_MOD_SHIFT; if (modifier & optionKey) flags |= PX_MOD_ALT; if (modifier & controlKey) flags |= PX_MOD_CONTROL; w->onKeyDown(kc, flags); return CallNextEventHandler (nextHandler, theEvent); } //------------------------------------------------------------------------ pascal OSStatus pxWindowNative::doKeyUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { char key_code; char char_code; UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key_code); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); UInt32 kc; GetEventParameter (theEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &kc); // printf("VK UP: %lx\n", kc); pxWindowNative* w = (pxWindowNative*)userData; if (kc == 0x24) kc = 0x4c; unsigned long flags = 0; if (modifier & shiftKey) flags |= PX_MOD_SHIFT; if (modifier & optionKey) flags |= PX_MOD_ALT; if (modifier & controlKey) flags |= PX_MOD_CONTROL; w->onKeyUp(kc, flags); return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doKeyModifierChanged (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { UInt32 modifier; GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); pxWindowNative* w = (pxWindowNative*)userData; if (!(w->mLastModifierState & shiftKey) && (modifier & shiftKey)) w->onKeyDown(PX_KEY_SHIFT, 0); else if ((w->mLastModifierState & shiftKey) && !(modifier & shiftKey)) w->onKeyUp(PX_KEY_SHIFT, 0); if (!(w->mLastModifierState & optionKey) && (modifier & optionKey)) w->onKeyDown(PX_KEY_ALT, 0); else if ((w->mLastModifierState & optionKey) && !(modifier & optionKey)) w->onKeyUp(PX_KEY_ALT, 0); if (!(w->mLastModifierState & controlKey) && (modifier & controlKey)) w->onKeyDown(PX_KEY_CONTROL, 0); else if ((w->mLastModifierState & controlKey) && !(modifier & controlKey)) w->onKeyUp(PX_KEY_CONTROL, 0); if (!(w->mLastModifierState & alphaLock) && (modifier & alphaLock)) w->onKeyDown(PX_KEY_CAPSLOCK, 0); else if ((w->mLastModifierState & alphaLock) && !(modifier & alphaLock)) w->onKeyUp(PX_KEY_CAPSLOCK, 0); w->mLastModifierState = modifier; return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doWindowDrawContent (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; //SetPort(GetWindowPort(w->mWindowRef)); //w->onDraw(GetPortPixMap(GetWindowPort(w->mWindowRef))); w->onDraw(GetWindowPort(w->mWindowRef)); return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doWindowResizeComplete(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; Rect rect; GetEventParameter(theEvent, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &rect); w->onSize(rect.right-rect.left, rect.bottom-rect.top); Rect r; GetWindowBounds(w->mWindowRef,kWindowContentRgn ,&r); r.right -= r.left; r.bottom -= r.top; r.left = r.top = 0; InvalWindowRect(w->mWindowRef,&r); OSStatus s = CallNextEventHandler (nextHandler, theEvent); w->createMouseTrackingRegion(); return s; } pascal OSStatus pxWindowNative::doWindowCloseRequest(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; printf("here\n"); w->onCloseRequest(); return noErr; // Don't use default handler } pascal void pxWindowNative::doPeriodicTask (EventLoopTimerRef theTimer, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; w->onAnimationTimer(); } pascal OSStatus pxWindowNative::doWindowClosed(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; w->onClose(); return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doMouseDown(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; Point loc; UInt16 button; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc); SetPort(GetWindowPort(w->mWindowRef)); RgnHandle r = NewRgn(); GetWindowRegion(w->mWindowRef, kWindowContentRgn, r); bool inContent = PtInRgn(loc, r); DisposeRgn(r); GlobalToLocal (&loc); GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); unsigned long flags = 0; if (button == kEventMouseButtonPrimary) flags |= PX_LEFTBUTTON; else if (button == kEventMouseButtonSecondary) flags |= PX_RIGHTBUTTON; else if (button == kEventMouseButtonTertiary) flags |= PX_MIDDLEBUTTON; if (modifier & shiftKey) flags |= PX_MOD_SHIFT; if (modifier & optionKey) flags |= PX_MOD_ALT; if (modifier & controlKey) flags |= PX_MOD_CONTROL; if (inContent) { if (w->mTrackingRegion) SetMouseTrackingRegionEnabled(w->mTrackingRegion, false); w->mDragging = true; w->onMouseDown(loc.h, loc.v, flags); } return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doMouseUp(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; Point loc; UInt16 button; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc); SetPort(GetWindowPort(w->mWindowRef)); RgnHandle r = NewRgn(); GetWindowRegion(w->mWindowRef, kWindowContentRgn, r); bool inContent = PtInRgn(loc, r); DisposeRgn(r); GlobalToLocal(&loc); GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); unsigned long flags = 0; if (button == kEventMouseButtonPrimary) flags |= PX_LEFTBUTTON; else if (button == kEventMouseButtonSecondary) flags |= PX_RIGHTBUTTON; else if (button == kEventMouseButtonTertiary) flags |= PX_MIDDLEBUTTON; if (modifier & shiftKey) flags |= PX_MOD_SHIFT; if (modifier & optionKey) flags |= PX_MOD_ALT; if (modifier & controlKey) flags |= PX_MOD_CONTROL; if (w->mTrackingRegion) SetMouseTrackingRegionEnabled(w->mTrackingRegion, true); w->mDragging = false; w->onMouseUp(loc.h, loc.v, flags); // Simulate onMouseLeave event if (!inContent) w->onMouseLeave(); return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doMouseMove(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; Point loc; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc); SetPort(GetWindowPort(w->mWindowRef)); RgnHandle r = NewRgn(); GetWindowRegion(w->mWindowRef, kWindowContentRgn, r); bool inContent = PtInRgn(loc, r); DisposeRgn(r); if (w->mDragging || inContent) { // Shouldn't need to do this here. But the Window region obtained from // GetWindowRegion doesn't appear to be updated immediately after a resize event // forcing us to update on every mousemove event w->createMouseTrackingRegion(); GlobalToLocal (&loc); printf("onMouseMove %d %d, %d\n", loc.h, loc.v, w->mDragging); w->onMouseMove(loc.h, loc.v); } return CallNextEventHandler (nextHandler, theEvent); } pascal OSStatus pxWindowNative::doMouseLeave(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { pxWindowNative* w = (pxWindowNative*)userData; #if 0 Point loc; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc); SetPort(GetWindowPort(w->mWindowRef)); GlobalToLocal (&loc); #endif printf("onMouseLeave\n"); w->onMouseLeave(); return CallNextEventHandler (nextHandler, theEvent); }
[ "johnrobinson@ubuntu.(none)" ]
johnrobinson@ubuntu.(none)
bd0720dbb643ccaf821cde092a07279aa40eae01
40b0530ef3eb345c49fc0d2face8bed9088a58c5
/v1.3/lib/hall-stm32/hall.h
c135d1373b0789eb54816716167d65285b37ad1d
[ "LicenseRef-scancode-public-domain", "Unlicense" ]
permissive
Enjection/monty
1262974ab1c74b82fc0ce4cef7906b36eea77bdb
e7f2ecaf1b7f2ed0ce24f5aaa4c14e801d18dfde
refs/heads/main
2023-07-18T16:17:08.465840
2021-08-25T09:30:01
2021-08-25T09:30:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,643
h
#include "boss.h" namespace hall { using namespace boss; enum struct STM { F1, F3, F4, F7, G0, G4, H7, L0, L4 }; #if STM32F1 constexpr auto FAMILY = STM::F1; #elif STM32F3 constexpr auto FAMILY = STM::F3; #elif STM32F4 constexpr auto FAMILY = STM::F4; #elif STM32F7 constexpr auto FAMILY = STM::F7; #elif STM32G0 constexpr auto FAMILY = STM::G0; #elif STM32G4 constexpr auto FAMILY = STM::G4; #elif STM32L0 constexpr auto FAMILY = STM::L0; #elif STM32L4 constexpr auto FAMILY = STM::L4; #endif auto fastClock (bool pll =true) -> uint32_t; auto slowClock (bool low =true) -> uint32_t; auto systemHz () -> uint32_t; void idle (); [[noreturn]] void systemReset (); template <typename TYPE, uint32_t ADDR> struct IoBase { constexpr static auto addr = ADDR; auto& operator() (int off) const { return *(volatile TYPE*) (ADDR+off); } }; template <uint32_t ADDR> using Io8 = IoBase<uint8_t,ADDR>; template <uint32_t ADDR> using Io16 = IoBase<uint16_t,ADDR>; template <uint32_t ADDR> struct Io32 : IoBase<uint32_t,ADDR> { using IoBase<uint32_t,ADDR>::operator(); auto operator() (int off, int bit, uint8_t num =1) const { struct IOMask { int o; uint8_t b, w; operator uint32_t () const { auto& a = *(volatile uint32_t*) (ADDR+o); auto m = (1<<w)-1; return (a >> b) & m; } auto operator= (uint32_t v) const { auto& a = *(volatile uint32_t*) (ADDR+o); auto m = (1<<w)-1; a = (a & ~(m<<b)) | ((v & m)<<b); return v & m; } }; return IOMask {off + (bit >> 5), (uint8_t) (bit & 0x1F), num}; } }; template <uint32_t ADDR> struct Io32b : Io32<ADDR> { using Io32<ADDR>::operator(); auto& operator() (int off, int bit) const { uint32_t a = ADDR + off + (bit>>5); return *(volatile uint32_t*) ((a & 0xF000'0000) + 0x0200'0000 + (a<<5) + ((bit&0x1F)<<2)); } }; constexpr Io32<0> anyIo32; namespace dev { //CG< devs constexpr Io32 <0x50040000> ADC1; constexpr Io32 <0x50040100> ADC2; constexpr Io32 <0x50040300> ADC_Common; constexpr Io32 <0x50060000> AES; constexpr Io32b <0x40006400> CAN1; constexpr Io32b <0x40010200> COMP; constexpr Io32b <0x40023000> CRC; constexpr Io32b <0x40006000> CRS; constexpr Io32b <0x40007400> DAC1; constexpr Io32 <0xE0042000> DBGMCU; constexpr Io32b <0x40016000> DFSDM; constexpr Io32b <0x40020000> DMA1; constexpr Io32b <0x40020400> DMA2; constexpr Io32b <0x40010400> EXTI; constexpr Io32b <0x40011C00> FIREWALL; constexpr Io32b <0x40022000> FLASH; constexpr Io32 <0xE000EF34> FPU; constexpr Io32 <0xE000ED88> FPU_CPACR; constexpr Io32b <0x48000000> GPIOA; constexpr Io32b <0x48000400> GPIOB; constexpr Io32b <0x48000800> GPIOC; constexpr Io32b <0x48000C00> GPIOD; constexpr Io32b <0x48001000> GPIOE; constexpr Io32b <0x48001C00> GPIOH; constexpr Io32b <0x40005400> I2C1; constexpr Io32b <0x40005800> I2C2; constexpr Io32b <0x40005C00> I2C3; constexpr Io32b <0x40008400> I2C4; constexpr Io32b <0x40003000> IWDG; constexpr Io32b <0x40002400> LCD; constexpr Io32b <0x40007C00> LPTIM1; constexpr Io32b <0x40009400> LPTIM2; constexpr Io32b <0x40008000> LPUART1; constexpr Io32 <0xE000ED90> MPU; constexpr Io32 <0xE000E100> NVIC; constexpr Io32 <0xE000EF00> NVIC_STIR; constexpr Io32b <0x40007800> OPAMP; constexpr Io32b <0x40007000> PWR; constexpr Io32 <0xA0001000> QUADSPI; constexpr Io32b <0x40021000> RCC; constexpr Io32 <0x50060800> RNG; constexpr Io32b <0x40002800> RTC; constexpr Io32b <0x40015400> SAI1; constexpr Io32 <0xE000ED00> SCB; constexpr Io32 <0xE000E008> SCB_ACTRL; constexpr Io32b <0x40012800> SDMMC; constexpr Io32b <0x40013000> SPI1; constexpr Io32b <0x40003800> SPI2; constexpr Io32b <0x40003C00> SPI3; constexpr Io32 <0xE000E010> STK; constexpr Io32b <0x40008800> SWPMI1; constexpr Io32b <0x40010000> SYSCFG; constexpr Io32b <0x40012C00> TIM1; constexpr Io32b <0x40014000> TIM15; constexpr Io32b <0x40014400> TIM16; constexpr Io32b <0x40000000> TIM2; constexpr Io32b <0x40000400> TIM3; constexpr Io32b <0x40001000> TIM6; constexpr Io32b <0x40001400> TIM7; constexpr Io32b <0x40024000> TSC; constexpr Io32b <0x40004C00> UART4; constexpr Io32b <0x40013800> USART1; constexpr Io32b <0x40004400> USART2; constexpr Io32b <0x40004800> USART3; constexpr Io32b <0x40006800> USB; constexpr Io32b <0x40010030> VREFBUF; constexpr Io32b <0x40002C00> WWDG; //CG> } namespace irq { //CG1 irqs-n constexpr auto limit = 85; enum : uint8_t { //CG< irqs-e ADC1_2 = 18, AES = 79, CAN1_RX0 = 20, CAN1_RX1 = 21, CAN1_SCE = 22, CAN1_TX = 19, COMP = 64, CRS = 82, DFSDM1 = 61, DFSDM1_FLT2 = 63, DFSDM1_FLT3 = 42, DFSDM2 = 62, DMA1_CH1 = 11, DMA1_CH2 = 12, DMA1_CH3 = 13, DMA1_CH4 = 14, DMA1_CH5 = 15, DMA1_CH6 = 16, DMA1_CH7 = 17, DMA2_CH1 = 56, DMA2_CH2 = 57, DMA2_CH3 = 58, DMA2_CH4 = 59, DMA2_CH5 = 60, DMA2_CH6 = 68, DMA2_CH7 = 69, EXTI0 = 6, EXTI1 = 7, EXTI15_10 = 40, EXTI2 = 8, EXTI3 = 9, EXTI4 = 10, EXTI9_5 = 23, FLASH = 4, FPU = 81, I2C1_ER = 32, I2C1_EV = 31, I2C2_ER = 34, I2C2_EV = 33, I2C3_ER = 73, I2C3_EV = 72, I2C4_ER = 84, I2C4_EV = 83, LCD = 78, LPTIM1 = 65, LPTIM2 = 66, LPUART1 = 70, PVD_PVM = 1, QUADSPI = 71, RCC = 5, RNG = 80, RTC_ALARM = 41, RTC_TAMP_STAMP = 2, RTC_WKUP = 3, SAI1 = 74, SDMMC1 = 49, SPI1 = 35, SPI2 = 36, SPI3 = 51, SWPMI1 = 76, TIM1_BRK_TIM15 = 24, TIM1_CC = 27, TIM1_TRG_COM = 26, TIM1_UP_TIM16 = 25, TIM2 = 28, TIM3 = 29, TIM6_DACUNDER = 54, TIM7 = 55, TSC = 77, UART4 = 52, USART1 = 37, USART2 = 38, USART3 = 39, USB = 67, WWDG = 0, //CG> }; } struct Pin { uint8_t port :4, pin :4; constexpr Pin () : port (15), pin (0) {} auto read () const { return (gpio32(IDR)>>pin) & 1; } void write (int v) const { gpio32(BSRR) = (v ? 1 : 1<<16)<<pin; } // shorthand void toggle () const { write(!read()); } operator int () const { return read(); } void operator= (int v) const { write(v); } // pin definition string: [A-O][<pin#>]:[AFPO][DU][LNHV][<alt#>][,] // return -1 on error, 0 if no mode set, or the mode (always > 0) auto config (char const*) -> int; // define multiple pins, return nullptr if ok, else ptr to error static auto define (char const*, Pin* =nullptr, int =0) -> char const*; private: constexpr static auto OFF = FAMILY == STM::F1 ? 0x0 : 0x8; enum { IDR=0x08+OFF, ODR=0x0C+OFF, BSRR=0x10+OFF }; auto gpio32 (int off) const -> volatile uint32_t& { return dev::GPIOA(0x400*port+off); } auto gpio32 (int off, int bit, uint8_t num =1) const { return dev::GPIOA(0x400*port+off, bit, num); } auto mode (int) const -> int; auto mode (char const* desc) const -> int; }; struct BlockIRQ { BlockIRQ () { asm ("cpsid i"); } ~BlockIRQ () { asm ("cpsie i"); } }; inline void nvicEnable (uint8_t irq) { dev::NVIC(0x00+4*(irq>>5)) = 1 << (irq&0x1F); } inline void nvicDisable (uint8_t irq) { dev::NVIC(0x80+4*(irq>>5)) = 1 << (irq&0x1F); } namespace systick { extern void (*expirer)(uint16_t,uint16_t&); void init (uint8_t ms =100); void deinit (); auto millis () -> uint32_t; auto micros () -> uint32_t; } namespace cycles { constexpr Io32<0xE000'1000> DWT; void init (); void deinit (); inline void clear () { DWT(0x04) = 0; } inline auto count () -> uint32_t { return DWT(0x04); } } namespace watchdog { auto resetCause () -> int; // watchdog: -1, nrst: 1, power: 2, other: 0 void init (int rate =6); // max timeout, 0 ≈ 500 ms, 6 ≈ 32 s void reload (int n); // 0..4095 x 125 µs (0) .. 8 ms (6) void kick (); } namespace rtc { struct DateTime { uint8_t yr, mo, dy, hh, mm, ss; }; void init (); auto get () -> DateTime; void set (DateTime dt); auto getData (int reg) -> uint32_t; void setData (int reg, uint32_t val); } namespace uart { void init (int n, char const* desc, int baud =115200); void deinit (int n); auto getc (int n) -> int; void putc (int n, int c); } }
[ "jc@wippler.nl" ]
jc@wippler.nl
cf6feb1c742440f524e1054ad746e7860a314708
118c080c0fad33c408b622b623076934db893728
/SimMeg.3.cpp
a6f2fc4969f43ea61d3eb850f6e32386368dcf82
[]
no_license
Liudimilla/Ling-C
255d51d9ed5a32e514c6e3c4869bbe8f3415414f
720e97386ffee3a3187e91673827cef4a94c5e22
refs/heads/master
2023-06-10T21:24:55.142741
2021-07-06T18:28:48
2021-07-06T18:28:48
178,754,681
0
0
null
null
null
null
UTF-8
C++
false
false
762
cpp
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<time.h> #include<string.h> struct pessoa { char nome [100]; int cpf,j,tam; int jogo [6]; }; for(j=0;j<tam; j++){ printf("\n"); for(j=1;j<=tam;j++){ printf("\nDigite seu nome:\n\n"); gets(umapessoa.nome); printf("Digite seu cpf\n"); scanf("%d", &umapessoa.cpf); printf("Digite os numeros desejados\n"); scanf("%d", &umapessoa.jogo[6]); fflush(stdin); } system ("pause>>null"); }
[ "noreply@github.com" ]
Liudimilla.noreply@github.com
de2cf38e4079dc82cc5f6471ea34f65e5e79461b
810837f2641e2a20826cb75b161ca3458917b1c2
/ash/login/ui/pin_request_view.cc
30824210cb72a13072b5a185bd03d8ee49f0e106
[ "BSD-3-Clause" ]
permissive
kan25/chromium
c425d4e1901816815bbde82c9c8d403507cbf588
27dc5aad16333a7be11602f4adb502cdc8759051
refs/heads/master
2023-02-24T09:04:16.104622
2020-03-13T18:03:42
2020-03-13T18:03:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
41,378
cc
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ash/login/ui/pin_request_view.h" #include <algorithm> #include <memory> #include <utility> #include <vector> #include "ash/login/login_screen_controller.h" #include "ash/login/ui/arrow_button_view.h" #include "ash/login/ui/login_button.h" #include "ash/login/ui/login_pin_view.h" #include "ash/login/ui/non_accessible_view.h" #include "ash/login/ui/pin_request_widget.h" #include "ash/public/cpp/login_constants.h" #include "ash/public/cpp/login_types.h" #include "ash/public/cpp/shelf_config.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/session/session_controller_impl.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/style/ash_color_provider.h" #include "ash/wallpaper/wallpaper_controller_impl.h" #include "base/bind.h" #include "base/logging.h" #include "base/optional.h" #include "base/strings/strcat.h" #include "base/strings/string16.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "components/session_manager/session_manager_types.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h" #include "ui/events/event.h" #include "ui/events/keycodes/dom/dom_code.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_analysis.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/font.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/views/background.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/focus_ring.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/controls/textfield/textfield_controller.h" #include "ui/views/layout/box_layout.h" #include "ui/views/layout/fill_layout.h" #include "ui/views/vector_icons.h" namespace ash { namespace { // Identifier of pin request input views group used for focus traversal. constexpr int kPinRequestInputGroup = 1; constexpr int kPinRequestViewWidthDp = 340; constexpr int kPinKeyboardHeightDp = 224; constexpr int kPinRequestViewRoundedCornerRadiusDp = 8; constexpr int kPinRequestViewVerticalInsetDp = 8; // Inset for all elements except the back button. constexpr int kPinRequestViewMainHorizontalInsetDp = 36; // Minimum inset (= back button inset). constexpr int kPinRequestViewHorizontalInsetDp = 8; constexpr int kCrossSizeDp = 20; constexpr int kBackButtonSizeDp = 36; constexpr int kLockIconSizeDp = 24; constexpr int kBackButtonLockIconVerticalOverlapDp = 8; constexpr int kHeaderHeightDp = kBackButtonSizeDp + kLockIconSizeDp - kBackButtonLockIconVerticalOverlapDp; constexpr int kIconToTitleDistanceDp = 24; constexpr int kTitleToDescriptionDistanceDp = 8; constexpr int kDescriptionToAccessCodeDistanceDp = 32; constexpr int kAccessCodeToPinKeyboardDistanceDp = 16; constexpr int kPinKeyboardToFooterDistanceDp = 16; constexpr int kSubmitButtonBottomMarginDp = 28; constexpr int kTitleFontSizeDeltaDp = 4; constexpr int kTitleLineWidthDp = 268; constexpr int kTitleLineHeightDp = 24; constexpr int kTitleMaxLines = 4; constexpr int kDescriptionFontSizeDeltaDp = 0; constexpr int kDescriptionLineWidthDp = 268; constexpr int kDescriptionTextLineHeightDp = 18; constexpr int kDescriptionMaxLines = 4; constexpr int kAccessCodeFlexLengthWidthDp = 192; constexpr int kAccessCodeFlexUnderlineThicknessDp = 1; constexpr int kAccessCodeFontSizeDeltaDp = 4; constexpr int kObscuredGlyphSpacingDp = 6; constexpr int kAccessCodeInputFieldWidthDp = 24; constexpr int kAccessCodeInputFieldUnderlineThicknessDp = 2; constexpr int kAccessCodeInputFieldHeightDp = 24 + kAccessCodeInputFieldUnderlineThicknessDp; constexpr int kAccessCodeBetweenInputFieldsGapDp = 8; constexpr int kArrowButtonSizeDp = 48; constexpr int kPinRequestViewMinimumHeightDp = kPinRequestViewMainHorizontalInsetDp + kLockIconSizeDp + kIconToTitleDistanceDp + kTitleToDescriptionDistanceDp + kDescriptionToAccessCodeDistanceDp + kAccessCodeInputFieldHeightDp + kAccessCodeToPinKeyboardDistanceDp + kPinKeyboardToFooterDistanceDp + kArrowButtonSizeDp + kPinRequestViewMainHorizontalInsetDp; // = 266 constexpr int kAlpha70Percent = 178; constexpr int kAlpha74Percent = 189; constexpr SkColor kTextColor = SK_ColorWHITE; constexpr SkColor kErrorColor = gfx::kGoogleRed300; constexpr SkColor kArrowButtonColor = SkColorSetARGB(0x2B, 0xFF, 0xFF, 0xFF); bool IsTabletMode() { return Shell::Get()->tablet_mode_controller()->InTabletMode(); } } // namespace PinRequest::PinRequest() = default; PinRequest::PinRequest(PinRequest&&) = default; PinRequest& PinRequest::operator=(PinRequest&&) = default; PinRequest::~PinRequest() = default; // Label button that displays focus ring. class PinRequestView::FocusableLabelButton : public views::LabelButton { public: FocusableLabelButton(views::ButtonListener* listener, const base::string16& text) : views::LabelButton(listener, text) { SetInstallFocusRingOnFocus(true); focus_ring()->SetColor(ShelfConfig::Get()->shelf_focus_border_color()); } FocusableLabelButton(const FocusableLabelButton&) = delete; FocusableLabelButton& operator=(const FocusableLabelButton&) = delete; ~FocusableLabelButton() override = default; }; class PinRequestView::AccessCodeInput : public views::View, public views::TextfieldController { public: AccessCodeInput() = default; ~AccessCodeInput() override = default; // Deletes the last character. virtual void Backspace() = 0; // Appends a digit to the code. virtual void InsertDigit(int value) = 0; // Returns access code as string. virtual base::Optional<std::string> GetCode() const = 0; // Sets the color of the input text. virtual void SetInputColor(SkColor color) = 0; virtual void SetInputEnabled(bool input_enabled) = 0; // Clears the input field(s). virtual void ClearInput() = 0; }; class PinRequestView::FlexCodeInput : public AccessCodeInput { public: using OnInputChange = base::RepeatingCallback<void(bool enable_submit)>; using OnEnter = base::RepeatingClosure; using OnEscape = base::RepeatingClosure; // Builds the view for an access code that consists out of an unknown number // of digits. |on_input_change| will be called upon digit insertion, deletion // or change. |on_enter| will be called when code is complete and user presses // enter to submit it for validation. |on_escape| will be called when pressing // the escape key. |obscure_pin| determines whether the entered pin is // displayed as clear text or as bullet points. FlexCodeInput(OnInputChange on_input_change, OnEnter on_enter, OnEscape on_escape, bool obscure_pin) : on_input_change_(std::move(on_input_change)), on_enter_(std::move(on_enter)), on_escape_(std::move(on_escape)) { DCHECK(on_input_change_); DCHECK(on_enter_); DCHECK(on_escape_); SetLayoutManager(std::make_unique<views::FillLayout>()); code_field_ = AddChildView(std::make_unique<views::Textfield>()); code_field_->set_controller(this); code_field_->SetTextColor(login_constants::kAuthMethodsTextColor); code_field_->SetFontList(views::Textfield::GetDefaultFontList().Derive( kAccessCodeFontSizeDeltaDp, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL)); code_field_->SetBorder(views::CreateSolidSidedBorder( 0, 0, kAccessCodeFlexUnderlineThicknessDp, 0, kTextColor)); code_field_->SetBackgroundColor(SK_ColorTRANSPARENT); code_field_->SetFocusBehavior(FocusBehavior::ALWAYS); code_field_->SetPreferredSize( gfx::Size(kAccessCodeFlexLengthWidthDp, kAccessCodeInputFieldHeightDp)); if (obscure_pin) { code_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); code_field_->SetObscuredGlyphSpacing(kObscuredGlyphSpacingDp); } else { code_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_NUMBER); } } FlexCodeInput(const FlexCodeInput&) = delete; FlexCodeInput& operator=(const FlexCodeInput&) = delete; ~FlexCodeInput() override = default; // Appends |value| to the code void InsertDigit(int value) override { DCHECK_LE(0, value); DCHECK_GE(9, value); if (code_field_->GetEnabled()) { code_field_->SetText(code_field_->GetText() + base::NumberToString16(value)); on_input_change_.Run(true); } } // Deletes the last character or the selected text. void Backspace() override { // Instead of just adjusting code_field_ text directly, fire a backspace key // event as this handles the various edge cases (ie, selected text). // views::Textfield::OnKeyPressed is private, so we call it via views::View. auto* view = static_cast<views::View*>(code_field_); view->OnKeyPressed(ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_BACK, ui::DomCode::BACKSPACE, ui::EF_NONE)); view->OnKeyPressed(ui::KeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_BACK, ui::DomCode::BACKSPACE, ui::EF_NONE)); // This triggers ContentsChanged(), which calls |on_input_change_|. } // Returns access code as string if field contains input. base::Optional<std::string> GetCode() const override { base::string16 code = code_field_->GetText(); if (!code.length()) { return base::nullopt; } return base::UTF16ToUTF8(code); } // Sets the color of the input text. void SetInputColor(SkColor color) override { code_field_->SetTextColor(color); } void SetInputEnabled(bool input_enabled) override { code_field_->SetEnabled(input_enabled); } // Clears text in input text field. void ClearInput() override { code_field_->SetText(base::string16()); on_input_change_.Run(false); } void RequestFocus() override { code_field_->RequestFocus(); } // views::TextfieldController void ContentsChanged(views::Textfield* sender, const base::string16& new_contents) override { const bool has_content = new_contents.length() > 0; on_input_change_.Run(has_content); } // views::TextfieldController bool HandleKeyEvent(views::Textfield* sender, const ui::KeyEvent& key_event) override { // Only handle keys. if (key_event.type() != ui::ET_KEY_PRESSED) return false; // Default handling for events with Alt modifier like spoken feedback. if (key_event.IsAltDown()) return false; // FlexCodeInput class responds to a limited subset of key press events. // All events not handled below are sent to |code_field_|. const ui::KeyboardCode key_code = key_event.key_code(); // Allow using tab for keyboard navigation. if (key_code == ui::VKEY_TAB || key_code == ui::VKEY_BACKTAB) return false; if (key_code == ui::VKEY_RETURN) { if (GetCode().has_value()) { on_enter_.Run(); } return true; } if (key_code == ui::VKEY_ESCAPE) { on_escape_.Run(); return true; } // We only expect digits in the PIN, so we swallow all letters. if (key_code >= ui::VKEY_A && key_code <= ui::VKEY_Z) return true; return false; } private: views::Textfield* code_field_; // To be called when access input code changes (digit is inserted, deleted or // updated). Passes true when code non-empty. OnInputChange on_input_change_; // To be called when user pressed enter to submit. OnEnter on_enter_; // To be called when user presses escape to go back. OnEscape on_escape_; }; // Accessible input field for a single digit in fixed length codes. // Customizes field description and focus behavior. class AccessibleInputField : public views::Textfield { public: AccessibleInputField() = default; ~AccessibleInputField() override = default; void set_accessible_description(const base::string16& description) { accessible_description_ = description; } // views::View: void GetAccessibleNodeData(ui::AXNodeData* node_data) override { views::Textfield::GetAccessibleNodeData(node_data); // The following property setup is needed to match the custom behavior of // pin input. It results in the following a11y vocalizations: // * when input field is empty: "Next number, {current field index} of // {number of fields}" // * when input field is populated: "{value}, {current field index} of // {number of fields}" node_data->RemoveState(ax::mojom::State::kEditable); node_data->role = ax::mojom::Role::kListItem; base::string16 description = views::Textfield::GetText().empty() ? accessible_description_ : GetText(); node_data->AddStringAttribute(ax::mojom::StringAttribute::kRoleDescription, base::UTF16ToUTF8(description)); } bool IsGroupFocusTraversable() const override { return false; } View* GetSelectedViewForGroup(int group) override { return parent() ? parent()->GetSelectedViewForGroup(group) : nullptr; } void OnGestureEvent(ui::GestureEvent* event) override { if (event->type() == ui::ET_GESTURE_TAP_DOWN) { RequestFocusWithPointer(event->details().primary_pointer_type()); return; } views::Textfield::OnGestureEvent(event); } private: base::string16 accessible_description_; DISALLOW_COPY_AND_ASSIGN(AccessibleInputField); }; // Digital access code input view for variable length of input codes. // Displays a separate underscored field for every input code digit. class PinRequestView::FixedLengthCodeInput : public AccessCodeInput { public: using OnInputChange = base::RepeatingCallback<void(bool last_field_active, bool complete)>; using OnEnter = base::RepeatingClosure; using OnEscape = base::RepeatingClosure; class TestApi { public: explicit TestApi( PinRequestView::FixedLengthCodeInput* fixed_length_code_input) : fixed_length_code_input_(fixed_length_code_input) {} ~TestApi() = default; views::Textfield* GetInputTextField(int index) { DCHECK_LT(static_cast<size_t>(index), fixed_length_code_input_->input_fields_.size()); return fixed_length_code_input_->input_fields_[index]; } private: PinRequestView::FixedLengthCodeInput* fixed_length_code_input_; }; // Builds the view for an access code that consists out of |length| digits. // |on_input_change| will be called upon access code digit insertion, deletion // or change. True will be passed if the current code is complete (all digits // have input values) and false otherwise. |on_enter| will be called when code // is complete and user presses enter to submit it for validation. |on_escape| // will be called when pressing the escape key. |obscure_pin| determines // whether the entered pin is displayed as clear text or as bullet points. FixedLengthCodeInput(int length, OnInputChange on_input_change, OnEnter on_enter, OnEscape on_escape, bool obscure_pin) : on_input_change_(std::move(on_input_change)), on_enter_(std::move(on_enter)), on_escape_(std::move(on_escape)) { DCHECK_LT(0, length); DCHECK(on_input_change_); SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, gfx::Insets(), kAccessCodeBetweenInputFieldsGapDp)); SetGroup(kPinRequestInputGroup); SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); for (int i = 0; i < length; ++i) { auto* field = new AccessibleInputField(); field->set_controller(this); field->SetPreferredSize(gfx::Size(kAccessCodeInputFieldWidthDp, kAccessCodeInputFieldHeightDp)); field->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER); field->SetBackgroundColor(SK_ColorTRANSPARENT); if (obscure_pin) { field->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); } else { field->SetTextInputType(ui::TEXT_INPUT_TYPE_NUMBER); } field->SetTextColor(kTextColor); field->SetFontList(views::Textfield::GetDefaultFontList().Derive( kAccessCodeFontSizeDeltaDp, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL)); field->SetBorder(views::CreateSolidSidedBorder( 0, 0, kAccessCodeInputFieldUnderlineThicknessDp, 0, kTextColor)); field->SetGroup(kPinRequestInputGroup); field->set_accessible_description(l10n_util::GetStringUTF16( IDS_ASH_LOGIN_PIN_REQUEST_NEXT_NUMBER_PROMPT)); input_fields_.push_back(field); AddChildView(field); } } ~FixedLengthCodeInput() override = default; FixedLengthCodeInput(const FixedLengthCodeInput&) = delete; FixedLengthCodeInput& operator=(const FixedLengthCodeInput&) = delete; // Inserts |value| into the |active_field_| and moves focus to the next field // if it exists. void InsertDigit(int value) override { DCHECK_LE(0, value); DCHECK_GE(9, value); ActiveField()->SetText(base::NumberToString16(value)); bool was_last_field = IsLastFieldActive(); // Moving focus is delayed by using PostTask to allow for proper // a11y announcements. Without that some of them are skipped. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&FixedLengthCodeInput::FocusNextField, weak_ptr_factory_.GetWeakPtr())); on_input_change_.Run(was_last_field, GetCode().has_value()); } // Clears input from the |active_field_|. If |active_field| is empty moves // focus to the previous field (if exists) and clears input there. void Backspace() override { if (ActiveInput().empty()) { FocusPreviousField(); } ActiveField()->SetText(base::string16()); on_input_change_.Run(IsLastFieldActive(), false /*complete*/); } // Returns access code as string if all fields contain input. base::Optional<std::string> GetCode() const override { std::string result; size_t length; for (auto* field : input_fields_) { length = field->GetText().length(); if (!length) return base::nullopt; DCHECK_EQ(1u, length); base::StrAppend(&result, {base::UTF16ToUTF8(field->GetText())}); } return result; } // Sets the color of the input text. void SetInputColor(SkColor color) override { for (auto* field : input_fields_) { field->SetTextColor(color); } } // views::View: bool IsGroupFocusTraversable() const override { return false; } View* GetSelectedViewForGroup(int group) override { return ActiveField(); } void RequestFocus() override { ActiveField()->RequestFocus(); } void GetAccessibleNodeData(ui::AXNodeData* node_data) override { views::View::GetAccessibleNodeData(node_data); node_data->role = ax::mojom::Role::kGroup; } // views::TextfieldController: bool HandleKeyEvent(views::Textfield* sender, const ui::KeyEvent& key_event) override { if (key_event.type() != ui::ET_KEY_PRESSED) return false; // Default handling for events with Alt modifier like spoken feedback. if (key_event.IsAltDown()) return false; // FixedLengthCodeInput class responds to limited subset of key press // events. All key pressed events not handled below are ignored. const ui::KeyboardCode key_code = key_event.key_code(); if (key_code == ui::VKEY_TAB || key_code == ui::VKEY_BACKTAB) { // Allow using tab for keyboard navigation. return false; } else if (key_code >= ui::VKEY_0 && key_code <= ui::VKEY_9) { InsertDigit(key_code - ui::VKEY_0); } else if (key_code >= ui::VKEY_NUMPAD0 && key_code <= ui::VKEY_NUMPAD9) { InsertDigit(key_code - ui::VKEY_NUMPAD0); } else if (key_code == ui::VKEY_LEFT) { FocusPreviousField(); } else if (key_code == ui::VKEY_RIGHT) { // Do not allow to leave empty field when moving focus with arrow key. if (!ActiveInput().empty()) FocusNextField(); } else if (key_code == ui::VKEY_BACK) { Backspace(); } else if (key_code == ui::VKEY_RETURN) { if (GetCode().has_value()) on_enter_.Run(); } else if (key_code == ui::VKEY_ESCAPE) { on_escape_.Run(); } return true; } bool HandleMouseEvent(views::Textfield* sender, const ui::MouseEvent& mouse_event) override { if (!(mouse_event.IsOnlyLeftMouseButton() || mouse_event.IsOnlyRightMouseButton())) { return false; } // Move focus to the field that was selected with mouse input. for (size_t i = 0; i < input_fields_.size(); ++i) { if (input_fields_[i] == sender) { active_input_index_ = i; RequestFocus(); break; } } return true; } bool HandleGestureEvent(views::Textfield* sender, const ui::GestureEvent& gesture_event) override { if (gesture_event.details().type() != ui::EventType::ET_GESTURE_TAP) return false; // Move focus to the field that was selected with gesture. for (size_t i = 0; i < input_fields_.size(); ++i) { if (input_fields_[i] == sender) { active_input_index_ = i; RequestFocus(); break; } } return true; } // Enables/disables entering a PIN. Currently, there is no use-case the uses // this with fixed length PINs. void SetInputEnabled(bool input_enabled) override { NOTIMPLEMENTED(); } // Clears the PIN fields. Currently, there is no use-case the uses this with // fixed length PINs. void ClearInput() override { NOTIMPLEMENTED(); } private: // Moves focus to the previous input field if it exists. void FocusPreviousField() { if (active_input_index_ == 0) return; --active_input_index_; ActiveField()->RequestFocus(); } // Moves focus to the next input field if it exists. void FocusNextField() { if (IsLastFieldActive()) return; ++active_input_index_; ActiveField()->RequestFocus(); } // Returns whether last input field is currently active. bool IsLastFieldActive() const { return active_input_index_ == (static_cast<int>(input_fields_.size()) - 1); } // Returns pointer to the active input field. AccessibleInputField* ActiveField() const { return input_fields_[active_input_index_]; } // Returns text in the active input field. const base::string16& ActiveInput() const { return ActiveField()->GetText(); } // To be called when access input code changes (digit is inserted, deleted or // updated). Passes true when code is complete (all digits have input value) // and false otherwise. OnInputChange on_input_change_; // To be called when user pressed enter to submit. OnEnter on_enter_; // To be called when user pressed escape to close view. OnEscape on_escape_; // An active/focused input field index. Incoming digit will be inserted here. int active_input_index_ = 0; // Unowned input textfields ordered from the first to the last digit. std::vector<AccessibleInputField*> input_fields_; base::WeakPtrFactory<FixedLengthCodeInput> weak_ptr_factory_{this}; }; PinRequestView::TestApi::TestApi(PinRequestView* view) : view_(view) { DCHECK(view_); } PinRequestView::TestApi::~TestApi() = default; LoginButton* PinRequestView::TestApi::back_button() { return view_->back_button_; } views::Label* PinRequestView::TestApi::title_label() { return view_->title_label_; } views::Label* PinRequestView::TestApi::description_label() { return view_->description_label_; } views::View* PinRequestView::TestApi::access_code_view() { return view_->access_code_view_; } views::LabelButton* PinRequestView::TestApi::help_button() { return view_->help_button_; } ArrowButtonView* PinRequestView::TestApi::submit_button() { return view_->submit_button_; } LoginPinView* PinRequestView::TestApi::pin_keyboard_view() { return view_->pin_keyboard_view_; } views::Textfield* PinRequestView::TestApi::GetInputTextField(int index) { return PinRequestView::FixedLengthCodeInput::TestApi( static_cast<PinRequestView::FixedLengthCodeInput*>( view_->access_code_view_)) .GetInputTextField(index); } PinRequestViewState PinRequestView::TestApi::state() const { return view_->state_; } // static SkColor PinRequestView::GetChildUserDialogColor(bool using_blur) { SkColor color = AshColorProvider::Get()->GetBaseLayerColor( AshColorProvider::BaseLayerType::kOpaque, AshColorProvider::AshColorMode::kDark); SkColor extracted_color = Shell::Get()->wallpaper_controller()->GetProminentColor( color_utils::ColorProfile(color_utils::LumaRange::DARK, color_utils::SaturationRange::MUTED)); if (extracted_color != kInvalidWallpaperColor && extracted_color != SK_ColorTRANSPARENT) { color = color_utils::GetResultingPaintColor( SkColorSetA(SK_ColorBLACK, kAlpha70Percent), extracted_color); } return using_blur ? SkColorSetA(color, kAlpha74Percent) : color; } // TODO(crbug.com/1061008): Make dialog look good on small screens with high // zoom factor. PinRequestView::PinRequestView(PinRequest request, Delegate* delegate) : delegate_(delegate), on_pin_request_done_(std::move(request.on_pin_request_done)), pin_keyboard_always_enabled_(request.pin_keyboard_always_enabled), default_title_(request.title), default_description_(request.description), default_accessible_title_(request.accessible_title.empty() ? request.title : request.accessible_title) { // Main view contains all other views aligned vertically and centered. auto layout = std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical, gfx::Insets(kPinRequestViewVerticalInsetDp, kPinRequestViewHorizontalInsetDp), 0); layout->set_main_axis_alignment(views::BoxLayout::MainAxisAlignment::kStart); layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kCenter); SetLayoutManager(std::move(layout)); SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); layer()->SetRoundedCornerRadius( gfx::RoundedCornersF(kPinRequestViewRoundedCornerRadiusDp)); layer()->SetBackgroundBlur(ShelfConfig::Get()->shelf_blur_radius()); const int child_view_width = kPinRequestViewWidthDp - 2 * kPinRequestViewMainHorizontalInsetDp; // Header view which contains the back button that is aligned top right and // the lock icon which is in the bottom center. auto header_layout = std::make_unique<views::FillLayout>(); auto* header = new NonAccessibleView(); header->SetLayoutManager(std::move(header_layout)); AddChildView(header); auto* header_spacer = new NonAccessibleView(); header_spacer->SetPreferredSize(gfx::Size(0, kHeaderHeightDp)); header->AddChildView(header_spacer); // Back button. auto* back_button_view = new NonAccessibleView(); back_button_view->SetPreferredSize( gfx::Size(child_view_width + 2 * (kPinRequestViewMainHorizontalInsetDp - kPinRequestViewHorizontalInsetDp), kHeaderHeightDp)); auto back_button_layout = std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, gfx::Insets(), 0); back_button_layout->set_main_axis_alignment( views::BoxLayout::MainAxisAlignment::kEnd); back_button_layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kStart); back_button_view->SetLayoutManager(std::move(back_button_layout)); header->AddChildView(back_button_view); back_button_ = new LoginButton(this); back_button_->SetPreferredSize( gfx::Size(kBackButtonSizeDp, kBackButtonSizeDp)); back_button_->SetBackground( views::CreateSolidBackground(SK_ColorTRANSPARENT)); back_button_->SetImage( views::Button::STATE_NORMAL, gfx::CreateVectorIcon(views::kIcCloseIcon, kCrossSizeDp, SK_ColorWHITE)); back_button_->SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER); back_button_->SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE); back_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ASH_LOGIN_BACK_BUTTON_ACCESSIBLE_NAME)); back_button_->SetFocusBehavior(FocusBehavior::ALWAYS); back_button_view->AddChildView(back_button_); // Main view icon. auto* icon_view = new NonAccessibleView(); icon_view->SetPreferredSize(gfx::Size(0, kHeaderHeightDp)); auto icon_layout = std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical, gfx::Insets(), 0); icon_layout->set_main_axis_alignment( views::BoxLayout::MainAxisAlignment::kEnd); icon_layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kCenter); icon_view->SetLayoutManager(std::move(icon_layout)); header->AddChildView(icon_view); views::ImageView* icon = new views::ImageView(); icon->SetPreferredSize(gfx::Size(kLockIconSizeDp, kLockIconSizeDp)); icon->SetImage(gfx::CreateVectorIcon(kPinRequestLockIcon, SK_ColorWHITE)); icon_view->AddChildView(icon); auto add_spacer = [&](int height) { auto* spacer = new NonAccessibleView(); spacer->SetPreferredSize(gfx::Size(0, height)); AddChildView(spacer); }; add_spacer(kIconToTitleDistanceDp); auto decorate_label = [](views::Label* label) { label->SetSubpixelRenderingEnabled(false); label->SetAutoColorReadabilityEnabled(false); label->SetEnabledColor(kTextColor); label->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); }; // Main view title. title_label_ = new views::Label(default_title_, views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY); title_label_->SetMultiLine(true); title_label_->SetMaxLines(kTitleMaxLines); title_label_->SizeToFit(kTitleLineWidthDp); title_label_->SetLineHeight(kTitleLineHeightDp); title_label_->SetFontList(gfx::FontList().Derive( kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); decorate_label(title_label_); AddChildView(title_label_); add_spacer(kTitleToDescriptionDistanceDp); // Main view description. description_label_ = new views::Label(default_description_, views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY); description_label_->SetMultiLine(true); description_label_->SetMaxLines(kDescriptionMaxLines); description_label_->SizeToFit(kDescriptionLineWidthDp); description_label_->SetLineHeight(kDescriptionTextLineHeightDp); description_label_->SetFontList( gfx::FontList().Derive(kDescriptionFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::NORMAL)); decorate_label(description_label_); AddChildView(description_label_); add_spacer(kDescriptionToAccessCodeDistanceDp); // Access code input view. if (request.pin_length.has_value()) { CHECK_GT(request.pin_length.value(), 0); access_code_view_ = AddChildView(std::make_unique<FixedLengthCodeInput>( request.pin_length.value(), base::BindRepeating(&PinRequestView::OnInputChange, base::Unretained(this)), base::BindRepeating(&PinRequestView::SubmitCode, base::Unretained(this)), base::BindRepeating(&PinRequestView::OnBack, base::Unretained(this)), request.obscure_pin)); } else { access_code_view_ = AddChildView(std::make_unique<FlexCodeInput>( base::BindRepeating(&PinRequestView::OnInputChange, base::Unretained(this), false), base::BindRepeating(&PinRequestView::SubmitCode, base::Unretained(this)), base::BindRepeating(&PinRequestView::OnBack, base::Unretained(this)), request.obscure_pin)); } access_code_view_->SetFocusBehavior(FocusBehavior::ALWAYS); add_spacer(kAccessCodeToPinKeyboardDistanceDp); // Pin keyboard. Note that the keyboard's own submit button is disabled via // passing a null |on_submit| callback. pin_keyboard_view_ = new LoginPinView(LoginPinView::Style::kAlphanumeric, base::BindRepeating(&AccessCodeInput::InsertDigit, base::Unretained(access_code_view_)), base::BindRepeating(&AccessCodeInput::Backspace, base::Unretained(access_code_view_)), /*on_submit=*/LoginPinView::OnPinSubmit()); // Backspace key is always enabled and |access_code_| field handles it. pin_keyboard_view_->OnPasswordTextChanged(false); AddChildView(pin_keyboard_view_); add_spacer(kPinKeyboardToFooterDistanceDp); // Footer view contains help text button aligned to its start, submit // button aligned to its end and spacer view in between. auto* footer = new NonAccessibleView(); footer->SetPreferredSize(gfx::Size(child_view_width, kArrowButtonSizeDp)); auto* bottom_layout = footer->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, gfx::Insets(), 0)); AddChildView(footer); help_button_ = new FocusableLabelButton( this, l10n_util::GetStringUTF16(IDS_ASH_LOGIN_PIN_REQUEST_HELP)); help_button_->SetPaintToLayer(); help_button_->layer()->SetFillsBoundsOpaquely(false); help_button_->SetTextSubpixelRenderingEnabled(false); help_button_->SetTextColor(views::Button::STATE_NORMAL, kTextColor); help_button_->SetTextColor(views::Button::STATE_HOVERED, kTextColor); help_button_->SetTextColor(views::Button::STATE_PRESSED, kTextColor); help_button_->SetFocusBehavior(FocusBehavior::ALWAYS); help_button_->SetVisible(request.help_button_enabled); footer->AddChildView(help_button_); auto* horizontal_spacer = new NonAccessibleView(); footer->AddChildView(horizontal_spacer); bottom_layout->SetFlexForView(horizontal_spacer, 1); submit_button_ = new ArrowButtonView(this, kArrowButtonSizeDp); submit_button_->SetBackgroundColor(kArrowButtonColor); submit_button_->SetPreferredSize( gfx::Size(kArrowButtonSizeDp, kArrowButtonSizeDp)); submit_button_->SetEnabled(false); submit_button_->SetAccessibleName( l10n_util::GetStringUTF16(IDS_ASH_LOGIN_SUBMIT_BUTTON_ACCESSIBLE_NAME)); submit_button_->SetFocusBehavior(FocusBehavior::ALWAYS); footer->AddChildView(submit_button_); add_spacer(kSubmitButtonBottomMarginDp); pin_keyboard_view_->SetVisible(PinKeyboardVisible()); tablet_mode_observer_.Add(Shell::Get()->tablet_mode_controller()); SetPreferredSize(GetPinRequestViewSize()); } PinRequestView::~PinRequestView() = default; void PinRequestView::OnPaint(gfx::Canvas* canvas) { views::View::OnPaint(canvas); cc::PaintFlags flags; flags.setStyle(cc::PaintFlags::kFill_Style); flags.setColor(GetChildUserDialogColor(true)); canvas->DrawRoundRect(GetContentsBounds(), kPinRequestViewRoundedCornerRadiusDp, flags); } void PinRequestView::RequestFocus() { access_code_view_->RequestFocus(); } gfx::Size PinRequestView::CalculatePreferredSize() const { return GetPinRequestViewSize(); } ui::ModalType PinRequestView::GetModalType() const { // MODAL_TYPE_SYSTEM is used to get a semi-transparent background behind the // pin request view, when it is used directly on a widget. The overlay // consumes all the inputs from the user, so that they can only interact with // the pin request view while it is visible. return ui::MODAL_TYPE_SYSTEM; } views::View* PinRequestView::GetInitiallyFocusedView() { return access_code_view_; } base::string16 PinRequestView::GetAccessibleWindowTitle() const { return default_accessible_title_; } void PinRequestView::ButtonPressed(views::Button* sender, const ui::Event& event) { if (sender == back_button_) { OnBack(); } else if (sender == help_button_) { delegate_->OnHelp(GetWidget()->GetNativeWindow()); } else if (sender == submit_button_) { SubmitCode(); } } void PinRequestView::OnTabletModeStarted() { if (!pin_keyboard_always_enabled_) { VLOG(1) << "Showing PIN keyboard in PinRequestView"; pin_keyboard_view_->SetVisible(true); // This will trigger ChildPreferredSizeChanged in parent view and Layout() // in view. As the result whole hierarchy will go through re-layout. UpdatePreferredSize(); } } void PinRequestView::OnTabletModeEnded() { if (!pin_keyboard_always_enabled_) { VLOG(1) << "Hiding PIN keyboard in PinRequestView"; DCHECK(pin_keyboard_view_); pin_keyboard_view_->SetVisible(false); // This will trigger ChildPreferredSizeChanged in parent view and Layout() // in view. As the result whole hierarchy will go through re-layout. UpdatePreferredSize(); } } void PinRequestView::OnTabletControllerDestroyed() { tablet_mode_observer_.RemoveAll(); } void PinRequestView::SubmitCode() { base::Optional<std::string> code = access_code_view_->GetCode(); DCHECK(code.has_value()); SubmissionResult result = delegate_->OnPinSubmitted(*code); switch (result) { case SubmissionResult::kPinAccepted: { std::move(on_pin_request_done_).Run(true /* success */); return; } case SubmissionResult::kPinError: { // Caller is expected to call UpdateState() to allow for customization of // error messages. return; } case SubmissionResult::kSubmitPending: { // Waiting on validation result - do nothing for now. return; } } } void PinRequestView::OnBack() { delegate_->OnBack(); if (PinRequestWidget::Get()) { PinRequestWidget::Get()->Close(false /* success */); } } void PinRequestView::UpdateState(PinRequestViewState state, const base::string16& title, const base::string16& description) { state_ = state; title_label_->SetText(title); description_label_->SetText(description); UpdatePreferredSize(); switch (state_) { case PinRequestViewState::kNormal: { access_code_view_->SetInputColor(kTextColor); title_label_->SetEnabledColor(kTextColor); return; } case PinRequestViewState::kError: { access_code_view_->SetInputColor(kErrorColor); title_label_->SetEnabledColor(kErrorColor); // Read out the error. title_label_->NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true); return; } } } void PinRequestView::ClearInput() { access_code_view_->ClearInput(); } void PinRequestView::SetInputEnabled(bool input_enabled) { access_code_view_->SetInputEnabled(input_enabled); } void PinRequestView::UpdatePreferredSize() { SetPreferredSize(CalculatePreferredSize()); if (GetWidget()) GetWidget()->CenterWindow(GetPreferredSize()); } void PinRequestView::FocusSubmitButton() { submit_button_->RequestFocus(); } void PinRequestView::OnInputChange(bool last_field_active, bool complete) { if (state_ == PinRequestViewState::kError) { UpdateState(PinRequestViewState::kNormal, default_title_, default_description_); } submit_button_->SetEnabled(complete); if (complete && last_field_active) { if (auto_submit_enabled_) { auto_submit_enabled_ = false; SubmitCode(); return; } // Moving focus is delayed by using PostTask to allow for proper // a11y announcements. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&PinRequestView::FocusSubmitButton, weak_ptr_factory_.GetWeakPtr())); } } void PinRequestView::GetAccessibleNodeData(ui::AXNodeData* node_data) { views::View::GetAccessibleNodeData(node_data); node_data->role = ax::mojom::Role::kDialog; node_data->SetName(default_accessible_title_); } // If |pin_keyboard_always_enabled_| is not set, pin keyboard is only shown in // tablet mode. bool PinRequestView::PinKeyboardVisible() const { return pin_keyboard_always_enabled_ || IsTabletMode(); } gfx::Size PinRequestView::GetPinRequestViewSize() const { int height = kPinRequestViewMinimumHeightDp + std::min(int{title_label_->GetRequiredLines()}, kTitleMaxLines) * kTitleLineHeightDp + std::min(int{description_label_->GetRequiredLines()}, kDescriptionMaxLines) * kDescriptionTextLineHeightDp; if (PinKeyboardVisible()) height += kPinKeyboardHeightDp; return gfx::Size(kPinRequestViewWidthDp, height); } } // namespace ash
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
4625688f8632dfcaff7791dc462c85f8b2144473
5742e5df1240da9be4955d42e4f402ca9f51cf0f
/ros2-osx/include/map_msgs/msg/detail/point_cloud2_update__traits.hpp
d3e4a73bc47aa5a6e8955d825eb228c82e20bcc9
[]
no_license
unmelted/ros_prj
b15b9961c313eff210636e7f65d40292f7252e9c
ec5e926147d7d9ac0606ea847cc4f5c4fb8fceed
refs/heads/master
2023-02-13T08:44:25.007130
2021-01-18T21:21:35
2021-01-18T21:21:35
330,076,208
0
0
null
null
null
null
UTF-8
C++
false
false
1,539
hpp
// generated from rosidl_generator_cpp/resource/idl__traits.hpp.em // with input from map_msgs:msg/PointCloud2Update.idl // generated code does not contain a copyright notice #ifndef MAP_MSGS__MSG__DETAIL__POINT_CLOUD2_UPDATE__TRAITS_HPP_ #define MAP_MSGS__MSG__DETAIL__POINT_CLOUD2_UPDATE__TRAITS_HPP_ #include "map_msgs/msg/detail/point_cloud2_update__struct.hpp" #include <rosidl_runtime_cpp/traits.hpp> #include <stdint.h> #include <type_traits> // Include directives for member types // Member 'header' #include "std_msgs/msg/detail/header__traits.hpp" // Member 'points' #include "sensor_msgs/msg/detail/point_cloud2__traits.hpp" namespace rosidl_generator_traits { template<> inline const char * data_type<map_msgs::msg::PointCloud2Update>() { return "map_msgs::msg::PointCloud2Update"; } template<> inline const char * name<map_msgs::msg::PointCloud2Update>() { return "map_msgs/msg/PointCloud2Update"; } template<> struct has_fixed_size<map_msgs::msg::PointCloud2Update> : std::integral_constant<bool, has_fixed_size<sensor_msgs::msg::PointCloud2>::value && has_fixed_size<std_msgs::msg::Header>::value> {}; template<> struct has_bounded_size<map_msgs::msg::PointCloud2Update> : std::integral_constant<bool, has_bounded_size<sensor_msgs::msg::PointCloud2>::value && has_bounded_size<std_msgs::msg::Header>::value> {}; template<> struct is_message<map_msgs::msg::PointCloud2Update> : std::true_type {}; } // namespace rosidl_generator_traits #endif // MAP_MSGS__MSG__DETAIL__POINT_CLOUD2_UPDATE__TRAITS_HPP_
[ "unmelted@naver.com" ]
unmelted@naver.com
fa4fbc92249d3c518205199917051575542739dd
6d0386587c23b9a9374813f30fef10cac55aa4d8
/gunhound/src/gunhound/vii_src/Enemy/HoundsEnemy/CEneH0205Danmaku.cpp
489496bed85c63ab7ae6a29af33514d1efe3ce4e
[]
no_license
t-mat/gunhound-easybuild
5b3c136205917a53a5d438b0498c7ead992e2416
e5c6d8fc792ea0aebf86c1743375b9356c2087bb
refs/heads/master
2020-04-06T07:09:37.246153
2016-09-10T19:00:32
2016-09-10T19:00:32
65,155,314
3
0
null
null
null
null
SHIFT_JIS
C++
false
false
13,281
cpp
//-------------------------------------------------------------------------------- // //弾幕用の弾クラス // //-------------------------------------------------------------------------------- #include "HoundsEnemy.h" //#include "EnemyTbl/CEneH0205JourikusenTBL.h" enum { enScrollOutWidth = WINDOW_W*100, enScrollOutHeight = WINDOW_H*100, enKuraiLeft = -30, enKuraiTop = -34, enKuraiRight = 30, enKuraiBottom= 0, enScore = 300, }; gxSprite SprDanmaku[] = { //弾幕用弾丸 { enTexPageEffectCommon02,32+16,136-8 ,16,16,8,8 }, //可変 { enTexPageEffectCommon02,32,136-8,14,8,7,5 }, //直進 { enTexPageEffectCommon02,32,136 ,10,10,5,5 }, //通常 }; enum { enBulletCurve, enBulletGensokuStraight, enBulletKasoku, enBulletGattling, enBulletNormal, enBulletFall, enBulletDropCandy, }; //------------------------------------------------------- //弾幕根元 //------------------------------------------------------- CDanmakuRoot::CDanmakuRoot( Sint32 sType , Sint32 x , Sint32 y , Sint32 sRot , Sint32 sSpd ) { m_Pos.x = x; m_Pos.y = y; m_sPattern = sType; m_fRot = (Float32)sRot; m_sSpd = sSpd; m_fRotSpd = ZERO; } void CDanmakuRoot::SeqMain() { switch( m_sPattern ){ case enDanmakuCandyShot: MakeCandyShot(); break; case enDanmakuDropShot: //ドロップショット MakeDropShot(); break; case enDanmakuAirCannon: //対空ドロップレーザー MakeAirCannon(); break; case enDanmakuSpiralGat: //ガトリング(ねじり)速い MakeGattlingSpiral(); break; case enDanmakuGattling: //ガトリング(ストレート) MakeGattlingStraight(); break; case enDanmakuWaveShot: //ウェーブ MakeWaveShot(); break; case enDanmakuTyphoonShot: //台風 MakeTyphoonShot(); break; case enDanmakuDonutsShot: //イオンリング MakeDonutsShot(); break; case enDanmakuPileBankerShot: //ランサーショット MakePileBankerShot(); break; } } void CDanmakuRoot::MakeCandyShot() { CDanmakuBullet *pBlt; for(Sint32 ii=0;ii<4;ii++) { Sint32 x,y; x = viiMath::Cos100((Sint32)m_fRot); y = viiMath::Sin100((Sint32)m_fRot); pBlt = new CDanmakuBullet( enBulletDropCandy , m_Pos.x, m_Pos.y ); pBlt->m_Add.x = 0; pBlt->m_Add.y = 0; pBlt->m_fRot = m_fRot+(-4+viiSub::Rand()%8)*4; pBlt->m_sAddSpd = 24; pBlt->m_sMaxSpd = m_sSpd+(-80+viiSub::Rand()%80); pBlt->m_sWait = viiSub::Rand()%8;//ii*2; pBlt->m_sSprite = 0; pBlt->m_sBulKaku = (Sint32)m_fRot; pBlt->m_fRotSpd = m_fRotSpd+1.5f+(-50+viiSub::Rand()%50)/100.f; pBlt->m_fWeightAdd = 10.5f; pBlt->m_sMaxSpd = m_sSpd+(-80+viiSub::Rand()%80); pBlt->m_bScrollOut = gxFalse; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); return; } void CDanmakuRoot::MakeDropShot() { //--------------------------------------- //ドロップショット //--------------------------------------- CDanmakuBullet *pBlt; for(Sint32 ii=0;ii<4;ii++) { Sint32 x,y; x = viiMath::Cos100((Sint32)m_fRot); y = viiMath::Sin100((Sint32)m_fRot); pBlt = new CDanmakuBullet( enBulletFall , m_Pos.x, m_Pos.y ); pBlt->m_Add.x = 0; pBlt->m_Add.y = 0; pBlt->m_fRot = m_fRot-4+viiSub::Rand()%8; pBlt->m_sAddSpd = 24; pBlt->m_sMaxSpd = m_sSpd+(-80+viiSub::Rand()%80); pBlt->m_sWait = viiSub::Rand()%8;//ii*2; pBlt->m_sSprite = 0; pBlt->m_sBulKaku = (Sint32)m_fRot; pBlt->m_fRotSpd = m_fRotSpd+1.5f+(-50+viiSub::Rand()%50)/100.f; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); } void CDanmakuRoot::MakeAirCannon() { //--------------------------------------- //高射砲ショット //--------------------------------------- CDanmakuBullet *pBlt; for(Sint32 ii=0;ii<12;ii++) { Sint32 x,y; x = viiMath::Cos100((Sint32)m_fRot); y = viiMath::Sin100((Sint32)m_fRot); pBlt = new CDanmakuBullet( enBulletFall , m_Pos.x, m_Pos.y ); pBlt->m_Add.x = 0; pBlt->m_Add.y = 0; pBlt->m_fRot = m_fRot; pBlt->m_sAddSpd = 24; pBlt->m_sMaxSpd = 480; pBlt->m_sWait = ii*2; pBlt->m_sSprite = 1; pBlt->m_sBulKaku = (Sint32)m_fRot; pBlt->m_fRotSpd = 1; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); } void CDanmakuRoot::MakeGattlingSpiral() { //--------------------------------------- //ガトリング砲(スパイラル) //--------------------------------------- CDanmakuBullet *pBlt; m_fRot -= 270.f; for(Sint32 ii=0;ii<8;ii++) { Sint32 x,y; x = viiMath::Cos100((Sint32)m_fRot); y = viiMath::Sin100((Sint32)m_fRot); pBlt = new CDanmakuBullet( enBulletKasoku , m_Pos.x, m_Pos.y ); pBlt->m_Add.x = x; pBlt->m_Add.y = y; pBlt->m_fRot = m_fRot+ii; pBlt->m_sAddSpd = 32; pBlt->m_sMaxSpd = 880; pBlt->m_sWait = ii*2; pBlt->m_sSprite = 1; pBlt->m_sBulKaku = (Sint32)m_fRot; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); } void CDanmakuRoot::MakeGattlingStraight() { //--------------------------------------- //ガトリング砲 //--------------------------------------- CDanmakuBullet *pBlt; // m_fRot -= 270.f; for(Sint32 ii=0;ii<4;ii++) { Sint32 x,y; x = viiMath::Cos100((Sint32)m_fRot); y = viiMath::Sin100((Sint32)m_fRot); pBlt = new CDanmakuBullet( enBulletGattling , m_Pos.x +x, m_Pos.y+y ); pBlt->m_Add.x = x; pBlt->m_Add.y = y; pBlt->m_fRot = m_fRot+ii; pBlt->m_sAddSpd = 24; pBlt->m_sMaxSpd = 360*2; pBlt->m_sWait = ii*6; pBlt->m_sSprite = 1; pBlt->m_sBulKaku = (Sint32)m_fRot; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); } void CDanmakuRoot::MakePileBankerShot() { //------------------------------------ //パイルバンカー //------------------------------------ CDanmakuBullet *pBlt; m_fRot -= 270.f; Sint32 xx,yy; xx = viiMath::Cos100((Sint32)m_fRot); yy = viiMath::Sin100((Sint32)m_fRot); Sint32 dstAdd = 0; for(Sint32 ii=0;ii<360*2-90;ii+=12) { Sint32 x,y,dst,r; //楕円を生成 x = (viiMath::Cos100(ii)*32)/100; y = (viiMath::Sin100(ii)*32 )/100; dst = 0;//viiMath::Dist(0,0,x,y); r = viiMath::Atan2_100(y,x)/100; dstAdd += 1; //楕円の角度を変更 x = viiMath::Cos100(r+(Sint32)m_fRot)*(dst+dstAdd/3); y = viiMath::Sin100(r+(Sint32)m_fRot)*(dst+dstAdd/3); pBlt = new CDanmakuBullet( enBulletKasoku , m_Pos.x +x, m_Pos.y+y ); pBlt->m_Add.x = 0;//;xx*8; pBlt->m_Add.y = 0;//;yy*8; pBlt->m_fRot = m_fRot-90; pBlt->m_sAddSpd = 32; pBlt->m_sMaxSpd = 300+viiMath::Sin100(ii);//480+ii*10; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); return; } void CDanmakuRoot::MakeDonutsShot() { //------------------------------------ //ドーナツ砲 //------------------------------------ CDanmakuBullet *pBlt; m_fRot -= 270.f; Sint32 xx,yy; xx = viiMath::Cos100((Sint32)m_fRot); yy = viiMath::Sin100((Sint32)m_fRot); for(Sint32 ii=0;ii<360;ii+=16) { Sint32 x,y,dst,r; //楕円を生成 x = (viiMath::Cos100(ii)*30)/100; y = (viiMath::Sin100(ii)*10 )/100; dst = viiMath::Dist(0,0,x,y); r = viiMath::Atan2_100(y,x)/100; //楕円の角度を変更 x = viiMath::Cos100(r+(Sint32)m_fRot)*dst; y = viiMath::Sin100(r+(Sint32)m_fRot)*dst; pBlt = new CDanmakuBullet( enBulletKasoku , m_Pos.x +x, m_Pos.y+y ); pBlt->m_Add.x = 0; pBlt->m_Add.y = 0; pBlt->m_fRot = m_fRot-90; pBlt->m_sAddSpd = 32;//8 pBlt->m_sMaxSpd = 480; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); return; } void CDanmakuRoot::MakeTyphoonShot() { //------------------------------------ //タイフーンショット //------------------------------------ CDanmakuBullet *pBlt; Sint32 sWait = 0; for(Sint32 ii=-135;ii<90;ii+=12) { m_Pos.x -= 100; pBlt = new CDanmakuBullet( enBulletCurve , m_Pos.x , m_Pos.y ); pBlt->m_Add.x = (viiMath::Cos100((Sint32)m_fRot+ii)); pBlt->m_Add.y = (viiMath::Sin100((Sint32)m_fRot+ii)); pBlt->m_fRot = m_fRot+ii; pBlt->m_sMaxSpd = 60; pBlt->m_sSpd = 0; pBlt->m_sWait = sWait*1; pBlt->SetBulletIndex( m_sBulletIndex ); sWait ++; } SetActionSeq( enActionSeqEnd ); } void CDanmakuRoot::MakeWaveShot() { //------------------------------------ //ウェーブショット //------------------------------------ CDanmakuBullet *pBlt; m_fRot -= 270.f; Sint32 xx,yy; xx = viiMath::Cos100((Sint32)m_fRot); yy = viiMath::Sin100((Sint32)m_fRot); for(Sint32 ii=0;ii<360;ii+=16) { Sint32 x,y,dst,r; //楕円を生成 // x = (viiMath::Cos100(ii)*30)/100; // y = (viiMath::Sin100(ii)*10 )/100; x = (viiMath::Cos100(ii)*10)/100; y = (viiMath::Sin100(ii)*3 )/100; dst = viiMath::Dist(0,0,x,y); r = viiMath::Atan2_100(y,x)/100; //楕円の角度を変更 x = viiMath::Cos100(r+(Sint32)m_fRot)*dst; y = viiMath::Sin100(r+(Sint32)m_fRot)*dst; pBlt = new CDanmakuBullet( enBulletKasoku , m_Pos.x +x, m_Pos.y+y ); pBlt->m_Add.x = 0; pBlt->m_Add.y = 0; pBlt->m_fRot = m_fRot-90; pBlt->m_sAddSpd = 32;//8 pBlt->m_sMaxSpd = 100+m_sSpd+gxAbs(viiMath::Sin100(ii));//480+ii*10; pBlt->SetBulletIndex( m_sBulletIndex ); } SetActionSeq( enActionSeqEnd ); } void CDanmakuRoot::Draw() { } //------------------------------------------------------- CDanmakuBullet::CDanmakuBullet( Sint32 sType , Sint32 x , Sint32 y ) { m_HitAtari.set_hp( 1 ); m_HitAtari.set_ap( 1 ); m_Pos.x = x; m_Pos.y = y; m_sPattern = sType; m_Add.x = 0; m_Add.y = 0; m_Kasoku.x = 0; m_Kasoku.y = 0; m_sWait = 0; m_fRot = 0; m_sSpd = 0; m_sMaxSpd = 0; m_sAddSpd = 8; m_fRotSpd = 1; m_fWeight = ZERO; m_fWeightAdd = ZERO; m_bScrollOut = gxTrue; m_HitAtari.ax1 = -2; m_HitAtari.ay1 = -2; m_HitAtari.ax2 = 2; m_HitAtari.ay2 = 2; m_sSprite = 2; m_sBulKaku = 0;//viiSub::Rand()%360; } CDanmakuBullet::~CDanmakuBullet() { } void CDanmakuBullet::SeqMain() { if( m_sWait > 0 ) { m_sWait --; return; } if( IsClearBullet() ) { viiEff::Set(EFF_HITFLASH_ENE , m_Pos.x , m_Pos.y , 0 ); SetActionSeq( enActionSeqEnd ); return; } if( m_HitAtari.is_dead() || m_HitAtari.IsImpacted() ) { viiEff::Set( EFF_HITFLASH , m_Pos.x , m_Pos.y , argset(0) ); // viiEff::SetBombSimple( m_Pos.x , m_Pos.y , 1 , 1+viiSub::Rand()%2 ); SetActionSeq( enActionSeqEnd ); return; } if( m_bScrollOut && viiSub::IsScrollOut( m_Pos.x , m_Pos.y , enScrollOutWidth , enScrollOutHeight ) ) { SetActionSeq( enActionSeqEnd ); return; } if( viiSub::GetBoundBlock_Enemy( m_Pos.x , m_Pos.y ) ) { viiEff::Set(EFF_HITFLASH_ENE , m_Pos.x , m_Pos.y , 0 ); SetActionSeq( enActionSeqEnd ); return; } m_sBulKaku +=8; m_sBulKaku = m_sBulKaku%360; switch( m_sPattern ){ case enBulletDropCandy: PatternCandy(); break; case enBulletFall: // m_sBulKaku = (Sint32)m_fRot; PatternFall(); break; case enBulletGensokuStraight: PatternWaveShot(); break; case enBulletCurve: PatternTyphoon(); break; case enBulletKasoku: PatternKasoku(); break; case enBulletNormal: PatternNormal(); break; case enBulletGattling: m_sBulKaku = (Sint32)m_fRot; PatternKasoku(); break; } if( m_sSpd < m_sMaxSpd ) { m_sSpd += m_sAddSpd; if( m_sSpd >= m_sMaxSpd ) { m_sSpd = m_sMaxSpd; } } m_HitAtari.SetHantei(ID_ENEMY_ATK , &m_Pos ); } void CDanmakuBullet::PatternTyphoon() { //回転軌道 m_fRot +=1; m_Add.x = viiMath::Cos100((Sint32)m_fRot)*10; m_Add.y = viiMath::Sin100((Sint32)m_fRot)*3; m_Pos.x += m_Add.x+150; m_Pos.y += m_Add.y; } void CDanmakuBullet::PatternKasoku() { //単純加速 m_Add.x = (viiMath::Cos100((Sint32)m_fRot)*m_sSpd)/100; m_Add.y = (viiMath::Sin100((Sint32)m_fRot)*m_sSpd)/100; m_Pos.x += m_Add.x; m_Pos.y += m_Add.y; } void CDanmakuBullet::PatternNormal() { //単純加速 m_Pos.x += m_Add.x; m_Pos.y += m_Add.y; } void CDanmakuBullet::PatternFall() { //落下軌道 NORMALIZE( m_fRot ); /* while(m_fRot > 360.f) { m_fRot -= 360.f; } while(m_fRot < 0.f) { m_fRot += 360.f; } */ if(m_fRot < 270 && m_fRot > 90) { m_fRot -= m_fRotSpd; } else if(m_fRot > 270 && m_fRot < 360+90) { m_fRot += m_fRotSpd; } else if(m_fRot < 90 && m_fRot > -90) { m_fRot += m_fRotSpd; } m_Add.x = (viiMath::Cos100((Sint32)m_fRot)*m_sSpd)/100; m_Add.y = (viiMath::Sin100((Sint32)m_fRot)*m_sSpd)/100; m_Pos.x += m_Add.x; m_Pos.y += m_Add.y; } void CDanmakuBullet::PatternWaveShot() { Sint32 sSpdRev = 1; if( m_sSpd > m_sMaxSpd ) { m_sSpd -= 16; } if(m_sSpd < 0 ) { m_sSpd -= 12; m_Add.x = viiMath::Cos100((Sint32)m_fRot); m_Add.y = viiMath::Sin100((Sint32)m_fRot); sSpdRev = -1; } m_Pos.x += (m_Add.x*(m_sSpd*sSpdRev))/100; m_Pos.y += (m_Add.y*(m_sSpd*sSpdRev))/100; } void CDanmakuBullet::PatternCandy() { //単純加速 m_Add.x = (viiMath::Cos100((Sint32)m_fRot)*m_sSpd)/100; m_Add.y = (viiMath::Sin100((Sint32)m_fRot)*m_sSpd)/100; m_Add.y += m_fWeight; if(m_fWeight < 800.f) m_fWeight += m_fWeightAdd; m_Pos.x += m_Add.x; m_Pos.y += m_Add.y; if( viiSub::IsScrollOut( m_Pos.x , m_Pos.y , 32*100 , 128*100 ) ) { SetActionSeq( enActionSeqEnd ); return; } } void CDanmakuBullet::Draw() { viiDraw::Sprite( &SprDanmaku[m_sSprite] , m_Pos.x , m_Pos.y , PRIO_ENE_BULLET ,ATR_DFLT , ARGB_DFLT , 1.f,m_sBulKaku); }
[ "takayuki.matsuoka@gmail.com" ]
takayuki.matsuoka@gmail.com
b5f16d6587cb0ac10a4e89ec4e28c8e75a09d736
e1eeac6e69b4b85b7c22f374fd068f9370476803
/instruction/gt.h
83a0179006ce09332e96c537483be5c128ed9e56
[]
no_license
trigrass2/PLCSim
fb32d58bf61fc0c2228464a9ec651bf624683cdf
c468c45363a396afaf7d1a77440ded6f82e1af86
refs/heads/master
2022-02-25T11:33:06.730980
2019-11-05T08:22:45
2019-11-05T08:22:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
419
h
#ifndef PLC_EMULATOR_INSTRUCTION_GT_H_ #define PLC_EMULATOR_INSTRUCTION_GT_H_ #include "instruction.h" namespace plc_emulator { class GT : public Instruction { public: GT(ResourceImpl *associated_resource, bool is_negated) { SetResource(associated_resource); SetNegation(is_negated); SetName("GT"); }; void Execute(Variable *curr_result, std::vector<Variable *> &ops); }; } #endif
[ "wisedier@gmail.com" ]
wisedier@gmail.com
8c07761ab525d2baf71c3d69cf9a8911c8eb066a
cee5c0b14016175c525f17fc96854e0c3ea754d7
/servo.ino
05ce88b10b22866c444c95486e0ef854e9aaa3ae
[]
no_license
ezequiel9/ESP8266-Servo-controller
2923850f4c1f4f2a675cf970b188f82c415a6ada
1bc79fcfd53f06a87871406a5a66c818c633318a
refs/heads/master
2020-07-10T19:57:45.206141
2019-08-25T22:24:44
2019-08-25T22:24:44
204,355,818
0
0
null
null
null
null
UTF-8
C++
false
false
2,042
ino
/* * ESP8266 Servo Motor Control With Web Server */ #include <ESP8266WiFi.h> #include <ESP8266WebServer.h> #include <Servo.h> #include "index.h"; #define LED 2 #define ServoPin 14 //D5 is GPIO14 //WiFi Connection configuration const char *ssid = "ssid"; const char *password = "password"; Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards ESP8266WebServer server(80); //================================================ void handleServo(){ String POS = server.arg("servoPOS"); int pos = POS.toInt(); myservo.write(pos); // tell servo to go to position delay(15); Serial.print("Servo Angle:"); Serial.println(pos); digitalWrite(LED,!(digitalRead(LED))); //Toggle LED server.send(200, "text/plane",""); } void handleRoot() { String s = MAIN_page; //Read HTML contents server.send(200, "text/html", s); //Send web page } //================================================ // Setup //================================================ void setup() { delay(1000); Serial.begin(115200); Serial.println(); pinMode(LED,OUTPUT); myservo.attach(ServoPin); // attaches the servo on GIO2 to the servo object //Connect to wifi Network WiFi.begin(ssid, password); //Connect to your WiFi router Serial.println(""); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } //If connection successful show IP address in serial monitor Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); //IP address assigned to your ESP //Initialize Webserver server.on("/",handleRoot); server.on("/setPOS",handleServo); //Sets servo position from Web request server.begin(); } //================================================ // LOOP //================================================ void loop() { server.handleClient(); } //================================================
[ "noreply@github.com" ]
ezequiel9.noreply@github.com
4ba4312ac9de18e7bd010b3f1aff9e11bb2145f0
553e8a8c36d52580b85e572bf1ba071e304932e9
/casablanca/Release/src/pplx/threadpool.cpp
febe7bb81a63cc505cdb63fe328067cf47acbcbe
[ "Apache-2.0" ]
permissive
mentionllc/traintracks-cpp-sdk
ba0d62bc5289d4d82d0c17b282788d65e1863cec
c294a463ef2d55bc7b27e35fe7f903d51104c6bd
refs/heads/master
2020-04-19T06:40:23.949106
2015-02-05T04:45:24
2015-02-05T04:45:24
28,652,489
0
0
null
null
null
null
UTF-8
C++
false
false
1,948
cpp
/*** * ==++== * * Copyright (c) Microsoft Corporation. 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. * * ==--== * =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ **/ #include "stdafx.h" #if defined(__ANDROID__) #include <android/log.h> #include <jni.h> #endif namespace crossplat { #if (defined(ANDROID) || defined(__ANDROID__)) // This pointer will be 0-initialized by default (at load time). std::atomic<JavaVM*> JVM; static void abort_if_no_jvm() { if (JVM == nullptr) { __android_log_print(ANDROID_LOG_ERROR, "CPPRESTSDK", "%s", "The CppREST SDK must be initialized before first use on android: https://casablanca.codeplex.com/wikipage?title=Use%20on%20Android"); std::abort(); } } JNIEnv* get_jvm_env() { abort_if_no_jvm(); JNIEnv* env = nullptr; auto result = JVM.load()->AttachCurrentThread(&env, nullptr); if (result != JNI_OK) { throw std::runtime_error("Could not attach to JVM"); } return env; } threadpool& threadpool::shared_instance() { abort_if_no_jvm(); static threadpool s_shared(40); return s_shared; } #else // initialize the static shared threadpool threadpool threadpool::s_shared(40); #endif } #if defined(__ANDROID__) void cpprest_init(JavaVM* vm) { crossplat::JVM = vm; } #endif
[ "heisenberg@traintracks.io" ]
heisenberg@traintracks.io
724302528c12a784deedc6b4befa9d073fe09795
fc515a72800f3fc7b3de998cb944eab91e0baf7b
/Other Works/SAMS2/howmuch.cpp
0ec9fbaaa070ec4debb93eb1dfad4d6640c58818
[]
no_license
jbji/2019-Programming-Basics-C-
4211e0c25dd1fc88de71716ad6a37d41cd7b8b04
014d3d8a5f1d6a95c132699e98ef4bfb25ef845f
refs/heads/master
2022-12-30T08:12:09.214502
2020-10-13T14:17:57
2020-10-13T14:17:57
303,658,050
0
0
null
null
null
null
UTF-8
C++
false
false
494
cpp
#include <howmuch.h> int howMuch(string filename){ ifstream filein(filename, ios::app | ios::binary); //打开文件 if (!filein) //读取失败 { filein.close(); return 0; } string getName, getId, getScore; int i = 0; while (getline(filein, getName, DEliM) && getline(filein, getId, DEliM) && getline(filein, getScore, DEliM)) { i++; //统计学生数目 } filein.close(); return i; }
[ "jbji@foxmail.com" ]
jbji@foxmail.com
2a4a98c6d2a9112b85334e2584862ab048eee7d5
2b6cb51c20ce7930af6cbbfa718c13d33491e814
/main.cpp
a7d39981af7a3a3d9f53f420abdaaa3ce7d19d70
[]
no_license
b0w1d/Othello
658be19e2df7f2ee83c79573f9640d88953f56f1
4ce69284759d010342fc623cb6d8262c8abe993f
refs/heads/master
2021-09-02T00:15:11.207447
2017-12-29T10:37:07
2017-12-29T10:37:07
115,713,734
0
0
null
null
null
null
UTF-8
C++
false
false
8,851
cpp
#define CONCAT(func, name) func##name #define HAND(name) CONCAT(I2P_, name) #define FIRST RANDOM // computer #define SECOND 106000135 // change to your student ID (ex: 105062999) #define _CRT_SECURE_NO_WARNINGS #ifndef FIRST #error you have to specify macro FIRST #endif #ifndef SECOND #error you have to specify macro SECOND #endif #include <cstdlib> #include <ctime> #include <fstream> #include <iostream> #include <string> #include <vector> using namespace std; const int N = 10; extern pair<int, int> HAND(FIRST)(int Board[][N], int player, vector<pair<int, int>> ValidPoint); extern pair<int, int> HAND(SECOND)(int Board[][N], int player, vector<pair<int, int>> ValidPoint); void InitialBoard(int a[N][N]) { for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) a[i][j] = 0; a[4][4] = 2; a[5][5] = 2; a[4][5] = 1; a[5][4] = 1; for (int j = 0; j < N; j++) a[0][j] = -1; for (int j = 0; j < N; j++) a[N - 1][j] = -1; for (int i = 0; i < N; i++) a[i][0] = -1; for (int i = 0; i < N; i++) a[i][N - 1] = -1; } void BoardShow(int Board[N][N]) { cout << " |-+-+-+-+-+-+-+-|\n"; for (int i = 1; i < N - 1; i++) { cout << " "; cout << i; cout << "|"; for (int j = 1; j < N; j++) { if (Board[j][i] == 1) cout << "x" << "|"; else if (Board[j][i] == 2) cout << "o" << "|"; else if (Board[j][i] == 0) cout << " " << "|"; } cout << "\n"; if (i != N - 2) cout << " |-+-+-+-+-+-+-+-|\n"; } cout << " |-+-+-+-+-+-+-+-|\n"; cout << " 1 2 3 4 5 6 7 8\n"; cout << endl; } // player=1: black number // player=2: white number // valid: return whether the chess can be put at this place or not bool PointValid(int board[N][N], // board 10*10 int player, pair<int, int> point) { int opponent = 3 - player; vector<pair<int, int>> mydirection; mydirection = {{-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}}; for (int i = 0; i < 8; i++) { bool lock = false; int px = point.first; int py = point.second; for (;;) { px = px + mydirection[i].first; py = py + mydirection[i].second; if (board[px][py] == -1) break; else if (board[px][py] == 0) break; else if (board[px][py] == opponent) { lock = true; continue; } else if (board[px][py] == player) { if (lock == true) return true; else break; } } } return false; } vector<pair<int, int>> BoardPointValid(int board[N][N], int player) { vector<pair<int, int>> ans; for (int i = 1; i < N - 1; i++) { for (int j = 1; j < N - 1; j++) { pair<int, int> point(i, j); if (board[i][j] == 0) { if (PointValid(board, player, point) == true) { ans.push_back(point); } else { continue; } } } } return ans; } void BoardCopy(int boardA[N][N], int boardB[N][N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { boardA[i][j] = boardB[i][j]; } } } void show_ValidPoint(vector<pair<int, int>> ValidPoint) { cout << " Next point you can put: "; for (int i = 0; i < ValidPoint.size(); i++) { cout << "(" << ValidPoint[i].first << "," << ValidPoint[i].second << ")" << " "; } cout << endl; } bool PlayReversi(int MBoard[N][N], int player, pair<int, int> point, vector<pair<int, int>> ValidPoint) { bool ValidLock = false; for (int i = 0; i < ValidPoint.size(); i++) { if (point == ValidPoint[i]) ValidLock = true; else continue; } if (ValidLock == false) return false; // invalid int px = point.first; int py = point.second; MBoard[px][py] = player; int opponent = 3 - player; vector<pair<int, int>> mydirection = { pair<int, int>(-1, 1), pair<int, int>(0, 1), pair<int, int>(1, 1), pair<int, int>(1, 0), pair<int, int>(1, -1), pair<int, int>(0, -1), pair<int, int>(-1, -1), pair<int, int>(-1, 0), }; for (int i = 0; i < 8; i++) { bool lock = false; int px = point.first; int py = point.second; for (int in = 0;; in++) { px = px + mydirection[i].first; py = py + mydirection[i].second; if (MBoard[px][py] == -1) break; else if (MBoard[px][py] == 0) break; else if (MBoard[px][py] == opponent) { lock = true; continue; } else if (MBoard[px][py] == player) { if (lock == true) { int ppx = point.first; int ppy = point.second; for (int j = 0; j < in; j++) { ppx = ppx + mydirection[i].first; ppy = ppy + mydirection[i].second; MBoard[ppx][ppy] = player; } break; } else break; } } } return true; } int main() { if (freopen("Chess.txt", "w", stdout) == NULL) { cout << "fail to read file" << endl; return 1; } srand(time(NULL)); int MainBoard[N][N]; int ModeBlackWhite = 0; int GP0_win = 0; // computer win int GP1_win = 0; // student win int tie = 0; ModeBlackWhite = rand() % 2; // random first // if(ModeBlackWhite==0){ // cout << "GP1 First" << endl; // } // else{ // cout << "GP0 First" << endl; // } for (int game = 0; game < 3; ++game) { InitialBoard(MainBoard); cout << "GAME: " << game << endl; if (ModeBlackWhite == 0) cout << "Student: x" << endl << "Computer: o" << endl; else cout << "Student: o" << endl << "Computer: x" << endl; for (int i = 1, k = 0; k < 2; i = i % 2 + 1) { // cout << "i = " << i << ", mode = " << ModeBlackWhite << endl; int CounterpartBoard[N][N]; BoardCopy(CounterpartBoard, MainBoard); BoardShow(MainBoard); vector<pair<int, int>> ValidPoint; ValidPoint = BoardPointValid(CounterpartBoard, i); if (i == 1) cout << " (x black)" << endl; else if (i == 2) cout << " (o white)" << endl; show_ValidPoint(ValidPoint); if (ValidPoint.size() == 0) { k++; } else { k = 0; pair<int, int> point; // if(ModeBlackWhite==0) // { // if(i==1) // point=HAND(SECOND)(CounterpartBoard,i,ValidPoint); // else // point=HAND(FIRST)(CounterpartBoard,3-i,ValidPoint); // } // else // { // if(i==1) // point=HAND(FIRST)(CounterpartBoard,3-i,ValidPoint); // else // point=HAND(SECOND)(CounterpartBoard,i,ValidPoint); // } if ((ModeBlackWhite + i) != 2) { cout << " (Student): "; point = HAND(SECOND)(CounterpartBoard, i, ValidPoint); } else { cout << " (Computer): "; point = HAND(FIRST)(CounterpartBoard, i, ValidPoint); } bool boolplay = PlayReversi(MainBoard, i, point, ValidPoint); int px = point.first; int py = point.second; if (i == 1) cout << " x"; else cout << " o"; cout << "(" << px << "," << py << ")"; if (boolplay == false) { cout << " Error!"; break; } } cout << endl; } int black_num = 0; int white_num = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (MainBoard[i][j] == 1) black_num++; if (MainBoard[i][j] == 2) white_num++; } } if (ModeBlackWhite == 0) { if (black_num > white_num) GP1_win++; else if (black_num < white_num) GP0_win++; else tie++; } else { if (black_num > white_num) GP0_win++; else if (black_num < white_num) GP1_win++; else tie++; } cout << "black num: " << black_num << " white num: " << white_num << endl; // if(black_num > white_num) // cout << "1" << endl; // else if(black_num < white_num) // cout << "0" << endl; // else // cout << "2" << endl; // system("pause"); ModeBlackWhite = !ModeBlackWhite; } if (GP1_win > GP0_win) { cout << "Student Win" << endl; // cout<<"1"<<endl; } else if (GP1_win < GP0_win) { cout << "Computer Win" << endl; // cout<<"0"<<endl; } else { cout << "Tie" << endl; // cout<<"2"<<endl; } return 0; }
[ "61a5t0@gmail.com" ]
61a5t0@gmail.com
799dbeda52c6c164cd422f53023ec403dfa1db79
47ebf27cd965269321b5d07beea10aec6da494d9
/Tests/DerivativeUnitTests/DerivativeUnitTests.cpp
039692ba38d5ec8a9b62796184eb8e91ee8444a9
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
JamieBamber/GRChombo
9220fa67eeaa97eee17bc3c0a8ad17bfd3d02d0e
4399e51f71618754282049d6f2946b69ad2c12ee
refs/heads/master
2022-03-21T18:49:41.668222
2020-11-24T23:21:14
2020-11-24T23:21:14
201,951,780
0
0
BSD-3-Clause
2020-03-11T10:19:26
2019-08-12T14:55:47
C++
UTF-8
C++
false
false
2,985
cpp
/* GRChombo * Copyright 2012 The GRChombo collaboration. * Please refer to LICENSE in GRChombo's root directory. */ #include "FArrayBox.H" #include <iostream> #include "BoxIterator.H" #include "BoxLoops.hpp" #include "DerivativeTestsCompute.hpp" #include "UserVariables.hpp" bool is_wrong(double value, double correct_value, std::string deriv_type) { if (abs(value - correct_value) > 1e-10) { std::cout.precision(17); std::cout << "Test of " << deriv_type << " failed " << " with value " << value << " instad of " << correct_value << ".\n"; return true; } else { return false; } } int main() { const int num_cells = 512; // box is flat in y direction to make test cheaper IntVect domain_hi_vect(num_cells - 1, 0, num_cells - 1); Box box(IntVect(0, 0, 0), domain_hi_vect); Box ghosted_box(IntVect(-3, -3, -3), IntVect(num_cells + 2, 3, num_cells + 2)); FArrayBox in_fab(ghosted_box, NUM_VARS); FArrayBox out_fab(box, NUM_VARS); const double dx = 1.0 / num_cells; BoxIterator bit_ghost(ghosted_box); for (bit_ghost.begin(); bit_ghost.ok(); ++bit_ghost) { const double x = (0.5 + bit_ghost()[0]) * dx; const double z = (0.5 + bit_ghost()[2]) * dx; for (int i = 0; i < NUM_VARS; ++i) { in_fab(bit_ghost(), i) = x * z * (z - 1); } // The dissipation component is special: in_fab(bit_ghost(), c_diss) = (pow(z - 0.5, 6) - 0.015625) / 720. + (z - 1) * z * pow(x, 6) / 720.; } // Compute the derivatives for the timing comparison BoxLoops::loop(DerivativeTestsCompute(dx), in_fab, out_fab); BoxIterator bit(box); for (bit.begin(); bit.ok(); ++bit) { const double x = (0.5 + bit()[0]) * dx; const double z = (0.5 + bit()[2]) * dx; bool error = false; error |= is_wrong(out_fab(bit(), c_d1), 2 * x * (z - 0.5), "diff1"); error |= is_wrong(out_fab(bit(), c_d2), 2 * x, "diff2"); error |= is_wrong(out_fab(bit(), c_d2_mixed), 2 * (z - 0.5), "mixed diff2"); double correct_dissipation = (1. + z * (z - 1)) * pow(dx, 5) / 64; error |= is_wrong(out_fab(bit(), c_diss), correct_dissipation, "dissipation"); double correct_advec_down = -2 * z * (z - 1) - 3 * x * (2 * z - 1); error |= is_wrong(out_fab(bit(), c_advec_down), correct_advec_down, "advection down"); double correct_advec_up = 2 * z * (z - 1) + 3 * x * (2 * z - 1); error |= is_wrong(out_fab(bit(), c_advec_up), correct_advec_up, "advection up"); if (error) { std::cout << "Derivative unit tests NOT passed.\n"; return error; } } std::cout << "Derivative unit tests passed.\n"; return 0; }
[ "m.kunesch@damtp.cam.ac.uk" ]
m.kunesch@damtp.cam.ac.uk
8c294ea89f179a5bbf9cd7a8909d1db1615b196b
0d7bc7b0e4669c81745e81bc8e09a5af58306b43
/Prog6/prog6.cc
593653ec37468e233beaa897de0b23041d4a0e88
[]
no_license
EdVillagran/Data-Structure-and-Algorithms
eccbf3c0b38c23fab9d117e36bcaa9859e48634e
87bd1d65b3857823ddd6ad4db94c9b2b59ed23e3
refs/heads/master
2022-10-07T09:10:59.138341
2020-06-09T15:54:17
2020-06-09T15:54:17
264,243,846
0
0
null
null
null
null
UTF-8
C++
false
false
3,127
cc
#include <algorithm> #include <iomanip> #include <iostream> #include <math.h> #include <vector> using namespace std; #include "binTree.h" #define SEED 1 // seed for RNGs #define N1 100 // size of 1st vector container #define LOW1 -999 // low val for rand integer #define HIGH1 999 // high val for rand integer #define N2 50 // size of 2nd vector container #define LOW2 -99999 // low val for rand float #define HIGH2 99999 // high val for rand float #define PREC 2 // no of digits after dec pt #define LSIZE 12 // no of vals printed on line #define ITEM_W 7 // no of spaces for each item // prints single val template < class T > void print ( const T& ); // prints data vals in tree template < class T > void print_vals ( binTree < T >&, const string& ); // class to generate rand ints class RND1 { private: int low, high; public: RND1 ( const int& l = 0, const int& h = 1 ) : low ( l ), high ( h ) { } int operator ( ) ( ) const { return rand ( ) % ( high - low + 1 ) + low; } }; // class to generate rand floats class RND2 { private: int low, high, prec; public: RND2 ( const int& l = 0, const int& h = 1, const int& p = 0 ) : low ( l ), high ( h ), prec ( p ) { } float operator ( ) ( ) const { return ( static_cast < float > ( rand ( ) % ( high - low + 1 ) + low ) ) / pow ( 10, prec ); } }; // prints out val passed as argument template < class T > void print ( const T& x ) { static unsigned cnt = 0; cout << setw ( ITEM_W ) << x << ' '; cnt++; if ( cnt % LSIZE == 0 ) cout << endl; } // prints out height of bin tree and data val in each node in inorder template < class T > void print_vals ( binTree < T >& tree, const string& name ) { cout << name << ": "; // print name of tree // print height of tree cout << "height of tree = " << tree.height ( ) << endl << endl; // print data values of tree in inorder cout << "Data values in '" << name << "' inorder:\n\n"; tree.inorder ( print ); cout << endl; } // driver program: to test several member functions // of bin tree class int main ( ) { srand ( SEED ); // set seed for RNGs // create 1st vector and fill it with rand ints vector < int > A ( N1 ); generate ( A.begin ( ), A.end ( ), RND1 ( LOW1, HIGH1 ) ); // create bin tree with int vals in vector A, // and print all vals of tree binTree < int > first; for (unsigned i = 0; i < A.size ( ); i++) first.insert ( A [ i ] ); print_vals ( first, "first" ); cout << endl; // create 2nd vector and fill it with rand floats vector < float > B ( N2 ); generate ( B.begin ( ), B.end ( ), RND2 ( LOW2, HIGH2, PREC ) ); // create bin tree with float-pt vals in vector B, // and print all vals of tree binTree < float > second; for ( unsigned i = 0; i < B.size ( ); i++ ) second.insert ( B [ i ] ); print_vals ( second, "second" ); cout << endl; return 0; }
[ "noreply@github.com" ]
EdVillagran.noreply@github.com
565e606f3bd0668bfa08acf64d6731e1533db79e
948f4e13af6b3014582909cc6d762606f2a43365
/testcases/juliet_test_suite/testcases/CWE126_Buffer_Overread/s02/CWE126_Buffer_Overread__new_wchar_t_memcpy_14.cpp
1d253c5e6dc660f9961eca679e42efba6bc33d81
[]
no_license
junxzm1990/ASAN--
0056a341b8537142e10373c8417f27d7825ad89b
ca96e46422407a55bed4aa551a6ad28ec1eeef4e
refs/heads/master
2022-08-02T15:38:56.286555
2022-06-16T22:19:54
2022-06-16T22:19:54
408,238,453
74
13
null
2022-06-16T22:19:55
2021-09-19T21:14:59
null
UTF-8
C++
false
false
4,004
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__new_wchar_t_memcpy_14.cpp Label Definition File: CWE126_Buffer_Overread__new.label.xml Template File: sources-sink-14.tmpl.cpp */ /* * @description * CWE: 126 Buffer Over-read * BadSource: Use a small buffer * GoodSource: Use a large buffer * Sink: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 14 Control flow: if(globalFive==5) and if(globalFive!=5) * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE126_Buffer_Overread__new_wchar_t_memcpy_14 { #ifndef OMITBAD void bad() { wchar_t * data; data = NULL; if(globalFive==5) { /* FLAW: Use a small buffer */ data = new wchar_t[50]; wmemset(data, L'A', 50-1); /* fill with 'A's */ data[50-1] = L'\0'; /* null terminate */ } { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: using memcpy with the length of the dest where data * could be smaller than dest causing buffer overread */ memcpy(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; printWLine(dest); delete [] data; } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the globalFive==5 to globalFive!=5 */ static void goodG2B1() { wchar_t * data; data = NULL; if(globalFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a large buffer */ data = new wchar_t[100]; wmemset(data, L'A', 100-1); /* fill with 'A's */ data[100-1] = L'\0'; /* null terminate */ } { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: using memcpy with the length of the dest where data * could be smaller than dest causing buffer overread */ memcpy(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; printWLine(dest); delete [] data; } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { wchar_t * data; data = NULL; if(globalFive==5) { /* FIX: Use a large buffer */ data = new wchar_t[100]; wmemset(data, L'A', 100-1); /* fill with 'A's */ data[100-1] = L'\0'; /* null terminate */ } { wchar_t dest[100]; wmemset(dest, L'C', 100-1); dest[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: using memcpy with the length of the dest where data * could be smaller than dest causing buffer overread */ memcpy(dest, data, wcslen(dest)*sizeof(wchar_t)); dest[100-1] = L'\0'; printWLine(dest); delete [] data; } } void good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE126_Buffer_Overread__new_wchar_t_memcpy_14; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
[ "yzhang0701@gmail.com" ]
yzhang0701@gmail.com
4c7ae582c068af8cf298fad944644b1f101e0688
8f729ce5b7f0bb45f323b2625890dbb87d121c9d
/Segment.h
3c2fc8a4a0f8a55bbf52b598f445e385e775ecbc
[]
no_license
aitzaz960/Centipede-Game
a27765dbd5da0f0ea9044412d8df3fbea20fe5ba
10c2add82a6672b5bf55864dc9bdcf964ca06477
refs/heads/master
2023-01-08T22:20:36.424692
2020-11-13T04:13:13
2020-11-13T04:13:13
312,563,833
0
0
null
null
null
null
UTF-8
C++
false
false
288
h
#ifndef SEGMENT_H #define SEGMENT_H class Segment { private: protected: public: virtual void setCX(int i); virtual void setCY(int i); virtual int getCX() const; virtual int getCY() const; virtual bool isMagic() const; }; #endif
[ "i180589@nu.edu.pk" ]
i180589@nu.edu.pk
58ccd3d85cc3cf517e96550c2a826939d79c8f2d
bc99213a51be3b412ea475a672d0932b4800ce9e
/Test_Bot/src/Utilities/Math/InverseInterpolable.h
f74e477e852f6ec82e18e99a053b23c9c23f1fa6
[]
no_license
JakeAllison/RobotTestPC01
8e18e71121f3a58121000e879911e67081c25c92
85198561e1844410c4d110391d959baf03ba5984
refs/heads/master
2020-04-05T19:34:02.551026
2018-11-14T04:40:15
2018-11-14T04:40:15
157,140,476
0
0
null
null
null
null
UTF-8
C++
false
false
272
h
/** * \file InverseInterpolable * \brief Allows us to interpolate using a bound and query * \author FRC 2481 */ #pragma once template<class T> class InverseInterpolable { public: virtual double inverseInterpolate(const T &upper, const T &query) const = 0; };
[ "noreply@github.com" ]
JakeAllison.noreply@github.com
78bb9cd5dbd11b0db911bf332a02609f44d6611a
b389755eed095f67bac67bde8690adf0217d8470
/modules/core/engine/src/Logger/LoggerServiceInterface.cpp
10bf206362e0ac0c164316c66dffc84c09941d49
[ "JSON", "MIT", "BSD-3-Clause", "GPL-2.0-only", "Apache-2.0" ]
permissive
shoesel/aac-sdk
4fdbb85d4d51aaaad7adb5d7ae69dfd65559dbd6
8370f7c71c73dd1af53469dfa3de1eaf7aa2d347
refs/heads/master
2020-06-10T14:00:11.911393
2019-06-24T22:46:22
2019-06-24T23:04:52
193,653,787
1
0
Apache-2.0
2019-06-25T07:06:17
2019-06-25T07:06:17
null
UTF-8
C++
false
false
819
cpp
/* * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0/ * * or in the "license" file accompanying this file. This file 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. */ #include "AACE/Engine/Logger/LoggerServiceInterface.h" namespace aace { namespace engine { namespace logger { LoggerServiceInterface::~LoggerServiceInterface() { } } // aace::engine::logger } // aace::engine } // aace
[ "muni.sakkuru@gmail.com" ]
muni.sakkuru@gmail.com
91783e2e6126992b98bbe3ac2382e05b5323db92
fc08ff32c2a5bf83d92eb815aeb3f70ac527163a
/include/ShadowFrameBuffer.h
b3cd67ba73ef6c89ea09762a04fdc34c641ccb3d
[]
no_license
flyhex/SandboxOGL
a587dbb8b062ff97be05fbbf675aacdc951161ab
7edc8694e8af7710893266405cd9f77ddee71459
refs/heads/master
2021-06-22T00:38:02.702210
2017-08-01T05:09:06
2017-08-01T05:09:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
412
h
#pragma once namespace OGL { class TextureManager; class SMFrameBuffer { public: SMFrameBuffer(); SMFrameBuffer(TextureManager& tm, u32 size); ~SMFrameBuffer(); void Load(TextureManager& tm); void startFrame(); void bindForShadowPass(); u32 getFBO() const; u32 getSize() const; void setShadowMap(TextureManager& tm, u32 shadowMap); u32 m_size; u32 m_fbo; u32 m_shadowMap; }; }
[ "naitsidous.mehdi@gmail.com" ]
naitsidous.mehdi@gmail.com
0b78bde641b30a8e33324395aaa6630677993cae
60db84d8cb6a58bdb3fb8df8db954d9d66024137
/android-cpp-sdk/platforms/android-4/java/sql/Date.hpp
78accf359b3cf311f2ea7113bf983986e64f23b5
[ "BSL-1.0" ]
permissive
tpurtell/android-cpp-sdk
ba853335b3a5bd7e2b5c56dcb5a5be848da6550c
8313bb88332c5476645d5850fe5fdee8998c2415
refs/heads/master
2021-01-10T20:46:37.322718
2012-07-17T22:06:16
2012-07-17T22:06:16
37,555,992
5
4
null
null
null
null
UTF-8
C++
false
false
6,618
hpp
/*================================================================================ code generated by: java2cpp author: Zoran Angelov, mailto://baldzar@gmail.com class: java.sql.Date ================================================================================*/ #ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_JAVA_SQL_DATE_HPP_DECL #define J2CPP_JAVA_SQL_DATE_HPP_DECL namespace j2cpp { namespace java { namespace io { class Serializable; } } } namespace j2cpp { namespace java { namespace util { class Date; } } } namespace j2cpp { namespace java { namespace lang { class Comparable; } } } namespace j2cpp { namespace java { namespace lang { class Cloneable; } } } namespace j2cpp { namespace java { namespace lang { class String; } } } namespace j2cpp { namespace java { namespace lang { class Object; } } } #include <java/io/Serializable.hpp> #include <java/lang/Cloneable.hpp> #include <java/lang/Comparable.hpp> #include <java/lang/Object.hpp> #include <java/lang/String.hpp> #include <java/util/Date.hpp> namespace j2cpp { namespace java { namespace sql { class Date; class Date : public object<Date> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) J2CPP_DECLARE_METHOD(2) J2CPP_DECLARE_METHOD(3) J2CPP_DECLARE_METHOD(4) J2CPP_DECLARE_METHOD(5) J2CPP_DECLARE_METHOD(6) J2CPP_DECLARE_METHOD(7) J2CPP_DECLARE_METHOD(8) J2CPP_DECLARE_METHOD(9) J2CPP_DECLARE_METHOD(10) explicit Date(jobject jobj) : object<Date>(jobj) { } operator local_ref<java::io::Serializable>() const; operator local_ref<java::util::Date>() const; operator local_ref<java::lang::Comparable>() const; operator local_ref<java::lang::Cloneable>() const; operator local_ref<java::lang::Object>() const; Date(jint, jint, jint); Date(jlong); jint getHours(); jint getMinutes(); jint getSeconds(); void setHours(jint); void setMinutes(jint); void setSeconds(jint); void setTime(jlong); local_ref< java::lang::String > toString(); static local_ref< java::sql::Date > valueOf(local_ref< java::lang::String > const&); }; //class Date } //namespace sql } //namespace java } //namespace j2cpp #endif //J2CPP_JAVA_SQL_DATE_HPP_DECL #else //J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_JAVA_SQL_DATE_HPP_IMPL #define J2CPP_JAVA_SQL_DATE_HPP_IMPL namespace j2cpp { java::sql::Date::operator local_ref<java::io::Serializable>() const { return local_ref<java::io::Serializable>(get_jobject()); } java::sql::Date::operator local_ref<java::util::Date>() const { return local_ref<java::util::Date>(get_jobject()); } java::sql::Date::operator local_ref<java::lang::Comparable>() const { return local_ref<java::lang::Comparable>(get_jobject()); } java::sql::Date::operator local_ref<java::lang::Cloneable>() const { return local_ref<java::lang::Cloneable>(get_jobject()); } java::sql::Date::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } java::sql::Date::Date(jint a0, jint a1, jint a2) : object<java::sql::Date>( call_new_object< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(0), java::sql::Date::J2CPP_METHOD_SIGNATURE(0) >(a0, a1, a2) ) { } java::sql::Date::Date(jlong a0) : object<java::sql::Date>( call_new_object< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(1), java::sql::Date::J2CPP_METHOD_SIGNATURE(1) >(a0) ) { } jint java::sql::Date::getHours() { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(2), java::sql::Date::J2CPP_METHOD_SIGNATURE(2), jint >(get_jobject()); } jint java::sql::Date::getMinutes() { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(3), java::sql::Date::J2CPP_METHOD_SIGNATURE(3), jint >(get_jobject()); } jint java::sql::Date::getSeconds() { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(4), java::sql::Date::J2CPP_METHOD_SIGNATURE(4), jint >(get_jobject()); } void java::sql::Date::setHours(jint a0) { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(5), java::sql::Date::J2CPP_METHOD_SIGNATURE(5), void >(get_jobject(), a0); } void java::sql::Date::setMinutes(jint a0) { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(6), java::sql::Date::J2CPP_METHOD_SIGNATURE(6), void >(get_jobject(), a0); } void java::sql::Date::setSeconds(jint a0) { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(7), java::sql::Date::J2CPP_METHOD_SIGNATURE(7), void >(get_jobject(), a0); } void java::sql::Date::setTime(jlong a0) { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(8), java::sql::Date::J2CPP_METHOD_SIGNATURE(8), void >(get_jobject(), a0); } local_ref< java::lang::String > java::sql::Date::toString() { return call_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(9), java::sql::Date::J2CPP_METHOD_SIGNATURE(9), local_ref< java::lang::String > >(get_jobject()); } local_ref< java::sql::Date > java::sql::Date::valueOf(local_ref< java::lang::String > const &a0) { return call_static_method< java::sql::Date::J2CPP_CLASS_NAME, java::sql::Date::J2CPP_METHOD_NAME(10), java::sql::Date::J2CPP_METHOD_SIGNATURE(10), local_ref< java::sql::Date > >(a0); } J2CPP_DEFINE_CLASS(java::sql::Date,"java/sql/Date") J2CPP_DEFINE_METHOD(java::sql::Date,0,"<init>","(III)V") J2CPP_DEFINE_METHOD(java::sql::Date,1,"<init>","(J)V") J2CPP_DEFINE_METHOD(java::sql::Date,2,"getHours","()I") J2CPP_DEFINE_METHOD(java::sql::Date,3,"getMinutes","()I") J2CPP_DEFINE_METHOD(java::sql::Date,4,"getSeconds","()I") J2CPP_DEFINE_METHOD(java::sql::Date,5,"setHours","(I)V") J2CPP_DEFINE_METHOD(java::sql::Date,6,"setMinutes","(I)V") J2CPP_DEFINE_METHOD(java::sql::Date,7,"setSeconds","(I)V") J2CPP_DEFINE_METHOD(java::sql::Date,8,"setTime","(J)V") J2CPP_DEFINE_METHOD(java::sql::Date,9,"toString","()Ljava/lang/String;") J2CPP_DEFINE_METHOD(java::sql::Date,10,"valueOf","(Ljava/lang/String;)Ljava/sql/Date;") } //namespace j2cpp #endif //J2CPP_JAVA_SQL_DATE_HPP_IMPL #endif //J2CPP_INCLUDE_IMPLEMENTATION
[ "baldzar@gmail.com" ]
baldzar@gmail.com
00ba09a986451f21c92fec82846975d42699a666
b00c54389a95d81a22e361fa9f8bdf5a2edc93e3
/external/deqp/modules/egl/teglQueryContextTests.cpp
c6edb9d1ed1c2e0e20c4728f1de6f3995cbbaa03
[ "Apache-2.0" ]
permissive
mirek190/x86-android-5.0
9d1756fa7ff2f423887aa22694bd737eb634ef23
eb1029956682072bb7404192a80214189f0dc73b
refs/heads/master
2020-05-27T01:09:51.830208
2015-10-07T22:47:36
2015-10-07T22:47:36
41,942,802
15
20
null
2020-03-09T00:21:03
2015-09-05T00:11:19
null
UTF-8
C++
false
false
18,379
cpp
/*------------------------------------------------------------------------- * drawElements Quality Program EGL Module * --------------------------------------- * * Copyright 2014 The Android Open Source Project * * 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 * \brief Config query tests. *//*--------------------------------------------------------------------*/ #include "teglQueryContextTests.hpp" #include "teglSimpleConfigCase.hpp" #include "teglRenderCase.hpp" #include "egluCallLogWrapper.hpp" #include "egluStrUtil.hpp" #include "tcuCommandLine.hpp" #include "tcuTestLog.hpp" #include "tcuTestContext.hpp" #include "egluUtil.hpp" #include "egluNativeDisplay.hpp" #include "egluNativeWindow.hpp" #include "egluNativePixmap.hpp" #include "deUniquePtr.hpp" #include <vector> #include <EGL/eglext.h> #if !defined(EGL_OPENGL_ES3_BIT_KHR) # define EGL_OPENGL_ES3_BIT_KHR 0x0040 #endif #if !defined(EGL_CONTEXT_MAJOR_VERSION_KHR) # define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION #endif namespace deqp { namespace egl { using eglu::ConfigInfo; using tcu::TestLog; struct ContextCaseInfo { EGLint surfaceType; EGLint clientType; EGLint clientVersion; }; class ContextCase : public SimpleConfigCase, protected eglu::CallLogWrapper { public: ContextCase (EglTestContext& eglTestCtx, const char* name, const char* description, const std::vector<EGLint>& configIds, EGLint surfaceTypeMask); virtual ~ContextCase (void); void executeForConfig (tcu::egl::Display& display, EGLConfig config); void executeForSurface (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, ContextCaseInfo& info); virtual void executeForContext (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, EGLContext context, ContextCaseInfo& info) = 0; private: EGLint m_surfaceTypeMask; }; ContextCase::ContextCase (EglTestContext& eglTestCtx, const char* name, const char* description, const std::vector<EGLint>& configIds, EGLint surfaceTypeMask) : SimpleConfigCase (eglTestCtx, name, description, configIds) , CallLogWrapper (eglTestCtx.getTestContext().getLog()) , m_surfaceTypeMask (surfaceTypeMask) { } ContextCase::~ContextCase (void) { } void ContextCase::executeForConfig (tcu::egl::Display& display, EGLConfig config) { tcu::TestLog& log = m_testCtx.getLog(); const int width = 64; const int height = 64; const EGLint configId = display.getConfigAttrib(config, EGL_CONFIG_ID); eglu::NativeDisplay& nativeDisplay = m_eglTestCtx.getNativeDisplay(); bool isOk = true; std::string failReason = ""; if (m_surfaceTypeMask & EGL_WINDOW_BIT) { log << TestLog::Message << "Creating window surface with config ID " << configId << TestLog::EndMessage; try { de::UniquePtr<eglu::NativeWindow> window (m_eglTestCtx.createNativeWindow(display.getEGLDisplay(), config, DE_NULL, width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))); tcu::egl::WindowSurface surface (display, eglu::createWindowSurface(nativeDisplay, *window, display.getEGLDisplay(), config, DE_NULL)); ContextCaseInfo info; info.surfaceType = EGL_WINDOW_BIT; executeForSurface(m_eglTestCtx.getDisplay(), config, surface.getEGLSurface(), info); } catch (const tcu::TestError& e) { log << e; isOk = false; failReason = e.what(); } log << TestLog::Message << TestLog::EndMessage; } if (m_surfaceTypeMask & EGL_PIXMAP_BIT) { log << TestLog::Message << "Creating pixmap surface with config ID " << configId << TestLog::EndMessage; try { de::UniquePtr<eglu::NativePixmap> pixmap (m_eglTestCtx.createNativePixmap(display.getEGLDisplay(), config, DE_NULL, width, height)); tcu::egl::PixmapSurface surface (display, eglu::createPixmapSurface(nativeDisplay, *pixmap, display.getEGLDisplay(), config, DE_NULL)); ContextCaseInfo info; info.surfaceType = EGL_PIXMAP_BIT; executeForSurface(display, config, surface.getEGLSurface(), info); } catch (const tcu::TestError& e) { log << e; isOk = false; failReason = e.what(); } log << TestLog::Message << TestLog::EndMessage; } if (m_surfaceTypeMask & EGL_PBUFFER_BIT) { log << TestLog::Message << "Creating pbuffer surface with config ID " << configId << TestLog::EndMessage; try { const EGLint surfaceAttribs[] = { EGL_WIDTH, width, EGL_HEIGHT, height, EGL_NONE }; tcu::egl::PbufferSurface surface(display, config, surfaceAttribs); ContextCaseInfo info; info.surfaceType = EGL_PBUFFER_BIT; executeForSurface(display, config, surface.getEGLSurface(), info); } catch (const tcu::TestError& e) { log << e; isOk = false; failReason = e.what(); } log << TestLog::Message << TestLog::EndMessage; } if (!isOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS) m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, failReason.c_str()); } void ContextCase::executeForSurface (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, ContextCaseInfo& info) { TestLog& log = m_testCtx.getLog(); EGLint apiBits = display.getConfigAttrib(config, EGL_RENDERABLE_TYPE); static const EGLint es1Attrs[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE }; static const EGLint es2Attrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; static const EGLint es3Attrs[] = { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_NONE }; static const struct { const char* name; EGLenum api; EGLint apiBit; const EGLint* ctxAttrs; EGLint apiVersion; } apis[] = { { "OpenGL", EGL_OPENGL_API, EGL_OPENGL_BIT, DE_NULL, 0 }, { "OpenGL ES 1", EGL_OPENGL_ES_API, EGL_OPENGL_ES_BIT, es1Attrs, 1 }, { "OpenGL ES 2", EGL_OPENGL_ES_API, EGL_OPENGL_ES2_BIT, es2Attrs, 2 }, { "OpenGL ES 3", EGL_OPENGL_ES_API, EGL_OPENGL_ES3_BIT_KHR, es3Attrs, 3 }, { "OpenVG", EGL_OPENVG_API, EGL_OPENVG_BIT, DE_NULL, 0 } }; for (int apiNdx = 0; apiNdx < (int)DE_LENGTH_OF_ARRAY(apis); apiNdx++) { if ((apiBits & apis[apiNdx].apiBit) == 0) continue; // Not supported API TCU_CHECK_EGL_CALL(eglBindAPI(apis[apiNdx].api)); log << TestLog::Message << "Creating " << apis[apiNdx].name << " context" << TestLog::EndMessage; const EGLContext context = eglCreateContext(display.getEGLDisplay(), config, EGL_NO_CONTEXT, apis[apiNdx].ctxAttrs); TCU_CHECK_EGL(); TCU_CHECK(context != EGL_NO_CONTEXT); TCU_CHECK_EGL_CALL(eglMakeCurrent(display.getEGLDisplay(), surface, surface, context)); info.clientType = apis[apiNdx].api; info.clientVersion = apis[apiNdx].apiVersion; executeForContext(display, config, surface, context, info); // Destroy TCU_CHECK_EGL_CALL(eglMakeCurrent(display.getEGLDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); TCU_CHECK_EGL_CALL(eglDestroyContext(display.getEGLDisplay(), context)); } } class GetCurrentContextCase : public ContextCase { public: GetCurrentContextCase (EglTestContext& eglTestCtx, const char* name, const char* description, const std::vector<EGLint>& configIds, EGLint surfaceTypeMask) : ContextCase(eglTestCtx, name, description, configIds, surfaceTypeMask) { } void executeForContext (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, EGLContext context, ContextCaseInfo& info) { TestLog& log = m_testCtx.getLog(); DE_UNREF(display); DE_UNREF(config && surface); DE_UNREF(info); enableLogging(true); const EGLContext gotContext = eglGetCurrentContext(); TCU_CHECK_EGL(); if (gotContext == context) { log << TestLog::Message << " Pass" << TestLog::EndMessage; } else if (gotContext == EGL_NO_CONTEXT) { log << TestLog::Message << " Fail, got EGL_NO_CONTEXT" << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Unexpected EGL_NO_CONTEXT"); } else if (gotContext != context) { log << TestLog::Message << " Fail, call returned the wrong context. Expected: " << tcu::toHex(context) << ", got: " << tcu::toHex(gotContext) << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid context"); } enableLogging(false); } }; class GetCurrentSurfaceCase : public ContextCase { public: GetCurrentSurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, const std::vector<EGLint>& configIds, EGLint surfaceTypeMask) : ContextCase(eglTestCtx, name, description, configIds, surfaceTypeMask) { } void executeForContext (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, EGLContext context, ContextCaseInfo& info) { TestLog& log = m_testCtx.getLog(); DE_UNREF(display); DE_UNREF(config && context); DE_UNREF(info); enableLogging(true); const EGLContext gotReadSurface = eglGetCurrentSurface(EGL_READ); TCU_CHECK_EGL(); const EGLContext gotDrawSurface = eglGetCurrentSurface(EGL_DRAW); TCU_CHECK_EGL(); if (gotReadSurface == surface && gotDrawSurface == surface) { log << TestLog::Message << " Pass" << TestLog::EndMessage; } else { log << TestLog::Message << " Fail, read surface: " << tcu::toHex(gotReadSurface) << ", draw surface: " << tcu::toHex(gotDrawSurface) << ", expected: " << tcu::toHex(surface) << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid surface"); } enableLogging(false); } }; class GetCurrentDisplayCase : public ContextCase { public: GetCurrentDisplayCase (EglTestContext& eglTestCtx, const char* name, const char* description, const std::vector<EGLint>& configIds, EGLint surfaceTypeMask) : ContextCase(eglTestCtx, name, description, configIds, surfaceTypeMask) { } void executeForContext (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, EGLContext context, ContextCaseInfo& info) { TestLog& log = m_testCtx.getLog(); DE_UNREF(config && surface && context); DE_UNREF(info); enableLogging(true); const EGLDisplay gotDisplay = eglGetCurrentDisplay(); TCU_CHECK_EGL(); if (gotDisplay == display.getEGLDisplay()) { log << TestLog::Message << " Pass" << TestLog::EndMessage; } else if (gotDisplay == EGL_NO_DISPLAY) { log << TestLog::Message << " Fail, got EGL_NO_DISPLAY" << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Unexpected EGL_NO_DISPLAY"); } else if (gotDisplay != display.getEGLDisplay()) { log << TestLog::Message << " Fail, call returned the wrong display. Expected: " << tcu::toHex(display.getEGLDisplay()) << ", got: " << tcu::toHex(gotDisplay) << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid display"); } enableLogging(false); } }; class QueryContextCase : public ContextCase { public: QueryContextCase (EglTestContext& eglTestCtx, const char* name, const char* description, const std::vector<EGLint>& configIds, EGLint surfaceTypeMask) : ContextCase(eglTestCtx, name, description, configIds, surfaceTypeMask) { } EGLint getContextAttrib (tcu::egl::Display& display, EGLContext context, EGLint attrib) { EGLint value; TCU_CHECK_EGL_CALL(eglQueryContext(display.getEGLDisplay(), context, attrib, &value)); return value; } void executeForContext (tcu::egl::Display& display, EGLConfig config, EGLSurface surface, EGLContext context, ContextCaseInfo& info) { TestLog& log = m_testCtx.getLog(); const eglu::Version version (display.getEGLMajorVersion(), display.getEGLMinorVersion()); DE_UNREF(surface); enableLogging(true); // Config ID { const EGLint configID = getContextAttrib(display, context, EGL_CONFIG_ID); const EGLint surfaceConfigID = display.getConfigAttrib(config, EGL_CONFIG_ID); if (configID != surfaceConfigID) { log << TestLog::Message << " Fail, config ID doesn't match the one used to create the context." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid config ID"); } } // Client API type if (version >= eglu::Version(1, 2)) { const EGLint clientType = getContextAttrib(display, context, EGL_CONTEXT_CLIENT_TYPE); if (clientType != info.clientType) { log << TestLog::Message << " Fail, client API type doesn't match." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid client API type"); } } // Client API version if (version >= eglu::Version(1, 3)) { const EGLint clientVersion = getContextAttrib(display, context, EGL_CONTEXT_CLIENT_VERSION); if (info.clientType == EGL_OPENGL_ES_API && clientVersion != info.clientVersion) { log << TestLog::Message << " Fail, client API version doesn't match." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid client API version"); } } // Render buffer if (version >= eglu::Version(1, 2)) { const EGLint renderBuffer = getContextAttrib(display, context, EGL_RENDER_BUFFER); if (info.surfaceType == EGL_PIXMAP_BIT && renderBuffer != EGL_SINGLE_BUFFER) { log << TestLog::Message << " Fail, render buffer should be EGL_SINGLE_BUFFER for a pixmap surface." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid render buffer"); } else if (info.surfaceType == EGL_PBUFFER_BIT && renderBuffer != EGL_BACK_BUFFER) { log << TestLog::Message << " Fail, render buffer should be EGL_BACK_BUFFER for a pbuffer surface." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid render buffer"); } else if (info.surfaceType == EGL_WINDOW_BIT && renderBuffer != EGL_SINGLE_BUFFER && renderBuffer != EGL_BACK_BUFFER) { log << TestLog::Message << " Fail, render buffer should be either EGL_SINGLE_BUFFER or EGL_BACK_BUFFER for a window surface." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid render buffer"); } } enableLogging(false); log << TestLog::Message << " Pass" << TestLog::EndMessage; } }; class QueryAPICase : public TestCase, protected eglu::CallLogWrapper { public: QueryAPICase (EglTestContext& eglTestCtx, const char* name, const char* description) : TestCase(eglTestCtx, name, description) , CallLogWrapper(eglTestCtx.getTestContext().getLog()) { } void init (void) { m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); } IterateResult iterate (void) { tcu::TestLog& log = m_testCtx.getLog(); const EGLenum apis[] = { EGL_OPENGL_API, EGL_OPENGL_ES_API, EGL_OPENVG_API }; enableLogging(true); { const EGLenum api = eglQueryAPI(); if (api != EGL_OPENGL_ES_API && m_eglTestCtx.isAPISupported(EGL_OPENGL_ES_API)) { log << TestLog::Message << " Fail, initial value should be EGL_OPENGL_ES_API if OpenGL ES is supported." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default value"); } else if(api != EGL_NONE && !m_eglTestCtx.isAPISupported(EGL_OPENGL_ES_API)) { log << TestLog::Message << " Fail, initial value should be EGL_NONE if OpenGL ES is not supported." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default value"); } } for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(apis); ndx++) { const EGLenum api = apis[ndx]; log << TestLog::Message << TestLog::EndMessage; if (m_eglTestCtx.isAPISupported(api)) { eglBindAPI(api); if (api != eglQueryAPI()) { log << TestLog::Message << " Fail, return value does not match previously bound API." << TestLog::EndMessage; m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid return value"); } } else { log << TestLog::Message << eglu::getAPIStr(api) << " not supported." << TestLog::EndMessage; } } enableLogging(false); return STOP; } }; QueryContextTests::QueryContextTests (EglTestContext& eglTestCtx) : TestCaseGroup(eglTestCtx, "query_context", "Rendering context query tests") { } QueryContextTests::~QueryContextTests (void) { } template<class QueryContextClass> void createQueryContextGroups (EglTestContext& eglTestCtx, tcu::TestCaseGroup* group) { std::vector<RenderConfigIdSet> configSets; eglu::FilterList filters; getDefaultRenderConfigIdSets(configSets, eglTestCtx.getConfigs(), filters); for (std::vector<RenderConfigIdSet>::const_iterator setIter = configSets.begin(); setIter != configSets.end(); setIter++) group->addChild(new QueryContextClass(eglTestCtx, setIter->getName(), "", setIter->getConfigIds(), setIter->getSurfaceTypeMask())); } void QueryContextTests::init (void) { { tcu::TestCaseGroup* simpleGroup = new tcu::TestCaseGroup(m_testCtx, "simple", "Simple API tests"); addChild(simpleGroup); simpleGroup->addChild(new QueryAPICase(m_eglTestCtx, "query_api", "eglQueryAPI() test")); } // eglGetCurrentContext { tcu::TestCaseGroup* getCurrentContextGroup = new tcu::TestCaseGroup(m_testCtx, "get_current_context", "eglGetCurrentContext() tests"); addChild(getCurrentContextGroup); createQueryContextGroups<GetCurrentContextCase>(m_eglTestCtx, getCurrentContextGroup); } // eglGetCurrentSurface { tcu::TestCaseGroup* getCurrentSurfaceGroup = new tcu::TestCaseGroup(m_testCtx, "get_current_surface", "eglGetCurrentSurface() tests"); addChild(getCurrentSurfaceGroup); createQueryContextGroups<GetCurrentSurfaceCase>(m_eglTestCtx, getCurrentSurfaceGroup); } // eglGetCurrentDisplay { tcu::TestCaseGroup* getCurrentDisplayGroup = new tcu::TestCaseGroup(m_testCtx, "get_current_display", "eglGetCurrentDisplay() tests"); addChild(getCurrentDisplayGroup); createQueryContextGroups<GetCurrentDisplayCase>(m_eglTestCtx, getCurrentDisplayGroup); } // eglQueryContext { tcu::TestCaseGroup* queryContextGroup = new tcu::TestCaseGroup(m_testCtx, "query_context", "eglQueryContext() tests"); addChild(queryContextGroup); createQueryContextGroups<QueryContextCase>(m_eglTestCtx, queryContextGroup); } } } // egl } // deqp
[ "mirek190@gmail.com" ]
mirek190@gmail.com
bf403d235a36de8087397b60ed2186a1da0ff548
95bde36b21aef0f2b4053e6c8aadbf01ac958b04
/page2.h
be6bb3f96eea5585d1e37b1b705dc952c76e7444
[]
no_license
bjk12/Engineering-Assistant
c33c3c48c0cd683ed023a0bad9fdc8fca10b7eda
a7c321a8c1c1ce6a541ba56f995a28487e1b8593
refs/heads/main
2023-04-08T11:33:41.394727
2021-04-22T09:35:16
2021-04-22T09:35:16
357,164,738
1
0
null
null
null
null
UTF-8
C++
false
false
611
h
#ifndef PAGE2_H #define PAGE2_H #include <QDialog> namespace Ui { class page2; } class page2 : public QDialog { Q_OBJECT public: explicit page2(QWidget *parent = 0); ~page2(); private slots: void on_backButton_clicked(); void on_timeout () ; //定时溢出处理槽函数 void on_startButton_clicked(); void on_suspendButton_clicked(); void on_calculate51Button_clicked(); void on_changetButton_clicked(); private: Ui::page2 *ui; void reject(); QTimer* Timer1; signals: void back2page1(); }; #endif // PAGE2_H
[ "1838336514@qq.com" ]
1838336514@qq.com
b6daaa546edb8da66ff5de7f02a232f83054a98a
3626089e86884038dc59104aa6fb1c5a7f6ba88a
/spf/bk2_spf.cpp
572da4976c69676e0674d88a3d33159d70dedf50
[]
no_license
costain/parallel
93568b9429a3d44c3d16e5247e75557e1a3f138d
a658b88de236a160427aff41b97bacb84dc60963
refs/heads/master
2020-09-02T13:44:40.315416
2019-11-27T00:10:19
2019-11-27T00:10:19
219,234,447
0
0
null
null
null
null
UTF-8
C++
false
false
3,210
cpp
#include <iostream> #include <mpi.h> #include <string.h> //using namespace std; #include <stdio.h> #include <stdlib.h> const int SIZE = 6; //maximum size of the graph char G[SIZE][SIZE]; //adjacency matrix bool OK[SIZE]; //nodes done int D[SIZE]; //distance int path[SIZE]; //we came to this node from const int INFINITY=9999; //big enough number, bigger than any possible path #define buffer_size 2024 const char *filename = "edge.txt"; int nproc, id; MPI_Status status; int N; int Read_G_Adjacency_Matrix(){ //actual G[][] adjacency matrix read in int u,v = 0; for ( u = 0; u < SIZE; u++){ for(int v = 0; v < SIZE; v++){ if( u==v){ G[u][v]=0; } else { G[u][v] = 'i'; } } } char nodeU = 'a'; char nodeV= 'a' ; char nodeZ ='a'; const char *delimiter_characters = " "; FILE *input_file = fopen( filename, "r" ); char buffer[ buffer_size ]; char *last_token; int nodes = SIZE; if( input_file == NULL ){ fprintf( stderr, "Unable to open file %s\n", filename ); }else { while (fgets(buffer, buffer_size, input_file) != NULL) { last_token = strtok(buffer, delimiter_characters); while (last_token != NULL) { nodeU = last_token[0]; nodeV = strtok(NULL, delimiter_characters)[0]; nodeZ = strtok(NULL, delimiter_characters)[0]; G[nodeU][nodeV] = nodeZ; printf("Adding: (%d,%d, %d)\n", nodeU, nodeV,nodeZ); last_token = strtok(NULL, delimiter_characters); } } if (ferror(input_file)) { perror("The following error occurred"); } fclose(input_file); return 0; } } void dijk(int s){ int i,j; int tmp, x; int pair[2]; int tmp_pair[2]; for(i=id;i<N;i+=nproc){ D[i]=G[s][i]; OK[i]=false; path[i]=s; } OK[s]=true; path[s]=-1; for(j=1;j<N;j++){ tmp=INFINITY; for(i=id;i<N;i+=nproc){ if(!OK[i] && D[i]<tmp){ x=i; tmp=D[i]; } } pair[0]=x; pair[1]=tmp; if(id!=0){ //Slave MPI_Send(pair,2,MPI_INT,0,1,MPI_COMM_WORLD); }else{ // id==0, Master for(i=1;i<nproc;++i){ MPI_Recv(tmp_pair,2,MPI_INT,i,1,MPI_COMM_WORLD, &status); if(tmp_pair[1]<pair[1]){ pair[0]=tmp_pair[0]; pair[1]=tmp_pair[1]; } } } MPI_Bcast(pair,2,MPI_INT,0,MPI_COMM_WORLD); x=pair[0]; D[x]=pair[1]; OK[x]=true; for(i=id;i<N;i+=nproc){ if(!OK[i] && D[i]>D[x]+G[x][i]){ D[i]=D[x]+G[x][i]; path[i]=x; } } } } main(int argc, char** argv){ double t1, t2; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &nproc); // get totalnodes MPI_Comm_rank(MPI_COMM_WORLD, &id); // get mynode N=Read_G_Adjacency_Matrix(); //read in the G[][] //set actual size printf("We are here"); if(id==0){ t1=MPI_Wtime(); } dijk(200); //call the algorithm with the choosen node if(id==0){ t2=MPI_Wtime(); //check the results with some output from G[][] and D[] printf("time elapsed:%d ",(t2-t1)); } MPI_Finalize(); }
[ "costain01@gmail.com" ]
costain01@gmail.com
c2b1e1ef5841c6d986df8a77d4cd8bd732d63536
84934b30b21e5f074e3c6d37821cf581da7d9784
/HPSS/Method2/hpss.h
7826ef4da61945ae111b806e6c0a1c8f356382ee
[]
no_license
vinson0526/Master_Graduate_Thesis
41645359a0130b200d2bcf92ec7c900fae1f0f9d
2d53d401722931e6c6e02a32466c65fde5f1ea10
refs/heads/master
2016-09-05T22:50:25.722218
2014-04-25T14:22:42
2014-04-25T14:22:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
936
h
#ifndef HPSS_H #define HPSS_H #include <vector> #include <string> #include <cmath> #include <iomanip> #include <fstream> #include <iostream> using namespace std; class HPSS { public: HPSS(){}; HPSS(string fileNameCome, int frameSizeCome, int maxIterCome = 500, double gammaCome = 0.5, double sigmaHCome = 0.3, double sigmaPCome = 0.3); ~HPSS(); void computeHP(string HFileName, string PFileName); private: void method1(); void method2(); void initial(); void computeABC(); void computeM(); vector<vector<double>> W; vector<vector<double>> H; vector<vector<double>> P; vector<vector<double>> mH; vector<vector<double>> mP; double aH; double aP; vector<vector<double>> bH; vector<vector<double>> bP; vector<vector<double>> cH; vector<vector<double>> cP; double alpha; double gamma; double sigmaH2; double sigmaP2; double Q; string fileName; int frameSize; int frameNum; int maxIter; }; #endif
[ "vinson0526@gmail.com" ]
vinson0526@gmail.com
09f9561ebf16dcab03c0531db741da0116b03422
641ab842216b3c8bee128e23ff8020a25a50af53
/src/Menu.hpp
a0a624ea8f2472bccfb6daff4ca81bba4a428135
[ "MIT" ]
permissive
saugkim/aalto_cs1
9f25e1ebc720d1112b1161eafd0110aced6d198f
c2c3f2ff152959914d91376a2fc8668846bbac90
refs/heads/main
2023-01-23T09:13:20.000453
2020-11-25T14:13:14
2020-11-25T14:13:14
314,247,915
0
0
null
null
null
null
UTF-8
C++
false
false
184
hpp
#include <string> using namespace std; class Menu { public: Menu(char* text) { text_ = text; }; void Show(string& action, bool menuActive); private: char* text_; };
[ "ugkimm@naver.com" ]
ugkimm@naver.com
3c81fc9aca6fd63746864a8a913e152809ab9fce
30771c41966bbc4c0f2e6b80f73e0507e6dbf321
/temp/Stack/getMin.cpp
286d94f88323801166dac66f643288928bdd3878
[]
no_license
ShubhamS156/daaGFG
1dae47fb0847a0fdf490a33365d8bcb260a35428
959c8f8f4748d5a9433c15bfa68240e90fa70971
refs/heads/master
2022-12-03T02:42:53.798625
2020-08-18T13:09:27
2020-08-18T13:09:27
282,121,950
0
0
null
null
null
null
UTF-8
C++
false
false
474
cpp
#include<iostream> #include<stack> using namespace std; //implementing stack using supposedly linked list /* IDEA: maintain an stack while pushing that keeps track of the smallest element yet. */ stack<int> ms; //main stack stack<int> as; //auxilary stack's top contatins the minimum element yet int ModeifiedPush(int key){ ms.push(key); if(ms.top()<=as.top()) as.push(key); } int ModifiedPop(){ if(as.top()==ms.top()){ as.pop(); } ms.pop(); }
[ "sharmashubh428@gmail.com" ]
sharmashubh428@gmail.com
1bef7beeca64b058ed3488d3d065ea49677d81f0
33868f8d4a0b5795290c4f628108ff6b29e90716
/Client/Client.Core/Game/GameOverlay.h
b630b826ba0f427febd4995f03e7c4c86cd86aa3
[]
no_license
grasmanek94/v-plus-mod
cdc87c77bd703c4b846b48139746e52ec8b6de94
9c4127fdf6c227f1dd5fbc75d377d98306c03a76
refs/heads/master
2021-03-26T10:05:45.896887
2016-08-13T15:01:10
2016-08-13T15:01:10
63,270,812
0
0
null
null
null
null
UTF-8
C++
false
false
874
h
#pragma once class Vector2; class Vector3; class GameUI; typedef HRESULT (__stdcall *DXGISwapChainPresent) (IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags); typedef bool (__fastcall *EngineWorldToScreen_t)(Vector3 worldPos, float *pRelativeScreenPositionX, float *pRelativeScreenPositionY); class GameOverlay { private: static bool bInitialized; static GameUI *pGameUI; static DXGISwapChainPresent pRealPresent; static uintptr_t hkSwapChainVFTable[64]; static EngineWorldToScreen_t EngineWorldToScreen; static HRESULT __stdcall HookedPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); public: static bool IsInitialized() { return bInitialized; } static GameUI * GetGameUI() { return pGameUI; } static bool Setup(); static void Shutdown(); static bool WorldToScreen(const Vector3 &worldPosition, Vector2 &screenPosition); };
[ "p3ti@hotmail.hu" ]
p3ti@hotmail.hu
8fc2ceb1c7ed539051e8c79edd9ee9c677de972c
bbadb0f47158d4b85ae4b97694823c8aab93d50e
/apps/c/CloverLeaf_3D/Tiled/update_halo_kernel5_minus_2_back_seq_kernel.cpp
837c0638e1f2c0d160131927b9ae0f8687092b45
[]
no_license
yshoraka/OPS
197d8191dbedc625f3669b511a8b4eadf7a365c4
708c0c78157ef8c711fc6118e782f8e5339b9080
refs/heads/master
2020-12-24T12:39:49.585629
2016-11-02T09:50:54
2016-11-02T09:50:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,839
cpp
// // auto-generated by ops.py // #define OPS_ACC0(x, y, z) \ (n_x * 1 + n_y * xdim0_update_halo_kernel5_minus_2_back * 1 + \ n_z * xdim0_update_halo_kernel5_minus_2_back * \ ydim0_update_halo_kernel5_minus_2_back * 1 + \ x + xdim0_update_halo_kernel5_minus_2_back * (y) + \ xdim0_update_halo_kernel5_minus_2_back * \ ydim0_update_halo_kernel5_minus_2_back * (z)) #define OPS_ACC1(x, y, z) \ (n_x * 1 + n_y * xdim1_update_halo_kernel5_minus_2_back * 1 + \ n_z * xdim1_update_halo_kernel5_minus_2_back * \ ydim1_update_halo_kernel5_minus_2_back * 1 + \ x + xdim1_update_halo_kernel5_minus_2_back * (y) + \ xdim1_update_halo_kernel5_minus_2_back * \ ydim1_update_halo_kernel5_minus_2_back * (z)) // user function // host stub function void ops_par_loop_update_halo_kernel5_minus_2_back_execute( ops_kernel_descriptor *desc) { int dim = desc->dim; int *range = desc->range; ops_arg arg0 = desc->args[0]; ops_arg arg1 = desc->args[1]; ops_arg arg2 = desc->args[2]; // Timing double t1, t2, c1, c2; ops_arg args[3] = {arg0, arg1, arg2}; #ifdef CHECKPOINTING if (!ops_checkpointing_before(args, 3, range, 138)) return; #endif if (OPS_diags > 1) { ops_timing_realloc(138, "update_halo_kernel5_minus_2_back"); OPS_kernels[138].count++; ops_timers_core(&c2, &t2); } // compute locally allocated range for the sub-block int start[3]; int end[3]; for (int n = 0; n < 3; n++) { start[n] = range[2 * n]; end[n] = range[2 * n + 1]; } #ifdef OPS_DEBUG ops_register_args(args, "update_halo_kernel5_minus_2_back"); #endif // set up initial pointers and exchange halos if necessary int base0 = args[0].dat->base_offset; double *__restrict__ vol_flux_z = (double *)(args[0].data + base0); int base1 = args[1].dat->base_offset; double *__restrict__ mass_flux_z = (double *)(args[1].data + base1); const int *__restrict__ fields = (int *)args[2].data; // initialize global variable with the dimension of dats int xdim0_update_halo_kernel5_minus_2_back = args[0].dat->size[0]; int ydim0_update_halo_kernel5_minus_2_back = args[0].dat->size[1]; int xdim1_update_halo_kernel5_minus_2_back = args[1].dat->size[0]; int ydim1_update_halo_kernel5_minus_2_back = args[1].dat->size[1]; // Halo Exchanges ops_H_D_exchanges_host(args, 3); ops_halo_exchanges(args, 3, range); ops_H_D_exchanges_host(args, 3); if (OPS_diags > 1) { ops_timers_core(&c1, &t1); OPS_kernels[138].mpi_time += t1 - t2; } #pragma omp parallel for collapse(2) for (int n_z = start[2]; n_z < end[2]; n_z++) { for (int n_y = start[1]; n_y < end[1]; n_y++) { #ifdef intel #pragma omp simd #else #pragma simd #endif for (int n_x = start[0]; n_x < end[0]; n_x++) { if (fields[FIELD_VOL_FLUX_Z] == 1) vol_flux_z[OPS_ACC0(0, 0, 0)] = -vol_flux_z[OPS_ACC0(0, 0, 2)]; if (fields[FIELD_MASS_FLUX_Z] == 1) mass_flux_z[OPS_ACC1(0, 0, 0)] = -mass_flux_z[OPS_ACC1(0, 0, 2)]; } } } if (OPS_diags > 1) { ops_timers_core(&c2, &t2); OPS_kernels[138].time += t2 - t1; } ops_set_dirtybit_host(args, 3); ops_set_halo_dirtybit3(&args[0], range); ops_set_halo_dirtybit3(&args[1], range); if (OPS_diags > 1) { // Update kernel record ops_timers_core(&c1, &t1); OPS_kernels[138].mpi_time += t1 - t2; OPS_kernels[138].transfer += ops_compute_transfer(dim, start, end, &arg0); OPS_kernels[138].transfer += ops_compute_transfer(dim, start, end, &arg1); } } #undef OPS_ACC0 #undef OPS_ACC1 void ops_par_loop_update_halo_kernel5_minus_2_back(char const *name, ops_block block, int dim, int *range, ops_arg arg0, ops_arg arg1, ops_arg arg2) { ops_kernel_descriptor *desc = (ops_kernel_descriptor *)malloc(sizeof(ops_kernel_descriptor)); desc->name = name; desc->block = block; desc->dim = dim; desc->index = 138; #ifdef OPS_MPI sub_block_list sb = OPS_sub_block_list[block->index]; if (!sb->owned) return; for (int n = 0; n < 3; n++) { desc->range[2 * n] = sb->decomp_disp[n]; desc->range[2 * n + 1] = sb->decomp_disp[n] + sb->decomp_size[n]; if (desc->range[2 * n] >= range[2 * n]) { desc->range[2 * n] = 0; } else { desc->range[2 * n] = range[2 * n] - desc->range[2 * n]; } if (sb->id_m[n] == MPI_PROC_NULL && range[2 * n] < 0) desc->range[2 * n] = range[2 * n]; if (desc->range[2 * n + 1] >= range[2 * n + 1]) { desc->range[2 * n + 1] = range[2 * n + 1] - sb->decomp_disp[n]; } else { desc->range[2 * n + 1] = sb->decomp_size[n]; } if (sb->id_p[n] == MPI_PROC_NULL && (range[2 * n + 1] > sb->decomp_disp[n] + sb->decomp_size[n])) desc->range[2 * n + 1] += (range[2 * n + 1] - sb->decomp_disp[n] - sb->decomp_size[n]); } #else // OPS_MPI for (int i = 0; i < 6; i++) { desc->range[i] = range[i]; } #endif // OPS_MPI desc->nargs = 3; desc->args = (ops_arg *)malloc(3 * sizeof(ops_arg)); desc->args[0] = arg0; desc->args[1] = arg1; desc->args[2] = arg2; char *tmp = (char *)malloc(NUM_FIELDS * sizeof(int)); memcpy(tmp, arg2.data, NUM_FIELDS * sizeof(int)); desc->args[2].data = tmp; desc->function = ops_par_loop_update_halo_kernel5_minus_2_back_execute; ops_enqueue_kernel(desc); }
[ "mudalige@octon.arc.ox.ac.uk" ]
mudalige@octon.arc.ox.ac.uk
33b20ac0d49b77ca720e2ee36a7d1ca349115ee8
ab2b453904fc4467c608cb3229e843d2254e18f1
/simpleChuanQi/ChuanQiGuaJi/src/game/friend.cpp
d39f0a1fcf7f35ab302dbf247cefa4de53af541e
[]
no_license
Crasader/niuniu_master
ca7ca199f044c3857d8c612180d61012cb7abd24
38892075e247172e28aa2be552988b303a5d2105
refs/heads/master
2020-07-15T16:31:05.745413
2016-02-23T12:58:33
2016-02-23T12:58:33
null
0
0
null
null
null
null
GB18030
C++
false
false
6,372
cpp
#include "friend.h" #include "roleCtrl.h" #include <algorithm> FriendInfo::FriendInfo(ROLE * role) { memset(this, 0, sizeof(*this)); if (role == NULL) { return; } strncpy(this->szName, role->roleName.c_str(), sizeof(this->szName)); this->dwID = role->dwRoleID; this->bySex = role->bySex; this->byJob = role->byJob; this->dwFightValue = role->dwFightValue; this->wLevel = role->wLevel; } OneFriendInfo::OneFriendInfo(ROLE * role) { memset(this, 0, sizeof(*this)); if (role == NULL) { return; } strncpy(this->szName, role->roleName.c_str(), sizeof(this->szName)); this->dwID = role->dwRoleID; this->bySex = role->bySex; this->byJob = role->byJob; this->dwFightValue = role->dwFightValue; this->wLevel = role->wLevel; } int FRIEND::compare(const FriendInfo &frione, const FriendInfo &fritwo)//是先按战力降序,若值相等则按等级 { if (frione.dwFightValue > fritwo.dwFightValue) { return 1; } else if(frione.dwFightValue == fritwo.dwFightValue) { if( frione.wLevel > fritwo.wLevel ) return 1; else return 0; } else { return 0; } } void FRIEND::getFriendsInfo(ROLE* role, string &strData) { vector<FriendInfo> vevFriendInfos; for (size_t i=0; i < role->vecFriends.size(); i++) { ROLE* frinendRole = RoleMgr::getMe().getRoleByID( role->vecFriends[i] ); if (frinendRole == NULL) { continue; } FriendInfo friInfo(frinendRole); vevFriendInfos.push_back(friInfo); //S_APPEND_NBYTES( strData, (char*)&friInfo, sizeof(friInfo) ); } FriendInfo friInfoMe(role); vevFriendInfos.push_back(friInfoMe); sort(vevFriendInfos.begin(), vevFriendInfos.end(),compare); for (size_t i=0; i < vevFriendInfos.size(); i++) { //logwm("get vevFriendInfos[%d].dwID = %d",i,vevFriendInfos[i].dwID); S_APPEND_NBYTES( strData, (char*)&vevFriendInfos[i], sizeof(FriendInfo) ); } } void FRIEND::addFriend(ROLE* role, string &strData, DWORD id) { BYTE byCode; if (role->vecFriends.size() >= MAX_FRIEND_NUM) { byCode = FRIEND_FULL; S_APPEND_BYTE(strData, byCode); return; } if (role->dwRoleID == id) { byCode = FRIEND_YOURSELF; S_APPEND_BYTE(strData, byCode); return; } vector<DWORD>::iterator itdword = find(role->vecFriends.begin(), role->vecFriends.end(), id); if (itdword != role->vecFriends.end()) { byCode = FRIEND_ALREADY; S_APPEND_BYTE(strData, byCode); return; } ROLE* frinendRole = RoleMgr::getMe().getRoleByID( id ); if (frinendRole == NULL) { byCode = FRIEND_NO_EXISTS; S_APPEND_BYTE(strData, byCode); return; } //logwm("add id = %d",id); byCode = FRIEND_SUCCESS; S_APPEND_BYTE(strData, byCode); role->vecFriends.push_back(id); } void FRIEND::delFriend(ROLE* role, string &strData, DWORD id) { vector<DWORD>::iterator it = find(role->vecFriends.begin(), role->vecFriends.end(), id); if (it != role->vecFriends.end()) { role->vecFriends.erase(it); } //logwm("del id = %d",id); } void FRIEND::searchFriend(ROLE* role, string &strData, string name) { BYTE byCode = FRIEND_SUCCESS; ROLE* frinendRole = RoleMgr::getMe().getRoleByName( name ); if (frinendRole == NULL) { byCode = FRIEND_NO_EXISTS; S_APPEND_BYTE(strData, byCode); return; } //vector<DWORD>::iterator itdword = find(role->vecFriends.begin(), role->vecFriends.end(), frinendRole->dwRoleID); //if (itdword != role->vecFriends.end()) //{ // byCode = FRIEND_ALREADY; // S_APPEND_BYTE(strData, byCode); //} //else //{ // byCode = FRIEND_NEW; // S_APPEND_BYTE(strData, byCode); //} S_APPEND_BYTE(strData, byCode); FriendInfo friendInfo(frinendRole); S_APPEND_SZ( strData, (char*)&friendInfo, sizeof(FriendInfo) ); //logwm("search fid = %d",frinendRole->dwRoleID); } void FRIEND::dianZhan(ROLE* role, string &strData, DWORD id) { BYTE byCode = FRIEND_SUCCESS; ROLE* frinendRole = RoleMgr::getMe().getRoleByID( id ); if (frinendRole == NULL) { byCode = FRIEND_NO_EXISTS; S_APPEND_BYTE(strData, byCode); return; } if (role->vecDianZhanIDs.size() >= DIANZHAN_NUM) { byCode = ENOUGH_YIDIAN; S_APPEND_BYTE(strData, byCode); return; } for (auto tempid : role->vecDianZhanIDs) { if (tempid == id) { byCode = FRIEND_YIDIAN; S_APPEND_BYTE(strData, byCode); return; } } role->vecDianZhanIDs.push_back(id); S_APPEND_BYTE(strData, byCode); } void FRIEND::recommondFriends(ROLE* role, string &strData) { //return; vector<DWORD> recommondIDs; RoleMgr::getMe().getRecommondIDs( role, recommondIDs ); for (size_t i=0; i < recommondIDs.size(); i++) { ROLE* frinendRole = RoleMgr::getMe().getRoleByID( recommondIDs[i] ); if (frinendRole == NULL) { continue; } FriendInfo friInfo(frinendRole); S_APPEND_NBYTES( strData, (char*)&friInfo, sizeof(FriendInfo) ); //logwm("recommond friInfo[%d].dwID = %d",i,friInfo.dwID); } //logwm("role.dwID = %d",role->dwRoleID); } int FRIEND::dealFriends(ROLE *role, unsigned char * data, size_t dataLen ,WORD cmd) { //logwm("\n cmd:%x",cmd); if (role == NULL) { return 0; } if (cmd == S_GET_FRIENDS) { string strData; FRIEND::getFriendsInfo(role, strData); PROTOCAL::sendClient( role->client, PROTOCAL::cmdPacket(S_GET_FRIENDS, strData) ); } if (cmd == S_ADD_FRIEND) { DWORD id; if ( !BASE::parseDWORD( data, dataLen, id) ) return -1; string strData; FRIEND::addFriend(role, strData, id); PROTOCAL::sendClient( role->client, PROTOCAL::cmdPacket(S_ADD_FRIEND, strData) ); } if (cmd == S_DEL_FRIEND) { DWORD id; if ( !BASE::parseDWORD( data, dataLen, id) ) return -1; string strData; FRIEND::delFriend(role, strData, id); PROTOCAL::sendClient( role->client, PROTOCAL::cmdPacket(S_DEL_FRIEND, strData) ); } if (cmd == S_SEARCH_FRIEND) { string roleName; if ( !BASE::parseBSTR( data, dataLen, roleName) ) return -1; string strData; FRIEND::searchFriend(role, strData, roleName); PROTOCAL::sendClient( role->client, PROTOCAL::cmdPacket(S_SEARCH_FRIEND, strData) ); } if (cmd == S_RECOMMOND_FRIENDS) { string strData; FRIEND::recommondFriends(role, strData); PROTOCAL::sendClient( role->client, PROTOCAL::cmdPacket(S_RECOMMOND_FRIENDS, strData) ); } if (cmd == S_DIANZAN) { DWORD id; if ( !BASE::parseDWORD( data, dataLen, id) ) return -1; string strData; FRIEND::dianZhan(role, strData, id); PROTOCAL::sendClient( role->client, PROTOCAL::cmdPacket(S_DIANZAN, strData) ); } return 0; }
[ "617179715@qq.com" ]
617179715@qq.com
5031c21cc93267405ece331fb832eb7a8b56b615
c24a5cdd5584748a70454736cb73df0704f51e06
/Arduino/unity_whisperer/02_demo_scene.ino
3d809dc20354522b0c785f0b27683f0847da1daf
[]
no_license
OMeyer973/zos
b7b046ed0c38cb2dabc381eb2ee9656759de83a0
4c05b6f386efe45dd497c14fedda88d95a53bfed
refs/heads/master
2020-09-23T05:41:46.610696
2020-01-07T18:05:48
2020-01-07T18:05:48
225,418,296
0
1
null
null
null
null
UTF-8
C++
false
false
1,815
ino
// --------------------------------------------------------------------- // DEMO SCENE // --------------------------------------------------------------------- //declaring the class class DemoScene { public: // initialise global values for demo scene void init() { for(int i=0; i<4; i++) { lianaFront[i] = -1; lianaBack[i] = -1; sensorStates[i] = 0; // optional } } // - - - - - - - - - - - - - - - - - - - - - - - // start an animation on a liana for the Demo scene // has no effect if an animation is allready running // on the given liana void beginLianaAnimationOnCommand(String str) { //Serial.print("begin liana "); //Serial.println(str); if(serialCommunication.getCommand(str) == 'L') { int liana = serialCommunication.getLiana(str); if (0 <= liana && liana < 4) { lianaFront[liana] ++; // moving the lianaFront from -1 to 0 triggers // the animation cycle in updateLianas_D } } } // - - - - - - - - - - - - - - - - - - - - - - - // goes one step forward in the liana animation // scene D : chase void updateLianas() { for (int i=0; i<4; i++) { if (lianaFront[i] < stripLen && lianaFront[i] >= 0) { lianaFront[i] ++; } if (lianaFront[i] >= stripLen && lianaBack[i] <= stripLen) { lianaBack[i] ++; } if (lianaFront[i] >= stripLen && lianaBack[i] >= stripLen) { lianaBack[i] = -1; lianaFront[i] = -1; } // updating mask for animations lianaMin[i] = -1; lianaMax[i] = lianaFront[i]; } } }; //and declaring the variable which will be used in main DemoScene demoScene;
[ "olivio" ]
olivio
7ba2134432f4861832e335af273f0efcc7464a46
b33a9177edaaf6bf185ef20bf87d36eada719d4f
/qtbase/src/plugins/platforms/ios/qiostheme.h
58144cb239839b1ea3b2b82c295c42340eca6125
[ "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-commercial-license", "LGPL-2.0-or-later", "LGPL-2.1-only", "GFDL-1.3-only", "LicenseRef-scancode-qt-commercial-1.1", "LGPL-3.0-only", "LicenseRef-scancode-qt-company-exception-lgpl-2.1", ...
permissive
wgnet/wds_qt
ab8c093b8c6eead9adf4057d843e00f04915d987
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
refs/heads/master
2021-04-02T11:07:10.181067
2020-06-02T10:29:03
2020-06-02T10:34:19
248,267,925
1
0
Apache-2.0
2020-04-30T12:16:53
2020-03-18T15:20:38
null
UTF-8
C++
false
false
2,478
h
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QIOSTHEME_H #define QIOSTHEME_H #include <QtCore/QHash> #include <QtGui/QPalette> #include <qpa/qplatformtheme.h> QT_BEGIN_NAMESPACE class QIOSTheme : public QPlatformTheme { public: QIOSTheme(); ~QIOSTheme(); const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE; bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE; const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE; static const char *name; private: mutable QHash<QPlatformTheme::Font, QFont *> m_fonts; QPalette m_systemPalette; }; QT_END_NAMESPACE #endif
[ "p_pavlov@wargaming.net" ]
p_pavlov@wargaming.net
11f3b512ff273b81d4f79259c1609e68c7f9b586
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/httpd/gumtree/httpd_new_hunk_1539.cpp
2e852164fdb58fe5d79423b714c4c959c0ad29b6
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
493
cpp
rv = apr_file_mktemp(&dobj->hfd, dobj->tempfile, APR_CREATE | APR_WRITE | APR_BINARY | APR_BUFFERED | APR_EXCL, r->pool); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_WARNING, rv, r->server, "disk_cache: could not create temp file %s", dobj->tempfile); return rv; } disk_info.format = DISK_FORMAT_VERSION; disk_info.date = info->date; disk_info.expire = info->expire;
[ "993273596@qq.com" ]
993273596@qq.com
78e7dd1ff2ee529be09f33ecc156b64fd9654bd7
a27ad1911c68050448e79e7d2d6a38beb416c239
/hybris/tests/test_glesv2.cpp
7e9e9e77cb4dde1da40f7bbb7368f3c5b87bdde4
[ "Apache-2.0" ]
permissive
vakkov/libhybris
dd5015f98920a5bba9a5107082b0f1c59512a653
fb03e26648720711d38b506a7b89d04fbcf150b4
refs/heads/master
2021-09-10T02:37:14.961919
2018-03-20T18:44:21
2018-03-20T18:50:18
126,066,604
0
0
null
null
null
null
UTF-8
C++
false
false
12,028
cpp
/* * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <EGL/egl.h> #include <GLES2/gl2.h> #include <assert.h> #include <stdio.h> #include <math.h> #include <stddef.h> #include <stdlib.h> #include <hwcomposer_window.h> #include <hardware/hardware.h> #include <hardware/hwcomposer.h> #include <malloc.h> #include <sync/sync.h> const char vertex_src [] = " \ attribute vec4 position; \ varying mediump vec2 pos; \ uniform vec4 offset; \ \ void main() \ { \ gl_Position = position + offset; \ pos = position.xy; \ } \ "; const char fragment_src [] = " \ varying mediump vec2 pos; \ uniform mediump float phase; \ \ void main() \ { \ gl_FragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \ cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \ + atan(pos.y,pos.x) - phase ); \ } \ "; GLuint load_shader(const char *shader_source, GLenum type) { GLuint shader = glCreateShader(type); glShaderSource(shader, 1, &shader_source, NULL); glCompileShader(shader); return shader; } GLfloat norm_x = 0.0; GLfloat norm_y = 0.0; GLfloat offset_x = 0.0; GLfloat offset_y = 0.0; GLfloat p1_pos_x = 0.0; GLfloat p1_pos_y = 0.0; GLint phase_loc; GLint offset_loc; GLint position_loc; const float vertexArray[] = { 0.0, 1.0, 0.0, -1., 0.0, 0.0, 0.0, -1.0, 0.0, 1., 0.0, 0.0, 0.0, 1., 0.0 }; class HWComposer : public HWComposerNativeWindow { private: hwc_layer_1_t *fblayer; hwc_composer_device_1_t *hwcdevice; hwc_display_contents_1_t **mlist; protected: void present(HWComposerNativeWindowBuffer *buffer); public: HWComposer(unsigned int width, unsigned int height, unsigned int format, hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer); void set(); }; HWComposer::HWComposer(unsigned int width, unsigned int height, unsigned int format, hwc_composer_device_1_t *device, hwc_display_contents_1_t **mList, hwc_layer_1_t *layer) : HWComposerNativeWindow(width, height, format) { fblayer = layer; hwcdevice = device; mlist = mList; } void HWComposer::present(HWComposerNativeWindowBuffer *buffer) { int oldretire = mlist[0]->retireFenceFd; mlist[0]->retireFenceFd = -1; fblayer->handle = buffer->handle; fblayer->acquireFenceFd = getFenceBufferFd(buffer); fblayer->releaseFenceFd = -1; int err = hwcdevice->prepare(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist); assert(err == 0); err = hwcdevice->set(hwcdevice, HWC_NUM_DISPLAY_TYPES, mlist); // in android surfaceflinger ignores the return value as not all display types may be supported setFenceBufferFd(buffer, fblayer->releaseFenceFd); if (oldretire != -1) { sync_wait(oldretire, -1); close(oldretire); } } inline static uint32_t interpreted_version(hw_device_t *hwc_device) { uint32_t version = hwc_device->version; if ((version & 0xffff0000) == 0) { // Assume header version is always 1 uint32_t header_version = 1; // Legacy version encoding version = (version << 16) | header_version; } return version; } int main(int argc, char **argv) { EGLDisplay display; EGLConfig ecfg; EGLint num_config; EGLint attr[] = { // some attributes to set up our egl-interface EGL_BUFFER_SIZE, 32, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLSurface surface; EGLint ctxattr[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; EGLContext context; EGLBoolean rv; int err; hw_module_t const* module = NULL; err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); assert(err == 0); framebuffer_device_t* fbDev = NULL; framebuffer_open(module, &fbDev); hw_module_t *hwcModule = 0; hwc_composer_device_1_t *hwcDevicePtr = 0; err = hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &hwcModule); assert(err == 0); err = hwc_open_1(hwcModule, &hwcDevicePtr); assert(err == 0); hw_device_t *hwcDevice = &hwcDevicePtr->common; uint32_t hwc_version = interpreted_version(hwcDevice); #ifdef HWC_DEVICE_API_VERSION_1_4 if (hwc_version == HWC_DEVICE_API_VERSION_1_4) { hwcDevicePtr->setPowerMode(hwcDevicePtr, 0, HWC_POWER_MODE_NORMAL); } else #endif #ifdef HWC_DEVICE_API_VERSION_1_5 if (hwc_version == HWC_DEVICE_API_VERSION_1_5) { hwcDevicePtr->setPowerMode(hwcDevicePtr, 0, HWC_POWER_MODE_NORMAL); } else #endif hwcDevicePtr->blank(hwcDevicePtr, 0, 0); uint32_t configs[5]; size_t numConfigs = 5; err = hwcDevicePtr->getDisplayConfigs(hwcDevicePtr, 0, configs, &numConfigs); assert (err == 0); int32_t attr_values[2]; uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_NO_ATTRIBUTE }; hwcDevicePtr->getDisplayAttributes(hwcDevicePtr, 0, configs[0], attributes, attr_values); printf("width: %i height: %i\n", attr_values[0], attr_values[1]); size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t); hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size); hwc_display_contents_1_t **mList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *)); const hwc_rect_t r = { 0, 0, attr_values[0], attr_values[1] }; int counter = 0; for (; counter < HWC_NUM_DISPLAY_TYPES; counter++) mList[counter] = list; hwc_layer_1_t *layer = &list->hwLayers[0]; memset(layer, 0, sizeof(hwc_layer_1_t)); layer->compositionType = HWC_FRAMEBUFFER; layer->hints = 0; layer->flags = 0; layer->handle = 0; layer->transform = 0; layer->blending = HWC_BLENDING_NONE; #ifdef HWC_DEVICE_API_VERSION_1_3 layer->sourceCropf.top = 0.0f; layer->sourceCropf.left = 0.0f; layer->sourceCropf.bottom = (float) attr_values[1]; layer->sourceCropf.right = (float) attr_values[0]; #else layer->sourceCrop = r; #endif layer->displayFrame = r; layer->visibleRegionScreen.numRects = 1; layer->visibleRegionScreen.rects = &layer->displayFrame; layer->acquireFenceFd = -1; layer->releaseFenceFd = -1; #if (ANDROID_VERSION_MAJOR >= 4) && (ANDROID_VERSION_MINOR >= 3) || (ANDROID_VERSION_MAJOR >= 5) // We've observed that qualcomm chipsets enters into compositionType == 6 // (HWC_BLIT), an undocumented composition type which gives us rendering // glitches and warnings in logcat. By setting the planarAlpha to non- // opaque, we attempt to force the HWC into using HWC_FRAMEBUFFER for this // layer so the HWC_FRAMEBUFFER_TARGET layer actually gets used. bool tryToForceGLES = getenv("QPA_HWC_FORCE_GLES") != NULL; layer->planeAlpha = tryToForceGLES ? 1 : 255; #endif #ifdef HWC_DEVICE_API_VERSION_1_5 layer->surfaceDamage.numRects = 0; #endif layer = &list->hwLayers[1]; memset(layer, 0, sizeof(hwc_layer_1_t)); layer->compositionType = HWC_FRAMEBUFFER_TARGET; layer->hints = 0; layer->flags = 0; layer->handle = 0; layer->transform = 0; layer->blending = HWC_BLENDING_NONE; #ifdef HWC_DEVICE_API_VERSION_1_3 layer->sourceCropf.top = 0.0f; layer->sourceCropf.left = 0.0f; layer->sourceCropf.bottom = (float) attr_values[1]; layer->sourceCropf.right = (float) attr_values[0]; #else layer->sourceCrop = r; #endif layer->displayFrame = r; layer->visibleRegionScreen.numRects = 1; layer->visibleRegionScreen.rects = &layer->displayFrame; layer->acquireFenceFd = -1; layer->releaseFenceFd = -1; #if (ANDROID_VERSION_MAJOR >= 4) && (ANDROID_VERSION_MINOR >= 3) || (ANDROID_VERSION_MAJOR >= 5) layer->planeAlpha = 0xff; #endif #ifdef HWC_DEVICE_API_VERSION_1_5 layer->surfaceDamage.numRects = 0; #endif list->retireFenceFd = -1; list->flags = HWC_GEOMETRY_CHANGED; list->numHwLayers = 2; HWComposer *win = new HWComposer(attr_values[0], attr_values[1], HAL_PIXEL_FORMAT_RGBA_8888, hwcDevicePtr, mList, &list->hwLayers[1]); display = eglGetDisplay(NULL); assert(eglGetError() == EGL_SUCCESS); assert(display != EGL_NO_DISPLAY); rv = eglInitialize(display, 0, 0); assert(eglGetError() == EGL_SUCCESS); assert(rv == EGL_TRUE); eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config); assert(eglGetError() == EGL_SUCCESS); assert(rv == EGL_TRUE); //surface = eglCreateWindowSurface((EGLDisplay) display, ecfg, (EGLNativeWindowType) ((struct ANativeWindow*) win), NULL); surface = eglCreateWindowSurface((EGLDisplay) display, ecfg, (EGLNativeWindowType) static_cast<ANativeWindow *> (win), NULL); assert(eglGetError() == EGL_SUCCESS); assert(surface != EGL_NO_SURFACE); context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr); assert(eglGetError() == EGL_SUCCESS); assert(context != EGL_NO_CONTEXT); assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE); const char *version = (const char *)glGetString(GL_VERSION); assert(version); printf("%s\n",version); GLuint vertexShader = load_shader ( vertex_src , GL_VERTEX_SHADER ); // load vertex shader GLuint fragmentShader = load_shader ( fragment_src , GL_FRAGMENT_SHADER ); // load fragment shader GLuint shaderProgram = glCreateProgram (); // create program object glAttachShader ( shaderProgram, vertexShader ); // and attach both... glAttachShader ( shaderProgram, fragmentShader ); // ... shaders to it glLinkProgram ( shaderProgram ); // link the program glUseProgram ( shaderProgram ); // and select it for usage //// now get the locations (kind of handle) of the shaders variables position_loc = glGetAttribLocation ( shaderProgram , "position" ); phase_loc = glGetUniformLocation ( shaderProgram , "phase" ); offset_loc = glGetUniformLocation ( shaderProgram , "offset" ); if ( position_loc < 0 || phase_loc < 0 || offset_loc < 0 ) { return 1; } //glViewport ( 0 , 0 , 800, 600); // commented out so it uses the initial window dimensions glClearColor ( 1. , 1. , 1. , 1.); // background color float phase = 0; int frames = -1; if(argc == 2) { frames = atoi(argv[1]); } if(frames < 0) { frames = 30 * 60; } int i; for (i = 0; i < frames; ++i) { if(i % 60 == 0) printf("frame:%i\n", i); glClear(GL_COLOR_BUFFER_BIT); glUniform1f ( phase_loc , phase ); // write the value of phase to the shaders phase phase = fmodf ( phase + 0.5f , 2.f * 3.141f ); // and update the local variable glUniform4f ( offset_loc , offset_x , offset_y , 0.0 , 0.0 ); glVertexAttribPointer ( position_loc, 3, GL_FLOAT, GL_FALSE, 0, vertexArray ); glEnableVertexAttribArray ( position_loc ); glDrawArrays ( GL_TRIANGLE_STRIP, 0, 5 ); eglSwapBuffers ( (EGLDisplay) display, surface ); // get the rendered buffer to the screen } printf("stop\n"); #if 0 (*egldestroycontext)((EGLDisplay) display, context); printf("destroyed context\n"); (*egldestroysurface)((EGLDisplay) display, surface); printf("destroyed surface\n"); (*eglterminate)((EGLDisplay) display); printf("terminated\n"); android_dlclose(baz); #endif } // vim:ts=4:sw=4:noexpandtab
[ "vakko_vakko@abv.bg" ]
vakko_vakko@abv.bg
2d29318f14081edd2adb8617bf58cff1ead48411
d7896f4dc83445c792fd5123472adc6569460340
/HttpLib/FormDataHandler.h
5bd5985c17e21b93fc80ef8116fe704009ac6065
[ "Unlicense" ]
permissive
mayimchen/local-file-server
b45f7bfd5f2db63c73a25c217357ce431e6ed795
801343b772f010ab21e215fa7258fa4be524b640
refs/heads/main
2023-03-22T01:55:19.968056
2021-03-16T14:46:07
2021-03-16T14:46:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
338
h
#pragma once #include <string> namespace net { class UploadHandler; class FormDataHandler { public: virtual void addDataPair(const std::string& name, const std::string& value) = 0; virtual std::unique_ptr<UploadHandler> createUploadHandler(const std::string& id, const std::string& fname) = 0; }; }
[ "56758042+tcjohnson123@users.noreply.github.com" ]
56758042+tcjohnson123@users.noreply.github.com
a5e35da3689e91326606507d91ce364aed73eaca
e217eaf05d0dab8dd339032b6c58636841aa8815
/IfcRoad/src/OpenInfraPlatform/IfcRoad/entity/include/IfcProduct.h
ab2830a3e95836eccde0aa209b19e8ede4fbf3f4
[]
no_license
bigdoods/OpenInfraPlatform
f7785ebe4cb46e24d7f636e1b4110679d78a4303
0266e86a9f25f2ea9ec837d8d340d31a58a83c8e
refs/heads/master
2021-01-21T03:41:20.124443
2016-01-26T23:20:21
2016-01-26T23:20:21
57,377,206
0
1
null
2016-04-29T10:38:19
2016-04-29T10:38:19
null
UTF-8
C++
false
false
3,244
h
/*! \verbatim * \copyright Copyright (c) 2015 Julian Amann. All rights reserved. * \author Julian Amann <julian.amann@tum.de> (https://www.cms.bgu.tum.de/en/team/amann) * \brief This file is part of the OpenInfraPlatform. * \endverbatim */ #pragma once #include <vector> #include <map> #include <sstream> #include <string> #include "OpenInfraPlatform/IfcRoad/model/shared_ptr.h" #include "OpenInfraPlatform/IfcRoad/model/IfcRoadObject.h" #include "IfcProductSelect.h" #include "IfcObject.h" namespace OpenInfraPlatform { namespace IfcRoad { class IfcObjectPlacement; class IfcProductRepresentation; class IfcRelAssignsToProduct; //ENTITY class IfcProduct : public IfcProductSelect, public IfcObject { public: IfcProduct(); IfcProduct( int id ); ~IfcProduct(); // method setEntity takes over all attributes from another instance of the class virtual void setEntity( shared_ptr<IfcRoadEntity> other ); virtual void getStepLine( std::stringstream& stream ) const; virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const; virtual void readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcRoadEntity> >& map ); virtual void setInverseCounterparts( shared_ptr<IfcRoadEntity> ptr_self ); virtual void unlinkSelf(); virtual const char* classname() const { return "IfcProduct"; } // IfcRoot ----------------------------------------------------------- // attributes: // shared_ptr<IfcGloballyUniqueId> m_GlobalId; // shared_ptr<IfcOwnerHistory> m_OwnerHistory; //optional // shared_ptr<IfcLabel> m_Name; //optional // shared_ptr<IfcText> m_Description; //optional // IfcObjectDefinition ----------------------------------------------------------- // inverse attributes: // std::vector<weak_ptr<IfcRelAssigns> > m_HasAssignments_inverse; // std::vector<weak_ptr<IfcRelNests> > m_Nests_inverse; // std::vector<weak_ptr<IfcRelNests> > m_IsNestedBy_inverse; // std::vector<weak_ptr<IfcRelDeclares> > m_HasContext_inverse; // std::vector<weak_ptr<IfcRelAggregates> > m_IsDecomposedBy_inverse; // std::vector<weak_ptr<IfcRelAggregates> > m_Decomposes_inverse; // std::vector<weak_ptr<IfcRelAssociates> > m_HasAssociations_inverse; // IfcObject ----------------------------------------------------------- // attributes: // shared_ptr<IfcLabel> m_ObjectType; //optional // inverse attributes: // std::vector<weak_ptr<IfcRelDefinesByObject> > m_IsDeclaredBy_inverse; // std::vector<weak_ptr<IfcRelDefinesByObject> > m_Declares_inverse; // std::vector<weak_ptr<IfcRelDefinesByType> > m_IsTypedBy_inverse; // std::vector<weak_ptr<IfcRelDefinesByProperties> > m_IsDefinedBy_inverse; // IfcProduct ----------------------------------------------------------- // attributes: shared_ptr<IfcObjectPlacement> m_ObjectPlacement; //optional shared_ptr<IfcProductRepresentation> m_Representation; //optional // inverse attributes: std::vector<weak_ptr<IfcRelAssignsToProduct> > m_ReferencedBy_inverse; }; } // end namespace IfcRoad } // end namespace OpenInfraPlatform
[ "planung.cms.bv@tum.de" ]
planung.cms.bv@tum.de
f0f95109381bd6498a01540d8c14d90f9796ae4a
54050becc6ea37a5eaae4c1a64cf6dc3df627a5f
/tree/Leaf.cpp
0c5435723c41241db5823c52799090a445d7c592
[]
no_license
monikahedman/tree
953cd729ee4a5ce7ff56830ce750146333bab6bc
9d8c2ddcd62c6efa4e8e567aadb9286e6aceacc1
refs/heads/master
2021-03-08T08:06:41.061927
2020-03-10T15:15:04
2020-03-10T15:15:04
246,332,858
0
0
null
null
null
null
UTF-8
C++
false
false
1,166
cpp
#include "Leaf.h" Leaf::Leaf(): m_renderer(std::make_unique<OpenGLShape>()) { } void Leaf::loadRenderer() { std::vector<GLfloat> vertex_data = {0.f, 0.f, 0.f, \ 0.f, 0.f, 1.f, \ 0.f, 0.f, \ 1.f, 0.f, 0.f, \ 0.f, 0.f, 1.f, \ 1.f, 0.f, \ 0.f, 1.f, 0.f, \ 0.f, 0.f, 1.f, \ 0.f, 1.f}; m_renderer->setAttribute(ShaderAttrib::POSITION, 3, 0, VBOAttribMarker::DATA_TYPE::FLOAT, false); m_renderer->setAttribute(ShaderAttrib::NORMAL, 3, 3 * sizeof (GLfloat), VBOAttribMarker::DATA_TYPE::FLOAT, false); m_renderer->setAttribute(ShaderAttrib::TEXCOORD0, 2, 6 * sizeof (GLfloat), VBOAttribMarker::DATA_TYPE::FLOAT, false); m_renderer->setVertexData(&vertex_data[0], 24, VBO::GEOMETRY_LAYOUT::LAYOUT_TRIANGLES, 3); m_renderer->buildVAO(); } /* * The shape's renderer draws the shape. */ void Leaf::renderShape() { m_renderer->draw(); }
[ "monika_hedman@brown.edu" ]
monika_hedman@brown.edu
a20b0bda4822ab4f0a75f475e07c23f3fe8c5c09
5318b60b7185251023d5658fa4a5742a4d508051
/UltrasonicSensor/SerialDistance/SerialDistance.ino
c73c89791e3c95fc056c34529db4fc8971854fd7
[]
no_license
TechStuffBoy/ArduinoDev
ccede08da30ab55ef8c83f5acf8fb3caed3aa893
f76509d16bf831dadc751eb348cb06e30911a8da
refs/heads/master
2020-03-29T21:23:22.207583
2018-11-15T12:20:16
2018-11-15T12:20:16
150,363,936
0
0
null
null
null
null
UTF-8
C++
false
false
671
ino
#include<SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // RX, TX int incomingByte = 0; // for incoming serial data String data=""; int i=0; byte incoming = 0; void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps mySerial.begin(9600); } void loop() { //46 to 57 ascii if (mySerial.available()) { incoming = mySerial.read(); if(incoming == 13 ) { //Serial.println(); Serial.print("Data :"); Serial.println(data); data = ""; } else { //Serial.print((char)incoming); data += (char)incoming; } } }
[ "nandhu03.m@gmail.com" ]
nandhu03.m@gmail.com
1716a055477be8589c424aa4bd8d5c2a2fc7b392
ee1f37311a4edc3d5ffc5554b8d7520fb20c6975
/tryout.cpp
10feeb81dbc545aa182ad6893181be2661c6e6ba
[]
no_license
smartestbeaverever/hh
dd670475b61a4984c60cbeee8838d92c0b94bf87
e773e5fb6b921d8892e36527207840316530148d
refs/heads/master
2020-12-09T09:00:57.317983
2020-01-11T19:10:24
2020-01-11T19:10:24
233,257,018
0
0
null
null
null
null
UTF-8
C++
false
false
32
cpp
kjfdfkjfhjhuhgjhndssdhjsdgcvsgc
[ "haley@Haleys-MacBook-Pro.local" ]
haley@Haleys-MacBook-Pro.local
eb2cc2affbdd28a1ff4a61002247323a10084e3e
ae55d33d245ca8b1ca82ee191507a86742cd8851
/lib/core/configreader.cpp
ac674c5654c5c8ded3de488f2d74611713c52737
[]
no_license
wjossowski/lazyfarmer-client
2464f2d05f384c3c099803e849c1919e94c7290f
31aa99f6ef9a5bfbf17d26c513790c5167c58906
refs/heads/master
2021-10-20T07:19:20.722225
2019-02-26T11:21:28
2019-02-26T11:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,805
cpp
/** ** This file is part of the LazyFarmer project. ** Copyright 2018 Wojciech Ossowski <w.j.ossowski@gmail.com>. ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU Lesser General Public License as ** published by the Free Software Foundation, either version 3 of the ** License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public License ** along with this program. If not, see <http://www.gnu.org/licenses/>. **/ #include "configreader.h" #include <QtCore/QFile> #include <QtCore/QDir> #include <QtCore/QJsonDocument> #include <QtCore/QVariantList> #include <QDebug> using namespace Core; using namespace Core::Data; ResourceInfo::ResourceInfo(const QString &url, const QVariantList eraseAt, int baseSize) : url(url) , baseSize(baseSize) { for (auto ommiter : eraseAt) { spritesToOmmit.append(ommiter.toInt()); } } bool ConfigReader::loadConfig(const QByteArray &contents) { const auto json = QJsonDocument::fromJson(contents).toVariant(); if (!json.isValid()) { return false; } const auto configObject = json.toMap(); const auto imageUrls = configObject["urls-images"].toMap(); for (auto iterator = imageUrls.cbegin(); iterator != imageUrls.cend(); iterator++) { const QVariantMap resource = iterator.value().toMap(); const int size = resource.value("size").toInt(); const QString url = resource.value("url").toString(); const QVariantList eraseAt = resource.value("erase-at").toList(); m_resourceInfos.insert(iterator.key(), ResourceInfo::Ptr::create(url, eraseAt, size)); } m_availableDomains = configObject["available-domains"].toStringList(); const auto buildingTypeInfo = configObject["building-config"].toMap(); for (auto iterator = buildingTypeInfo.cbegin(); iterator != buildingTypeInfo.cend(); iterator++) { const auto storedBuildingType = iterator.key(); const auto buildingTypeIds = iterator.value().toList(); BuildingType mappedBuildingType = BuildingHelper::fromString(storedBuildingType); if (!BuildingHelper::isBuildingValid(mappedBuildingType)) { continue; } for (auto id : buildingTypeIds) { m_buildingTypes.insert(id.toInt(), mappedBuildingType); } } return true; } bool ConfigReader::hasDownloadedResources() { if (m_resourceInfos.isEmpty()) return false; auto found = std::find_if (m_resourceInfos.cbegin(), m_resourceInfos.cend(), [] (const ResourceInfo::Ptr &iterator) { return iterator->icons.isEmpty(); }); return found == m_resourceInfos.cend(); } QUrl ConfigReader::urlAt(const QString &key) { return m_resourceInfos.value(key, ResourceInfo::Ptr::create())->url; } QPixmap ConfigReader::pixmapAt(const QString &key, int id) { const auto icons = m_resourceInfos.value(key, ResourceInfo::Ptr::create())->icons; return (id > 0 && icons.size() >= id) ? icons.at(id - 1) : QPixmap(1, 1); } void ConfigReader::storeResource(const QString &key, const QByteArray &data) { auto info = m_resourceInfos.find(key); if (info == m_resourceInfos.end()) { return; } auto resource = *info; const auto image = QImage::fromData(data); int baseSize = resource->baseSize; int totalWidth = image.width(); int totalHeight = image.height(); if (totalWidth % baseSize != 0) { return; } else if (totalHeight % baseSize != 0) { return; } QList<QPixmap> icons; int index = 0; // used for filtering unnecessary pictures for (int h = 0; h < totalHeight; h += baseSize) { for (int w = 0; w < totalWidth; w += baseSize) { if (!resource->spritesToOmmit.contains(index)) { icons.append(QPixmap::fromImage(image.copy(w, h, baseSize, baseSize))); } index++; } } #ifdef DEBUG_MODE for (int i = 0; i < icons.size(); i++) { const auto icon = icons.at(i); QDir temp("/tmp"); temp.mkdir(key); icon.save(QString("/tmp/%1/%1_%2.png").arg(key).arg(i+1)); } #endif resource->icons = std::move(icons); } ConfigReader &ConfigReader::instance() { static ConfigReader reader; return reader; } ConfigReader::ConfigReader() { qDebug() << "Creating config reader"; }
[ "zavafoj@gmail.com" ]
zavafoj@gmail.com
4aefe03314274d8295aa458b102e808a42dc72fa
dde4e9c0ab539884c63e56ef46984c6482b91070
/Camera.h
f6f02d1c18ce83f543d84a025bf6739f11482c29
[]
no_license
awthomps/CSE168HW2
0ecc7b5773e43828e04707aacc80e2d3087be143
4c084c5b6a3e90d8b1388837e05315beb8c1ad21
refs/heads/master
2016-09-11T09:36:41.429756
2014-04-25T18:33:13
2014-04-25T18:33:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
779
h
#pragma once #ifndef CSE168_CAMERA_H #define CSE168_CAMERA_H #include "Matrix34.h" #include "Vector3.h" #include "Bitmap.h" #include "Scene.h" #include "Material.h" #include "StopWatch.h" #include <iostream> class Camera { public: Camera(); ~Camera(); void SetFOV(float f); void SetAspect(float a); void SetResolution(int x, int y); void LookAt(Vector3 &pos, Vector3 &target, Vector3 &up); void LookAt(Vector3 &pos, Vector3 &target); void Render(Scene &s); void SaveBitmap(char *filename); void RenderPixel(int x, int y, Scene &s); private: int XRes, YRes; Matrix34 WorldMatrix; float VerticalFOV; float Aspect; Bitmap BMP; Vector3 topLeft, topRight, bottomLeft, bottomRight, right, up; float rightDelta; float downDelta; StopWatch watch; }; #endif
[ "killosquirrel@gmail.com" ]
killosquirrel@gmail.com
49804c9f37f75c5b2019c94a7e6c23be2880bf5d
7973d7cf1e3ea2f0743b046ec78b1ed07d13920e
/C++/iLab/Minggu 1/Activity/celsius.cpp
a9e31f72c723e6640b45ca434ab385cbcae85e4c
[ "MIT" ]
permissive
rafipriatna/Belajar-Bahasa-Pemrograman
35e7010af30c2e9a076f1d7ba8155cf0e07eb9d5
e6e1f00526897a9d37065d70f9509cb4db5a61f8
refs/heads/master
2021-07-15T09:30:20.677657
2020-11-10T14:36:40
2020-11-10T14:36:40
223,768,692
1
0
null
null
null
null
UTF-8
C++
false
false
404
cpp
// Program untuk mengonversi Fahrenheit ke Celsius #include <iostream> using namespace std; int main(){ // Deklarasi variabel float fahren, celsius; // Input cout << "Nilai derajat Fahrenheit: "; cin >> fahren; // Hitung celsius = (fahren - 32) * 5 / 9; // Output cout << "Identik dengan " << celsius << " derajat Celsius" << endl; return 0; }
[ "stormrider136@gmail.com" ]
stormrider136@gmail.com