blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
dd115fdd3b763b1d5c98cb446b22a2c864329f68
aff28d3b7fbbdc9f3a73528d30b6a9e6c2b9adb7
/src/clientversion.cpp
7b85a0c4465ce6b6df07fad20d1f1c5266ef2d84
[ "MIT" ]
permissive
shehzad002/blockdee_x11
9f2d01db32c6088164b795fb91cb950379f52795
bc2fbd55192e462980e59bb6e8c0e5aa6740283e
refs/heads/master
2023-03-04T08:13:25.969953
2021-02-20T20:08:24
2021-02-20T20:08:24
340,743,519
0
0
null
null
null
null
UTF-8
C++
false
false
3,774
cpp
// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "clientversion.h" #include "tinyformat.h" #include <string> /** * Name of client reported in the 'version' message. Report the same name * for both blockdeed and blockdee-qt, to make it harder for attackers to * target servers or GUI users specifically. */ const std::string CLIENT_NAME("BlockDee Core"); /** * Client version number */ #define CLIENT_VERSION_SUFFIX "" /** * The following part of the code determines the CLIENT_BUILD variable. * Several mechanisms are used for this: * * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is * generated by the build environment, possibly containing the output * of git-describe in a macro called BUILD_DESC * * secondly, if this is an exported version of the code, GIT_ARCHIVE will * be defined (automatically using the export-subst git attribute), and * GIT_COMMIT will contain the commit id. * * then, three options exist for determining CLIENT_BUILD: * * if BUILD_DESC is defined, use that literally (output of git-describe) * * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit] * * otherwise, use v[maj].[min].[rev].[build]-unk * finally CLIENT_VERSION_SUFFIX is added */ //! First, include build.h if requested #ifdef HAVE_BUILD_INFO #include "build.h" #endif //! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. #define GIT_ARCHIVE 1 #ifdef GIT_ARCHIVE #define GIT_COMMIT_ID "" #define GIT_COMMIT_DATE "" #endif #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" #ifndef BUILD_DESC #ifdef BUILD_SUFFIX #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) #elif defined(GIT_COMMIT_ID) #define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) #else #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) #endif #endif const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); std::string FormatVersion(int nVersion) { if (nVersion % 100 == 0) return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100); else return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100); } std::string FormatFullVersion() { return CLIENT_BUILD; } /** * Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki) */ std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments) { std::ostringstream ss; ss << "/"; ss << name << ":" << FormatVersion(nClientVersion); if (!comments.empty()) { std::vector<std::string>::const_iterator it(comments.begin()); ss << "(" << *it; for(++it; it != comments.end(); ++it) ss << "; " << *it; ss << ")"; } ss << "/"; return ss.str(); }
[ "shehzad.khan145@yahoo.com" ]
shehzad.khan145@yahoo.com
e2136f5668b56d0d653eb0f5be1dd82ee8f030cf
18b250c95573c5734640240fa2d16834023d4468
/Gigantic/dos_new.h
304f0d213d5c6442478013cbcd375e3c52702a83
[]
no_license
adurie/code-base-realistic-tight-binding
60e468aa9f6ddc4437fa5f452b048cef1c871518
f57e73e5beb1486d68c09c3e508014e543c7ebce
refs/heads/master
2021-06-23T21:09:36.056429
2019-03-01T21:28:40
2019-03-01T21:28:40
110,285,163
0
0
null
null
null
null
UTF-8
C++
false
false
17,774
h
#ifndef GREENS_H #define GREENS_H #include <cmath> #include <eigen3/Eigen/Dense> #include <eigen3/Eigen/StdVector> #include <string> using namespace std; using namespace Eigen; typedef complex<double> dcomp; typedef vector<Vector3d, aligned_allocator<Vector3d>> vV3d; typedef vector<vector<Vector3d, aligned_allocator<Vector3d>>> vvV3d; typedef vector<VectorXd, aligned_allocator<VectorXd>> vVXd; typedef vector<MatrixXd, aligned_allocator<MatrixXd>> vMXd; void adlayer1(MatrixXcd &zgl, MatrixXcd &zu, MatrixXcd &zt, dcomp zener, int n){ // adlayer ontop of gl MatrixXcd zwrk(n, n); zwrk = zgl*zt; zgl = zt.adjoint()*zwrk; MatrixXcd I = MatrixXcd::Identity(n, n); zwrk = (zener*I-zu-zgl).inverse(); zgl = zwrk; return; } int surfacenew(MatrixXcd &zu, MatrixXcd &zt, dcomp zener, MatrixXcd &zsurfl, MatrixXcd &zsurfr, int natom){ // this routine is written for the atomic cell SGF // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int n=natom; int n2=2*n; dcomp zi=-1; zi = sqrt(zi); MatrixXcd zunit = MatrixXcd::Identity(n,n); // ----------------------------------------------------------------- // ----------------------------------------------------------------- // now calculate GF's from closed form // ----------------------------------------------------------------- // ----------------------------------------------------------------- // define zp // redefine gamma and delta MatrixXcd ztmp1(n,n), ztinv(n,n), zs(n,n), zsinv(n,n), zgamma(n,n); MatrixXcd zero = MatrixXcd::Zero(n,n); ztmp1 = zener*zunit - zu; ztinv = zt.inverse(); zs = zt.adjoint(); zsinv = zs.inverse(); zgamma = ztmp1*ztinv; MatrixXcd zp(n2,n2), O(n2,n2); zp.topLeftCorner(n,n) = zero; zp.topRightCorner(n,n) = ztinv; zp.bottomLeftCorner(n,n) = -zs; zp.bottomRightCorner(n,n) = zgamma; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // diagonalise zp ComplexEigenSolver<MatrixXcd> ces; ces.compute(zp); O = ces.eigenvectors(); int ifail = ces.info(); if (ifail != 0){ cout<<"SURFACENEW : ifail = "<<ifail<<endl; ifail=1; return ifail; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // calculate L.H. zsurf MatrixXcd b = O.topRightCorner(n, n); MatrixXcd d = O.bottomRightCorner(n, n); zsurfl = b*d.inverse(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* // ** less efficient but ifail doesn't complain */ /* zgamma = ztmp1*zsinv; */ /* zp.topLeftCorner(n,n) = zero; */ /* zp.topRightCorner(n,n) = zsinv; */ /* zp.bottomLeftCorner(n,n) = -zt; */ /* zp.bottomRightCorner(n,n) = zgamma; */ /* // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* // diagonalise zp */ /* ces.compute(zp); */ /* O = ces.eigenvectors(); */ /* ifail = ces.info(); */ /* if (ifail != 0){ */ /* cout<<"SURFACENEW : ifail = "<<ifail<<endl; */ /* ifail=1; */ /* return ifail; */ /* } */ /* // calculate R.H. zsurf */ /* b = O.topRightCorner(n, n); */ /* d = O.bottomRightCorner(n, n); */ /* zsurfr = b*d.inverse(); */ /* MatrixXcd ztmp2; */ /* ztmp1 = zsurfl; */ /* ztmp2 = zsurfr; */ /* adlayer1(ztmp1,zu,zt,zener,n); */ /* adlayer1(ztmp2,zu,zs,zener,n); */ /* ztmp1 = ztmp1 - zsurfl; */ /* ztmp2 = ztmp2 - zsurfr; */ /* if ((ztmp1.cwiseAbs().maxCoeff() > 5e-5) || (ztmp2.cwiseAbs().maxCoeff() > 5e-5)) */ /* ifail=1; */ /* // ** */ // more efficient but not fully functional (though final results don't seem impacted) // *UPDATE* since adding the below loop, ifail no longer complains MatrixXcd zevl, ztmp2, ztmp3; zevl = ces.eigenvalues().asDiagonal(); ztmp1 = O.topLeftCorner(n,n); ztmp2 = ztmp1.inverse(); ztmp1 = ztmp1*zevl.topLeftCorner(n,n); ztmp3 = ztmp1*ztmp2; zsurfr = ztmp3*zsinv; // ----------------------------------------------------------------- ztmp1 = zsurfl; ztmp2 = zsurfr; adlayer1(ztmp1,zu,zt,zener,n); adlayer1(ztmp2,zu,zs,zener,n); ztmp3 = ztmp1 - zsurfl; if (ztmp3.cwiseAbs().maxCoeff() > 5e-5){ zsurfl = ztmp1; adlayer1(ztmp1,zu,zs,zener,n); ztmp3 = ztmp1 - zsurfl; } ztmp3 = ztmp2 - zsurfr; while (ztmp3.cwiseAbs().maxCoeff() > 5e-5){ zsurfr = ztmp2; adlayer1(ztmp2,zu,zs,zener,n); ztmp3 = ztmp2 - zsurfr; } zsurfl = ztmp1; zsurfr = ztmp2; //This line shifts the bandstructure of Co at the surface if required /* adlayer1(zsurfr,zu,zs,zener+0.05,n); */ return ifail; } Matrix<complex<double>, 9, 9> eint1(double sss, double sps, double pps, double ppp, double ss, double ps, double pp, double ds, double dp, double dd, double x, double y, double z) { // THIS ROUTINE IS SPIN DEPENDENT :- // IT IS WRITTEN FOR s,p and d BANDS ONLY Matrix<complex<double>, 9, 9> b; double xx=x*x; double xy=x*y; double yy=y*y; double yz=y*z; double zz=z*z; double zx=z*x; double xxyy=xx*yy; double yyzz=yy*zz; double zzxx=zz*xx; double aux=pps-ppp; double r3=sqrt(3.); double aux1=r3*ss; double f8=3.*zz-1.; double f1=xx+yy; double f2=xx-yy; double f3=zz-.5*f1; double g1=1.5*f2*ds; double g2=r3*f3*ds; b(0,0)=sss; b(0,1)=x*sps; b(0,2)=y*sps; b(0,3)=z*sps; b(1,0)=-b(0,1); b(1,1)=xx*pps+(1.-xx)*ppp; b(1,2)=xy*aux; b(1,3)=zx*aux; b(2,0)=-b(0,2); b(2,1)=b(1,2); b(2,2)=yy*pps+(1.-yy)*ppp; b(2,3)=yz*aux; b(3,0)=-b(0,3); b(3,1)=b(1,3); b(3,2)=b(2,3); b(3,3)=zz*pps+(1.-zz)*ppp; b(0,4)=xy*aux1; b(0,5)=yz*aux1; b(0,6)=zx*aux1; b(0,7)=.5*f2*aux1; b(0,8)=.5*f8*ss; b(4,0)=b(0,4); b(5,0)=b(0,5); b(6,0)=b(0,6); b(7,0)=b(0,7); b(8,0)=b(0,8); double f4=.5*r3*f2*ps; double f5=.5*f8*ps; double aux2=r3*xx*ps+(1.-2.*xx)*pp; b(1,4)=aux2*y; b(1,5)=(r3*ps-2.*pp)*xy*z; b(1,6)=aux2*z; b(1,7)=(f4+(1.-f2)*pp)*x; b(1,8)=(f5-r3*zz*pp)*x; double aux3=(r3*yy*ps+(1.-2.*yy)*pp); b(2,4)=aux3*x; b(2,5)=aux3*z; b(2,6)=b(1,5); b(2,7)=(f4-(1.+f2)*pp)*y; b(2,8)=(f5-r3*zz*pp)*y; double aux4=r3*zz*ps+(1.-2.*zz)*pp; b(3,4)=b(1,5); b(3,5)=aux4*y; b(3,6)=aux4*x; b(3,7)=(f4-f2*pp)*z; b(3,8)=(f5+r3*f1*pp)*z; b(4,1)=-b(1,4); b(5,1)=-b(1,5); b(6,1)=-b(1,6); b(7,1)=-b(1,7); b(8,1)=-b(1,8); b(4,2)=-b(2,4); b(5,2)=-b(2,5); b(6,2)=-b(2,6); b(7,2)=-b(2,7); b(8,2)=-b(2,8); b(4,3)=-b(3,4); b(5,3)=-b(3,5); b(6,3)=-b(3,6); b(7,3)=-b(3,7); b(8,3)=-b(3,8); b(4,4)=3.*xxyy*ds+(f1-4.*xxyy)*dp+(zz+xxyy)*dd; b(4,5)=(3.*yy*ds+(1.-4.*yy)*dp+(yy-1.)*dd)*zx; b(4,6)=(3.*xx*ds+(1.-4.*xx)*dp+(xx-1.)*dd)*yz; b(4,7)=(g1-2.*f2*dp+.5*f2*dd)*xy; b(4,8)=(g2-2.0*r3*zz*dp+.5*r3*(1.+zz)*dd)*xy; b(5,4)=b(4,5); b(5,5)=3.*yyzz*ds+(yy+zz-4.0*yyzz)*dp+(xx+yyzz)*dd; b(5,6)=(3.0*zz*ds+(1.0-4.0*zz)*dp+(zz-1.0)*dd)*xy; b(5,7)=(g1-(1.0+2.0*f2)*dp+(1.0+.5*f2)*dd)*yz; b(5,8)=(g2+r3*(f1-zz)*dp-.5*r3*f1*dd)*yz; b(6,4)=b(4,6); b(6,5)=b(5,6); b(6,6)=3.*zzxx*ds+(zz+xx-4.*zzxx)*dp+(yy+zzxx)*dd; b(6,7)=(g1+(1.-2.*f2)*dp-(1.-.5*f2)*dd)*zx; b(6,8)=(g2+r3*(f1-zz)*dp-.5*r3*f1*dd)*zx; b(7,4)=b(4,7); b(7,5)=b(5,7); b(7,6)=b(6,7); b(7,7)=.75*f2*f2*ds+(f1-f2*f2)*dp+(zz+.25*f2*f2)*dd; b(7,8)=.5*f2*g2-r3*zz*f2*dp+.25*r3*(1.+zz)*f2*dd; b(8,4)=b(4,8); b(8,5)=b(5,8); b(8,6)=b(6,8); b(8,7)=b(7,8); b(8,8)=f3*f3*ds+3.*zz*f1*dp+.75*f1*f1*dd; return b; } MatrixXcd sk(int ind1, int ind2, int nn, Vector3d &d, double dd, const Vector3d &xk, Vector3d &dpar, int nspin, int ispin, const Matrix2d &s0, const Matrix2d &p0, const Matrix2d &d0t, const Matrix2d &d0e, const vm2d &sssint, const vm2d &spsint, const vm2d &ppsint, const vm2d &pppint, const vm2d &sdsint, const vm2d &pdsint, const vm2d &pdpint, const vm2d &ddsint, const vm2d &ddpint, const vm2d &dddint){ // calculate the cosine angles : MatrixXcd rt(nspin,nspin); rt.fill(0.); Vector3d c; if (dd > 1e-8) c=d/dd; double dk; dcomp zexdk, i; dk=xk.dot(dpar); i = -1; i = sqrt(i); zexdk=cos(dk) + i*sin(dk); int elem; if (ispin == +1) elem = 1; if (ispin == -1) elem = 0; double g1,g2,g3,g4,g5,g6,g7,g8,g9,g10; // find the hopping for this nn.th N.N in direction d // ensure that this routine gives U for d = 0 if (nn == 0){ rt(0,0)=s0(ind1,elem); rt(1,1)=p0(ind1,elem); rt(2,2)=p0(ind1,elem); rt(3,3)=p0(ind1,elem); rt(4,4)=d0e(ind1,elem); rt(5,5)=d0t(ind1,elem); rt(6,6)=d0t(ind1,elem); rt(7,7)=d0t(ind1,elem); rt(8,8)=d0e(ind1,elem); } else{ nn--; g1=sssint[ind1](ind2,nn); g2=spsint[ind1](ind2,nn); g3=ppsint[ind1](ind2,nn); g4=pppint[ind1](ind2,nn); g5=sdsint[ind1](ind2,nn); g6=pdsint[ind1](ind2,nn); g7=pdpint[ind1](ind2,nn); g8=ddsint[ind1](ind2,nn); g9=ddpint[ind1](ind2,nn); g10=dddint[ind1](ind2,nn); rt = eint1(g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,c(0),c(1),c(2)); } return rt*zexdk; } template <typename... Args> MatrixXcd helement(int n1, int n2, int isub, int jsub, const Vector3d &xk, int ispin, int ndim, int nspin, int natom, int nmat, const vvV3d &vsub, const vvV3d &vsubat, int numnn, const Vector3d &a1, const Vector3d &a2, const vV3d &a3, const Vector3d &aa1, const Vector3d &aa2, const vV3d &aa3, const vector<vector<int>> &itype, const vVXd &itypeat, const vMXd &ddnn, Args&&... params){ int ind1, ind2; if (ndim == 1){ ind1=itypeat[n1](isub)-1; ind2=itypeat[n2](jsub)-1; } if (ndim == 0){ ind1=itype[n1][isub]-1; ind2=itype[n2][jsub]-1; } MatrixXcd zh(nspin,nspin); zh.fill(0.); // Calculate // H_{n1,n2}(isub,jsub) = // \sum{d_{//}} exp(i k_{//} d_{//}) <isub,n1|H|jsub,n2,d_{//}> // // To do this we need to calculate // D = (vsub(isub,n1)+a3(n1)) - (vsub(jsub,n2)+a3(n2)+d//) // We need to sum over d_{//} double ddmax=0.; Vector3d dpar, d; double dd; int nn; for (int inn=0; inn<numnn; inn++) ddmax=max(ddmax,ddnn[inn](ind1,ind2)); // sometimes ddnn(ind1,ind2,numnn)=0 for (int i1=-numnn; i1<=numnn; i1++){ for (int i2=-numnn; i2<=numnn; i2++){ // First construct d_{//} if (ndim == 1){ dpar=i1*aa1+i2*aa2+aa3[n2]-aa3[n1]; d=vsubat[n2][jsub]-vsubat[n1][isub]+dpar; } if(ndim == 0){ dpar=i1*a1+i2*a2+a3[n2]-a3[n1]; d=vsub[n2][jsub]-vsub[n1][isub]+dpar; } dd=sqrt(d(0)*d(0) + d(1)*d(1) + d(2)*d(2)); if (dd > (ddmax+1e-8)) continue; // this is not a NN if (abs(dd) < 1e-8){ nn=0; zh = zh + sk(ind1, ind2, nn, d, dd, xk, dpar, nspin, ispin, forward<Args>(params)...); } for (int inn=0; inn<numnn; inn++){ if (abs(dd-ddnn[inn](ind1,ind2)) < 1e-8){ nn=inn+1; zh = zh + sk(ind1, ind2, nn, d, dd, xk, dpar, nspin, ispin, forward<Args>(params)...); } } } } return zh; } template <typename... Args> MatrixXcd hamil(const Vector3d &xk, int n1, int n2, int ispin, int n, int ncell, int nsubat, int nmat, int nspin, vector<int> &imapl, vector<int> &imapr, const vvV3d &vsub, const vvV3d &vsubat, Args&&... params){ // compute the hamiltonian matrices zu and zt // calculate for given layers n1,n2 ; sublattice points isub,jsub ; // orbital indices isp,jsp the Hamiltonian element // <n1 ; isub ; isp | H | n2 ; jsub ; jsp> int natom = nspin*nsubat; MatrixXcd zt(nmat,nmat); MatrixXcd zh(nspin,nspin); int jjj, iii; // compute U or T for (int isub=0; isub<ncell; isub++){ for (int jsub=0; jsub<ncell; jsub++){ zh = helement(n1,n2,isub,jsub,xk,ispin,n,nspin,natom,nmat,vsub,vsubat,forward<Args>(params)...); for (int isp=0; isp<nspin; isp++){ // orbital elements for (int jsp=0; jsp<nspin; jsp++){ iii=(isub)*nspin+isp; jjj=(jsub)*nspin+jsp; zt(iii,jjj)=zh(isp,jsp); } } } } return zt; } dcomp coupl(MatrixXcd &zgsl, MatrixXcd &zgsr, MatrixXcd &zt){ int rows = zgsr.rows(); dcomp zcoupl; MatrixXcd ztdag(rows,rows), ztmp1(rows,rows), ztmp2(rows,rows); ztdag = zt.adjoint(); ztmp1 = zgsl*zt; ztmp2 = ztdag*ztmp1; MatrixXcd I = MatrixXcd::Identity(rows, rows); ztmp1 = zgsr*ztmp2 - I; zcoupl=log(ztmp1.determinant())/M_PI; return zcoupl; } template <typename... Args> int green(dcomp zener, int ispin, string &side, MatrixXcd &zgl, MatrixXcd &zgr, int nsub, int nsubat, int nlay, int nmat, int nxfold, vV3d &xfold, int nspin, vector<int> &imapl, vector<int> &imapr, const vvV3d &vsub, const vvV3d &vsubat, Args&&... params){ // Calculate the SGF at a given k// , // in the supercell representation -- so that the SGF's are nmatx x nmatx // if side="LH" we calculate the LH SGF. if side="RH" the RH SGF // if ispin=-1 minority, +1 majority // calculate the LH & RH SGF in the atomic basis, and convert to the // supercell basis. int natom = nspin*nsubat; MatrixXcd zgltmp(nmat,nmat), zgrtmp(nmat,nmat); MatrixXcd ztat(natom,natom), zuat(natom,natom); zgltmp.fill(0.); zgrtmp.fill(0.); Vector3d ds; vector<int> imap; imap.reserve(2); int ifail = 0; int ilay; int iii, jjj, ii, jj; dcomp i, zarg1; i = -1.; i = sqrt(i); if (side == "LH"){ ilay=0; imap=imapl; } if (side == "RH"){ ilay=nlay-2; imap=imapr; } Vector3d xkat; MatrixXcd zglat(natom,natom), zgrat(natom,natom); zglat.fill(0.); zgrat.fill(0.); for (int iff=0; iff<nxfold; iff++){ xkat=xfold[iff]; // define atomic hamiltonian elements in lead - u1, t1 // '1' after ispin relates to this referring to the lead ztat = hamil(xkat,ilay,ilay+1,ispin,1,nsubat,nsubat,nmat,nspin,imapl,imapr,vsub,vsubat,forward<Args>(params)...); zuat = hamil(xkat,ilay+1,ilay+1,ispin,1,nsubat,nsubat,nmat,nspin,imapl,imapr,vsub,vsubat,forward<Args>(params)...); ifail=0; ifail = surfacenew(zuat,ztat,zener,zglat,zgrat,natom); if (ifail != 0)// zt has a near zero eigenvalue cout<<"eigenvalues ill-conditioned. Consider coding to higher precision"<<endl; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // now load elements into zgl and zgr for (int isub=0; isub<nsub; isub++){ // sublattice elements for (int jsub=0; jsub<nsub; jsub++){ ds=vsub[ilay][isub]-vsub[ilay][jsub] - (vsubat[ilay][imap[isub]-1]-vsubat[ilay][imap[jsub]-1]); zarg1=i*xkat.dot(ds); for (int isp=0; isp<nspin; isp++){ // orbital elements for (int jsp=0; jsp<nspin; jsp++){ iii=isub*nspin+isp; jjj=jsub*nspin+jsp; ii=(imap[isub]-1)*nspin+isp; jj=(imap[jsub]-1)*nspin+jsp; zgltmp(iii,jjj)=zgltmp(iii,jjj)+zglat(ii,jj)*exp(zarg1)*(nsubat*1.)/(1.*nsub); zgrtmp(iii,jjj)=zgrtmp(iii,jjj)+zgrat(ii,jj)*exp(zarg1)*(nsubat*1.)/(1.*nsub); } } } } } zgl=zgltmp; zgr=zgrtmp; return ifail; } template <typename... Args> int cond(dcomp zener, const Vector3d &xk, double &zconu, double &zcond, int nsub, int nsubat, int nxfold, vV3d &xfold, int nmat, int mlay, int nins, int nlay, Args&&... params){ int ifail = 0; string st = "LH"; MatrixXcd zglu(nmat, nmat), zgru(nmat, nmat), zgld(nmat, nmat), zgrd(nmat, nmat); MatrixXcd GNuinv(nmat, nmat), zgruinv(nmat, nmat), GNdinv(nmat, nmat), zgrdinv(nmat, nmat); MatrixXcd zt(nmat, nmat), zu(nmat, nmat), ztdag(nmat, nmat), zudag(nmat, nmat); double result; ifail = green(zener,+1,st,zglu,zgru,nsub,nsubat,nlay,nmat,nxfold,xfold,forward<Args>(params)...); // LH UP if (ifail != 0) return ifail; zgruinv = zgru.inverse(); zt = hamil(xk,mlay+1,mlay+2,+1,0,nsub,nsubat,nmat,forward<Args>(params)...); ztdag = zt.adjoint(); GNuinv = zgruinv - ztdag*zglu*zt; result = imag((GNuinv.inverse()).trace()); zconu = result; ifail = green(zener,-1,st,zgld,zgrd,nsub,nsubat,nlay,nmat,nxfold,xfold,forward<Args>(params)...); // LH DOWN if (ifail != 0) return ifail; zgrdinv = zgrd.inverse(); zt = hamil(xk,mlay+1,mlay+2,-1,0,nsub,nsubat,nmat,forward<Args>(params)...); ztdag = zt.adjoint(); GNdinv = zgrdinv - ztdag*zgld*zt; result = imag((GNdinv.inverse()).trace()); zcond = result; return ifail; } #endif
[ "alex.durie@open.ac.uk" ]
alex.durie@open.ac.uk
0290b3125a88fb38c05162f2f178d240acebdcd4
ac2529383cd8592c98b810f6bee0b192404980c8
/src/collaborative-robotic-sanding/crs_gui/include/crs_gui/widgets/crs_application_widget.h
ee63723688ef820260a931e42f5443e0496ae78d
[ "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause" ]
permissive
Surfacerobot/crs_application_sizen
3ff1fa79ad6e9b2f065699e9fab28a3ed458feeb
6864fc42be96c514fc3d1fac7b77386781764471
refs/heads/master
2023-08-23T20:44:08.862661
2021-10-17T06:18:47
2021-10-17T06:18:47
416,222,005
1
0
null
2021-10-17T06:18:48
2021-10-12T07:03:52
C++
UTF-8
C++
false
false
3,266
h
/* * Copyright 2020 Southwest Research Institute * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CRS_GUI_WIDGETS_CRS_APPLICATION_WIDGET_H #define CRS_GUI_WIDGETS_CRS_APPLICATION_WIDGET_H #include <QWidget> #include <QTimer> #include <rclcpp/rclcpp.hpp> #include <visualization_msgs/msg/marker_array.hpp> #include <std_msgs/msg/string.hpp> #include <crs_msgs/srv/get_available_actions.hpp> #include <crs_msgs/srv/execute_action.hpp> #include <crs_msgs/srv/get_configuration.hpp> #include <string> namespace YAML { class Node; } namespace Ui { class CRSApplication; } namespace crs_gui { class PartSelectionWidget; class PolygonAreaSelectionWidget; class StateMachineInterfaceWidget; class CRSApplicationWidget : public QWidget { Q_OBJECT public: CRSApplicationWidget(rclcpp::Node::SharedPtr node, QWidget* parent = nullptr); ~CRSApplicationWidget(); std::vector<rclcpp::Node::SharedPtr> getNodes(); protected slots: void onPartSelected(const QString selected_part, const QString part_mesh); void onPartPathSelected(const QString qselected_part, const QString qselected_path); bool loadConfig(const std::string config_file); bool updateConfig(); bool saveConfig(); protected: std::unique_ptr<Ui::CRSApplication> ui_; rclcpp::Node::SharedPtr node_; rclcpp::Node::SharedPtr support_widgets_node_; std::string database_directory_; /** @brief Service that provides process Config when called */ rclcpp::Service<crs_msgs::srv::GetConfiguration>::SharedPtr get_configuration_srv_; /** @brief Callback for get_configuration_srv_*/ void getConfigurationCb(crs_msgs::srv::GetConfiguration::Request::SharedPtr req, crs_msgs::srv::GetConfiguration::Response::SharedPtr res); rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr mesh_marker_pub_; visualization_msgs::msg::MarkerArray current_mesh_marker_; rclcpp::TimerBase::SharedPtr mesh_marker_timer_; void meshMarkerTimerCb(); rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr toolpath_marker_pub_; visualization_msgs::msg::MarkerArray current_toolpath_marker_; rclcpp::TimerBase::SharedPtr toolpath_marker_timer_; void toolpathMarkerTimerCb(); std::string default_config_path_; std::string config_file_path_; std::string toolpath_file_; std::string cad_part_file_; std::shared_ptr<YAML::Node> config_yaml_node_; visualization_msgs::msg::MarkerArray delete_all_marker_; std::unique_ptr<PartSelectionWidget> part_selector_widget_; std::unique_ptr<PolygonAreaSelectionWidget> area_selection_widget_; std::unique_ptr<StateMachineInterfaceWidget> state_machine_interface_widget_; }; } // namespace crs_gui #endif // crs_GUI_WIDGETS_APPLICATION_WIDGET_BASE_H
[ "shizeng007@gmail.com" ]
shizeng007@gmail.com
bf1fcab62fbeb205674e1554e3f296d6b7196e29
2bc222c4afd9db25917d5469db0ff5da0a076797
/src/lb/Context.hxx
a2d34ac7d09fd48484781a3511a39359bb93db37
[]
permissive
CM4all/beng-proxy
27fd1a1908810cb10584d8ead388fbdf21f15ba9
4b870c9f81d5719fd5b0007c2094c1d5dd94a9c4
refs/heads/master
2023-08-31T18:43:31.463121
2023-08-30T14:03:31
2023-08-30T14:03:31
96,917,990
43
12
BSD-2-Clause
2023-09-11T10:00:43
2017-07-11T17:13:52
C++
UTF-8
C++
false
false
746
hxx
// SPDX-License-Identifier: BSD-2-Clause // Copyright CM4all GmbH // author: Max Kellermann <mk@cm4all.com> #pragma once #include <memory> class FailureManager; class BalancerMap; class FilteredSocketStock; class FilteredSocketBalancer; class SslClientFactory; class LbMonitorManager; namespace Avahi { class Client; class ErrorHandler; } struct LbContext { FailureManager &failure_manager; BalancerMap &tcp_balancer; FilteredSocketStock &fs_stock; FilteredSocketBalancer &fs_balancer; SslClientFactory &ssl_client_factory; LbMonitorManager &monitors; #ifdef HAVE_AVAHI std::unique_ptr<Avahi::Client> &avahi_client; Avahi::ErrorHandler &avahi_error_handler; [[gnu::const]] Avahi::Client &GetAvahiClient() const noexcept; #endif };
[ "mk@cm4all.com" ]
mk@cm4all.com
8235aea3dd351ef791243f5bb5fe4dd244df336c
6f0e8ed250cd1b99257b5baf11606f35b17ffd93
/src/gstcontrol.cpp
ffdb7a4c1155ccf1f606786efee0d0822cbd6ead
[]
no_license
andreluizeng/raw_uyvy_player
f2067a1a83d99855dfbb8db0a76cbf045ffea8d9
f7a11fd865b5ca1b5ee78b47f08445910884e0f0
refs/heads/master
2023-04-24T14:38:45.836793
2021-05-12T04:57:15
2021-05-12T04:57:15
366,596,685
0
0
null
null
null
null
UTF-8
C++
false
false
4,766
cpp
#include "gstcontrol.h" //------------------------------------------------------------------------------- // Name: GSTInit // Arguments: argc, argv (command line arguments) // Description: gstreamer initialization // usage: object->GSTInit (&argc, &argv); //------------------------------------------------------------------------------- bool GSTVideoControl::GSTInit (void) { __location = (char *) malloc (sizeof (char) * 500); if (! __location) { printf ("\nError allocating memory for the Location string"); printf ("\nAborting..."); return false; } return true; } //------------------------------------------------------------------------------- // Name: GSTBuildPipeline // Arguments: video_sink ("fakesink", "mfw_v4lsink", "vro4l2sink", etc..) // Arguments: location (path to the video file) // Description: pipeline creation // usage: object->GSTBuildPipeline ("data/video.uyvy", "autovideosink"); //------------------------------------------------------------------------------- bool GSTVideoControl::GSTBuildPipeline (char *location, int width, int height, int framerate, int format, char *videosink) { __pipeline = gst_pipeline_new ("pipeline"); __filesrc = gst_element_factory_make ("filesrc", "src"); if(! __filesrc) { GST_WARNING("Error in: src"); } g_object_set (G_OBJECT (__filesrc), "location", location, NULL); __videoparse = gst_element_factory_make("videoparse", NULL); if(! __videoparse) { GST_WARNING("Error in: videoparse"); } g_object_set(G_OBJECT(__videoparse),"width", width, NULL); g_object_set(G_OBJECT(__videoparse),"height", height, NULL); g_object_set(G_OBJECT(__videoparse),"framerate", framerate, 1, NULL); g_object_set(G_OBJECT(__videoparse),"format", format , NULL); __videoconvert = gst_element_factory_make("videoconvert", NULL); if(! __videoconvert) { GST_WARNING("Error in: videoconvert"); } __videosink = gst_element_factory_make(videosink, NULL); if(! __videosink) { GST_WARNING("Error in: videosink"); } gst_bin_add_many(GST_BIN(__pipeline), __filesrc, __videoparse, __videoconvert, __videosink, NULL); gst_element_link_many(__filesrc, __videoparse, __videoconvert, __videosink, NULL); // gst_element_link(filesrc, videoparse); // gst_element_link(videoparse, videoconvert); // gst_element_link(videoconvert, videosink); gst_element_set_state (__pipeline, GST_STATE_PAUSED); return TRUE; } //------------------------------------------------------------------------------- // Name: GSTPlay // Arguments: none // Description: start playing // usage: object->GSTPlay (); //------------------------------------------------------------------------------- void GSTVideoControl::GSTPlay(void) { if (__pipeline) { gst_element_set_state (__pipeline, GST_STATE_PLAYING); if (gst_element_get_state (__pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE) { g_error ("Failed to go into PLAYING state"); } } else { printf ("\nError: no pipeline created\n"); } return; } //------------------------------------------------------------------------------- // Name: GSTStop // Arguments: none // Description: stop playing (needs to create another pipeline to play again) // usage: object->GSTStop (); //------------------------------------------------------------------------------- void GSTVideoControl::GSTStop(void) { if (__pipeline) { gst_element_set_state (__pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (__pipeline)); __pipeline = NULL; } else { printf ("\nError: no pipeline created\n"); } return; } //------------------------------------------------------------------------------- // Name: GSTPause // Arguments: none // Description: pause playing // usage: object->GSTPause (); //------------------------------------------------------------------------------- void GSTVideoControl::GSTPause(void) { if (__pipeline) { gst_element_set_state (__pipeline, GST_STATE_PAUSED); } else { printf ("\nError: no pipeline created\n"); } return; } //------------------------------------------------------------------------------- // Name: GstDeInit // Arguments: none // Description: destroy the object // usage: object->GSTFastRewind(2); //------------------------------------------------------------------------------- void GSTVideoControl::GSTDeInit(void) { if (__pipeline) { gst_object_unref (GST_OBJECT (__pipeline)); gst_element_set_state (__pipeline, GST_STATE_NULL); } if (__location) free (__location); gst_deinit(); return; }
[ "andre@sightvision.com.br" ]
andre@sightvision.com.br
40a0a36170a353f6d49ae8854ecbab90a41cf411
7daa6e3b9f8daee61690c6d3b9c3bf18785bcea9
/Anubis_complete/src/gprod/gprodion.h
e51181005ed77b8b995d9f0f14e5efd653257e2e
[]
no_license
YiyangHuo/G-nut-Anubis-complied-in-VS2019
c83afa3c2e641f6a63e85313274a026c86a6c418
92f8ed9f674bbe895f998ca35dd4e130aa4a476e
refs/heads/master
2020-07-03T20:40:08.262945
2019-08-22T09:17:19
2019-08-22T09:17:19
202,043,284
15
8
null
null
null
null
UTF-8
C++
false
false
962
h
#ifndef GPRODION_H #define GPRODION_H /* ---------------------------------------------------------------------- (c) 2011 Geodetic Observatory Pecny, http://www.pecny.cz (gnss@pecny.cz) Research Institute of Geodesy, Topography and Cartography Ondrejov 244, 251 65, Czech Republic Purpose: Version: $Rev:$ 2018-04-10 /PV: created -*/ #include <iostream> #include "gprod/gprod.h" using namespace std; namespace gnut { class t_gprodion : public t_gprod { public: t_gprodion(const t_gtime& t, shared_ptr<t_gobj> pt = nullobj); virtual ~t_gprodion(); typedef map<double, map<double, double> > t_map_grd; double const tec(const double& lat, const double& lon); // get TEC for particular location void tec(const double& lat, const double& lon, const double& val); // set TEC for a grid point void clear(); protected: t_map_grd _tec_map; private: }; } // namespace #endif
[ "2392314079@qq.com" ]
2392314079@qq.com
7dedfa60bdc85ab62dd6385ae7a4319041747c04
a0c4ed3070ddff4503acf0593e4722140ea68026
/source/NET/UI/MPR/H/MPRBROWS.HXX
11c27ae891fe030c470286d5b13cf93439910dec
[]
no_license
cjacker/windows.xp.whistler
a88e464c820fbfafa64fbc66c7f359bbc43038d7
9f43e5fef59b44e47ba1da8c2b4197f8be4d4bc8
refs/heads/master
2022-12-10T06:47:33.086704
2020-09-19T15:06:48
2020-09-19T15:06:48
299,932,617
0
1
null
2020-09-30T13:43:42
2020-09-30T13:43:41
null
UTF-8
C++
false
false
15,225
hxx
/*****************************************************************/ /** Microsoft Windows NT **/ /** Copyright(c) Microsoft Corp., 2000, 2000 **/ /*****************************************************************/ /* * mprbrows.hxx * * History: * Yi-HsinS 09-Nov-2000 Created * Yi-HsinS 01-Mar-1993 Added support for multithreading * */ #ifndef _MPRBROWS_HXX_ #define _MPRBROWS_HXX_ extern "C" { #include <mpr.h> } #include <mprdev.hxx> #include <fontedit.hxx> // get SLE_FONT #include <hierlb.hxx> // get HIER_LISTBOX #include <mrucombo.hxx> // get MRUCOMBO #include <mprthred.hxx> // get MPR_ENUM_THREAD class MPR_HIER_LISTBOX; class MPR_LBI_CACHE; /************************************************************************* NAME: MPR_LBI SYNOPSIS: Hierarchical listbox LBI INTERFACE: PARENT: HIER_LBI USES: NLS_STR CAVEATS: NOTES: HISTORY: Johnl 21-Jan-2000 Commented, cleaned up beng 22-Apr-2000 Change in LBI::Paint protocol Yi-HsinS 09-Nov-2000 Added _fRefreshNeeded and methods **************************************************************************/ class MPR_LBI : public HIER_LBI { private: NETRESOURCE _netres; NLS_STR _nlsDisplayName; // Name formatted by the provider BOOL _fRefreshNeeded; protected: virtual VOID Paint( LISTBOX * plb, HDC hdc, const RECT * prect, GUILTT_INFO * pGUILTT ) const ; virtual WCHAR QueryLeadingChar() const; public: MPR_LBI( LPNETRESOURCE lpnetresource ); ~MPR_LBI(); LPNETRESOURCE QueryLPNETRESOURCE( void ) { return &_netres; } const TCHAR * QueryRemoteName( void ) const { return _netres.lpRemoteName; } const TCHAR * QueryLocalName( void ) const { return _netres.lpLocalName; } const TCHAR * QueryComment( void ) const { return _netres.lpComment ; } const TCHAR * QueryDisplayName( void ) const { return _nlsDisplayName.QueryPch() ; } const DWORD QueryDisplayType( void ) const { return _netres.dwDisplayType ; } UINT QueryType( void ) const { return _netres.dwType; } BOOL IsSearchDialogSupported( void ) const ; BOOL IsContainer( void ) const ; BOOL IsConnectable( void ) const ; BOOL IsProvider( VOID ) const; BOOL IsRefreshNeeded( VOID ) const { return _fRefreshNeeded; } VOID SetRefreshNeeded( BOOL fRefreshNeeded ) { _fRefreshNeeded = fRefreshNeeded; } virtual INT Compare( const LBI * plbi ) const; }; // class MPR_LBI /************************************************************************* NAME: MPR_HIER_LISTBOX SYNOPSIS: MPR specific hierarchical list box. Contains the providers and containers/connections. INTERFACE: PARENT: HIER_LISTBOX USES: DISPLAY_MAP CAVEATS: NOTES: HISTORY: Johnl 21-Jan-2000 Commented, cleaned up Yi-HsinS 09-Nov-2000 Added FindItem, FindNextProvider **************************************************************************/ class MPR_HIER_LISTBOX : public HIER_LISTBOX { private: DISPLAY_MAP _dmapGeneric ; // ie unexpanded DISPLAY_MAP _dmapGenericExpanded ; DISPLAY_MAP _dmapGenericNoExpand ; // cannot expand DISPLAY_MAP _dmapProvider ; // ie unexpanded DISPLAY_MAP _dmapProviderExpanded ; DISPLAY_MAP _dmapDomain ; // ie unexpanded DISPLAY_MAP _dmapDomainExpanded ; DISPLAY_MAP _dmapDomainNoExpand ; // cannot expand DISPLAY_MAP _dmapServer ; // ie unexpanded DISPLAY_MAP _dmapServerExpanded ; DISPLAY_MAP _dmapServerNoExpand ; // cannot expand DISPLAY_MAP _dmapShare ; // ie unexpanded DISPLAY_MAP _dmapShareExpanded ; DISPLAY_MAP _dmapShareNoExpand ; // cannot expand DISPLAY_MAP _dmapFile ; // ie unexpanded DISPLAY_MAP _dmapFileExpanded ; DISPLAY_MAP _dmapFileNoExpand ; // cannot expand DISPLAY_MAP _dmapTree ; // ie unexpanded DISPLAY_MAP _dmapTreeExpanded ; DISPLAY_MAP _dmapTreeNoExpand ; // cannot expand DISPLAY_MAP _dmapGroup ; // ie unexpanded DISPLAY_MAP _dmapGroupExpanded ; DISPLAY_MAP _dmapGroupNoExpand ; // cannot expand /* This is the column width table. When an LBI is requested to be painted, * it copies this table then adjusts the fields appropriately * depending on the indentation level of the LBI. */ UINT _adxColumns[4] ; // // Set by CalcMaxHorizontalExtent, contains the number of pels in the // offset of the deepest (most indented) node. Need to adjust // container column width with this so the comments will line up. // UINT _nMaxPelIndent ; /* Indicates whether we are listing printers or drives */ UINT _uiType; /* The average character width */ INT _nAveCharWidth; protected: virtual APIERR AddChildren( HIER_LBI * phlbi ); void SetMaxPelIndent( UINT nMaxPelIndent ) { _nMaxPelIndent = nMaxPelIndent ; } public: MPR_HIER_LISTBOX( OWNER_WINDOW * powin, CID cid, UINT uiType ); ~MPR_HIER_LISTBOX() ; /* Enumerates the network resources in this listbox using the * parameters (suitable for passing to WNetOpenEnum) and enumerating * them under the passed LBI. */ DISPLAY_MAP * QueryDisplayMap( BOOL fIsContainer, BOOL fIsExpanded, DWORD dwDisplayType, BOOL fIsProvider) ; UINT * QueryColWidthArray( void ) { return _adxColumns ; } UINT QueryType( VOID ) const { return _uiType; } /* Find an item that is on the given indentation level * and matches the string. */ INT FindItem( const TCHAR *psz, INT nLevel ); /* Find the next top-level item ( provider) starting from the given index */ INT FindNextProvider( INT iStart ); /* Return the average char width */ INT QueryAveCharWidth( VOID ) const { return _nAveCharWidth; } void CalcMaxHorizontalExtent( void ) ; UINT QueryMaxPelIndent( void ) const { return _nMaxPelIndent ; } }; // class MPR_HIER_LISTBOX /************************************************************************* NAME: MPR_BROWSE_BASE SYNOPSIS: Base MPR dialog class INTERFACE: PARENT: DIALOG_WINDOW USES: SLT, BLT_LISTBOX, MPR_HIER_LISTBOX CAVEATS: NOTES: HISTORY: Johnl 21-Jan-2000 Commented, cleaned up, broke into hierarchy to support separate connection dialogs Yi-HsinS 09-Nov-2000 Added support for expanding logon domain at startup **************************************************************************/ class MPR_BROWSE_BASE : public DIALOG_WINDOW { private: SLT _sltShowLBTitle ; MPR_HIER_LISTBOX _mprhlbShow; // Server/provider browser CHECKBOX _boxExpandDomain; SLE_FONT _sleGetInfo; // Always disabled PUSH_BUTTON _buttonOK ; PUSH_BUTTON _buttonSearch ; // Indicates whether we are listing printers or drives UINT _uiType; // Second thread object to retrieve the data MPR_ENUM_THREAD *_pMprEnumThread; // Are there any providers that support SearchDialog? BOOL _fSearchDialogUsed ; // The name of the Provider to expand NLS_STR _nlsProviderToExpand; // The domain the workstation is in NLS_STR _nlsWkstaDomain; // help related stuff if passed in NLS_STR _nlsHelpFile ; DWORD _nHelpContext ; // // As an optimization, the last connectable resource selected by the user // from the resource listbox is stored here, thus // when DoConnect is called, the provider information can be provided // (useful when connecting to non-primary provider). The // _nlsLastNetPath member must match the resource being connected to, // else NULL is used for the provider. // NLS_STR _nlsLastProvider ; NLS_STR _nlsLastNetPath ; protected: virtual const TCHAR *QueryHelpFile( ULONG nHelpContext ); UINT QueryType( void ) const { return _uiType ; } virtual BOOL OnOK( void ) ; virtual BOOL OnCommand( const CONTROL_EVENT & event ); virtual BOOL OnUserMessage( const EVENT & event ); virtual BOOL MayRun( VOID ); MPR_HIER_LISTBOX * QueryShowLB( void ) { return &_mprhlbShow ; } PUSH_BUTTON * QueryOKButton( void ) { return &_buttonOK ; } virtual VOID SetFocusToNetPath( VOID ) = 0; virtual VOID SetNetPathString( const TCHAR *pszPath ) = 0; virtual VOID ClearNetPathString( VOID ) = 0; virtual APIERR OnShowResourcesChange( BOOL fEnumChildren = FALSE ); VOID SetLastProviderInfo( const TCHAR * pszProvider, const TCHAR * pszNetPath ) { _nlsLastProvider = pszProvider ; _nlsLastNetPath = pszNetPath ; } const TCHAR * QueryLastProvider( VOID ) { return _nlsLastProvider.QueryPch() ; } const TCHAR * QueryLastNetPath( VOID ) { return _nlsLastNetPath.QueryPch() ; } /* Get the user's logged on domain */ APIERR QueryWkstaDomain( NLS_STR *pnlsWkstaDomain ); /* Get the name of provider to expand */ APIERR QueryProviderToExpand( NLS_STR *pnlsProvider, BOOL *pfIsNT ); /* Expand the item given */ BOOL Expand( const TCHAR *psz, INT nLevel, MPR_LBI_CACHE *pcache, BOOL fTopIndex = FALSE ); /* Get and expand the logon domain in the listbox if needed */ APIERR InitializeLbShow( VOID ); /* * Return the supplied helpfile name if any */ const TCHAR *QuerySuppliedHelpFile( VOID ) { return _nlsHelpFile.QueryPch() ; } /* * Return the supplied help context if any */ DWORD QuerySuppliedHelpContext( VOID ) { return _nHelpContext ; } /* * call a provider's search dialog */ void CallSearchDialog( MPR_LBI *pmprlbi ) ; /* * Show search dialog on double click if the provider does not support * WNNC_ENUM_GLOBAL but supports search dialog */ BOOL ShowSearchDialogOnDoubleClick( MPR_LBI *pmprlbi ); /* * Enable and show the listbox */ VOID ShowMprListbox( BOOL fShow ); /* * check and set the ExpandDomain bit in user profile */ BOOL IsExpandDomain( VOID ); BOOL SetExpandDomain(BOOL fSave); /* Protected constructor so only leaf nodes can be constructed. */ MPR_BROWSE_BASE( const TCHAR *pszDialogName, HWND hwndOwner, DEVICE_TYPE devType, TCHAR *pszHelpFile, DWORD nHelpIndex) ; ~MPR_BROWSE_BASE(); }; // class MPR_BROWSE_BASE /************************************************************************* NAME: MPR_BROWSE_DIALOG SYNOPSIS: INTERFACE: PARENT: DIALOG_WINDOW USES: CAVEATS: NOTES: HISTORY: Yi-HsinS 09-Nov-2000 Created **************************************************************************/ class MPR_BROWSE_DIALOG : public MPR_BROWSE_BASE { private: SLE _sleNetPath; NLS_STR *_pnlsPath; PFUNC_VALIDATION_CALLBACK _pfuncValidation; protected: virtual ULONG QueryHelpContext( VOID ); virtual BOOL OnOK( VOID ); public: MPR_BROWSE_DIALOG( HWND hwndOwner, DEVICE_TYPE devType, TCHAR *pszHelpFIle, DWORD nHelpIndex, NLS_STR *pnlsPath, PFUNC_VALIDATION_CALLBACK pfuncValidation ); ~MPR_BROWSE_DIALOG(); virtual VOID SetFocusToNetPath( VOID ) { _sleNetPath.ClaimFocus(); } virtual VOID SetNetPathString( const TCHAR *pszPath ) { _sleNetPath.SetText( pszPath ); } virtual VOID ClearNetPathString( VOID ) { _sleNetPath.ClearText(); } }; /************************************************************************* NAME: MPR_LBI_CACHE SYNOPSIS: Simple container class for storing and sorting MPR_LBIs PARENT: BASE NOTES: Ownership of the LBI's memory is transferred to here, then to the listbox. HISTORY: Johnl 27-Jan-1993 Created YiHsinS 01-Mar-1993 Added FindItem, DeleteAllItems **************************************************************************/ class MPR_LBI_CACHE : public BASE { private: INT _cItems ; // Items in array INT _cMaxItems ; // Size of array BUFFER _buffArray ; // Memory for the array static int _CRTAPI1 CompareLbis( const void * p0, const void * p1 ) ; public: MPR_LBI_CACHE( INT cInitialItems = 100 ) ; ~MPR_LBI_CACHE() ; // // Behaves just like LISTBOX::AddItem // APIERR AppendItem( MPR_LBI * plbi ) ; INT FindItem( const TCHAR *psz ) ; VOID DeleteAllItems( VOID ); void Sort( void ) ; INT QueryCount( void ) const { return _cItems ; } MPR_LBI * * QueryPtr( void ) { return (MPR_LBI**) _buffArray.QueryPtr() ; } } ; /* The following are support for multithreading. * WM_LB_FILLED is the message sent by the worker thread to the dialog. * MPR_RETURN_CACHE is the structure sent by the worker thread that * contains the data needed. */ #define WM_LB_FILLED (WM_USER + 118) typedef struct { MPR_LBI_CACHE *pcacheDomain; // Contains the list of domains MPR_LBI_CACHE *pcacheServer; // Contains the list of servers } MPR_RETURN_CACHE; /* Puts up a MsgPopup with the information returned by calling * WNetGetLastError. Should be called after a WNet call returns * WN_EXTENDED_ERROR. */ void MsgExtendedError( HWND hwndParent ) ; APIERR GetNetworkDisplayName( const TCHAR *pszProvider, const TCHAR *pszRemoteName, DWORD dwFlags, DWORD dwAveCharPerLine, NLS_STR *pnls ); /* Worker routine that does the actual enumeration. ( WNetOpenEnum, * WNetEnumResource ). Result are either added into the listbox * ( if pmprlb is not NULL ) or returned in a buffer MPR_LBI_CACHE * ( if pmprlb is NULL ). */ APIERR EnumerateShow( UINT uiScope, UINT uiType, UINT uiUsage, LPNETRESOURCE lpNetResource, MPR_LBI *pmprlbi, MPR_HIER_LISTBOX *pmprlb, BOOL fDeleteChildren = FALSE, BOOL *pfSearchDialogUsed = NULL, MPR_LBI_CACHE **ppmprlbicache = NULL ); #endif // _MPRBROWS_HXX_
[ "71558585+window-chicken@users.noreply.github.com" ]
71558585+window-chicken@users.noreply.github.com
2bc8d265e0b38b409e16a4316e66e9f1060b49a9
254261f58c5fe22572d5ddd4e75f0d06d680b93c
/hackday/client/game/Plugins/Dance4MeInputDevice/Source/Dance4MeInputDevice/Public/Dance4MeInputDevice.h
c501134832bbe43c15bad25efcd7c9a78ed43d73
[]
no_license
Jack-Myth/Dance4Me
9bf8ce04f30d08d259780cddfe92e86e22a7943c
b8199dda927f0a93c2f427cc0027017a6b100858
refs/heads/master
2020-03-19T09:16:13.881404
2018-06-14T14:25:03
2018-06-14T14:25:03
136,273,400
1
0
null
2018-06-06T04:50:50
2018-06-06T04:50:50
null
UTF-8
C++
false
false
616
h
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "ModuleManager.h" #include "WebSocketBase.h" #include <../InputDevice/Public/IInputDeviceModule.h> class FDance4MeInputDeviceModule : public IInputDeviceModule { public: UPROPERTY() UWebSocketBase* WebsocketBaseInstance; /** IModuleInterface implementation */ virtual void StartupModule() override; virtual void ShutdownModule() override; virtual TSharedPtr<class IInputDevice> CreateInputDevice(const TSharedRef<FGenericApplicationMessageHandler>& InMessageHandler) override; };
[ "xiaocao.grasses@gmail.com" ]
xiaocao.grasses@gmail.com
3ab83c751864b46928f38b82583688fb61cd6b5b
fae45a23a885b72cd27c0ad1b918ad754b5de9fd
/benchmarks/shenango/parsec/pkgs/libs/mesa/src/src/glu/sgi/libnurbs/internals/basiccrveval.h
eb81ad37383115b89f6be1a8c189a485dad2b93f
[ "MIT", "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
bitslab/CompilerInterrupts
6678700651c7c83fd06451c94188716e37e258f0
053a105eaf176b85b4c0d5e796ac1d6ee02ad41b
refs/heads/main
2023-06-24T18:09:43.148845
2021-07-26T17:32:28
2021-07-26T17:32:28
342,868,949
3
3
MIT
2021-07-19T15:38:30
2021-02-27T13:57:16
C
UTF-8
C++
false
false
2,593
h
/* * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to * http://oss.sgi.com/projects/FreeB/ * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of Silicon Graphics, Inc. * shall not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization from * Silicon Graphics, Inc. */ /* * basiccurveeval.h * * $Date: 2012/03/29 17:22:18 $ $Revision: 1.1.1.1 $ * $Header: /cvs/bao-parsec/pkgs/libs/mesa/src/src/glu/sgi/libnurbs/internals/basiccrveval.h,v 1.1.1.1 2012/03/29 17:22:18 uid42307 Exp $ */ #ifndef __glubasiccrveval_h_ #define __glubasiccrveval_h_ #include "types.h" #include "displaymode.h" #include "cachingeval.h" class BasicCurveEvaluator : public CachingEvaluator { public: virtual ~BasicCurveEvaluator() { /* silence warning*/ } virtual void domain1f( REAL, REAL ); virtual void range1f( long, REAL *, REAL * ); virtual void enable( long ); virtual void disable( long ); virtual void bgnmap1f( long ); virtual void map1f( long, REAL, REAL, long, long, REAL * ); virtual void mapgrid1f( long, REAL, REAL ); virtual void mapmesh1f( long, long, long ); virtual void evalcoord1f( long, REAL ); virtual void endmap1f( void ); virtual void bgnline( void ); virtual void endline( void ); }; #endif /* __glubasiccrveval_h_ */
[ "nilanjana.basu87@gmail.com" ]
nilanjana.basu87@gmail.com
91b77fa0dba4cd2a11fb464671b817e9d4d6bd3e
90d687751ce46eab38b587ce53e825e9eac21de7
/assignment_package/src/scene/materials/microfacetbrdf.cpp
c8b5ca9ece0e2293c66737ab0601139dd49aa9e3
[]
no_license
VElysianP/ProgressivePhotonMappingCIS599
1310ebefca34a544eeb0ab77659d9fda0190fc27
c68e002fbdb6e99700ac20d93c4d1a9869c5b428
refs/heads/master
2021-09-05T03:14:18.363589
2018-01-23T22:03:40
2018-01-23T22:03:40
110,455,212
0
0
null
null
null
null
UTF-8
C++
false
false
1,196
cpp
#include "microfacetbrdf.h" Color3f MicrofacetBRDF::f(const Vector3f &wo, const Vector3f &wi) const { //TODO float CosThetaO = AbsCosTheta(wo),CosThetaI = AbsCosTheta(wi); Vector3f wh = wi+wo; if((CosThetaI==0)||(CosThetaO==0)) { return Color3f(0.0f); } if((wh.x==0)&&(wh.y==0)&&(wh.z==0)) { return Color3f(0.0f); } wh = glm::normalize(wh); Color3f F = fresnel->Evaluate(glm::dot(wi,wh)); return R*distribution->D(wh)*distribution->G(wo,wi)*F/(4*CosThetaI*CosThetaO); return Color3f(0.f); } Color3f MicrofacetBRDF::Sample_f(const Vector3f &wo, Vector3f *wi, const Point2f &xi, Float *pdf, BxDFType *sampledType) const { //TODO Vector3f wh = distribution->Sample_wh(wo,xi); *wi = -wo+2*glm::dot(wo,wh)*wh; if(!SameHemisphere(wo,*wi)) { return Color3f(0.0f); } *pdf = distribution->Pdf(wo,wh)/(4*glm::dot(wo,wh)); return f(wo,*wi); } float MicrofacetBRDF::Pdf(const Vector3f &wo, const Vector3f &wi) const { //TODO if(!SameHemisphere(wo,wi)) { return 0; } Vector3f wh = glm::normalize(wo+wi); return distribution->Pdf(wo,wh)/(4*glm::dot(wo,wh)); }
[ "byaoyi@seas.upenn.edu" ]
byaoyi@seas.upenn.edu
06ee43d76bc6e0f07f281889b186d1e3180ed6f7
4a1b388fc7254e7f8fa2b72df9d61999bf7df341
/ThirdParty/ros/include/geometry_msgs/msg/detail/point32__struct.hpp
d8668067ec4909c5e37bfce01885ea317295cc32
[ "Apache-2.0" ]
permissive
rapyuta-robotics/rclUE
a2055cf772d7ca4d7c36e991ee9c8920e0475fd2
7613773cd4c1226957603d705d68a2d2b4a69166
refs/heads/devel
2023-08-19T04:06:31.306109
2023-07-24T15:23:29
2023-07-24T15:23:29
334,819,367
75
17
Apache-2.0
2023-09-06T02:34:56
2021-02-01T03:29:17
C++
UTF-8
C++
false
false
4,218
hpp
// generated from rosidl_generator_cpp/resource/idl__struct.hpp.em // with input from geometry_msgs:msg/Point32.idl // generated code does not contain a copyright notice #ifndef GEOMETRY_MSGS__MSG__DETAIL__POINT32__STRUCT_HPP_ #define GEOMETRY_MSGS__MSG__DETAIL__POINT32__STRUCT_HPP_ #include <rosidl_runtime_cpp/bounded_vector.hpp> #include <rosidl_runtime_cpp/message_initialization.hpp> #include <algorithm> #include <array> #include <memory> #include <string> #include <vector> #ifndef _WIN32 # define DEPRECATED__geometry_msgs__msg__Point32 __attribute__((deprecated)) #else # define DEPRECATED__geometry_msgs__msg__Point32 __declspec(deprecated) #endif namespace geometry_msgs { namespace msg { // message struct template<class ContainerAllocator> struct Point32_ { using Type = Point32_<ContainerAllocator>; explicit Point32_(rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL) { if (rosidl_runtime_cpp::MessageInitialization::ALL == _init || rosidl_runtime_cpp::MessageInitialization::ZERO == _init) { this->x = 0.0f; this->y = 0.0f; this->z = 0.0f; } } explicit Point32_(const ContainerAllocator & _alloc, rosidl_runtime_cpp::MessageInitialization _init = rosidl_runtime_cpp::MessageInitialization::ALL) { (void)_alloc; if (rosidl_runtime_cpp::MessageInitialization::ALL == _init || rosidl_runtime_cpp::MessageInitialization::ZERO == _init) { this->x = 0.0f; this->y = 0.0f; this->z = 0.0f; } } // field types and members using _x_type = float; _x_type x; using _y_type = float; _y_type y; using _z_type = float; _z_type z; // setters for named parameter idiom Type & set__x( const float & _arg) { this->x = _arg; return *this; } Type & set__y( const float & _arg) { this->y = _arg; return *this; } Type & set__z( const float & _arg) { this->z = _arg; return *this; } // constant declarations // pointer types using RawPtr = geometry_msgs::msg::Point32_<ContainerAllocator> *; using ConstRawPtr = const geometry_msgs::msg::Point32_<ContainerAllocator> *; using SharedPtr = std::shared_ptr<geometry_msgs::msg::Point32_<ContainerAllocator>>; using ConstSharedPtr = std::shared_ptr<geometry_msgs::msg::Point32_<ContainerAllocator> const>; template<typename Deleter = std::default_delete< geometry_msgs::msg::Point32_<ContainerAllocator>>> using UniquePtrWithDeleter = std::unique_ptr<geometry_msgs::msg::Point32_<ContainerAllocator>, Deleter>; using UniquePtr = UniquePtrWithDeleter<>; template<typename Deleter = std::default_delete< geometry_msgs::msg::Point32_<ContainerAllocator>>> using ConstUniquePtrWithDeleter = std::unique_ptr<geometry_msgs::msg::Point32_<ContainerAllocator> const, Deleter>; using ConstUniquePtr = ConstUniquePtrWithDeleter<>; using WeakPtr = std::weak_ptr<geometry_msgs::msg::Point32_<ContainerAllocator>>; using ConstWeakPtr = std::weak_ptr<geometry_msgs::msg::Point32_<ContainerAllocator> const>; // pointer types similar to ROS 1, use SharedPtr / ConstSharedPtr instead // NOTE: Can't use 'using' here because GNU C++ can't parse attributes properly typedef DEPRECATED__geometry_msgs__msg__Point32 std::shared_ptr<geometry_msgs::msg::Point32_<ContainerAllocator>> Ptr; typedef DEPRECATED__geometry_msgs__msg__Point32 std::shared_ptr<geometry_msgs::msg::Point32_<ContainerAllocator> const> ConstPtr; // comparison operators bool operator==(const Point32_ & other) const { if (this->x != other.x) { return false; } if (this->y != other.y) { return false; } if (this->z != other.z) { return false; } return true; } bool operator!=(const Point32_ & other) const { return !this->operator==(other); } }; // struct Point32_ // alias to use template instance with default allocator using Point32 = geometry_msgs::msg::Point32_<std::allocator<void>>; // constant definitions } // namespace msg } // namespace geometry_msgs #endif // GEOMETRY_MSGS__MSG__DETAIL__POINT32__STRUCT_HPP_
[ "christian.conti@rapyuta-robotics.com" ]
christian.conti@rapyuta-robotics.com
6fc66fec6ec79570aa5cf34cd2baf99dda7cc6c7
38d31311f1d7b80949c35d5c177c5183dd477589
/chap2/dijkstra.cpp
20ed84ccfe24ac0b475b688426f78f542ee0fc95
[]
no_license
mryoshio/pccb_v2
ef19d194710aa43cf6778359f36ef5778012b48c
6f96adc69e27a1c453ea0f5361fe9a67cdf2e633
refs/heads/master
2021-01-10T21:06:16.516797
2015-04-25T11:43:19
2015-04-25T11:43:19
15,137,623
0
0
null
2014-12-27T07:51:25
2013-12-12T14:10:50
C++
UTF-8
C++
false
false
344
cpp
#include <iostream> #include <vector> #define MAX_V 50 #define MAX_E 100 struct edge { int from, to, cost; }; using namespace std; edge edges[MAX_E]; int distances[MAX_V]; int V, E; void shortest_path() { for (int i = 0; i < MAX_V] } void initialize() { { 0, 1, 2 } } int main() { initialize(); shortest_path(); return 0; }
[ "ashitaba.yoshioka@leonisand.co" ]
ashitaba.yoshioka@leonisand.co
c1929e84afd6f11d4dd1100ce03a52cbdd62e769
f80a4ddb66b8602c91042ec5c0b4b489bdd0387b
/cuboid.cpp
32f56aba9ae6d89cb10be2380e0610e3aae4b74b
[]
no_license
shunyaoshih/cse291h-hw1
58a44fe9f0e1461af8eff01a71612f017fea1aa5
157716ce2a7c9f16c707b2fa674e415a5e25ba85
refs/heads/master
2022-04-12T19:47:27.597739
2020-04-12T05:33:21
2020-04-12T05:33:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
17,953
cpp
#include "cuboid.h" #ifdef __APPLE__ #define GLFW_INCLUDE_GLCOREARB #include <OpenGL/gl3.h> #else #include <GL/glew.h> #endif #include <GLFW/glfw3.h> #include <math.h> #include <stdlib.h> #include <algorithm> #include <glm/gtx/string_cast.hpp> #include <iostream> #include <random> #define PI 3.1415926f Cuboid::Cuboid(glm::vec3 cuboidSide) { model = glm::mat4(1.0f); // Set color. color = glm::vec3(1.f, 1.f, 1.f); glm::vec3 cuboidMin(0.f); glm::vec3 cuboidMax = cuboidSide; volume = (cuboidMax.x - cuboidMin.x) * (cuboidMax.y - cuboidMin.y) * (cuboidMax.z - cuboidMin.z); totalMass = volume * kDensity; lambda = kE * kNu / (1 + kNu) / (1 - 2 * kNu); mu = kE / 2 / (1 + kNu); std::cout << "lambda: " << lambda << ", mu: " << mu << std::endl; // Set positions. glm::vec3 one(1.f); numOfParticles = glm::vec3(kNBlocks) * (cuboidMax - cuboidMin) + one; indexOfParticles.resize( numOfParticles.x, std::vector<std::vector<int>>(numOfParticles.y, std::vector<int>(numOfParticles.z))); positions.resize(numOfParticles.x * numOfParticles.y * numOfParticles.z); // rotation degree on X, Y, Z std::vector<float> degree = {-20.0, 0.0, 13.0}; std::vector<float> radius(3); for (int i = 0; i < 3; ++i) radius[i] = degree[i] * PI / 180.0f; std::vector<glm::mat3> rotate(3); rotate[0] = {{1.f, 0.f, 0.f}, {0.f, cos(radius[0]), -sin(radius[0])}, {0, sin(radius[0]), cos(radius[0])}}; rotate[1] = {{cos(radius[1]), 0, sin(radius[1])}, {0.f, 1.f, 0.f}, {-sin(radius[1]), 0.f, cos(radius[1])}}; rotate[2] = {{cos(radius[2]), -sin(radius[2]), 0.f}, {sin(radius[2]), cos(radius[2]), 0.f}, {0.f, 0.f, 1.f}}; for (int i = 0; i < 3; ++i) rotate[i] = transpose(rotate[i]); const glm::mat3 kRotate = rotate[2] * rotate[1] * rotate[0]; const glm::vec3 kTranslation = {-0.5f, 2.f, -0.5f}; int index = 0; for (size_t i = 0; i < indexOfParticles.size(); ++i) for (size_t j = 0; j < indexOfParticles[i].size(); ++j) for (size_t k = 0; k < indexOfParticles[i][j].size(); ++k) { indexOfParticles[i][j][k] = index; positions[index] = cuboidMin + glm::vec3(i, j, k) * (cuboidMax - cuboidMin) / (numOfParticles - one); positions[index] = kRotate * positions[index]; positions[index] += kTranslation; ++index; } tetrahedrons.resize(5 * (numOfParticles.x - 1) * (numOfParticles.y - 1) * (numOfParticles.z - 1), std::vector<int>(4)); index = 0; for (size_t i = 0; i < indexOfParticles.size() - 1; ++i) for (size_t j = 0; j < indexOfParticles[i].size() - 1; ++j) for (size_t k = 0; k < indexOfParticles[i][j].size() - 1; ++k) for (size_t l = 0; l < kCubeToTetrahedron.size(); ++l) { for (size_t m = 0; m < 4; ++m) { int di = kCubeToTetrahedron[l][m].x; int dj = kCubeToTetrahedron[l][m].y; int dk = kCubeToTetrahedron[l][m].z; tetrahedrons[index][m] = indexOfParticles[i + di][j + dj][k + dk]; } ++index; } mass.resize(positions.size()); for (std::vector<int>& tetrahedron : tetrahedrons) { int& i0 = tetrahedron[0]; int& i1 = tetrahedron[1]; int& i2 = tetrahedron[2]; int& i3 = tetrahedron[3]; glm::vec3& p0 = positions[i0]; glm::vec3& p1 = positions[i1]; glm::vec3& p2 = positions[i2]; glm::vec3& p3 = positions[i3]; float vol = glm::dot(glm::cross(p1 - p0, p2 - p0), p3 - p0) / 6.f; float m = abs(vol) * kDensity * 0.25f; mass[i0] += m; mass[i1] += m; mass[i2] += m; mass[i3] += m; } force.resize(positions.size()); velocities.resize(positions.size()); // Calculate rest tetrahedral frame (R^-1). inverseRs.resize(tetrahedrons.size(), std::vector<glm::mat3>(kSurfaceOfTetrahedron.size())); n_stars.resize(tetrahedrons.size(), std::vector<glm::vec3>(kSurfaceOfTetrahedron.size())); glm::vec3 half(0.5f); for (size_t i = 0; i < tetrahedrons.size(); ++i) { std::vector<int>& tetrahedron = tetrahedrons[i]; for (size_t j = 0; j < kSurfaceOfTetrahedron.size(); ++j) { const std::vector<int>& order = kSurfaceOfTetrahedron[j]; int& i0 = tetrahedron[order[0]]; int& i1 = tetrahedron[order[1]]; int& i2 = tetrahedron[order[2]]; int& i3 = tetrahedron[order[3]]; glm::vec3& r0 = positions[i0]; glm::vec3& r1 = positions[i1]; glm::vec3& r2 = positions[i2]; glm::vec3& r3 = positions[i3]; inverseRs[i][j] = inverse(glm::mat3(r1 - r0, r2 - r0, r3 - r0)); n_stars[i][j] = cross(r2 - r1, r3 - r1) * half; } } totalNumOfSquares = 2 * ((((int)numOfParticles.x - 1) * ((int)numOfParticles.y - 1)) + (((int)numOfParticles.x - 1) * ((int)numOfParticles.z - 1)) + (((int)numOfParticles.y - 1) * ((int)numOfParticles.z - 1))); // Generate a vertex array (VAO) and two vertex buffer objects (VBO). glGenVertexArrays(1, &VAO); glGenBuffers(1, &VBO_positions); glGenBuffers(1, &VBO_normals); Update(); } Cuboid::~Cuboid() { // Delete the VBOs and the VAO. glDeleteBuffers(1, &VBO_positions); glDeleteBuffers(1, &VBO_normals); glDeleteBuffers(1, &EBO); glDeleteVertexArrays(1, &VAO); } void Cuboid::Draw(const glm::mat4& viewProjMtx, GLuint shader) { // actiavte the shader program glUseProgram(shader); // get the locations and send the uniforms to the shader glUniformMatrix4fv(glGetUniformLocation(shader, "viewProj"), 1, false, (float*)&viewProjMtx); glUniformMatrix4fv(glGetUniformLocation(shader, "model"), 1, GL_FALSE, (float*)&model); glUniform3fv(glGetUniformLocation(shader, "DiffuseColor"), 1, &color[0]); // Bind the VAO glBindVertexArray(VAO); // draw the points using triangles, indexed with the EBO glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0); // Unbind the VAO and shader program glBindVertexArray(0); glUseProgram(0); } void Cuboid::Update() { CalculateForce(); ApplyForce(); SetSurface(); // Bind to the VAO. glBindVertexArray(VAO); // Bind to the first VBO - We will use it to store the vertices glBindBuffer(GL_ARRAY_BUFFER, VBO_positions); glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec3) * surfacePositions.size(), surfacePositions.data(), GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), 0); // Bind to the second VBO - We will use it to store the normals glBindBuffer(GL_ARRAY_BUFFER, VBO_normals); glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec3) * surfaceNormals.size(), surfaceNormals.data(), GL_STATIC_DRAW); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), 0); // Generate EBO, bind the EBO to the bound VAO and send the data glGenBuffers(1, &EBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned int) * indices.size(), indices.data(), GL_STATIC_DRAW); // Unbind the VBOs. glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); } std::pair<glm::mat3, glm::mat3> Cuboid::ComputeStrain(glm::vec3& r0, glm::vec3& r1, glm::vec3& r2, glm::vec3& r3, glm::mat3& inverseR) { glm::vec3 e1 = r1 - r0; glm::vec3 e2 = r2 - r0; glm::vec3 e3 = r3 - r0; glm::mat3 T(e1, e2, e3); glm::mat3 F = T * inverseR; glm::mat3 epsilon = 0.5f * (transpose(F) * F - glm::mat3(1.f)); return {F, epsilon}; } glm::mat3 Cuboid::ComputeStress(glm::mat3& epsilon) { glm::mat3 mu_mat(glm::vec3(2.f * mu), glm::vec3(2.f * mu), glm::vec3(2.f * mu)); float trace = epsilon[0][0] + epsilon[1][1] + epsilon[2][2]; return matrixCompMult(mu_mat, epsilon) + glm::mat3(trace * lambda); } void Cuboid::CalculateForce() { fill(force.begin(), force.end(), glm::vec3(0.f)); // Gravity. for (size_t i = 0; i < positions.size(); ++i) { force[i].y -= mass[i] * kG; } // Linear elasicity. for (size_t i = 0; i < tetrahedrons.size(); ++i) { std::vector<int>& tetrahedron = tetrahedrons[i]; for (size_t j = 0; j < kSurfaceOfTetrahedron.size(); ++j) { const std::vector<int>& order = kSurfaceOfTetrahedron[j]; int& i0 = tetrahedron[order[0]]; int& i1 = tetrahedron[order[1]]; int& i2 = tetrahedron[order[2]]; int& i3 = tetrahedron[order[3]]; glm::vec3& r0 = positions[i0]; glm::vec3& r1 = positions[i1]; glm::vec3& r2 = positions[i2]; glm::vec3& r3 = positions[i3]; float vol = glm::dot(glm::cross(r1 - r0, r2 - r0), r3 - r0) / 6.f; if (vol < kEpsilon) { std::cerr << "vol: " << vol << " should not be less than zero!" << std::endl; assert(false); break; } auto [F, epsilon] = ComputeStrain(r0, r1, r2, r3, inverseRs[i][j]); glm::mat3 sigma = ComputeStress(epsilon); force[i0] += F * sigma * n_stars[i][j]; if (isnan(force[i0].x) || isnan(force[i0].y) || isnan(force[i0].z)) { std::cerr << to_string(force[i0]) << " should not be nan!" << std::endl; exit(0); } } } } void Cuboid::ApplyForce() { for (size_t i = 0; i < positions.size(); ++i) { glm::vec3 acceleration = force[i] / mass[i]; velocities[i] += acceleration * kdt; positions[i] += velocities[i] * kdt; } // Ground detection. for (size_t i = 0; i < positions.size(); ++i) if (positions[i].y < kGround + kEpsilon) { positions[i].y = 0, velocities[i].y *= -1; } // Velocity decay. for (size_t i = 0; i < positions.size(); ++i) velocities[i] *= kVelocityDecay; } void Cuboid::SetSurface() { if (surfacePositions.empty()) surfacePositions.resize(6 * totalNumOfSquares); if (surfaceNormals.empty()) surfaceNormals.resize(6 * totalNumOfSquares); if (indices.empty()) indices.resize(6 * totalNumOfSquares); iota(indices.begin(), indices.end(), 0); int index = 0; // Front for (int i = 0; i < numOfParticles.x - 1; ++i) for (int j = 0; j < numOfParticles.y - 1; ++j) { int z_axis = numOfParticles.z - 1; glm::vec3& p0 = surfacePositions[index]; glm::vec3& p1 = surfacePositions[index + 1]; glm::vec3& p2 = surfacePositions[index + 2]; glm::vec3& p3 = surfacePositions[index + 3]; glm::vec3& p4 = surfacePositions[index + 4]; glm::vec3& p5 = surfacePositions[index + 5]; p0 = positions[indexOfParticles[i][j][z_axis]]; p1 = positions[indexOfParticles[i + 1][j][z_axis]]; p2 = positions[indexOfParticles[i + 1][j + 1][z_axis]]; p3 = positions[indexOfParticles[i][j][z_axis]]; p4 = positions[indexOfParticles[i + 1][j + 1][z_axis]]; p5 = positions[indexOfParticles[i][j + 1][z_axis]]; glm::vec3& n0 = surfaceNormals[index]; glm::vec3& n1 = surfaceNormals[index + 1]; glm::vec3& n2 = surfaceNormals[index + 2]; glm::vec3& n3 = surfaceNormals[index + 3]; glm::vec3& n4 = surfaceNormals[index + 4]; glm::vec3& n5 = surfaceNormals[index + 5]; n0 = n1 = n2 = glm::normalize(glm::cross(p1 - p0, p2 - p0)); n3 = n4 = n5 = glm::normalize(glm::cross(p4 - p3, p5 - p3)); index += 6; } // Back for (int i = 0; i < numOfParticles.x - 1; ++i) for (int j = 0; j < numOfParticles.y - 1; ++j) { int z_axis = 0; glm::vec3& p0 = surfacePositions[index]; glm::vec3& p1 = surfacePositions[index + 1]; glm::vec3& p2 = surfacePositions[index + 2]; glm::vec3& p3 = surfacePositions[index + 3]; glm::vec3& p4 = surfacePositions[index + 4]; glm::vec3& p5 = surfacePositions[index + 5]; p0 = positions[indexOfParticles[i][j][z_axis]]; p1 = positions[indexOfParticles[i + 1][j][z_axis]]; p2 = positions[indexOfParticles[i + 1][j + 1][z_axis]]; p3 = positions[indexOfParticles[i][j][z_axis]]; p4 = positions[indexOfParticles[i + 1][j + 1][z_axis]]; p5 = positions[indexOfParticles[i][j + 1][z_axis]]; glm::vec3& n0 = surfaceNormals[index]; glm::vec3& n1 = surfaceNormals[index + 1]; glm::vec3& n2 = surfaceNormals[index + 2]; glm::vec3& n3 = surfaceNormals[index + 3]; glm::vec3& n4 = surfaceNormals[index + 4]; glm::vec3& n5 = surfaceNormals[index + 5]; n0 = n1 = n2 = -glm::normalize(glm::cross(p1 - p0, p2 - p0)); n3 = n4 = n5 = -glm::normalize(glm::cross(p4 - p3, p5 - p3)); index += 6; } // Top for (int i = 0; i < numOfParticles.x - 1; ++i) for (int k = 0; k < numOfParticles.z - 1; ++k) { int y_axis = numOfParticles.y - 1; glm::vec3& p0 = surfacePositions[index]; glm::vec3& p1 = surfacePositions[index + 1]; glm::vec3& p2 = surfacePositions[index + 2]; glm::vec3& p3 = surfacePositions[index + 3]; glm::vec3& p4 = surfacePositions[index + 4]; glm::vec3& p5 = surfacePositions[index + 5]; p0 = positions[indexOfParticles[i][y_axis][k]]; p1 = positions[indexOfParticles[i][y_axis][k + 1]]; p2 = positions[indexOfParticles[i + 1][y_axis][k + 1]]; p3 = positions[indexOfParticles[i][y_axis][k]]; p4 = positions[indexOfParticles[i + 1][y_axis][k + 1]]; p5 = positions[indexOfParticles[i + 1][y_axis][k]]; glm::vec3& n0 = surfaceNormals[index]; glm::vec3& n1 = surfaceNormals[index + 1]; glm::vec3& n2 = surfaceNormals[index + 2]; glm::vec3& n3 = surfaceNormals[index + 3]; glm::vec3& n4 = surfaceNormals[index + 4]; glm::vec3& n5 = surfaceNormals[index + 5]; n0 = n1 = n2 = glm::normalize(glm::cross(p1 - p0, p2 - p0)); n3 = n4 = n5 = glm::normalize(glm::cross(p4 - p3, p5 - p3)); index += 6; } // Back for (int i = 0; i < numOfParticles.x - 1; ++i) for (int k = 0; k < numOfParticles.z - 1; ++k) { int y_axis = 0; glm::vec3& p0 = surfacePositions[index]; glm::vec3& p1 = surfacePositions[index + 1]; glm::vec3& p2 = surfacePositions[index + 2]; glm::vec3& p3 = surfacePositions[index + 3]; glm::vec3& p4 = surfacePositions[index + 4]; glm::vec3& p5 = surfacePositions[index + 5]; p0 = positions[indexOfParticles[i][y_axis][k]]; p1 = positions[indexOfParticles[i][y_axis][k + 1]]; p2 = positions[indexOfParticles[i + 1][y_axis][k + 1]]; p3 = positions[indexOfParticles[i][y_axis][k]]; p4 = positions[indexOfParticles[i + 1][y_axis][k + 1]]; p5 = positions[indexOfParticles[i + 1][y_axis][k]]; glm::vec3& n0 = surfaceNormals[index]; glm::vec3& n1 = surfaceNormals[index + 1]; glm::vec3& n2 = surfaceNormals[index + 2]; glm::vec3& n3 = surfaceNormals[index + 3]; glm::vec3& n4 = surfaceNormals[index + 4]; glm::vec3& n5 = surfaceNormals[index + 5]; n0 = n1 = n2 = -glm::normalize(glm::cross(p1 - p0, p2 - p0)); n3 = n4 = n5 = -glm::normalize(glm::cross(p4 - p3, p5 - p3)); index += 6; } // Left for (int j = 0; j < numOfParticles.y - 1; ++j) for (int k = 0; k < numOfParticles.z - 1; ++k) { int x_axis = 0; glm::vec3& p0 = surfacePositions[index]; glm::vec3& p1 = surfacePositions[index + 1]; glm::vec3& p2 = surfacePositions[index + 2]; glm::vec3& p3 = surfacePositions[index + 3]; glm::vec3& p4 = surfacePositions[index + 4]; glm::vec3& p5 = surfacePositions[index + 5]; p0 = positions[indexOfParticles[x_axis][j][k]]; p1 = positions[indexOfParticles[x_axis][j + 1][k]]; p2 = positions[indexOfParticles[x_axis][j + 1][k + 1]]; p3 = positions[indexOfParticles[x_axis][j][k]]; p4 = positions[indexOfParticles[x_axis][j + 1][k + 1]]; p5 = positions[indexOfParticles[x_axis][j][k + 1]]; glm::vec3& n0 = surfaceNormals[index]; glm::vec3& n1 = surfaceNormals[index + 1]; glm::vec3& n2 = surfaceNormals[index + 2]; glm::vec3& n3 = surfaceNormals[index + 3]; glm::vec3& n4 = surfaceNormals[index + 4]; glm::vec3& n5 = surfaceNormals[index + 5]; n0 = n1 = n2 = -glm::normalize(glm::cross(p1 - p0, p2 - p0)); n3 = n4 = n5 = -glm::normalize(glm::cross(p4 - p3, p5 - p3)); index += 6; } // Right for (int j = 0; j < numOfParticles.y - 1; ++j) for (int k = 0; k < numOfParticles.z - 1; ++k) { int x_axis = numOfParticles.x - 1; glm::vec3& p0 = surfacePositions[index]; glm::vec3& p1 = surfacePositions[index + 1]; glm::vec3& p2 = surfacePositions[index + 2]; glm::vec3& p3 = surfacePositions[index + 3]; glm::vec3& p4 = surfacePositions[index + 4]; glm::vec3& p5 = surfacePositions[index + 5]; p0 = positions[indexOfParticles[x_axis][j][k]]; p1 = positions[indexOfParticles[x_axis][j + 1][k]]; p2 = positions[indexOfParticles[x_axis][j + 1][k + 1]]; p3 = positions[indexOfParticles[x_axis][j][k]]; p4 = positions[indexOfParticles[x_axis][j + 1][k + 1]]; p5 = positions[indexOfParticles[x_axis][j][k + 1]]; glm::vec3& n0 = surfaceNormals[index]; glm::vec3& n1 = surfaceNormals[index + 1]; glm::vec3& n2 = surfaceNormals[index + 2]; glm::vec3& n3 = surfaceNormals[index + 3]; glm::vec3& n4 = surfaceNormals[index + 4]; glm::vec3& n5 = surfaceNormals[index + 5]; n0 = n1 = n2 = glm::normalize(glm::cross(p1 - p0, p2 - p0)); n3 = n4 = n5 = glm::normalize(glm::cross(p4 - p3, p5 - p3)); index += 6; } }
[ "shunyaoshih@gmail.com" ]
shunyaoshih@gmail.com
9af5ea93028fb80a784f45b21be1932fc6bad99f
83c9ece4e6b0460e25703730523456db7babe3d5
/ConEmu-stable/src/ConEmu/DwmHelper.h
2e5a2153016bee9b490589e3c1b780bb76aa94fd
[ "BSD-3-Clause" ]
permissive
rheostat2718/conemu-maximus5
e89b92ba7abb5b3e3cfb4c2e8d1240a6c91284f0
870bbe44c3c11b563a087b4fa22a2208774096db
refs/heads/master
2021-01-10T18:52:35.564980
2015-08-24T09:06:43
2015-08-24T09:06:43
41,538,033
7
1
null
null
null
null
UTF-8
C++
false
false
8,506
h
/* Copyright (c) 2009-2012 Maximus5 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''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 AUTHOR 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. */ #pragma once enum FrameDrawStyle { fdt_Win2k = 1, fdt_Win2kSelf = 2, fdt_Themed = 3, fdt_Aero = 4, }; class CDwmHelper { protected: bool mb_DwmAllowed, mb_ThemeAllowed, mb_BufferedAllowed; bool mb_EnableGlass, mb_EnableTheming; int mn_DwmClientRectTopOffset; FrameDrawStyle m_DrawType; virtual void OnUseGlass(bool abEnableGlass) = 0; virtual void OnUseTheming(bool abEnableTheming) = 0; virtual void OnUseDwm(bool abEnableDwm) = 0; public: CDwmHelper(void); virtual ~CDwmHelper(void); public: bool IsDwm(); bool IsDwmAllowed(); bool IsGlass(); bool IsThemed(); void EnableGlass(bool abGlass); void EnableTheming(bool abTheme); void ExtendWindowFrame(); void CheckGlassAttribute(); int GetDwmClientRectTopOffset(); BOOL DwmDefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult); HRESULT DwmGetWindowAttribute(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); HANDLE/*HTHEME*/ OpenThemeData(HWND hwnd, LPCWSTR pszClassList); HRESULT CloseThemeData(HANDLE/*HTHEME*/ hTheme); HANDLE/*HPAINTBUFFER*/ BeginBufferedPaint(HDC hdcTarget, const RECT *prcTarget, int/*BP_BUFFERFORMAT*/ dwFormat, void/*BP_PAINTPARAMS*/ *pPaintParams, HDC *phdc); HRESULT EndBufferedPaint(HANDLE/*HPAINTBUFFER*/ hBufferedPaint, BOOL fUpdateTarget); HRESULT DrawThemeTextEx(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const void/*DTTOPTS*/ *pOptions); HRESULT DrawThemeBackground(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect); HRESULT DrawThemeEdge(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect); HRESULT GetThemeMargins(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LPRECT prc, RECT *pMargins); HRESULT GetThemePartSize(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT prc, int/*THEMESIZE*/ eSize, SIZE *psz); HRESULT GetThemePosition(HANDLE/*HTHEME*/ hTheme, int iPartId, int iStateId, int iPropId, POINT *pPoint); int GetThemeSysSize(HANDLE/*HTHEME*/ hTheme, int iSizeID); HRESULT GetThemeBackgroundContentRect(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pBoundingRect, LPRECT pContentRect); // Determine and store current draw type FrameDrawStyle DrawType(); // Aero support void ForceSetIconic(HWND hWnd); HRESULT DwmSetIconicThumbnail(HWND hwnd, HBITMAP hbmp); HRESULT DwmSetIconicLivePreviewBitmap(HWND hwnd, HBITMAP hbmp, POINT *pptClient); HRESULT DwmInvalidateIconicBitmaps(HWND hwnd); private: //OSVERSIONINFO m_OSVer; // Vista+ HMODULE mh_User32; typedef BOOL (WINAPI* ChangeWindowMessageFilter_t)(UINT message, DWORD dwFlag); ChangeWindowMessageFilter_t _ChangeWindowMessageFilter; // Vista+ Aero HMODULE mh_DwmApi; typedef HRESULT (WINAPI* DwmIsCompositionEnabled_t)(BOOL *pfEnabled); DwmIsCompositionEnabled_t _DwmIsCompositionEnabled; typedef HRESULT (WINAPI* DwmSetWindowAttribute_t)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); DwmSetWindowAttribute_t _DwmSetWindowAttribute; typedef HRESULT (WINAPI* DwmExtendFrameIntoClientArea_t)(HWND hWnd, void* pMarInset); DwmExtendFrameIntoClientArea_t _DwmExtendFrameIntoClientArea; typedef BOOL (WINAPI* DwmDefWindowProc_t)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult); DwmDefWindowProc_t _DwmDefWindowProc; typedef HRESULT (WINAPI* DwmGetWindowAttribute_t)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); DwmGetWindowAttribute_t _DwmGetWindowAttribute; typedef HRESULT (WINAPI* DwmSetIconicThumbnail_t)(HWND hwnd, HBITMAP hbmp, DWORD dwSITFlags); DwmSetIconicThumbnail_t _DwmSetIconicThumbnail; typedef HRESULT (WINAPI* DwmSetIconicLivePreviewBitmap_t)(HWND hwnd, HBITMAP hbmp, POINT *pptClient, DWORD dwSITFlags); DwmSetIconicLivePreviewBitmap_t _DwmSetIconicLivePreviewBitmap; typedef HRESULT (WINAPI* DwmInvalidateIconicBitmaps_t)(HWND hwnd); DwmInvalidateIconicBitmaps_t _DwmInvalidateIconicBitmaps; // XP+ Theming HMODULE mh_UxTheme; typedef BOOL (WINAPI* AppThemed_t)(); AppThemed_t _IsAppThemed; // XP AppThemed_t _IsThemeActive; // XP typedef HANDLE/*HTHEME*/ (WINAPI* OpenThemeData_t)(HWND hwnd, LPCWSTR pszClassList); OpenThemeData_t _OpenThemeData; // XP typedef HRESULT (WINAPI* CloseThemeData_t)(HANDLE/*HTHEME*/ hTheme); CloseThemeData_t _CloseThemeData; // XP typedef HRESULT (WINAPI* BufferedPaintInit_t)(); BufferedPaintInit_t _BufferedPaintInit; // Vista BufferedPaintInit_t _BufferedPaintUnInit; // Vista typedef HANDLE/*HPAINTBUFFER*/ (WINAPI* BeginBufferedPaint_t)(HDC hdcTarget, const RECT *prcTarget, int/*BP_BUFFERFORMAT*/ dwFormat, void/*BP_PAINTPARAMS*/ *pPaintParams, HDC *phdc); BeginBufferedPaint_t _BeginBufferedPaint; // Vista typedef HRESULT (WINAPI* EndBufferedPaint_t)(HANDLE/*HPAINTBUFFER*/ hBufferedPaint, BOOL fUpdateTarget); EndBufferedPaint_t _EndBufferedPaint; // Vista typedef HRESULT (WINAPI* DrawThemeTextEx_t)(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const void/*DTTOPTS*/ *pOptions); DrawThemeTextEx_t _DrawThemeTextEx; // Vista typedef HRESULT (WINAPI* DrawThemeBackground_t)(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect); DrawThemeBackground_t _DrawThemeBackground; // XP typedef HRESULT (WINAPI* DrawThemeEdge_t)(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect); DrawThemeEdge_t _DrawThemeEdge; // XP typedef HRESULT (WINAPI* GetThemeMargins_t)(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LPRECT prc, RECT *pMargins); GetThemeMargins_t _GetThemeMargins; // XP typedef HRESULT (WINAPI* GetThemePartSize_t)(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT prc, int/*THEMESIZE*/ eSize, SIZE *psz); GetThemePartSize_t _GetThemePartSize; // XP typedef HRESULT (WINAPI* GetThemePosition_t)(HANDLE/*HTHEME*/ hTheme, int iPartId, int iStateId, int iPropId, POINT *pPoint); GetThemePosition_t _GetThemePosition; // XP typedef int (WINAPI* GetThemeSysSize_t)(HANDLE/*HTHEME*/ hTheme, int iSizeID); GetThemeSysSize_t _GetThemeSysSize; // XP typedef HRESULT (WINAPI* GetThemeBackgroundContentRect_t)(HANDLE/*HTHEME*/ hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pBoundingRect, LPRECT pContentRect); GetThemeBackgroundContentRect_t _GetThemeBackgroundContentRect; // XP typedef void (WINAPI* SetThemeAppProperties_t)(DWORD dwFlags); SetThemeAppProperties_t _SetThemeAppProperties; // XP typedef void (WINAPI* SetWindowThemeNonClientAttributes_t)(DWORD dwFlags); SetWindowThemeNonClientAttributes_t _SetWindowThemeNonClientAttributes; // Vista // some other private functions void InitDwm(); };
[ "ConEmu.Maximus5@90859970-1e37-fbe9-063f-f7b1e201b3eb" ]
ConEmu.Maximus5@90859970-1e37-fbe9-063f-f7b1e201b3eb
fed0a1e8c5284bed4fb4fa9a97dbf0c779f056fc
4ab52666e7f440d7765008728a70af539e8d48df
/HC-05_trial_code/HC-05_trial_code.ino
07e1c0a300332cf92d4016b15f4379a5e596e921
[]
no_license
deepwithin/Arduino_projects-old
7bf45c1e7bfc77e554db8b1a5945c97b329677e6
e94d3cfdeb39882403cca6819e301868d50b1026
refs/heads/master
2023-02-18T17:39:44.180694
2021-01-13T17:01:33
2021-01-13T17:01:33
286,812,817
0
0
null
null
null
null
UTF-8
C++
false
false
624
ino
#include<SoftwareSerial.h> /* Create object named bt of the class SoftwareSerial */ SoftwareSerial bt(0,1); /* (Rx,Tx) */ //Rx defined will be connected to TXD //Rx and Tx here defined will be for arduino board only //always connections will be as Rx to TXD and Tx to Rxd void setup() { bt.begin(9600); /* Define baud rate for software serial communication */ Serial.begin(9600); /* Define baud rate for serial communication */ } void loop() { if (bt.available()) /* If data is available on serial port */ { Serial.write(bt.read()); /* Print character received on to the serial monitor */ } }
[ "47920281+EoTprinceDEEP@users.noreply.github.com" ]
47920281+EoTprinceDEEP@users.noreply.github.com
07208dd98b7cd0455de810962bbfe738242b9f2c
4c23be1a0ca76f68e7146f7d098e26c2bbfb2650
/ic8h18/0.003/C2H5COC2H4P
1d215be0fa47d0a25899ae1f989b2a0a0965db61
[]
no_license
labsandy/OpenFOAM_workspace
a74b473903ddbd34b31dc93917e3719bc051e379
6e0193ad9dabd613acf40d6b3ec4c0536c90aed4
refs/heads/master
2022-02-25T02:36:04.164324
2019-08-23T02:27:16
2019-08-23T02:27:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
843
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.003"; object C2H5COC2H4P; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 1.70423e-13; boundaryField { boundary { type empty; } } // ************************************************************************* //
[ "jfeatherstone123@gmail.com" ]
jfeatherstone123@gmail.com
fe79cc61a0d2539300767d7e384b29df5ca8131d
e45f197f56ec6d81728e7aa857a536db9220f9e4
/SkProjects/GNSS_Viewer_V2/UISetting.cpp
7adaebc4fa98feaf95642f5ec40dde986dfee0b6
[]
no_license
asion0/AsionGitCodes
82bfbaf5bf14eebeb375f3d83ecbcee5c45989ad
7f493fb2a67e053387026a5652fc28f53e76f73c
refs/heads/master
2016-09-10T20:12:25.665716
2013-12-31T09:11:47
2013-12-31T09:11:47
15,427,503
1
2
null
null
null
null
UTF-8
C++
false
false
3,216
cpp
#include "StdAfx.h" #include "UISetting.h" #include "resource.h" UISetting::UISetting(COLORREF bk, COLORREF line, COLORREF inPen, COLORREF noPen, COLORREF inBru, COLORREF noBru, COLORREF inTxt, COLORREF noTxt, COLORREF inIcoTxt, COLORREF noIcoTxt, UINT inBmp, UINT noBmp, const LOGFONT* lpLogFont) : panelBkColor(bk), panelLineColor(line), inUseSnrBarPenColor(inPen), noUseSnrBarPenColor(noPen), inUseSnrBarBrushColor(inBru), noUseSnrBarBrushColor(noBru), inUseBarTextColor(inTxt), noUseBarTextColor(noTxt), inUseIcoTextColor(inIcoTxt), noUseIcoTextColor(noIcoTxt), panelBkBrush(bk), panelLinePen(PS_SOLID, 1, line), inUseSateBmpId(inBmp), noUseSateBmpId(noBmp), inUseSnrBarPen(PS_SOLID, 1, inPen), inUseSnrBarBrush(inBru), noUseSnrBarPen(PS_SOLID, 1, noPen), noUseSnrBarBrush(noBru) { idFont.CreateFont( 17, // LONG lfHeight; 0, // LONG lfWidth; 0, // LONG lfEscapement; 0, // LONG lfOrientation; 400,// LONG lfWeight; 0, // BYTE lfItalic; 0, // BYTE lfUnderline; 0, // BYTE lfStrikeOut; DEFAULT_CHARSET, // BYTE lfCharSet; OUT_DEFAULT_PRECIS, // BYTE lfOutPrecision; CLIP_DEFAULT_PRECIS, // BYTE lfClipPrecision; DEFAULT_QUALITY, // BYTE lfQuality; DEFAULT_PITCH, // BYTE lfPitchAndFamily; "Impact" // WCHAR lfFaceName[LF_FACESIZE]; ); barFont.CreateFont( 16, // LONG lfHeight; 0, // LONG lfWidth; 0, // LONG lfEscapement; 0, // LONG lfOrientation; 400,// LONG lfWeight; 0, // BYTE lfItalic; 0, // BYTE lfUnderline; 0, // BYTE lfStrikeOut; DEFAULT_CHARSET, // BYTE lfCharSet; OUT_DEFAULT_PRECIS, // BYTE lfOutPrecision; CLIP_DEFAULT_PRECIS, // BYTE lfClipPrecision; DEFAULT_QUALITY, // BYTE lfQuality; DEFAULT_PITCH, // BYTE lfPitchAndFamily; "Arial" // WCHAR lfFaceName[LF_FACESIZE]; ); } UISetting::~UISetting(void) { } UISetting gpUI(RGB(255, 255, 204), RGB(150, 150, 150), RGB(200, 200, 200), RGB( 26, 144, 255), RGB( 26, 144, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(128, 128, 128), //inTxt, noTxt RGB(255, 255, 255), RGB( 61, 179, 255), //inIcoTxt, noIcoTxt, IDB_GP_ACT, IDB_GP_DIS, NULL); UISetting glUI(RGB(255, 255, 204), RGB(150, 150, 150), RGB(200, 200, 200), RGB(156, 102, 204), RGB(156, 102, 204), RGB(255, 255, 255), RGB(255, 255, 255), RGB(128, 128, 128), RGB(255, 255, 255), RGB(195, 128, 255), //inIcoTxt, noIcoTxt, IDB_GL_ACT, IDB_GL_DIS, NULL); UISetting bdUI(RGB(204, 255, 255), RGB(150, 150, 150), RGB(200, 200, 200), RGB(255, 153, 0), RGB(255, 153, 0), RGB(255, 255, 255), RGB(255, 255, 255), RGB(128, 128, 128), RGB(255, 255, 255), RGB(255, 153, 0), IDB_BD_ACT, IDB_BD_DIS, NULL); UISetting gaUI(RGB(255, 217, 217), RGB(150, 150, 150), RGB(200, 200, 200), RGB(180, 171, 180), RGB(180, 0, 180), RGB(255, 255, 255), RGB(255, 255, 255), RGB(128, 128, 128), RGB(255, 255, 255), RGB(180, 171, 180), IDB_BD_ACT, IDB_BD_DIS, NULL);
[ "asion.lin@gmail.com" ]
asion.lin@gmail.com
c684cc5cac987526037bbb88ca2d6ba881299ab7
729166e7d015cd52f43f26d3cf7e72daa1eb06ac
/devel/.private/mavros_msgs/include/mavros_msgs/CommandTriggerControlResponse.h
cb4cb8fae61db0bff24580f5260719f80e9df422
[]
no_license
SwastikNandan/VO-backup
c85984c1f58707862a13a4226db6d987ead300df
81f55052d071ff9bfc52380aa9a8aebcad46831b
refs/heads/master
2022-06-17T20:33:49.812373
2020-05-15T23:59:08
2020-05-15T23:59:08
264,303,976
0
0
null
null
null
null
UTF-8
C++
false
false
6,017
h
// Generated by gencpp from file mavros_msgs/CommandTriggerControlResponse.msg // DO NOT EDIT! #ifndef MAVROS_MSGS_MESSAGE_COMMANDTRIGGERCONTROLRESPONSE_H #define MAVROS_MSGS_MESSAGE_COMMANDTRIGGERCONTROLRESPONSE_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> namespace mavros_msgs { template <class ContainerAllocator> struct CommandTriggerControlResponse_ { typedef CommandTriggerControlResponse_<ContainerAllocator> Type; CommandTriggerControlResponse_() : success(false) , result(0) { } CommandTriggerControlResponse_(const ContainerAllocator& _alloc) : success(false) , result(0) { (void)_alloc; } typedef uint8_t _success_type; _success_type success; typedef uint8_t _result_type; _result_type result; typedef boost::shared_ptr< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> const> ConstPtr; }; // struct CommandTriggerControlResponse_ typedef ::mavros_msgs::CommandTriggerControlResponse_<std::allocator<void> > CommandTriggerControlResponse; typedef boost::shared_ptr< ::mavros_msgs::CommandTriggerControlResponse > CommandTriggerControlResponsePtr; typedef boost::shared_ptr< ::mavros_msgs::CommandTriggerControlResponse const> CommandTriggerControlResponseConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> & v) { ros::message_operations::Printer< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace mavros_msgs namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False} // {'geographic_msgs': ['/opt/ros/kinetic/share/geographic_msgs/cmake/../msg'], 'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'sensor_msgs': ['/opt/ros/kinetic/share/sensor_msgs/cmake/../msg'], 'mavros_msgs': ['/root/catkin_ws/src/mavros/mavros_msgs/msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'uuid_msgs': ['/opt/ros/kinetic/share/uuid_msgs/cmake/../msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsFixedSize< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct HasHeader< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> const> : FalseType { }; template<class ContainerAllocator> struct MD5Sum< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > { static const char* value() { return "1cd894375e4e3d2861d2222772894fdb"; } static const char* value(const ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x1cd894375e4e3d28ULL; static const uint64_t static_value2 = 0x61d2222772894fdbULL; }; template<class ContainerAllocator> struct DataType< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > { static const char* value() { return "mavros_msgs/CommandTriggerControlResponse"; } static const char* value(const ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > { static const char* value() { return "bool success\n\ uint8 result\n\ \n\ "; } static const char* value(const ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.success); stream.next(m.result); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct CommandTriggerControlResponse_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::mavros_msgs::CommandTriggerControlResponse_<ContainerAllocator>& v) { s << indent << "success: "; Printer<uint8_t>::stream(s, indent + " ", v.success); s << indent << "result: "; Printer<uint8_t>::stream(s, indent + " ", v.result); } }; } // namespace message_operations } // namespace ros #endif // MAVROS_MSGS_MESSAGE_COMMANDTRIGGERCONTROLRESPONSE_H
[ "jnaneshwar.das@gmail.com" ]
jnaneshwar.das@gmail.com
f489550283d921a6dbe489be5711e20d99db19ec
0750760abf243238b8552dacd23ee76dda354a22
/XiaomiMI6Pkg/CommonDsc.dsc.inc
db5bd2da2ed075f3c17d575e5e551eaf2bfff76f
[]
no_license
wode2016501/edk2-sagit2
0815f475ce28f422b3bfd23820c6a2c2761cddb4
baa2fdfaefbae754c4d71d8411574b08ff8eac44
refs/heads/main
2023-07-30T15:36:33.293916
2021-09-21T14:42:24
2021-09-21T14:42:24
408,829,204
0
0
null
null
null
null
UTF-8
C++
false
false
17,282
inc
# # Copyright (c) 2011-2012, ARM Limited. All rights reserved. # Copyright (c) 2016, Hisilicon Limited. All rights reserved. # Copyright (c) 2016, Linaro Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # # [LibraryClasses.common] !if $(TARGET) == RELEASE DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !endif DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf # # Allow dynamic PCDs # PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf # ARM Architectural Libraries CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf # ARM PL011 UART Driver PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf UefiDevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf # # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window # in the debugger will show load and unload commands for symbols. You can cut and paste this # into the command window to load symbols. We should be able to use a script to do this, but # the version of RVD I have does not support scripts accessing system memory. # #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf # BDS Libraries FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf UefiDevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf # # It is not possible to prevent the ARM compiler for generic intrinsic functions. # This library provides the instrinsic functions generate by a given compiler. # And NULL mean link this library into all ARM images. # NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf # Add support for GCC stack protector NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf [LibraryClasses.common.SEC] ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf [LibraryClasses.common.PEI_CORE] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf [LibraryClasses.common.PEIM] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf ## Fixed compile error after upgrade to 14.10 PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf [LibraryClasses.common.DXE_CORE] HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf [LibraryClasses.common.DXE_DRIVER] ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf [LibraryClasses.common.UEFI_APPLICATION] UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.inf PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf [LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION] DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf [LibraryClasses.common.UEFI_DRIVER] ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCustomDecompressLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf [LibraryClasses.common.DXE_RUNTIME_DRIVER] HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf !ifndef CONFIG_NO_DEBUGLIB DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf !endif !if $(TARGET) != RELEASE DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf !endif [LibraryClasses.AARCH64] ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf [BuildOptions] RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000 GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000 ################################################################################ # # Pcd Section - list of all EDK II PCD Entries defined by this Platform # ################################################################################ [PcdsFeatureFlag.common] gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE [PcdsFixedAtBuild.common] # # IO is mapped to memory space, so we use the same size of # PcdPrePiCpuMemorySize # gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|44 gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4 # DEBUG_ASSERT_ENABLED 0x01 # DEBUG_PRINT_ENABLED 0x02 # DEBUG_CODE_ENABLED 0x04 # CLEAR_MEMORY_ENABLED 0x08 # ASSERT_BREAKPOINT_ENABLED 0x10 # ASSERT_DEADLOOP_ENABLED 0x20 !if $(TARGET) == RELEASE gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0e !else gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f !endif # DEBUG_INIT 0x00000001 // Initialization # DEBUG_WARN 0x00000002 // Warnings # DEBUG_LOAD 0x00000004 // Load events # DEBUG_FS 0x00000008 // EFI File system # DEBUG_POOL 0x00000010 // Alloc & Free's # DEBUG_PAGE 0x00000020 // Alloc & Free's # DEBUG_INFO 0x00000040 // Verbose # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers # DEBUG_VARIABLE 0x00000100 // Variable # DEBUG_BM 0x00000400 // Boot Manager # DEBUG_BLKIO 0x00001000 // BlkIo Driver # DEBUG_NET 0x00004000 // SNI Driver # DEBUG_UNDI 0x00010000 // UNDI Driver # DEBUG_LOADFILE 0x00020000 // UNDI Driver # DEBUG_EVENT 0x00080000 // Event messages # DEBUG_ERROR 0x80000000 // Error gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000 gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x06 # # Optional feature to help prevent EFI memory map fragments # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob # Values are in EFI Pages (4K). DXE Core will make sure that # at least this much of each type of memory can be allocated # from a single memory range. This way you only end up with # maximum of two fragements for each type in the memory map # (the memory used, and the free memory that was prereserved # but not used). # gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 # Set timer interrupt to be triggerred in 1ms to avoid missing # serial terminal input characters. gEmbeddedTokenSpaceGuid.PcdTimerPeriod|10000 gArmTokenSpaceGuid.PcdVFPEnabled|1 gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|32 [PcdsDynamicHii.common.DEFAULT] # gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|0 # Variable: L"Timeout"
[ "1937696985@qq.com" ]
1937696985@qq.com
3d4bb5df39572ac07b170b9438aae7c55df52172
0203e21cd2e601e7a805ed04dd9a01460df16331
/othello.cpp
b2b198d3a3cf2aba88370f1358d44020f5f9de64
[]
no_license
y701311/MyOthello
5bcc63e1b3e5b2c8bde16701a68c650eb3f11c6b
391890cbed7043446a9b9f62278b724ace514752
refs/heads/main
2023-02-15T18:30:23.037164
2020-12-31T06:12:13
2020-12-31T06:12:13
325,511,429
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
10,985
cpp
#include <Siv3D.hpp> #include "othello.h" void const othello::drawGridLines() { for (auto i : { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) { Line(i * 60, 0, i * 60, 480).draw(2, ColorF(0.2)); Line(0, i * 60, 480, i * 60).draw(2, ColorF(0.2)); } } void const othello::drawCells() { for (int32 i = 1; i < 9; i++) { for (int32 j = 1; j < 9; j++) { const Rect cell((j - 1) * CellSize, (i - 1) * CellSize, CellSize, CellSize); if (board[i][j] == black) { Circle(cell.center(), CellSize * 0.4).draw(Palette::Black); continue; } else if (board[i][j] == white) { Circle(cell.center(), CellSize * 0.4).draw(Palette::White); continue; } if (cell.mouseOver()) { Cursor::RequestStyle(CursorStyle::Hand); cell.stretched(-2).draw(ColorF(1.0, 0.6)); } } } } void othello::makeButtons() { if (SimpleGUI::ButtonAt(U"Pass", Vec2(580, 0))) { turn++; } } void othello::draw() { ClearPrint(); if (!end) { if (turn % 2) { Print << U"黒のターンです。"; } else { Print << U"白のターンです。"; } } if (end) { last(); } drawGridLines(); drawCells(); if (!end) { makeButtons(); } } void othello::start() { turn = 1; end = false; for (int32 i = 0; i < 10; i++) { for (int32 j = 0; j < 10; j++) { board[i][j] = 0; boardBefore[i][j] = 0; } } board[4][4] = white; board[5][5] = white; board[4][5] = black; board[5][4] = black; boardBefore[4][4] = white; boardBefore[5][5] = white; boardBefore[4][5] = black; boardBefore[5][4] = black; } void othello::turnOver(int32 x, int32 y) { int32 i; for (i = x - 1; board[i][y] * -1 == board[x][y]; i--) {// 縦 if (board[i - 1][y] == board[x][y]) { for (i = x - 1; board[i][y] * -1 == board[x][y]; i--) { board[i][y] *= -1; } break; } } for (i = x + 1; board[i][y] * -1 == board[x][y]; i++) { if (board[i + 1][y] == board[x][y]) { for (i = x + 1; board[i][y] * -1 == board[x][y]; i++) { board[i][y] *= -1; } break; } } for (i = y - 1; board[x][i] * -1 == board[x][y]; i--) {// 横 if (board[x][i - 1] == board[x][y]) { for (i = y - 1; board[x][i] * -1 == board[x][y]; i--) { board[x][i] *= -1; } break; } } for (i = y + 1; board[x][i] * -1 == board[x][y]; i++) { if (board[x][i + 1] == board[x][y]) { for (i = y + 1; board[x][i] * -1 == board[x][y]; i++) { board[x][i] *= -1; } break; } } for (i = 1; board[x - i][y - i] * -1 == board[x][y]; i++) {// 左斜め if (board[x - i - 1][y - i - 1] == board[x][y]) { for (i = 1; board[x - i][y - i] * -1 == board[x][y]; i++) { board[x - i][y - i] *= -1; } break; } } for (i = 1; board[x + i][y + i] * -1 == board[x][y]; i++) { if (board[x + i + 1][y + i + 1] == board[x][y]) { for (i = 1; board[x + i][y + i] * -1 == board[x][y]; i++) { board[x + i][y + i] *= -1; } break; } } for (i = 1; board[x + i][y - i] * -1 == board[x][y]; i++) {// 右斜め if (board[x + i + 1][y - i - 1] == board[x][y]) { for (i = 1; board[x + i][y - i] * -1 == board[x][y]; i++) { board[x + i][y - i] *= -1; } break; } } for (i = 1; board[x - i][y + i] * -1 == board[x][y]; i++) { if (board[x - i - 1][y + i + 1] == board[x][y]) { for (i = 1; board[x - i][y + i] * -1 == board[x][y]; i++) { board[x - i][y + i] *= -1; } break; } } } int32 othello::judge(int32 x, int32 y) { int32 i, can = 0; for (i = x - 1; board[i][y] * -1 == board[x][y]; i--) {// 縦 if (board[i - 1][y] == board[x][y]) { can = 1; break; } } for (i = x + 1; board[i][y] * -1 == board[x][y]; i++) { if (board[i + 1][y] == board[x][y]) { can = 1; break; } } for (i = y - 1; board[x][i] * -1 == board[x][y]; i--) {// 横 if (board[x][i - 1] == board[x][y]) { can = 1; break; } } for (i = y + 1; board[x][i] * -1 == board[x][y]; i++) { if (board[x][i + 1] == board[x][y]) { can = 1; break; } } for (i = 1; board[x - i][y - i] * -1 == board[x][y]; i++) {// 左斜め if (board[x - i - 1][y - i - 1] == board[x][y]) { can = 1; break; } } for (i = 1; board[x + i][y + i] * -1 == board[x][y]; i++) { if (board[x + i + 1][y + i + 1] == board[x][y]) { can = 1; break; } } for (i = 1; board[x + i][y - i] * -1 == board[x][y]; i++) {// 右斜め if (board[x + i + 1][y - i - 1] == board[x][y]) { can = 1; break; } } for (i = 1; board[x - i][y + i] * -1 == board[x][y]; i++) { if (board[x - i - 1][y + i + 1] == board[x][y]) { can = 1; break; } } return can; } int32 othello::canPutColor(int32 x, int32 y) { if (board[x][y] == 0) { board[x][y] = color; if (judge(x, y)) { board[x][y] = 0; return 1; } board[x][y] = 0; } return 0; } void othello::nomalSelect() { for (int32 i = 1; i < 9; i++) { for (int32 j = 1; j < 9; j++) { const Rect cell((j - 1) * CellSize, (i - 1) * CellSize, CellSize, CellSize); if ((board[i][j] == 0) && cell.leftClicked()) { if (canPutColor(i, j)) { board[i][j] = color; turnOver(i, j); if (postProcess()) { end = true; } } } } } } int32 othello::cornerSelect() { bool corner = false; if (canPutColor(1, 1)) { board[1][1] = color; turnOver(1, 1); corner = true; } if (canPutColor(1, 8)) { board[1][8] = color; turnOver(1, 8); corner = true; } if (canPutColor(8, 1)) { board[8][1] = color; turnOver(8, 1); corner = true; } if (canPutColor(8, 8)) { board[8][8] = color; turnOver(8, 8); corner = true; } if (corner) { if (postProcess()) { end = true; } return 1; } return 0; } int32 othello::rondomSelect() { int32 i, j; int32 x, y; int32 can = 0; int32 cornerCancel = 0; for (i = 1; i < 9; i++) { for (j = 1; j < 9; j++) { if (canPutColor(i, j)) { can++; } } } if (can == 0) { turn++; return 0; } srand((unsigned)time(NULL)); while (1) { x = rand() % 8 + 1; y = rand() % 8 + 1; if (canPutColor(x, y)) { board[x][y] = color; turnOver(x, y); if (cornerCancel > 15) { break; } color *= -1; if (canPutColor(1, 1) || canPutColor(8, 1) || canPutColor(1, 8) || canPutColor(8, 8)) { color *= -1; cornerCancel++; for (i = 1; i < 9; i++) { for (j = 1; j < 9; j++) { board[i][j] = boardBefore[i][j]; } } } else { break; } } } if (postProcess()) { end = true; } return 0; } int32 othello::count(int32 x, int32 y) { int32 i, countKoma = 0; for (i = x - 1; board[i][y] * -1 == board[x][y]; i--) {// 縦 if (board[i - 1][y] == board[x][y]) { for (i = x - 1; board[i][y] * -1 == board[x][y]; i--) { countKoma++; } break; } } for (i = x + 1; board[i][y] * -1 == board[x][y]; i++) { if (board[i + 1][y] == board[x][y]) { for (i = x + 1; board[i][y] * -1 == board[x][y]; i++) { countKoma++; } break; } } for (i = y - 1; board[x][i] * -1 == board[x][y]; i--) {// 横 if (board[x][i - 1] == board[x][y]) { for (i = y - 1; board[x][i] * -1 == board[x][y]; i--) { countKoma++; } break; } } for (i = y + 1; board[x][i] * -1 == board[x][y]; i++) { if (board[x][i + 1] == board[x][y]) { for (i = y + 1; board[x][i] * -1 == board[x][y]; i++) { countKoma++; } break; } } for (i = 1; board[x - i][y - i] * -1 == board[x][y]; i++) {// 左斜め if (board[x - i - 1][y - i - 1] == board[x][y]) { for (i = 1; board[x - i][y - i] * -1 == board[x][y]; i++) { countKoma++; } break; } } for (i = 1; board[x + i][y + i] * -1 == board[x][y]; i++) { if (board[x + i + 1][y + i + 1] == board[x][y]) { for (i = 1; board[x + i][y + i] * -1 == board[x][y]; i++) { countKoma++; } break; } } for (i = 1; board[x + i][y - i] * -1 == board[x][y]; i++) {// 右斜め if (board[x + i + 1][y - i - 1] == board[x][y]) { for (i = 1; board[x + i][y - i] * -1 == board[x][y]; i++) { countKoma++; } break; } } for (i = 1; board[x - i][y + i] * -1 == board[x][y]; i++) { if (board[x - i - 1][y + i + 1] == board[x][y]) { for (i = 1; board[x - i][y + i] * -1 == board[x][y]; i++) { countKoma++; } break; } } return countKoma; } int32 othello::maxSelect() { int32 i, j; int32 x[60] = { 0 }, y[60] = { 0 }; int32 can = 0; int32 countColor, max = 1, maxPlace = 0; int32 cornerCancel = 0; for (i = 1; i < 9; i++) { for (j = 1; j < 9; j++) { if (canPutColor(i, j)) { can++; } } } if (can == 0) { turn++; return 0; } for (i = 1; i < 9; i++) { for (j = 1; j < 9; j++) { if (board[i][j] == 0) { board[i][j] = color; countColor = count(i, j); board[i][j] = 0; if (max < countColor) { max = countColor; for (int32 c = 0; c <= maxPlace; c++) { x[c] = 0; y[c] = 0; } maxPlace = 0; } if (max == countColor) { x[maxPlace] = i; y[maxPlace] = j; maxPlace++; } } } } srand((unsigned)time(NULL)); while (1) { int32 k = rand() % maxPlace; board[x[k]][y[k]] = color; turnOver(x[k], y[k]); if (cornerCancel > 15) { break; } color *= -1; if (canPutColor(1, 1) || canPutColor(8, 1) || canPutColor(1, 8) || canPutColor(8, 8)) { color *= -1; cornerCancel++; for (i = 1; i < 9; i++) { for (j = 1; j < 9; j++) { board[i][j] = boardBefore[i][j]; } } } else { break; } } if (postProcess()) { end = true; } return 0; } int othello::postProcess() { int32 can_put = 0; for (int32 i = 1; i < 9; i++) { for (int32 j = 1; j < 9; j++) { boardBefore[i][j] = board[i][j]; } } for (int32 i = 1; i < 9; i++) { for (int32 j = 1; j < 9; j++) { color = black; if (canPutColor(i, j)) { can_put++; } color = white; if (canPutColor(i, j)) { can_put++; } } } turn++; if (can_put > 0) { return 0; } else { return 1; } } void othello::last() { int32 black_count = 0, white_count = 0; for (int32 i = 1; i < 9; i++) { for (int32 j = 1; j < 9; j++) { if (board[i][j] == black) { black_count++; } if (board[i][j] == white) { white_count++; } } } if (black_count > white_count) { Print << U"黒の勝ち!"; } else if (white_count > black_count) { Print << U"白の勝ち!"; } else { Print << U"引き分け!"; } Print << U""; Print << U"黒 … " << black_count << U" " << U"白 … " << white_count; }
[ "noreply@github.com" ]
noreply@github.com
ed1a734eabf24b3340460ca87d838cf132c8126d
c76e78581983830158b2a6f56b807e37132f4bba
/CSES/p1071.cpp
3d13a6caabf6f604e0234b6245abbbd9a6e75647
[]
no_license
itslinotlie/competitive-programming-solutions
7f72e27bbc53046174a95246598c3c9c2096b965
b639ebe3c060bb3c0b304080152cc9d958e52bfb
refs/heads/master
2021-07-17T17:48:42.639357
2021-05-29T03:07:47
2021-05-29T03:07:47
249,599,291
2
1
null
null
null
null
UTF-8
C++
false
false
909
cpp
// 02/21/2021 // https://cses.fi/problemset/task/1071 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define CLR(a) memset(a, 0, sizeof(a)) #define REP(i, n) for(int i=0;i<n;i++) #define FOR(i, n) for(int i=1;i<=n;i++) #define all(c) (c).begin(), (c).end() #define F first #define S second inline ll gcd(ll a, ll b) {return b==0? a:gcd(b, a%b);} inline ll lcm(ll a, ll b) {return a*b/gcd(a, b);} int t(1), r, c; void solve() { cin >> r >> c; ll mx = max(r, c), mn = min(r, c), cur = mx*mx-(mx-1); if(mx%2) { //up is inc if(r==mx) cout << cur-(mx-c) << endl; else cout << cur+(mx-r) << endl; } else { //up is dec if(r==mx) cout << cur+(mx-c) << endl; else cout << cur-(mx-r) << endl; } } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> t; for (int i=1;i<=t;i++) { solve(); } }
[ "michael.li.web@gmail.com" ]
michael.li.web@gmail.com
02527cfb3ff5e8378c2a4bdd3b687749b261a99f
3b7c25ab09fe4527d7ec2f590a4d5a5dd52a26a1
/ESP2/ESP2.ino
b62f9698a022cc25069378d67ca4ab4eb5871e1e
[]
no_license
alfredovaldes/telecom
1f16e294ad5f35e1c1c30871063493af16e33988
49358701d50341f16a3aec56cda8cfe2ea4aa72f
refs/heads/master
2020-03-11T22:01:24.751023
2018-05-02T17:26:47
2018-05-02T17:26:47
130,280,897
0
0
null
null
null
null
UTF-8
C++
false
false
3,873
ino
#include <ESP8266WiFi.h> extern "C" { #include <espnow.h> } #include <ArduinoJson.h> #include <Wire.h> #include <Adafruit_BMP085.h> Adafruit_BMP085 bmp; //***ESTRUCTURA DE LOS DATOS TRANSMITIDOS MAESTRO/ESCLAVO***// //Se de establecer IGUAL en el par esclavo struct ESTRUCTURA_DATOS { char payload[1000]; }; void setup() { //***INICIALIZACIÓN DEL PUERTO SERIE***// Serial.begin(115200); Wire.pins(D1, D2); Wire.begin(D1, D2); if (!bmp.begin()) { Serial.println("No BMP180 / BMP085");// we dont wait for this //while (1) {} } //***INICIALIZACIÓN DEL PROTOCOLO ESP-NOW***// if (esp_now_init() != 0) { Serial.println("*** ESP_Now init failed"); ESP.restart(); delay(1); } //***DATOS DE LAS MAC (Access Point y Station) del ESP***// Serial.print("Access Point MAC de este ESP: "); Serial.println(WiFi.softAPmacAddress()); Serial.print("Station MAC de este ESP: "); Serial.println(WiFi.macAddress()); //***DECLARACIÓN DEL PAPEL DEL DISPOSITIVO ESP EN LA COMUNICACIÓN***// //0=OCIOSO, 1=MAESTRO, 2=ESCLAVO y 3=MAESTRO+ESCLAVO esp_now_set_self_role(1); //***EMPAREJAMIENTO CON EL ESCLAVO***// // Dirección MAC del ESP con el que se empareja (esclavo) // Se debe introducir la STA MAC correspondiente uint8_t mac_addr[6] = {0x5c, 0xcf, 0x7f, 0x86, 0x08, 0x54}; uint8_t role = 2; uint8_t channel = 3; uint8_t key[0] = {}; //no hay clave //uint8_t key[16] = {0,255,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; uint8_t key_len = sizeof(key); Serial.print("Tamaño de *key: "); Serial.println(key_len); esp_now_add_peer(mac_addr, role, channel, key, key_len); } float temp[10]; float pres[10]; float alti[10]; float avgTemp; float avgPres; float avgAlti; float average (float * array, int len) // assuming array is int. { long sum = 0L ; // sum will be larger than an item, long for safety. for (int i = 0 ; i < len ; i++) sum += array [i] ; return ((float) sum) / len ; // average will be fractional, so float may be appropriate. } StaticJsonBuffer<300> JSONbuffer; //Declaramos objeto JSON JsonObject& JSONencoder = JSONbuffer.createObject(); JsonObject& values = JSONencoder.createNestedObject("ESP2"); char JSONmessageBuffer[1000]; void loop() { sensorData(); //JSON DE //Agregamos datos al JSON values["lux"] = Light(analogRead(A0)); values["presBar"] = avgPres; values["altitud"] = avgAlti; JSONencoder.prettyPrintTo(JSONmessageBuffer, sizeof(JSONmessageBuffer)); //***DATOS A ENVIAR***// ESTRUCTURA_DATOS ED; // ED.payload = JSONmessageBuffer; std::copy(std::begin(JSONmessageBuffer), std::end(JSONmessageBuffer), std::begin(ED.payload)); //***ENVÍO DE LOS DATOS***// //uint8_t *da=NULL; //NULL envía los datos a todos los ESP con los que está emparejado uint8_t da[6] = {0x5E, 0xCF, 0x7F, 0x86, 0x08, 0x54}; uint8_t data[sizeof(ED)]; memcpy(data, &ED, sizeof(ED)); uint8_t len = sizeof(data); esp_now_send(da, data, len); delay(1); //Si se pierden datos en la recepción se debe subir este valor //***VERIFICACIÓN DE LA RECEPCIÓN CORRECTA DE LOS DATOS POR EL ESCLAVO***// esp_now_register_send_cb([](uint8_t* mac, uint8_t status) { char MACesclavo[6]; sprintf(MACesclavo, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); Serial.print(". Enviado a ESP MAC: "); Serial.print(MACesclavo); Serial.print(". Recepcion (0=0K - 1=ERROR): "); Serial.println(status); }); delay(10000); } double Light (int RawADC0) { double Vout = RawADC0 * 0.0048828125; int lux = (2400 / Vout - 330) / 9.97; return lux; } void sensorData() { for (int i = 0; i < 10; i++) { temp[i] = bmp.readTemperature(); pres[i] = bmp.readPressure(); alti[i] = bmp.readAltitude(102300); } avgTemp = average(temp, 10); avgPres = average(pres, 10); avgAlti = average(alti, 10); }
[ "alfredovaldes@uadec.edu.mx" ]
alfredovaldes@uadec.edu.mx
4d68627fb14832cf36f4fabc86079b3d5fc950f2
9de23d5d8982b512238f3ea367531af42a5c5917
/src/AflUnicornEngine.h
fe3b5b5456ffd518b3aee04e4cfcf0c8fde029b1
[]
no_license
Asll666/unicorn-fuzzer
d0ea23a1620a8ee60e20e008687342126d65c514
51aecf91f691b174eb1465e6eb8a5b48bebba05b
refs/heads/master
2022-02-10T19:51:49.674208
2019-08-29T15:05:27
2019-08-29T15:05:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,382
h
#ifndef _AFLUNICORNENGINE #define _AFLUNICORNENGINE #include <iostream> #include <fstream> #include <string> #include <vector> #include <map> #include <algorithm> #include <unicorn/unicorn.h> #include <zlib.h> #include <nlohmann/json.hpp> #include <cstdio> #include <cstdint> #include <csignal> #define DEBUG(fmt,...) do { \ if (debug_trace) { printf(fmt, ##__VA_ARGS__); putchar('\n'); } \ } while (0) #define uc_assert_err(expect, err) \ do { \ uc_err __err = err; \ if (__err != expect) { \ fprintf(stderr, "%s", uc_strerror(__err)); \ exit(1); \ } \ } while (0) #define uc_assert_success(err) uc_assert_err(UC_ERR_OK, err) extern void _error(const char* err_msg); using json = nlohmann::json; typedef std::map<std::string, int> Regmap; #pragma pack(push, 1) struct SegmentDescriptor { union { struct { #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned short limit0; unsigned short base0; unsigned char base1; unsigned char type:4; unsigned char system:1; /* S flag */ unsigned char dpl:2; unsigned char present:1; /* P flag */ unsigned char limit1:4; unsigned char avail:1; unsigned char is_64_code:1; /* L flag */ unsigned char db:1; /* DB flag */ unsigned char granularity:1; /* G flag */ unsigned char base2; #else unsigned char base2; unsigned char granularity:1; /* G flag */ unsigned char db:1; /* DB flag */ unsigned char is_64_code:1; /* L flag */ unsigned char avail:1; unsigned char limit1:4; unsigned char present:1; /* P flag */ unsigned char dpl:2; unsigned char system:1; /* S flag */ unsigned char type:4; unsigned char base1; unsigned short base0; unsigned short limit0; #endif }; uint64_t desc; }; }; #pragma pack(pop) #define SEGBASE(d) ((uint32_t)((((d).desc >> 16) & 0xffffff) | (((d).desc >> 32) & 0xff000000))) #define SEGLIMIT(d) ((d).limit0 | (((unsigned int)(d).limit1) << 16)) //VERY basic descriptor init function, sets many fields to user space sane defaults static void init_descriptor(struct SegmentDescriptor *desc, uint32_t base, uint32_t limit, uint8_t is_code); struct uc_settings{ uc_arch arch; uc_mode mode; }; class AflUnicornEngine{ private: uc_engine *uc; uc_settings uc_set; bool debug_trace; public: AflUnicornEngine(const std::string context_dir, bool enable_trace=false, bool _debug_trace=false); void _map_segments(const json& segment_list, const std::string context_dir); void _map_segment(const std::string name, const uint64_t address, const uint64_t size, int perms); void mapGDT(const uint32_t fs_addr); void dump_regs() const; void force_crash(uc_err err) const; uc_settings _get_arch_and_mode(const std::string arch_str) const; Regmap _get_register_map(uc_mode mode) const; uc_engine* get_uc() const; }; #endif
[ "goodcrane3@naver.com" ]
goodcrane3@naver.com
b077985e89acf4d2240a65e64906d63f3b894648
8b3bd5278095c70d34a4fd8dbcee6ffe4b356067
/dpi.cpp
dc813678c7b93cd24d9d942e5489a1626b1ecb4f
[]
no_license
Jackfrost2639/ex
5d1c963aeb69f7e57cbc40612feb40c0b76c0b2f
dbd5897934a2fe55b6bb5601b78613e101015ec1
refs/heads/master
2021-06-27T03:25:51.508201
2021-03-30T12:07:36
2021-03-30T12:07:36
220,775,367
0
0
null
null
null
null
UTF-8
C++
false
false
882
cpp
#include <bits/stdc++.h> #define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false) #define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false) #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " using namespace std; int n; double prob[3001]; double dp[3001][3001]; int main() { cin >> n; for(int i = 1; i <= n; i++) { cin >> prob[i]; } dp[0][0] = 1; for(int i = 1; i <= n; i++) { for(int j = 0; j <= n; j++) { if(j) { dp[i][j] = dp[i-1][j-1] * prob[i] + dp[i-1][j] * (1-prob[i]); } else { dp[i][j] = dp[i-1][j] * (1-prob[i]); } } } double ans = 0; for(int i = (n+1)/2; i <= n; i++) { ans += dp[n][i]; } cout << setprecision(9); cout << ans << endl; return 0; }
[ "hellobye587846@gmail.com" ]
hellobye587846@gmail.com
86a9ecbf94855113c45bf2898013c0c9d8482db6
a76cfebebfe17ae4ad91a8faf08c45fff6994471
/cs4514/Proj2/FileTransferProtocol.cpp
f08ce626fcaedfb18504462622c8369941c17af6
[]
no_license
pete0877/wpi
b5e3163852ab6359bcb838c6ec9cafbaddac4004
9841753596c6e72facec7f4236d37a9d35b66c0b
refs/heads/master
2021-01-02T08:21:47.787986
2015-04-03T21:17:56
2015-04-03T21:17:56
33,380,551
0
0
null
null
null
null
UTF-8
C++
false
false
3,423
cpp
///////////////////////////////////////////////////////////////////////////// // FileTransferProtocol.cpp // // Version 1.00 // // This class implements File Transfer Protocol. // ///////////////////////////////////////////////////////////////////////////// #include "FileTransferProtocol.h" ///////////////////////////////////////////////////////////////////////////// // FileTransferProtocol Implementation FileTransferProtocol::FileTransferProtocol(Socket *socket) { m_socket = socket; } FileTransferProtocol::~FileTransferProtocol() { ; } void FileTransferProtocol::recvFile(String filename) { cout << "FTP: Receiving '" << filename << "'..." << endl; int count = 0, total = 0; byte buffer[MESSAGE_DATA_SIZE]; Message msg; ofstream file(filename); // Check whether a file was successfully opened. if (!file) { cout << "FTP: Unable to open '" << filename << "' for writing." << endl; throw FileException(); } // Receive the first message. recvMessage(msg); // While the message contains data, write it out to // the file. while (msg.cmd == cmdData) { #ifdef _DEBUG cout << "FTP: \t" << msg.size << " bytes received." << endl; #endif total += count = msg.size; bcopy (buffer, msg.data, count); file.write(buffer, count); recvMessage(msg); } // A successful transfer is terminated by a message // containing cmdEnd. if (msg.cmd != cmdEnd) throw FileException(); cout << "FTP: '" << filename << "' received successfully. " << endl; cout << "FTP: Total of " << total << " bytes received." << endl; file.close(); } void FileTransferProtocol::sendFile(String filename) { cout << "FTP: Sending '" << filename << "'..." << endl; int count = 0, total = 0; byte buffer[MESSAGE_DATA_SIZE]; Message msg; ifstream file(filename); // Check whether a file was successfully created. if (!file) { cout << "FTP: Unable to open '" << filename << "' for reading." << endl; msg.cmd = cmdErr; sendMessage(msg); throw FileException(); } // Send the file in chunks of data. while (file.eof() == 0) { file.read(buffer, sizeof(buffer)); msg.cmd = cmdData; total += msg.size = file.gcount(); bcopy (msg.data, buffer, msg.size); sendMessage(msg); #ifdef _DEBUG cout << "FTP: \t" << msg.size << " bytes sent." << endl; #endif } // Acknowledge successful completion of a transfer by // sending cmdEnd. msg.cmd = cmdEnd; sendMessage(msg); cout << "FTP: '" << filename << "' transfered successfully. " << endl; cout << "FTP: Total of " << total << " bytes sent." << endl; file.close(); } void FileTransferProtocol::getCommand (Command &cmd, byte data[], int size) { Message msg; recvMessage(msg); cmd = msg.cmd; size = (msg.size > size) ? size : msg.size; bcopy(data, msg.data, size); } void FileTransferProtocol::putCommand (Command cmd, byte data[], int size) { Message msg; msg.cmd = cmd; msg.size = (size > sizeof(msg.data)) ? sizeof(msg.data) : size; bcopy(msg.data, data, msg.size); sendMessage(msg); } void FileTransferProtocol::recvMessage (Message &msg) { m_socket->recv((void *) &msg, sizeof(Message)); } void FileTransferProtocol::sendMessage (Message &msg) { m_socket->send((void *) &msg, sizeof(Message)); } void FileTransferProtocol::bcopy (byte dest[], byte src[], int length) { while (length--) *dest++ = *src++; } // END OF FILETRANSFERPROTOCOL.H ////////////////////////////////////////////
[ "pete@pixability.com" ]
pete@pixability.com
02806a2a49a22fb6bd57cfab65b9f86f0cc29e6a
1f58935b873f3072404f28b17209f2593e283011
/Level/TileType.h
813b1f971eefcf0718baafbde4c0366b027b2d28
[]
no_license
LuisEduardoReis/ores-clone
83a8604abbfbe3b71c9ba677c9f971e1981d25a6
6f33c2067a907918e73ceacee074c5a7dff30b5e
refs/heads/master
2021-06-24T07:04:06.022513
2021-06-06T19:06:43
2021-06-06T19:06:59
127,788,069
0
0
null
null
null
null
UTF-8
C++
false
false
1,015
h
// // Created by luis.reis on 27-03-2018. // #ifndef ORESCLONE_TILE_H #define ORESCLONE_TILE_H #include <utility> #include <vector> #include "../Graphics/Graphics.h" class TileType; typedef const TileType* TileTypeRef; /** * "Enum" class that defines all types of tile. */ class TileType { private: static TileType _EMPTY; TileType() : TileType("Empty", nullptr, 0,0) {}; TileType(const std::string& name, SDL_Texture* texture, int tx, int ty); public: std::string name = ""; TextureRegion ore_sprite; TextureRegion resource_sprite; static std::unordered_map<std::string, TileTypeRef> TILES_MAP; static std::vector<TileType> TILES; static TileTypeRef EMPTY; static TileTypeRef getRandomTile(); static void initTiles(Graphics& graphics); static TileTypeRef getTileByName(const std::string &name); bool operator==(const TileType& rhs) const; bool operator!=(const TileType& rhs) const; }; class UnknownTileException {}; #endif //ORESCLONE_TILE_H
[ "luis.reis@feedzai.com" ]
luis.reis@feedzai.com
54301ee7425682857e0b445047b59c932d0ed9a5
f1ccee2c7ab3d39151c82ee58076e4198e5ab99d
/c++/membershipopp.cpp
6d23e6173082364119b2183a709475fcbb241396
[]
no_license
sreeramjeeyar/learningSeries
f2d3ebc857cfaca40badb0389de82de83e6c3b69
34a9c1c8ac7979fa614bef96006affe0dcbfbbba
refs/heads/master
2020-05-19T21:23:06.357631
2019-08-27T01:07:51
2019-08-27T01:07:51
185,222,637
1
0
null
2019-05-06T15:59:45
2019-05-06T15:22:45
null
UTF-8
C++
false
false
372
cpp
#include <iostream> using namespace std; struct S { float a; int b; int c; }; int main( int argc, char ** argv ) { struct S s={55.023,10,15}; struct S *sp=&s; printf("the struct is a:%d b:%d c:%d\n",s.a,s.b,s.c); //membership operator . printf("the struct is a:%f b:%d c:%d\n",sp->a,sp->b,sp->c); //dereference operator used -> return 0; }
[ "noreply@github.com" ]
noreply@github.com
1cc55da4e2533f1e25c1b812a20ebef39f5cf425
e3377683f87206ed1de5e3d8a5ff34463873c817
/Validators.cpp
c69644edc3ef865a196404b65cd0dd7b9549f4b1
[]
no_license
senpaiburado/SushiOne
fad046d76390971328140cf3d5e4ada70b8637ac
46ac4381d61395a9a7365bae6f07424ae5a580f2
refs/heads/main
2023-07-09T19:11:05.325971
2021-08-17T10:48:52
2021-08-17T10:48:52
396,759,874
0
0
null
null
null
null
UTF-8
C++
false
false
1,932
cpp
#include "Validators.h" #include <QRegExp> #include <QRegularExpression> void Validator::setChainList(IValidator *chainList) { m_chainList = chainList; } ValidatorErrorPtr Validator::isValid() { if (m_chainList != nullptr) { return m_chainList->isValid(); } ValidatorErrorPtr error = ValidatorErrorPtr(new ValidatorError, &QObject::deleteLater); error->setValidator(metaObject()->className()); error->setDescription("Chain is not set"); return error; } EmailValidator::EmailValidator(const QString &email) : BaseValidator() { m_email = email; } ValidatorErrorPtr EmailValidator::isValid() { if (!m_email.length()) return createError("Email is not set"); QRegExp mailREX("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b"); mailREX.setCaseSensitivity(Qt::CaseInsensitive); mailREX.setPatternSyntax(QRegExp::RegExp); if (mailREX.exactMatch(m_email)) { if (m_next != nullptr) return m_next->isValid(); return nullptr; } return createError("Email is invalid"); } PhoneValidator::PhoneValidator(const QString &phone) : BaseValidator() { m_phone = phone; } ValidatorErrorPtr PhoneValidator::isValid() { if (!m_phone.length()) return createError("Phone is not set"); QRegExp phoneREX("^\\+?3?8?(0\\d{9})$"); phoneREX.setPatternSyntax(QRegExp::RegExp); if (phoneREX.exactMatch(m_phone)) { if (m_next != nullptr) return m_next->isValid(); return nullptr; } return createError("Phone is invalid"); } DateIsNotPastValidator::DateIsNotPastValidator(const QDate &date) : BaseValidator() { m_date = date; } ValidatorErrorPtr DateIsNotPastValidator::isValid() { if (m_date > QDate::currentDate()) { if (m_next != nullptr) return m_next->isValid(); return nullptr; } return createError("Date is past!"); }
[ "minerminer354@gmail.com" ]
minerminer354@gmail.com
624b68f380cda5e295c9dc07ebac186cdf7aeb6a
91fb47823359c27572e39f94ee82ad293eec009a
/hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.cpp
7de940b63ec31a8937272eb1dc3cfa30dbdf254e
[ "Apache-2.0" ]
permissive
ken2190/hummingbot_Modificado
793e35ac12226cdedea90204f62d8c55174b31e4
8f8c7dd3cc5579044f560212f598f76699898442
refs/heads/master
2022-11-16T03:54:25.333688
2020-06-10T15:44:02
2020-06-10T15:44:02
null
0
0
null
null
null
null
UTF-8
C++
false
true
297,078
cpp
/* Generated by Cython 0.29.15 */ /* BEGIN: Cython Metadata { "distutils": { "language": "c++", "name": "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order", "sources": [ "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx" ] }, "module_name": "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order" } END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else #define CYTHON_ABI "0_29_15" #define CYTHON_HEX_VERSION 0x001D0FF0 #define CYTHON_FUTURE_DIVISION 1 #include <stddef.h> #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x02070000 #define HAVE_LONG_LONG #endif #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #undef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if PY_VERSION_HEX < 0x030300F0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif #ifndef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) #endif #ifndef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR # if defined(__cplusplus) template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } # else # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 typedef unsigned char uint8_t; typedef unsigned int uint32_t; #else typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; #endif #endif #else #include <stdint.h> #endif #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) && __cplusplus >= 201103L #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #elif __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__ ) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." #endif #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #else #define CYTHON_INLINE inline #endif #endif template<typename T> void __Pyx_call_destructor(T& x) { x.~T(); } template<typename T> class __Pyx_FakeReference { public: __Pyx_FakeReference() : ptr(NULL) { } __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { } T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } template<typename U> bool operator ==(U other) { return *ptr == other; } template<typename U> bool operator !=(U other) { return *ptr != other; } private: T *ptr; }; #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 #define PyMem_RawMalloc(n) PyMem_Malloc(n) #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) #define PyMem_RawFree(p) PyMem_Free(p) #endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #elif PY_VERSION_HEX >= 0x03000000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 typedef int Py_tss_t; static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { *key = PyThread_create_key(); return 0; } static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); *key = Py_tss_NEEDS_INIT; return key; } static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { PyObject_Free(key); } static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { return *key != Py_tss_NEEDS_INIT; } static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { PyThread_delete_key(*key); *key = Py_tss_NEEDS_INIT; } static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { return PyThread_set_key_value(*key, value); } static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) #else #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 #define PyUnicode_2BYTE_KIND 2 #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef __Pyx_PyAsyncMethodsStruct typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include <math.h> #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__hummingbot__market__bitcoin_com__bitcoin_com_in_flight_order #define __PYX_HAVE_API__hummingbot__market__bitcoin_com__bitcoin_com_in_flight_order /* Early includes */ #ifdef _OPENMP #include <omp.h> #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #if defined (__cplusplus) && __cplusplus >= 201103L #include <cstdlib> #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx", "stringsource", }; /*--- Type declarations ---*/ struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase; struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder; /* "hummingbot/market/in_flight_order_base.pxd":1 * cdef class InFlightOrderBase: # <<<<<<<<<<<<<< * cdef: * public object market_class */ struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase { PyObject_HEAD PyObject *market_class; PyObject *client_order_id; PyObject *exchange_order_id; PyObject *trading_pair; PyObject *order_type; PyObject *trade_type; PyObject *price; PyObject *amount; PyObject *executed_amount_base; PyObject *executed_amount_quote; PyObject *fee_asset; PyObject *fee_paid; PyObject *last_state; PyObject *exchange_order_id_update_event; }; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pxd":3 * from hummingbot.market.in_flight_order_base cimport InFlightOrderBase * * cdef class BitcoinComInFlightOrder(InFlightOrderBase): # <<<<<<<<<<<<<< * pass */ struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder { struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase __pyx_base; }; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __pyx_dict_cached_value;\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } #define __Pyx_GetModuleGlobalNameUncached(var, name) {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif /* IncludeStringH.proto */ #include <string.h> /* BytesEquals.proto */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* PyUnicode_Unicode.proto */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); /* JoinPyUnicode.proto */ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name)\ (likely(PyDict_CheckExact(obj)) ?\ __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* PyObjectCall2Args.proto */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyErrExceptionMatches.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* GetAttr3.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ __Pyx_GetItemInt_Generic(o, to_py_func(i)))) #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /* CallNextTpDealloc.proto */ static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); /* CallNextTpTraverse.proto */ static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); /* CallNextTpClear.proto */ static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); /* TypeImport.proto */ #ifndef __PYX_HAVE_RT_ImportType_proto #define __PYX_HAVE_RT_ImportType_proto enum __Pyx_ImportType_CheckSize { __Pyx_ImportType_CheckSize_Error = 0, __Pyx_ImportType_CheckSize_Warn = 1, __Pyx_ImportType_CheckSize_Ignore = 2 }; static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); #endif /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr #endif /* PyObject_GenericGetAttr.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); /* ClassMethod.proto */ #include "descrobject.h" static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method); /* GetNameInClass.proto */ #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #else static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'hummingbot.market.in_flight_order_base' */ static PyTypeObject *__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase = 0; /* Module declarations from 'hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order' */ static PyTypeObject *__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder = 0; static PyObject *__pyx_f_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder__set_state(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *, PyObject *); /*proto*/ #define __Pyx_MODULE_NAME "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order" extern int __pyx_module_is_main_hummingbot__market__bitcoin_com__bitcoin_com_in_flight_order; int __pyx_module_is_main_hummingbot__market__bitcoin_com__bitcoin_com_in_flight_order = 0; /* Implementation of 'hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order' */ static PyObject *__pyx_builtin_super; static const char __pyx_k_[] = " "; static const char __pyx_k_Any[] = "Any"; static const char __pyx_k_BUY[] = "BUY"; static const char __pyx_k_buy[] = "buy"; static const char __pyx_k_new[] = "new"; static const char __pyx_k_Dict[] = "Dict"; static const char __pyx_k_None[] = "None"; static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_sell[] = "sell"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_limit[] = "limit"; static const char __pyx_k_new_2[] = "__new__"; static const char __pyx_k_price[] = "price"; static const char __pyx_k_super[] = "super"; static const char __pyx_k_MARKET[] = "MARKET"; static const char __pyx_k_amount[] = "amount"; static const char __pyx_k_filled[] = "filled"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_market[] = "market"; static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_update[] = "update"; static const char __pyx_k_Decimal[] = "Decimal"; static const char __pyx_k_decimal[] = "decimal"; static const char __pyx_k_expired[] = "expired"; static const char __pyx_k_Optional[] = "Optional"; static const char __pyx_k_canceled[] = "canceled"; static const char __pyx_k_fee_paid[] = "fee_paid"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_OrderType[] = "OrderType"; static const char __pyx_k_TradeType[] = "TradeType"; static const char __pyx_k_fee_asset[] = "fee_asset"; static const char __pyx_k_from_json[] = "from_json"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_suspended[] = "suspended"; static const char __pyx_k_last_state[] = "last_state"; static const char __pyx_k_order_type[] = "order_type"; static const char __pyx_k_pyx_result[] = "__pyx_result"; static const char __pyx_k_trade_type[] = "trade_type"; static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_trading_pair[] = "trading_pair"; static const char __pyx_k_initial_state[] = "initial_state"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_client_order_id[] = "client_order_id"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_BitcoinComMarket[] = "BitcoinComMarket"; static const char __pyx_k_InFlightOrderBase[] = "InFlightOrderBase"; static const char __pyx_k_exchange_order_id[] = "exchange_order_id"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_executed_amount_base[] = "executed_amount_base"; static const char __pyx_k_executed_amount_quote[] = "executed_amount_quote"; static const char __pyx_k_BitcoinComInFlightOrder[] = "BitcoinComInFlightOrder"; static const char __pyx_k_hummingbot_core_event_events[] = "hummingbot.core.event.events"; static const char __pyx_k_pyx_unpickle_BitcoinComInFligh[] = "__pyx_unpickle_BitcoinComInFlightOrder"; static const char __pyx_k_Incompatible_checksums_s_vs_0x4a[] = "Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))"; static const char __pyx_k_hummingbot_market_bitcoin_com_bi[] = "hummingbot.market.bitcoin_com.bitcoin_com_market"; static const char __pyx_k_hummingbot_market_in_flight_orde[] = "hummingbot.market.in_flight_order_base"; static const char __pyx_k_hummingbot_market_bitcoin_com_bi_2[] = "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order"; static PyObject *__pyx_kp_u_; static PyObject *__pyx_n_s_Any; static PyObject *__pyx_n_s_BUY; static PyObject *__pyx_n_s_BitcoinComInFlightOrder; static PyObject *__pyx_n_s_BitcoinComMarket; static PyObject *__pyx_n_s_Decimal; static PyObject *__pyx_n_s_Dict; static PyObject *__pyx_n_s_InFlightOrderBase; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x4a; static PyObject *__pyx_n_s_MARKET; static PyObject *__pyx_kp_u_None; static PyObject *__pyx_n_s_Optional; static PyObject *__pyx_n_s_OrderType; static PyObject *__pyx_n_s_PickleError; static PyObject *__pyx_n_s_TradeType; static PyObject *__pyx_n_s_amount; static PyObject *__pyx_n_u_amount; static PyObject *__pyx_n_u_buy; static PyObject *__pyx_n_u_canceled; static PyObject *__pyx_n_s_client_order_id; static PyObject *__pyx_n_u_client_order_id; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_decimal; static PyObject *__pyx_n_s_dict; static PyObject *__pyx_n_s_exchange_order_id; static PyObject *__pyx_n_u_exchange_order_id; static PyObject *__pyx_n_u_executed_amount_base; static PyObject *__pyx_n_u_executed_amount_quote; static PyObject *__pyx_n_u_expired; static PyObject *__pyx_n_u_fee_asset; static PyObject *__pyx_n_u_fee_paid; static PyObject *__pyx_n_u_filled; static PyObject *__pyx_n_s_from_json; static PyObject *__pyx_n_s_getstate; static PyObject *__pyx_n_s_hummingbot_core_event_events; static PyObject *__pyx_n_s_hummingbot_market_bitcoin_com_bi; static PyObject *__pyx_n_s_hummingbot_market_bitcoin_com_bi_2; static PyObject *__pyx_n_s_hummingbot_market_in_flight_orde; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_initial_state; static PyObject *__pyx_n_u_last_state; static PyObject *__pyx_n_u_limit; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_u_market; static PyObject *__pyx_n_s_name; static PyObject *__pyx_n_u_new; static PyObject *__pyx_n_s_new_2; static PyObject *__pyx_n_s_order_type; static PyObject *__pyx_n_u_order_type; static PyObject *__pyx_n_s_pickle; static PyObject *__pyx_n_s_price; static PyObject *__pyx_n_u_price; static PyObject *__pyx_n_s_pyx_PickleError; static PyObject *__pyx_n_s_pyx_checksum; static PyObject *__pyx_n_s_pyx_result; static PyObject *__pyx_n_s_pyx_state; static PyObject *__pyx_n_s_pyx_type; static PyObject *__pyx_n_s_pyx_unpickle_BitcoinComInFligh; static PyObject *__pyx_n_s_reduce; static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_reduce_ex; static PyObject *__pyx_n_u_sell; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_super; static PyObject *__pyx_n_u_suspended; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_trade_type; static PyObject *__pyx_n_u_trade_type; static PyObject *__pyx_n_s_trading_pair; static PyObject *__pyx_n_u_trading_pair; static PyObject *__pyx_n_s_typing; static PyObject *__pyx_n_s_update; static int __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder___init__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self, PyObject *__pyx_v_client_order_id, PyObject *__pyx_v_exchange_order_id, PyObject *__pyx_v_trading_pair, PyObject *__pyx_v_order_type, PyObject *__pyx_v_trade_type, PyObject *__pyx_v_price, PyObject *__pyx_v_amount, PyObject *__pyx_v_initial_state); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7is_done___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_10is_failure___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_12is_cancelled___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_22order_type_description___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self); /* proto */ static struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_2from_json(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_data); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_4__reduce_cython__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_6__setstate_cython__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_77691215; static PyObject *__pyx_tuple__2; static PyObject *__pyx_codeobj__3; /* Late includes */ /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":17 * * cdef class BitcoinComInFlightOrder(InFlightOrderBase): * def __init__(self, # <<<<<<<<<<<<<< * client_order_id: str, * exchange_order_id: Optional[str], */ /* Python wrapper */ static int __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_client_order_id = 0; PyObject *__pyx_v_exchange_order_id = 0; PyObject *__pyx_v_trading_pair = 0; PyObject *__pyx_v_order_type = 0; PyObject *__pyx_v_trade_type = 0; PyObject *__pyx_v_price = 0; PyObject *__pyx_v_amount = 0; PyObject *__pyx_v_initial_state = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_client_order_id,&__pyx_n_s_exchange_order_id,&__pyx_n_s_trading_pair,&__pyx_n_s_order_type,&__pyx_n_s_trade_type,&__pyx_n_s_price,&__pyx_n_s_amount,&__pyx_n_s_initial_state,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; values[7] = ((PyObject*)__pyx_n_u_new); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_client_order_id)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchange_order_id)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, 1); __PYX_ERR(0, 17, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trading_pair)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, 2); __PYX_ERR(0, 17, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order_type)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, 3); __PYX_ERR(0, 17, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_type)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, 4); __PYX_ERR(0, 17, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_price)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, 5); __PYX_ERR(0, 17, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amount)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, 6); __PYX_ERR(0, 17, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_initial_state); if (value) { values[7] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 17, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_client_order_id = ((PyObject*)values[0]); __pyx_v_exchange_order_id = values[1]; __pyx_v_trading_pair = ((PyObject*)values[2]); __pyx_v_order_type = values[3]; __pyx_v_trade_type = values[4]; __pyx_v_price = values[5]; __pyx_v_amount = values[6]; __pyx_v_initial_state = ((PyObject*)values[7]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 17, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_client_order_id), (&PyUnicode_Type), 1, "client_order_id", 1))) __PYX_ERR(0, 18, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trading_pair), (&PyUnicode_Type), 1, "trading_pair", 1))) __PYX_ERR(0, 20, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_initial_state), (&PyUnicode_Type), 1, "initial_state", 1))) __PYX_ERR(0, 25, __pyx_L1_error) __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder___init__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self), __pyx_v_client_order_id, __pyx_v_exchange_order_id, __pyx_v_trading_pair, __pyx_v_order_type, __pyx_v_trade_type, __pyx_v_price, __pyx_v_amount, __pyx_v_initial_state); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder___init__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self, PyObject *__pyx_v_client_order_id, PyObject *__pyx_v_exchange_order_id, PyObject *__pyx_v_trading_pair, PyObject *__pyx_v_order_type, PyObject *__pyx_v_trade_type, PyObject *__pyx_v_price, PyObject *__pyx_v_amount, PyObject *__pyx_v_initial_state) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__init__", 0); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":26 * amount: Decimal, * initial_state: str = "new"): * super().__init__( # <<<<<<<<<<<<<< * BitcoinComMarket, * client_order_id, */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder)); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":27 * initial_state: str = "new"): * super().__init__( * BitcoinComMarket, # <<<<<<<<<<<<<< * client_order_id, * exchange_order_id, */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BitcoinComMarket); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":35 * price, * amount, * initial_state, # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[10] = {__pyx_t_4, __pyx_t_3, __pyx_v_client_order_id, __pyx_v_exchange_order_id, __pyx_v_trading_pair, __pyx_v_order_type, __pyx_v_trade_type, __pyx_v_price, __pyx_v_amount, __pyx_v_initial_state}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 9+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[10] = {__pyx_t_4, __pyx_t_3, __pyx_v_client_order_id, __pyx_v_exchange_order_id, __pyx_v_trading_pair, __pyx_v_order_type, __pyx_v_trade_type, __pyx_v_price, __pyx_v_amount, __pyx_v_initial_state}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 9+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_6 = PyTuple_New(9+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_v_client_order_id); __Pyx_GIVEREF(__pyx_v_client_order_id); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_client_order_id); __Pyx_INCREF(__pyx_v_exchange_order_id); __Pyx_GIVEREF(__pyx_v_exchange_order_id); PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_exchange_order_id); __Pyx_INCREF(__pyx_v_trading_pair); __Pyx_GIVEREF(__pyx_v_trading_pair); PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_v_trading_pair); __Pyx_INCREF(__pyx_v_order_type); __Pyx_GIVEREF(__pyx_v_order_type); PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_v_order_type); __Pyx_INCREF(__pyx_v_trade_type); __Pyx_GIVEREF(__pyx_v_trade_type); PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_5, __pyx_v_trade_type); __Pyx_INCREF(__pyx_v_price); __Pyx_GIVEREF(__pyx_v_price); PyTuple_SET_ITEM(__pyx_t_6, 6+__pyx_t_5, __pyx_v_price); __Pyx_INCREF(__pyx_v_amount); __Pyx_GIVEREF(__pyx_v_amount); PyTuple_SET_ITEM(__pyx_t_6, 7+__pyx_t_5, __pyx_v_amount); __Pyx_INCREF(__pyx_v_initial_state); __Pyx_GIVEREF(__pyx_v_initial_state); PyTuple_SET_ITEM(__pyx_t_6, 8+__pyx_t_5, __pyx_v_initial_state); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":17 * * cdef class BitcoinComInFlightOrder(InFlightOrderBase): * def __init__(self, # <<<<<<<<<<<<<< * client_order_id: str, * exchange_order_id: Optional[str], */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":39 * * @property * def is_done(self) -> bool: # <<<<<<<<<<<<<< * return self.last_state in [ * "suspended", */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7is_done_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7is_done_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7is_done___get__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7is_done___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":40 * @property * def is_done(self) -> bool: * return self.last_state in [ # <<<<<<<<<<<<<< * "suspended", * "filled", */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->__pyx_base.last_state); __pyx_t_1 = __pyx_v_self->__pyx_base.last_state; __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_suspended, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (!__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L3_bool_binop_done; } __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_filled, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_t_3 = (__pyx_t_4 != 0); if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_canceled, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (!__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L3_bool_binop_done; } __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_expired, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_t_3 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_3; __pyx_L3_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":39 * * @property * def is_done(self) -> bool: # <<<<<<<<<<<<<< * return self.last_state in [ * "suspended", */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.is_done.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":48 * * @property * def is_failure(self) -> bool: # <<<<<<<<<<<<<< * return self.last_state in [ * "suspended", */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_10is_failure_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_10is_failure_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_10is_failure___get__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_10is_failure___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":49 * @property * def is_failure(self) -> bool: * return self.last_state in [ # <<<<<<<<<<<<<< * "suspended", * "canceled", */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->__pyx_base.last_state); __pyx_t_1 = __pyx_v_self->__pyx_base.last_state; __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_suspended, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (!__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L3_bool_binop_done; } __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_canceled, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) __pyx_t_3 = (__pyx_t_4 != 0); if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_expired, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 49, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); __pyx_t_2 = __pyx_t_4; __pyx_L3_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":48 * * @property * def is_failure(self) -> bool: # <<<<<<<<<<<<<< * return self.last_state in [ * "suspended", */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.is_failure.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":56 * * @property * def is_cancelled(self) -> bool: # <<<<<<<<<<<<<< * return self.last_state == "canceled" * */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_12is_cancelled_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_12is_cancelled_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_12is_cancelled___get__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_12is_cancelled___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":57 * @property * def is_cancelled(self) -> bool: * return self.last_state == "canceled" # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->__pyx_base.last_state, __pyx_n_u_canceled, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 57, __pyx_L1_error) __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":56 * * @property * def is_cancelled(self) -> bool: # <<<<<<<<<<<<<< * return self.last_state == "canceled" * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.is_cancelled.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":60 * * @property * def order_type_description(self) -> str: # <<<<<<<<<<<<<< * """ * :return: Order description string . One of ["limit buy" / "limit sell" / "market buy" / "market sell"] */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_22order_type_description_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_22order_type_description_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_22order_type_description___get__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_22order_type_description___get__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self) { PyObject *__pyx_v_order_type = NULL; PyObject *__pyx_v_side = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; Py_ssize_t __pyx_t_5; Py_UCS4 __pyx_t_6; __Pyx_RefNannySetupContext("__get__", 0); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":64 * :return: Order description string . One of ["limit buy" / "limit sell" / "market buy" / "market sell"] * """ * order_type = "market" if self.order_type is OrderType.MARKET else "limit" # <<<<<<<<<<<<<< * side = "buy" if self.trade_type == TradeType.BUY else "sell" * return f"{order_type} {side}" */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_OrderType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_MARKET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__pyx_v_self->__pyx_base.order_type == __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if ((__pyx_t_4 != 0)) { __Pyx_INCREF(__pyx_n_u_market); __pyx_t_1 = __pyx_n_u_market; } else { __Pyx_INCREF(__pyx_n_u_limit); __pyx_t_1 = __pyx_n_u_limit; } __pyx_v_order_type = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":65 * """ * order_type = "market" if self.order_type is OrderType.MARKET else "limit" * side = "buy" if self.trade_type == TradeType.BUY else "sell" # <<<<<<<<<<<<<< * return f"{order_type} {side}" * */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_TradeType); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_BUY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_v_self->__pyx_base.trade_type, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { __Pyx_INCREF(__pyx_n_u_buy); __pyx_t_1 = __pyx_n_u_buy; } else { __Pyx_INCREF(__pyx_n_u_sell); __pyx_t_1 = __pyx_n_u_sell; } __pyx_v_side = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":66 * order_type = "market" if self.order_type is OrderType.MARKET else "limit" * side = "buy" if self.trade_type == TradeType.BUY else "sell" * return f"{order_type} {side}" # <<<<<<<<<<<<<< * * @classmethod */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_6 = 127; __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_order_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u_); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_); __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_side); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":60 * * @property * def order_type_description(self) -> str: # <<<<<<<<<<<<<< * """ * :return: Order description string . One of ["limit buy" / "limit sell" / "market buy" / "market sell"] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.order_type_description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_order_type); __Pyx_XDECREF(__pyx_v_side); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":69 * * @classmethod * def from_json(cls, data: Dict[str, Any]) -> InFlightOrderBase: # <<<<<<<<<<<<<< * """ * :param data: json data from API */ /* Python wrapper */ static struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_3from_json(PyObject *__pyx_v_cls, PyObject *__pyx_v_data); /*proto*/ static char __pyx_doc_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_2from_json[] = "\n :param data: json data from API\n :return: formatted InFlightOrder\n "; static struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_3from_json(PyObject *__pyx_v_cls, PyObject *__pyx_v_data) { struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_json (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_2from_json(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_data)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_2from_json(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_data) { struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_retval = 0; struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; __Pyx_RefNannySetupContext("from_json", 0); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":76 * cdef: * BitcoinComInFlightOrder retval = BitcoinComInFlightOrder( * data["client_order_id"], # <<<<<<<<<<<<<< * data["exchange_order_id"], * data["trading_pair"], */ __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_client_order_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":77 * BitcoinComInFlightOrder retval = BitcoinComInFlightOrder( * data["client_order_id"], * data["exchange_order_id"], # <<<<<<<<<<<<<< * data["trading_pair"], * getattr(OrderType, data["order_type"]), */ __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_exchange_order_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":78 * data["client_order_id"], * data["exchange_order_id"], * data["trading_pair"], # <<<<<<<<<<<<<< * getattr(OrderType, data["order_type"]), * getattr(TradeType, data["trade_type"]), */ __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_trading_pair); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":79 * data["exchange_order_id"], * data["trading_pair"], * getattr(OrderType, data["order_type"]), # <<<<<<<<<<<<<< * getattr(TradeType, data["trade_type"]), * Decimal(data["price"]), */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_OrderType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_order_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_GetAttr(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":80 * data["trading_pair"], * getattr(OrderType, data["order_type"]), * getattr(TradeType, data["trade_type"]), # <<<<<<<<<<<<<< * Decimal(data["price"]), * Decimal(data["amount"]), */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_TradeType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_trade_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_GetAttr(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":81 * getattr(OrderType, data["order_type"]), * getattr(TradeType, data["trade_type"]), * Decimal(data["price"]), # <<<<<<<<<<<<<< * Decimal(data["amount"]), * data["last_state"] */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_price); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":82 * getattr(TradeType, data["trade_type"]), * Decimal(data["price"]), * Decimal(data["amount"]), # <<<<<<<<<<<<<< * data["last_state"] * ) */ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_amount); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":83 * Decimal(data["price"]), * Decimal(data["amount"]), * data["last_state"] # <<<<<<<<<<<<<< * ) * retval.executed_amount_base = Decimal(data["executed_amount_base"]) */ __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_last_state); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":75 * """ * cdef: * BitcoinComInFlightOrder retval = BitcoinComInFlightOrder( # <<<<<<<<<<<<<< * data["client_order_id"], * data["exchange_order_id"], */ __pyx_t_9 = PyTuple_New(8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 7, __pyx_t_8); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder), __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_retval = ((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_t_8); __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":85 * data["last_state"] * ) * retval.executed_amount_base = Decimal(data["executed_amount_base"]) # <<<<<<<<<<<<<< * retval.executed_amount_quote = Decimal(data["executed_amount_quote"]) * retval.fee_asset = data["fee_asset"] */ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_executed_amount_base); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GIVEREF(__pyx_t_8); __Pyx_GOTREF(__pyx_v_retval->__pyx_base.executed_amount_base); __Pyx_DECREF(__pyx_v_retval->__pyx_base.executed_amount_base); __pyx_v_retval->__pyx_base.executed_amount_base = __pyx_t_8; __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":86 * ) * retval.executed_amount_base = Decimal(data["executed_amount_base"]) * retval.executed_amount_quote = Decimal(data["executed_amount_quote"]) # <<<<<<<<<<<<<< * retval.fee_asset = data["fee_asset"] * retval.fee_paid = Decimal(data["fee_paid"]) */ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_executed_amount_quote); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GIVEREF(__pyx_t_8); __Pyx_GOTREF(__pyx_v_retval->__pyx_base.executed_amount_quote); __Pyx_DECREF(__pyx_v_retval->__pyx_base.executed_amount_quote); __pyx_v_retval->__pyx_base.executed_amount_quote = __pyx_t_8; __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":87 * retval.executed_amount_base = Decimal(data["executed_amount_base"]) * retval.executed_amount_quote = Decimal(data["executed_amount_quote"]) * retval.fee_asset = data["fee_asset"] # <<<<<<<<<<<<<< * retval.fee_paid = Decimal(data["fee_paid"]) * retval.last_state = data["last_state"] */ __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_fee_asset); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_8); __Pyx_GOTREF(__pyx_v_retval->__pyx_base.fee_asset); __Pyx_DECREF(__pyx_v_retval->__pyx_base.fee_asset); __pyx_v_retval->__pyx_base.fee_asset = ((PyObject*)__pyx_t_8); __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":88 * retval.executed_amount_quote = Decimal(data["executed_amount_quote"]) * retval.fee_asset = data["fee_asset"] * retval.fee_paid = Decimal(data["fee_paid"]) # <<<<<<<<<<<<<< * retval.last_state = data["last_state"] * return retval */ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_fee_paid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GIVEREF(__pyx_t_8); __Pyx_GOTREF(__pyx_v_retval->__pyx_base.fee_paid); __Pyx_DECREF(__pyx_v_retval->__pyx_base.fee_paid); __pyx_v_retval->__pyx_base.fee_paid = __pyx_t_8; __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":89 * retval.fee_asset = data["fee_asset"] * retval.fee_paid = Decimal(data["fee_paid"]) * retval.last_state = data["last_state"] # <<<<<<<<<<<<<< * return retval */ __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data, __pyx_n_u_last_state); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (!(likely(PyUnicode_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_8); __Pyx_GOTREF(__pyx_v_retval->__pyx_base.last_state); __Pyx_DECREF(__pyx_v_retval->__pyx_base.last_state); __pyx_v_retval->__pyx_base.last_state = ((PyObject*)__pyx_t_8); __pyx_t_8 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":90 * retval.fee_paid = Decimal(data["fee_paid"]) * retval.last_state = data["last_state"] * return retval # <<<<<<<<<<<<<< */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_retval)); __pyx_r = ((struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase *)__pyx_v_retval); goto __pyx_L0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":69 * * @classmethod * def from_json(cls, data: Dict[str, Any]) -> InFlightOrderBase: # <<<<<<<<<<<<<< * """ * :param data: json data from API */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.from_json", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_retval); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_4__reduce_cython__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_4__reduce_cython__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self) { PyObject *__pyx_v_state = 0; PyObject *__pyx_v__dict = 0; int __pyx_v_use_setstate; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 * cdef object _dict * cdef bint use_setstate * state = (self.amount, self.client_order_id, self.exchange_order_id, self.exchange_order_id_update_event, self.executed_amount_base, self.executed_amount_quote, self.fee_asset, self.fee_paid, self.last_state, self.market_class, self.order_type, self.price, self.trade_type, self.trading_pair) # <<<<<<<<<<<<<< * _dict = getattr(self, '__dict__', None) * if _dict is not None: */ __pyx_t_1 = PyTuple_New(14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self->__pyx_base.amount); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.amount); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->__pyx_base.amount); __Pyx_INCREF(__pyx_v_self->__pyx_base.client_order_id); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.client_order_id); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->__pyx_base.client_order_id); __Pyx_INCREF(__pyx_v_self->__pyx_base.exchange_order_id); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.exchange_order_id); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_self->__pyx_base.exchange_order_id); __Pyx_INCREF(__pyx_v_self->__pyx_base.exchange_order_id_update_event); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.exchange_order_id_update_event); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->__pyx_base.exchange_order_id_update_event); __Pyx_INCREF(__pyx_v_self->__pyx_base.executed_amount_base); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.executed_amount_base); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_self->__pyx_base.executed_amount_base); __Pyx_INCREF(__pyx_v_self->__pyx_base.executed_amount_quote); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.executed_amount_quote); PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_self->__pyx_base.executed_amount_quote); __Pyx_INCREF(__pyx_v_self->__pyx_base.fee_asset); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.fee_asset); PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_v_self->__pyx_base.fee_asset); __Pyx_INCREF(__pyx_v_self->__pyx_base.fee_paid); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.fee_paid); PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_v_self->__pyx_base.fee_paid); __Pyx_INCREF(__pyx_v_self->__pyx_base.last_state); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.last_state); PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_v_self->__pyx_base.last_state); __Pyx_INCREF(__pyx_v_self->__pyx_base.market_class); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.market_class); PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_v_self->__pyx_base.market_class); __Pyx_INCREF(__pyx_v_self->__pyx_base.order_type); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.order_type); PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_v_self->__pyx_base.order_type); __Pyx_INCREF(__pyx_v_self->__pyx_base.price); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.price); PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_v_self->__pyx_base.price); __Pyx_INCREF(__pyx_v_self->__pyx_base.trade_type); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.trade_type); PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_v_self->__pyx_base.trade_type); __Pyx_INCREF(__pyx_v_self->__pyx_base.trading_pair); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.trading_pair); PyTuple_SET_ITEM(__pyx_t_1, 13, __pyx_v_self->__pyx_base.trading_pair); __pyx_v_state = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":6 * cdef bint use_setstate * state = (self.amount, self.client_order_id, self.exchange_order_id, self.exchange_order_id_update_event, self.executed_amount_base, self.executed_amount_quote, self.fee_asset, self.fee_paid, self.last_state, self.market_class, self.order_type, self.price, self.trade_type, self.trading_pair) * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< * if _dict is not None: * state += (_dict,) */ __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__dict = __pyx_t_1; __pyx_t_1 = 0; /* "(tree fragment)":7 * state = (self.amount, self.client_order_id, self.exchange_order_id, self.exchange_order_id_update_event, self.executed_amount_base, self.executed_amount_quote, self.fee_asset, self.fee_paid, self.last_state, self.market_class, self.order_type, self.price, self.trade_type, self.trading_pair) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) * use_setstate = True */ __pyx_t_2 = (__pyx_v__dict != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) * if _dict is not None: * state += (_dict,) # <<<<<<<<<<<<<< * use_setstate = True * else: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; /* "(tree fragment)":9 * if _dict is not None: * state += (_dict,) * use_setstate = True # <<<<<<<<<<<<<< * else: * use_setstate = self.amount is not None or self.client_order_id is not None or self.exchange_order_id is not None or self.exchange_order_id_update_event is not None or self.executed_amount_base is not None or self.executed_amount_quote is not None or self.fee_asset is not None or self.fee_paid is not None or self.last_state is not None or self.market_class is not None or self.order_type is not None or self.price is not None or self.trade_type is not None or self.trading_pair is not None */ __pyx_v_use_setstate = 1; /* "(tree fragment)":7 * state = (self.amount, self.client_order_id, self.exchange_order_id, self.exchange_order_id_update_event, self.executed_amount_base, self.executed_amount_quote, self.fee_asset, self.fee_paid, self.last_state, self.market_class, self.order_type, self.price, self.trade_type, self.trading_pair) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) * use_setstate = True */ goto __pyx_L3; } /* "(tree fragment)":11 * use_setstate = True * else: * use_setstate = self.amount is not None or self.client_order_id is not None or self.exchange_order_id is not None or self.exchange_order_id_update_event is not None or self.executed_amount_base is not None or self.executed_amount_quote is not None or self.fee_asset is not None or self.fee_paid is not None or self.last_state is not None or self.market_class is not None or self.order_type is not None or self.price is not None or self.trade_type is not None or self.trading_pair is not None # <<<<<<<<<<<<<< * if use_setstate: * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, None), state */ /*else*/ { __pyx_t_2 = (__pyx_v_self->__pyx_base.amount != Py_None); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.client_order_id != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_5 != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->__pyx_base.exchange_order_id != ((PyObject*)Py_None)); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.exchange_order_id_update_event != Py_None); __pyx_t_2 = (__pyx_t_5 != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->__pyx_base.executed_amount_base != Py_None); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.executed_amount_quote != Py_None); __pyx_t_2 = (__pyx_t_5 != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->__pyx_base.fee_asset != ((PyObject*)Py_None)); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.fee_paid != Py_None); __pyx_t_2 = (__pyx_t_5 != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->__pyx_base.last_state != ((PyObject*)Py_None)); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.market_class != Py_None); __pyx_t_2 = (__pyx_t_5 != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->__pyx_base.order_type != Py_None); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.price != Py_None); __pyx_t_2 = (__pyx_t_5 != 0); if (!__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->__pyx_base.trade_type != Py_None); __pyx_t_5 = (__pyx_t_2 != 0); if (!__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->__pyx_base.trading_pair != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_5 != 0); __pyx_t_3 = __pyx_t_2; __pyx_L4_bool_binop_done:; __pyx_v_use_setstate = __pyx_t_3; } __pyx_L3:; /* "(tree fragment)":12 * else: * use_setstate = self.amount is not None or self.client_order_id is not None or self.exchange_order_id is not None or self.exchange_order_id_update_event is not None or self.executed_amount_base is not None or self.executed_amount_quote is not None or self.fee_asset is not None or self.fee_paid is not None or self.last_state is not None or self.market_class is not None or self.order_type is not None or self.price is not None or self.trade_type is not None or self.trading_pair is not None * if use_setstate: # <<<<<<<<<<<<<< * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, None), state * else: */ __pyx_t_3 = (__pyx_v_use_setstate != 0); if (__pyx_t_3) { /* "(tree fragment)":13 * use_setstate = self.amount is not None or self.client_order_id is not None or self.exchange_order_id is not None or self.exchange_order_id_update_event is not None or self.executed_amount_base is not None or self.executed_amount_quote is not None or self.fee_asset is not None or self.fee_paid is not None or self.last_state is not None or self.market_class is not None or self.order_type is not None or self.price is not None or self.trade_type is not None or self.trading_pair is not None * if use_setstate: * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, None), state # <<<<<<<<<<<<<< * else: * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, state) */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_BitcoinComInFligh); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_INCREF(__pyx_int_77691215); __Pyx_GIVEREF(__pyx_int_77691215); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_77691215); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_state); __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; /* "(tree fragment)":12 * else: * use_setstate = self.amount is not None or self.client_order_id is not None or self.exchange_order_id is not None or self.exchange_order_id_update_event is not None or self.executed_amount_base is not None or self.executed_amount_quote is not None or self.fee_asset is not None or self.fee_paid is not None or self.last_state is not None or self.market_class is not None or self.order_type is not None or self.price is not None or self.trade_type is not None or self.trading_pair is not None * if use_setstate: # <<<<<<<<<<<<<< * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, None), state * else: */ } /* "(tree fragment)":15 * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, None), state * else: * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, state) # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_BitcoinComInFlightOrder__set_state(self, __pyx_state) */ /*else*/ { __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pyx_unpickle_BitcoinComInFligh); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_INCREF(__pyx_int_77691215); __Pyx_GIVEREF(__pyx_int_77691215); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_77691215); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state * cdef object _dict */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_state); __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":16 * else: * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_BitcoinComInFlightOrder__set_state(self, __pyx_state) */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_6__setstate_cython__(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_6__setstate_cython__(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_BitcoinComInFlightOrder__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error) __pyx_t_1 = __pyx_f_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":16 * else: * return __pyx_unpickle_BitcoinComInFlightOrder, (type(self), 0x4a1794f, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_BitcoinComInFlightOrder__set_state(self, __pyx_state) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __pyx_unpickle_BitcoinComInFlightOrder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ /* Python wrapper */ static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_1__pyx_unpickle_BitcoinComInFlightOrder(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_1__pyx_unpickle_BitcoinComInFlightOrder = {"__pyx_unpickle_BitcoinComInFlightOrder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_1__pyx_unpickle_BitcoinComInFlightOrder, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_1__pyx_unpickle_BitcoinComInFlightOrder(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_BitcoinComInFlightOrder (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BitcoinComInFlightOrder", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BitcoinComInFlightOrder", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_BitcoinComInFlightOrder") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v___pyx_type = values[0]; __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) __pyx_v___pyx_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BitcoinComInFlightOrder", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.__pyx_unpickle_BitcoinComInFlightOrder", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_v___pyx_PickleError = 0; PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; __Pyx_RefNannySetupContext("__pyx_unpickle_BitcoinComInFlightOrder", 0); /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result * if __pyx_checksum != 0x4a1794f: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) */ __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x4a1794f) != 0); if (__pyx_t_1) { /* "(tree fragment)":5 * cdef object __pyx_result * if __pyx_checksum != 0x4a1794f: * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) * __pyx_result = BitcoinComInFlightOrder.__new__(__pyx_type) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PickleError); __Pyx_GIVEREF(__pyx_n_s_PickleError); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_v___pyx_PickleError = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":6 * if __pyx_checksum != 0x4a1794f: * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) # <<<<<<<<<<<<<< * __pyx_result = BitcoinComInFlightOrder.__new__(__pyx_type) * if __pyx_state is not None: */ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x4a, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v___pyx_PickleError); __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 6, __pyx_L1_error) /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result * if __pyx_checksum != 0x4a1794f: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) */ } /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) * __pyx_result = BitcoinComInFlightOrder.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder), __pyx_n_s_new_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v___pyx_result = __pyx_t_3; __pyx_t_3 = 0; /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) * __pyx_result = BitcoinComInFlightOrder.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) * return __pyx_result */ __pyx_t_1 = (__pyx_v___pyx_state != Py_None); __pyx_t_6 = (__pyx_t_1 != 0); if (__pyx_t_6) { /* "(tree fragment)":9 * __pyx_result = BitcoinComInFlightOrder.__new__(__pyx_type) * if __pyx_state is not None: * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) # <<<<<<<<<<<<<< * return __pyx_result * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): */ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error) __pyx_t_3 = __pyx_f_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder__set_state(((struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0x4a1794f = (amount, client_order_id, exchange_order_id, exchange_order_id_update_event, executed_amount_base, executed_amount_quote, fee_asset, fee_paid, last_state, market_class, order_type, price, trade_type, trading_pair))" % __pyx_checksum) * __pyx_result = BitcoinComInFlightOrder.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) * return __pyx_result */ } /* "(tree fragment)":10 * if __pyx_state is not None: * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) * return __pyx_result # <<<<<<<<<<<<<< * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v___pyx_result); __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; /* "(tree fragment)":1 * def __pyx_unpickle_BitcoinComInFlightOrder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.__pyx_unpickle_BitcoinComInFlightOrder", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v___pyx_PickleError); __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":11 * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] * if len(__pyx_state) > 14 and hasattr(__pyx_result, '__dict__'): */ static PyObject *__pyx_f_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order___pyx_unpickle_BitcoinComInFlightOrder__set_state(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("__pyx_unpickle_BitcoinComInFlightOrder__set_state", 0); /* "(tree fragment)":12 * return __pyx_result * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] # <<<<<<<<<<<<<< * if len(__pyx_state) > 14 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[14]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.amount); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.amount); __pyx_v___pyx_result->__pyx_base.amount = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.client_order_id); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.client_order_id); __pyx_v___pyx_result->__pyx_base.client_order_id = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.exchange_order_id); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.exchange_order_id); __pyx_v___pyx_result->__pyx_base.exchange_order_id = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.exchange_order_id_update_event); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.exchange_order_id_update_event); __pyx_v___pyx_result->__pyx_base.exchange_order_id_update_event = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.executed_amount_base); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.executed_amount_base); __pyx_v___pyx_result->__pyx_base.executed_amount_base = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.executed_amount_quote); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.executed_amount_quote); __pyx_v___pyx_result->__pyx_base.executed_amount_quote = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fee_asset); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.fee_asset); __pyx_v___pyx_result->__pyx_base.fee_asset = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.fee_paid); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.fee_paid); __pyx_v___pyx_result->__pyx_base.fee_paid = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.last_state); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.last_state); __pyx_v___pyx_result->__pyx_base.last_state = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.market_class); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.market_class); __pyx_v___pyx_result->__pyx_base.market_class = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.order_type); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.order_type); __pyx_v___pyx_result->__pyx_base.order_type = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.price); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.price); __pyx_v___pyx_result->__pyx_base.price = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.trade_type); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.trade_type); __pyx_v___pyx_result->__pyx_base.trade_type = __pyx_t_1; __pyx_t_1 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.trading_pair); __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.trading_pair); __pyx_v___pyx_result->__pyx_base.trading_pair = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":13 * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] * if len(__pyx_state) > 14 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< * __pyx_result.__dict__.update(__pyx_state[14]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(1, 13, __pyx_L1_error) } __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_3 > 14) != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { /* "(tree fragment)":14 * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] * if len(__pyx_state) > 14 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[14]) # <<<<<<<<<<<<<< */ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 14, __pyx_L1_error) } __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":13 * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] * if len(__pyx_state) > 14 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< * __pyx_result.__dict__.update(__pyx_state[14]) */ } /* "(tree fragment)":11 * __pyx_unpickle_BitcoinComInFlightOrder__set_state(<BitcoinComInFlightOrder> __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_BitcoinComInFlightOrder__set_state(BitcoinComInFlightOrder __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< * __pyx_result.amount = __pyx_state[0]; __pyx_result.client_order_id = __pyx_state[1]; __pyx_result.exchange_order_id = __pyx_state[2]; __pyx_result.exchange_order_id_update_event = __pyx_state[3]; __pyx_result.executed_amount_base = __pyx_state[4]; __pyx_result.executed_amount_quote = __pyx_state[5]; __pyx_result.fee_asset = __pyx_state[6]; __pyx_result.fee_paid = __pyx_state[7]; __pyx_result.last_state = __pyx_state[8]; __pyx_result.market_class = __pyx_state[9]; __pyx_result.order_type = __pyx_state[10]; __pyx_result.price = __pyx_state[11]; __pyx_result.trade_type = __pyx_state[12]; __pyx_result.trading_pair = __pyx_state[13] * if len(__pyx_state) > 14 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.__pyx_unpickle_BitcoinComInFlightOrder__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase->tp_new(t, a, k); if (unlikely(!o)) return 0; return o; } static void __pyx_tp_dealloc_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder(PyObject *o) { #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); PyObject_GC_Track(o); if (likely(__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase)) __pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder); } static int __pyx_tp_traverse_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder(PyObject *o, visitproc v, void *a) { int e; e = ((likely(__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase)) ? ((__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase->tp_traverse) ? __pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder)); if (e) return e; return 0; } static int __pyx_tp_clear_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder(PyObject *o) { if (likely(__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase)) { if (__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase->tp_clear) __pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder); return 0; } static PyObject *__pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_is_done(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7is_done_1__get__(o); } static PyObject *__pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_is_failure(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_10is_failure_1__get__(o); } static PyObject *__pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_is_cancelled(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_12is_cancelled_1__get__(o); } static PyObject *__pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_order_type_description(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_22order_type_description_1__get__(o); } static PyMethodDef __pyx_methods_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder[] = { {"from_json", (PyCFunction)__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_3from_json, METH_O, __pyx_doc_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_2from_json}, {"__reduce_cython__", (PyCFunction)__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_5__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_7__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder[] = { {(char *)"is_done", __pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_is_done, 0, (char *)0, 0}, {(char *)"is_failure", __pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_is_failure, 0, (char *)0, 0}, {(char *)"is_cancelled", __pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_is_cancelled, 0, (char *)0, 0}, {(char *)"order_type_description", __pyx_getprop_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_order_type_description, 0, (char *)"\n :return: Order description string . One of [\"limit buy\" / \"limit sell\" / \"market buy\" / \"market sell\"]\n ", 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder = { PyVarObject_HEAD_INIT(0, 0) "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order.BitcoinComInFlightOrder", /*tp_name*/ sizeof(struct __pyx_obj_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, /*tp_traverse*/ __pyx_tp_clear_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_23BitcoinComInFlightOrder_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif #if PY_VERSION_HEX >= 0x030800b1 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec_bitcoin_com_in_flight_order(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_bitcoin_com_in_flight_order}, {0, NULL} }; #endif static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, "bitcoin_com_in_flight_order", 0, /* m_doc */ #if CYTHON_PEP489_MULTI_PHASE_INIT 0, /* m_size */ #else -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, {&__pyx_n_s_Any, __pyx_k_Any, sizeof(__pyx_k_Any), 0, 0, 1, 1}, {&__pyx_n_s_BUY, __pyx_k_BUY, sizeof(__pyx_k_BUY), 0, 0, 1, 1}, {&__pyx_n_s_BitcoinComInFlightOrder, __pyx_k_BitcoinComInFlightOrder, sizeof(__pyx_k_BitcoinComInFlightOrder), 0, 0, 1, 1}, {&__pyx_n_s_BitcoinComMarket, __pyx_k_BitcoinComMarket, sizeof(__pyx_k_BitcoinComMarket), 0, 0, 1, 1}, {&__pyx_n_s_Decimal, __pyx_k_Decimal, sizeof(__pyx_k_Decimal), 0, 0, 1, 1}, {&__pyx_n_s_Dict, __pyx_k_Dict, sizeof(__pyx_k_Dict), 0, 0, 1, 1}, {&__pyx_n_s_InFlightOrderBase, __pyx_k_InFlightOrderBase, sizeof(__pyx_k_InFlightOrderBase), 0, 0, 1, 1}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0x4a, __pyx_k_Incompatible_checksums_s_vs_0x4a, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x4a), 0, 0, 1, 0}, {&__pyx_n_s_MARKET, __pyx_k_MARKET, sizeof(__pyx_k_MARKET), 0, 0, 1, 1}, {&__pyx_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0, 0}, {&__pyx_n_s_Optional, __pyx_k_Optional, sizeof(__pyx_k_Optional), 0, 0, 1, 1}, {&__pyx_n_s_OrderType, __pyx_k_OrderType, sizeof(__pyx_k_OrderType), 0, 0, 1, 1}, {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_TradeType, __pyx_k_TradeType, sizeof(__pyx_k_TradeType), 0, 0, 1, 1}, {&__pyx_n_s_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 0, 1, 1}, {&__pyx_n_u_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 1, 0, 1}, {&__pyx_n_u_buy, __pyx_k_buy, sizeof(__pyx_k_buy), 0, 1, 0, 1}, {&__pyx_n_u_canceled, __pyx_k_canceled, sizeof(__pyx_k_canceled), 0, 1, 0, 1}, {&__pyx_n_s_client_order_id, __pyx_k_client_order_id, sizeof(__pyx_k_client_order_id), 0, 0, 1, 1}, {&__pyx_n_u_client_order_id, __pyx_k_client_order_id, sizeof(__pyx_k_client_order_id), 0, 1, 0, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_decimal, __pyx_k_decimal, sizeof(__pyx_k_decimal), 0, 0, 1, 1}, {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, {&__pyx_n_s_exchange_order_id, __pyx_k_exchange_order_id, sizeof(__pyx_k_exchange_order_id), 0, 0, 1, 1}, {&__pyx_n_u_exchange_order_id, __pyx_k_exchange_order_id, sizeof(__pyx_k_exchange_order_id), 0, 1, 0, 1}, {&__pyx_n_u_executed_amount_base, __pyx_k_executed_amount_base, sizeof(__pyx_k_executed_amount_base), 0, 1, 0, 1}, {&__pyx_n_u_executed_amount_quote, __pyx_k_executed_amount_quote, sizeof(__pyx_k_executed_amount_quote), 0, 1, 0, 1}, {&__pyx_n_u_expired, __pyx_k_expired, sizeof(__pyx_k_expired), 0, 1, 0, 1}, {&__pyx_n_u_fee_asset, __pyx_k_fee_asset, sizeof(__pyx_k_fee_asset), 0, 1, 0, 1}, {&__pyx_n_u_fee_paid, __pyx_k_fee_paid, sizeof(__pyx_k_fee_paid), 0, 1, 0, 1}, {&__pyx_n_u_filled, __pyx_k_filled, sizeof(__pyx_k_filled), 0, 1, 0, 1}, {&__pyx_n_s_from_json, __pyx_k_from_json, sizeof(__pyx_k_from_json), 0, 0, 1, 1}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_n_s_hummingbot_core_event_events, __pyx_k_hummingbot_core_event_events, sizeof(__pyx_k_hummingbot_core_event_events), 0, 0, 1, 1}, {&__pyx_n_s_hummingbot_market_bitcoin_com_bi, __pyx_k_hummingbot_market_bitcoin_com_bi, sizeof(__pyx_k_hummingbot_market_bitcoin_com_bi), 0, 0, 1, 1}, {&__pyx_n_s_hummingbot_market_bitcoin_com_bi_2, __pyx_k_hummingbot_market_bitcoin_com_bi_2, sizeof(__pyx_k_hummingbot_market_bitcoin_com_bi_2), 0, 0, 1, 1}, {&__pyx_n_s_hummingbot_market_in_flight_orde, __pyx_k_hummingbot_market_in_flight_orde, sizeof(__pyx_k_hummingbot_market_in_flight_orde), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_initial_state, __pyx_k_initial_state, sizeof(__pyx_k_initial_state), 0, 0, 1, 1}, {&__pyx_n_u_last_state, __pyx_k_last_state, sizeof(__pyx_k_last_state), 0, 1, 0, 1}, {&__pyx_n_u_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 1, 0, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_u_market, __pyx_k_market, sizeof(__pyx_k_market), 0, 1, 0, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, {&__pyx_n_u_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 1, 0, 1}, {&__pyx_n_s_new_2, __pyx_k_new_2, sizeof(__pyx_k_new_2), 0, 0, 1, 1}, {&__pyx_n_s_order_type, __pyx_k_order_type, sizeof(__pyx_k_order_type), 0, 0, 1, 1}, {&__pyx_n_u_order_type, __pyx_k_order_type, sizeof(__pyx_k_order_type), 0, 1, 0, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, {&__pyx_n_s_price, __pyx_k_price, sizeof(__pyx_k_price), 0, 0, 1, 1}, {&__pyx_n_u_price, __pyx_k_price, sizeof(__pyx_k_price), 0, 1, 0, 1}, {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, {&__pyx_n_s_pyx_unpickle_BitcoinComInFligh, __pyx_k_pyx_unpickle_BitcoinComInFligh, sizeof(__pyx_k_pyx_unpickle_BitcoinComInFligh), 0, 0, 1, 1}, {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, {&__pyx_n_u_sell, __pyx_k_sell, sizeof(__pyx_k_sell), 0, 1, 0, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_u_suspended, __pyx_k_suspended, sizeof(__pyx_k_suspended), 0, 1, 0, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_trade_type, __pyx_k_trade_type, sizeof(__pyx_k_trade_type), 0, 0, 1, 1}, {&__pyx_n_u_trade_type, __pyx_k_trade_type, sizeof(__pyx_k_trade_type), 0, 1, 0, 1}, {&__pyx_n_s_trading_pair, __pyx_k_trading_pair, sizeof(__pyx_k_trading_pair), 0, 0, 1, 1}, {&__pyx_n_u_trading_pair, __pyx_k_trading_pair, sizeof(__pyx_k_trading_pair), 0, 1, 0, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 26, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "(tree fragment)":1 * def __pyx_unpickle_BitcoinComInFlightOrder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ __pyx_tuple__2 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_BitcoinComInFligh, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_77691215 = PyInt_FromLong(77691215L); if (unlikely(!__pyx_int_77691215)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ __pyx_t_1 = PyImport_ImportModule("hummingbot.market.in_flight_order_base"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase = __Pyx_ImportType(__pyx_t_1, "hummingbot.market.in_flight_order_base", "InFlightOrderBase", sizeof(struct __pyx_obj_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase), __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder.tp_base = __pyx_ptype_10hummingbot_6market_20in_flight_order_base_InFlightOrderBase; if (PyType_Ready(&__pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder) < 0) __PYX_ERR(0, 16, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder.tp_dictoffset && __pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (PyObject_SetAttr(__pyx_m, __pyx_n_s_BitcoinComInFlightOrder, (PyObject *)&__pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder) < 0) __PYX_ERR(0, 16, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder = &__pyx_type_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } #if PY_MAJOR_VERSION < 3 #ifdef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC void #else #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #else #ifdef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyObject * #else #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif #if PY_MAJOR_VERSION < 3 __Pyx_PyMODINIT_FUNC initbitcoin_com_in_flight_order(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC initbitcoin_com_in_flight_order(void) #else __Pyx_PyMODINIT_FUNC PyInit_bitcoin_com_in_flight_order(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit_bitcoin_com_in_flight_order(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { #if PY_VERSION_HEX >= 0x030700A1 static PY_INT64_T main_interpreter_id = -1; PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); if (main_interpreter_id == -1) { main_interpreter_id = current_id; return (unlikely(current_id == -1)) ? -1 : 0; } else if (unlikely(main_interpreter_id != current_id)) #else static PyInterpreterState *main_interpreter = NULL; PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; if (!main_interpreter) { main_interpreter = current_interpreter; } else if (unlikely(main_interpreter != current_interpreter)) #endif { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec_bitcoin_com_in_flight_order(PyObject *__pyx_pyinit_module) #endif #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'bitcoin_com_in_flight_order' has already been imported. Re-initialisation is not supported."); return -1; } #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_bitcoin_com_in_flight_order(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; Py_INCREF(__pyx_m); #else #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("bitcoin_com_in_flight_order", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) #endif __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_b); __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_cython_runtime); if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_hummingbot__market__bitcoin_com__bitcoin_com_in_flight_order) { if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order")) { if (unlikely(PyDict_SetItemString(modules, "hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; (void)__Pyx_modinit_type_import_code(); (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":1 * from decimal import Decimal # <<<<<<<<<<<<<< * from typing import ( * Any, */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Decimal); __Pyx_GIVEREF(__pyx_n_s_Decimal); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Decimal); __pyx_t_2 = __Pyx_Import(__pyx_n_s_decimal, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Decimal, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":3 * from decimal import Decimal * from typing import ( * Any, # <<<<<<<<<<<<<< * Dict, * Optional, */ __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_Any); __Pyx_GIVEREF(__pyx_n_s_Any); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Any); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Dict); __Pyx_INCREF(__pyx_n_s_Optional); __Pyx_GIVEREF(__pyx_n_s_Optional); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Optional); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":2 * from decimal import Decimal * from typing import ( # <<<<<<<<<<<<<< * Any, * Dict, */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Any); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":9 * * from hummingbot.core.event.events import ( * OrderType, # <<<<<<<<<<<<<< * TradeType * ) */ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_OrderType); __Pyx_GIVEREF(__pyx_n_s_OrderType); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_OrderType); __Pyx_INCREF(__pyx_n_s_TradeType); __Pyx_GIVEREF(__pyx_n_s_TradeType); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_TradeType); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":8 * ) * * from hummingbot.core.event.events import ( # <<<<<<<<<<<<<< * OrderType, * TradeType */ __pyx_t_2 = __Pyx_Import(__pyx_n_s_hummingbot_core_event_events, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OrderType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderType, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_TradeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_TradeType, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":12 * TradeType * ) * from hummingbot.market.bitcoin_com.bitcoin_com_market import BitcoinComMarket # <<<<<<<<<<<<<< * from hummingbot.market.in_flight_order_base import InFlightOrderBase * */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_BitcoinComMarket); __Pyx_GIVEREF(__pyx_n_s_BitcoinComMarket); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_BitcoinComMarket); __pyx_t_1 = __Pyx_Import(__pyx_n_s_hummingbot_market_bitcoin_com_bi, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BitcoinComMarket); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_BitcoinComMarket, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":13 * ) * from hummingbot.market.bitcoin_com.bitcoin_com_market import BitcoinComMarket * from hummingbot.market.in_flight_order_base import InFlightOrderBase # <<<<<<<<<<<<<< * * */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_InFlightOrderBase); __Pyx_GIVEREF(__pyx_n_s_InFlightOrderBase); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_InFlightOrderBase); __pyx_t_2 = __Pyx_Import(__pyx_n_s_hummingbot_market_in_flight_orde, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":69 * * @classmethod * def from_json(cls, data: Dict[str, Any]) -> InFlightOrderBase: # <<<<<<<<<<<<<< * """ * :param data: json data from API */ __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder, __pyx_n_s_from_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":68 * return f"{order_type} {side}" * * @classmethod # <<<<<<<<<<<<<< * def from_json(cls, data: Dict[str, Any]) -> InFlightOrderBase: * """ */ __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder->tp_dict, __pyx_n_s_from_json, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_BitcoinComInFlightOrder); /* "(tree fragment)":1 * def __pyx_unpickle_BitcoinComInFlightOrder(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10hummingbot_6market_11bitcoin_com_27bitcoin_com_in_flight_order_1__pyx_unpickle_BitcoinComInFlightOrder, NULL, __pyx_n_s_hummingbot_market_bitcoin_com_bi_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_BitcoinComInFligh, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "hummingbot/market/bitcoin_com/bitcoin_com_in_flight_order.pyx":1 * from decimal import Decimal # <<<<<<<<<<<<<< * from typing import ( * Any, */ __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init hummingbot.market.bitcoin_com.bitcoin_com_in_flight_order"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #elif PY_MAJOR_VERSION >= 3 return __pyx_m; #else return; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } else if (exact) { #if PY_MAJOR_VERSION == 2 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ #if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } else if (unlikely(PyErr_Occurred())) { return NULL; } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } #endif #else result = PyObject_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } PyErr_Clear(); #endif return __Pyx_GetBuiltinName(name); } /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject **fastlocals; Py_ssize_t i; PyObject *result; assert(globals != NULL); /* XXX Perhaps we should create a specialized PyFrame_New() that doesn't take locals, but does take builtins without sanity checking them. */ assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); if (f == NULL) { return NULL; } fastlocals = __Pyx_PyFrame_GetLocalsplus(f); for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; } result = PyEval_EvalFrameEx(f,0); ++tstate->recursion_depth; Py_DECREF(f); --tstate->recursion_depth; return result; } #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func); PyObject *closure; #if PY_MAJOR_VERSION >= 3 PyObject *kwdefs; #endif PyObject *kwtuple, **k; PyObject **d; Py_ssize_t nd; Py_ssize_t nk; PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { return NULL; } if ( #if PY_MAJOR_VERSION >= 3 co->co_kwonlyargcount == 0 && #endif likely(kwargs == NULL || nk == 0) && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { if (argdefs == NULL && co->co_argcount == nargs) { result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); goto done; } else if (nargs == 0 && argdefs != NULL && co->co_argcount == Py_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ args = &PyTuple_GET_ITEM(argdefs, 0); result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); goto done; } } if (kwargs != NULL) { Py_ssize_t pos, i; kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { result = NULL; goto done; } k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { Py_INCREF(k[i]); Py_INCREF(k[i+1]); i += 2; } nk = i / 2; } else { kwtuple = NULL; k = NULL; } closure = PyFunction_GET_CLOSURE(func); #if PY_MAJOR_VERSION >= 3 kwdefs = PyFunction_GET_KW_DEFAULTS(func); #endif if (argdefs != NULL) { d = &PyTuple_GET_ITEM(argdefs, 0); nd = Py_SIZE(argdefs); } else { d = NULL; nd = 0; } #if PY_MAJOR_VERSION >= 3 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, args, (int)nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, args, (int)nargs, k, (int)nk, d, (int)nd, closure); #endif Py_XDECREF(kwtuple); done: Py_LeaveRecursiveCall(); return result; } #endif #endif /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); } else { return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); } } #endif /* BytesEquals */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result; #if CYTHON_USE_UNICODE_INTERNALS Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else #if PY_MAJOR_VERSION < 3 PyObject* owned_ref = NULL; #endif int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); #if PY_MAJOR_VERSION < 3 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { owned_ref = PyUnicode_FromObject(s2); if (unlikely(!owned_ref)) return -1; s2 = owned_ref; s2_is_unicode = 1; } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { owned_ref = PyUnicode_FromObject(s1); if (unlikely(!owned_ref)) return -1; s1 = owned_ref; s1_is_unicode = 1; } else if (((!s2_is_unicode) & (!s1_is_unicode))) { return __Pyx_PyBytes_Equals(s1, s2, equals); } #endif if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length; int kind; void *data1, *data2; if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; length = __Pyx_PyUnicode_GET_LENGTH(s1); if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; #if CYTHON_PEP393_ENABLED hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; #else hash1 = ((PyUnicodeObject*)s1)->hash; hash2 = ((PyUnicodeObject*)s2)->hash; #endif if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ); return_ne: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_NE); #endif } /* PyUnicode_Unicode */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { if (unlikely(obj == Py_None)) obj = __pyx_kp_u_None; return __Pyx_NewRef(obj); } /* JoinPyUnicode */ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, CYTHON_UNUSED Py_UCS4 max_char) { #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS PyObject *result_uval; int result_ukind; Py_ssize_t i, char_pos; void *result_udata; #if CYTHON_PEP393_ENABLED result_uval = PyUnicode_New(result_ulength, max_char); if (unlikely(!result_uval)) return NULL; result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; result_udata = PyUnicode_DATA(result_uval); #else result_uval = PyUnicode_FromUnicode(NULL, result_ulength); if (unlikely(!result_uval)) return NULL; result_ukind = sizeof(Py_UNICODE); result_udata = PyUnicode_AS_UNICODE(result_uval); #endif char_pos = 0; for (i=0; i < value_count; i++) { int ukind; Py_ssize_t ulength; void *udata; PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); if (unlikely(__Pyx_PyUnicode_READY(uval))) goto bad; ulength = __Pyx_PyUnicode_GET_LENGTH(uval); if (unlikely(!ulength)) continue; if (unlikely(char_pos + ulength < 0)) goto overflow; ukind = __Pyx_PyUnicode_KIND(uval); udata = __Pyx_PyUnicode_DATA(uval); if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind)); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); #else Py_ssize_t j; for (j=0; j < ulength; j++) { Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); } #endif } char_pos += ulength; } return result_uval; overflow: PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); bad: Py_DECREF(result_uval); return NULL; #else result_ulength++; value_count++; return PyUnicode_Join(__pyx_empty_unicode, value_tuple); #endif } /* DictGetItem */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) { if (unlikely(PyTuple_Check(key))) { PyObject* args = PyTuple_Pack(1, key); if (likely(args)) { PyErr_SetObject(PyExc_KeyError, args); Py_DECREF(args); } } else { PyErr_SetObject(PyExc_KeyError, key); } } return NULL; } Py_INCREF(value); return value; } #endif /* GetAttr */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) #else if (likely(PyString_Check(n))) #endif return __Pyx_PyObject_GetAttrStr(o, n); #endif return PyObject_GetAttr(o, n); } /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; #if CYTHON_FAST_PYCALL if (PyFunction_Check(function)) { PyObject *args[2] = {arg1, arg2}; return __Pyx_PyFunction_FastCall(function, args, 2); } #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(function)) { PyObject *args[2] = {arg1, arg2}; return __Pyx_PyCFunction_FastCall(function, args, 2); } #endif args = PyTuple_New(2); if (unlikely(!args)) goto done; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); Py_INCREF(function); result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); done: return result; } /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = PyCFunction_GET_FUNCTION(func); self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); if (unlikely(!args)) return NULL; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, &arg, 1); } #endif if (likely(PyCFunction_Check(func))) { if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } } return __Pyx__PyObject_CallOneArg(func, arg); } #else static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_Pack(1, arg); if (unlikely(!args)) return NULL; result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } #endif /* PyErrExceptionMatches */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); #if PY_MAJOR_VERSION >= 3 for (i=0; i<n; i++) { if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; } #endif for (i=0; i<n; i++) { if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; } return 0; } static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { PyObject *exc_type = tstate->curexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; if (unlikely(PyTuple_Check(err))) return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #endif /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* GetAttr3 */ static PyObject *__Pyx_GetAttr3Default(PyObject *d) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) return NULL; __Pyx_PyErr_Clear(); Py_INCREF(d); return d; } static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { PyObject *r = __Pyx_GetAttr(o, n); return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); #else "cannot import name %S", name); #endif } return value; } /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS Py_ssize_t wrapped_i = i; if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS Py_ssize_t wrapped_i = i; if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return NULL; PyErr_Clear(); } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } /* HasAttr */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!__Pyx_PyBaseString_Check(n))) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return -1; } r = __Pyx_GetAttr(o, n); if (unlikely(!r)) { PyErr_Clear(); return 0; } else { Py_DECREF(r); return 1; } } /* CallNextTpDealloc */ static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { PyTypeObject* type = Py_TYPE(obj); while (type && type->tp_dealloc != current_tp_dealloc) type = type->tp_base; while (type && type->tp_dealloc == current_tp_dealloc) type = type->tp_base; if (type) type->tp_dealloc(obj); } /* CallNextTpTraverse */ static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { PyTypeObject* type = Py_TYPE(obj); while (type && type->tp_traverse != current_tp_traverse) type = type->tp_base; while (type && type->tp_traverse == current_tp_traverse) type = type->tp_base; if (type && type->tp_traverse) return type->tp_traverse(obj, v, a); return 0; } /* CallNextTpClear */ static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { PyTypeObject* type = Py_TYPE(obj); while (type && type->tp_clear != current_tp_clear) type = type->tp_base; while (type && type->tp_clear == current_tp_clear) type = type->tp_base; if (type && type->tp_clear) type->tp_clear(obj); } /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if ((size_t)basicsize < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); goto bad; } if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); goto bad; } else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(result); return NULL; } #endif /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 "'%.50s' object has no attribute '%U'", tp->tp_name, attr_name); #else "'%.50s' object has no attribute '%.400s'", tp->tp_name, PyString_AS_STRING(attr_name)); #endif return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { PyObject *descr; PyTypeObject *tp = Py_TYPE(obj); if (unlikely(!PyString_Check(attr_name))) { return PyObject_GenericGetAttr(obj, attr_name); } assert(!tp->tp_dictoffset); descr = _PyType_Lookup(tp, attr_name); if (unlikely(!descr)) { return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } Py_INCREF(descr); #if PY_MAJOR_VERSION < 3 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif { descrgetfunc f = Py_TYPE(descr)->tp_descr_get; if (unlikely(f)) { PyObject *res = f(descr, obj, (PyObject *)tp); Py_DECREF(descr); return res; } } return descr; } #endif /* PyObject_GenericGetAttr */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); } return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } #endif /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { ret = -1; } if (unlikely(ret < 0)) { PyErr_Clear(); ret = 0; } Py_XDECREF(name_attr); return ret; } static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; #if CYTHON_USE_PYTYPE_LOOKUP if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #else if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #endif #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #else object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD; ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD; ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } PyType_Modified((PyTypeObject*)type_obj); } } goto __PYX_GOOD; __PYX_BAD: if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); Py_XDECREF(reduce_cython); Py_XDECREF(setstate); Py_XDECREF(setstate_cython); return ret; } /* ClassMethod */ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000 if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { return PyClassMethod_New(method); } #else #if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY if (PyMethodDescr_Check(method)) #else static PyTypeObject *methoddescr_type = NULL; if (methoddescr_type == NULL) { PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); if (!meth) return NULL; methoddescr_type = Py_TYPE(meth); Py_DECREF(meth); } if (__Pyx_TypeCheck(method, methoddescr_type)) #endif { PyMethodDescrObject *descr = (PyMethodDescrObject *)method; #if PY_VERSION_HEX < 0x03020000 PyTypeObject *d_type = descr->d_type; #else PyTypeObject *d_type = descr->d_common.d_type; #endif return PyDescr_NewClassMethod(d_type, descr->d_method); } #endif else if (PyMethod_Check(method)) { return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); } else if (PyCFunction_Check(method)) { return PyClassMethod_New(method); } #ifdef __Pyx_CyFunction_USED else if (__Pyx_CyFunction_Check(method)) { return PyClassMethod_New(method); } #endif PyErr_SetString(PyExc_TypeError, "Class-level classmethod() can only be called on " "a method_descriptor or instance method."); return NULL; } /* GetNameInClass */ static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) { PyObject *result; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) return NULL; __Pyx_PyErr_Clear(); __Pyx_GetModuleGlobalNameUncached(result, name); return result; } static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { PyObject *result; result = __Pyx_PyObject_GetAttrStr(nmspace, name); if (!result) { result = __Pyx_GetGlobalNameAfterAttributeLookup(name); } return result; } /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif if (unlikely(!__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, *cython_runtime_dict, __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) } else #endif { PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); } else { PyErr_Clear(); use_cline = NULL; } } if (!use_cline) { c_line = 0; PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; int res; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&exception, &value, &tb); res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; if (unlikely(res == -1)) { PyErr_WriteUnraisable(err); res = 0; } if (!res) { res = PyObject_IsSubclass(err, exc_type2); if (unlikely(res == -1)) { PyErr_WriteUnraisable(err); res = 0; } } __Pyx_ErrRestore(exception, value, tb); return res; } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; if (!res) { res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); #if PY_MAJOR_VERSION >= 3 for (i=0; i<n; i++) { if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; } #endif for (i=0; i<n; i++) { PyObject *t = PyTuple_GET_ITEM(tuple, i); #if PY_MAJOR_VERSION < 3 if (likely(exc_type == t)) return 1; #endif if (likely(PyExceptionClass_Check(t))) { if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; } else { } } return 0; } static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { if (likely(err == exc_type)) return 1; if (likely(PyExceptionClass_Check(err))) { if (likely(PyExceptionClass_Check(exc_type))) { return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); } else if (likely(PyTuple_Check(exc_type))) { return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); } else { } } return PyErr_GivenExceptionMatches(err, exc_type); } static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { assert(PyExceptionClass_Check(exc_type1)); assert(PyExceptionClass_Check(exc_type2)); if (likely(err == exc_type1 || err == exc_type2)) return 1; if (likely(PyExceptionClass_Check(err))) { return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); } return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); } #endif /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT #if !CYTHON_PEP393_ENABLED static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; } #else static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(PyUnicode_IS_ASCII(o))) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif } #endif #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type %.200s). " "The ability to return an instance of a strict subclass of int " "is deprecated, and may be removed in a future version of Python.", Py_TYPE(result)->tp_name)) { Py_DECREF(result); return NULL; } return result; } #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", type_name, type_name, Py_TYPE(result)->tp_name); Py_DECREF(result); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x) || PyLong_Check(x))) #else if (likely(PyLong_Check(x))) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = m->nb_int(x); } else if (m && m->nb_long) { name = "long"; res = m->nb_long(x); } #else if (likely(m && m->nb_int)) { name = "int"; res = m->nb_int(x); } #endif #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Int(x); } #endif if (likely(res)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { #else if (unlikely(!PyLong_CheckExact(res))) { #endif return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(b); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */
[ "lag21392@gmail.com" ]
lag21392@gmail.com
4ea8fd9c93ce3e702f72db2330901b78d35e86ca
c6738e1ea6eef052d2b3df144321912b7d82b85b
/app/exampleadaptor.cpp
50d7ada6f4c8522d3450efaec2668d3673cc88fd
[]
no_license
baslack/cs7100-proj
e0e55f767f05f922531f0310d17f8559c4c11ff2
566172a7b8476ad41e0d9af648df74e10150a3bb
refs/heads/master
2020-03-24T21:29:59.614481
2018-08-16T19:32:04
2018-08-16T19:32:04
143,035,802
0
0
null
null
null
null
UTF-8
C++
false
false
566
cpp
#include "exampleadaptor.h" ExampleAdaptor::ExampleAdaptor(): Adaptor("fcn7", "Example function from Dr. Dedoncker."), fn(&fcn7) { addParam("x", "Parameter 0", 1.0); addParam("y", "Parameter 1", 1.0); } ExampleAdaptor::~ExampleAdaptor() { } int ExampleAdaptor::call( QVector<double>& params, double& result) { int temp = int(NumParams()); int* ndims = &temp; double* x = params.data(); int temp2 = 1; int* nfcns = &temp2; double* funvls = &result; int retval = fn(ndims, x, nfcns, funvls); return retval; }
[ "iam@nimajneb.com" ]
iam@nimajneb.com
c9b504a1778aa1bada813ced8417516b223dcf7c
fd7a88184de801f241c0af871423276a0a4e7a5e
/include/ceetah/ast/multi-expression.hpp
a09fb8cef1d56ee00240fd042f9d4408c0560d28
[ "MIT" ]
permissive
alta-lang/ceetah
e86b07979cdc9e8c642d04406b66a09e40c3bffa
4863604cb8bd319fd19cdb9d7fe6a187432893f4
refs/heads/master
2023-01-30T10:10:19.666915
2023-01-12T05:31:52
2023-01-12T05:31:52
156,795,196
0
0
null
null
null
null
UTF-8
C++
false
false
692
hpp
#ifndef CEETAH_AST_MULTI_EXPRESSION_HPP #define CEETAH_AST_MULTI_EXPRESSION_HPP #include "expression.hpp" #include <string> #include <vector> namespace Ceetah { namespace AST { class MultiExpression: public Expression { public: virtual NodeType nodeType() const override; std::vector<std::shared_ptr<Expression>> expressions; virtual std::shared_ptr<Node> clone() const override; void cloneTo(std::shared_ptr<Node> node) const; virtual std::string toStringWithIndent(std::string indent = "") const override; virtual bool operator ==(const MultiExpression& other) const; }; }; }; #endif // CEETAH_AST_MULTI_EXPRESSION_HPP
[ "facekapow@outlook.com" ]
facekapow@outlook.com
3d160341383ff0436d25be240f99acc3f8f38683
391a2503af992339650bc7673b39b63d6748de4f
/tinyXmlEx/stdafx.cpp
5abcdf1290f54121c5fd7a493220dd0ce61bfa27
[]
no_license
pdpdds/Win32OpenSourceSample
ccd8258a821b03118af45ef288d94c57aa43f41d
17af141c72685698abe7f25182ab1dbb90f61f6e
refs/heads/master
2021-01-25T07:27:35.405919
2015-12-11T07:44:10
2015-12-11T07:44:10
24,195,690
10
8
null
null
null
null
UHC
C++
false
false
327
cpp
// stdafx.cpp : 표준 포함 파일만 들어 있는 소스 파일입니다. // tinyXmlEx.pch는 미리 컴파일된 헤더가 됩니다. // stdafx.obj에는 미리 컴파일된 형식 정보가 포함됩니다. #include "stdafx.h" // TODO: 필요한 추가 헤더는 // 이 파일이 아닌 STDAFX.H에서 참조합니다.
[ "juhang3@daum.net" ]
juhang3@daum.net
cfa337d17003cf6b9cf3aeee0dbccef432f4088a
a30e39f1a5efd5f28c1efedc69f9c83cba817260
/LevelStreaming/NPC.cpp
7e5b93e0c94c6de1a7b842652fb538b32577351c
[]
no_license
MattFiler/LevelStreaming
a08d2460098d885b4841f9ddc6551934635560cf
53d381eed4e9cf3cbe9f8b57762fa6c412886148
refs/heads/master
2022-06-20T05:35:37.799326
2020-05-07T09:05:55
2020-05-07T09:05:55
233,844,526
2
0
null
null
null
null
UTF-8
C++
false
false
1,542
cpp
#include "NPC.h" #include "Waypoint.h" /* Create base resources */ void NPC::Create() { GameObject::Create(); } /* A wrapper for model creation, to be called when swapping model data and LODs */ void NPC::CreateModel() { if (!modelData) Debug::Log("Creating an NPC without its model data - check scripts!"); if (modelData) modelData->AddUseage(); } /* A wrapper for model deletion, to be called when swapping model data and LODs */ void NPC::ReleaseModel() { if (modelData) modelData->RemoveUseage(); modelData = nullptr; } /* Move the NPC if it's active */ void NPC::Update(float dt) { Model::Update(dt); if (dxshared::pauseNPCs && pathingPoints.size() != 0) { currentPathingPointTarget = 0; } if (!isActive) return; if (dxshared::pauseNPCs || dt == 0 || pathingPoints.size() == 0) return; float tx = pathingPoints[currentPathingPointTarget].x - position.x; float ty = pathingPoints[currentPathingPointTarget].y - position.y; float tz = pathingPoints[currentPathingPointTarget].z - position.z; float length = sqrt(tx*tx + ty*ty + tz*tz); if (length > (dt*pathingSpeed)) { position = DirectX::XMFLOAT3(position.x + (dt*pathingSpeed) * tx / length, position.y + (dt*pathingSpeed) * ty / length, position.z + (dt*pathingSpeed) * tz / length); } else { currentPathingPointTarget++; if (currentPathingPointTarget >= pathingPoints.size()) currentPathingPointTarget = 0; } } /* Render the NPC if it's loaded */ void NPC::Render(float dt) { if (GetLOD() == LevelOfDetail::UNLOADED) return; Model::Render(dt); }
[ "matthew.filer@hotmail.co.uk" ]
matthew.filer@hotmail.co.uk
a0d3c7f2dc68acbf836289c37fc3c38af2b904a4
5a543aa5ccb089d091397493913013ed2aa530f2
/GEngine/src/Platform/OpenGL/OpenGLBuffer.h
4ff6c840b9688999fff1223e596f2252b721e0de
[]
no_license
bgz-native/GEngine
59d9a9a53c594d9b9baeb8117c30582062db81c5
c5215f28a967832bd94e9cd7f1fd5cde5a6c865d
refs/heads/master
2021-05-21T16:42:31.387326
2020-07-11T10:17:07
2020-07-11T10:17:07
252,721,107
0
0
null
null
null
null
UTF-8
C++
false
false
886
h
#pragma once #include "GEngine/Renderer/Buffer.h" namespace GEngine { class OpenGLVertexBuffer : public VertexBuffer { public: OpenGLVertexBuffer(float* vertices, uint32_t size); virtual ~OpenGLVertexBuffer(); virtual void Bind() const override; virtual void UnBind() const override; virtual const BufferLayout& GetLayout() const override { return m_layout; } virtual void SetLayout(const BufferLayout& layout) override { m_layout = layout; } private: uint32_t m_rendererId; BufferLayout m_layout; }; class OpenGLIndexBuffer : public IndexBuffer { public: OpenGLIndexBuffer(uint32_t* indices, uint32_t count); virtual ~OpenGLIndexBuffer(); virtual void Bind() const; virtual void UnBind() const; virtual uint32_t GetCount() const { return m_count; } private: uint32_t m_rendererId; uint32_t m_count; }; }
[ "martinbogz@gmail.com" ]
martinbogz@gmail.com
743705a5516f689947f7ef2513ec2b9229f589c4
60e217269d23aaf1016bd521334337cf899789d4
/OpenGL Demo/OpenGL Demo/Audio.cpp
e488e0fab43615f5527186967d2efbc4d8592f68
[ "MIT" ]
permissive
henry9836/OpenGLDemo
457b515dace6220e4a7770c6fe16622b65942a99
7c3be8d872828a02154f0a38378cc299a733cb1b
refs/heads/master
2021-07-09T15:19:56.853777
2020-10-26T01:49:00
2020-10-26T01:49:00
209,205,554
0
0
null
null
null
null
UTF-8
C++
false
false
2,018
cpp
#include "Audio.h" bool AudioSystem::AudioInit() { Console_OutputLog(L"Initalising Audio...", LOGINFO); FMOD_RESULT result; result = FMOD::System_Create(&audioSystem); if (result != FMOD_OK) { Console_OutputLog(L"Cannot Initalise Audio FMOD_OK Check Failed!", LOGWARN); return false; } result = audioSystem->init(100, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, 0); if (result != FMOD_OK) { Console_OutputLog(L"Cannot Initalise Audio FMOD_OK Check Failed!", LOGWARN); return false; } /* CREATE SOUNDS */ result = audioSystem->createSound("Resources/Sounds/shoot.wav", FMOD_DEFAULT, 0, &shoot); if (result != FMOD_OK) { Console_OutputLog(L"Cannot Initalise Audio Track shoot.wav", LOGWARN); } result = audioSystem->createSound("Resources/Sounds/hit.wav", FMOD_DEFAULT, 0, &hit); if (result != FMOD_OK) { Console_OutputLog(L"Cannot Initalise Audio Track hit.wav", LOGWARN); } result = audioSystem->createSound("Resources/Sounds/ambient.mp3", FMOD_LOOP_NORMAL, 0, &ambient); if (result != FMOD_OK) { Console_OutputLog(L"Cannot Initalise Audio Track ambient.mp3", LOGWARN); } Console_OutputLog(L"Initalised Audio...", LOGINFO); return true; } void AudioSystem::Play(int track) { bool foundtrack = true; bool result = false; switch (track) { case SHOOT: { result = audioSystem->playSound(shoot, 0, false, 0); break; } case HIT: { result = audioSystem->playSound(hit, 0, false, 0); break; } case AMBIENT: { result = audioSystem->playSound(ambient, 0, false, 0); break; } default: { foundtrack = false; Console_OutputLog(to_wstring("Audio Track: " + std::to_string(track) + " was called but it doesn't exist"), LOGWARN); break; } } if (foundtrack) { if (result != FMOD_OK) { Console_OutputLog(to_wstring("Audio Track: " + std::to_string(track) + " was called but cannot be played"), LOGWARN); return; } } } void AudioSystem::Tick() { audioSystem->update(); }
[ "henry983615@gmail.com" ]
henry983615@gmail.com
e8ec19a83e4de9496d23c6cc1bbe1d955cba445e
e81c41a3a8c0a9a4f26dc1ce0487ff83cbe065e6
/src/libtsduck/tsTerrestrialDeliverySystemDescriptor.h
875a2d470aafac19f60b18791be077cb044f520a
[ "BSD-2-Clause" ]
permissive
mypopydev/tsduck
baa6fc9029d4ec9750ad6948efa4537bad2803cc
38e29aa7ba82d0d07ca926a4e37a7f6d167089d3
refs/heads/master
2020-03-30T03:45:21.306955
2019-11-15T20:21:25
2019-11-15T20:21:25
150,706,575
0
0
NOASSERTION
2018-09-28T08:04:07
2018-09-28T08:04:07
null
UTF-8
C++
false
false
3,796
h
//---------------------------------------------------------------------------- // // TSDuck - The MPEG Transport Stream Toolkit // Copyright (c) 2005-2019, Thierry Lelegard // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. // //---------------------------------------------------------------------------- //! //! @file //! Representation of a terrestrial_delivery_system_descriptor //! //---------------------------------------------------------------------------- #pragma once #include "tsAbstractDeliverySystemDescriptor.h" namespace ts { //! //! Representation of a terrestrial_delivery_system_descriptor. //! @see ETSI 300 468, 6.2.13.4. //! @ingroup descriptor //! class TSDUCKDLL TerrestrialDeliverySystemDescriptor : public AbstractDeliverySystemDescriptor { public: // TerrestrialDeliverySystemDescriptor public members: uint32_t centre_frequency; //!< Frequency, unit is 10 Hz. uint8_t bandwidth; //!< Bandwidth, 0..7 (3 bits). bool high_priority; //!< Must be true if hierarchy == 0. bool no_time_slicing; //!< No time slicing. bool no_mpe_fec; //!< NO MPE-FEC. uint8_t constellation; //!< Constellation, 0..3 (2 bits). uint8_t hierarchy; //!< Hierarchy, 0..7 (3 bits). uint8_t code_rate_hp; //!< Code Rate, high priority, 0..7 (3 bits). uint8_t code_rate_lp; //!< Code Rate, low priority, 0..7 (3 bits). uint8_t guard_interval; //!< Guard interval, 0..3 (2 bits). uint8_t transmission_mode; //!< Transmission mode, 0..3 (2 bits). bool other_frequency; //!< Other frequency. //! //! Default constructor. //! TerrestrialDeliverySystemDescriptor(); //! //! Constructor from a binary descriptor. //! @param [in,out] duck TSDuck execution context. //! @param [in] bin A binary descriptor to deserialize. //! TerrestrialDeliverySystemDescriptor(DuckContext& duck, const Descriptor& bin); // Inherited methods virtual void serialize(DuckContext&, Descriptor&) const override; virtual void deserialize(DuckContext&, const Descriptor&) override; virtual void fromXML(DuckContext&, const xml::Element*) override; DeclareDisplayDescriptor(); protected: // Inherited methods virtual void buildXML(DuckContext&, xml::Element*) const override; }; }
[ "thierry@lelegard.fr" ]
thierry@lelegard.fr
35af0da2662389370e7f9ea22495b680b91ea0ea
9c0d2bba9e3e6ca34a3c2924db51f121eea7b698
/その他/Sample0218/Observer06/Texture.h
ec3aabbf382aa6291ecd12f0ab40fff9e05b1e8a
[ "MIT" ]
permissive
KoreanGinseng/CreativeLabo3
6ed5a4bbb81720e613bab67b70a989bbcf86dd03
279fbb23a7412ec59d27b21417e7335f5849eba5
refs/heads/main
2023-03-21T12:31:14.162828
2021-03-16T04:06:16
2021-03-16T04:06:16
339,245,670
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
586
h
#pragma once #include <iostream> /** * 画像を保持するクラス */ class Texture { private: /** 画像ファイル名 */ std::string fileName; public: /** * コンストラクタ */ Texture() : fileName() { } /** * デストラクタ */ ~Texture() { } /** * @brief 画像の読み込み処理 * @param[in] fname ファイル名 */ bool Load(const std::string& fname) { std::cout << "画像[" << fname << "]を読み込んだ!!" << std::endl; fileName = fname; return true; } const std::string& GetName() const { return fileName; } };
[ "49602459+KoreanGinseng@users.noreply.github.com" ]
49602459+KoreanGinseng@users.noreply.github.com
d7fc5a1c4281aa6c842e4229a1b845fedff8747a
be31580024b7fb89884cfc9f7e8b8c4f5af67cfa
/CTDL1/New folder/VC/crt/src/xrngdev.cpp
7b2f324cee1eb556517b6f8a3aece0b50fff33ad
[]
no_license
Dat0309/CTDL-GT1
eebb73a24bd4fecf0ddb8428805017e88e4ad9da
8b5a7ed4f98e5d553bf3c284cd165ae2bd7c5dcc
refs/heads/main
2023-06-09T23:04:49.994095
2021-06-23T03:34:47
2021-06-23T03:34:47
379,462,390
1
0
null
null
null
null
UTF-8
C++
false
false
603
cpp
// xrngdev: random device for TR1 random number generators #define _CRT_RAND_S // for rand_s #include <stdexcept> // for out_of_range // #include <random> _STD_BEGIN _CRTIMP2_PURE unsigned int __CLRCALL_PURE_OR_CDECL _Random_device(); _CRTIMP2_PURE unsigned int __CLRCALL_PURE_OR_CDECL _Random_device() { // return a random value unsigned int ans; if (_CSTD rand_s(&ans)) _Xout_of_range("invalid random_device value"); return (ans); } _STD_END /* * Copyright (c) 1992-2012 by P.J. Plauger. ALL RIGHTS RESERVED. * Consult your license regarding permissions and restrictions. V6.00:0009 */
[ "71766267+Dat0309@users.noreply.github.com" ]
71766267+Dat0309@users.noreply.github.com
71cc757b7bebf67ffeeb927f652a5c65dbea3bb9
0de72d530d147475b478ca2088313a151b1efd4d
/splitgate/core/sdk/sdk/AnimationSharing_classes.h
f2c955b7ed79bf492d80f99934d5bd3d83f85924
[]
no_license
gamefortech123/splitgate-cheat
aca411678799ea3d316197acbde3ee1775b1ca76
bf935f5b3c0dfc5d618298e76e474b1c8b3cea4b
refs/heads/master
2023-07-15T00:56:45.222698
2021-08-22T03:26:21
2021-08-22T03:26:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,023
h
#pragma once #include "..\..\pch.h" /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // Class AnimationSharing.AnimSharingStateInstance // 0x0028 (FullSize[0x02E0] - InheritedSize[0x02B8]) class UAnimSharingStateInstance : public UAnimInstance { public: class UAnimSequence* AnimationToPlay; // 0x02B8(0x0008) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) float PermutationTimeOffset; // 0x02C0(0x0004) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) float PlayRate; // 0x02C4(0x0004) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) bool bStateBool; // 0x02C8(0x0001) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) unsigned char UnknownData_8ZTJ[0x7]; // 0x02C9(0x0007) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) class UAnimSharingInstance* instance; // 0x02D0(0x0008) (ZeroConstructor, Transient, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPrivate) unsigned char UnknownData_VD3E[0x8]; // 0x02D8(0x0008) MISSED OFFSET (PADDING) static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimSharingStateInstance"); return ptr; } void GetInstancedActors(TArray<class AActor*>* Actors); }; // Class AnimationSharing.AnimSharingTransitionInstance // 0x0018 (FullSize[0x02D0] - InheritedSize[0x02B8]) class UAnimSharingTransitionInstance : public UAnimInstance { public: TWeakObjectPtr<class USkeletalMeshComponent> FromComponent; // 0x02B8(0x0008) (Edit, BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, InstancedReference, IsPlainOldData, NoDestructor, Protected, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierProtected) TWeakObjectPtr<class USkeletalMeshComponent> ToComponent; // 0x02C0(0x0008) (Edit, BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, InstancedReference, IsPlainOldData, NoDestructor, Protected, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierProtected) float BlendTime; // 0x02C8(0x0004) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) bool bBlendBool; // 0x02CC(0x0001) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) unsigned char UnknownData_HB4M[0x3]; // 0x02CD(0x0003) MISSED OFFSET (PADDING) static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimSharingTransitionInstance"); return ptr; } }; // Class AnimationSharing.AnimSharingAdditiveInstance // 0x0018 (FullSize[0x02D0] - InheritedSize[0x02B8]) class UAnimSharingAdditiveInstance : public UAnimInstance { public: TWeakObjectPtr<class USkeletalMeshComponent> BaseComponent; // 0x02B8(0x0008) (Edit, BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, InstancedReference, IsPlainOldData, NoDestructor, Protected, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierProtected) TWeakObjectPtr<class UAnimSequence> AdditiveAnimation; // 0x02C0(0x0008) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierProtected) float Alpha; // 0x02C8(0x0004) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) bool bStateBool; // 0x02CC(0x0001) (Edit, BlueprintVisible, BlueprintReadOnly, ZeroConstructor, Transient, DisableEditOnInstance, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected) unsigned char UnknownData_NPVR[0x3]; // 0x02CD(0x0003) MISSED OFFSET (PADDING) static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimSharingAdditiveInstance"); return ptr; } }; // Class AnimationSharing.AnimSharingInstance // 0x00F0 (FullSize[0x0118] - InheritedSize[0x0028]) class UAnimSharingInstance : public UObject { public: TArray<class AActor*> RegisteredActors; // 0x0028(0x0010) (Edit, ZeroConstructor, Transient, EditConst, NativeAccessSpecifierPublic) unsigned char UnknownData_6UTF[0x50]; // 0x0038(0x0050) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) class UAnimationSharingStateProcessor* StateProcessor; // 0x0088(0x0008) (Edit, ZeroConstructor, Transient, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) unsigned char UnknownData_PVXY[0x38]; // 0x0090(0x0038) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) TArray<class UAnimSequence*> UsedAnimationSequences; // 0x00C8(0x0010) (Edit, ZeroConstructor, Transient, EditConst, NativeAccessSpecifierPublic) unsigned char UnknownData_XOKG[0x10]; // 0x00D8(0x0010) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) class UEnum* StateEnum; // 0x00E8(0x0008) (Edit, ZeroConstructor, Transient, EditConst, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class AActor* SharingActor; // 0x00F0(0x0008) (Edit, ZeroConstructor, Transient, EditConst, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) unsigned char UnknownData_7LGG[0x20]; // 0x00F8(0x0020) MISSED OFFSET (PADDING) static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimSharingInstance"); return ptr; } }; // Class AnimationSharing.AnimationSharingManager // 0x0060 (FullSize[0x0088] - InheritedSize[0x0028]) class UAnimationSharingManager : public UObject { public: TArray<class USkeleton*> Skeletons; // 0x0028(0x0010) (ZeroConstructor, Transient, Protected, NativeAccessSpecifierProtected) TArray<class UAnimSharingInstance*> PerSkeletonData; // 0x0038(0x0010) (Edit, ZeroConstructor, Transient, EditConst, Protected, NativeAccessSpecifierProtected) unsigned char UnknownData_E961[0x40]; // 0x0048(0x0040) MISSED OFFSET (PADDING) static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimationSharingManager"); return ptr; } void RegisterActorWithSkeletonBP(class AActor* InActor, class USkeleton* SharingSkeleton); class UAnimationSharingManager* STATIC_GetAnimationSharingManager(class UObject* WorldContextObject); bool STATIC_CreateAnimationSharingManager(class UObject* WorldContextObject, class UAnimationSharingSetup* Setup); bool STATIC_AnimationSharingEnabled(); }; // Class AnimationSharing.AnimationSharingSetup // 0x0020 (FullSize[0x0048] - InheritedSize[0x0028]) class UAnimationSharingSetup : public UObject { public: TArray<struct FPerSkeletonAnimationSharingSetup> SkeletonSetups; // 0x0028(0x0010) (Edit, ZeroConstructor, Config, NativeAccessSpecifierPublic) struct FAnimationSharingScalability ScalabilitySettings; // 0x0038(0x0010) (Edit, Config, NoDestructor, NativeAccessSpecifierPublic) static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimationSharingSetup"); return ptr; } }; // Class AnimationSharing.AnimationSharingStateProcessor // 0x0028 (FullSize[0x0050] - InheritedSize[0x0028]) class UAnimationSharingStateProcessor : public UObject { public: unsigned char AnimationStateEnum[0x28]; // 0x0028(0x0028) UNKNOWN PROPERTY: SoftObjectProperty static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AnimationSharing.AnimationSharingStateProcessor"); return ptr; } void ProcessActorState(int* OutState, class AActor* InActor, unsigned char CurrentState, unsigned char OnDemandState, bool* bShouldProcess); class UEnum* GetAnimationStateEnum(); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "nickmantini01@gmail.com" ]
nickmantini01@gmail.com
ec6e4a0a7710bd8dc0e5d4d581ad1262e2784c2e
feff5dadc85629c0947abf87a79f86ace8c84539
/codejam/2022-qualify/C.cpp
25cc14cab3a2ce5f3062dc390ffdfd416e491130
[]
no_license
Redleaf23477/ojcodes
af7582d9de8619509fa4ffa5338b2a59d9176608
7ee3053a88a78f74764bc473b3bd4887ceac6734
refs/heads/master
2023-08-13T22:34:58.000532
2023-08-10T15:54:05
2023-08-10T15:54:05
107,507,680
0
0
null
null
null
null
UTF-8
C++
false
false
613
cpp
#include <bits/stdc++.h> using namespace std; using LL = long long int; void solve() { constexpr int B = 1e6 + 1; int n; cin >> n; vector<int> bucket(B, 0); for (int i = 0; i < n; i++) { int x; cin >> x; bucket[x] += 1; } int ans = 0; for (int i = 0; i < B; i++) { while (bucket[i] > 0 && i > ans) { bucket[i] -= 1, ans += 1; } } cout << ans << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(); int T; cin >> T; for (int t = 1; t <= T; t++) { cout << "Case #" << t << ": "; solve(); } }
[ "schpokeool@gmail.com" ]
schpokeool@gmail.com
5b4fbb11bbaa3f13adc4461aabcf6a7e6eac289f
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
/NT/com/ole32/oleui/cnfgpsht.cpp
a12e9c9c9517de546356f23f460f18f3eb19870b
[]
no_license
jjzhang166/WinNT5_src_20201004
712894fcf94fb82c49e5cd09d719da00740e0436
b2db264153b80fbb91ef5fc9f57b387e223dbfc2
refs/heads/Win2K3
2023-08-12T01:31:59.670176
2021-10-14T15:14:37
2021-10-14T15:14:37
586,134,273
1
0
null
2023-01-07T03:47:45
2023-01-07T03:47:44
null
UTF-8
C++
false
false
4,474
cpp
//+--------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1993 - 1997. // // File: cnfgpsht.cpp // // Contents: Implements class COlecnfgPropertySheet // // Classes: // // Methods: COlecnfgPropertySheet::COlecnfgPropertySheet // COlecnfgPropertySheet::~COlecnfgPropertySheet // COlecnfgPropertySheet::DoModal // COlecnfgPropertySheet::Create // COlecnfgPropertySheet::OnNcCreate // COlecnfgPropertySheet::OnCommand // // History: 23-Apr-96 BruceMa Created. // //---------------------------------------------------------------------- #include "stdafx.h" #include "afxtempl.h" #include "resource.h" #include "cstrings.h" #include "creg.h" #include "types.h" #include "datapkt.h" #if !defined(STANDALONE_BUILD) extern "C" { #include <getuser.h> } #endif #include "util.h" #include "virtreg.h" #include "CnfgPSht.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // COlecnfgPropertySheet IMPLEMENT_DYNAMIC(COlecnfgPropertySheet, CPropertySheet) COlecnfgPropertySheet::COlecnfgPropertySheet(CWnd* pWndParent) : CPropertySheet(IDS_PROPSHT_CAPTION, pWndParent) { // Set the title CString sTitle; sTitle.LoadString(IDS_PSMAIN_TITLE); SetTitle(sTitle, PSH_PROPTITLE); // Add all of the property pages here. Note that // the order that they appear in here will be // the order they appear in on screen. By default, // the first page of the set is the active one. // One way to make a different property page the // active one is to call SetActivePage(). // Disable property sheet help button m_psh.dwFlags &= ~PSH_HASHELP; m_Page1.m_psp.dwFlags &= ~PSH_HASHELP; m_Page2.m_psp.dwFlags &= ~PSH_HASHELP; m_Page3.m_psp.dwFlags &= ~PSH_HASHELP; m_Page4.m_psp.dwFlags &= ~PSH_HASHELP; AddPage(&m_Page1); AddPage(&m_Page2); AddPage(&m_Page3); AddPage(&m_Page4); } COlecnfgPropertySheet::~COlecnfgPropertySheet() { } BEGIN_MESSAGE_MAP(COlecnfgPropertySheet, CPropertySheet) //{{AFX_MSG_MAP(COlecnfgPropertySheet) ON_WM_NCCREATE() ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COlecnfgPropertySheet message handlers INT_PTR COlecnfgPropertySheet::DoModal() { return CPropertySheet::DoModal(); } BOOL COlecnfgPropertySheet::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } BOOL COlecnfgPropertySheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { if (!CPropertySheet::OnNcCreate(lpCreateStruct)) return FALSE; // Enable context help ModifyStyleEx(0, WS_EX_CONTEXTHELP); return TRUE; } BOOL COlecnfgPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class switch (LOWORD(wParam)) { case IDOK: case ID_APPLY_NOW: g_virtreg.ApplyAll(); // Check whether the user changed something that requires a notification to DCOM if (g_fReboot) { g_util.UpdateDCOMInfo(); // With the above interface to the SCM we don't have to ask the // user whether to reboot. However, I'll keep the code for // posterity. /* CString sCaption; CString sMessage; sCaption.LoadString(IDS_SYSTEMMESSAGE); sMessage.LoadString(IDS_REBOOT); if (MessageBox(sMessage, sCaption, MB_YESNO) == IDYES) { if (g_util.AdjustPrivilege(SE_SHUTDOWN_NAME)) { // Now reboot ExitWindowsEx(EWX_REBOOT, 0); } } */ } break; } return CPropertySheet::OnCommand(wParam, lParam); } void COlecnfgPropertySheet::OnDestroy() { CPropertySheet::OnDestroy(); }
[ "seta7D5@protonmail.com" ]
seta7D5@protonmail.com
32f3749702fa34b591b880b980e4babad115a7aa
cc047b5c8a3a8049912a15d03e37fa4f68aaf37b
/6/6,3.cpp
08ad80a56c2fdd5be4c264d4fafd5c886da64431
[]
no_license
SeiperLu/Nauka
a046609f38478ddd5f1922a74eb1d3bd59bdd8d5
39411650c262b6b9232d9a0ab3859240a72c9f9e
refs/heads/master
2023-07-14T19:29:45.229810
2021-08-12T11:04:39
2021-08-12T11:04:39
343,428,592
0
0
null
null
null
null
UTF-8
C++
false
false
513
cpp
#include<iostream> const int Fave = 27; int main() { using namespace std; int n; cout << "Szukaj mojej ulubionej liczby - miesci sie w zakresie 1 - 100: "; do { cin >> n; if ( n < Fave) cout << "Za malo - probuj dalej: "; else if (n > Fave) cout << "Za duzo - probuj dalej: "; else cout << Fave << " to jest to!\n"; }while (n != Fave); cin.get(); cin.get(); return 0; }
[ "grzechuw1236@gmail.com" ]
grzechuw1236@gmail.com
f2af491482e085f46e563f36ddeddea8183cbac9
8a4a69e5b39212b955eb52cc005311a440189c9b
/src/mame/machine/atarigen.h
5a7c2b9ae8667cd685e83854ad523760dcbb4a91
[]
no_license
Ced2911/mame-lx
7d503b63eb5ae52f1e49763fc156dffa18517ec9
e58a80fefc46bdb879790c6bcfe882a9aff6f3ae
refs/heads/master
2021-01-01T17:37:22.723553
2012-02-04T10:05:52
2012-02-04T10:05:52
3,058,666
1
7
null
null
null
null
UTF-8
C++
false
false
13,668
h
/*************************************************************************** atarigen.h General functions for Atari games. **************************************************************************** Copyright Aaron Giles All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name 'MAME' nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY AARON GILES ''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 AARON GILES 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. ***************************************************************************/ #ifndef __MACHINE_ATARIGEN__ #define __MACHINE_ATARIGEN__ #include "machine/nvram.h" #include "machine/er2055.h" /*************************************************************************** CONSTANTS ***************************************************************************/ #define ATARI_CLOCK_14MHz XTAL_14_31818MHz #define ATARI_CLOCK_20MHz XTAL_20MHz #define ATARI_CLOCK_32MHz XTAL_32MHz #define ATARI_CLOCK_50MHz XTAL_50MHz /*************************************************************************** TYPES & STRUCTURES ***************************************************************************/ typedef void (*atarigen_int_func)(running_machine &machine); typedef void (*atarigen_scanline_func)(screen_device &screen, int scanline); typedef struct _atarivc_state_desc atarivc_state_desc; struct _atarivc_state_desc { UINT32 latch1; /* latch #1 value (-1 means disabled) */ UINT32 latch2; /* latch #2 value (-1 means disabled) */ UINT32 rowscroll_enable; /* true if row-scrolling is enabled */ UINT32 palette_bank; /* which palette bank is enabled */ UINT32 pf0_xscroll; /* playfield 1 xscroll */ UINT32 pf0_xscroll_raw; /* playfield 1 xscroll raw value */ UINT32 pf0_yscroll; /* playfield 1 yscroll */ UINT32 pf1_xscroll; /* playfield 2 xscroll */ UINT32 pf1_xscroll_raw; /* playfield 2 xscroll raw value */ UINT32 pf1_yscroll; /* playfield 2 yscroll */ UINT32 mo_xscroll; /* sprite xscroll */ UINT32 mo_yscroll; /* sprite xscroll */ }; typedef struct _atarigen_screen_timer atarigen_screen_timer; struct _atarigen_screen_timer { screen_device *screen; emu_timer * scanline_interrupt_timer; emu_timer * scanline_timer; emu_timer * atarivc_eof_update_timer; }; class atarigen_state : public driver_device { public: atarigen_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_earom(*this, "earom"), m_eeprom(*this, "eeprom"), m_eeprom_size(*this, "eeprom") { } // users must call through to these virtual void machine_start(); virtual void machine_reset(); // vector and early raster EAROM interface DECLARE_READ8_MEMBER( earom_r ); DECLARE_WRITE8_MEMBER( earom_w ); DECLARE_WRITE8_MEMBER( earom_control_w ); // vector and early raster EAROM interface optional_device<er2055_device> m_earom; UINT8 m_earom_data; UINT8 m_earom_control; optional_shared_ptr<UINT16> m_eeprom; optional_shared_size m_eeprom_size; UINT8 m_scanline_int_state; UINT8 m_sound_int_state; UINT8 m_video_int_state; const UINT16 * m_eeprom_default; UINT8 m_cpu_to_sound_ready; UINT8 m_sound_to_cpu_ready; UINT16 * m_playfield; UINT16 * m_playfield2; UINT16 * m_playfield_upper; UINT16 * m_alpha; UINT16 * m_alpha2; UINT16 * m_xscroll; UINT16 * m_yscroll; UINT32 * m_playfield32; UINT32 * m_alpha32; tilemap_t * m_playfield_tilemap; tilemap_t * m_playfield2_tilemap; tilemap_t * m_alpha_tilemap; tilemap_t * m_alpha2_tilemap; UINT16 * m_atarivc_data; UINT16 * m_atarivc_eof_data; atarivc_state_desc m_atarivc_state; /* internal state */ atarigen_int_func m_update_int_callback; UINT8 m_eeprom_unlocked; UINT8 m_slapstic_num; UINT16 * m_slapstic; UINT8 m_slapstic_bank; void * m_slapstic_bank0; offs_t m_slapstic_last_pc; offs_t m_slapstic_last_address; offs_t m_slapstic_base; offs_t m_slapstic_mirror; device_t * m_sound_cpu; UINT8 m_cpu_to_sound; UINT8 m_sound_to_cpu; UINT8 m_timed_int; UINT8 m_ym2151_int; atarigen_scanline_func m_scanline_callback; UINT32 m_scanlines_per_callback; UINT32 m_actual_vc_latch0; UINT32 m_actual_vc_latch1; UINT8 m_atarivc_playfields; UINT32 m_playfield_latch; UINT32 m_playfield2_latch; atarigen_screen_timer m_screen_timer[2]; }; /*************************************************************************** FUNCTION PROTOTYPES ***************************************************************************/ /*--------------------------------------------------------------- OVERALL INIT ---------------------------------------------------------------*/ void atarigen_init(running_machine &machine); /*--------------------------------------------------------------- INTERRUPT HANDLING ---------------------------------------------------------------*/ void atarigen_interrupt_reset(atarigen_state *state, atarigen_int_func update_int); void atarigen_update_interrupts(running_machine &machine); void atarigen_scanline_int_set(screen_device &screen, int scanline); INTERRUPT_GEN( atarigen_scanline_int_gen ); WRITE16_HANDLER( atarigen_scanline_int_ack_w ); WRITE32_HANDLER( atarigen_scanline_int_ack32_w ); INTERRUPT_GEN( atarigen_sound_int_gen ); WRITE16_HANDLER( atarigen_sound_int_ack_w ); WRITE32_HANDLER( atarigen_sound_int_ack32_w ); INTERRUPT_GEN( atarigen_video_int_gen ); WRITE16_HANDLER( atarigen_video_int_ack_w ); WRITE32_HANDLER( atarigen_video_int_ack32_w ); /*--------------------------------------------------------------- EEPROM HANDLING ---------------------------------------------------------------*/ void atarigen_eeprom_reset(atarigen_state *state); WRITE16_HANDLER( atarigen_eeprom_enable_w ); WRITE16_HANDLER( atarigen_eeprom_w ); READ16_HANDLER( atarigen_eeprom_r ); READ16_HANDLER( atarigen_eeprom_upper_r ); WRITE32_HANDLER( atarigen_eeprom_enable32_w ); WRITE32_HANDLER( atarigen_eeprom32_w ); READ32_HANDLER( atarigen_eeprom_upper32_r ); /*--------------------------------------------------------------- SLAPSTIC HANDLING ---------------------------------------------------------------*/ void atarigen_slapstic_init(device_t *device, offs_t base, offs_t mirror, int chipnum); void atarigen_slapstic_reset(atarigen_state *state); WRITE16_HANDLER( atarigen_slapstic_w ); READ16_HANDLER( atarigen_slapstic_r ); /*--------------------------------------------------------------- SOUND I/O ---------------------------------------------------------------*/ void atarigen_sound_io_reset(device_t *device); INTERRUPT_GEN( atarigen_6502_irq_gen ); READ8_HANDLER( atarigen_6502_irq_ack_r ); WRITE8_HANDLER( atarigen_6502_irq_ack_w ); void atarigen_ym2151_irq_gen(device_t *device, int irq); WRITE16_HANDLER( atarigen_sound_w ); READ16_HANDLER( atarigen_sound_r ); WRITE16_HANDLER( atarigen_sound_upper_w ); READ16_HANDLER( atarigen_sound_upper_r ); WRITE32_HANDLER( atarigen_sound_upper32_w ); READ32_HANDLER( atarigen_sound_upper32_r ); void atarigen_sound_reset(running_machine &machine); WRITE16_HANDLER( atarigen_sound_reset_w ); WRITE8_HANDLER( atarigen_6502_sound_w ); READ8_HANDLER( atarigen_6502_sound_r ); /*--------------------------------------------------------------- SOUND HELPERS ---------------------------------------------------------------*/ void atarigen_set_ym2151_vol(running_machine &machine, int volume); void atarigen_set_ym2413_vol(running_machine &machine, int volume); void atarigen_set_pokey_vol(running_machine &machine, int volume); void atarigen_set_tms5220_vol(running_machine &machine, int volume); void atarigen_set_oki6295_vol(running_machine &machine, int volume); /*--------------------------------------------------------------- VIDEO CONTROLLER ---------------------------------------------------------------*/ void atarivc_reset(screen_device &screen, UINT16 *eof_data, int playfields); void atarivc_w(screen_device &screen, offs_t offset, UINT16 data, UINT16 mem_mask); UINT16 atarivc_r(screen_device &screen, offs_t offset); INLINE void atarivc_update_pf_xscrolls(atarigen_state *state) { state->m_atarivc_state.pf0_xscroll = state->m_atarivc_state.pf0_xscroll_raw + ((state->m_atarivc_state.pf1_xscroll_raw) & 7); state->m_atarivc_state.pf1_xscroll = state->m_atarivc_state.pf1_xscroll_raw + 4; } /*--------------------------------------------------------------- PLAYFIELD/ALPHA MAP HELPERS ---------------------------------------------------------------*/ WRITE16_HANDLER( atarigen_alpha_w ); WRITE32_HANDLER( atarigen_alpha32_w ); WRITE16_HANDLER( atarigen_alpha2_w ); void atarigen_set_playfield_latch(atarigen_state *state, int data); void atarigen_set_playfield2_latch(atarigen_state *state, int data); WRITE16_HANDLER( atarigen_playfield_w ); WRITE32_HANDLER( atarigen_playfield32_w ); WRITE16_HANDLER( atarigen_playfield_large_w ); WRITE16_HANDLER( atarigen_playfield_upper_w ); WRITE16_HANDLER( atarigen_playfield_dual_upper_w ); WRITE16_HANDLER( atarigen_playfield_latched_lsb_w ); WRITE16_HANDLER( atarigen_playfield_latched_msb_w ); WRITE16_HANDLER( atarigen_playfield2_w ); WRITE16_HANDLER( atarigen_playfield2_latched_msb_w ); /*--------------------------------------------------------------- VIDEO HELPERS ---------------------------------------------------------------*/ void atarigen_scanline_timer_reset(screen_device &screen, atarigen_scanline_func update_graphics, int frequency); int atarigen_get_hblank(screen_device &screen); void atarigen_halt_until_hblank_0(screen_device &screen); WRITE16_HANDLER( atarigen_666_paletteram_w ); WRITE16_HANDLER( atarigen_expanded_666_paletteram_w ); WRITE32_HANDLER( atarigen_666_paletteram32_w ); /*--------------------------------------------------------------- MISC HELPERS ---------------------------------------------------------------*/ void atarigen_swap_mem(void *ptr1, void *ptr2, int bytes); void atarigen_blend_gfx(running_machine &machine, int gfx0, int gfx1, int mask0, int mask1); /*************************************************************************** GENERAL ATARI NOTES **************************************************************************## Atari 68000 list: Driver Pr? Up? VC? PF? P2? MO? AL? BM? PH? ---------- --- --- --- --- --- --- --- --- --- arcadecl.c * * * atarig1.c * * rle * atarig42.c * * rle * atarigt.c * rle * atarigx2.c * rle * atarisy1.c * * * * * 270->260 atarisy2.c * * * * * 150->120 badlands.c * * * 250->260 batman.c * * * * * * * * 200->160 ? blstroid.c * * * 240->230 cyberbal.c * * * * 125->105 ? eprom.c * * * * 170->170 gauntlet.c * * * * * * 220->250 klax.c * * * * 480->440 ? offtwall.c * * * * 260->260 rampart.c * * * 280->280 relief.c * * * * * * 240->240 shuuz.c * * * * 410->290 fix! skullxbo.c * * * * 150->145 thunderj.c * * * * * * * 180->180 toobin.c * * * * 140->115 fix! vindictr.c * * * * * * 200->210 xybots.c * * * * * 235->238 ---------- --- --- --- --- --- --- --- --- --- Pr? - do we have verifiable proof on priorities? Up? - have we updated to use new MO's & tilemaps? VC? - does it use the video controller? PF? - does it have a playfield? P2? - does it have a dual playfield? MO? - does it have MO's? AL? - does it have an alpha layer? BM? - does it have a bitmap layer? PH? - does it use the palette hack? ***************************************************************************/ #endif
[ "cc2911@facebook.com" ]
cc2911@facebook.com
0758c1e88b5c140d7dbdd5f15b22fbe262089519
48070e29210b0f8815ea29b698bae64fb86ae020
/src/cpp/engine/scene.h
0c4f880c164da4b883a197815bd7a8a816dfd7ad
[]
no_license
Nuos/LoD
e1049f74b07e05f07467d9a2e23acdff1aa5ec44
5fe4802ce0fceb26c96137c6781866ae2937fe7a
refs/heads/master
2021-01-17T10:40:27.110169
2015-02-11T23:27:10
2015-02-11T23:27:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,727
h
// Copyright (c) 2014, Tamas Csala #ifndef ENGINE_SCENE_H_ #define ENGINE_SCENE_H_ #include <vector> #include <memory> #include <btBulletDynamicsCommon.h> #include "./oglwrap_config.h" #include "../oglwrap/oglwrap.h" #include "./timer.h" #include "./camera.h" #include "./game_object.h" #include "./behaviour.h" #include "./shader_manager.h" #include "./auto_reset_event.h" #include "../shadow.h" namespace engine { class GameObject; class Scene : public Behaviour { public: Scene(); virtual ~Scene() { // The GameObject's destructor have to run here // as they might use the scene ptr in their destructor for (auto& comp_ptr : components_) { comp_ptr.reset(); } // close the physics thread physics_thread_should_quit_ = true; physics_can_run_.set(); physics_thread_.join(); } virtual float gravity() const { return 9.81f; } const btDynamicsWorld* world() const { return world_.get(); } btDynamicsWorld* world() { return world_.get(); } const Timer& game_time() const { return game_time_; } Timer& game_time() { return game_time_; } const Timer& environment_time() const { return environment_time_; } Timer& environment_time() { return environment_time_; } const Timer& camera_time() const { return camera_time_; } Timer& camera_time() { return camera_time_; } const Camera* camera() const { return camera_; } Camera* camera() { return camera_; } void set_camera(Camera* camera) { camera_ = camera; } const Shadow* shadow() const { return shadow_; } Shadow* shadow() { return shadow_; } void set_shadow(Shadow* shadow) { shadow_ = shadow; } ShaderManager* shader_manager(); GLFWwindow* window() const { return window_; } void set_window(GLFWwindow* window) { window_ = window; } virtual void keyAction(int key, int scancode, int action, int mods) override { if (action == GLFW_PRESS) { switch (key) { case GLFW_KEY_F1: game_time_.toggle(); break; case GLFW_KEY_F2: environment_time_.toggle(); break; default: break; } } } virtual void turn() { physics_finished_.waitOne(); updateAll(); physics_can_run_.set(); shadowRenderAll(); renderAll(); render2DAll(); } protected: // Bullet classes std::unique_ptr<btCollisionConfiguration> collision_config_; std::unique_ptr<btDispatcher> dispatcher_; std::unique_ptr<btBroadphaseInterface> broadphase_; std::unique_ptr<btConstraintSolver> solver_; std::unique_ptr<btDynamicsWorld> world_; // physics thread data AutoResetEvent physics_can_run_{false}, physics_finished_{true}; bool physics_thread_should_quit_; std::thread physics_thread_; // Own data Camera* camera_; Shadow* shadow_; Timer game_time_, environment_time_, camera_time_; GLFWwindow* window_; virtual void updateAll() override { game_time_.tick(); environment_time_.tick(); camera_time_.tick(); Behaviour::updateAll(); } virtual void shadowRenderAll() override { if (camera_ && shadow_) { shadow_->begin(); { Behaviour::shadowRenderAll(); } shadow_->end(); } } virtual void renderAll() override { if (camera_) { Behaviour::renderAll(); } } virtual void render2DAll() override { gl::TemporarySet capabilities{{{gl::kBlend, true}, {gl::kCullFace, false}, {gl::kDepthTest, false}}}; gl::BlendFunc(gl::kSrcAlpha, gl::kOneMinusSrcAlpha); Behaviour::render2DAll(); } virtual void updatePhysics() { if (world_) { world_->stepSimulation(game_time().dt, 0); } } }; } // namespace engine #endif
[ "tomius1994@gmail.com" ]
tomius1994@gmail.com
f43dab280229c3b8edc05c55e1eefb4c41d44b93
bf611ee308c96877fd9482983b30c2ec61458445
/src/EnemyClass.hpp
f78051aead63e04ab0370c0ac4b0cd16cf208aba
[]
no_license
AleksandarTheBoulderRankovic/A_VALID_CI_PROJECT
c67fadb19a4c04cd1cd7d4cb016ab0d87f077108
e6689f779938fad7eb683f2051740e22b80643f7
refs/heads/master
2020-12-19T19:19:43.696115
2020-04-25T08:21:34
2020-04-25T08:21:34
235,827,576
0
1
null
null
null
null
UTF-8
C++
false
false
17,697
hpp
#ifndef _ENEMY_CLASS_HPP #define _ENEMY_CLASS_HPP using namespace sf; //Enemy class - this is used to animate everything - and storage for our rectangle frames class EnemyClass{ public: EnemyClass(){ init_rectangles(); } void Animation(){ //duration of a frame int delta_time = 200; Clock imp_idle_clock; Clock imp_walk_clock; Clock attack_clock; Clock death_clock; Clock fireball_clock; //dino Clock dino_slam_clock; Clock dino_walk_clock; //cleo Clock cleo_idle_clock; Clock cleo_walk_clock; Clock cleo_attack_clock; Clock cleo_death_clock; //witch Clock witch_idle_clock; Clock witch_walk_clock; Clock witch_attack_clock; Clock witch_death_clock; Clock witch_broom_clock; //minotaur Clock minotaur_idle_clock; Clock minotaur_taunt_clock; Clock minotaur_walk_clock; Clock minotaur_attack_1_clock; Clock minotaur_attack_2_clock; Clock minotaur_attack_3_clock; Clock minotaur_attack_4_clock; Clock minotaur_death_clock; //batsy Clock batsy_fly_clock; Clock batsy_attack_clock; Clock batsy_death_clock; while(true){ //imp index_update(delta_time, imp_idle_clock, 7, rectangles_index_); index_update(delta_time, imp_walk_clock, 8, rectangles_index_walk_); index_update(delta_time, attack_clock, 6, rectangles_index_attack_); index_update(delta_time, death_clock, 6, rectangles_index_death_); index_update(delta_time + 200, fireball_clock, 6, rectangles_index_heart_); //cleopatra index_update(delta_time, cleo_idle_clock, 4, rectangles_index_cleo_idle_); index_update(delta_time, cleo_walk_clock, 4, rectangles_index_cleo_walk_); index_update(delta_time + 200, cleo_attack_clock, 2, rectangles_index_cleo_attack_); index_update(delta_time, cleo_death_clock, 6, rectangles_index_cleo_death_); //dino index_update(delta_time, dino_slam_clock, 4, rectangles_index_dino_slam_); index_update(delta_time, dino_walk_clock, 6, rectangles_index_dino_walk_); //witch index_update(delta_time, witch_idle_clock, 4, rectangles_index_witch_idle_); index_update(delta_time, witch_walk_clock, 8, rectangles_index_witch_walk_); index_update(delta_time, witch_attack_clock, 8, rectangles_index_witch_attack_); index_update(delta_time, witch_death_clock, 10, rectangles_index_witch_death_); index_update(delta_time, witch_broom_clock, 4, rectangles_index_witch_broom_); //minotaur index_update(delta_time, minotaur_idle_clock, 5, rectangles_index_minotaur_idle_); index_update(delta_time, minotaur_walk_clock, 8, rectangles_index_minotaur_walk_); index_update(delta_time, minotaur_taunt_clock, 5, rectangles_index_minotaur_taunt_); index_update(delta_time, minotaur_attack_1_clock, 9, rectangles_index_minotaur_attack_1_); index_update(delta_time, minotaur_attack_2_clock, 5, rectangles_index_minotaur_attack_2_); index_update(delta_time, minotaur_attack_3_clock, 6, rectangles_index_minotaur_attack_3_); index_update(75, minotaur_attack_4_clock, 6, rectangles_index_minotaur_attack_4_); index_update(delta_time, minotaur_death_clock, 6, rectangles_index_minotaur_death_); //batsy index_update(delta_time, batsy_fly_clock, 5, rectangles_index_batsy_fly_); index_update(25, batsy_attack_clock, 3, rectangles_index_batsy_attack_); index_update(delta_time, batsy_death_clock, 6, rectangles_index_batsy_death_); }//while }//IdleAnimation std::vector<IntRect> rectangles_imp_idle_; std::vector<IntRect> rectangles_imp_walk_right_; std::vector<IntRect> rectangles_imp_walk_left_; std::vector<IntRect> rectangles_imp_attack_left_; std::vector<IntRect> rectangles_imp_attack_right_; std::vector<IntRect> rectangles_imp_death_; std::vector<IntRect> rectangles_imp_fireBall_left_; std::vector<IntRect> rectangles_imp_fireBall_right_; int rectangles_index_; int rectangles_index_walk_; int rectangles_index_attack_; int rectangles_index_death_; int rectangles_index_fireball_; //dino parameters std::vector<IntRect> rectangles_dino_slam_left; std::vector<IntRect> rectangles_dino_slam_right; std::vector<IntRect> rectangles_dino_walk_left_; std::vector<IntRect> rectangles_dino_walk_right_; int rectangles_index_dino_slam_; int rectangles_index_dino_walk_; //cleo parameters std::vector<IntRect> rectangles_cleo_idle_; std::vector<IntRect> rectangles_cleo_walk_right_; std::vector<IntRect> rectangles_cleo_walk_left_; std::vector<IntRect> rectangles_cleo_attack_; std::vector<IntRect> rectangles_cleo_death_; int rectangles_index_cleo_idle_; int rectangles_index_cleo_walk_; int rectangles_index_cleo_attack_; int rectangles_index_heart_; int rectangles_index_cleo_death_; //witch parameters std::vector<IntRect> rectangles_witch_idle_; std::vector<IntRect> rectangles_witch_walk_left_; std::vector<IntRect> rectangles_witch_walk_right_; std::vector<IntRect> rectangles_witch_attack_; std::vector<IntRect> rectangles_witch_death_; std::vector<IntRect> rectangles_witch_broom_; int rectangles_index_witch_idle_; int rectangles_index_witch_walk_; int rectangles_index_witch_attack_; int rectangles_index_witch_death_; int rectangles_index_witch_broom_; //minotaur parameters std::vector<IntRect> rectangles_minotaur_idle_; std::vector<IntRect> rectangles_minotaur_walk_left_; std::vector<IntRect> rectangles_minotaur_walk_right_; std::vector<IntRect> rectangles_minotaur_taunt_; std::vector<IntRect> rectangles_minotaur_attack_1_; std::vector<IntRect> rectangles_minotaur_attack_2_; std::vector<IntRect> rectangles_minotaur_attack_3_; std::vector<IntRect> rectangles_minotaur_attack_4_; std::vector<IntRect> rectangles_minotaur_death_; int rectangles_index_minotaur_idle_; int rectangles_index_minotaur_walk_; int rectangles_index_minotaur_taunt_; int rectangles_index_minotaur_attack_1_; int rectangles_index_minotaur_attack_2_; int rectangles_index_minotaur_attack_3_; int rectangles_index_minotaur_attack_4_; int rectangles_index_minotaur_death_; //batsy parameters std::vector<IntRect> rectangles_batsy_fly_; std::vector<IntRect> rectangles_sonic_attack_; std::vector<IntRect> rectangles_batsy_death_; int rectangles_index_batsy_fly_; int rectangles_index_batsy_attack_; int rectangles_index_batsy_death_; private: void index_update(int delta_time, Clock &clock, int iters, int &index){ if(clock.getElapsedTime().asMilliseconds() > delta_time){ index++; if(index == iters) index = 0; clock.restart(); } } void init_rectangles(){ //Cleopatra indices rectangles_index_cleo_idle_ = 0; rectangles_index_cleo_walk_ = 0; rectangles_index_cleo_attack_ = 0; rectangles_index_cleo_death_ = 0; //imp indices rectangles_index_ = 0; rectangles_index_walk_ = 0; rectangles_index_attack_ = 0; rectangles_index_death_ = 0; rectangles_index_fireball_ = 0; //dino indices rectangles_index_dino_slam_ = 0; rectangles_index_dino_walk_ = 0; //witch indices rectangles_index_witch_idle_ = 0; rectangles_index_witch_walk_ = 0; rectangles_index_witch_attack_ = 0; rectangles_index_witch_death_ = 0; rectangles_index_witch_broom_ = 0; //minotaur indices rectangles_index_minotaur_idle_ = 0; rectangles_index_minotaur_walk_ = 0; rectangles_index_minotaur_taunt_ = 0; rectangles_index_minotaur_attack_1_ = 0; rectangles_index_minotaur_attack_2_ = 0; rectangles_index_minotaur_attack_3_ = 0; rectangles_index_minotaur_attack_4_ = 0; rectangles_index_minotaur_death_ = 0; //batsy indices rectangles_index_batsy_fly_ = 0; rectangles_index_batsy_attack_ = 0; rectangles_index_batsy_death_ = 0; for (int i = 0; i < 4; i++){ rectangles_dino_slam_left.push_back(IntRect(150 , 25*i, 33, 25)); } for (int i = 0; i < 4; i++){ rectangles_dino_slam_right.push_back(IntRect(200 , 25*i, 33, 25)); } for (int i = 0; i < 6; i++){ rectangles_dino_walk_left_.push_back(IntRect(0 , 25*i, 33, 25)); } for (int i = 0; i < 6; i++){ rectangles_dino_walk_right_.push_back(IntRect(50 , 25*i, 33, 25)); } //Cleopatra rectangles for (int i = 0; i < 3; i++){ rectangles_cleo_idle_.push_back(IntRect(i*25, 0, 25, 25)); } rectangles_cleo_idle_.push_back(IntRect(25, 0, 25, 25)); for (int i = 0; i < 4; i++){ rectangles_cleo_walk_left_.push_back(IntRect(i*25, 75, 25, 25)); } for (int i = 0; i < 4; i++){ rectangles_cleo_walk_right_.push_back(IntRect(i*25, 50, 25, 25)); } //attack for (int i = 0; i < 4; i++){ rectangles_cleo_attack_.push_back(IntRect(i*25, 25, 25, 25)); } rectangles_cleo_attack_.push_back(IntRect(106, 10, 38, 38)); rectangles_cleo_attack_.push_back(IntRect(156, 10, 38, 38)); //death for (int i = 0; i < 6; i++){ rectangles_cleo_death_.push_back(IntRect(i*25, 150, 25, 25)); } for (int i = 5; i >= 0; i--){ rectangles_cleo_death_.push_back(IntRect(i*25, 175, 25, 25)); } //Imp rectangles for (int i = 0; i < 7; i++){ rectangles_imp_idle_.push_back(IntRect(10 + i*32, 209, 15, 15)); } for (int i = 0; i < 8; i++){ rectangles_imp_walk_left_.push_back(IntRect(10 + i*32, 241, 15, 15)); } for (int i = 0; i < 8; i++){ rectangles_imp_walk_right_.push_back(IntRect(7 + i*32, 49, 15, 15)); } for (int i = 0; i < 6; i++){ rectangles_imp_attack_left_.push_back(IntRect(9 + i*32, 273, 17, 15)); } for (int i = 0; i < 6; i++){ rectangles_imp_attack_right_.push_back(IntRect(7 + i*32, 81, 17, 15)); } for (int i = 0; i < 6; i++){ rectangles_imp_death_.push_back(IntRect(7 + i*32, 145, 16, 15)); } for (int i = 0; i < 6; i++){ rectangles_imp_death_.push_back(IntRect(9 + i*32, 337, 16, 15)); } //no pattern with fireballs :( rectangles_imp_fireBall_left_.push_back(IntRect(23, 377, 1, 1)); rectangles_imp_fireBall_left_.push_back(IntRect(54, 376, 3, 4)); rectangles_imp_fireBall_left_.push_back(IntRect(66, 376, 19, 3)); rectangles_imp_fireBall_left_.push_back(IntRect(98, 376, 9, 3)); rectangles_imp_fireBall_left_.push_back(IntRect(130, 376, 5, 3)); rectangles_imp_fireBall_left_.push_back(IntRect(162, 372, 4, 8)); rectangles_imp_fireBall_left_.push_back(IntRect(194, 375, 4, 8)); rectangles_imp_fireBall_right_.push_back(IntRect(8, 185, 1, 1)); rectangles_imp_fireBall_right_.push_back(IntRect(39, 184, 3, 4)); rectangles_imp_fireBall_right_.push_back(IntRect(75, 184, 19, 3)); rectangles_imp_fireBall_right_.push_back(IntRect(117, 184, 9, 3)); rectangles_imp_fireBall_right_.push_back(IntRect(153, 184, 5, 3)); rectangles_imp_fireBall_right_.push_back(IntRect(186, 181, 4, 8)); rectangles_imp_fireBall_right_.push_back(IntRect(218, 183, 4, 8)); //witch rectangles //idle for (int i = 0; i < 4; i++){ rectangles_witch_idle_.push_back(IntRect(4 + i*32, 4, 22, 27)); } //walk //right for (int i = 0; i < 8; i++){ rectangles_witch_walk_right_.push_back(IntRect(4 + i*32, 37, 22, 27)); } //left for (int i = 0; i < 8; i++){ rectangles_witch_walk_left_.push_back(IntRect(291 - i*32, 229, 25, 27)); } //attack //right for (int i = 0; i < 8; i++){ rectangles_witch_attack_.push_back(IntRect(1 + i*32, 68, 28, 27)); } //left for (int i = 0; i < 8; i++){ rectangles_witch_attack_.push_back(IntRect(291 - i*32, 261, 28, 27)); } //death //right for (int i = 0; i < 10; i++){ rectangles_witch_death_.push_back(IntRect(4 + i*32, 133, 25, 27)); } //left for (int i = 0; i < 10; i++){ rectangles_witch_death_.push_back(IntRect(293 - i*32, 325, 25, 27)); } //broom //right for (int i = 0; i < 4; i++){ rectangles_witch_broom_.push_back(IntRect(1 + i*32, 163, 28, 27)); } //left for (int i = 0; i < 4; i++){ rectangles_witch_broom_.push_back(IntRect(291 - i*32, 354, 28, 27)); } //MINOTAUR //Minotaur idle for (int i = 0; i < 5; i++){ rectangles_minotaur_idle_.push_back(IntRect(27 + i*96, 5, 53, 59)); } //Minotaur walk right for (int i = 0; i < 8; i++){ rectangles_minotaur_walk_right_.push_back(IntRect(25 + i*96, 101, 56, 59)); } //Minotaur walk left for (int i = 0; i < 8; i++){ rectangles_minotaur_walk_left_.push_back(IntRect(14 + i*96, 1061, 60, 59)); //1076 } //Minotaur taunt right for (int i = 0; i < 5; i++){ rectangles_minotaur_taunt_.push_back(IntRect(28 + i*96, 197, 56, 59)); } //Minotaur taunt left for (int i = 0; i < 5; i++){ rectangles_minotaur_taunt_.push_back(IntRect(16 + i*96, 1157, 60, 59)); } //Minotaur attack 1 right for (int i = 0; i < 9; i++){ rectangles_minotaur_attack_1_.push_back(IntRect(5 + i*96, 293, 83, 65)); } //Minotaur attack 1 left for (int i = 0; i < 9; i++){ rectangles_minotaur_attack_1_.push_back(IntRect(8 + i*96, 1253, 83, 65)); } //Minotaur attack 2 right for (int i = 0; i < 5; i++){ rectangles_minotaur_attack_2_.push_back(IntRect(28 + i*96, 389, 65, 61)); } //Minotaur attack 2 left for (int i = 0; i < 5; i++){ rectangles_minotaur_attack_2_.push_back(IntRect(6 + i*96, 1349, 65, 67)); } //Minotaur attack 3 right for (int i = 0; i < 6; i++){ rectangles_minotaur_attack_3_.push_back(IntRect(23 + i*96, 485, 38, 66)); } //Minotaur attack 3 left for (int i = 0; i < 6; i++){ rectangles_minotaur_attack_3_.push_back(IntRect(34 + i*96, 1445, 38, 62)); } //Minotaur attack 4 right for (int i = 3; i < 9; i++){ rectangles_minotaur_attack_4_.push_back(IntRect(2 + i*96, 581, 94, 63)); } //Minotaur attack 4 left for (int i = 3; i < 9; i++){ rectangles_minotaur_attack_4_.push_back(IntRect(6 + i*96, 1541, 90, 63)); } //Minotaur death right for (int i = 0; i < 6; i++){ rectangles_minotaur_death_.push_back(IntRect(28 + i*96, 869, 60, 69)); } //Minotaur death left for (int i = 0; i < 6; i++){ rectangles_minotaur_death_.push_back(IntRect(8 + i*96, 1829, 60, 69)); } //batsy //right for(int i = 0; i < 5; i++) rectangles_batsy_fly_.push_back(IntRect(1 + i*16, 27, 15, 11)); //left for(int i = 0; i < 5; i++) rectangles_batsy_fly_.push_back(IntRect(64 - i*16, 244, 16, 11)); //right for(int i = 0; i < 5; i++) rectangles_batsy_death_.push_back(IntRect(0 + i*16, 53, 15, 19)); rectangles_batsy_death_.push_back(IntRect(0 + 4*16, 53, 15, 19)); //left for(int i = 0; i < 5; i++) rectangles_batsy_death_.push_back(IntRect(64 - i*16, 269, 15, 19)); rectangles_batsy_death_.push_back(IntRect(64 - 4*16, 53, 15, 19)); //sonic attack //right rectangles_sonic_attack_.push_back(IntRect(45, 91, 35, 43)); rectangles_sonic_attack_.push_back(IntRect(45, 135, 35, 43)); rectangles_sonic_attack_.push_back(IntRect(45, 177, 35, 43)); //left rectangles_sonic_attack_.push_back(IntRect(0, 91, 35, 43)); rectangles_sonic_attack_.push_back(IntRect(0, 135, 35, 43)); rectangles_sonic_attack_.push_back(IntRect(0, 177, 35, 43)); } }; #endif // _ENEMY_CLASS_HPP
[ "mi16111@alas.matf.bg.ac.rs" ]
mi16111@alas.matf.bg.ac.rs
8f1d2ade03e6f4785e20e1af20c53392181f05c5
082cce2495043810a045564880dc235c16f7a3a9
/service/comms/subscriber.cc
17bbb992490f4d873c51ed9be8136ab084106e20
[ "Apache-2.0" ]
permissive
dusmith1974/osoa
bd1ce884fd14f7bca95ffdfb5c7147a94b54b392
0d24aadac2ad5085220e2318f86127d00603bf3e
refs/heads/master
2016-09-05T14:49:11.523471
2015-01-21T22:08:26
2015-01-21T22:08:26
14,902,733
0
1
null
null
null
null
UTF-8
C++
false
false
807
cc
// Copyright 2014 Duncan Smith // https://github.com/dusmith1974/osoa // // 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. // Implements the Subscriber class. #include "osoa_pch.h" // NOLINT #include "service/comms/subscriber.h" namespace osoa { Subscriber::~Subscriber() { } } // namespace osoa
[ "duncan.smith@telperin.com" ]
duncan.smith@telperin.com
05a9cf1f97fbdfb5e93f3f3b3d16433f5ca34336
24f26275ffcd9324998d7570ea9fda82578eeb9e
/components/performance_manager/graph/frame_node_impl_unittest.cc
7cc3883bb6ab0414c09c62c4c4af4e77bef1574b
[ "BSD-3-Clause" ]
permissive
Vizionnation/chromenohistory
70a51193c8538d7b995000a1b2a654e70603040f
146feeb85985a6835f4b8826ad67be9195455402
refs/heads/master
2022-12-15T07:02:54.461083
2019-10-25T15:07:06
2019-10-25T15:07:06
217,557,501
2
1
BSD-3-Clause
2022-11-19T06:53:07
2019-10-25T14:58:54
null
UTF-8
C++
false
false
14,470
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/performance_manager/graph/frame_node_impl.h" #include "components/performance_manager/graph/page_node_impl.h" #include "components/performance_manager/graph/process_node_impl.h" #include "components/performance_manager/test_support/graph_test_harness.h" #include "components/performance_manager/test_support/mock_graphs.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace performance_manager { namespace { using FrameNodeImplTest = GraphTestHarness; } // namespace TEST_F(FrameNodeImplTest, SafeDowncast) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame = CreateFrameNodeAutoId(process.get(), page.get()); FrameNode* node = frame.get(); EXPECT_EQ(frame.get(), FrameNodeImpl::FromNode(node)); NodeBase* base = frame.get(); EXPECT_EQ(base, NodeBase::FromNode(node)); EXPECT_EQ(static_cast<Node*>(node), base->ToNode()); } using FrameNodeImplDeathTest = FrameNodeImplTest; TEST_F(FrameNodeImplDeathTest, SafeDowncast) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame = CreateFrameNodeAutoId(process.get(), page.get()); ASSERT_DEATH_IF_SUPPORTED(PageNodeImpl::FromNodeBase(frame.get()), ""); } TEST_F(FrameNodeImplTest, AddFrameHierarchyBasic) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto parent_node = CreateFrameNodeAutoId(process.get(), page.get()); auto child2_node = CreateFrameNodeAutoId(process.get(), page.get(), parent_node.get(), 1); auto child3_node = CreateFrameNodeAutoId(process.get(), page.get(), parent_node.get(), 2); EXPECT_EQ(nullptr, parent_node->parent_frame_node()); EXPECT_EQ(2u, parent_node->child_frame_nodes().size()); EXPECT_EQ(parent_node.get(), child2_node->parent_frame_node()); EXPECT_EQ(parent_node.get(), child3_node->parent_frame_node()); } TEST_F(FrameNodeImplTest, GetFrameNodeById) { RenderProcessHostProxy render_process_proxy_a(42); RenderProcessHostProxy render_process_proxy_b(43); auto process_a = CreateNode<ProcessNodeImpl>(render_process_proxy_a); auto process_b = CreateNode<ProcessNodeImpl>(render_process_proxy_b); auto page = CreateNode<PageNodeImpl>(); auto frame_a1 = CreateFrameNodeAutoId(process_a.get(), page.get()); auto frame_a2 = CreateFrameNodeAutoId(process_a.get(), page.get()); auto frame_b1 = CreateFrameNodeAutoId(process_b.get(), page.get()); EXPECT_EQ(graph()->GetFrameNodeById(process_a->GetRenderProcessId(), frame_a1->render_frame_id()), frame_a1.get()); EXPECT_EQ(graph()->GetFrameNodeById(process_a->GetRenderProcessId(), frame_a2->render_frame_id()), frame_a2.get()); EXPECT_EQ(graph()->GetFrameNodeById(process_b->GetRenderProcessId(), frame_b1->render_frame_id()), frame_b1.get()); } TEST_F(FrameNodeImplTest, NavigationCommitted_SameDocument) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); EXPECT_TRUE(frame_node->url().is_empty()); const GURL url("http://www.foo.com/"); frame_node->OnNavigationCommitted(url, /* same_document */ true); EXPECT_EQ(url, frame_node->url()); } TEST_F(FrameNodeImplTest, NavigationCommitted_DifferentDocument) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); EXPECT_TRUE(frame_node->url().is_empty()); const GURL url("http://www.foo.com/"); frame_node->OnNavigationCommitted(url, /* same_document */ false); EXPECT_EQ(url, frame_node->url()); } TEST_F(FrameNodeImplTest, RemoveChildFrame) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto parent_frame_node = CreateFrameNodeAutoId(process.get(), page.get()); auto child_frame_node = CreateFrameNodeAutoId(process.get(), page.get(), parent_frame_node.get(), 1); // Ensure correct Parent-child relationships have been established. EXPECT_EQ(1u, parent_frame_node->child_frame_nodes().size()); EXPECT_TRUE(!parent_frame_node->parent_frame_node()); EXPECT_EQ(0u, child_frame_node->child_frame_nodes().size()); EXPECT_EQ(parent_frame_node.get(), child_frame_node->parent_frame_node()); child_frame_node.reset(); // Parent-child relationships should no longer exist. EXPECT_EQ(0u, parent_frame_node->child_frame_nodes().size()); EXPECT_TRUE(!parent_frame_node->parent_frame_node()); } namespace { class LenientMockObserver : public FrameNodeImpl::Observer { public: LenientMockObserver() = default; ~LenientMockObserver() override = default; MOCK_METHOD1(OnFrameNodeAdded, void(const FrameNode*)); MOCK_METHOD1(OnBeforeFrameNodeRemoved, void(const FrameNode*)); MOCK_METHOD1(OnIsCurrentChanged, void(const FrameNode*)); MOCK_METHOD1(OnNetworkAlmostIdleChanged, void(const FrameNode*)); MOCK_METHOD1(OnFrameLifecycleStateChanged, void(const FrameNode*)); MOCK_METHOD2(OnOriginTrialFreezePolicyChanged, void(const FrameNode*, const mojom::InterventionPolicy&)); MOCK_METHOD2(OnURLChanged, void(const FrameNode*, const GURL&)); MOCK_METHOD1(OnIsAdFrameChanged, void(const FrameNode*)); MOCK_METHOD1(OnFrameIsHoldingWebLockChanged, void(const FrameNode*)); MOCK_METHOD1(OnFrameIsHoldingIndexedDBLockChanged, void(const FrameNode*)); MOCK_METHOD1(OnNonPersistentNotificationCreated, void(const FrameNode*)); MOCK_METHOD1(OnPriorityAndReasonChanged, void(const FrameNode*)); void SetCreatedFrameNode(const FrameNode* frame_node) { created_frame_node_ = frame_node; } const FrameNode* created_frame_node() { return created_frame_node_; } private: const FrameNode* created_frame_node_ = nullptr; }; using MockObserver = ::testing::StrictMock<LenientMockObserver>; using testing::_; using testing::Invoke; } // namespace TEST_F(FrameNodeImplTest, ObserverWorks) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); MockObserver obs; graph()->AddFrameNodeObserver(&obs); // Create a frame node and expect a matching call to "OnFrameNodeAdded". EXPECT_CALL(obs, OnFrameNodeAdded(_)) .WillOnce(Invoke(&obs, &MockObserver::SetCreatedFrameNode)); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); testing::Mock::VerifyAndClear(&obs); const FrameNode* raw_frame_node = frame_node.get(); EXPECT_EQ(raw_frame_node, obs.created_frame_node()); // Invoke "SetIsCurrent" and expect a "OnIsCurrentChanged" callback. EXPECT_CALL(obs, OnIsCurrentChanged(raw_frame_node)); frame_node->SetIsCurrent(true); testing::Mock::VerifyAndClear(&obs); // Invoke "SetNetworkAlmostIdle" and expect an "OnNetworkAlmostIdleChanged" // callback. EXPECT_CALL(obs, OnNetworkAlmostIdleChanged(raw_frame_node)); frame_node->SetNetworkAlmostIdle(); testing::Mock::VerifyAndClear(&obs); // Invoke "SetLifecycleState" and expect an "OnFrameLifecycleStateChanged" // callback. EXPECT_CALL(obs, OnFrameLifecycleStateChanged(raw_frame_node)); frame_node->SetLifecycleState(mojom::LifecycleState::kFrozen); testing::Mock::VerifyAndClear(&obs); // Invoke "OnNonPersistentNotificationCreated" and expect an // "OnNonPersistentNotificationCreated" callback. EXPECT_CALL(obs, OnNonPersistentNotificationCreated(raw_frame_node)); frame_node->OnNonPersistentNotificationCreated(); testing::Mock::VerifyAndClear(&obs); // Invoke "OnNavigationCommitted" and expect an "OnURLChanged" callback. EXPECT_CALL(obs, OnURLChanged(raw_frame_node, _)); frame_node->OnNavigationCommitted(GURL("https://foo.com/"), true); testing::Mock::VerifyAndClear(&obs); // Release the frame node and expect a call to "OnBeforeFrameNodeRemoved". EXPECT_CALL(obs, OnBeforeFrameNodeRemoved(raw_frame_node)); frame_node.reset(); testing::Mock::VerifyAndClear(&obs); graph()->RemoveFrameNodeObserver(&obs); } TEST_F(FrameNodeImplTest, IsAdFrame) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); MockObserver obs; graph()->AddFrameNodeObserver(&obs); EXPECT_FALSE(frame_node->is_ad_frame()); EXPECT_CALL(obs, OnIsAdFrameChanged(frame_node.get())); frame_node->SetIsAdFrame(); EXPECT_TRUE(frame_node->is_ad_frame()); frame_node->SetIsAdFrame(); EXPECT_TRUE(frame_node->is_ad_frame()); graph()->RemoveFrameNodeObserver(&obs); } TEST_F(FrameNodeImplTest, IsHoldingWebLock) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); MockObserver obs; graph()->AddFrameNodeObserver(&obs); EXPECT_FALSE(frame_node->is_holding_weblock()); EXPECT_CALL(obs, OnFrameIsHoldingWebLockChanged(frame_node.get())); frame_node->SetIsHoldingWebLock(true); EXPECT_TRUE(frame_node->is_holding_weblock()); EXPECT_CALL(obs, OnFrameIsHoldingWebLockChanged(frame_node.get())); frame_node->SetIsHoldingWebLock(false); EXPECT_FALSE(frame_node->is_holding_weblock()); graph()->RemoveFrameNodeObserver(&obs); } TEST_F(FrameNodeImplTest, IsHoldingIndexedDBLock) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); MockObserver obs; graph()->AddFrameNodeObserver(&obs); EXPECT_CALL(obs, OnFrameIsHoldingIndexedDBLockChanged(frame_node.get())); frame_node->SetIsHoldingIndexedDBLock(true); EXPECT_TRUE(frame_node->is_holding_indexeddb_lock()); EXPECT_CALL(obs, OnFrameIsHoldingIndexedDBLockChanged(frame_node.get())); frame_node->SetIsHoldingIndexedDBLock(false); EXPECT_FALSE(frame_node->is_holding_indexeddb_lock()); graph()->RemoveFrameNodeObserver(&obs); } TEST_F(FrameNodeImplTest, Priority) { using PriorityAndReason = frame_priority::PriorityAndReason; auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); MockObserver obs; graph()->AddFrameNodeObserver(&obs); // By default the priority should be "lowest". EXPECT_EQ(base::TaskPriority::LOWEST, frame_node->priority_and_reason().priority()); // Changed the reason only. static const char kDummyReason[] = "this is a reason!"; EXPECT_CALL(obs, OnPriorityAndReasonChanged(frame_node.get())); frame_node->SetPriorityAndReason( PriorityAndReason(base::TaskPriority::LOWEST, kDummyReason)); EXPECT_EQ(PriorityAndReason(base::TaskPriority::LOWEST, kDummyReason), frame_node->priority_and_reason()); testing::Mock::VerifyAndClear(&obs); // Change the priority only. EXPECT_CALL(obs, OnPriorityAndReasonChanged(frame_node.get())); frame_node->SetPriorityAndReason( PriorityAndReason(base::TaskPriority::HIGHEST, kDummyReason)); EXPECT_EQ(PriorityAndReason(base::TaskPriority::HIGHEST, kDummyReason), frame_node->priority_and_reason()); testing::Mock::VerifyAndClear(&obs); // Change neither. frame_node->SetPriorityAndReason( PriorityAndReason(base::TaskPriority::HIGHEST, kDummyReason)); EXPECT_EQ(PriorityAndReason(base::TaskPriority::HIGHEST, kDummyReason), frame_node->priority_and_reason()); testing::Mock::VerifyAndClear(&obs); // Change both the priority and the reason. EXPECT_CALL(obs, OnPriorityAndReasonChanged(frame_node.get())); frame_node->SetPriorityAndReason( PriorityAndReason(base::TaskPriority::LOWEST, nullptr)); EXPECT_EQ(PriorityAndReason(base::TaskPriority::LOWEST, nullptr), frame_node->priority_and_reason()); testing::Mock::VerifyAndClear(&obs); graph()->RemoveFrameNodeObserver(&obs); } TEST_F(FrameNodeImplTest, PublicInterface) { auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); auto frame_node = CreateFrameNodeAutoId(process.get(), page.get()); const FrameNode* public_frame_node = frame_node.get(); // Simply test that the public interface impls yield the same result as their // private counterpart. EXPECT_EQ(static_cast<const FrameNode*>(frame_node->parent_frame_node()), public_frame_node->GetParentFrameNode()); EXPECT_EQ(static_cast<const PageNode*>(frame_node->page_node()), public_frame_node->GetPageNode()); EXPECT_EQ(static_cast<const ProcessNode*>(frame_node->process_node()), public_frame_node->GetProcessNode()); EXPECT_EQ(frame_node->frame_tree_node_id(), public_frame_node->GetFrameTreeNodeId()); EXPECT_EQ(frame_node->dev_tools_token(), public_frame_node->GetDevToolsToken()); EXPECT_EQ(frame_node->browsing_instance_id(), public_frame_node->GetBrowsingInstanceId()); EXPECT_EQ(frame_node->site_instance_id(), public_frame_node->GetSiteInstanceId()); auto child_frame_nodes = public_frame_node->GetChildFrameNodes(); for (auto* child_frame_node : frame_node->child_frame_nodes()) { const FrameNode* child = child_frame_node; EXPECT_TRUE(base::Contains(child_frame_nodes, child)); } EXPECT_EQ(child_frame_nodes.size(), frame_node->child_frame_nodes().size()); EXPECT_EQ(frame_node->lifecycle_state(), public_frame_node->GetLifecycleState()); EXPECT_EQ(frame_node->has_nonempty_beforeunload(), public_frame_node->HasNonemptyBeforeUnload()); EXPECT_EQ(frame_node->url(), public_frame_node->GetURL()); EXPECT_EQ(frame_node->is_current(), public_frame_node->IsCurrent()); EXPECT_EQ(frame_node->network_almost_idle(), public_frame_node->GetNetworkAlmostIdle()); EXPECT_EQ(frame_node->is_ad_frame(), public_frame_node->IsAdFrame()); EXPECT_EQ(frame_node->is_holding_weblock(), public_frame_node->IsHoldingWebLock()); EXPECT_EQ(frame_node->is_holding_indexeddb_lock(), public_frame_node->IsHoldingIndexedDBLock()); } } // namespace performance_manager
[ "rjkroege@chromium.org" ]
rjkroege@chromium.org
497fcdf90661d9052b2536f26e9574488c409246
4cc51211ef649d7d2bb9a7777ba3d78d2e405849
/spoj/halfofhalf.cpp
c6b9c4cf6c0b3b4afd01b98855abc2abe2c919d7
[ "MIT" ]
permissive
Shisir/Online-Judge
0044fe7d52e8c922dbc491fc00abbb2915ce995e
e58c32eeb7ca18a19cc2a83ef016f9c3b124370a
refs/heads/master
2021-01-12T14:59:50.878107
2016-11-08T16:22:13
2016-11-08T16:22:13
71,658,699
0
0
null
null
null
null
UTF-8
C++
false
false
265
cpp
#include <bits/stdc++.h> using namespace std; int main() { int test; scanf("%d",&test); test++; for(int t=1;t<test; t++) { string line; cin>>line; int i=0; while(i<(line.length()/2)) { cout<<line[i]; i+=2; } cout<<'\n'; } return 0; }
[ "nazmul295iit@gmail.com" ]
nazmul295iit@gmail.com
10099b5702164cb27dce4db60a6c95cfa9feb6f1
711e5c8b643dd2a93fbcbada982d7ad489fb0169
/XPSP1/NT/ds/security/azroles/azdisp.cxx
51a444d2e357f4e26f96e397f12df11d5fd8d18e
[]
no_license
aurantst/windows-XP-SP1
629a7763c082fd04d3b881e0d32a1cfbd523b5ce
d521b6360fcff4294ae6c5651c539f1b9a6cbb49
refs/heads/master
2023-03-21T01:08:39.870106
2020-09-28T08:10:11
2020-09-28T08:10:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
24,231
cxx
/*++ Copyright (c) 2001 Microsoft Corporation Module Name: azdisp.h Abstract: Implementation of CAz* dispatch interfaces Author: Xiaoxi Tan (xtan) 11-May-2001 --*/ #include "pch.hxx" #include "stdafx.h" #include "azroles.h" #include "azdisp.h" ///////////////////////// //CAzAdminManager ///////////////////////// CAzAdminManager::CAzAdminManager() { } CAzAdminManager::~CAzAdminManager() { } HRESULT CAzAdminManager::Initialize( /* [in] */ ULONG lReserved, /* [in] */ ULONG lStoreType, /* [in] */ BSTR bstrPolicyURL) { UNREFERENCED_PARAMETER(lReserved); UNREFERENCED_PARAMETER(lStoreType); UNREFERENCED_PARAMETER(bstrPolicyURL); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::CreateEnumApplication( /* [retval][out] */ VARIANT __RPC_FAR *pvarEnumApplication) { UNREFERENCED_PARAMETER(pvarEnumApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::OpenApplication( /* [in] */ BSTR bstrApplicationName, /* [retval][out] */ VARIANT __RPC_FAR *pvarApplication) { UNREFERENCED_PARAMETER(bstrApplicationName); UNREFERENCED_PARAMETER(pvarApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::CreateApplication( /* [in] */ BSTR bstrApplicationName, /* [retval][out] */ VARIANT __RPC_FAR *pvarApplication) { UNREFERENCED_PARAMETER(bstrApplicationName); UNREFERENCED_PARAMETER(pvarApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::DeleteApplication( /* [in] */ BSTR bstrApplicationName) { UNREFERENCED_PARAMETER(bstrApplicationName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::CreateEnumApplicationGroup( /* [retval][out] */ VARIANT __RPC_FAR *pvarEnumApplicationGroup) { UNREFERENCED_PARAMETER(pvarEnumApplicationGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::AddApplicationGroup( /* [in] */ BSTR bstrGroupName) { UNREFERENCED_PARAMETER(bstrGroupName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::OpenApplicationGroup( /* [in] */ BSTR bstrGroupName, /* [retval][out] */ VARIANT __RPC_FAR *pvarApplicationGroup) { UNREFERENCED_PARAMETER(bstrGroupName); UNREFERENCED_PARAMETER(pvarApplicationGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::DeleteApplicationGroup( /* [in] */ BSTR bstrGroupName) { UNREFERENCED_PARAMETER(bstrGroupName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAdminManager::Submit( /* [in] */ ULONG lReserved) { UNREFERENCED_PARAMETER(lReserved); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzApplication ///////////////////////// CAzApplication::CAzApplication() { } CAzApplication::~CAzApplication() { } HRESULT CAzApplication::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateEnumScope( /* [retval][out] */ VARIANT *pvarEnumAzScope) { UNREFERENCED_PARAMETER(pvarEnumAzScope); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::OpenScope( /* [in] */ BSTR bstrScopeName, /* [retval][out] */ VARIANT *pvarScope) { UNREFERENCED_PARAMETER(bstrScopeName); UNREFERENCED_PARAMETER(pvarScope); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateScope( /* [in] */ BSTR bstrScopeName, /* [retval][out] */ VARIANT *pScope) { UNREFERENCED_PARAMETER(bstrScopeName); UNREFERENCED_PARAMETER(pScope); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::DeleteScope( /* [in] */ BSTR bstrScopeName) { UNREFERENCED_PARAMETER(bstrScopeName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateEnumOperation( /* [retval][out] */ VARIANT *pvarEnumOperation) { UNREFERENCED_PARAMETER(pvarEnumOperation); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::OpenOperation( /* [in] */ BSTR bstrOperationName, /* [retval][out] */ VARIANT *pvarOperation) { UNREFERENCED_PARAMETER(bstrOperationName); UNREFERENCED_PARAMETER(pvarOperation); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateOperation( /* [in] */ BSTR bstrOperationName, /* [retval][out] */ VARIANT *pvarOperation) { UNREFERENCED_PARAMETER(bstrOperationName); UNREFERENCED_PARAMETER(pvarOperation); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::DeleteOperation( /* [in] */ BSTR bstrOperationName) { UNREFERENCED_PARAMETER(bstrOperationName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateEnumTask( /* [retval][out] */ VARIANT *pvarEnumAzTask) { UNREFERENCED_PARAMETER(pvarEnumAzTask); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::OpenTask( /* [in] */ BSTR bstrTaskName, /* [retval][out] */ VARIANT *pvarTask) { UNREFERENCED_PARAMETER(bstrTaskName); UNREFERENCED_PARAMETER(pvarTask); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateTask( /* [in] */ BSTR bstrTaskName, /* [retval][out] */ VARIANT *pvarTask) { UNREFERENCED_PARAMETER(bstrTaskName); UNREFERENCED_PARAMETER(pvarTask); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::DeleteTask( /* [in] */ BSTR bstrTaskName) { UNREFERENCED_PARAMETER(bstrTaskName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateEnumApplicationGroup( /* [retval][out] */ VARIANT *pvarEnumGroup) { UNREFERENCED_PARAMETER(pvarEnumGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::OpenApplicationGroup( /* [in] */ BSTR bstrGroupName, /* [retval][out] */ VARIANT *pvarGroup) { UNREFERENCED_PARAMETER(bstrGroupName); UNREFERENCED_PARAMETER(pvarGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateApplicationGroup( /* [in] */ BSTR bstrGroupName, /* [retval][out] */ VARIANT *pvarGroup) { UNREFERENCED_PARAMETER(bstrGroupName); UNREFERENCED_PARAMETER(pvarGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::DeleteApplicationGroup( /* [in] */ BSTR bstrGroupName) { UNREFERENCED_PARAMETER(bstrGroupName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateEnumRole( /* [retval][out] */ VARIANT *pvarEnumRole) { UNREFERENCED_PARAMETER(pvarEnumRole); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::OpenRole( /* [in] */ BSTR bstrRoleName, /* [retval][out] */ VARIANT *pvarRole) { UNREFERENCED_PARAMETER(bstrRoleName); UNREFERENCED_PARAMETER(pvarRole); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateRole( /* [in] */ BSTR bstrRoleName, /* [retval][out] */ VARIANT *pvarRole) { UNREFERENCED_PARAMETER(bstrRoleName); UNREFERENCED_PARAMETER(pvarRole); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::DeleteRole( /* [in] */ BSTR bstrRoleName) { UNREFERENCED_PARAMETER(bstrRoleName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateEnumJunctionPoint( /* [retval][out] */ VARIANT *pvarEnumJunctionPoint) { UNREFERENCED_PARAMETER(pvarEnumJunctionPoint); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::OpenJunctionPoint( /* [in] */ BSTR bstrJunctionPointName, /* [retval][out] */ VARIANT *pvarJunctionPoint) { UNREFERENCED_PARAMETER(bstrJunctionPointName); UNREFERENCED_PARAMETER(pvarJunctionPoint); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::CreateJunctionPoint( /* [in] */ BSTR bstrJunctionPointName, /* [retval][out] */ VARIANT *pvarJunctionPoint) { UNREFERENCED_PARAMETER(bstrJunctionPointName); UNREFERENCED_PARAMETER(pvarJunctionPoint); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::DeleteJunctionPoint( /* [in] */ BSTR bstrJunctionPointName) { UNREFERENCED_PARAMETER(bstrJunctionPointName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplication::InitializeClientContextFromToken( /* [in] */ ULONG lTokenHandle, /* [retval][out] */ VARIANT *pvarClientContext) { UNREFERENCED_PARAMETER(lTokenHandle); UNREFERENCED_PARAMETER(pvarClientContext); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumApplication ///////////////////////// CAzEnumApplication::CAzEnumApplication() { } CAzEnumApplication::~CAzEnumApplication() { } HRESULT CAzEnumApplication::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumApplication::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumApplication::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzOperaion ///////////////////////// CAzOperation::CAzOperation() { } CAzOperation::~CAzOperation() { } HRESULT CAzOperation::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzOperation::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumOperation ///////////////////////// CAzEnumOperation::CAzEnumOperation() { } CAzEnumOperation::~CAzEnumOperation() { } HRESULT CAzEnumOperation::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumOperation::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumOperation::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzTask ///////////////////////// CAzTask::CAzTask() { } CAzTask::~CAzTask() { } HRESULT CAzTask::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzTask::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzTask::AddPropertyItem( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzTask::DeletePropertyItem( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumTask ///////////////////////// CAzEnumTask::CAzEnumTask() { } CAzEnumTask::~CAzEnumTask() { } HRESULT CAzEnumTask::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumTask::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumTask::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzScope ///////////////////////// CAzScope::CAzScope() { } CAzScope::~CAzScope() { } HRESULT CAzScope::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::CreateEnumApplicationGroup( /* [retval][out] */ VARIANT *pvarEnumGroup) { UNREFERENCED_PARAMETER(pvarEnumGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::OpenApplicationGroup( /* [in] */ BSTR bstrGroupName, /* [retval][out] */ VARIANT *pvarGroup) { UNREFERENCED_PARAMETER(bstrGroupName); UNREFERENCED_PARAMETER(pvarGroup); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::AddApplicationGroup( /* [in] */ BSTR bstrGroupName) { UNREFERENCED_PARAMETER(bstrGroupName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::DeleteApplicationGroup( /* [in] */ BSTR bstrGroupName) { UNREFERENCED_PARAMETER(bstrGroupName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::CreateEnumRole( /* [retval][out] */ VARIANT *pvarEnumRole) { UNREFERENCED_PARAMETER(pvarEnumRole); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::OpenRole( /* [in] */ BSTR bstrRoleName, /* [retval][out] */ VARIANT *pvarRole) { UNREFERENCED_PARAMETER(bstrRoleName); UNREFERENCED_PARAMETER(pvarRole); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::AddRole( /* [in] */ BSTR bstrRoleName) { UNREFERENCED_PARAMETER(bstrRoleName); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzScope::DeleteRole( /* [in] */ BSTR bstrRoleName) { UNREFERENCED_PARAMETER(bstrRoleName); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumScope ///////////////////////// CAzEnumScope::CAzEnumScope() { } CAzEnumScope::~CAzEnumScope() { } HRESULT CAzEnumScope::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumScope::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumScope::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzApplicationGroup ///////////////////////// CAzApplicationGroup::CAzApplicationGroup() { } CAzApplicationGroup::~CAzApplicationGroup() { } HRESULT CAzApplicationGroup::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplicationGroup::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplicationGroup::AddPropertyItem( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzApplicationGroup::DeletePropertyItem( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumApplicationGroup ///////////////////////// CAzEnumApplicationGroup::CAzEnumApplicationGroup() { } CAzEnumApplicationGroup::~CAzEnumApplicationGroup() { } HRESULT CAzEnumApplicationGroup::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumApplicationGroup::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumApplicationGroup::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzRole ///////////////////////// CAzRole::CAzRole() { } CAzRole::~CAzRole() { } HRESULT CAzRole::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzRole::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzRole::AddPropertyItem( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzRole::DeletePropertyItem( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumRole ///////////////////////// CAzEnumRole::CAzEnumRole() { } CAzEnumRole::~CAzEnumRole() { } HRESULT CAzEnumRole::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumRole::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumRole::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzJunctionPoint ///////////////////////// CAzJunctionPoint::CAzJunctionPoint() { } CAzJunctionPoint::~CAzJunctionPoint() { } HRESULT CAzJunctionPoint::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzJunctionPoint::SetProperty( /* [in] */ ULONG lPropId, /* [in] */ VARIANT varProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(varProp); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzEnumJunctionPoint ///////////////////////// CAzEnumJunctionPoint::CAzEnumJunctionPoint() { } CAzEnumJunctionPoint::~CAzEnumJunctionPoint() { } HRESULT CAzEnumJunctionPoint::Count( /* [retval][out] */ ULONG *plCount) { UNREFERENCED_PARAMETER(plCount); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumJunctionPoint::Reset( void) { HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzEnumJunctionPoint::Next( /* [retval][out] */ VARIANT *pvarAzApplication) { UNREFERENCED_PARAMETER(pvarAzApplication); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzClientContext ///////////////////////// CAzClientContext::CAzClientContext() { } CAzClientContext::~CAzClientContext() { } HRESULT CAzClientContext::AccessCheck( /* [in] */ BSTR bstrObjectName, /* [in] */ ULONG lScopeCount, /* [in] */ VARIANT varScopeNames, /* [in] */ ULONG lOperationCount, /* [in] */ VARIANT varOperations, /* [in] */ ULONG lParameterCount, /* [in] */ VARIANT varParameterNames, /* [in] */ VARIANT varParameterVariants, /* [in] */ ULONG lInterfaceCount, /* [in] */ VARIANT varInterfaceNames, /* [in] */ ULONG lInterfaceFlags, /* [in] */ VARIANT varInterfaces, /* [retval][out] */ VARIANT *pvarResults) { UNREFERENCED_PARAMETER(bstrObjectName); UNREFERENCED_PARAMETER(lScopeCount); UNREFERENCED_PARAMETER(varScopeNames); UNREFERENCED_PARAMETER(lOperationCount); UNREFERENCED_PARAMETER(varOperations); UNREFERENCED_PARAMETER(lParameterCount); UNREFERENCED_PARAMETER(varParameterNames); UNREFERENCED_PARAMETER(varParameterVariants); UNREFERENCED_PARAMETER(lInterfaceCount); UNREFERENCED_PARAMETER(varInterfaceNames); UNREFERENCED_PARAMETER(lInterfaceFlags); UNREFERENCED_PARAMETER(varInterfaces); UNREFERENCED_PARAMETER(pvarResults); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzClientContext::GetBusinessRuleString( /* [retval][out] */ BSTR *pbstrBusinessRuleString) { UNREFERENCED_PARAMETER(pbstrBusinessRuleString); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzClientContext::GetProperty( /* [in] */ ULONG lPropId, /* [retval][out] */ VARIANT *pvarProp) { UNREFERENCED_PARAMETER(lPropId); UNREFERENCED_PARAMETER(pvarProp); HRESULT hr; hr = E_NOTIMPL; return hr; } ///////////////////////// //CAzAccessCheck ///////////////////////// CAzAccessCheck::CAzAccessCheck() { } CAzAccessCheck::~CAzAccessCheck() { } HRESULT CAzAccessCheck::put_BusinessRuleResult( /* [in] */ BOOL bResult) { UNREFERENCED_PARAMETER(bResult); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAccessCheck::put_BusinessRuleString( /* [in] */ BSTR bstrBusinessRuleString) { UNREFERENCED_PARAMETER(bstrBusinessRuleString); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAccessCheck::get_BusinessRuleString( /* [retval][out] */ BSTR *pbstrBusinessRuleString) { UNREFERENCED_PARAMETER(pbstrBusinessRuleString); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAccessCheck::put_BusinessRuleExpiration( /* [in] */ ULONG lExpirationPeriod) { UNREFERENCED_PARAMETER(lExpirationPeriod); HRESULT hr; hr = E_NOTIMPL; return hr; } HRESULT CAzAccessCheck::GetParameter( /* [in] */ BSTR bstrParameterName, /* [retval][out] */ VARIANT *pvarParameterName) { UNREFERENCED_PARAMETER(bstrParameterName); UNREFERENCED_PARAMETER(pvarParameterName); HRESULT hr; hr = E_NOTIMPL; return hr; }
[ "112426112@qq.com" ]
112426112@qq.com
e8c76026b7e797ac52e173541685e1b29b010522
a1fbf16243026331187b6df903ed4f69e5e8c110
/cs/sdk/3d_sdk/maya/ver-2008/devkit/plug-ins/hwToonShader_NV20.h
4a550c4fe6247381ce5729cb99f47cc236f4c303
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
OpenXRay/xray-15
ca0031cf1893616e0c9795c670d5d9f57ca9beff
1390dfb08ed20997d7e8c95147ea8e8cb71f5e86
refs/heads/xd_dev
2023-07-17T23:42:14.693841
2021-09-01T23:25:34
2021-09-01T23:25:34
23,224,089
64
23
NOASSERTION
2019-04-03T17:50:18
2014-08-22T12:09:41
C++
UTF-8
C++
false
false
5,997
h
#ifndef _hwToonShader_NV20 #define _hwToonShader_NV20 //- // ========================================================================== // Copyright (C) 1995 - 2006 Autodesk, Inc. and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to Autodesk, Inc. ("Autodesk") and/or its // licensors, which is protected by U.S. and Canadian federal copyright // law and by international treaties. // // The Data is provided for use exclusively by You. You have the right // to use, modify, and incorporate this Data into other products for // purposes authorized by the Autodesk software license agreement, // without fee. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the // following disclaimer, must be included in all copies of the // Software, in whole or in part, and all derivative works of // the Software, unless such copies or derivative works are solely // in the form of machine-executable object code generated by a // source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR // PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE, OR // TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS LICENSORS // BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL, // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK // AND/OR ITS LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY // OR PROBABILITY OF SUCH DAMAGES. // // ========================================================================== //+ /////////////////////////////////////////////////////////////////// // // NOTE: PLEASE READ THE README.TXT FILE FOR INSTRUCTIONS ON // COMPILING AND USAGE REQUIREMENTS. // // DESCRIPTION: NV20-specific (Geforce3) sample shader. // <fill up later> // // This shader builds on the foundation demonstrated in the // hwUnlitShader. // // /////////////////////////////////////////////////////////////////// #include <maya/MPxHwShaderNode.h> #include "MTextureCache.h" class hwToonShader_NV20 : public MPxHwShaderNode { public: hwToonShader_NV20(); virtual ~hwToonShader_NV20(); void releaseEverything(); virtual MStatus compute( const MPlug&, MDataBlock& ); virtual void postConstructor(); virtual MStatus bind(const MDrawRequest& request, M3dView& view); virtual MStatus unbind(const MDrawRequest& request, M3dView& view); virtual MStatus geometry( const MDrawRequest& request, M3dView& view, int prim, unsigned int writable, int indexCount, const unsigned int * indexArray, int vertexCount, const int * vertexIDs, const float * vertexArray, int normalCount, const float ** normalArrays, int colorCount, const float ** colorArrays, int texCoordCount, const float ** texCoordArrays); virtual int normalsPerVertex(); virtual int texCoordsPerVertex(); static void * creator(); static MStatus initialize(); static MTypeId id; MTextureCache *m_pTextureCache; void loadVertexProgramGL(); float* computeBinormals(int indexCount, const unsigned int * indexArray, int vertexCount, const float* vertexArray, const float* normalsArray, const float* texCoordsArray); bool fVertexProgramsLoaded; GLuint fVertexProgramDirectional; GLuint fVertexProgramPointDecay; GLuint fVertexProgramPointNoDecay; void printGlError( const char *call ); void init_ext(const char *ext); MStatus getFloat3(MObject colorAttr, float colorValue[3]); MStatus getString(MObject attr, MString &str); vec3f lightRotation; vec3f cameraPos; boolean isDirectionalLight; // when light's rotation is on the lightPos attr boolean isNonAmbientLight; // Has a decay rate protected: static MObject colorR; static MObject colorG; static MObject colorB; static MObject color; static MObject lightModelR; static MObject lightModelG; static MObject lightModelB; static MObject lightModel; static MObject cameraX; static MObject cameraY; static MObject cameraZ; static MObject camera; static MObject uCoord; static MObject vCoord; static MObject uvCoord; static MObject uBias; static MObject vBias; static MObject uvFilterSize; static MObject uvFilterSizeX; static MObject uvFilterSizeY; static MObject shininess; static MObject lightColorR; static MObject lightColorG; static MObject lightColorB; static MObject lightColor; static MObject decalTextureName; static MObject lightModelTextureName; // Shininess value/scale, used to generate the lookup texture. float currentShininessValue, currentShininessScale; tex_object_2D *lookup_texture; unsigned char *lookup_table; static const unsigned int lookup_texture_size; bool fLookupTextureReprocessed; // Bind the look-up texture in the current GL texture unit. // This function automatically calls make_lookup_texture, // and reloads the texture in video memory if it needs to. void bind_lookup_table(); // Release the memory occupied by the look-up texture. void release_lookup_texture(); // Callbacks that we monitor so we can release OpenGL-dependant resources before // their context gets destroyed. MCallbackId fBeforeNewCB; MCallbackId fBeforeOpenCB; MCallbackId fBeforeRemoveReferenceCB; MCallbackId fMayaExitingCB; void attachSceneCallbacks(); void detachSceneCallbacks(); static void releaseCallback(void* clientData); }; #endif /* _hwToonShader_NV20 */
[ "paul-kv@yandex.ru" ]
paul-kv@yandex.ru
d4770ef58da7eb9ddca17524b1722b6e9e2e8d5f
0d77fc08a0501eb17a697c78ba32d305737f1559
/Code/DataTratamiento.cpp
a218e801e81781866ec160de139e60b89ee28df7
[]
no_license
Bernax512/Prog4
f32bf32d29a604aef0e3033eee5cbdb2fc7c51ba
0cde70f107c2cc32e7a57278e1e5e1747741cc05
refs/heads/master
2021-01-20T23:50:52.137256
2014-06-23T15:00:19
2014-06-23T15:00:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
257
cpp
#include "DataTratamiento.h" DataTratamiento::DataTratamiento() {} DataTratamiento::~DataTratamiento() {} DataTratamiento::DataTratamiento(string desc){ this->descripcion = desc; } string DataTratamiento::getDescripcion(){ return this->descripcion; }
[ "p.martinezben@gmail.com" ]
p.martinezben@gmail.com
e6cc5a29b9a96ca19b53241fb8d0d3e31c398ab5
04b1803adb6653ecb7cb827c4f4aa616afacf629
/dbus/util.h
b983b6fdb86e43101e2d50fd79e736073a07bab4
[ "BSD-3-Clause" ]
permissive
Samsung/Castanets
240d9338e097b75b3f669604315b06f7cf129d64
4896f732fc747dfdcfcbac3d442f2d2d42df264a
refs/heads/castanets_76_dev
2023-08-31T09:01:04.744346
2021-07-30T04:56:25
2021-08-11T05:45:21
125,484,161
58
49
BSD-3-Clause
2022-10-16T19:31:26
2018-03-16T08:07:37
null
UTF-8
C++
false
false
729
h
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DBUS_UTIL_H_ #define DBUS_UTIL_H_ #include <string> #include "dbus/dbus_export.h" namespace dbus { // Returns the absolute name of a member by concatanating |interface_name| and // |member_name|. e.g.: // GetAbsoluteMemberName( // "org.freedesktop.DBus.Properties", // "PropertiesChanged") // // => "org.freedesktop.DBus.Properties.PropertiesChanged" // CHROME_DBUS_EXPORT std::string GetAbsoluteMemberName( const std::string& interface_name, const std::string& member_name); } // namespace dbus #endif // DBUS_UTIL_H_
[ "sunny.nam@samsung.com" ]
sunny.nam@samsung.com
a9923b1527b47f53356af13f77329c046b83de96
9d56361a0f676706e138fa514b67c2fca355eb60
/Project-1.0-interactive_events/FundRaiser/src/testApp.h
aa67f9fe28c124933e2f1612d621bc2978dce265
[]
no_license
cdj/SpatialMedia
d0f493ad10986346fcc4e75bb1d9758f692acc37
447cc0d5d72cadfd31634899825ef7af3d8e032c
refs/heads/master
2022-12-10T12:15:05.594392
2022-12-07T18:54:57
2022-12-07T18:54:57
8,465,004
0
0
null
null
null
null
UTF-8
C++
false
false
1,589
h
#pragma once #include "ofMain.h" #include "ofxSimpleProjectionMapper.h" #include "StandingTable.h" #include "GuitarString.h" #include "Bob.h" #include "Spring.h" #include <iostream> #include "ofxTSPSReceiver.h" static const int tableSize = 48; static const int roomSize = 360; static const int makeBigger = 2; static const int tableDist = 100; static const int margin = 100; static const int stringsEdge = 250; class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed (int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); void audioOut(float * input, int bufferSize, int nChannels); vector<StandingTable> tables; list<GuitarString> strings; int index1 = -1; int index2 = -1; Bob bob; Spring spring; ofxSimpleProjectionMapper mapper; bool bDrawBounds; bool projectionMode; float maxLength; float minLength; // Audio related vars ofSoundStream soundStream; float pan; int sampleRate; float volumeMax; vector <float> lAudio; vector <float> rAudio; float targetFrequency; float phase; float phaseAdder; float phaseAdderTarget; // create TSPS Receiver object ofxTSPS::Receiver tspsReceiver; };
[ "cdj255@nyu.edu" ]
cdj255@nyu.edu
522b21691ad371381e3764defa894183a1436dfd
d9febae941e2f66c9507191a9a824f6c0cee850f
/ch9/drill/drill2.cpp
270d9ca6c32e2a80746d510aa0d45b500c95ef3b
[]
no_license
raidoon/bev_prog
6a224b484dd26f03a4f94550dc7c5a61ad4d4ebb
08582cc7f665fc9ea1f3e91129afa37b6c39f7fe
refs/heads/master
2023-01-23T21:43:48.832353
2020-12-09T10:59:40
2020-12-09T10:59:40
297,075,780
0
0
null
null
null
null
UTF-8
C++
false
false
1,505
cpp
// 9.4.2 #include "std_lib_facilities.h" class Date { int y, m, d; public: Date(int y, int m, int d); void add_day(int n); int year() const { return y; } int month() const { return m; } int day() const {return d; } }; /*bool Date::is_valid() { if (month < 1 || month > 12 || year < 0 || day > 31 || day < 1) return false; return true; } */ Date::Date(int y, int m, int d) { if (y > 0) y = y; else error("Invalid year"); if (m <= 12 && m > 0) m = m; else error("Invalid month"); if (d > 0 && d <= 31) d = d; else error("Invalid day"); } void Date::add_day( int n) { d += n; if (d > 31) { m++; d -= 31; if (m > 12) { y++; m -= 12; } } } ostream& operator<<(ostream& os, const Date& d) { return os << '(' << d.year() << ',' << d.month() << ',' << d.day() << ')'; } int main() try{ Date today {1978, 6, 25}; today.add_day(1); cout << "Date: " << today.year() << today.month() << '.' << today.day() << ".\n"; Date tomorrow {today}; tomorrow.add_day(1); //tomorrow.year() = today.year(); //tomorrow.month() = today.month(); //tomorrow.day() = ++today.day(); cout << "Date: " << tomorrow.year() << ". " << tomorrow.month() << ' ' << tomorrow.day() << ".\n"; Date my_birthday {2000, 07, 30}; Date test {2007, 12, 24}; //hibás teszt Date last {2000, 12, 31}; Date next = {2014, 2, 14}; Date christmas = Date{1976, 12, 24}; return 0; } catch (exception& e) { cout << e.what() << endl; return 1; }
[ "thomaselphin@gmail.com" ]
thomaselphin@gmail.com
2a1d0a66b7fbb0b188881f26d65ccb12898247a1
5c442363f5824a8da4eb1a6a2aaddca97bb88f92
/Code/Mantid/MantidQt/CustomInterfaces/src/MultiDatasetFit/MDFLocalParameterItemDelegate.cpp
8368dedbec3bfb61bf331071f23c957370257477
[]
no_license
stothe2/mantid
07dba616d771c28f91d3761fb02ef6b0e90444b3
01407170b8df46c98bb36b6fa530e54851117b18
refs/heads/master
2020-12-25T02:39:05.609946
2015-09-18T20:40:27
2015-09-18T20:40:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,260
cpp
#include "MantidQtCustomInterfaces/MultiDatasetFit/MDFLocalParameterItemDelegate.h" #include "MantidQtCustomInterfaces/MultiDatasetFit/MDFEditLocalParameterDialog.h" #include "MantidQtCustomInterfaces/MultiDatasetFit/MDFLocalParameterEditor.h" #include "MantidQtCustomInterfaces/MultiDatasetFit/MultiDatasetFit.h" #include <QPainter> namespace MantidQt { namespace CustomInterfaces { namespace MDF { /// Constructor. LocalParameterItemDelegate::LocalParameterItemDelegate(EditLocalParameterDialog *parent): QStyledItemDelegate(parent), m_currentEditor(NULL) { } /// Create a custom editor LocalParameterEditor. QWidget* LocalParameterItemDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem &, const QModelIndex & index) const { m_currentEditor = new LocalParameterEditor(parent,index.row(), owner()->isFixed(index.row())); connect(m_currentEditor,SIGNAL(setAllValues(double)),this,SIGNAL(setAllValues(double))); connect(m_currentEditor,SIGNAL(fixParameter(int,bool)),this,SIGNAL(fixParameter(int,bool))); connect(m_currentEditor,SIGNAL(setAllFixed(bool)),this,SIGNAL(setAllFixed(bool))); m_currentEditor->installEventFilter(const_cast<LocalParameterItemDelegate*>(this)); return m_currentEditor; } /// Initialize the editor with the current data in the cell. void LocalParameterItemDelegate::setEditorData(QWidget * editor, const QModelIndex & index) const { QStyledItemDelegate::setEditorData(editor->layout()->itemAt(0)->widget(), index); } /// Update the data in the cell with the text in the editor. void LocalParameterItemDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const { QStyledItemDelegate::setModelData(editor->layout()->itemAt(0)->widget(), model, index); } /// Re-implemented to resolve an issue: if the parent dialog closes with /// the editor is active any changes in it get ignored. bool LocalParameterItemDelegate::eventFilter(QObject * obj, QEvent * ev) { if ( ev->type() == QEvent::WindowDeactivate ) { // Force to save the changes to the underlying model. emit commitData(m_currentEditor); return true; } return QStyledItemDelegate::eventFilter(obj,ev); } /// Paint the table cell. void LocalParameterItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const { QStyledItemDelegate::paint(painter, option, index); if ( owner()->isFixed(index.row()) ) { auto rect = option.rect; auto text = index.model()->data(index).asString(); int textWidth = option.fontMetrics.width(text); QString fixedStr(" (fixed)"); int fWidth = option.fontMetrics.width(fixedStr); if ( textWidth + fWidth > rect.width() ) { fixedStr = "(f)"; fWidth = option.fontMetrics.width(fixedStr); } auto dHeight = (option.rect.height() - option.fontMetrics.height()) / 2; rect.adjust(rect.width() - fWidth, dHeight, 0 ,-dHeight); painter->drawText(rect,fixedStr); } } /// Cast the parent to EditLocalParameterDialog. Get access to parameter /// values and fixes. EditLocalParameterDialog *LocalParameterItemDelegate::owner() const { return static_cast<EditLocalParameterDialog*>(parent()); } } // MDF } // CustomInterfaces } // MantidQt
[ "roman.tolchenov@stfc.ac.uk" ]
roman.tolchenov@stfc.ac.uk
05955a116056835a3966f0fdd5f7192cc5090184
005d10b6aaf5e65b18b33c7c54b6f3dcf1f5c95c
/smartDeliveryNode-MCU/smartDeliveryNode-MCU.ino
d7ce665c314590899939e2222f0be9b1ebccaa4b
[]
no_license
darksun27/Smart-Delivery
cbec53bb19da06f2267d2d688b961265a6a687e4
c290bcc64079e49fde573efd901853996d6ee784
refs/heads/master
2022-12-14T04:59:18.183238
2020-08-24T19:34:50
2020-08-24T19:34:50
290,021,485
1
0
null
null
null
null
UTF-8
C++
false
false
2,016
ino
#include<ESP8266WiFi.h> #include<ESP8266WebServer.h> const char *ssid = "DarksunJ"; const char *password = "9810166770"; const char *host = "192.168.29.214"; WiFiClient client; ESP8266WebServer server; const int sleepTimeSeconds = 2; void setup() { // put your setup code here, to run once: pinMode(D7, INPUT); WiFi.begin(ssid, password); Serial.begin(115200); while(WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println("Connected"); Serial.println(WiFi.localIP().toString()); if(client.connect(host,3000)) { String url = "/connectBOX?ip_addr="; client.print(String("GET ") + url + WiFi.localIP().toString() + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: keep-alive\r\n\r\n"); delay(10); Serial.println("Response: "); while(client.available()) { String line = client.readStringUntil('\r'); Serial.print(line); } } server.on("/startJob",startJob); server.on("/finishJob",finishJob); server.begin(); } String order_id = ""; int in_job = 0; int message_sent = 0; void startJob(){ order_id = server.arg("order_id"); in_job = 1; Serial.print("Started"); server.send(200,"text/plain", String("Started")); } void finishJob(){ in_job = 0; message_sent = 0; server.send(200,"text/plain",String("Finish")); } void loop() { if(in_job){ int sensor_value = digitalRead(D7); if(sensor_value == 0 && message_sent == 0) { sendMessage("open"); } } server.handleClient(); } void sendMessage(char* value) { if(client.connect(host,3000)) { String url = "/tamper?value="; url += String(value); url += "&order_id="+order_id; Serial.print(url); client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: keep-alive\r\n\r\n"); delay(10); Serial.println("Response: "); while(client.available()) { String line = client.readStringUntil('\r'); Serial.print(line); message_sent = 1; } } }
[ "noreply@github.com" ]
noreply@github.com
b722cb42f2b4d850a2a423eadc5189c74e6fc850
c06574d4ddf1e2cab62737e8b74accea3c34007a
/Codeforces/Quasi Binary.cpp
30c3544e2d1b87f1db8e7fc6886244513347d277
[]
no_license
t1war1/CP
5ec8210c37c54262cb8758647fe52c0fec402f35
237c8e32e351511142c4fd79bb965a4e8efa37b6
refs/heads/master
2022-12-21T11:03:14.300293
2020-04-10T11:06:24
2020-04-10T11:06:24
116,372,420
0
1
null
2020-10-01T20:37:31
2018-01-05T10:19:59
C++
UTF-8
C++
false
false
1,634
cpp
#include <bits/stdc++.h> #define mod 1000000007ll #define mod2 100000009ll #define mod3 998244353 #define pb push_back #define fastIO ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); #define readi(x) scanf("%d",&x) #define reads(x) scanf("%s", x) #define readl(x) scanf("%I64d",&x) #define PI 3.141592653589793238462643383 #define repi(i,a,b) for(int i=a;i<b;i++) #define repd(i,a,b) for(int i=a;i>b;i--) #define mp make_pair #define ll long long #define sorti(a,b) sort(a,b) #define sortd(a,b,tp) sort(a,b,greater<tp>()) #define ff first #define ss second #define endl "\n" using namespace std; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<long double,long double>pdd; template<class T> using max_pq = priority_queue<T>; template<class T> using min_pq = priority_queue<T,vector<T>,greater<T> >; int oo = 0x3f3f3f3f; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif fastIO; // int testcases;cin>>testcases; // while(testcases--) // { //Clear global variables int n; cin>>n; vector<int> digits; while(n>0) { digits.pb(n%10); n/=10; } reverse(digits.begin(),digits.end()); int ans=0; repi(i,0,digits.size()) ans=max(ans,digits[i]); cout<<ans<<endl; for(int i=1;i<=ans;i++) { int curr=0; for(int j=0;j<digits.size();j++) { if(digits[j]>=i) { curr=curr*10+1; } else{ curr=curr*10; } } cout<<curr<<" "; } // cout<<endl; // } return 0; }
[ "tiwarigaurav1998@gmail.com" ]
tiwarigaurav1998@gmail.com
5e53d0408a90de57651304d4b1d7d4c3a20286aa
48b83bbadb35eed1ec1fb539a9ea8b0e45eba95c
/aoc_2022/day_01/day_01_2.cpp
46139ad293caf984b92935fb8df82e91f26cd2fd
[]
no_license
Jul-Le/advent-of-code
fc0c02dae4998a0f40782ee580c040e9dfdf039f
0d1cda6dbcc3e595729e9056959aa16acaf7a390
refs/heads/master
2022-12-18T10:57:19.873601
2022-12-11T10:05:45
2022-12-11T10:05:45
225,173,684
0
0
null
2022-12-11T10:05:46
2019-12-01T14:19:31
C++
UTF-8
C++
false
false
3,317
cpp
/* * Contributor(s): JulLe * * Created: 2022-12-03 * Modified: 2022-12-03 * * * * Input list represents calories of food carried by elves. * * Find the top three elves carrying the most Calories. How * many total Calories are those elves carrying? */ #include <algorithm> #include <iostream> #include <fstream> #include <string> #include <vector> std::vector<std::string> parseInput() { std::ifstream file; std::vector<std::string> data; std::string line; file.open("input.txt"); if (!file.is_open()) { perror("Failed to open file \"input.txt\""); exit(EXIT_FAILURE); } while (getline(file, line)) data.push_back(line); file.close(); return data; } std::vector<int> getCalories(const std::vector<std::string> data) { std::vector<int> calories = { 0 }; for (auto line : data) { // Blank line, move to next elf if (line == "") { calories.push_back(0); continue; } // Add calories calories[calories.size() - 1] += std::stoi(line); } return calories; } bool greater(int a, int b) { return a > b; } /** * @brief Test functions * @return Number of failed tests, zero if all were successful */ int doTests() { int failedTests = 0; std::vector<std::string> testData = { "1000", "2000", "3000", "", "4000", "", "5000", "6000", "", "7000", "8000", "9000", "", "10000" }; std::vector<int> totalCalories = getCalories(testData); std::vector<int> expectedCalories = { 6000, 4000, 11000, 24000, 10000 }; if (totalCalories.size() != 5) { failedTests++; std::cout << "totalCalories.size(): Expected " << expectedCalories.size() << ", got " << totalCalories.size() << std::endl; // Skip other tests to avoid out of bounds errors return failedTests; } for (int i = 0; i < totalCalories.size(); i++) { if (totalCalories[i] != expectedCalories[i]) { failedTests++; std::cout << "Total calories: Expected " << expectedCalories[i] << ", got " << totalCalories[i] << std::endl; } } // Get largest calorie amount int mostCalories = 0; // Sort descending std::sort(totalCalories.begin(), totalCalories.end(), greater); // Add up three largest for (int i = 0; i < 3; i++) mostCalories += totalCalories[i]; if (mostCalories != 45000) { failedTests++; std::cout << "Most calories: Expected 45000, got " << mostCalories << std::endl; } return failedTests; } int main() { int failedTests = doTests(); if (failedTests != 0) { std::cout << failedTests << " test(s) failed" << std::endl; return 1; } std::vector<std::string> input = parseInput(); std::vector<int> calories = getCalories(input); int mostCalories = 0; std::sort(calories.begin(), calories.end(), greater); for (int i = 0; i < 3; i++) mostCalories += calories[i]; std::cout << "The sum of top three calorie counts is " << mostCalories << std::endl; return 0; }
[ "noreply@github.com" ]
noreply@github.com
4ebbd8c23991616d5e417952722f6d1b2ea3a60a
45890b0d5f6a9e1ec7ef38e5d11c42c328cc00bf
/CODIGOS/Trabalhos/ESTUFA/ESTUFA.ino
56b452cad7ff386690fab262afbaf7a369894a9c
[ "MIT" ]
permissive
melquelima/Arduino
271b6cf3e0f0700a45006411dc6de9de78ee99aa
de69513af573d684530e0f86c6e161c4b454de04
refs/heads/master
2020-05-07T20:18:32.783318
2020-04-26T15:48:57
2020-04-26T15:48:57
180,851,698
0
0
null
null
null
null
UTF-8
C++
false
false
1,959
ino
#include "DHT.h" #define DHTPIN 11 // what digital pin we're connected to #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display DHT dht(DHTPIN, DHTTYPE); int C_aquece = 8; int C_esfria = 9; int resist = 4; void setup() { lcd.init(); // initialize the lcd lcd.init(); // Print a message to the LCD. lcd.backlight(); pinMode(C_aquece, OUTPUT); pinMode(C_esfria, OUTPUT); pinMode(resist, OUTPUT); Serial.begin(9600); dht.begin(); } void loop() { float temp = temperatura(); if (temp == 0) { //ERRO } else { if (temp > 32) esfria(); if (temp < 30) aquece(); } lcd.clear(); lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(temp); } void aquece() { while (temperatura() < 31) { digitalWrite(C_aquece, 1); digitalWrite(resist, 1); digitalWrite(C_esfria, 0); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(temperatura()); lcd.setCursor(0, 1); lcd.print("Aquecendo..."); } digitalWrite(C_aquece, 0); digitalWrite(resist, 0); digitalWrite(C_esfria, 0); } void esfria() { while (temperatura() > 31) { digitalWrite(C_aquece, 0); digitalWrite(resist, 0); digitalWrite(C_esfria, 1); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(temperatura()); lcd.setCursor(0, 1); lcd.print("Esfriando..."); } digitalWrite(C_aquece, 0); digitalWrite(resist, 0); digitalWrite(C_esfria, 0); } float temperatura() { delay(1000); float h = dht.readHumidity(); float t = dht.readTemperature(); float f = dht.readTemperature(true); if (isnan(h) || isnan(t) || isnan(f)) { return 0; } float hif = dht.computeHeatIndex(f, h); float hic = dht.computeHeatIndex(t, h, false); return hic; }
[ "melque_ex@yahoo.com.br" ]
melque_ex@yahoo.com.br
fe83272f0ffcf8346c18beb5ed238d3381fe6022
36763192f8f8a40e0818b5b95aed8079c3f7abe1
/src/components/jc_finder/finder/image.cpp
07e6a0bb3adc4699430de8270acbcb46075e9527
[]
no_license
ZhenlangLi/vldt-proj
15f5c3defcca52af27e48a0bf42af915dd384e71
26df0f9a381e5746780fbf6c43fa31f352cc322e
refs/heads/master
2021-03-25T04:38:29.803399
2020-03-16T02:26:53
2020-03-16T02:26:53
247,590,188
0
0
null
2020-03-16T02:12:33
2020-03-16T02:12:33
null
UTF-8
C++
false
false
8,279
cpp
// image.cpp 03/03/2020 // J_Code // brief: J_Code image processing functions // Miao Xinyu #include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/types_c.h> extern "C" { #include "detector.h" } #include "jc_finder_cpp.h" using namespace cv; using namespace std; /** 可以分离R、G、B三个通道图像的函数,并二极化输出 @param src 原图(Mat) @param rgb_thres 存放2极化后的 3个通道 的数组 @param number 选用的二级化种类,默认为0 */ void split_thres(Mat& src, Mat rgb_thres[], int number = 0) { //自定义阈值: const int thres = 175; //设置阈值类型选项(默认为number=0,阈值二极化) //0,1,2,3,4,5,6,7 int type = THRESH_BINARY | THRESH_OTSU; switch (number) { case 0:type = THRESH_BINARY; break; //阈值二极化(大于阈值的部分被置为255,小于部分被置为0); case 1:type = THRESH_BINARY_INV; break; //阈值反二极化(大于阈值部分被置为0,小于部分被置为255); case 2:type = THRESH_TRUNC; break; //大于阈值部分被置为threshold,小于部分保持原样; case 3:type = THRESH_TOZERO; break; //小于阈值部分被置为0,大于部分保持不变; case 4:type = THRESH_TOZERO_INV; break; //大于阈值部分被置为0,小于部分保持不变 ; case 5:type = THRESH_MASK; break; case 6:type = THRESH_OTSU; break; //系统根据图像自动选择最优阈值,并进行二极化; // case 7:type = THRESH_TRIANGLE; break; //系统根据图像自动选择最优阈值,并进行二极化; } // 分割3个通道 split(src, rgb_thres); // 先直方图拉伸 void histStretch(Mat& grayImage, int minValue); histStretch(rgb_thres[0], 20); histStretch(rgb_thres[1], 20); histStretch(rgb_thres[2], 20); // 再二值化 threshold(rgb_thres[0], rgb_thres[0], thres, 255, type); threshold(rgb_thres[1], rgb_thres[1], thres, 255, type); threshold(rgb_thres[2], rgb_thres[2], thres, 255, type); } // 直方图拉伸函数 /* grayImageStretched - 拉伸后得到的图像; grayImage - 要进行直方图拉伸的图像; minValue - 忽略像数个数小于此值的灰度级; */ void histStretch(Mat& grayImage, int minValue) { // grayImageStretched.create(grayImage.size(), grayImage.type()); Mat histImg; int channels[1] = { 0 }; int histSize = 256; float range[2] = { 0, 256 }; const float* ranges[1] = { range }; calcHist(&grayImage, 1, channels, Mat(), histImg, 1, &histSize, ranges); // CV_Assert(!grayImageStretched.empty() && grayImageStretched.channels() == 1 && grayImageStretched.depth() == CV_8U); // CV_Assert(!histImg.empty() && histImg.rows == 256 && histImg.cols == 1 && histImg.depth() == CV_32F); // CV_Assert(minValue >= 0); // 求左边界 uchar grayMin = 0; for (int i = 0; i < histImg.rows; ++i) { if (histImg.at<float>(i, 0) > minValue) { grayMin = static_cast<uchar>(i); break; } } // 求右边界 uchar grayMax = 0; for (int i = histImg.rows - 1; i >= 0; --i) { if (histImg.at<float>(i, 0) > minValue) { grayMax = static_cast<uchar>(i); break; } } if (grayMin >= grayMax) { return; } const int w = grayImage.cols; const int h = grayImage.rows; for (int y = 0; y < h; ++y) { uchar* imageData = grayImage.ptr<uchar>(y); for (int x = 0; x < w; ++x) { if (imageData[x] < grayMin) { imageData[x] = 0; } else if (imageData[x] > grayMax) { imageData[x] = 255; } else { imageData[x] = static_cast<uchar>(round((imageData[x] - grayMin) * 255.0 / (grayMax - grayMin))); } } } } /** 将Mat格式的图像转化为Bitmap @param mat Mat格式的图像 @return Bitmap图像指针 */ Bitmap* matToBitmap(Mat& mat) { Size size = mat.size(); Bitmap *bitmap = NULL; if (mat.channels() > 1) { Mat destMat; cvtColor(mat, destMat, CV_BGR2RGBA); int bitmap_len = size.width * size.height; bitmap = (Bitmap *)malloc(sizeof(Bitmap) + 4 * bitmap_len); // 映射bitmap内存 memcpy(bitmap->pixel, destMat.data, 4 * bitmap_len); bitmap->channel_count = BITMAP_CHANNEL_COUNT; } else { // 设为黑白图 int bitmap_len = size.width * size.height; bitmap = (Bitmap *)malloc(sizeof(Bitmap) + bitmap_len); // 搬运图像内存内容 memcpy(bitmap->pixel, mat.data, bitmap_len); bitmap->channel_count = 1; } (bitmap)->width = size.width; (bitmap)->height = size.height; (bitmap)->bits_per_pixel = BITMAP_BITS_PER_PIXEL; (bitmap)->bits_per_channel = BITMAP_BITS_PER_CHANNEL; return bitmap; } /** 对一个Mat对象进行预处理、透视变换、采样 @param img 原图(Mat) @return 采样后的Symbol */ J_Found_Symbol* image_processing(Mat& img) { Mat rgb_thres[3]; split_thres(img, rgb_thres); Mat img_after_thres; merge(rgb_thres, 3, img_after_thres); Bitmap* bitmap = matToBitmap(img_after_thres); Bitmap* ch[3]; ch[0] = matToBitmap(rgb_thres[2]); ch[1] = matToBitmap(rgb_thres[1]); ch[2] = matToBitmap(rgb_thres[0]); #if TEST_MODE saveImage(bitmap, "/Users/phantef/Desktop/test/fin/bitmap.png"); saveImage(ch[0], "/Users/phantef/Desktop/test/fin/ch_r.png"); saveImage(ch[1], "/Users/phantef/Desktop/test/fin/ch_g.png"); saveImage(ch[2], "/Users/phantef/Desktop/test/fin/ch_b.png"); J_Found_Symbol* found = detectMaster(bitmap, ch); saveImage(found->sampled_img, "/Users/phantef/Desktop/test/fin/sampled_fin.png"); free(bitmap); for (int i = 0; i < 3; i++) free(ch[i]); return found; #endif J_Found_Symbol* found_smb = detectMaster(bitmap, ch); // 把原图的bitmap和ch删掉 free(bitmap); for (int i = 0; i < 3; i++) free(ch[i]); return found_smb; } /** 入口函数 @param src 存图片的地址 @return 返回一个Found_Symbol,要用clear_found_symbol清除 */ J_Found_Symbol* importImage_cpp(const char src[]) { Mat img = imread(src); if (img.empty()) { return NULL; } return image_processing(img); } /** 清除Found_Symbol @param found_symbol Found_Symbol */ void clean_foundSymbol_cpp(J_Found_Symbol* found_symbol) { if (!found_symbol) return; else { free(found_symbol->fps); free(found_symbol->sampled_img); free(found_symbol); } } void swap(Int32* a, Int32* b) { Int32 tmp = *a; *a = *b; *b = tmp; } /** * @brief Get the min, middle and max value of three values and the corresponding indexes * @param rgb the pixel with RGB values * @param min the min value * @param mid the middle value * @param max the max value */ void getRGBMinMax_cpp(BYTE* rgb, BYTE* min, BYTE* mid, BYTE* max, Int32* index_min, Int32* index_mid, Int32* index_max) { *index_min = 0; *index_mid = 1; *index_max = 2; if(rgb[*index_min] > rgb[*index_max]) swap(index_min, index_max); if(rgb[*index_min] > rgb[*index_mid]) swap(index_min, index_mid); if(rgb[*index_mid] > rgb[*index_max]) swap(index_mid, index_max); *min = rgb[*index_min]; *mid = rgb[*index_mid]; *max = rgb[*index_max]; } /** * @brief 获取一块像素的RGB的平均值及RGB的方差 (Get the average and variance of RGB values) * @param rgb 像素的RGB值 * @param ave 平均值 * @param var 方差 */ void getRGBAveVar_cpp(BYTE* rgb, Double* ave, Double* var) { // 计算均值 *ave = (rgb[0] + rgb[1] + rgb[2]) / 3; // 计算方差 Double sum = 0.0; for(Int32 i = 0; i < 3; i++) { sum += (rgb[i] - (*ave)) * (rgb[i] - (*ave)); } *var = sum / 3; }
[ "han@han-li.cn" ]
han@han-li.cn
7ce76d9567861cfd1b5f2388302597904f738b69
35eb335409884b954bcb4f74a84d5db42288f9fd
/analyser/tools/TrainTestFeaturesTools.h
6297b41cfede3fa4b815cc183664c1595214038b
[]
no_license
amourao/searchservices
460264dea5ce02ec369054df9235bcbce291e168
9f0d1e2c2f9cee586209f94f4e291e5974a6e74b
refs/heads/master
2021-10-25T14:00:50.884729
2017-06-26T10:27:43
2017-06-26T10:27:43
179,506,525
0
0
null
null
null
null
UTF-8
C++
false
false
1,665
h
#pragma once #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <string> #include <vector> #include <sstream> #include <iostream> // std::cout #include <algorithm> // std::random_shuffle #include <vector> // std::vector #include <ctime> // std::time #include <cstdlib> // std::rand, std::srand #include "../nTag/IClassifier.h" using namespace std; class TrainTestFeaturesTools { public: TrainTestFeaturesTools(cv::Mat data, cv::Mat labels, vector<IClassifier*> classifiers); TrainTestFeaturesTools(cv::Mat data, cv::Mat labels, cv::Mat dataTest, cv::Mat labelsTest, vector<IClassifier*> classifiers); ~TrainTestFeaturesTools(); cv::Mat getTrainingData(); cv::Mat getTestData(); cv::Mat getTrainingLabels(); cv::Mat getTestLabels(); string crossValidateAll(int numberOfDivisions); string testAll(); string crossValidate(string name,int numberOfDivisions); string test(string name); void splitDataForTest(double ratio); private: void test(cv::Mat trainData, cv::Mat trainLabels, cv::Mat testData, cv::Mat testLabels, IClassifier* classifier, vector<int>& correctGuesses, vector<int>& falsePositives, cv::Mat& confusionMatrix); string resultsToString(vector<int>& correctGuesses, vector<int>& falsePositives, cv::Mat& confusionMatrix); void divideByClass(cv::Mat trainData, cv::Mat trainLabels, double numberOfDivisions, int currentDivision, cv::Mat& newTrainData, cv::Mat& newTrainLabels, cv::Mat& testData, cv::Mat& testLabels); IClassifier* getClassifier(string name); cv::Mat data; cv::Mat labels; cv::Mat dataTest; cv::Mat labelsTest; vector<IClassifier*> classifiers; };
[ "a.mourao@campus.fct.unl.pt" ]
a.mourao@campus.fct.unl.pt
39b7a550bf95f5dda2961a1b9e049578169f192b
f8255b3c56faa6a9718d8767b2b544878236dfcf
/FindRobotModule/src/FindRobotModuleExt.cpp
e9a4392368d570490904804cfba382e0189c57c3
[]
no_license
LGPhappy/aim_modules
c56d46617faaa9587454bd2bd3ac5cf810b86923
8ef703781bb0f0725405775908b4645bfa6365d8
refs/heads/master
2020-04-24T13:28:48.740903
2015-08-29T18:21:24
2015-08-29T18:21:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,189
cpp
/** * @file FindRobotModuleExt.cpp * @brief FindRobotModule extension * * This file is created at Almende B.V. It is open-source software and part of the Common * Hybrid Agent Platform (CHAP). A toolbox with a lot of open-source tools, ranging from * thread pools and TCP/IP components to control architectures and learning algorithms. * This software is published under the GNU Lesser General Public license (LGPL). * * It is not possible to add usage restrictions to an open-source license. Nevertheless, * we personally strongly object against this software being used by the military, in the * bio-industry, for animal experimentation, or anything that violates the Universal * Declaration of Human Rights. * * Copyright © 2013 Your Name <your@email> * * @author Your Name * @date Current date * @company Your Company * @project Specific Software Project */ #include <FindRobotModuleExt.h> #include <string> #include <sstream> #include <iostream> #include <sstream> using namespace rur; FindRobotModuleExt::FindRobotModuleExt(): cam(NULL), image0(NULL), stop_flag(true), counter(0) { from_file = false; } FindRobotModuleExt::~FindRobotModuleExt() { // already deallocated in Stop() } void FindRobotModuleExt::Init(std::string & name) { FindRobotModule::Init(name); image0 = new CRawImage(640,480,3); if (from_file) { return; } sem_init(&imageSem,0,1); std::string devStrName = "/dev/video0"; const char *devName = devStrName.c_str(); std::cout << "We will use " << std::string(devName) << " as argument" << std::endl; std::cout << " make sure you have called modprobe ... etc. before" << std::endl; cam = new CCamera(&imageSem); cam->init(devName,640,480); counter = 0; } void FindRobotModuleExt::Patches(std::vector<Patch*> & patches) { //image0 //32/24 int div = 4; for (int i = 0; i < div*div; ++i) { Patch *patch = new Patch; patch->width = image0->getwidth() / div; patch->height = image0->getheight() / div; image0->getPatch((i%div)*patch->width,(i/div)*patch->height,*patch); patches.push_back(patch); CRawImage *img = image0->patch2Img(*patch); std::ostringstream ss; ss.clear(); ss.str(""); ss << "patch" << i << ".bmp"; img->saveBmp(ss.str().c_str()); delete img; } } //! Replace with your own functionality void FindRobotModuleExt::Tick() { FindRobotModule::Tick(); std::vector<Patch*> patches; patches.clear(); if (from_file) { std::ostringstream ss; ss.clear(); ss.str(""); ss << "/data/blackfin/img/"; ss << "test0.bmp"; std::string file = ss.str(); image0->loadBmp(file.c_str()); Patches(patches); } else { std::cout << "Renew image object with data from camera" << std::endl; cam->renewImage(image0); } std::ostringstream ss; ss << "test" << counter << ".bmp"; std::string bmp_file = ss.str(); std::cout << "Save image as " << bmp_file << std::endl; image0->saveBmp(bmp_file.c_str()); //image0->makeMonochrome(image0gray); usleep(100000); // 0.1 second counter++; if (counter == 2) stop_flag = true; } //! Immediately returns true to stop the module bool FindRobotModuleExt::Stop() { if (stop_flag) { delete cam; delete image0; } return stop_flag; }
[ "anne@almende.org" ]
anne@almende.org
aba2d68186caf3ff548e91e0867bf35fca35a677
a47b25512e8ae10543d691988f11c2bca40a4515
/src/Matchers/NegativeLookBehindMatcher.hpp
18fd8a66dbcd1aca4afbe84a459926d1135242fb
[]
no_license
davizuku/oregex
dfb67892f99157aefdac2b0288173537b05d5160
451655b194137ae6d6e58c9203debc328aba4247
refs/heads/master
2022-11-28T05:44:23.251991
2020-08-10T06:02:29
2020-08-10T06:02:29
221,951,366
0
0
null
null
null
null
UTF-8
C++
false
false
593
hpp
#pragma once #include "MatcherInterface.hpp" class NegativeLookBehindMatcher: public MatcherInterface { public: NegativeLookBehindMatcher(MatcherInterface *matcher); ~NegativeLookBehindMatcher(); Result* match( const vector<MatchableInterface *> &matchables, size_t start, const forward_list<Result> &previousResults ); Result* match( const vector<MatchableInterface *> &matchables, size_t start ); Result* next(); protected: MatcherInterface* matcher; };
[ "david_alvarezpons@hotmail.com" ]
david_alvarezpons@hotmail.com
f380305830a822807477cfe4d0b123c4c7882323
4bc16b676c3ad3e2dc81b410dc9865a5322df50e
/Oleksenko_Sergey_Lesson_5/Stack.cpp
6201cca98b64bbba90657b462e5b5dc2161cc4c6
[]
no_license
Soleks/algorithm
7b9c3f97a74700cc89203df8f046807dd980a8a2
38bd88cb8223581485a403244c79d2dda05d67f8
refs/heads/master
2020-03-12T09:54:30.350001
2018-05-02T09:32:15
2018-05-02T09:32:15
130,562,032
0
0
null
null
null
null
UTF-8
C++
false
false
797
cpp
#include "Stack.h" struct SStack* stack_new(const unsigned num) { struct SStack* stack = (struct SStack*) malloc(sizeof(struct SStack)); if (stack == NULL) { printf("Out of memory: function: %s, line: %d\n", __FUNCTION__, __LINE__); return NULL; } stack->p = (int*)malloc(sizeof(int) * num); stack->ind = -1; stack->max_num = num; return stack; } void stack_delete(struct SStack* stack) { if (stack != NULL) { if (stack != NULL) { free(stack->p); } free(stack); } } void stack_push(struct SStack* stack, const int value) { if (stack->ind == stack->max_num - 1) { return; } stack->ind++; stack->p[stack->ind] = value; } int stack_pop(struct SStack* stack) { if (stack->ind >= 0) { stack->ind--; return stack->p[stack->ind + 1]; } return 0; }
[ "SolekX@gmail.com" ]
SolekX@gmail.com
12a981a691231ea966f5f09d767ff195a095e134
1720cfbd572c3d2636a811625976e57dc1f8dd0e
/fs/fs_prj/src/Const.h
99860fe533663404766ff9472d4b626395df8382
[]
no_license
howellxu24678/cpp
b4a09fd725cd6fb95b73a16300ce3ec839eb48fb
f97bd58d1d14250192ecaeed8a4d26bbc515f97b
refs/heads/master
2021-09-15T07:01:55.958157
2018-05-28T06:57:53
2018-05-28T06:57:53
null
0
0
null
null
null
null
GB18030
C++
false
false
2,180
h
#ifndef __CONST_H__ #define __CONST_H__ #include "sgit/SgitFtdcUserApiDataType.h" #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define MIN(a,b) (((a) < (b)) ? (a) : (b)) const int G_WAIT_TIME = 10000; const std::string G_VERSION = "20170901.01.01"; const std::string G_CONFIG_PATH = "./config/global.cfg"; const std::string G_CONFIG_GLOBAL_SECTION = "global"; const std::string G_CONFIG_LOG = "log"; const std::string G_CONFIG_SGIT = "sgit"; const std::string G_CONFIG_FIX = "fix"; const std::string G_CONFIG_DICT = "dict"; //保存Fix用户的关键信息,回复消息时需要用到 struct STUserInfo { STUserInfo() : m_ssOnBehalfOfCompID("") , m_enCvtType(Convert::Unknow) , m_iCloseTodayYesterdayTag(0) , m_iSpecHedgeTag(0) , m_cDefaultSpecHedge(THOST_FTDC_HF_Speculation) {} FIX::SessionID m_oSessionID; std::string m_ssOnBehalfOfCompID; //代码类型 Convert::EnCvtType m_enCvtType; //平今平昨的自定义tag int m_iCloseTodayYesterdayTag; //投机套保的自定义tag int m_iSpecHedgeTag; //默认投机套保值(不在投机套保tag中显式指明时取的默认值,不做字典转换),没有配置默认投机 char m_cDefaultSpecHedge; }; //行情处理中,标的的订阅参数 struct STUScrbParm { STUScrbParm() : m_ssSessionKey("") , m_iDepth(0) { m_setEntryTypes.clear(); } std::string m_ssSessionKey; int m_iDepth; std::set<char> m_setEntryTypes; bool operator==(const STUScrbParm &stuScrbParm) const { //return this->m_ssSessionKey == stuScrbParm.m_ssSessionKey && // this->m_iDepth == stuScrbParm.m_iDepth && // this->m_setEntryTypes == stuScrbParm.m_setEntryTypes; return this->m_ssSessionKey == stuScrbParm.m_ssSessionKey; } bool operator<(const STUScrbParm &stuScrbParm) const { if (this->m_ssSessionKey < stuScrbParm.m_ssSessionKey) return true; if (this->m_iDepth < stuScrbParm.m_iDepth) return true; if (this->m_setEntryTypes < stuScrbParm.m_setEntryTypes) return true; return false; } }; #endif // __CONST_H__
[ "xujhaosysu@163.com" ]
xujhaosysu@163.com
5b81f4544cd163f02d5ea18a7db1c5d0d9e7b337
0f4012d03230b59125ac3c618f9b5e5e61d4cc7d
/Cocos2d-x/cocos2d-2.0-x-2.0.3/CocosDenshionEx/include/ALU.h
c0bcd5d0e65e1a654de1ff07d2e4f08760c34cfb
[ "MIT" ]
permissive
daxingyou/SixCocos2d-xVC2012
80d0a8701dda25d8d97ad88b762aadd7e014c6ee
536e5c44b08c965744cd12103d3fabd403051f19
refs/heads/master
2022-04-27T06:41:50.396490
2020-05-01T02:57:20
2020-05-01T02:57:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,419
h
#if !defined(ALU_H) #define ALU_H #define OF 0X0800 #define DF 0X0400 #define IF 0X0200 #define TF 0X0100 #define SF 0X0080 #define ZF 0X0040 #define AF 0X0010 #define PF 0X0004 #define CF 0X0001 // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 // +-----------------------------------------------+ // | | | | |OF|DF|IF|TF|SF|ZF| |AF| |PF| |CF| // +-----------------------------------------------+ //#define LO32 ( (nn_Temp) ) ( (unsigned long)( ( (nn_Temp) & ( (unsigned __int64)(0X00000000FFFFFFFF)) ) ) ) //#define HI32 ( (nn_Temp) ) ( (unsigned long)( ( (nn_Temp) & (((unsigned __int64)(0XFFFFFFFF00000000)) >> 32 ) ) ) ) #define NOFLAG 0 #define MAX 0XFFFFFFFF //#ifndef WIN32 typedef unsigned long long UINT64; typedef unsigned int UINT32; typedef unsigned int UINT; //#endif class CALU { public: void MUL( UINT64& DST, UINT32 SRC1, UINT32 SRC2 ); inline void ADD ( UINT32& DST, UINT32 SRC ); inline void ADC ( UINT32& DST, UINT32 SRC ); void ADD ( UINT32& DST, UINT32 SRC1, UINT32 SRC2 ); void ADC ( UINT32& DST, UINT32 SRC1, UINT32 SRC2 ); inline void SUB ( UINT32& DST, UINT32 SRC ); inline void SBB ( UINT32& DST, UINT32 SRC ); void SUB ( UINT32& DST, UINT32 SRC1, UINT32 SRC2 ); void SBB ( UINT32& DST, UINT32 SRC1, UINT32 SRC2 ); void AND ( UINT32& DST, const UINT32 SRC ); void OR ( UINT32& DST, const UINT32 SRC ); void NOT ( UINT32& DST ); void XOR ( UINT32& DST, UINT32 SRC ); void TEST( const UINT32 OPR1, const UINT32 OPR2 ); void SHL ( UINT32& OPR, const UINT CNT ); void SHL ( UINT32& DST, UINT32& SRC, const UINT CNT ); void SHL ( UINT32& DSTH,UINT32& DSTL,UINT32 SRC, const UINT CNT ); void SHR ( UINT32& OPR, const UINT CNT ); void SHR ( UINT32& SRC, UINT32& DST, const UINT CNT ); void SHR ( UINT32 SRC, UINT32& DSTH,UINT32& DSTL, const UINT CNT); void STC ( void ); void CMC ( void ); void CLC ( void ); UINT32 HI32( const UINT64& nnTemp ); UINT32 LO32( const UINT64& nnTemp ); private: inline void ClearPSW( const unsigned short Flag ); inline void SetPSW ( const unsigned short Flag ); inline bool GetPSW ( const unsigned short Flag ) const; inline void SetPSW ( unsigned short Flag, const UINT32& Set ); protected: CALU(); virtual ~CALU(); private: unsigned short PSW; }; #endif
[ "hanshouqing85@163.com" ]
hanshouqing85@163.com
eb93cbccd765eb2c0f73cf85f984a908f078c0bf
f7c3004051876ef1da2cd9c41eb8939434dea084
/chapter-02/ex-09/main.cpp
f1f021723c00898c1d9db851a2c1638917a4dca2
[]
no_license
numerodix/accelerated-cpp
e70d03b6e7696b7638279c0ba0575de08da45542
08d722aeaa572c34d326bb9f9e829850f213f563
refs/heads/master
2020-11-25T09:19:39.414230
2019-12-24T04:21:10
2019-12-24T04:21:10
228,592,304
0
0
null
null
null
null
UTF-8
C++
false
false
351
cpp
#include <iostream> #include <string> using std::cin; using std::cout; using std::endl; int main() { int x; int y; cout << "Please enter your first number: "; cin >> x; cout << "Please enter your second number: "; cin >> y; int greatest = x > y ? x : y; cout << greatest << " is greatest" << endl; return 0; }
[ "numerodix@gmail.com" ]
numerodix@gmail.com
fe6633391ee25aeef548cfd4db2695685afff810
e36128cfc5a6ef0cef1da54e536c99250fc6fd43
/Libs/src/YXC_AVKernel/Utils/_YXV_Common.hpp
27d8053cd18931cffbbb88512e4bfc71fc36a3ba
[]
no_license
yuanqs86/native
f53cb48bae133976c89189e1ea879ab6854a9004
0a46999537260620b683296d53140e1873442514
refs/heads/master
2021-08-31T14:50:41.572622
2017-12-21T19:20:10
2017-12-21T19:20:10
114,990,467
0
1
null
null
null
null
UTF-8
C++
false
false
1,591
hpp
#ifndef __INNER_INC_YXC_AV_COMMON_HPP__ #define __INNER_INC_YXC_AV_COMMON_HPP__ #include <YXC_AVKernel/YXV_AVBuilder.h> #include <YXC_Sys/YXC_UtilMacros.hpp> #include <YXC_Sys/YXC_Nullable.hpp> namespace _YXV_AVUtils { YXC_Status _CalculateSampleInfo(YXV_PixFmt fmt, yuint32_t w, yuint32_t h, yuint32_t* pC, yuint32_t* pRSArr, yuint32_t* pHArr, yuint32_t* pCSArr, yuint32_t* puS); void _FillVSample(YXV_Buffer* buffer, ybool_t bInvert, const YXV_PicDesc* picDesc, yuint32_t uC, yuint32_t* pRSArr, yuint32_t* pHArr, yuint32_t* pCSArr, YXV_Frame* pSample); void _FillPixInfo(YXV_PixFmt pixFmt, yuint8_t (&ratioW)[YXV_MAX_NUM_PLANARS], yuint8_t (&ratioH)[YXV_MAX_NUM_PLANARS], yuint8_t (&pixelSize)[YXV_MAX_NUM_PLANARS]); YXC_Status _AllocVSample(ybool_t bInvert, const YXV_PicDesc* picDesc, yuint32_t uC, yuint32_t* pRSArr, yuint32_t* pHArr, yuint32_t* pCSArr, yuint32_t uS, YXV_Frame* pSample); static inline yuint32_t _GetSampleBits(YXV_SampleFmt sampleFmt) { yuint32_t uBitVal = YXC_HI_16BITS(sampleFmt & YXV_SAMPLE_FMT_BITS_MASK); return uBitVal; } static inline ybool_t _IsPlanarSampleFmt(YXV_SampleFmt sampleFmt) { yuint32_t uVal = sampleFmt & YXV_SAMPLE_FMT_TYPE_PLANAR; return uVal != 0; } void _FillASample(YXV_Buffer* buffer, const YXV_SampleDesc* desc, yuint32_t uP, yuint32_t uSampleBytes, yuint32_t uNumSamples, YXV_Frame* sample); YXC_Status _AllocASample(const YXV_SampleDesc* desc, yuint32_t uP, yuint32_t uSampleBytes, yuint32_t uNumSamples, YXV_Frame* sample); extern int gs_resize_flag; } #endif /* __INNER_INC_YXC_AV_COMMON_HPP__ */
[ "34738843+yuanqs86@users.noreply.github.com" ]
34738843+yuanqs86@users.noreply.github.com
d9858938011b40abb4e80066f500de33b840bd1a
05802ccc466d774e85aefbf2c501faf7c1890a00
/modules/core/combinatorial/include/nt2/combinatorial/functions/scalar/fibonacci.hpp
7824adea6c3d04cc37888557237506ee7dc4039a
[ "BSL-1.0" ]
permissive
ndoss/nt2
895d5297a2c951c9d66fbe4dfc009367a4b5e211
3a47c38e8b528273c1413eee15364b92039e06f1
refs/heads/master
2021-01-15T10:59:42.807892
2014-03-13T16:51:24
2014-03-13T16:51:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,381
hpp
//============================================================================== // Copyright 2003 - 2011 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2011 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_SCALAR_FIBONACCI_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_SCALAR_FIBONACCI_HPP_INCLUDED #include <nt2/combinatorial/functions/fibonacci.hpp> #include <nt2/include/functions/cons.hpp> #include <nt2/include/functions/linsolve.hpp> #include <nt2/include/functions/vertcat.hpp> #include <nt2/include/functions/scalar/minusone.hpp> #include <nt2/include/functions/scalar/is_flint.hpp> #include <nt2/include/functions/scalar/round.hpp> #include <nt2/include/functions/scalar/pow.hpp> #include <nt2/include/functions/scalar/rec.hpp> #include <nt2/include/constants/one.hpp> #include <nt2/include/constants/gold.hpp> #include <nt2/include/constants/cgold.hpp> #include <nt2/core/container/table/table.hpp> namespace nt2 { namespace ext { NT2_FUNCTOR_IMPLEMENTATION(nt2::tag::fibonacci_, tag::cpu_, (A0)(A1), ((scalar_<arithmetic_<A0> >)) ((scalar_<arithmetic_<A0> >)) ((scalar_<integer_<A1> >)) ) { typedef A0 result_type; inline result_type operator()(A0 const& a, const A0 & b, const A1 & n) const { const A0 gold1 = -rec(nt2::Gold<result_type>()); nt2::container::table<A0> m = nt2::cons(of_size(2, 2), nt2::One<result_type>(), nt2::Gold<result_type>(), nt2::One<result_type>(),gold1 ); BOOST_AUTO_TPL(nm1, nt2::minusone(n)); nt2::container::table<A0> c = nt2::linsolve(m, catv(a, b)); BOOST_AUTO_TPL(f, c(1)*nt2::pow(nt2::Gold<result_type>(), nm1)+c(2)*nt2::pow(gold1, nm1)); if (nt2::is_flint(a) && nt2::is_flint(b)) return nt2::round(f); else return f; } }; } } #endif
[ "jtlapreste@gmail.com" ]
jtlapreste@gmail.com
097a86ebdd1f87e0ce33d86903676969bab5afbd
31fa6c4a41a6b0147aebab090a87edfbaa7c0be4
/HeapSort.cpp
fadf419e11bd3063bf080608078ed7db9fbab8b9
[]
no_license
ZeaLot4J/Algorithms-DataStructures
517ab02c2e40ffa1ce1907fd4f9e7a97b8c052b8
e6059515a35704ced8069e50c9853c2feb0a2ccc
refs/heads/master
2021-01-19T05:21:43.878016
2018-01-05T10:06:43
2018-01-05T10:06:43
87,427,845
0
0
null
null
null
null
UTF-8
C++
false
false
2,047
cpp
#include<iostream> using namespace std; //最后一个非叶结点是n/2-1 //堆的调整算法,大顶堆,最后是单独写一个函数 void heapAdjustLargeTop(int* ia,int index, int n){ int t,maxIndex; while(1){ if(index*2<n){//如果有左孩子结点 maxIndex = ia[index]<ia[index*2]?index*2:index; }else{//没有左孩子则退出 break; } if(index*2+1<n){// 如果有右孩子结点 maxIndex = ia[maxIndex]<ia[index*2+1]?index*2+1:maxIndex; } if(index!=maxIndex){//如果最大数的下标不是自己 t = ia[index]; ia[index] = ia[maxIndex]; ia[maxIndex] = t; index = maxIndex; }else{ break; } } } void heapAdjustLittleTop(int* ia,int index, int n){ int t,minIndex; while(1){ if(index*2<n){//如果有左孩子结点 minIndex = ia[index]>ia[index*2]?index*2:index; }else{//没有左孩子则退出 break; } if(index*2+1<n){// 如果有右孩子结点 minIndex = ia[minIndex]>ia[index*2+1]?index*2+1:minIndex; } if(index!=minIndex){//如果最大数的下标不是自己 t = ia[index]; ia[index] = ia[minIndex]; ia[minIndex] = t; index = minIndex; }else{ break; } } } //建一个大顶堆 void createHeap(int* ia, int n){ for(int i=n/2; i>0; i--){ heapAdjustLargeTop(ia,i,n); } } void heapSort(int* ia, int n){ int t,i = n; while(i>2){ t = ia[i]; ia[i] = ia[1]; ia[1] = t; i--; heapAdjustLittleTop(ia,1,i); } } int main(){ // int ia[100] = {0,99,5,36,7,22,17,46,12,2,19,25,28,1,92}; int ia[100] = {0,1 ,2, 5, 7, 12, 17, 19, 22, 25, 28, 36, 46, 92, 99}; int n = 14; // createHeap(ia,14); heapSort(ia,14); for(int i=1; i<=14; i++){ cout << ia[i] << " "; } cout << endl; return 0; }
[ "704956780@qq.com" ]
704956780@qq.com
f66e6ed4a5441c7cd030d926104c7f77d8711483
3c7e9921abd987e45bb034027717a515943cabe9
/code_builtin_system_cpu+gpu/src/taskms/Utility/PeeIdHelper.cpp
f838f5c128d4549dd7a278a41164fac08471eaf6
[]
no_license
zhuanbao/gxzb
2f07380e3b27acb86d46d8d1c77f838593fc98b8
a40bc93fad5f40bfc410619c5d4265a1bce099d4
refs/heads/master
2021-01-12T01:28:53.383633
2020-04-22T05:13:44
2020-04-22T05:13:44
78,386,221
2
2
null
2020-01-26T22:35:49
2017-01-09T02:24:32
C++
GB18030
C++
false
false
2,667
cpp
//保护此文件需要在预编译头文件里 加入#define WIN32_LEAN_AND_MEAN #pragma once #include "stdafx.h" #include <Winsock2.h> #include <iphlpapi.h> #pragma comment(lib, "IPHLPAPI.lib") #include <string> #include "HardDriveInfo.h" #include "StringOperation.h" #include "commonshare\md5.h" #include "PeeIdHelper.h" bool GetMacByGetAdaptersAddresses(std::wstring& macOUT) { bool ret = false; ULONG outBufLen = sizeof(IP_ADAPTER_ADDRESSES); PIP_ADAPTER_ADDRESSES pAddresses = (IP_ADAPTER_ADDRESSES*)malloc(outBufLen); if (pAddresses == NULL) return false; // Make an initial call to GetAdaptersAddresses to get the necessary size into the ulOutBufLen variable if(GetAdaptersAddresses(AF_UNSPEC, 0, NULL, pAddresses, &outBufLen) == ERROR_BUFFER_OVERFLOW) { free(pAddresses); pAddresses = (IP_ADAPTER_ADDRESSES*)malloc(outBufLen); if (pAddresses == NULL) return false; } if(GetAdaptersAddresses(AF_UNSPEC, 0, NULL, pAddresses, &outBufLen) == NO_ERROR) { // If successful, output some information from the data we received for(PIP_ADAPTER_ADDRESSES pCurrAddresses = pAddresses; pCurrAddresses != NULL; pCurrAddresses = pCurrAddresses->Next) { // 确保MAC地址的长度为 00-00-00-00-00-00 if(pCurrAddresses->PhysicalAddressLength != 6) continue; wchar_t acMAC[32]; wsprintf(acMAC, L"%02X%02X%02X%02X%02X%02X", int (pCurrAddresses->PhysicalAddress[0]), int (pCurrAddresses->PhysicalAddress[1]), int (pCurrAddresses->PhysicalAddress[2]), int (pCurrAddresses->PhysicalAddress[3]), int (pCurrAddresses->PhysicalAddress[4]), int (pCurrAddresses->PhysicalAddress[5])); macOUT = acMAC; ret = true; break; } } free(pAddresses); return ret; } void GetPeerId_(std::wstring & wstrPeerId) { std::wstring wstrMAC; if (!GetMacByGetAdaptersAddresses(wstrMAC)) { wstrMAC = L"000000000000"; } wstrPeerId = wstrMAC; std::wstring wstrIDESN = L""; if (IDEINFO::getHardDriveComputerID() > 0) { std::string strHardDriveSN= IDEINFO::HardDriveSerialNumber; strHardDriveSN = ultra::Trim(strHardDriveSN); if (!strHardDriveSN.empty()) { wchar_t pszMD5[MAX_PATH] = {0}; if (GetStringMd5(strHardDriveSN,pszMD5) && wcslen(pszMD5) > 4) { wstrIDESN = std::wstring(pszMD5,4); } } } if (!wstrIDESN .empty()) { wstrPeerId += wstrIDESN; } else { /*srand( (unsigned)time( NULL ) ); for(int i=0;i<4;i++) { wchar_t szRam[2] = {0}; wsprintf(szRam,L"%X", rand()%16); szRam[1]=L'\0'; wstrPeerId += szRam; }*/ wstrPeerId += L"0000"; } return ; }
[ "ethminer@163.com" ]
ethminer@163.com
ab71188c4e469053c7a22c31d266dbc12c9a788e
31f0ad52446c050f0fccd2d29958c063ffaedc15
/sfup-core/rtp/RtpVP8Parser.cpp
6dbb64a5423a407ed4be4092f2d90036500eb766
[]
no_license
lcmftianci/sfup-client-win
8eba3d168cf9059580af2d6abdca6085b2a25592
1875f0b539b3b84555d57f2bd9c3996284e0049b
refs/heads/master
2020-07-08T13:30:21.265563
2019-08-26T03:01:39
2019-08-26T03:01:39
203,689,090
3
2
null
null
null
null
UTF-8
C++
false
false
6,115
cpp
/* * This file contains third party code: copyright below */ /* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "rtp/RtpVP8Parser.h" #include <cstddef> #include <cstdio> #include <string> namespace erizo { DEFINE_LOGGER(RtpVP8Parser, "rtp.RtpVP8Parser"); RtpVP8Parser::RtpVP8Parser() { } RtpVP8Parser::~RtpVP8Parser() { } // // VP8 format: // // Payload descriptor // 0 1 2 3 4 5 6 7 // +-+-+-+-+-+-+-+-+ // |X|R|N|S|PartID | (REQUIRED) // +-+-+-+-+-+-+-+-+ // X: |I|L|T|K| RSV | (OPTIONAL) // +-+-+-+-+-+-+-+-+ // I: | PictureID | (OPTIONAL) // +-+-+-+-+-+-+-+-+ // L: | TL0PICIDX | (OPTIONAL) // +-+-+-+-+-+-+-+-+ // T/K: |TID:Y| KEYIDX | (OPTIONAL) // +-+-+-+-+-+-+-+-+ // // Payload header (considered part of the actual payload, sent to decoder) // 0 1 2 3 4 5 6 7 // +-+-+-+-+-+-+-+-+ // |Size0|H| VER |P| // +-+-+-+-+-+-+-+-+ // | ... | // + + int ParseVP8PictureID(erizo::RTPPayloadVP8* vp8, const unsigned char** dataPtr, int* dataLength, int* parsedBytes) { if (*dataLength <= 0) { return -1; } vp8->pictureID = (**dataPtr & 0x7F); if (**dataPtr & 0x80) { (*dataPtr)++; (*parsedBytes)++; if (--(*dataLength) <= 0) return -1; // PictureID is 15 bits vp8->pictureID = (vp8->pictureID << 8) + **dataPtr; } (*dataPtr)++; (*parsedBytes)++; (*dataLength)--; return 0; } int ParseVP8Tl0PicIdx(erizo::RTPPayloadVP8* vp8, const unsigned char** dataPtr, int* dataLength, int* parsedBytes) { if (*dataLength <= 0) { return -1; } vp8->tl0PicIdx = **dataPtr; (*dataPtr)++; (*parsedBytes)++; (*dataLength)--; return 0; } int ParseVP8TIDAndKeyIdx(erizo::RTPPayloadVP8* vp8, const unsigned char** dataPtr, int* dataLength, int* parsedBytes) { if (*dataLength <= 0) { return -1; } if (vp8->hasTID) { vp8->tID = ((**dataPtr >> 6) & 0x03); vp8->layerSync = (**dataPtr & 0x20) ? true : false; // Y bit } if (vp8->hasKeyIdx) { vp8->keyIdx = (**dataPtr & 0x1F); } (*dataPtr)++; (*parsedBytes)++; (*dataLength)--; return 0; } int ParseVP8FrameSize(erizo::RTPPayloadVP8* vp8, const unsigned char* dataPtr, int dataLength) { if (vp8->frameType != kIFrame) { // Included in payload header for I-frames. return -1; } if (dataLength < 10) { // For an I-frame we should always have the uncompressed VP8 header // in the beginning of the partition. return -1; } vp8->frameWidth = ((dataPtr[7] << 8) + dataPtr[6]) & 0x3FFF; vp8->frameHeight = ((dataPtr[9] << 8) + dataPtr[8]) & 0x3FFF; return 0; } int ParseVP8Extension(erizo::RTPPayloadVP8* vp8, const unsigned char* dataPtr, int dataLength) { int parsedBytes = 0; if (dataLength <= 0) { return -1; } // Optional X field is present vp8->hasPictureID = (*dataPtr & 0x80) ? true : false; // I bit vp8->hasTl0PicIdx = (*dataPtr & 0x40) ? true : false; // L bit vp8->hasTID = (*dataPtr & 0x20) ? true : false; // T bit vp8->hasKeyIdx = (*dataPtr & 0x10) ? true : false; // K bit // ELOG_DEBUG("Parsing extension haspic %d, hastl0 %d, has TID %d, has Key %d ", // vp8->hasPictureID, vp8->hasTl0PicIdx, vp8->hasTID, vp8->hasKeyIdx ); // Advance dataPtr and decrease remaining payload size dataPtr++; parsedBytes++; dataLength--; if (vp8->hasPictureID) { if (ParseVP8PictureID(vp8, &dataPtr, &dataLength, &parsedBytes) != 0) { return -1; } } if (vp8->hasTl0PicIdx) { if (ParseVP8Tl0PicIdx(vp8, &dataPtr, &dataLength, &parsedBytes) != 0) { return -1; } } if (vp8->hasTID || vp8->hasKeyIdx) { if (ParseVP8TIDAndKeyIdx(vp8, &dataPtr, &dataLength, &parsedBytes) != 0) { return -1; } } return parsedBytes; } RTPPayloadVP8* RtpVP8Parser::parseVP8(unsigned char* data, int dataLength) { // ELOG_DEBUG("Parsing VP8 %d bytes", dataLength); RTPPayloadVP8* vp8 = new RTPPayloadVP8; // = &parsedPacket.info.VP8; const unsigned char* dataPtr = data; // Parse mandatory first byte of payload descriptor bool extension = (*dataPtr & 0x80) ? true : false; // X bit vp8->nonReferenceFrame = (*dataPtr & 0x20) ? true : false; // N bit vp8->beginningOfPartition = (*dataPtr & 0x10) ? true : false; // S bit vp8->partitionID = (*dataPtr & 0x0F); // PartID field // ELOG_DEBUG("X: %d N %d S %d PartID %d", // extension, vp8->nonReferenceFrame, vp8->beginningOfPartition, vp8->partitionID); if (vp8->partitionID > 8) { // Weak check for corrupt data: PartID MUST NOT be larger than 8. return vp8; } // Advance dataPtr and decrease remaining payload size dataPtr++; dataLength--; if (extension) { const int parsedBytes = ParseVP8Extension(vp8, dataPtr, dataLength); if (parsedBytes < 0) { return vp8; } dataPtr += parsedBytes; dataLength -= parsedBytes; // ELOG_DEBUG("Parsed bytes in extension %d", parsedBytes); } if (dataLength <= 0) { ELOG_WARN("Error parsing VP8 payload descriptor; payload too short"); return vp8; } // Read P bit from payload header (only at beginning of first partition) if (dataLength > 0 && vp8->beginningOfPartition && vp8->partitionID == 0) { // parsedPacket.frameType = (*dataPtr & 0x01) ? kPFrame : kIFrame; vp8->frameType = (*dataPtr & 0x01) ? kPFrame : kIFrame; } else { vp8->frameType = kPFrame; } if (0 == ParseVP8FrameSize(vp8, dataPtr, dataLength)) { if (vp8->frameWidth != 640) { ELOG_WARN("VP8 Frame width changed! = %d need postprocessing", vp8->frameWidth); } } vp8->data = dataPtr; vp8->dataLength = (unsigned int) dataLength; return vp8; } } // namespace erizo
[ "707010543@qq.com" ]
707010543@qq.com
548bd441f674617601e35c91b923bbf83f675dd0
4e7b3607bb9a23fbad4a2a65ae8b2b55870ce809
/ogre_test/WorldObject.cpp
a6334b183ea8af64a0a2a4fe1dbe5fe6b7acbf77
[]
no_license
zhengyeve/SeniorSem
7f45b286d1b006e183672697ba9e93c3a4ef43bd
f274c389be3152efbfafc409f15f9650fd4fafaa
refs/heads/master
2020-05-18T12:40:19.962430
2012-11-27T05:07:44
2012-11-27T05:07:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
303
cpp
#include "WorldObject.h" /*WorldObject::WorldObject(Ogre::SceneNode* node, float collision_radius) { ourNode = node; collisionRadius = collision_radius; } WorldObject::WorldObject() { isClear = false; } bool WorldObject::receiveAction(ActionType action_type, double action_var) { return true; }*/
[ "isoma-13@rhodes.edu" ]
isoma-13@rhodes.edu
d08b0adeec3b138947d3960a9c2d5df912062736
3560f535e567b788e2507fd227257ef04e4b01a8
/tests/exited.cpp
cfd6647ec776098133a0baa3be68e481ce100b26
[ "MIT" ]
permissive
qoo2p5/libsbox
6b3b8cdb5794b1b30c6657fa72d8762fe85a8657
445eb2a336ab21c0293f39fc38347afa617658bb
refs/heads/master
2020-07-14T06:35:14.402977
2019-08-29T23:09:38
2019-08-29T23:09:38
205,263,285
0
0
null
2019-08-29T22:50:59
2019-08-29T22:50:59
null
UTF-8
C++
false
false
2,525
cpp
/* * Copyright (c) 2019 Andrei Odintsov <forestryks1@gmail.com> */ #include <libsbox.h> #include <string> #include <map> #include <cassert> #include <iostream> #include <memory> int target_main(int argc, char *argv[]) { assert(argc >= 3); int exit_code = strtol(argv[2], nullptr, 10); return exit_code; } int invoke_main(int argc, char *argv[]) { libsbox::init([](const char *msg){ std::cout << "Error: " << msg << std::endl; }); assert(argc >= 3); std::vector<std::string> arg; arg.emplace_back(argv[0]); arg.emplace_back("target"); arg.emplace_back(argv[2]); std::unique_ptr<libsbox::execution_target> target(new libsbox::execution_target(arg)); std::unique_ptr<libsbox::execution_context> context(new libsbox::execution_context()); target->add_standard_rules(); context->register_target(target.get()); context->run(); std::cout << "exited: " << target->exited << std::endl; std::cout << "exit_code: " << target->exit_code << std::endl; std::cout << "signaled: " << target->signaled << std::endl; std::cout << "term_signal: " << target->term_signal << std::endl; std::cout << "time_limit_exceeded: " << target->time_limit_exceeded << std::endl; std::cout << "wall_time_limit_exceeded: " << target->wall_time_limit_exceeded << std::endl; std::cout << "oom_killed: " << target->oom_killed << std::endl; std::cout << "time_usage: " << target->time_usage << std::endl; std::cout << "time_usage_sys: " << target->time_usage_sys << std::endl; std::cout << "time_usage_user: " << target->time_usage_user << std::endl; std::cout << "wall_time_usage: " << target->wall_time_usage << std::endl; std::cout << "memory_usage: " << target->memory_usage << std::endl; int exit_code = strtol(argv[2], nullptr, 10); assert(target->exited); assert(target->exit_code == exit_code); assert(!target->signaled); assert(target->term_signal == -1); assert(!target->time_limit_exceeded); assert(!target->wall_time_limit_exceeded); assert(!target->oom_killed); // assert(target->time_usage); // assert(target->time_usage_sys); // assert(target->time_usage_user); // assert(target->wall_time_usage); // assert(target->memory_usage); return 0; } int main(int argc, char *argv[]) { assert(argc >= 2); std::string target = argv[1]; if (target == "invoke") { return invoke_main(argc, argv); } else { return target_main(argc, argv); } }
[ "forestryks1@gmail.com" ]
forestryks1@gmail.com
30de7eb4c2ef1b3a9086ff7c480fe370dba0caa9
1fef826e19eaa4838fa1c952fb375a730203b01d
/avancefinal2/avance3corregido/clases/include/Global.h
e6eea6fee4eb18f78969bfd22962a1fcea029d72
[]
no_license
sebscaz/compiladores
18bed3757f6dd5e975a33babe83d7d8819c24a1d
e0727bb085f61c89eece110dcd6972423d82211b
refs/heads/master
2021-01-01T17:56:27.041435
2013-05-10T19:57:26
2013-05-10T19:57:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
214
h
#ifndef GLOBAL_H #define GLOBAL_H #include <Memoria.h> class Global : public Memoria { public: Global(); virtual ~Global(); protected: private: }; #endif // GLOBAL_H
[ "mak@ubuntu.(none)" ]
mak@ubuntu.(none)
656e30cd00b98a701bb4926c2d76888220eb5ece
6ed8ab3591f0522a4a669c44f68160ee941ad783
/022_NormalMap/022_Normal.cpp
f53298a3e9b30b3bc9d1d6a4b81532463999ef7e
[]
no_license
zhudianyu/LearnOpenGL
011e95cc78403ee79129da0729abcc5407cb539a
94d733bf27524f0f1e1e9fb752cbdfbcd919989d
refs/heads/master
2021-05-18T23:33:06.913686
2020-05-06T06:36:58
2020-05-06T06:36:58
251,478,346
0
0
null
null
null
null
GB18030
C++
false
false
14,373
cpp
#define GLEW_STATIC #include <GL/glew.h> #include <GLFW/glfw3.h> #include <iostream> #include <SOIL.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include "../common/Shader.h" #include "../common/Camera.h" #include <map> #include "../common/Model.h" using namespace std; // Window dimensions const GLuint SCR_WIDTH = 800, SCR_HEIGHT = 600; // Camera Camera camera(glm::vec3(0.0f, 0.0f, 3.0f)); GLfloat lastX = SCR_WIDTH / 2.0; GLfloat lastY = SCR_HEIGHT / 2.0; bool keys[1024]; // Deltatime GLfloat deltaTime = 0.0f; // Time between current frame and last frame GLfloat lastFrame = 0.0f; // Time of last frame void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode); void mouse_callback(GLFWwindow* window, double xpos, double ypos); void scroll_callback(GLFWwindow* window, double xoffset, double yoffset); void do_movement(); const string projName = "022_NORMALMAP"; GLuint GenTexture(const char* path) { int width, height; unsigned char* image = SOIL_load_image(path, &width, &height, 0, SOIL_LOAD_RGB); GLuint textureID; glGenTextures(1, &textureID); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textureID); //纹理环绕 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); //纹理放大缩小 // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //多级渐进纹理采样 纹理放大不会使用多级渐远纹理 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image); glGenerateMipmap(GL_TEXTURE_2D); SOIL_free_image_data(image); glBindTexture(GL_TEXTURE_2D, 0); return textureID; } GLuint GenAlphaTexture(const char* path) { int width, height; unsigned char* image = SOIL_load_image(path, &width, &height, 0, SOIL_LOAD_RGBA); GLuint textureID; glGenTextures(1, &textureID); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textureID); //纹理环绕 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); //纹理放大缩小 // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //多级渐进纹理采样 纹理放大不会使用多级渐远纹理 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image); glGenerateMipmap(GL_TEXTURE_2D); SOIL_free_image_data(image); glBindTexture(GL_TEXTURE_2D, 0); return textureID; } GLenum glCheckError_(const char* file, int line) { GLenum errorCode; while ((errorCode = glGetError()) != GL_NO_ERROR) { std::string error; switch (errorCode) { case GL_INVALID_ENUM: error = "INVALID_ENUM"; break; case GL_INVALID_VALUE: error = "INVALID_VALUE"; break; case GL_INVALID_OPERATION: error = "INVALID_OPERATION"; break; case GL_STACK_OVERFLOW: error = "STACK_OVERFLOW"; break; case GL_STACK_UNDERFLOW: error = "STACK_UNDERFLOW"; break; case GL_OUT_OF_MEMORY: error = "OUT_OF_MEMORY"; break; case GL_INVALID_FRAMEBUFFER_OPERATION: error = "INVALID_FRAMEBUFFER_OPERATION"; break; } std::cout << error << " | " << file << " (" << line << ")" << std::endl; } return errorCode; } #define glCheckError() glCheckError_(__FILE__, __LINE__) void APIENTRY glDebugOutput(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) { if (id == 131169 || id == 131185 || id == 131218 || id == 131204) return; // ignore these non-significant error codes std::cout << "---------------" << std::endl; std::cout << "Debug message (" << id << "): " << message << std::endl; switch (source) { case GL_DEBUG_SOURCE_API: std::cout << "Source: API"; break; case GL_DEBUG_SOURCE_WINDOW_SYSTEM: std::cout << "Source: Window System"; break; case GL_DEBUG_SOURCE_SHADER_COMPILER: std::cout << "Source: Shader Compiler"; break; case GL_DEBUG_SOURCE_THIRD_PARTY: std::cout << "Source: Third Party"; break; case GL_DEBUG_SOURCE_APPLICATION: std::cout << "Source: Application"; break; case GL_DEBUG_SOURCE_OTHER: std::cout << "Source: Other"; break; } std::cout << std::endl; switch (type) { case GL_DEBUG_TYPE_ERROR: std::cout << "Type: Error"; break; case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: std::cout << "Type: Deprecated Behaviour"; break; case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: std::cout << "Type: Undefined Behaviour"; break; case GL_DEBUG_TYPE_PORTABILITY: std::cout << "Type: Portability"; break; case GL_DEBUG_TYPE_PERFORMANCE: std::cout << "Type: Performance"; break; case GL_DEBUG_TYPE_MARKER: std::cout << "Type: Marker"; break; case GL_DEBUG_TYPE_PUSH_GROUP: std::cout << "Type: Push Group"; break; case GL_DEBUG_TYPE_POP_GROUP: std::cout << "Type: Pop Group"; break; case GL_DEBUG_TYPE_OTHER: std::cout << "Type: Other"; break; } std::cout << std::endl; switch (severity) { case GL_DEBUG_SEVERITY_HIGH: std::cout << "Severity: high"; break; case GL_DEBUG_SEVERITY_MEDIUM: std::cout << "Severity: medium"; break; case GL_DEBUG_SEVERITY_LOW: std::cout << "Severity: low"; break; case GL_DEBUG_SEVERITY_NOTIFICATION: std::cout << "Severity: notification"; break; } std::cout << std::endl; std::cout << std::endl; } GLFWwindow* InitGL() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); // comment this line in a release build! //开启多重采样 glfwWindowHint(GLFW_SAMPLES, 4); GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, projName.c_str(), nullptr, nullptr); glfwMakeContextCurrent(window); glfwSetKeyCallback(window, key_callback); glfwSetCursorPosCallback(window, mouse_callback); glfwSetScrollCallback(window, scroll_callback); // GLFW Options glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); glewExperimental = GL_TRUE; glViewport(0, 0, 800, 600); if (glewInit() != GLEW_OK) { std::cout << "failed to initalize glew" << std::endl; return NULL; } return window; } unsigned int quadVAO = 0; unsigned int quadVBO = 0; void RendQuad() { if (quadVAO == 0) { // positions glm::vec3 pos1(-1.0f, 1.0f, 0.0f); glm::vec3 pos2(-1.0f, -1.0f, 0.0f); glm::vec3 pos3(1.0f, -1.0f, 0.0f); glm::vec3 pos4(1.0f, 1.0f, 0.0f); // texture coordinates glm::vec2 uv1(0.0f, 1.0f); glm::vec2 uv2(0.0f, 0.0f); glm::vec2 uv3(1.0f, 0.0f); glm::vec2 uv4(1.0f, 1.0f); // normal vector glm::vec3 nm(0.0f, 0.0f, 1.0f); // calculate tangent/bitangent vectors of both triangles glm::vec3 tangent1, bitangent1; glm::vec3 tangent2, bitangent2; // triangle 1 // ---------- glm::vec3 edge1 = pos2 - pos1; glm::vec3 edge2 = pos3 - pos1; glm::vec2 deltaUV1 = uv2 - uv1; glm::vec2 deltaUV2 = uv3 - uv1; GLfloat f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y); tangent1.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x); tangent1.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y); tangent1.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z); tangent1 = glm::normalize(tangent1); bitangent1.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x); bitangent1.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y); bitangent1.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z); bitangent1 = glm::normalize(bitangent1); // triangle 2 // ---------- edge1 = pos3 - pos1; edge2 = pos4 - pos1; deltaUV1 = uv3 - uv1; deltaUV2 = uv4 - uv1; f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y); tangent2.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x); tangent2.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y); tangent2.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z); tangent2 = glm::normalize(tangent2); bitangent2.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x); bitangent2.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y); bitangent2.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z); bitangent2 = glm::normalize(bitangent2); float quadVertices[] = { // positions // normal // texcoords // tangent // bitangent pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z, pos2.x, pos2.y, pos2.z, nm.x, nm.y, nm.z, uv2.x, uv2.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z, pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z, pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z, pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z, pos4.x, pos4.y, pos4.z, nm.x, nm.y, nm.z, uv4.x, uv4.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z }; glGenVertexArrays(1,&quadVAO); glGenBuffers(1, &quadVBO); glBindVertexArray(quadVAO); glBindBuffer(GL_ARRAY_BUFFER, quadVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)0); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(3 * sizeof(float))); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(6 * sizeof(float))); glEnableVertexAttribArray(3); glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(8 * sizeof(float))); glEnableVertexAttribArray(4); glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(11 * sizeof(float))); } glBindVertexArray(quadVAO); glDrawArrays(GL_TRIANGLES, 0, 6); glBindVertexArray(0); } int main() { GLFWwindow* window = InitGL(); // enable OpenGL debug context if context allows for debug context GLint flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags); if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) { glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); // makes sure errors are displayed synchronously glDebugMessageCallback(glDebugOutput, nullptr); glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); } //把每一个片段着色器的结果 存储在个采样点上 最后对采样点的结果进行平均 glEnable(GL_MULTISAMPLE); unsigned int diffuseMap = GenTexture("../Resources/img/brickwall.jpg"); unsigned int normalMap = GenTexture("../Resources/img/brickwall_normal.jpg"); Shader shader("../022_NormalMap/normalmap.vert", "../022_NormalMap/normalmap.frag"); shader.Use(); shader.setInt("diffuseMap", 0); shader.setInt("normalMap", 1); glm::vec3 lightPos(0.5f, 1.0f, -10.3f); while (!glfwWindowShouldClose(window)) { GLfloat currentFrame = glfwGetTime(); deltaTime = currentFrame - lastFrame; lastFrame = currentFrame; glfwPollEvents(); do_movement(); //first pass glClearColor(0.2f, 0.3f, 0.4f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f); glm::mat4 view = camera.GetViewMatrix(); shader.Use(); shader.setMat("projection", projection); shader.setMat("view", view); glm::mat4 model = glm::mat4(1.0f); model = glm::translate(model, glm::vec3(0, 0, -10.0f)); model = glm::rotate(model, glm::radians((float)glfwGetTime() * -10.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0))); // rotate the quad to show normal mapping from multiple directions shader.setMat("model", model); shader.setVec3("viewPos", camera.Position); shader.setVec3("lightPos", lightPos); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, diffuseMap); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, normalMap); RendQuad(); model = glm::mat4(1.0f); model = glm::translate(model, lightPos); model = glm::scale(model, glm::vec3(0.1f)); shader.setMat("model", model); RendQuad(); glfwSwapBuffers(window); } //glDeleteFramebuffers(1, &fbo); glfwTerminate(); return 0; } #pragma region camera void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GL_TRUE); if (key >= 0 && key < 1024) { if (action == GLFW_PRESS) keys[key] = true; else if (action == GLFW_RELEASE) keys[key] = false; } } void do_movement() { // Camera controls if (keys[GLFW_KEY_S]) camera.ProcessKeyboard(FORWARD, deltaTime); if (keys[GLFW_KEY_W]) camera.ProcessKeyboard(BACKWARD, deltaTime); if (keys[GLFW_KEY_D]) camera.ProcessKeyboard(LEFT, deltaTime); if (keys[GLFW_KEY_A]) camera.ProcessKeyboard(RIGHT, deltaTime); } float mouseMoveFactor = 0.1f; bool firstMouse = true; void mouse_callback(GLFWwindow* window, double xpos, double ypos) { if (firstMouse) { lastX = xpos; lastY = ypos; firstMouse = false; } GLfloat xoffset = xpos - lastX; GLfloat yoffset = lastY - ypos; // Reversed since y-coordinates go from bottom to left lastX = xpos; lastY = ypos; camera.ProcessMouseMovement(xoffset * mouseMoveFactor, yoffset * mouseMoveFactor); } void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { camera.ProcessMouseScroll(yoffset * mouseMoveFactor); } #pragma endregion camera
[ "1462415060@qq.com" ]
1462415060@qq.com
a3695c24a93b3c4a20683c47ac637e1dd9375830
ebced54de3e3610a1ecc1faf0af19adfd85aee9f
/corrections/Flattener.h
bd3ac8f4dbf274b667fa77244abd0ed21670959a
[]
no_license
aperloff/Analysis
820f43584736256a2f53d0526b64792fd84cdebf
34662ca21953f9d1f3803bcc8f08e644b1d9e4fc
refs/heads/master
2021-06-18T12:56:33.273772
2018-05-09T22:22:07
2018-05-09T22:22:07
133,418,991
0
0
null
2018-05-14T20:41:56
2018-05-14T20:41:55
null
UTF-8
C++
false
false
938
h
#ifndef Flattener_H #define Flattener_H #include <TH1.h> #include <TLorentzVector.h> #include <iostream> class Flattener { public: //constructor Flattener() : h_dist(NULL) {} //destructor virtual ~Flattener() {} //accessors void SetDist(TH1* dist){ if(!dist) return; h_dist = (TH1*)dist->Clone(); //make sure normalized h_dist->Scale(1.0/h_dist->Integral(0,h_dist->GetNbinsX()+1)); //invert weights to flatten for(int b = 0; b <= h_dist->GetNbinsX()+1; ++b){ double content = h_dist->GetBinContent(b); double weight = content>0 ? 1.0/content : 0.0; h_dist->SetBinContent(b,weight); } } //function double GetWeight(double qty){ if(!h_dist) return 1.0; return h_dist ? h_dist->GetBinContent(h_dist->GetXaxis()->FindBin(min(qty,h_dist->GetBinLowEdge(h_dist->GetNbinsX())))) : 1.; } //member variables TH1 *h_dist; }; #endif
[ "kpedro88@gmail.com" ]
kpedro88@gmail.com
0395472f5e924af7186a0b4bb077f5a9cec4b176
94117a46bbd26777ed0a8d71896283967b479224
/highlightframe.h
4bf3a1b70c3b080c0aae43227eca35903976e8b7
[]
no_license
zhaoxh16/sudoku
c511bdc8c558c3ffc73860110e85e9d67023656d
89044d80a809b792f21ea2eb4923d1c656f31078
refs/heads/master
2021-01-21T22:34:49.854191
2017-09-02T14:44:21
2017-09-02T14:44:21
102,160,756
0
0
null
null
null
null
UTF-8
C++
false
false
320
h
#ifndef HIGHLIGHTFRAME_H #define HIGHLIGHTFRAME_H #include <QWidget> #include <QPainter> class HighlightFrame : public QWidget { Q_OBJECT public: explicit HighlightFrame(QWidget *parent = nullptr); signals: public slots: protected: void paintEvent(QPaintEvent *event); }; #endif // HIGHLIGHTFRAME_H
[ "zhaoxinhao2012@126.com" ]
zhaoxinhao2012@126.com
a2f965ac094859055a3d4050ae48cc3fde026d3a
9923e30eb99716bfc179ba2bb789dcddc28f45e6
/openapi-generator/cpp-restsdk/model/DispatchRoute.cpp
b8ced93f70618d631423dd73008e30f6d1034892
[]
no_license
silverspace/samsara-sdks
cefcd61458ed3c3753ac5e6bf767229dd8df9485
c054b91e488ab4266f3b3874e9b8e1c9e2d4d5fa
refs/heads/master
2020-04-25T13:16:59.137551
2019-03-01T05:49:05
2019-03-01T05:49:05
172,804,041
2
0
null
null
null
null
UTF-8
C++
false
false
27,748
cpp
/** * Samsara API * # Introduction Samsara provides API endpoints for interacting with Samsara Cloud, so that you can build powerful applications and custom solutions with sensor data. Samsara has endpoints available to track and analyze sensors, vehicles, and entire fleets. The Samsara Cloud API is a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer) accessed by an [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) client such as wget or curl, or HTTP libraries of most modern programming languages including python, ruby, java. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. We allow you to interact securely with our API from a client-side web application (though you should never expose your secret API key). [JSON](http://www.json.org/) is returned by all API responses, including errors. If you’re familiar with what you can build with a REST API, the following API reference guide will be your go-to resource. API access to the Samsara cloud is available to all Samsara administrators. To start developing with Samsara APIs you will need to [obtain your API keys](#section/Authentication) to authenticate your API requests. If you have any questions you can reach out to us on [support@samsara.com](mailto:support@samsara.com) # Endpoints All our APIs can be accessed through HTTP requests to URLs like: ```curl https://api.samsara.com/<version>/<endpoint> ``` All our APIs are [versioned](#section/Versioning). If we intend to make breaking changes to an API which either changes the response format or request parameter, we will increment the version. # Authentication To authenticate your API request you will need to include your secret token. You can manage your API tokens in the [Dashboard](https://cloud.samsara.com). They are visible under `Settings->Organization->API Tokens`. Your API tokens carry many privileges, so be sure to keep them secure. Do not share your secret API tokens in publicly accessible areas such as GitHub, client-side code, and so on. Authentication to the API is performed via [HTTP Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication). Provide your API token as the basic access_token value in the URL. You do not need to provide a password. ```curl https://api.samsara.com/<version>/<endpoint>?access_token={access_token} ``` All API requests must be made over [HTTPS](https://en.wikipedia.org/wiki/HTTPS). Calls made over plain HTTP or without authentication will fail. # Request Methods Our API endpoints use [HTTP request methods](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods) to specify the desired operation to be performed. The documentation below specified request method supported by each endpoint and the resulting action. ## GET GET requests are typically used for fetching data (like data for a particular driver). ## POST POST requests are typically used for creating or updating a record (like adding new tags to the system). With that being said, a few of our POST requests can be used for fetching data (like current location data of your fleet). ## PUT PUT requests are typically used for updating an existing record (like updating all devices associated with a particular tag). ## PATCH PATCH requests are typically used for modifying an existing record (like modifying a few devices associated with a particular tag). ## DELETE DELETE requests are used for deleting a record (like deleting a tag from the system). # Response Codes All API requests will respond with appropriate [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). Your API client should handle each response class differently. ## 2XX These are successful responses and indicate that the API request returned the expected response. ## 4XX These indicate that there was a problem with the request like a missing parameter or invalid values. Check the response for specific [error details](#section/Error-Responses). Requests that respond with a 4XX status code, should be modified before retrying. ## 5XX These indicate server errors when the server is unreachable or is misconfigured. In this case, you should retry the API request after some delay. # Error Responses In case of a 4XX status code, the body of the response will contain information to briefly explain the error reported. To help debugging the error, you can refer to the following table for understanding the error message. | Status Code | Message | Description | |-------------|----------------|-------------------------------------------------------------------| | 401 | Invalid token | The API token is invalid and could not be authenticated. Please refer to the [authentication section](#section/Authentication). | | 404 | Page not found | The API endpoint being accessed is invalid. | | 400 | Bad request | Default response for an invalid request. Please check the request to make sure it follows the format specified in the documentation. | # Versioning All our APIs are versioned. Our current API version is `v1` and we are continuously working on improving it further and provide additional endpoints. If we intend to make breaking changes to an API which either changes the response format or request parameter, we will increment the version. Thus, you can use our current API version worry free. # FAQs Check out our [responses to FAQs here](https://kb.samsara.com/hc/en-us/sections/360000538054-APIs). Don’t see an answer to your question? Reach out to us on [support@samsara.com](mailto:support@samsara.com). * * OpenAPI spec version: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ #include "DispatchRoute.h" namespace org { namespace openapitools { namespace client { namespace model { DispatchRoute::DispatchRoute() { m_Actual_end_ms = 0L; m_Actual_end_msIsSet = false; m_Actual_start_ms = 0L; m_Actual_start_msIsSet = false; m_Driver_id = 0L; m_Driver_idIsSet = false; m_Group_id = 0L; m_Group_idIsSet = false; m_Name = utility::conversions::to_string_t(""); m_Scheduled_end_ms = 0L; m_Scheduled_meters = 0L; m_Scheduled_metersIsSet = false; m_Scheduled_start_ms = 0L; m_Start_location_address = utility::conversions::to_string_t(""); m_Start_location_addressIsSet = false; m_Start_location_address_id = 0L; m_Start_location_address_idIsSet = false; m_Start_location_lat = 0.0; m_Start_location_latIsSet = false; m_Start_location_lng = 0.0; m_Start_location_lngIsSet = false; m_Start_location_name = utility::conversions::to_string_t(""); m_Start_location_nameIsSet = false; m_Trailer_id = 0L; m_Trailer_idIsSet = false; m_Vehicle_id = 0L; m_Vehicle_idIsSet = false; m_Id = 0L; } DispatchRoute::~DispatchRoute() { } void DispatchRoute::validate() { // TODO: implement validation } web::json::value DispatchRoute::toJson() const { web::json::value val = web::json::value::object(); if(m_Actual_end_msIsSet) { val[utility::conversions::to_string_t("actual_end_ms")] = ModelBase::toJson(m_Actual_end_ms); } if(m_Actual_start_msIsSet) { val[utility::conversions::to_string_t("actual_start_ms")] = ModelBase::toJson(m_Actual_start_ms); } if(m_Driver_idIsSet) { val[utility::conversions::to_string_t("driver_id")] = ModelBase::toJson(m_Driver_id); } if(m_Group_idIsSet) { val[utility::conversions::to_string_t("group_id")] = ModelBase::toJson(m_Group_id); } val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name); val[utility::conversions::to_string_t("scheduled_end_ms")] = ModelBase::toJson(m_Scheduled_end_ms); if(m_Scheduled_metersIsSet) { val[utility::conversions::to_string_t("scheduled_meters")] = ModelBase::toJson(m_Scheduled_meters); } val[utility::conversions::to_string_t("scheduled_start_ms")] = ModelBase::toJson(m_Scheduled_start_ms); if(m_Start_location_addressIsSet) { val[utility::conversions::to_string_t("start_location_address")] = ModelBase::toJson(m_Start_location_address); } if(m_Start_location_address_idIsSet) { val[utility::conversions::to_string_t("start_location_address_id")] = ModelBase::toJson(m_Start_location_address_id); } if(m_Start_location_latIsSet) { val[utility::conversions::to_string_t("start_location_lat")] = ModelBase::toJson(m_Start_location_lat); } if(m_Start_location_lngIsSet) { val[utility::conversions::to_string_t("start_location_lng")] = ModelBase::toJson(m_Start_location_lng); } if(m_Start_location_nameIsSet) { val[utility::conversions::to_string_t("start_location_name")] = ModelBase::toJson(m_Start_location_name); } if(m_Trailer_idIsSet) { val[utility::conversions::to_string_t("trailer_id")] = ModelBase::toJson(m_Trailer_id); } if(m_Vehicle_idIsSet) { val[utility::conversions::to_string_t("vehicle_id")] = ModelBase::toJson(m_Vehicle_id); } { std::vector<web::json::value> jsonArray; for( auto& item : m_Dispatch_jobs ) { jsonArray.push_back(ModelBase::toJson(item)); } val[utility::conversions::to_string_t("dispatch_jobs")] = web::json::value::array(jsonArray); } val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id); return val; } void DispatchRoute::fromJson(const web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("actual_end_ms"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("actual_end_ms")); if(!fieldValue.is_null()) { setActualEndMs(ModelBase::int64_tFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("actual_start_ms"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("actual_start_ms")); if(!fieldValue.is_null()) { setActualStartMs(ModelBase::int64_tFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("driver_id"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("driver_id")); if(!fieldValue.is_null()) { setDriverId(ModelBase::int64_tFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("group_id"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("group_id")); if(!fieldValue.is_null()) { setGroupId(ModelBase::int64_tFromJson(fieldValue)); } } setName(ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("name")))); setScheduledEndMs(ModelBase::int64_tFromJson(val.at(utility::conversions::to_string_t("scheduled_end_ms")))); if(val.has_field(utility::conversions::to_string_t("scheduled_meters"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("scheduled_meters")); if(!fieldValue.is_null()) { setScheduledMeters(ModelBase::int64_tFromJson(fieldValue)); } } setScheduledStartMs(ModelBase::int64_tFromJson(val.at(utility::conversions::to_string_t("scheduled_start_ms")))); if(val.has_field(utility::conversions::to_string_t("start_location_address"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("start_location_address")); if(!fieldValue.is_null()) { setStartLocationAddress(ModelBase::stringFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("start_location_address_id"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("start_location_address_id")); if(!fieldValue.is_null()) { setStartLocationAddressId(ModelBase::int64_tFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("start_location_lat"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("start_location_lat")); if(!fieldValue.is_null()) { setStartLocationLat(ModelBase::doubleFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("start_location_lng"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("start_location_lng")); if(!fieldValue.is_null()) { setStartLocationLng(ModelBase::doubleFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("start_location_name"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("start_location_name")); if(!fieldValue.is_null()) { setStartLocationName(ModelBase::stringFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("trailer_id"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("trailer_id")); if(!fieldValue.is_null()) { setTrailerId(ModelBase::int64_tFromJson(fieldValue)); } } if(val.has_field(utility::conversions::to_string_t("vehicle_id"))) { const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("vehicle_id")); if(!fieldValue.is_null()) { setVehicleId(ModelBase::int64_tFromJson(fieldValue)); } } { m_Dispatch_jobs.clear(); std::vector<web::json::value> jsonArray; for( auto& item : val.at(utility::conversions::to_string_t("dispatch_jobs")).as_array() ) { if(item.is_null()) { m_Dispatch_jobs.push_back( std::shared_ptr<DispatchJob>(nullptr) ); } else { std::shared_ptr<DispatchJob> newItem(new DispatchJob()); newItem->fromJson(item); m_Dispatch_jobs.push_back( newItem ); } } } setId(ModelBase::int64_tFromJson(val.at(utility::conversions::to_string_t("id")))); } void DispatchRoute::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) { namePrefix += utility::conversions::to_string_t("."); } if(m_Actual_end_msIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("actual_end_ms"), m_Actual_end_ms)); } if(m_Actual_start_msIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("actual_start_ms"), m_Actual_start_ms)); } if(m_Driver_idIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("driver_id"), m_Driver_id)); } if(m_Group_idIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("group_id"), m_Group_id)); } multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name)); multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("scheduled_end_ms"), m_Scheduled_end_ms)); if(m_Scheduled_metersIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("scheduled_meters"), m_Scheduled_meters)); } multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("scheduled_start_ms"), m_Scheduled_start_ms)); if(m_Start_location_addressIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("start_location_address"), m_Start_location_address)); } if(m_Start_location_address_idIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("start_location_address_id"), m_Start_location_address_id)); } if(m_Start_location_latIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("start_location_lat"), m_Start_location_lat)); } if(m_Start_location_lngIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("start_location_lng"), m_Start_location_lng)); } if(m_Start_location_nameIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("start_location_name"), m_Start_location_name)); } if(m_Trailer_idIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("trailer_id"), m_Trailer_id)); } if(m_Vehicle_idIsSet) { multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("vehicle_id"), m_Vehicle_id)); } { std::vector<web::json::value> jsonArray; for( auto& item : m_Dispatch_jobs ) { jsonArray.push_back(ModelBase::toJson(item)); } multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("dispatch_jobs"), web::json::value::array(jsonArray), utility::conversions::to_string_t("application/json"))); } multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id)); } void DispatchRoute::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) { utility::string_t namePrefix = prefix; if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) { namePrefix += utility::conversions::to_string_t("."); } if(multipart->hasContent(utility::conversions::to_string_t("actual_end_ms"))) { setActualEndMs(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("actual_end_ms")))); } if(multipart->hasContent(utility::conversions::to_string_t("actual_start_ms"))) { setActualStartMs(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("actual_start_ms")))); } if(multipart->hasContent(utility::conversions::to_string_t("driver_id"))) { setDriverId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("driver_id")))); } if(multipart->hasContent(utility::conversions::to_string_t("group_id"))) { setGroupId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("group_id")))); } setName(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")))); setScheduledEndMs(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("scheduled_end_ms")))); if(multipart->hasContent(utility::conversions::to_string_t("scheduled_meters"))) { setScheduledMeters(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("scheduled_meters")))); } setScheduledStartMs(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("scheduled_start_ms")))); if(multipart->hasContent(utility::conversions::to_string_t("start_location_address"))) { setStartLocationAddress(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("start_location_address")))); } if(multipart->hasContent(utility::conversions::to_string_t("start_location_address_id"))) { setStartLocationAddressId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("start_location_address_id")))); } if(multipart->hasContent(utility::conversions::to_string_t("start_location_lat"))) { setStartLocationLat(ModelBase::doubleFromHttpContent(multipart->getContent(utility::conversions::to_string_t("start_location_lat")))); } if(multipart->hasContent(utility::conversions::to_string_t("start_location_lng"))) { setStartLocationLng(ModelBase::doubleFromHttpContent(multipart->getContent(utility::conversions::to_string_t("start_location_lng")))); } if(multipart->hasContent(utility::conversions::to_string_t("start_location_name"))) { setStartLocationName(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("start_location_name")))); } if(multipart->hasContent(utility::conversions::to_string_t("trailer_id"))) { setTrailerId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("trailer_id")))); } if(multipart->hasContent(utility::conversions::to_string_t("vehicle_id"))) { setVehicleId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("vehicle_id")))); } { m_Dispatch_jobs.clear(); web::json::value jsonArray = web::json::value::parse(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("dispatch_jobs")))); for( auto& item : jsonArray.as_array() ) { if(item.is_null()) { m_Dispatch_jobs.push_back( std::shared_ptr<DispatchJob>(nullptr) ); } else { std::shared_ptr<DispatchJob> newItem(new DispatchJob()); newItem->fromJson(item); m_Dispatch_jobs.push_back( newItem ); } } } setId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")))); } int64_t DispatchRoute::getActualEndMs() const { return m_Actual_end_ms; } void DispatchRoute::setActualEndMs(int64_t value) { m_Actual_end_ms = value; m_Actual_end_msIsSet = true; } bool DispatchRoute::actualEndMsIsSet() const { return m_Actual_end_msIsSet; } void DispatchRoute::unsetActual_end_ms() { m_Actual_end_msIsSet = false; } int64_t DispatchRoute::getActualStartMs() const { return m_Actual_start_ms; } void DispatchRoute::setActualStartMs(int64_t value) { m_Actual_start_ms = value; m_Actual_start_msIsSet = true; } bool DispatchRoute::actualStartMsIsSet() const { return m_Actual_start_msIsSet; } void DispatchRoute::unsetActual_start_ms() { m_Actual_start_msIsSet = false; } int64_t DispatchRoute::getDriverId() const { return m_Driver_id; } void DispatchRoute::setDriverId(int64_t value) { m_Driver_id = value; m_Driver_idIsSet = true; } bool DispatchRoute::driverIdIsSet() const { return m_Driver_idIsSet; } void DispatchRoute::unsetDriver_id() { m_Driver_idIsSet = false; } int64_t DispatchRoute::getGroupId() const { return m_Group_id; } void DispatchRoute::setGroupId(int64_t value) { m_Group_id = value; m_Group_idIsSet = true; } bool DispatchRoute::groupIdIsSet() const { return m_Group_idIsSet; } void DispatchRoute::unsetGroup_id() { m_Group_idIsSet = false; } utility::string_t DispatchRoute::getName() const { return m_Name; } void DispatchRoute::setName(const utility::string_t& value) { m_Name = value; } int64_t DispatchRoute::getScheduledEndMs() const { return m_Scheduled_end_ms; } void DispatchRoute::setScheduledEndMs(int64_t value) { m_Scheduled_end_ms = value; } int64_t DispatchRoute::getScheduledMeters() const { return m_Scheduled_meters; } void DispatchRoute::setScheduledMeters(int64_t value) { m_Scheduled_meters = value; m_Scheduled_metersIsSet = true; } bool DispatchRoute::scheduledMetersIsSet() const { return m_Scheduled_metersIsSet; } void DispatchRoute::unsetScheduled_meters() { m_Scheduled_metersIsSet = false; } int64_t DispatchRoute::getScheduledStartMs() const { return m_Scheduled_start_ms; } void DispatchRoute::setScheduledStartMs(int64_t value) { m_Scheduled_start_ms = value; } utility::string_t DispatchRoute::getStartLocationAddress() const { return m_Start_location_address; } void DispatchRoute::setStartLocationAddress(const utility::string_t& value) { m_Start_location_address = value; m_Start_location_addressIsSet = true; } bool DispatchRoute::startLocationAddressIsSet() const { return m_Start_location_addressIsSet; } void DispatchRoute::unsetStart_location_address() { m_Start_location_addressIsSet = false; } int64_t DispatchRoute::getStartLocationAddressId() const { return m_Start_location_address_id; } void DispatchRoute::setStartLocationAddressId(int64_t value) { m_Start_location_address_id = value; m_Start_location_address_idIsSet = true; } bool DispatchRoute::startLocationAddressIdIsSet() const { return m_Start_location_address_idIsSet; } void DispatchRoute::unsetStart_location_address_id() { m_Start_location_address_idIsSet = false; } double DispatchRoute::getStartLocationLat() const { return m_Start_location_lat; } void DispatchRoute::setStartLocationLat(double value) { m_Start_location_lat = value; m_Start_location_latIsSet = true; } bool DispatchRoute::startLocationLatIsSet() const { return m_Start_location_latIsSet; } void DispatchRoute::unsetStart_location_lat() { m_Start_location_latIsSet = false; } double DispatchRoute::getStartLocationLng() const { return m_Start_location_lng; } void DispatchRoute::setStartLocationLng(double value) { m_Start_location_lng = value; m_Start_location_lngIsSet = true; } bool DispatchRoute::startLocationLngIsSet() const { return m_Start_location_lngIsSet; } void DispatchRoute::unsetStart_location_lng() { m_Start_location_lngIsSet = false; } utility::string_t DispatchRoute::getStartLocationName() const { return m_Start_location_name; } void DispatchRoute::setStartLocationName(const utility::string_t& value) { m_Start_location_name = value; m_Start_location_nameIsSet = true; } bool DispatchRoute::startLocationNameIsSet() const { return m_Start_location_nameIsSet; } void DispatchRoute::unsetStart_location_name() { m_Start_location_nameIsSet = false; } int64_t DispatchRoute::getTrailerId() const { return m_Trailer_id; } void DispatchRoute::setTrailerId(int64_t value) { m_Trailer_id = value; m_Trailer_idIsSet = true; } bool DispatchRoute::trailerIdIsSet() const { return m_Trailer_idIsSet; } void DispatchRoute::unsetTrailer_id() { m_Trailer_idIsSet = false; } int64_t DispatchRoute::getVehicleId() const { return m_Vehicle_id; } void DispatchRoute::setVehicleId(int64_t value) { m_Vehicle_id = value; m_Vehicle_idIsSet = true; } bool DispatchRoute::vehicleIdIsSet() const { return m_Vehicle_idIsSet; } void DispatchRoute::unsetVehicle_id() { m_Vehicle_idIsSet = false; } std::vector<std::shared_ptr<DispatchJob>>& DispatchRoute::getDispatchJobs() { return m_Dispatch_jobs; } void DispatchRoute::setDispatchJobs(const std::vector<std::shared_ptr<DispatchJob>>& value) { m_Dispatch_jobs = value; } int64_t DispatchRoute::getId() const { return m_Id; } void DispatchRoute::setId(int64_t value) { m_Id = value; } } } } }
[ "greg@samsara.com" ]
greg@samsara.com
f07e96938de90f0be1fe02ef92fc4a34a23772df
f250d530c51db1fb261747a0ef1c915d238bfc64
/include/wrapvalue.h
0a98cfc37b83274111848811f4a4d36071c268be
[ "MIT" ]
permissive
mamontov-cpp/dukpp-03
30281b4db4f9e3c51dd2e85f9ceea334e94815e7
052d97fecfe6684fcdb47f3dcd61dbc63e401385
refs/heads/master
2022-01-20T22:52:23.139045
2021-12-29T23:27:15
2021-12-29T23:27:15
67,593,550
2
0
MIT
2020-04-04T10:19:36
2016-09-07T09:41:15
C
UTF-8
C++
false
false
505
h
/*! \file wrapvalue.h Defines a generic interface for wrapping value */ #pragma once namespace dukpp03 { /*! A wrapper for wrapping value for specified context */ struct WrapValue { /*! Performs wrapping value for specified variant \param[in] context a context \param[in] variant a specified variant \param[in] wrapped was a value wrapped by generic binding previously */ inline static void perform(void* context, void* variant, bool wrapped) { // Does nothing } }; }
[ "mamontov.dp@gmail.com" ]
mamontov.dp@gmail.com
3e83c168bd5945642c8fdbbe0ffca15944340f98
dd129fb6461d1b44dceb196caaa220e9f8398d18
/unittests/work-queue-suite.cc
ffcbeaeb160379a3616bd624d36238b626d5bbfb
[]
no_license
jfasch/jf-linux-trainings
3af777b4c603dd5c3f6832c0034be44a062b493a
aebff2e6e0f98680aa14e1b7ad4a22e73a6f31b4
refs/heads/master
2020-04-29T19:13:33.398276
2020-03-29T20:45:33
2020-03-29T20:45:33
176,347,614
0
1
null
2019-10-01T06:02:49
2019-03-18T18:35:28
C++
UTF-8
C++
false
false
863
cc
#include <jf/work-queue.h> #include <jf/tid.h> #include <boost/test/unit_test.hpp> #include <atomic> #include <chrono> #include <thread> using namespace std::chrono_literals; namespace { BOOST_AUTO_TEST_SUITE(WorkQueueSuite) BOOST_AUTO_TEST_CASE(basic) { jf::WorkQueue wq; std::atomic<std::thread::id> wq_id; auto work = [&wq_id](){ wq_id = std::this_thread::get_id(); }; wq.enqueue(work); // spin until work done (no, this is not a real life use case :-) size_t num_spins = 100; while (wq_id == std::thread::id() && --num_spins) std::this_thread::sleep_for(50ms); BOOST_REQUIRE_NE(wq_id, std::thread::id()/*default ctor*/); // verify that work was done in a different thread BOOST_REQUIRE_NE(wq_id, std::this_thread::get_id()); BOOST_REQUIRE_EQUAL(wq_id, wq.id()); } BOOST_AUTO_TEST_SUITE_END() }
[ "jf@faschingbauer.co.at" ]
jf@faschingbauer.co.at
d91e66833ec63b568c4c5e83f52e4adbd4b0eb91
b36a8a5ae45d371f26c1382a7d643002a42a7167
/512.cpp
cf5e2ea9da661d24167fb9e0fe5ec10604606c06
[]
no_license
zhongzebin/find-required-loops-in-digraph
410e66952220170d428553834f771cfd7ca369a8
cb236f95dcb339853e662caa987a2f0f6f558846
refs/heads/master
2022-12-02T02:11:39.748324
2020-08-14T07:14:57
2020-08-14T07:14:57
286,699,857
1
0
null
null
null
null
GB18030
C++
false
false
18,210
cpp
#include <bits/stdc++.h> #include<sys/mman.h> #include<sys/types.h> #include<fcntl.h> #include<unistd.h> #include <sys/stat.h> using namespace std; vector<int> EW[500000][4]; vector<int> EWinv[500000][4]; vector<unsigned int> EW_money[500000][4]; vector<unsigned int> EWinv_money[500000][4]; vector<int> EWt[500000]; vector<int> EWinvt[500000]; vector<unsigned int> EW_moneyt[500000]; vector<unsigned int> EWinv_moneyt[500000]; string idsComma[500000]; string idsLF[500000]; int ans3[4][3 * 20000000]; int ans4[4][4 * 20000000]; int ans5[4][5 * 20000000]; int ans6[4][6 * 20000000]; int ans7[4][7 * 20000000]; int r[5][4]={0}; unsigned int inputs[2000000 * 3]; unsigned int tempG[2000000*2]; int c = 0; unsigned int pre_money[4][7]; bool marked[4][500000] = { false }; int pure[4][500000]; unsigned int pure_money[4][500000]; void GetDataOpt(string &testFile,unsigned int* inputs,unsigned int* tempG,int* c) { int fd = open(testFile.c_str(), O_RDONLY); int len = lseek(fd, 0, SEEK_END); char* p = (char*)mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0); int i = 0; unsigned int u; char temp[10]; char tempCount=0; int c_i=len/sizeof(char); int temp_max=0; while (i<c_i) { for(int ii=0;ii<2;ii++) { while(p[i] != ',') { temp[tempCount]=p[i]-'0'; tempCount++; i++; } unsigned int multi = 1; u = 0; for (int k = tempCount - 1; k >= 0; k--) { u += temp[k] * multi; multi *= 10; } tempCount=0; inputs[*c] = u; tempG[*c/3*2+ii] = u; if(temp_max<*c/3*2+ii) temp_max=*c/3*2+ii; //(*tempG).emplace_back(u); (*c)++; i++; } while(p[i]!='\n') { temp[tempCount]=p[i]-'0'; tempCount++; i++; } unsigned int multi = 1; u = 0; int k; k=tempCount-2; for (; k >= 0; k--) { u += temp[k] * multi; multi *= 10; } tempCount=0; inputs[*c] = u; (*c)++; i++; } //cout<<"max:"<<temp_max<<endl; //cout<<"c:"<<*c<<endl; munmap(p, len); close(fd); } string uto_string(unsigned int a) { string ans=""; if(a==0) return "0"; char temp[10]; int i=0; while(a) { temp[i]=a%10; a=a/10; i++; } for(int k=i-1;k>=0;k--) ans+=temp[k]+'0'; return ans; } struct graph_thread{ vector<int> (*EW)[4]; vector<unsigned int> (*EW_money)[4]; vector<int> (*EWinv)[4]; vector<unsigned int> (*EWinv_money)[4]; unordered_map<unsigned int,int> hash_int_id; char threadNo; int end; int begin; unsigned int* inputs; }; void *make_graph(void *arg) { struct graph_thread *a; a=(struct graph_thread*) arg; char threadNo=a->threadNo; for (int i = a->begin; i < a->end; i += 3) { int u = a->hash_int_id[a->inputs[i]], v = a->hash_int_id[a->inputs[i + 1]]; unsigned int m=a->inputs[i + 2]; EW[u][threadNo].emplace_back(v); EWinv[v][threadNo].emplace_back(u);//反向图 EW_money[u][threadNo].emplace_back(m); EWinv_money[v][threadNo].emplace_back(m); //if(idsComma[u]=="587," && idsComma[v]=="293,") cout<<idsComma[EWinv[v][0]]<<EWinv_money[v][0]<<endl; } } void Graph(vector<int> (*EW)[4],vector<unsigned int> (*EW_money)[4],vector<int> (*EWinv)[4],vector<unsigned int> (*EWinv_money)[4],string* idsComma,string* idsLF,int* node_count,int c,unsigned int* inputs,unsigned int* tempG) { sort(tempG,tempG+c/3*2); bool flag=true; unsigned int tG = 0; unordered_map<unsigned int,int> hash_int_id; for (int i = 0; i<c/3*2; i++) { if (tempG[i] != tG || flag) { idsComma[*node_count] = uto_string(tempG[i]) + ','; idsLF[*node_count] = uto_string(tempG[i]) + '\n'; hash_int_id[tempG[i]] = (*node_count)++; tG = tempG[i]; flag=false; } } struct graph_thread a0,a1,a2,a3; a0.EW=EW;a0.EW_money=EW_money;a0.EWinv=EWinv;a0.EWinv_money=EWinv_money;a0.hash_int_id=hash_int_id;a0.inputs=inputs;a0.threadNo=0;a0.begin=0;a0.end=c/4/3*3; a1.EW=EW;a1.EW_money=EW_money;a1.EWinv=EWinv;a1.EWinv_money=EWinv_money;a1.hash_int_id=hash_int_id;a1.inputs=inputs;a1.threadNo=1;a1.begin=c/4/3*3;a1.end=c/2/3*3; a2.EW=EW;a2.EW_money=EW_money;a2.EWinv=EWinv;a2.EWinv_money=EWinv_money;a2.hash_int_id=hash_int_id;a2.inputs=inputs;a2.threadNo=2;a2.begin=c/2/3*3;a2.end=c/4*3; a3.EW=EW;a3.EW_money=EW_money;a3.EWinv=EWinv;a3.EWinv_money=EWinv_money;a3.hash_int_id=hash_int_id;a3.inputs=inputs;a3.threadNo=3;a3.begin=c/4*3;a3.end=c; pthread_t first,second,third,forth; pthread_create(&first,NULL,make_graph,(void*)&a0); pthread_create(&second,NULL,make_graph,(void*)&a1); pthread_create(&third,NULL,make_graph,(void*)&a2); pthread_create(&forth,NULL,make_graph,(void*)&a3); pthread_join(first,NULL); pthread_join(second,NULL); pthread_join(third,NULL); pthread_join(forth,NULL); } void quickSort2(int left, int right,vector<int>* i,vector<unsigned int>* mi) { if (left < right) { int pivot = (*i)[left]; unsigned int pivot_m=(*mi)[left]; int low = left, high = right; while (low < high) { while (low<high && (*i)[high]>=pivot) high--; (*i)[low] = (*i)[high]; (*mi)[low]=(*mi)[high]; while (low<high && pivot>=(*i)[low]) low++; (*i)[high] = (*i)[low]; (*mi)[high]=(*mi)[low]; } (*i)[low] = pivot; (*mi)[low]=pivot_m; quickSort2(left, low - 1,i,mi); quickSort2(low + 1, right,i,mi); } } struct topothread{ int begin; int end; vector<int> (*EW)[4]; vector<int> (*EWinv)[4]; vector<unsigned int> (*EW_money)[4]; vector<unsigned int> (*EWinv_money)[4]; vector<int>* EWt; vector<int>* EWinvt; vector<unsigned int>* EW_moneyt; vector<unsigned int>* EWinv_moneyt; }; void *topoSort1(void *arg) { struct topothread *a; a=(struct topothread*) arg; for (int i = a->begin; i < a->end; i++) { a->EWinvt[i].insert(a->EWinvt[i].end(),a->EWinv[i][0].begin(),a->EWinv[i][0].end()); a->EWinvt[i].insert(a->EWinvt[i].end(),a->EWinv[i][1].begin(),a->EWinv[i][1].end()); a->EWinvt[i].insert(a->EWinvt[i].end(),a->EWinv[i][2].begin(),a->EWinv[i][2].end()); a->EWinvt[i].insert(a->EWinvt[i].end(),a->EWinv[i][3].begin(),a->EWinv[i][3].end()); a->EWt[i].insert(a->EWt[i].end(),a->EW[i][0].begin(),a->EW[i][0].end()); a->EWt[i].insert(a->EWt[i].end(),a->EW[i][1].begin(),a->EW[i][1].end()); a->EWt[i].insert(a->EWt[i].end(),a->EW[i][2].begin(),a->EW[i][2].end()); a->EWt[i].insert(a->EWt[i].end(),a->EW[i][3].begin(),a->EW[i][3].end()); a->EWinv_moneyt[i].insert(a->EWinv_moneyt[i].end(),a->EWinv_money[i][0].begin(),a->EWinv_money[i][0].end()); a->EWinv_moneyt[i].insert(a->EWinv_moneyt[i].end(),a->EWinv_money[i][1].begin(),a->EWinv_money[i][1].end()); a->EWinv_moneyt[i].insert(a->EWinv_moneyt[i].end(),a->EWinv_money[i][2].begin(),a->EWinv_money[i][2].end()); a->EWinv_moneyt[i].insert(a->EWinv_moneyt[i].end(),a->EWinv_money[i][3].begin(),a->EWinv_money[i][3].end()); a->EW_moneyt[i].insert(a->EW_moneyt[i].end(),a->EW_money[i][0].begin(),a->EW_money[i][0].end()); a->EW_moneyt[i].insert(a->EW_moneyt[i].end(),a->EW_money[i][1].begin(),a->EW_money[i][1].end()); a->EW_moneyt[i].insert(a->EW_moneyt[i].end(),a->EW_money[i][2].begin(),a->EW_money[i][2].end()); a->EW_moneyt[i].insert(a->EW_moneyt[i].end(),a->EW_money[i][3].begin(),a->EW_money[i][3].end()); int size0=EWinvt[i].size(),size1=EWt[i].size(); if (size0 != 0) { quickSort2(0, size0-1,&(a->EWinvt[i]),&(a->EWinv_moneyt[i])); } if (size1 != 0) { quickSort2(0, size1-1,&(a->EWt[i]),&(a->EW_moneyt[i])); } } } struct solvethread{ int begin; int end; vector<int>* EWinv; vector<unsigned int>* EWinv_money; vector<int>* EW; vector<unsigned int>* EW_money; int* res_count; unsigned int (*pre_money)[7]; unsigned int (*pure_money)[500000]; int (*pure)[500000]; bool (*marked)[500000]; int (*ans3)[3 * 20000000]; int (*ans4)[4 * 20000000]; int (*ans5)[5 * 20000000]; int (*ans6)[6 * 20000000]; int (*ans7)[7 * 20000000]; int (*r)[4]; char threadNo; }; void dfs(int k,int* loop,bool* marked,int* thread_pure,unsigned int* thread_money,int loopCount,vector<int>* EW,vector<unsigned int>* EW_money,int p_o,int* res_count,unsigned int* thread_pre,int (*ans3)[3 * 20000000],int (*ans4)[4 * 20000000],int (*ans5)[5 * 20000000],int (*ans6)[6 * 20000000],int (*ans7)[7 * 20000000],char threadNo,int (*r)[4]) { vector<int> ewCur = EW[k]; for (int it=0; it < ewCur.size(); it++) { int v = ewCur[it]; if (v < p_o) continue; //if(idsComma[v]=="25699," && pure[v]==-2) {cout<<pure_money[v]<<endl;cout<<EW_money[k][it]<<endl;} double t1=thread_money[v]; double t2=EW_money[k][it]; double c1=t1/t2; double c2=thread_pre[0]/t1; double c3=t2/thread_pre[loopCount-2]; if (thread_pure[v] == -2 && !marked[v] && c1>=0.2 && c1<=3 && c2>=0.2 && c2<=3 && c3>=0.2 && c3<=3) {//探索最后一个节点v loop[loopCount]=v; loopCount++; if(loopCount>2){ int loop_index=loopCount-3; for (int i = 0; i < loopCount; i++) { //cout<<idsComma[loop[i]]; switch(loop_index) { case 0: ans3[threadNo][r[0][threadNo]]=loop[i]; r[0][threadNo]++; break; case 1: ans4[threadNo][r[1][threadNo]]=loop[i]; r[1][threadNo]++; break; case 2: ans5[threadNo][r[2][threadNo]]=loop[i]; r[2][threadNo]++; break; case 3: ans6[threadNo][r[3][threadNo]]=loop[i]; r[3][threadNo]++; break; case 4: ans7[threadNo][r[4][threadNo]]=loop[i]; r[4][threadNo]++; break; } } //cout<<endl; (*res_count)++; } loopCount--; } if (marked[v] || (thread_pure[v] != p_o && thread_pure[v]!= -2)) continue; if (loopCount == 6 || v == p_o) continue; if(loopCount==1) thread_pre[0]=t2; else if(c3<0.2 || c3>3) continue; else thread_pre[loopCount-1]=t2; marked[v] = true; loop[loopCount]=v; dfs(v,loop,marked,thread_pure,thread_money,loopCount+1,EW,EW_money,p_o,res_count,thread_pre,ans3,ans4,ans5,ans6,ans7,threadNo,r); marked[v] = false; } } // 3邻域剪枝思路:如果将图看作是无向图,一个点数为7的环中,距离起点最远的点距离不超过3 void dfspure(int k, int range,int p_o,vector<int>* EW,int* pure,bool* marked) { vector<int> ewCur = EW[k]; for (int it = 0; it < ewCur.size(); it++) { int temp=ewCur[it]; if (temp < p_o || marked[temp]) continue; pure[temp] = p_o; if (range == 3) continue; marked[temp] = true; dfspure(temp, range + 1,p_o,EW,pure,marked); marked[temp] = false; } } void dfspure1(int k, int range,int p_o,vector<int>* EWinv,int* pure,bool* marked) { vector<int> ewCur = EWinv[k]; for (int it = 0; it < ewCur.size(); it++) { int temp=ewCur[it]; if (temp < p_o || marked[temp]) continue; pure[temp] = p_o; if (range == 3) continue; marked[temp] = true; dfspure1(temp, range + 1,p_o,EWinv,pure,marked); marked[temp] = false; } } void *solve(void *arg) { struct solvethread *a; a=(struct solvethread*) arg; int loop[7]; char loopCount=0; char threadNo=a->threadNo; unsigned int* thread_money=a->pure_money[threadNo]; unsigned int* thread_pre=a->pre_money[threadNo]; int* thread_pure=a->pure[threadNo]; bool* thread_marked=a->marked[threadNo]; for (int i = a->begin; i < a->end; i++) { //if(i%100==0) //cout<<i<<"/"<<node_count<<endl; vector<int> temp=a->EWinv[i]; vector<unsigned int> temp_money=a->EWinv_money[i]; dfspure(i, 1,i,a->EW,thread_pure,thread_marked); dfspure1(i, 1,i,a->EWinv,thread_pure,thread_marked); for (int j = 0; j < temp.size(); j++) { int temp_index=temp[j]; thread_pure[temp_index] = -2; thread_money[temp_index]=temp_money[j]; //if(idsComma[i]=="293,") cout<<j<<' '<<temp_money[j]<<' '<<idsLF[temp[j]]; } loop[loopCount]=i; loopCount++; dfs(i,loop,thread_marked,thread_pure,thread_money,loopCount,a->EW,a->EW_money,i,&(a->res_count[threadNo]),thread_pre,a->ans3,a->ans4,a->ans5,a->ans6,a->ans7,threadNo,a->r); loopCount--; for (int j = 0; j < temp.size(); j++) { thread_pure[temp[j]] = i; } } } void save(string &outputFile,string* idsComma,string* idsLF,int* res_count,int (*ans3)[3 * 20000000],int (*ans4)[4 * 20000000],int (*ans5)[5 * 20000000],int (*ans6)[6 * 20000000],int (*ans7)[7 * 20000000],int (*r)[4]) { int total=res_count[0]+res_count[1]+res_count[2]+res_count[3]; //printf("Total Loops %d\n", total); FILE* fp; fp = fopen(outputFile.c_str(), "w"); char F[10]; int cnt = 0; while (total > 0) { F[cnt++] = total % 10 + '0'; total /= 10; } while (cnt > 0) fwrite(&F[--cnt], sizeof(char), 1, fp); char h = '\n', z = '0', d = ','; fwrite(&h, sizeof(char), 1, fp); for(int i=0;i<4;i++) for (int j = 0; j < r[0][i]/3; j++) { for (int k = 0; k < 2; k++) { auto idres = idsComma[ans3[i][j * 3 + k]]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } int ii=ans3[i][j * 3 + 2]; auto idres = idsLF[ii]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } for(int i=0;i<4;i++) for (int j = 0; j < r[1][i]/4; j++) { for (int k = 0; k < 3; k++) { auto idres = idsComma[ans4[i][j * 4 + k]]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } int ii=ans4[i][j * 4 + 3]; auto idres = idsLF[ii]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } for(int i=0;i<4;i++) for (int j = 0; j < r[2][i]/5; j++) { for (int k = 0; k < 4; k++) { auto idres = idsComma[ans5[i][j * 5 + k]]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } int ii=ans5[i][j * 5 + 4]; auto idres = idsLF[ii]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } for(int i=0;i<4;i++) for (int j = 0; j < r[3][i]/6; j++) { for (int k = 0; k < 5; k++) { auto idres = idsComma[ans6[i][j * 6 + k]]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } int ii=ans6[i][j * 6 + 5]; auto idres = idsLF[ii]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } for(int i=0;i<4;i++) for (int j = 0; j < r[4][i]/7; j++) { for (int k = 0; k < 6; k++) { auto idres = idsComma[ans7[i][j * 7 + k]]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } int ii=ans7[i][j * 7 + 6]; auto idres = idsLF[ii]; fwrite(idres.c_str(), idres.size(), sizeof(char), fp); } } int main() { int node_count=0; string testFile = "/data/test_data.txt"; string outputFile = "/projects/student/result.txt"; int res_count[4]={0}; //auto t = clock(), org = clock(); //cout<<"begin"<<endl; GetDataOpt(testFile,inputs,tempG,&c); //cout << "parseInput time:" << double(clock() - t) / CLOCKS_PER_SEC << endl; //t = clock(); Graph(EW,EW_money,EWinv,EWinv_money,idsComma,idsLF,&node_count,c,inputs,tempG); //cout<<"graph time:" << double(clock() - t) / CLOCKS_PER_SEC << endl; //cout<<"node:"<<node_count<<endl; //t=clock(); struct topothread a0,a1,a2,a3; a0.begin=0;a0.end=node_count/4;a0.EW=EW;a0.EWinv=EWinv;a0.EW_money=EW_money;a0.EWinv_money=EWinv_money;a0.EWt=EWt;a0.EWinvt=EWinvt;a0.EW_moneyt=EW_moneyt;a0.EWinv_moneyt=EWinv_moneyt; a1.begin=node_count/4;a1.end=node_count/2;a1.EW=EW;a1.EWinv=EWinv;a1.EW_money=EW_money;a1.EWinv_money=EWinv_money;a1.EWt=EWt;a1.EWinvt=EWinvt;a1.EW_moneyt=EW_moneyt;a1.EWinv_moneyt=EWinv_moneyt; a2.begin=node_count/2;a2.end=node_count/4*3;a2.EW=EW;a2.EWinv=EWinv;a2.EW_money=EW_money;a2.EWinv_money=EWinv_money;a2.EWt=EWt;a2.EWinvt=EWinvt;a2.EW_moneyt=EW_moneyt;a2.EWinv_moneyt=EWinv_moneyt; a3.begin=node_count/4*3;a3.end=node_count;a3.EW=EW;a3.EWinv=EWinv;a3.EW_money=EW_money;a3.EWinv_money=EWinv_money;a3.EWt=EWt;a3.EWinvt=EWinvt;a3.EW_moneyt=EW_moneyt;a3.EWinv_moneyt=EWinv_moneyt; pthread_t first,second,third,forth; pthread_create(&first,NULL,topoSort1,(void*)&a0); pthread_create(&second,NULL,topoSort1,(void*)&a1); pthread_create(&third,NULL,topoSort1,(void*)&a2); pthread_create(&forth,NULL,topoSort1,(void*)&a3); pthread_join(first,NULL); pthread_join(second,NULL); pthread_join(third,NULL); pthread_join(forth,NULL); //cout << "topoSort time:" << double(clock() - t) / CLOCKS_PER_SEC << endl; //t = clock(); struct solvethread s0,s1,s2,s3; s0.begin=0;s0.end=node_count/40;s0.threadNo=0;s0.EWinv=EWinvt;s0.EW=EWt;s0.EW_money=EW_moneyt;s0.EWinv_money=EWinv_moneyt;s0.r=r; s0.res_count=res_count;s0.pre_money=pre_money;s0.pure_money=pure_money;s0.pure=pure;s0.marked=marked;s0.ans3=ans3;s0.ans4=ans4;s0.ans5=ans5;s0.ans6=ans6;s0.ans7=ans7; s1.begin=node_count/40;s1.end=node_count/20;s1.threadNo=1;s1.EWinv=EWinvt;s1.EW=EWt;s1.EW_money=EW_moneyt;s1.EWinv_money=EWinv_moneyt;s1.r=r; s1.res_count=res_count;s1.pre_money=pre_money;s1.pure_money=pure_money;s1.pure=pure;s1.marked=marked;s1.ans3=ans3;s1.ans4=ans4;s1.ans5=ans5;s1.ans6=ans6;s1.ans7=ans7; s2.begin=node_count/20;s2.end=node_count/10;s2.threadNo=2;s2.EWinv=EWinvt;s2.EW=EWt;s2.EW_money=EW_moneyt;s2.EWinv_money=EWinv_moneyt;s2.r=r; s2.res_count=res_count;s2.pre_money=pre_money;s2.pure_money=pure_money;s2.pure=pure;s2.marked=marked;s2.ans3=ans3;s2.ans4=ans4;s2.ans5=ans5;s2.ans6=ans6;s2.ans7=ans7; s3.begin=node_count/10;s3.end=node_count;s3.threadNo=3;s3.EWinv=EWinvt;s3.EW=EWt;s3.EW_money=EW_moneyt;s3.EWinv_money=EWinv_moneyt;s3.r=r; s3.res_count=res_count;s3.pre_money=pre_money;s3.pure_money=pure_money;s3.pure=pure;s3.marked=marked;s3.ans3=ans3;s3.ans4=ans4;s3.ans5=ans5;s3.ans6=ans6;s3.ans7=ans7; pthread_create(&first,NULL,solve,(void*)&s0); pthread_create(&second,NULL,solve,(void*)&s1); pthread_create(&third,NULL,solve,(void*)&s2); pthread_create(&forth,NULL,solve,(void*)&s3); pthread_join(first,NULL); pthread_join(second,NULL); pthread_join(third,NULL); pthread_join(forth,NULL); //cout << "solve time:" << double(clock() - t) / CLOCKS_PER_SEC << endl; //t=clock(); save(outputFile,idsComma,idsLF,res_count,ans3,ans4,ans5,ans6,ans7,r); //cout << "save time:" << double(clock() - t) / CLOCKS_PER_SEC << endl; //cout << "total time:" << double(clock() - org) / CLOCKS_PER_SEC << endl; return 0; }
[ "noreply@github.com" ]
noreply@github.com
aae9107a0c878a98edc4e35342c0d8ddeca19488
0f6ba0e7d8cf1977b1bc4148ac983a0d1423e9e3
/src/BLEDeviceID.h
63c46b01ff06592dedad640332651d4d21e3af2e
[]
no_license
hobzcalvin/ESP32_BLE_Arduino
c525e5c04a7154fe2b7ac2c89898f3ded3e265f9
e3bbac3dcd14c0c2b1531f66725dd34c53a8efa9
refs/heads/master
2021-08-17T09:08:11.717529
2017-11-21T01:55:33
2017-11-21T02:03:57
111,475,658
1
0
null
2017-11-20T23:52:20
2017-11-20T23:52:19
null
UTF-8
C++
false
false
2,088
h
/* BLEDeviceID.h - Bluetooth Low Energy Device ID Profile implementation. Copyright (c) 2017 by Grant Patterson. All rights reserved. This library 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 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MAIN_BLEDeviceID_H_ #define MAIN_BLEDeviceID_H_ #include "sdkconfig.h" #if defined(CONFIG_BT_ENABLED) #include <inttypes.h> #include <string> #include "BLEService.h" class BLEDeviceID { public: // Specify server and all values needed to implement the Device ID spec: // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.device_information.xml BLEDeviceID( BLEServer* server, std::string systemId, // 0x2A23, 64 bits, use strtoull format "0x..." std::string modelNumber, // 0x2A24 std::string serialNumber, // 0x2A25 std::string firmwareRevision, // 0x2A26 std::string hardwareRevision, // 0x2A27 std::string softwareRevision, // 0x2A28 std::string manufacturerName, // 0x2A29 std::string ieee11073_20601, // 0x2A2A, standard is behind paywall. // 0x2A50 PnP ID values: uint8_t vendorIdSource, // 1=Bluetooth SIG, 2=USB Impl. Forum uint16_t vendorId, uint16_t productId, uint16_t productVersion); void start(); protected: BLEService* service; }; #endif // CONFIG_BT_ENABLED #endif /* MAIN_BLEDeviceID_H_ */
[ "grant.patterson@gmail.com" ]
grant.patterson@gmail.com
53962e72a8c9134b3775ae708f4bbd303ef77062
893cdc4fc5313d9eade5347c43b13434bd64a083
/src/message_passing.cpp
aea17f9f4985a3c2f2b45aa3b7b222794814951b
[ "MIT" ]
permissive
paulromano/openmc
9b4a3d742601f97217f905d8c50306e7ca90e7c7
66d76429a8f5f5104ed08f41d810a61fc0495072
refs/heads/develop
2023-09-01T02:27:14.945321
2021-01-07T14:16:34
2021-01-07T14:16:34
6,039,026
2
4
MIT
2023-04-26T13:27:39
2012-10-02T01:55:56
Python
UTF-8
C++
false
false
325
cpp
#include "openmc/message_passing.h" namespace openmc { namespace mpi { int rank {0}; int n_procs {1}; bool master {true}; #ifdef OPENMC_MPI MPI_Comm intracomm {MPI_COMM_NULL}; MPI_Datatype bank {MPI_DATATYPE_NULL}; #endif extern "C" bool openmc_master() { return mpi::master; } } // namespace mpi } // namespace openmc
[ "paul.k.romano@gmail.com" ]
paul.k.romano@gmail.com
0efc10fde7c47526fcbd9e42fe91395d270f3fd1
43b4006c4ee90376918b8b88b6b6b67186bd70e0
/src/ofxAddons/ofxTimeline/src/ofxTimeline.h
ab40146cf8b3602f1e2782ab9acadc7e2eb870b4
[ "MIT" ]
permissive
laboluz/GAmuza
efcd55479833176a0761335a29dbe68a7ca6f28d
eaa363c4f67041b785e63ea56d7f148aff37c0e9
refs/heads/master
2021-01-13T03:03:05.753164
2016-12-09T13:43:49
2016-12-09T13:43:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
20,759
h
/** * ofxTimeline * openFrameworks graphical timeline addon * * Copyright (c) 2011-2012 James George * Development Supported by YCAM InterLab http://interlab.ycam.jp/en/ * http://jamesgeorge.org + http://flightphase.com * http://github.com/obviousjim + http://github.com/flightphase * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #pragma once #include "ofMain.h" //For lack of a type abstraction, this let's you #define a font renderer before including ofxTimeline //(like ofxFTGL or ofxFont) //to use ofxFTGL use somethinglike this: //#define OFX_TIMELINE_FONT_RENDERER ofxFTGLFont //#define OFX_TIMELINE_FONT_INCLUDE "ofxFTGLFont.h" #ifndef OFX_TIMELINE_FONT_RENDERER #define OFX_TIMELINE_FONT_RENDERER ofTrueTypeFont #endif #ifdef OFX_TIMELINE_FONT_INCLUDE #include OFX_TIMELINE_FONT_INCLUDE #endif //external addons #include "ofRange.h" #include "ofxMSATimer.h" #include "ofxTimecode.h" //internal types #include "ofxTLTrack.h" #include "ofxTLPage.h" #include "ofxTLPageTabs.h" #include "ofxTLZoomer.h" #include "ofxTLTicker.h" #include "ofxTLInOut.h" #include "ofxTLCurves.h" #include "ofxTLBangs.h" #include "ofxTLFlags.h" #include "ofxTLSwitches.h" #include "ofxTLColorTrack.h" #include "ofxTLImageSequence.h" #include "ofxTLColors.h" #include "ofxTLLFO.h" #include "ofxTLVideoTrack.h" #include "ofxTLAudioTrack.h" #include "ofxTLNotes.h" #include "ofxTLCameraTrack.h" typedef struct { ofxTLTrack* track; string stateBuffer; } UndoItem; class ofxTimeline : ofThread { public: //needed for hotkeys to work //optionally pass in an "app name" for Quit. static void removeCocoaMenusFromGlut(string appName); ofxTimeline(); virtual ~ofxTimeline(); virtual void setup(int _w, int _h); //Optionally run ofxTimeline on the background thread //this isn't necessary most of the time but //for precise timing apps and input recording it'll greatly //improve performance virtual void moveToThread(); virtual void removeFromThread(); bool toggleEnabled(); virtual void enable(); virtual void disable(); virtual void clear(); //clears every track virtual void reset(); //gets rid of everything, sets back to one page //used mostly for generating unique XML //for custom names, call setup() before calling name virtual void setName(string name); virtual string getName(); //playback virtual void play(); virtual void stop(); virtual bool togglePlay(); virtual bool getIsPlaying(); virtual bool getSpacebarTogglesPlay(); virtual void setSpacebarTogglePlay(bool spacebarPlays); virtual void playSelectedTrack(); virtual void stopSelectedTrack(); virtual bool togglePlaySelectedTrack(); virtual void setLoopType(ofLoopType newType); virtual ofLoopType getLoopType(); bool isDone(); //returns true if percentComplete == 1.0 and loop type is none virtual bool toggleShow(); virtual void show(); virtual void hide(); virtual bool getIsShowing(); virtual void draw(); virtual void mousePressed(ofMouseEventArgs& args); virtual void mouseMoved(ofMouseEventArgs& args); virtual void mouseDragged(ofMouseEventArgs& args); virtual void mouseReleased(ofMouseEventArgs& args); virtual void keyPressed(ofKeyEventArgs& args); virtual void keyReleased(ofKeyEventArgs& args); virtual void windowResized(ofResizeEventArgs& args); virtual void exit(ofEventArgs& args); //show/hide ticker,zoomer,inout all at once virtual void setShowTimeControls(bool shouldShowTimeControls); virtual void setShowTicker(bool shouldShowTicker); virtual void setShowInoutControl(bool shouldShowInoutControl); virtual void setShowZoomer(bool shouldShowZoomer); //sets where to save all timeline-related meta data xml files virtual void setWorkingFolder(string folderPath); virtual string getWorkingFolder(); //loads calls load on all tracks from the given folder //really useful for setting up 'project' directories virtual void loadTracksFromFolder(string folderPath); //timing setup functions void setFrameRate(float fps); void setDurationInFrames(int frames); void setDurationInSeconds(float seconds); void setDurationInMillis(unsigned long long millis); void setDurationInTimecode(string timecode); int getDurationInFrames(); float getDurationInSeconds(); long getDurationInMilliseconds(); string getDurationInTimecode(); //frame based mode timelines will never skip frames, and will advance at the speed of openFrameworks //regardless of the FPS that you set the timeline to void setFrameBased(bool frameBased); bool getIsFrameBased(); //autosave will always write to XML file on each major change //otherwise call save manually to write the files void setAutosave(bool autosave); virtual void save(); //if there have been changes without a save. //if autosave is on this will always return false bool hasUnsavedChanges(); virtual void setCurrentFrame(int currentFrame); virtual void setCurrentTimeSeconds(float time); virtual void setCurrentTimeMillis(unsigned long long millis); virtual void setPercentComplete(float percent); virtual void setCurrentTimecode(string timecodeString); virtual void setCurrentTimeToInPoint(); virtual void setCurrentTimeToOutPoint(); virtual int getCurrentFrame(); virtual float getCurrentTime(); virtual long getCurrentTimeMillis(); virtual float getPercentComplete(); virtual string getCurrentTimecode(); virtual long getQuantizedTime(unsigned long long time, unsigned long long step); //internal tracks call this when the value has changed slightly //so that views can know if they need to update virtual void flagUserChangedValue(); //this returns and clears the flag, generally call once per frame virtual bool getUserChangedValue(); //internal tracks call this when a big change has been made and it will trigger a save virtual void flagTrackModified(ofxTLTrack* track); //in and out point setting, respected by internal time virtual void setInPointAtPercent(float percent); void setInPointAtFrame(int frame); void setInPointAtSeconds(float time); void setInPointAtMillis(unsigned long long millis); void setInPointAtTimecode(string timecode); void setInPointAtPlayhead(); virtual void setOutPointAtPercent(float percent); void setOutPointAtFrame(float frame); void setOutPointAtSeconds(float time); void setOutPointAtMillis(unsigned long long millis); void setOutPointAtTimecode(string timecode); void setOutPointAtPlayhead(); virtual void setEditableHeaders(bool headersEditable); virtual bool areHeadersEditable(); virtual void setMinimalHeaders(bool headersMinimal); virtual bool areHeadersMinimal(); virtual bool toggleShowFooters(); virtual void setFootersHidden(bool footersHidden); virtual bool areFootersHidden(); virtual void setInOutRange(ofRange inoutPercentRange); virtual void setInOutRangeMillis(unsigned long long min, unsigned long long max); virtual void clearInOut(); ofRange getInOutRange(); ofLongRange getInOutRangeMillis(); int getInFrame(); float getInTimeInSeconds(); long getInTimeInMillis(); string getInPointTimecode(); int getOutFrame(); float getOutTimeInSeconds(); long getOutTimeInMillis(); string getOutPointTimecode(); virtual void setOffset(ofVec2f offset); virtual void setLockWidthToWindow(bool lockWidth); virtual bool getLockWidthToWindow(); virtual void setWidth(float width); virtual void setHeight(float height); virtual void collapseAllTracks(); //collapses all tracks heights to 0; ofRectangle getDrawRect(); float getWidth(); float getHeight(); ofVec2f getTopRight(); ofVec2f getTopLeft(); ofVec2f getBottomLeft(); ofVec2f getBottomRight(); //setting a BPM allows for a global measure across the timeline //this is useful for snapping to intervals void setBPM(float bpm); float getBPM(); bool toggleSnapToBPM(); void enableSnapToBPM(bool enableSnap); bool getSnapToBPM(); bool toggleShowBPMGrid(); void setShowBPMGrid(bool enableGrid); bool getShowBPMGrid(); bool toggleSnapToOtherKeyframes(); void enableSnapToOtherKeyframes(bool enableSnapToOther); bool getSnapToOtherElements(); void setMovePlayheadOnPaste(bool move); bool getMovePlayheadOnPaste(); vector<string>& getPasteboard(); //Undo and Redo void enableUndo(bool enabled); void undo(); void redo(); void setMovePlayheadOnDrag(bool updatePlayhead); bool getMovePlayheadOnDrag(); void unselectAll(); virtual void addPage(string name, bool makeCurrent = true); virtual void setPageName(string newName); virtual void setPageName(string newName, int index); virtual void setCurrentPage(string name); virtual void setCurrentPage(int number); //if a timeline is modal it means that it may be presenting //content outside of the timeline or requiring keyboard input //testApp should respect this value and not trigger other hotkeys //while isModal() is true so the user can freely type bool isModal(); ofxTLTrack* getModalTrack(); //Returns the number of items selected in the whole timeline // Subclass Note // ofxTLTracks that allow for multiple selection // should use this value to change the behavior for creating new items // If a user clicks on a blank part of a track it should only // create a new keyframe if 1 or 0 keys is selected // if 2 or more is selected, it just trigger an unselect all before // create any new items int getTotalSelectedItems(); unsigned long long getEarliestTime(); unsigned long long getLatestTime(); unsigned long long getEarliestSelectedTime(); unsigned long long getLatestSelectedTime(); bool hasTrack(string trackName); //type can be //Bangs, Switches, Flags, Colors, Curves, Audio or Video ofxTLTrack* getTrack(string name); //adding tracks always adds to the current page ofxTLCurves* addCurves(string name, ofRange valueRange = ofRange(0,1.0), float defaultValue = 0); ofxTLCurves* addCurves(string name, string xmlFileName, ofRange valueRange = ofRange(0,1.0), float defaultValue = 0); float getValue(string name); float getValueAtPercent(string name, float atPercent); float getValue(string name, float atTime); float getValue(string name, int atFrame); //adding tracks always adds to the current page ofxTLLFO* addLFO(string name, ofRange valueRange = ofRange(0,1.0), float defaultValue = 0); ofxTLLFO* addLFO(string name, string xmlFileName, ofRange valueRange = ofRange(0,1.0), float defaultValue = 0); ofxTLSwitches* addSwitches(string name); ofxTLSwitches* addSwitches(string name, string xmlFileName); bool isSwitchOn(string name); bool isSwitchOn(string name, float atTime); bool isSwitchOn(string name, int atFrame); // Notes track ofxTLNotes* addNotes(string name); ofxTLNotes* addNotes(string name, string xmlFileName); int getNotePitch(string name); float getNoteVelocity(string name); bool isNoteOn(string name); ofxTLBangs* addBangs(string name); ofxTLBangs* addBangs(string name, string xmlFileName); ofxTLFlags* addFlags(string name); ofxTLFlags* addFlags(string name, string xmlFileName); ofxTLColorTrack* addColors(string name); //adds with the default palette ofxTLColorTrack* addColors(string name, string xmlFileName); //adds with the default palette ofxTLColorTrack* addColorsWithPalette(string name, ofImage& palette); ofxTLColorTrack* addColorsWithPalette(string name, string palettePath); ofxTLColorTrack* addColorsWithPalette(string name, string xmlFileName, ofImage& palette); ofxTLColorTrack* addColorsWithPalette(string name, string xmlFileName, string palettePath); ofColor getColor(string name); ofColor getColorAtPercent(string name, float percent); ofColor getColorAtSecond(string name, float second); ofColor getColorAtMillis(string name, unsigned long long millis); string getDefaultColorPalettePath(); //TODO: remove image sequence from the core? ... or fix it up. //*IMAGE SEQUENCE DOES NOT WORK* ofxTLImageSequence* addImageSequence(string name); ofxTLImageSequence* addImageSequence(string name, string directory); ofImage* getImage(string name); ofImage* getImage(string name, float atTime); ofImage* getImage(string name, int atFrame); //*IMAGE SEQUENCE DOES NOT WORK* ofxTLVideoTrack* addVideoTrack(string name); ofxTLVideoTrack* addVideoTrackWithPath(string videoPath); ofxTLVideoTrack* addVideoTrack(string name, string videoPath); ofxTLVideoTrack* getVideoTrack(string videoTrackName); ofPtr<ofVideoPlayer> getVideoPlayer(string videoTrackName); //Audio tracks only work with PCM Wav or Aiff file ofxTLAudioTrack* addAudioTrack(string trackName); ofxTLAudioTrack* addAudioTrackWithPath(string audioPath); ofxTLAudioTrack* addAudioTrack(string name, string audioPath); ofxTLAudioTrack* getAudioTrack(string audioTrackName); // Camera tracks ofxTLCameraTrack* addCameraTrack(string name); ofxTLCameraTrack* getCameraTrack(string cameraTrackName); //used for audio and video. //we punt to the track to control time. //this can be a video or audio track void setTimecontrolTrack(string trackName); void setTimecontrolTrack(ofxTLTrack* track); ofxTLTrack* getTimecontrolTrack(); //you can add custom tracks this way virtual void addTrack(string name, ofxTLTrack* track); ofxTLTrackHeader* getTrackHeader(string trackName); ofxTLTrackHeader* getTrackHeader(ofxTLTrack* track); void removeTrack(string name); void removeTrack(ofxTLTrack* track); //ordering the track void bringTrackToTop(string name); void bringTrackToTop(ofxTLTrack* track); void bringTrackToBottom(string name); void bringTrackToBottom(ofxTLTrack* track); void setupFont(); void setupFont(string newFontPath, int newFontSize); OFX_TIMELINE_FONT_RENDERER & getFont(); ofxTLColors& getColors(); ofxTimecode& getTimecode(); ofxMSATimer& getTimer(); ofxTLZoomer* getZoomer(); vector<ofxTLPage*>& getPages(); ofVec2f getNudgePercent(); ofVec2f getBigNudgePercent(); //do not call this yourself, called from within TLTrack //This is a bit subtle why it's here //when multi keys are being dragged and snapping is enabled //we need to compensate by the drag offset between the grabbed key //and the mouse. //TLTracks should call this on mousedown if one of their tracks is //should be snapped directly to snap lines void setDragTimeOffset(unsigned long long millisecondOffset); void cancelSnapping(); long getDragTimeOffset(); void setHoverTime(unsigned long long millisTime); string formatTime(float seconds); string formatTime(unsigned long long millis); string nameToXMLName(string name); string confirmedUniqueName(string name); ofxTLPlaybackEventArgs createPlaybackEvent(); //when an track calls presentedModalContent all key and mouse action will be sent directly to that tracks //until dismissedModalContent() is called. This will is for displaying custom controls that may overlap with other //tracks or require keyboard input (see how it's used in ofxTLTweener and ofxTLFlags) void presentedModalContent(ofxTLTrack* modalTrack); void dismissedModalContent(); //time <-> pixel translation helpers long screenXToMillis(float x); float millisToScreenX(long millis); float screenXtoNormalizedX(float x); float normalizedXtoScreenX(float x); float screenXtoNormalizedX(float x, ofRange outputRange); float normalizedXtoScreenX(float x, ofRange inputRange); virtual ofxTLEvents& events(); void timelineResizeWithWindow(int _w,int _h); int _windowW,_windowH; //binary test hack bool curvesUseBinary; // pasteboard getters void copyOnTimeline(); void cutOnTimeline(); void pasteOnTimeline(); protected: ofxTimecode timecode; ofxMSATimer timer; ofxTLEvents timelineEvents; ofxTLColors colors; ofxTLInOut* inoutTrack; ofxTLTicker* ticker; ofxTLPageTabs* tabs; ofxTLZoomer* zoomer; vector<ofxTLPage*> pages; ofxTLPage* currentPage; map<string, ofxTLPage*> trackNameToPage; ofxTLTrack* modalTrack; ofxTLTrack* timeControl; //can be blank, default save to bin/data/ string workingFolder; bool isSetup; bool usingEvents; bool isOnThread; //called when the name changes to setup the inout track, zoomer, ticker etc void setupStandardElements(); bool movePlayheadOnPaste; long dragMillsecondOffset; bool dragAnchorSet; // will disable snapping if no drag anchor is set on mousedown bool lockWidthToWindow; //one string per track vector<string> pasteboard; bool undoEnabled; //turn off undo if you don't need it, it'll take up a ton of memory void collectStateBuffers(); void pushUndoStack(); void restoreToState(vector<UndoItem>& state); //this is populated on mouse-down or key-down with all items that could potentially be modified vector<UndoItem> stateBuffers; //then after the events are propagated all the modified tracks are collected here set<ofxTLTrack*> modifiedTracks; //finally, the state buffers for the tracks that were modified are pushed onto the stack say that state may be returned deque< vector<UndoItem> > undoStack; //the undo pointer points into the array and lets the user move through undo/redo actions int undoPointer; bool movePlayheadOnDrag; bool snapToBPM; bool snapToOtherElements; bool spacebarTogglesPlay; float width; ofVec2f offset; int fontSize; string fontPath; OFX_TIMELINE_FONT_RENDERER font; //only enabled while playing virtual void update(ofEventArgs& updateArgs); virtual void updateTime(); virtual void threadedFunction(); //only fired after moveToThread() virtual void checkLoop(); virtual void checkEvents(); virtual void enableEvents(); virtual void disableEvents(); virtual void viewWasResized(ofEventArgs& args); virtual void pageChanged(ofxTLPageEventArgs& args); virtual void updatePagePositions(); virtual void recalculateBoundingRects(); string defaultPalettePath; //TODO convert to ofLongRange ofRange inoutRange; bool timelineHasFocus; bool showTicker; bool showInoutControl; bool showZoomer; ofxXmlSettings settings; string name; ofRectangle totalDrawRect; bool isEnabled; //allows for editing bool isShowing; //allows for viewing bool isPlaying; //moves playhead along bool userChangedValue; //did value change this frame; //TODO: switch to millis! float currentTime; ofLoopType loopType; int playbackStartFrame; double playbackStartTime; bool autosave; bool unsavedChanges; bool headersAreEditable; bool minimalHeaders; bool footersHidden; bool isFrameBased; float durationInSeconds; };
[ "n3m3da@d3cod3.org" ]
n3m3da@d3cod3.org
c516beddfe9d3de0b1bdefd1dd6f8de051f91ac3
3e8a948e1d49911eb041c6be61fa02125293ce80
/Algorithms/lu_decompotision.cpp
a13833127636a3ff116b1b71759372bbd8cdd023
[]
no_license
MatsudaYoshio/study
66fea10ada4920763cab9d56ff38aad4eec8a6f3
604efb487ccced2d93ca1e93dc1b0a9559d0ba9b
refs/heads/master
2022-11-16T15:51:11.022117
2022-11-12T12:49:46
2022-11-12T12:49:46
101,472,509
0
0
null
null
null
null
UTF-8
C++
false
false
1,632
cpp
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <cmath> #include <cfloat> using namespace std; using Mat2d = vector<vector<double>>; void lu_decompotision(Mat2d& m){ const int r = m.size(); const int c = begin(m)->size(); const int s = min(r, c); vector<int> p(r); iota(begin(p), end(p), 0); for(int k = 0; k < s; ++k){ /* ピボットテーブルの更新 */ double max_val = DBL_MIN; int max_i; for(int i = k; i < r; ++i){ const double x = fabs(m[p[i]][k]); if(x > max_val){ max_val = x; max_i = i; } } swap(p[max_i], p[k]); const double w = 1.0/m[p[k]][k]; for(int i = k+1; i < r; ++i){ m[p[i]][k] *= w; for(int j = k+1; j < c; ++j){ m[p[i]][j] -= m[p[i]][k]*m[p[k]][j]; } } } /* 転置行列をかけてない形(転置行列がない(単位行列になっている)時も含む) */ cout << "<LU or L'U'>" << endl; for(const auto& r : m){ for(const auto& e : r){ cout << e << " "; } cout << endl; } /* 転置行列をかけた形 */ cout << "<PLU>" << endl; Mat2d n(r); for(int i = 0; i < r; ++i){ n[i] = m[p[i]]; } for(const auto& r : n){ for(const auto& e : r){ cout << e << " "; } cout << endl; } } int main(){ Mat2d A = { {1, 2, -1}, {1, 1, 2}, {-2, -1, 1} }; lu_decompotision(A); }
[ "dark.unicorn1213@gmail.com" ]
dark.unicorn1213@gmail.com
0d3385d56c91dd8136f75144e1aae118ea0e3a14
ca4d70080ced49e6c9d5110a8563eafdbe79eec4
/src/feti/specific/acc/mic.cpp
534dc1ed5165883b81783f4926c8f36e7d5ebeab
[]
no_license
It4innovations/espreso
f6b038dcd77f7f3677694e160a984bc45f4a4850
5acb7651287bd5114af736abc97c84de8a6ede99
refs/heads/master
2023-01-28T13:35:52.731234
2022-05-24T14:24:05
2022-06-26T06:35:31
66,345,061
18
6
null
null
null
null
UTF-8
C++
false
false
50,663
cpp
#include "mic.h" using namespace espreso; SparseSolverMIC::SparseSolverMIC() { device = 0; isOffloaded = false; keep_factors = true; initialized = false; USE_FLOAT = false; nMatrices = 0; mtype = 2; tmp_sol_fl1 = 0; tmp_sol_fl1 = 0; } SparseSolverMIC::~SparseSolverMIC() { this->Clear(); } void SparseSolverMIC::Clear() { if (isOffloaded) { for (esint i = 0; i<nMatrices; i++) { double* valPointer = CSR_V_values[i]; MKL_INT* iPointer = CSR_I_row_indices[i]; MKL_INT* jPointer = CSR_J_col_indices[i]; void **ptPointer = pt[i]; MKL_INT* iparmPointer = iparm[i]; double* dparmPointer = dparm[i]; MKL_INT *permPointer = perm[i]; #pragma offload_transfer target(mic:device) \ in( valPointer : length(0) alloc_if(0) free_if(1)) \ in( iPointer : length(0) alloc_if(0) free_if(1)) \ in( jPointer : length(0) alloc_if(0) free_if(1)) \ in( ptPointer : length(0) alloc_if(0) free_if(1)) \ in( iparmPointer : length(0) alloc_if(0) free_if(1)) \ in( dparmPointer : length(0) alloc_if(0) free_if(1)) \ in( permPointer : length(0) alloc_if(0) free_if(1)) } #pragma offload_transfer target(mic:device) \ in(rows : length(0) alloc_if(0) free_if(1) ) \ in(cols : length(0) alloc_if(0) free_if(1) ) \ in(nnz : length(0) alloc_if(0) free_if(1) ) \ in(CSR_I_row_indices_size : length(0) alloc_if(0) free_if(1)) \ in(CSR_J_col_indices_size : length(0) alloc_if(0) free_if(1)) \ in(CSR_V_values_size : length(0) alloc_if(0) free_if(1)) \ in(pt : length(0) alloc_if(0) free_if(1)) \ in(iparm : length(0) alloc_if(0) free_if(1)) \ in(dparm : length(0) alloc_if(0) free_if(1)) \ in(perm : length(0) alloc_if(0) free_if(1)) \ in(error : length(0) alloc_if(0) free_if(1)) \ in(m_Kplus_size : length(0) alloc_if(0) free_if(1)) _mm_free(rows); _mm_free(cols); _mm_free(nnz); _mm_free(CSR_I_row_indices_size); _mm_free(CSR_J_col_indices_size); _mm_free(CSR_V_values_size); delete [] m_Kplus_size; delete [] error; for (esint i = 0 ; i < nMatrices; i++) { if(import_with_copy) { _mm_free(CSR_I_row_indices[i]); _mm_free(CSR_J_col_indices[i]); _mm_free(CSR_V_values[i]); } delete [] pt[i]; delete [] iparm[i]; delete [] dparm[i]; _mm_free(perm[i]); } delete [] pt; delete [] iparm; delete [] dparm; delete [] perm; } } void SparseSolverMIC::ImportMatrices_wo_Copy(SparseMatrix ** A, esint nMatrices, esint mic) { USE_FLOAT = false; this->nMatrices = nMatrices; this->device = mic; this->A = A; /* rows = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); cols = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); nnz = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_I_row_indices_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_J_col_indices_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_V_values_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_I_row_indices = new MKL_INT*[nMatrices]; CSR_J_col_indices = new MKL_INT*[nMatrices]; CSR_V_values = new double*[nMatrices]; pt = new void**[nMatrices]; iparm = new MKL_INT*[nMatrices]; dparm = new double*[nMatrices]; perm = new MKL_INT*[nMatrices]; error = new MKL_INT[nMatrices]; m_factorized = 0; m_Kplus_size = new MKL_INT[nMatrices]; for (esint i = 0; i < nMatrices; i++) { rows[i] = A[i]->rows; cols[i] = A[i]->cols; nnz[i] = A[i]->nnz; m_Kplus_size[i] = A[i]->rows; CSR_I_row_indices_size[i] = A[i]->CSR_I_row_indices.size(); CSR_J_col_indices_size[i] = A[i]->CSR_J_col_indices.size(); CSR_V_values_size[i] = A[i]->CSR_V_values.size(); CSR_I_row_indices[i] = &(A[i]->CSR_I_row_indices[0]); CSR_J_col_indices[i] = &(A[i]->CSR_J_col_indices[0]); CSR_V_values[i] = &(A[i]->CSR_V_values[0]); pt[i] = new void*[64]; iparm[i] = new MKL_INT[65]; dparm[i] = new double[65]; perm[i] = (MKL_INT*) _mm_malloc(rows[i] * sizeof(MKL_INT), 64); for (esint j = 0; j < 65; j++) { iparm[i][j]=0; } for (esint j = 0; j < rows[i] ; j++) { perm[i][j] = 0; } for (esint j = 0 ;j < 64; j++) { pt[i][j] = 0; } } // send data to MIC #pragma offload_transfer target(mic:device) \ in(rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in(cols : length(nMatrices) alloc_if(1) free_if(0) ) \ in(nnz : length(nMatrices) alloc_if(1) free_if(0) ) \ in(CSR_I_row_indices_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_J_col_indices_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_V_values_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_V_values : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_I_row_indices : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_J_col_indices : length(nMatrices) alloc_if(1) free_if(0)) \ in(pt : length(nMatrices) alloc_if(1) free_if(0)) \ in(iparm : length(nMatrices) alloc_if(1) free_if(0)) \ in(dparm : length(nMatrices) alloc_if(1) free_if(0)) \ in(perm : length(nMatrices) alloc_if(1) free_if(0)) \ in(error : length(nMatrices) alloc_if(1) free_if(0)) \ in(m_Kplus_size : length(nMatrices) alloc_if(1) free_if(0) ) \ in(this : alloc_if(1) free_if(0)) for (esint i = 0; i<nMatrices; i++) { double* valPointer = CSR_V_values[i]; MKL_INT* iPointer = CSR_I_row_indices[i]; MKL_INT* jPointer = CSR_J_col_indices[i]; void **ptPointer = pt[i]; MKL_INT* iparmPointer = iparm[i]; double* dparmPointer = dparm[i]; MKL_INT *permPointer = perm[i]; #pragma offload target(mic:device) \ in( valPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( iPointer : length(rows[i]+1) alloc_if(1) free_if(0)) \ in( jPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( ptPointer : length(64) alloc_if(1) free_if(0)) \ in( iparmPointer : length(65) alloc_if(1) free_if(0)) \ in( dparmPointer : length(65) alloc_if(1) free_if(0)) \ in( permPointer : length(rows[i]) alloc_if(1) free_if(0)) \ in(CSR_V_values : length(0) alloc_if(0) free_if(0)) \ in(CSR_I_row_indices : length(0) alloc_if(0) free_if(0)) \ in(CSR_J_col_indices : length(0) alloc_if(0) free_if(0)) \ in(iparm : length(0) alloc_if(0) free_if(0)) \ in(dparm : length(0) alloc_if(0) free_if(0)) \ in(perm : length(0) alloc_if(0) free_if(0)) \ in(pt : length(0) alloc_if(0) free_if(0)) \ in(this : length(0) alloc_if(0) free_if(0)) { CSR_V_values[i] = valPointer; CSR_I_row_indices[i] = iPointer; CSR_J_col_indices[i] = jPointer; pt[i] = ptPointer; iparm[i] = iparmPointer; dparm[i] = dparmPointer; perm[i] = permPointer; } } isOffloaded = true; */ } void SparseSolverMIC::ImportMatrices(SparseMatrix ** A, esint nMatrices, esint mic) { USE_FLOAT = false; this->nMatrices = nMatrices; this->device = mic; this->A = A; /* rows = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); cols = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); nnz = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_I_row_indices_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_J_col_indices_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_V_values_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_I_row_indices = new MKL_INT*[nMatrices]; CSR_J_col_indices = new MKL_INT*[nMatrices]; CSR_V_values = new double*[nMatrices]; pt = new void**[nMatrices]; iparm = new MKL_INT*[nMatrices]; dparm = new double*[nMatrices]; perm = new MKL_INT*[nMatrices]; error = new MKL_INT[nMatrices]; m_factorized = 0; m_Kplus_size = new MKL_INT[nMatrices]; for (esint i = 0; i < nMatrices; i++) { rows[i] = A[i]->rows; cols[i] = A[i]->cols; nnz[i] = A[i]->nnz; m_Kplus_size[i] = A[i]->rows; CSR_I_row_indices_size[i] = A[i]->CSR_I_row_indices.size(); CSR_J_col_indices_size[i] = A[i]->CSR_J_col_indices.size(); CSR_V_values_size[i] = A[i]->CSR_V_values.size(); CSR_I_row_indices[i] = (MKL_INT*) _mm_malloc(CSR_I_row_indices_size[i] * sizeof(MKL_INT), 64); CSR_J_col_indices[i] = (MKL_INT*) _mm_malloc(CSR_J_col_indices_size[i] * sizeof(MKL_INT), 64); CSR_V_values[i] = (double*) _mm_malloc(CSR_V_values_size[i] * sizeof(double), 64); copy(A[i]->CSR_I_row_indices.begin(), A[i]->CSR_I_row_indices.end(), CSR_I_row_indices[i]); copy(A[i]->CSR_J_col_indices.begin(), A[i]->CSR_J_col_indices.end(), CSR_J_col_indices[i]); copy(A[i]->CSR_V_values.begin(), A[i]->CSR_V_values.end(), CSR_V_values[i]); pt[i] = new void*[65]; iparm[i] = new MKL_INT[65]; dparm[i] = new double[65]; perm[i] = (MKL_INT*) _mm_malloc(rows[i] * sizeof(MKL_INT), 64); for (esint j = 0; j < 65; j++) iparm[j]=0; } import_with_copy = true; // send data to MIC #pragma offload_transfer target(mic:device) \ in(rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in(cols : length(nMatrices) alloc_if(1) free_if(0) ) \ in(nnz : length(nMatrices) alloc_if(1) free_if(0) ) \ in(CSR_I_row_indices_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_J_col_indices_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_V_values_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(pt : length(nMatrices) alloc_if(1) free_if(0)) \ in(iparm : length(nMatrices) alloc_if(1) free_if(0)) \ in(dparm : length(nMatrices) alloc_if(1) free_if(0)) \ in(perm : length(nMatrices) alloc_if(1) free_if(0)) \ in(error : length(nMatrices) alloc_if(1) free_if(0)) \ in(m_Kplus_size : length(nMatrices) alloc_if(1) free_if(0)) for (esint i = 0; i<nMatrices; i++) { double* valPointer = CSR_V_values[i]; MKL_INT* iPointer = CSR_I_row_indices[i]; MKL_INT* jPointer = CSR_J_col_indices[i]; void **ptPointer = pt[i]; MKL_INT* iparmPointer = iparm[i]; double* dparmPointer = dparm[i]; MKL_INT *permPointer = perm[i]; #pragma offload target(mic:device) \ in( valPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( iPointer : length(rows[i]+1) alloc_if(1) free_if(0)) \ in( jPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( ptPointer : length(64) alloc_if(1) free_if(0)) \ in( iparmPointer : length(65) alloc_if(1) free_if(0)) \ in( dparmPointer : length(65) alloc_if(1) free_if(0)) \ in( permPointer : length(rows[i]) alloc_if(1) free_if(0)) { CSR_V_values[i] = valPointer; CSR_I_row_indices[i] = iPointer; CSR_J_col_indices[i] = jPointer; pt[i] = ptPointer; iparm[i] = iparmPointer; dparm[i] = dparmPointer; perm[i] = permPointer; } } isOffloaded = true; */ } void SparseSolverMIC::ImportMatrices_fl(SparseMatrix ** A, esint nMatrices, esint mic) { USE_FLOAT = true; this->device = mic; this->nMatrices = nMatrices; this->A = A; /* rows = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); cols = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); nnz = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_I_row_indices_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_J_col_indices_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_V_values_size = (MKL_INT*) _mm_malloc(nMatrices * sizeof(MKL_INT), 64); CSR_I_row_indices = new MKL_INT*[nMatrices]; CSR_J_col_indices = new MKL_INT*[nMatrices]; CSR_V_values_fl = new float*[nMatrices]; pt = new void**[nMatrices]; iparm = new MKL_INT*[nMatrices]; dparm = new double*[nMatrices]; error = new MKL_INT[nMatrices]; m_factorized = 0; m_Kplus_size = new MKL_INT[nMatrices]; for (esint i = 0; i < nMatrices; i++) { rows[i] = A[i]->rows; cols[i] = A[i]->cols; nnz[i] = A[i]->nnz; m_Kplus_size[i] = A[i]->rows; CSR_I_row_indices_size[i] = A[i]->CSR_I_row_indices.size(); CSR_J_col_indices_size[i] = A[i]->CSR_J_col_indices.size(); CSR_V_values_size[i] = A[i]->CSR_V_values.size(); CSR_I_row_indices[i] = (MKL_INT*) _mm_malloc(CSR_I_row_indices_size[i] * sizeof(MKL_INT), 64); CSR_J_col_indices[i] = (MKL_INT*) _mm_malloc(CSR_J_col_indices_size[i] * sizeof(MKL_INT), 64); CSR_V_values_fl[i] = (float*) _mm_malloc(CSR_V_values_size[i] * sizeof(float), 64); copy(A[i]->CSR_I_row_indices.begin(), A[i]->CSR_I_row_indices.end(), CSR_I_row_indices[i]); copy(A[i]->CSR_J_col_indices.begin(), A[i]->CSR_J_col_indices.end(), CSR_J_col_indices[i]); copy(A[i]->CSR_V_values.begin(), A[i]->CSR_V_values.end(), CSR_V_values_fl[i]); pt[i] = new void*[65]; iparm[i] = new MKL_INT[65]; dparm[i] = new double[65]; } import_with_copy = true; //send data to MIC #pragma offload_transfer target(mic:device) \ in(rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in(cols : length(nMatrices) alloc_if(1) free_if(0) ) \ in(nnz : length(nMatrices) alloc_if(1) free_if(0) ) \ in(CSR_I_row_indices_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_J_col_indices_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(CSR_V_values_size : length(nMatrices) alloc_if(1) free_if(0)) \ in(pt : length(nMatrices) alloc_if(1) free_if(0)) \ in(iparm : length(nMatrices) alloc_if(1) free_if(0)) \ in(dparm : length(nMatrices) alloc_if(1) free_if(0)) \ in(error : length(nMatrices) alloc_if(1) free_if(0)) \ in(m_Kplus_size : length(nMatrices) alloc_if(1) free_if(0)) for (esint i = 0; i<nMatrices; i++) { double* valPointer = CSR_V_values[i]; MKL_INT* iPointer = CSR_I_row_indices[i]; MKL_INT* jPointer = CSR_J_col_indices[i]; void **ptPointer = pt[i]; MKL_INT* iparmPointer = iparm[i]; double* dparmPointer = dparm[i]; #pragma offload target(mic:device) \ in( valPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( iPointer : length(rows[i]+1) alloc_if(1) free_if(0)) \ in( jPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( ptPointer : length(64) alloc_if(1) free_if(0)) \ in( iparmPointer : length(65) alloc_if(1) free_if(0)) \ in( dparmPointer : length(65) alloc_if(1) free_if(0)) { CSR_V_values[i] = valPointer; CSR_I_row_indices[i] = iPointer; CSR_J_col_indices[i] = jPointer; pt[i] = ptPointer; iparm[i] = iparmPointer; dparm[i] = dparmPointer; } } isOffloaded = true; */ } void SparseSolverMIC::Factorization(const std::string &str) { // reordering and symbolic factorization of all matrices at MIC in parallel // #pragma offload target(mic:device) \ in(rows : length(0) alloc_if(0) free_if(0) ) \ in(cols : length(0) alloc_if(0) free_if(0) ) \ in(nnz : length(0) alloc_if(0) free_if(0) ) \ in(CSR_I_row_indices : length(0) alloc_if(0) free_if(0)) \ in(CSR_J_col_indices : length(0) alloc_if(0) free_if(0)) \ in(CSR_V_values : length(0) alloc_if(0) free_if(0)) \ in(pt : length(0) alloc_if(0) free_if(0)) \ in(iparm : length(0) alloc_if(0) free_if(0)) \ in(dparm : length(0) alloc_if(0) free_if(0)) \ in(error : length(0) alloc_if(0) free_if(0)) \ in(m_Kplus_size : length(0) alloc_if(0) free_if(0)) \ in(perm : length(0) alloc_if(0) free_if(0)) \ in(this : length(0) alloc_if(0) free_if(0)) { phase = 11; MKL_INT idum; mnum = 1; maxfct = 1; double ddum; m_nRhs = 0; msglvl = 0; #pragma omp parallel { #pragma omp for for (esint i = 0; i < nMatrices; i++) { iparm[i][2] = 0; iparm[i][1-1] = 1; /* No solver default */ iparm[i][2-1] = 2; /* Fill-in reordering from METIS */ iparm[i][5-1] = 0; /* No user fill-in reducing permutation */ iparm[i][6-1] = 0; /* Write solution to x */ iparm[i][10-1] = 8; /* Perturb the pivot elements with 1E-13 */ iparm[i][11-1] = 0; /* Use nonsymmetric permutation and scaling MPS */ iparm[i][13-1] = 0; /* Maximum weighted matching algorithm is switched-off (default for symmetric). Try iparm[12] = 1 in case of inappropriate accuracy */ iparm[i][14-1] = 0; /* Output: Number of perturbed pivots */ iparm[i][18-1] = -1; /* Output: Number of nonzeros in the factor LU */ iparm[i][19-1] = -1; /* Output: Mflops for LU factorization */ iparm[i][24-1] = 0; /* Parallel factorization control */ iparm[i][25-1] = 0; /* Parallel forward/backward solve control */ iparm[i][28-1] = 0; iparm[i][36-1] = 0; /* Use Schur complement */ if (USE_FLOAT) { iparm[i][27] = 1; // run PARDISO in float pardiso(pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], CSR_V_values_fl[i], CSR_I_row_indices[i], CSR_J_col_indices[i], perm[i], &m_nRhs, iparm[i], &msglvl, &ddum, &ddum, &error[i]); } else { pardiso (pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], perm[i], &m_nRhs, iparm[i], &msglvl, &ddum, &ddum, &error[i]); } } initialized = true; for (esint i=0; i < nMatrices; i++) { if (error[i] != 0) { initialized = false; std::cerr << "ERROR during symbolic factorization of matrix " << i <<": " << str << "\n"; } } if (!initialized) { exit(EXIT_FAILURE); } #ifdef DEBUG presintf ("\nReordering completed ... "); #endif /* -------------------------------------------------------------------- */ /* .. Numerical factorization. */ /* -------------------------------------------------------------------- */ #pragma omp single { phase = 22; } #pragma omp for for (esint i = 0; i < nMatrices; i++) { if (USE_FLOAT) { pardiso (pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], CSR_V_values_fl[i], CSR_I_row_indices[i], CSR_J_col_indices[i], perm[i], &m_nRhs, iparm[i], &msglvl, &ddum, &ddum, &error[i]); } else { pardiso (pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], perm[i], &m_nRhs, iparm[i], &msglvl, &ddum, &ddum, &error[i]); } m_factorized = 1; for (esint i=0; i < nMatrices; i++) { if (error[i] != 0) { m_factorized = 0; std::cerr << "ERROR during numeric factorization of matrix " << i <<": " << str << "\n"; } } if (m_factorized!=1) { exit(EXIT_FAILURE); } #ifdef DEBUG presintf ("\nFactorization completed ... "); #endif } } } if (USE_FLOAT) { tmp_sol_fl1 = new float*[nMatrices]; tmp_sol_fl2 = new float*[nMatrices]; for (esint i=0; i < nMatrices; i++) { tmp_sol_fl1[i] = (float*) _mm_malloc(m_Kplus_size[i]*sizeof(float), 64); tmp_sol_fl2[i] = (float*) _mm_malloc(m_Kplus_size[i]*sizeof(float), 64); } // send data persistently to mic so it does not have to be allocated // everytime the solve is needed #pragma offload_transfer target(mic:device) \ in(tmp_sol_fl1 : length(nMatrices) alloc_if(1) free_if(0)) \ in(tmp_sol_fl2 : length(nMatrices) alloc_if(1) free_if(0)) for (esint i = 0; i<nMatrices; i++) { float * tmp1 = tmp_sol_fl1[i]; float * tmp2 = tmp_sol_fl2[i]; esint tmpLength = m_Kplus_size[i]; #pragma offload target(mic:device) \ in(tmp1 : length(tmpLength) alloc_if(1) free_if(0)) \ in(tmp2 : length(tmpLength) alloc_if(1) free_if(0)) \ in(this : length(0) alloc_if(0) free_if(0)) { tmp_sol_fl1[i] = tmp1; tmp_sol_fl2[i] = tmp2; } } } else { tmp_sol_d1 = new double*[nMatrices]; tmp_sol_d2 = new double*[nMatrices]; for (esint i=0; i<nMatrices; i++) { tmp_sol_d1[i] = (double*) _mm_malloc(m_Kplus_size[i]*sizeof(double),64); tmp_sol_d2[i] = (double*) _mm_malloc(m_Kplus_size[i]*sizeof(double),64); } // send data persistently to mic so it does not have to be allocated // everytime the solve is needed #pragma offload_transfer target(mic:device) \ in(tmp_sol_d1 : length(nMatrices) alloc_if(1) free_if(0)) \ in(tmp_sol_d2 : length(nMatrices) alloc_if(1) free_if(0)) \ in(this : length(0) alloc_if(0) free_if(0)) for (esint i = 0; i<nMatrices; i++) { double * tmp1 = tmp_sol_d1[i]; double * tmp2 = tmp_sol_d2[i]; esint tmpLength = m_Kplus_size[i]; #pragma offload target(mic:device) \ in(tmp_sol_d1 : length(0) alloc_if(0) free_if(0)) \ in(tmp_sol_d2 : length(0) alloc_if(0) free_if(0)) \ in(tmp1 : length(tmpLength) alloc_if(1) free_if(0)) \ in(tmp2 : length(tmpLength) alloc_if(1) free_if(0)) \ in(this : length(0) alloc_if(0) free_if(0)) { tmp_sol_d1[i] = tmp1; tmp_sol_d2[i] = tmp2; } } } int totalLength = 0; for (esint i = 0 ; i < nMatrices; i++) { totalLength += m_Kplus_size[i]; } vectors = (double*) _mm_malloc(totalLength * sizeof(double), 64); vectors_out = (double*) _mm_malloc(totalLength * sizeof(double), 64); #pragma offload_transfer target(mic:device) \ in(vectors : length(totalLength) alloc_if(1) free_if(0)) \ in(vectors_out : length(totalLength) alloc_if(1) free_if(0)) m_factorized = true; } void SparseSolverMIC::Factorization( const std::string &str, SparseMatrixPack &factors_out ) { if ( this->A != NULL ) { factors_out.AddMatrices( this->A, this->nMatrices, device ); } factors_out.FactorizeMIC(); } void SparseSolverMIC::Solve( SEQ_VECTOR <double> ** rhs_sol) { if (!m_factorized) { //std::cout << "NOT INITIALIED\n\n"<<std::endl; std::stringstream ss; ss << "Solve -> rank: ";// << esinfo::mpi::MPIrank; // MPIrank link problem Factorization(ss.str()); } esint offset = 0; for (esint i = 0; i < nMatrices; i++) { memcpy(vectors + offset, &(rhs_sol[i]->at(0)), m_Kplus_size[i] * sizeof(double)); tmp_sol_d1[i] = vectors + offset; offset += m_Kplus_size[i]; } #pragma offload_transfer target(mic:device) in(vectors : length(offset) alloc_if(0) free_if(0)) \ in(tmp_sol_d1 : length(nMatrices) alloc_if(0) free_if(0)) if( USE_FLOAT ) { for (esint i = 0; i < nMatrices; i++) { for (esint j = 0; j < m_Kplus_size[i]; j++) tmp_sol_fl1[i][j] = (float)(rhs_sol[i])->at(j); } } double ** tmpVecPointers = new double*[nMatrices]; if ( USE_FLOAT ) { for (esint i = 0 ; i < nMatrices; i++) { float *tmpPointer = tmp_sol_fl1[i]; esint tmpLength = m_Kplus_size[i]; #pragma offload_transfer target(mic:device) \ in(tmpPointer : length(tmpLength) alloc_if(0) free_if(0)) //in(tmp_sol_fl1 : length(0) alloc_if(0) free_if(0)) //{ // tmp_sol_fl1[i] = tmpPoesinter; //} } } else { for (esint i = 0; i < nMatrices; i++) { tmpVecPointers[i] = &(rhs_sol[i]->at(0)); } //#pragma offload_transfer taget(mic:device) \ //in(tmpVecPoesinters : length(nMatrices) alloc_if(1) free_if(0)) for (esint i = 0; i < nMatrices;i++) { double * tmpPointer2 = tmpVecPointers[i]; esint tmpLength = m_Kplus_size[i]; double * buffer = tmp_sol_d1[i]; //#pragma offload_transfer target(mic:device) \ // : in(tmpPointer2 : length(tmpLength) alloc_if(0) free_if(0) into(buffer)) //{ // tmpVecPoesinters[i] = tmpPoesinter2; //} } } #pragma offload target(mic:device) \ in(rows : length(0) alloc_if(0) free_if(0) ) \ in(cols : length(0) alloc_if(0) free_if(0) ) \ in(nnz : length(0) alloc_if(0) free_if(0) ) \ in(CSR_I_row_indices_size : length(0) alloc_if(0) free_if(0)) \ in(CSR_J_col_indices_size : length(0) alloc_if(0) free_if(0)) \ in(CSR_I_row_indices : length(0) alloc_if(0) free_if(0)) \ in(CSR_J_col_indices : length(0) alloc_if(0) free_if(0)) \ in(CSR_V_values :length(0) alloc_if(0) free_if(0)) \ in(pt : length(0) alloc_if(0) free_if(0)) \ in(iparm : length(0) alloc_if(0) free_if(0)) \ in(dparm : length(0) alloc_if(0) free_if(0)) \ in(perm : length(0) alloc_if(0) free_if(0)) \ in(error : length(0) alloc_if(0) free_if(0)) \ in(m_Kplus_size : length(0) alloc_if(0) free_if(0)) \ in(tmp_sol_d1 : length(0) alloc_if(0) free_if(0)) \ in(tmp_sol_d2 : length(0) alloc_if(0) free_if(0)) \ in(vectors : length(0) alloc_if(0) free_if(0)) \ in(vectors_out : length(0) alloc_if(0) free_if(0)) \ in(this : length(0) alloc_if(0) free_if(0)) { esint offset = 0; for (esint i = 0; i < nMatrices; i++){ tmp_sol_d1[i] = &vectors[offset]; tmp_sol_d2[i] = &vectors_out[offset]; offset+=m_Kplus_size[i]; } double ddum = 0; /* Double dummy */ MKL_INT idum = 0; /* Integer dummy. */ MKL_INT n_rhs = 1; msglvl = 0; mnum = 1; maxfct = 1; /* -------------------------------------------------------------------- */ /* .. Back substitution and iterative refinement. */ /* -------------------------------------------------------------------- */ //iparm[24] = 1; // Parallel forward/backward solve control. - 1 - Intel MKL PARDISO uses the sequential forward and backward solve. #pragma omp parallel //num_threads(21) { esint myPhase = 331; #pragma omp for schedule(dynamic) for (esint i = 0; i < nMatrices; i++) { myPhase=331; MKL_INT ip5backup = iparm[i][5]; iparm[i][5] = 0; if (USE_FLOAT) { myPhase=33; pardiso (pt[i], &maxfct, &mnum, &mtype, &myPhase, &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], &idum, &n_rhs, iparm[i], &msglvl, &tmp_sol_fl1[i], &tmp_sol_fl2[i], &error[i]); } else { myPhase = 33; PARDISO (pt[i], &maxfct, &mnum, &mtype, &myPhase, &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], NULL, &n_rhs, iparm[i], &msglvl, tmp_sol_d1[i], tmp_sol_d2[i], &error[i]); //myPhase = 332; //PARDISO (pt[i], &maxfct, &mnum, &mtype, &myPhase, // &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], &idum, &n_rhs, iparm[i], &msglvl, tmp_sol_d1[i], tmp_sol_d2[i], &error[i]); } iparm[i][5] = ip5backup; } } bool err = false; for (esint i = 0; i < nMatrices; i++) { if (error[i]!=0) { err = true; ////ESINFO(ERROR) << "ERROR during solution: " << error[i] << ", matrix " << i; } } if (err) { exit (3); } if (!keep_factors) { /* -------------------------------------------------------------------- */ /* .. Termination and release of memory. */ /* -------------------------------------------------------------------- */ /* phase = -1; MKL_INT nRhs = 1; for (esint i =0 ; i < nMatrices; i++ ) { pardiso (pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], &ddum, CSR_I_row_indices[i], CSR_J_col_indices[i], &idum, &nRhs, iparm[i], &msglvl, &ddum, &ddum, &error[i]); } initialized = false; */ } } // send data from buffers on mic back to CPU user provided arrays if (USE_FLOAT) { for (esint i = 0; i < nMatrices; i++) { float * tmp = tmp_sol_fl2[i]; #pragma offload_transfer target(mic:device) \ out(tmp : length(m_Kplus_size[i]) alloc_if(0) free_if(0)) for (esint j = 0; j < m_Kplus_size[i]; j++) { rhs_sol[i]->at(j) = (double) tmp[j]; } } } else { #pragma offload_transfer target(mic:device) \ out(vectors_out : length(offset) alloc_if(0) free_if(0)) offset = 0; for (esint i = 0; i < nMatrices; i++) { memcpy(&(rhs_sol[i]->at(0)), vectors_out + offset, m_Kplus_size[i] * sizeof(double)); offset += m_Kplus_size[i]; //double * tmp = tmp_sol_d2[i]; //double * output = tmpVecPointers[i]; //#pragma offload_transfer target(mic:device) \ // out(tmp : length(m_Kplus_size[i]) alloc_if(0) free_if(0) into(output)) } } } void SparseSolverMIC::Create_SC( DenseMatrixPack & SC_out, MKL_INT *SC_sizes, esint generate_symmetric_sc_1_generate_general_sc_0 ) { ////ESINFO(PROGRESS3) << "Creating Schur complements"; // data to be transfered to MIC esint * SC_out_rows = SC_out.rows; esint * SC_out_cols = SC_out.cols; long * SC_out_lengths = SC_out.lengths; long * SC_out_offsets = SC_out.offsets; long * SC_out_rowOffsets = SC_out.rowOffsets; long * SC_out_colOffsets = SC_out.colOffsets; long SC_out_totalCols = SC_out.totalCols; long SC_out_totalRows = SC_out.totalRows; double * SC_out_matrices = SC_out.matrices; esint matricesSize = SC_out.preallocSize - SC_out.freeSpace; bool * SC_out_packed = SC_out.packed; int setMsglvl = Info::report(LIBRARIES) ? 1 : 0; #pragma offload target(mic : device ) \ in ( rows : length(0) alloc_if(0) free_if(0) ) \ in( SC_sizes : length(nMatrices) alloc_if(1) free_if(1) ) \ in( nnz : length(0) alloc_if(0) free_if(0)) \ in( perm : length(0) alloc_if(0) free_if(0)) \ in( CSR_V_values : length(0) alloc_if(0) free_if(0) ) \ in( CSR_I_row_indices : length(0) alloc_if(0) free_if(0) ) \ in( CSR_J_col_indices : length(0) alloc_if(0) free_if(0) ) \ in(SC_out_rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in(SC_out_cols : length(nMatrices) alloc_if(1) free_if(0) ) \ in(SC_out_offsets : length(nMatrices) alloc_if(1) free_if(0) ) \ in(SC_out_matrices : length(matricesSize) alloc_if(1) free_if(0)) \ in(SC_out_packed : length(nMatrices) alloc_if(1) free_if(0)) \ in(SC_out_rowOffsets : length(nMatrices) alloc_if(1) free_if(0) ) \ in(SC_out_colOffsets : length(nMatrices) alloc_if(1) free_if (0)) \ in(SC_out_lengths : length(nMatrices) alloc_if(1) free_if(0)) if(1) \ in(this : length(0) alloc_if(0) free_if(0)) { long maxSize = 0; for (esint i = 0; i < nMatrices; i++) { if (SC_sizes[i]*SC_sizes[i] > maxSize) { maxSize = SC_sizes[i]*SC_sizes[i]; } } double ** matrixPerThread = new double*[nMatrices]; #pragma omp parallel { esint myRank = omp_get_thread_num(); matrixPerThread[myRank] = (double*) _mm_malloc(maxSize * sizeof(double), 64); } ////ESINFO(PROGRESS3) << "start"; #pragma omp parallel { esint myRank = omp_get_thread_num(); #pragma omp for //schedule(static,1) for (esint i = 0 ; i < nMatrices; i++) { for (esint j = 0; j < 64; j++) { iparm[i][j] = 0; } esint mtype = 2; double ddum; iparm[i][2] = 0; iparm[i][1-1] = 1; /* No solver default */ iparm[i][2-1] = 2; /* Fill-in reordering from METIS */ iparm[i][10-1] = 8; //13 /* Perturb the pivot elements with 1E-13 */ iparm[i][11-1] = 0; /* Use nonsymmetric permutation and scaling MPS */ iparm[i][13-1] = 0; /* Maximum weighted matching algorithm is switched-off (default for symmetric). Try iparm[12] = 1 in case of inappropriate accuracy */ iparm[i][14-1] = 0; /* Output: Number of perturbed pivots */ iparm[i][18-1] = -1; /* Output: Number of nonzeros in the factor LU */ iparm[i][19-1] = -1; /* Output: Mflops for LU factorization */ iparm[i][36-1] = 1; /* Use Schur complement */ maxfct = 1; /* Maximum number of numerical factorizations. */ mnum = 1; /* Which factorization to use. */ msglvl = setMsglvl; /* Print statistical information in file */ error = 0; /* Initialize error flag */ // for reordering and factorization for (esint j = 0; j < rows[i] - SC_sizes[i]; j++) perm[i][j] = 0; for (esint j = rows[i] - SC_sizes[i]; j < rows[i]; j++) perm[i][j] = 1; m_nRhs = 0; /* -------------------------------------------------------------------- */ /* .. Numerical factorization. */ /* -------------------------------------------------------------------- */ double * SC_out_data; if (SC_out_packed[i]) { SC_out_data = matrixPerThread[myRank];//(double*) malloc(K_b_tmp_rows[i] * K_b_tmp_rows[i]*sizeof(double)); } else { SC_out_data = SC_out_matrices + SC_out_offsets[i]; } phase = 12; PARDISO (pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], perm[i], &m_nRhs, iparm[i], &msglvl, &ddum, SC_out_data, &error[i]); for (esint j = 0; j < SC_sizes[i]*SC_sizes[i]; j++) SC_out_data[j] = (-1.0)*SC_out_data[j]; if (SC_out_packed[i]) { for (long j = 0; j < SC_out_cols[ i ]; j++ ) { long pos = ((double)( 1.0 +j ))*((double) j)/2.0; memcpy( SC_out_matrices + SC_out_offsets[ i ] + pos, SC_out_data + j * SC_out_rows[ i ], sizeof( double ) * (j+1) ); } } /* -------------------------------------------------------------------- */ /* .. Termination and release of memory. */ /* -------------------------------------------------------------------- */ phase = -1; /* Release internal memory. */ PARDISO (pt[i], &maxfct, &mnum, &mtype, &phase, &rows[i], CSR_V_values[i], CSR_I_row_indices[i], CSR_J_col_indices[i], perm[i], &m_nRhs, iparm[i], &msglvl, &ddum, SC_out_data, &error[i]); initialized = false; } } bool err=false; for (esint i = 0; i < nMatrices; i++) { if (error[i]!=0) { err=true; } } if ( err ) { ////ESINFO(ERROR) << "ERROR during numerical factorization"; exit (2); } else { initialized = true; } ////ESINFO(PROGRESS3) << "end"; } } void SparseSolverMIC::Create_SC_w_Mat( SparseMatrix** K_in, SparseMatrix** B_in, DenseMatrixPack & SC_out, esint nMatrices, esint generate_symmetric_sc_1_generate_general_sc_0, esint device ) { if (!SC_out.areDataOnMIC()) { SC_out.CopyToMIC(); } // data to be transfered to MIC esint * K_in_rows = (esint*) _mm_malloc(nMatrices * sizeof(esint), 64); //new esint[nMatrices]; esint * K_b_tmp_rows = (esint*) _mm_malloc(nMatrices * sizeof(esint), 64);//new esint[nMatrices]; esint * K_sc1_rows = (esint*) _mm_malloc(nMatrices * sizeof(esint), 64);//new esint[nMatrices]; esint * nnz = (esint*) _mm_malloc(nMatrices * sizeof(esint), 64);//new esint[nMatrices]; double ** K_sc1_CSR_V_values = (double**) _mm_malloc(nMatrices * sizeof(double*), 64);// new double*[nMatrices]; esint ** K_sc1_CSR_I_row_indices = (esint**) _mm_malloc(nMatrices * sizeof(esint*), 64); //new esint*[nMatrices]; esint ** K_sc1_CSR_J_col_indices = (esint**) _mm_malloc(nMatrices * sizeof(esint*), 64);//new esint*[nMatrices]; //double ** SC_out_dense_values = new double*[nMatrices]; esint * SC_out_rows = SC_out.rows; esint * SC_out_cols = SC_out.cols; long * SC_out_lengths = SC_out.lengths; long * SC_out_offsets = SC_out.offsets; long * SC_out_rowOffsets = SC_out.rowOffsets; long * SC_out_colOffsets = SC_out.colOffsets; double * SC_out_mic_x_in = SC_out.mic_x_in; double * SC_out_mic_y_out = SC_out.mic_y_out; long SC_out_totalCols = SC_out.totalCols; long SC_out_totalRows = SC_out.totalRows; double * SC_out_matrices = SC_out.matrices; esint matricesSize = SC_out.preallocSize - SC_out.freeSpace; bool * SC_out_packed = SC_out.packed; // find the biggest SC matrix and preallocate output array for PARDISO for ( esint i = 0 ; i < nMatrices; ++i ) { // assemble the whole matrix [K, B; Bt, eye] SparseMatrix K_sc1; SparseMatrix Sc_eye; SparseMatrix K_b_tmp = *(B_in[i]); K_b_tmp.MatTranspose(); Sc_eye.CreateEye(K_b_tmp.rows, 0.0, 0, K_b_tmp.cols); K_sc1 = *(K_in[i]); K_sc1.MatTranspose(); K_sc1.MatAppend(K_b_tmp); K_sc1.MatTranspose(); K_sc1.MatAppend(Sc_eye); K_in_rows[ i ] = K_in[i]->rows; K_b_tmp_rows[i] = K_b_tmp.rows; K_sc1_rows[i] = K_sc1.rows; nnz[i] = K_sc1.nnz; K_sc1_CSR_V_values[i] = (double*) _mm_malloc(nnz[i] * sizeof(double), 64); // new double[ nnz[i] ]; memcpy(K_sc1_CSR_V_values[i], &K_sc1.CSR_V_values[0], nnz[i] * sizeof(double) ); K_sc1_CSR_I_row_indices[i] = (esint*) _mm_malloc( (K_sc1_rows[i] +1) * sizeof(esint), 64);// new esint[K_sc1_rows[i] + 1]; memcpy(K_sc1_CSR_I_row_indices[i], &K_sc1.CSR_I_row_indices[0], ( K_sc1_rows[i] + 1) * sizeof(esint)); //K_sc1_CSR_I_row_indices[i][K_sc1_rows[i]] = nnz[i]; K_sc1_CSR_J_col_indices[i] = (esint*) _mm_malloc(nnz[i] * sizeof(esint), 64); //new esint[nnz[i]]; memcpy(K_sc1_CSR_J_col_indices[i], &K_sc1.CSR_J_col_indices[0], nnz[i] * sizeof(esint)); } // transfer data #pragma offload_transfer target(mic : device ) \ in( K_in_rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in( K_b_tmp_rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in( K_sc1_rows : length(nMatrices) alloc_if(1) free_if(0) ) \ in( nnz : length(nMatrices) alloc_if(1) free_if(0) ) \ in(K_sc1_CSR_V_values : length(nMatrices) alloc_if(1) free_if(0) ) \ in(K_sc1_CSR_I_row_indices : length(nMatrices) alloc_if(1) free_if(0) ) \ in(K_sc1_CSR_J_col_indices : length(nMatrices) alloc_if(1) free_if(0) ) \ in(this : alloc_if(1) free_if(0) ) // #pragma omp parallel for num_threads(24) for (esint i = 0 ; i < nMatrices; i++) { double * valPointer = K_sc1_CSR_V_values[i]; esint * iPointer = K_sc1_CSR_I_row_indices[i]; esint * jPointer = K_sc1_CSR_J_col_indices[i]; #pragma offload target(mic:device) \ in( valPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( iPointer : length(K_sc1_rows[i] + 1) alloc_if(1) free_if(0)) \ in( jPointer : length(nnz[i]) alloc_if(1) free_if(0)) \ in( K_sc1_CSR_V_values : length(0) alloc_if(0) free_if(0) ) \ in( K_sc1_CSR_I_row_indices : length(0) alloc_if(0) free_if(0) ) \ in( K_sc1_CSR_J_col_indices : length(0) alloc_if(0) free_if(0) ) \ in(this : length(0) alloc_if(0) free_if(0)) { K_sc1_CSR_V_values[i] = valPointer; K_sc1_CSR_I_row_indices[i] = iPointer; K_sc1_CSR_J_col_indices[i] = jPointer; } } #pragma offload target(mic : device ) \ in ( K_in_rows : length(0) alloc_if(0) free_if(1) ) \ in( K_b_tmp_rows : length(0) alloc_if(0) free_if(1) ) \ in( K_sc1_rows : length(0) alloc_if(0) free_if(1) ) \ in( nnz : length(0) alloc_if(0) free_if(1)) \ in( K_sc1_CSR_V_values : length(0) alloc_if(0) free_if(0) ) \ in(K_sc1_CSR_I_row_indices : length(0) alloc_if(0) free_if(0) ) \ in( K_sc1_CSR_J_col_indices : length(0) alloc_if(0) free_if(0) ) \ in(SC_out_rows : length(0) alloc_if(0) free_if(0) ) \ in(SC_out_cols : length(0) alloc_if(0) free_if(0) ) \ in(SC_out_offsets : length(0) alloc_if(0) free_if(0) ) \ in(SC_out_matrices : length(0) alloc_if(0) free_if(0)) \ in(SC_out_packed : length(0) alloc_if(0) free_if(0)) \ in(SC_out_rowOffsets : length(0) alloc_if(0) free_if(0) ) \ in(SC_out_colOffsets : length(0) alloc_if(0) free_if (0)) \ in(SC_out_mic_x_in : length(0) alloc_if(0) free_if(0)) \ in(SC_out_mic_y_out : length(0) alloc_if(0) free_if(0)) \ in(SC_out_lengths : length(0) alloc_if(0) free_if(0)) in(this : length(0) alloc_if(0) free_if(0)) if(1) { long maxSize = 0; for (esint i = 0; i < nMatrices; i++) { if (K_b_tmp_rows[i]*K_b_tmp_rows[i] > maxSize) { maxSize = K_b_tmp_rows[i]*K_b_tmp_rows[i]; } } esint nThreads = 1; #pragma omp parallel { #pragma omp single nThreads = omp_get_num_threads(); } double ** matrixPerThread = new double*[nThreads]; #pragma omp parallel { esint myRank = omp_get_thread_num(); // to overcome competition among threads allocate buffer one by one #pragma omp critical matrixPerThread[myRank] = (double*) _mm_malloc(maxSize * sizeof(double), 64); /* Internal solver memory pointer pt, */ /* 32-bit: int pt[64]; 64-bit: long int pt[64] */ /* or void *pt[64] should be OK on both architectures */ void *pt[64]; /* Pardiso control parameters. */ esint iparm[64]; double dparm[65]; esint maxfct, mnum, phase, error; /* Auxiliary variables. */ esint j; double ddum; /* Double dummy */ esint idum; /* Integer dummy. */ esint solver; /* -------------------------------------------------------------------- */ /* .. Setup Pardiso control parameters. */ /* -------------------------------------------------------------------- */ for (j = 0; j < 64; j++) { iparm[j] = 0; } /* -------------------------------------------------------------------- */ /* .. Initialize the esinternal solver memory poesinter. This is only */ /* necessary for the FIRST call of the PARDISO solver. */ /* -------------------------------------------------------------------- */ for (j = 0; j < 64; j++) pt[j] = 0; esint mtype = 2; iparm[2] = 0; iparm[1-1] = 1; /* No solver default */ iparm[2-1] = 2; /* Fill-in reordering from METIS */ iparm[10-1] = 8; //13 /* Perturb the pivot elements with 1E-13 */ iparm[11-1] = 0; /* Use nonsymmetric permutation and scaling MPS */ iparm[13-1] = 0; /* Maximum weighted matching algorithm is switched-off (default for symmetric). Try iparm[12] = 1 in case of inappropriate accuracy */ iparm[14-1] = 0; /* Output: Number of perturbed pivots */ iparm[18-1] = -1; /* Output: Number of nonzeros in the factor LU */ iparm[19-1] = -1; /* Output: Mflops for LU factorization */ iparm[36-1] = 1; /* Use Schur complement */ maxfct = 1; /* Maximum number of numerical factorizations. */ mnum = 1; /* Which factorization to use. */ msglvl = 0; /* Print statistical information in file */ error = 0; /* Initialize error flag */ #pragma omp for //schedule(static,1) for (esint i = 0 ; i < nMatrices; i++) { // for reordering and factorization esint * perm = new esint[K_sc1_rows[i]]; for (esint j = 0; j < K_in_rows[i]; j++) perm[j] = 0; for (esint j = K_in_rows[i]; j < K_sc1_rows[i]; j++) perm[j] = 1; esint nrhs = 0; /* -------------------------------------------------------------------- */ /* .. Numerical factorization. */ /* -------------------------------------------------------------------- */ double * SC_out_data; if (SC_out_packed[i]) { SC_out_data = matrixPerThread[myRank];//(double*) malloc(K_b_tmp_rows[i] * K_b_tmp_rows[i]*sizeof(double)); } else { SC_out_data = SC_out_matrices + SC_out_offsets[i]; } phase = 12; PARDISO (pt, &maxfct, &mnum, &mtype, &phase, &K_sc1_rows[i], K_sc1_CSR_V_values[i], K_sc1_CSR_I_row_indices[i], K_sc1_CSR_J_col_indices[i], &perm[0], &nrhs, iparm, &msglvl, &ddum, SC_out_data, &error); for (esint j = 0; j < K_b_tmp_rows[i]*K_b_tmp_rows[i]; j++) SC_out_data[j] = (-1.0)*SC_out_data[j]; if (SC_out_packed[i]) { for (long j = 0; j < SC_out_cols[ i ]; j++ ) { long pos = ((double)( 1.0 +j ))*((double) j)/2.0; memcpy( SC_out_matrices + SC_out_offsets[ i ] + pos, SC_out_data + j * SC_out_rows[ i ], sizeof( double ) * (j+1) ); } } if ( error != 0 ) { ////ESINFO(ERROR) << "ERROR during numerical factorization: " << error; exit (2); } else { initialized = true; } /* -------------------------------------------------------------------- */ /* .. Termination and release of memory. */ /* -------------------------------------------------------------------- */ phase = -1; /* Release internal memory. */ PARDISO (pt, &maxfct, &mnum, &mtype, &phase, &K_sc1_rows[i], K_sc1_CSR_V_values[i], K_sc1_CSR_I_row_indices[i], K_sc1_CSR_J_col_indices[i], &perm[0], &nrhs, iparm, &msglvl, &ddum, SC_out_data, &error); initialized = false; delete [] perm; } _mm_free(matrixPerThread[myRank]); } } // remember to clear also MICs memory for (esint i = 0 ; i < nMatrices; i++) { double * valPointer = K_sc1_CSR_V_values[i]; esint * iPointer = K_sc1_CSR_I_row_indices[i]; esint * jPointer = K_sc1_CSR_J_col_indices[i]; #pragma offload_transfer target(mic:device) \ nocopy( valPointer : alloc_if(0) free_if(1)) \ nocopy( iPointer : alloc_if(0) free_if(1)) \ nocopy( jPointer : alloc_if(0) free_if(1)) } #pragma offload_transfer target(mic : device ) \ nocopy(K_sc1_CSR_V_values :alloc_if(0) free_if(1) ) \ nocopy(K_sc1_CSR_I_row_indices : alloc_if(0) free_if(1) ) \ nocopy(K_sc1_CSR_J_col_indices : alloc_if(0) free_if(1) ) for ( esint i = 0 ; i < nMatrices; ++i ) { _mm_free(K_sc1_CSR_V_values[i]); _mm_free(K_sc1_CSR_I_row_indices[i]); _mm_free(K_sc1_CSR_J_col_indices[i]); } _mm_free(K_sc1_CSR_V_values); _mm_free(K_sc1_CSR_I_row_indices); _mm_free(K_sc1_CSR_J_col_indices); _mm_free(K_in_rows); _mm_free(K_b_tmp_rows); _mm_free(K_sc1_rows); _mm_free(nnz); }
[ "ondrej.meca@gmail.com" ]
ondrej.meca@gmail.com
2b060cfda0e13995827a18548321ea12f4a93da5
53e5f3b52f6d3aab128be556f473e9645be9b069
/include/moost/logging/scoped_logger.hpp
432496aa4ece4d2385f8f9c236d623644eba5eff
[ "MIT" ]
permissive
1901/libmoost
7fe1fecdbec78f026c40a2d06eb3885dc2105bdf
895db7cc5468626f520971648741488c373c5cff
refs/heads/master
2021-01-21T04:11:53.023058
2013-02-22T11:49:18
2013-02-22T11:49:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,090
hpp
/* vim:set ts=3 sw=3 sts=3 et: */ /** * Copyright © 2008-2013 Last.fm Limited * * This file is part of libmoost. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MOOST_LOGGING_SCOPED_LOGGER_HPP #define MOOST_LOGGING_SCOPED_LOGGER_HPP #include <string> #include <sstream> #include <map> #include <vector> #include <boost/shared_ptr.hpp> #if defined(_MSC_VER) #pragma warning (push) #pragma warning ( disable: 4231 4251 4275 4786 ) #endif #include <log4cxx/logger.h> #include <log4cxx/helpers/pool.h> #include <log4cxx/spi/loggingevent.h> #include <log4cxx/helpers/synchronized.h> #include <log4cxx/helpers/mutex.h> #include <log4cxx/helpers/resourcebundle.h> #include <log4cxx/helpers/transcoder.h> #include <log4cxx/appenderskeleton.h> #include "../logging.hpp" #include "../timer.h" namespace moost { namespace logging { /** * \brief handles verbose with log4cxx gracefully. * scoped_logger takes care of collecting the log information within the scope, then * spit it out (to whatever it was configured to) * \note Important: scoped_logger is \b not thread safe. * \note I must forward everything because the constructor is a bit of a mess (it's generated from * a factory). */ class scoped_logger { private: struct sLogEntry { sLogEntry() : pLocationInfo(NULL) {} log4cxx::LevelPtr level; std::string message; log4cxx::spi::LocationInfo const* pLocationInfo; }; public: scoped_logger() : m_startTime(boost::posix_time::microsec_clock::local_time()) { init(std::string(), log4cxx::Level::getOff()); } scoped_logger(const std::string& name) : m_startTime(boost::posix_time::microsec_clock::local_time()) { init(name); } scoped_logger(const std::string& name, moost::timer::scoped_time& sc) : m_startTime(sc.get_time()) { init(name); } scoped_logger(const std::string& name, moost::multi_timer::scoped_time& sc) : m_startTime(sc.get_time()) { init(name); } scoped_logger(const std::string& name, const boost::posix_time::ptime& startTime) : m_startTime(startTime) { init(name); } ~scoped_logger() { try { forcedLog(); } catch (...) {} } ////////////////////////////////////////////////////////////////////////// // scoped_logger custom /** * Set the timings headers. */ void setTimingsHeader(const std::string& totTimingsHeader = " Overall time: ", const std::string& subTimingsIndentation = " -> ") { m_totTimingsHeader = totTimingsHeader; m_subTimingsIndentation = subTimingsIndentation; } void addSubTime(const std::string& header, int ms) { m_subTimes[header] += ms; } ////////////////////////////////////////////////////////////////////////// void forcedLog(const log4cxx::LevelPtr& level, const std::string& message) { updateHighestLevel(level); m_messages.push_back( sLogEntry() ); sLogEntry& b = m_messages.back(); b.level = level; b.message = message; } void forcedLog(const log4cxx::LevelPtr& level, const std::string& message, const log4cxx::spi::LocationInfo& location) { updateHighestLevel(level); m_messages.push_back( sLogEntry() ); sLogEntry& b = m_messages.back(); b.level = level; b.message = message; b.pLocationInfo = &location; } log4cxx::LevelPtr getLevel() const { return m_loggerLevel; } virtual void setLevel(const log4cxx::LevelPtr& level) { m_loggerLevel = level; } ////////////////////////////////////////////////////////////////////////// void debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) { if (isDebugEnabled()) { forcedLog(log4cxx::Level::getDebug(), msg, location); } } void debug(const std::string& msg) { if (isDebugEnabled()) { forcedLog(log4cxx::Level::getDebug(), msg); } } void error(const std::string& msg, const log4cxx::spi::LocationInfo& location) { if (isErrorEnabled()) { forcedLog(log4cxx::Level::getError(), msg, location); } } void error(const std::string& msg) { if (isErrorEnabled()) { forcedLog(log4cxx::Level::getError(), msg); } } void fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) { if (isFatalEnabled()) { forcedLog(log4cxx::Level::getFatal(), msg, location); } } void fatal(const std::string& msg) { if (isFatalEnabled()) { forcedLog(log4cxx::Level::getFatal(), msg); } } void info(const std::string& msg, const log4cxx::spi::LocationInfo& location) { if (isInfoEnabled()) { forcedLog(log4cxx::Level::getInfo(), msg, location); } } void info(const std::string& msg) { if (isInfoEnabled()) { forcedLog(log4cxx::Level::getInfo(), msg); } } void log(const log4cxx::LevelPtr& level, const std::string& message, const log4cxx::spi::LocationInfo& location) { if (isEnabledFor(level)) { forcedLog(level, message, location); } } void log(const log4cxx::LevelPtr& level, const std::string& message) { if (isEnabledFor(level)) { forcedLog(level, message); } } void warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) { if (isWarnEnabled()) { forcedLog(log4cxx::Level::getWarn(), msg, location); } } void warn(const std::string& msg) { if (isWarnEnabled()) { forcedLog(log4cxx::Level::getWarn(), msg); } } void trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) { if (isTraceEnabled()) { forcedLog(log4cxx::Level::getTrace(), msg, location); } } void trace(const std::string& msg) { if (isTraceEnabled()) { forcedLog(log4cxx::Level::getTrace(), msg); } } ////////////////////////////////////////////////////////////////////////// void addRef() const { /*m_pLogger->addRef(); */} void releaseRef() const { /*m_pLogger->releaseRef(); */} virtual void addAppender(const log4cxx::AppenderPtr& /* newAppender */) { /*m_pLogger->addAppender(newAppender);*/ } void callAppenders(const log4cxx::spi::LoggingEventPtr& /* event */, log4cxx::helpers::Pool& /* pool */) const { /*m_pLogger->callAppenders(event, pool);*/ } void closeNestedAppenders() { /*m_pLogger->closeNestedAppenders();*/ } bool getAdditivity() const { return true; /*m_pLogger->getAdditivity();*/ } //log4cxx::AppenderList getAllAppenders() const //{ return m_pLogger->getAllAppenders(); } virtual const log4cxx::LevelPtr& getEffectiveLevel() const { return m_loggerLevel; } log4cxx::spi::LoggerRepositoryPtr getLoggerRepository() const { return log4cxx::Logger::getRootLogger()->getLoggerRepository(); } void getName(std::string& name) const { log4cxx::helpers::Transcoder::encode(m_name, name); } log4cxx::LoggerPtr getParent() const { return log4cxx::Logger::getRootLogger(); } log4cxx::helpers::ResourceBundlePtr getResourceBundle() const { return log4cxx::Logger::getRootLogger()->getResourceBundle(); } void removeAllAppenders() { log4cxx::Logger::getRootLogger()->removeAllAppenders(); } void removeAppender(const log4cxx::AppenderPtr& appender) { log4cxx::Logger::getRootLogger()->removeAppender(appender); } void setAdditivity(bool additive) { log4cxx::Logger::getRootLogger()->setAdditivity(additive); } inline void setResourceBundle(const log4cxx::helpers::ResourceBundlePtr& bundle) { log4cxx::Logger::getRootLogger()->setResourceBundle(bundle); } inline const log4cxx::helpers::Mutex& getMutex() const { return log4cxx::Logger::getRootLogger()->getMutex(); } ////////////////////////////////////////////////////////////////////////// // forwarded methods bool isAttached(const log4cxx::AppenderPtr& appender) const { return log4cxx::Logger::getRootLogger()->isAttached(appender); } bool isEnabledFor(const log4cxx::LevelPtr& level) const { return level->isGreaterOrEqual(m_loggerLevel); } bool isDebugEnabled() const { return m_loggerLevel->toInt() <= log4cxx::Level::DEBUG_INT; } bool isInfoEnabled() const { return m_loggerLevel->toInt() <= log4cxx::Level::INFO_INT; } bool isWarnEnabled() const { return m_loggerLevel->toInt() <= log4cxx::Level::WARN_INT; } bool isErrorEnabled() const { return m_loggerLevel->toInt() <= log4cxx::Level::ERROR_INT; } bool isFatalEnabled() const { return m_loggerLevel->toInt() <= log4cxx::Level::FATAL_INT; } bool isTraceEnabled() const { return m_loggerLevel->toInt() <= log4cxx::Level::TRACE_INT; } ////////////////////////////////////////////////////////////////////////// //// not implemented //AppenderPtr getAppender(const LogString& name) const; //void forcedLogLS( const LevelPtr& level, const log4cxx::LogString& message, // const log4cxx::spi::LocationInfo& location) const; // static LoggerPtr getLoggerLS(const LogString& name); //static LoggerPtr getLoggerLS(const LogString& name, // const log4cxx::spi::LoggerFactoryPtr& factory); //void removeAppender(const LogString& name) //void l7dlog(const LevelPtr& level, const LogString& key, // const log4cxx::spi::LocationInfo& locationInfo, // const std::vector<LogString>& values) const; //void logLS(const LevelPtr& level, const LogString& message, // const log4cxx::spi::LocationInfo& location) const; //const LogString getName() const { return name; } private: void forcedLog() { if ( !m_highestMessageLevel ) m_highestMessageLevel = m_loggerLevel; if ( isTraceEnabled() ) { std::ostringstream buf; buf << "\n"; // get subtimes if ( !m_subTimes.empty() ) { std::map<std::string, int>::const_iterator it; for ( it = m_subTimes.begin(); it != m_subTimes.end(); ++it ) buf << ">>> " << m_subTimingsIndentation << it->first << ": " << it->second << "ms\n"; } // get overall time int timeMs = static_cast<int> ( ( boost::posix_time::microsec_clock::local_time() - m_startTime ).total_milliseconds() ); buf << " " << m_totTimingsHeader << timeMs << "ms\n"; m_messages.push_back( sLogEntry() ); sLogEntry& b = m_messages.back(); b.level = log4cxx::Level::getDebug(); b.message = buf.str(); } std::vector< std::pair<log4cxx::LevelPtr, log4cxx::AppenderPtr> >::iterator aIt; std::vector<sLogEntry>::const_iterator mIt; std::string message; log4cxx::helpers::Pool p; log4cxx::LogString msg; for ( aIt = m_appenders.begin(); aIt != m_appenders.end(); ++aIt ) { const log4cxx::LevelPtr& appenderLevel = aIt->first; log4cxx::AppenderPtr& appender = aIt->second; std::ostringstream buf; log4cxx::spi::LocationInfo const* pLocationInfo = NULL; if(!m_messages.empty()) { buf << "\n"; for ( mIt = m_messages.begin(); mIt != m_messages.end(); ++mIt ) { if ( mIt->level->isGreaterOrEqual( appenderLevel ) ) { buf << " " << mIt->message << "\n"; pLocationInfo = mIt->pLocationInfo; } } } message = buf.str(); if ( message.empty() ) continue; LOG4CXX_DECODE_CHAR(msg, message); if ( pLocationInfo ) { log4cxx::spi::LoggingEventPtr event(new log4cxx::spi::LoggingEvent( m_name, m_highestMessageLevel, msg, *pLocationInfo )); appender->doAppend(event, p); } else { log4cxx::spi::LoggingEventPtr event(new log4cxx::spi::LoggingEvent( m_name, m_highestMessageLevel, msg, log4cxx::spi::LocationInfo::getLocationUnavailable())); appender->doAppend(event, p); } } } void updateHighestLevel(const log4cxx::LevelPtr& level) { if ( !m_highestMessageLevel || // no level was set ( !level->equals(m_highestMessageLevel) && level->isGreaterOrEqual(m_highestMessageLevel) ) // it's a higher level! ) { m_highestMessageLevel = level; } } public: /** * Initialize the logger. * It will go through all the appenders currently registered and check the lowest threshold, * then set its own level to that and keep track of the appenders. */ void init(const std::string& name, log4cxx::LevelPtr level = log4cxx::Level::getFatal()) { setTimingsHeader(); log4cxx::helpers::Transcoder::decode(name, m_name); log4cxx::LoggerPtr pRoot = log4cxx::Logger::getRootLogger(); m_loggerLevel = level; //const log4cxx::helpers::Mutex& mutex = pRoot->getMutex(); //log4cxx::helpers::synchronized s(mutex); // go through the list of appenders and set the lowest threshold! log4cxx::AppenderList al = pRoot->getAllAppenders(); log4cxx::AppenderList::const_iterator it; for ( it = al.begin(); it != al.end(); ++it ) { // Looks ugly, but works quite nicely (TM) // The static_cast<> invokes the overloaded cast operator of the ObjectPtrT<> template and turns // the AppenderPtr into and Appender *, which we can easily downcast to an AppenderSkeleton *. log4cxx::AppenderSkeleton *pSkeletonAppender = dynamic_cast<log4cxx::AppenderSkeleton*>(static_cast<log4cxx::Appender *>(*it)); if ( !pSkeletonAppender ) continue; const log4cxx::LevelPtr& pLvl = pSkeletonAppender->getThreshold(); if ( !pLvl ) continue; m_appenders.push_back( std::make_pair(pLvl, *it) ); if ( m_loggerLevel->isGreaterOrEqual(pLvl) ) { m_loggerLevel = pLvl; } } } private: /** * The level of the logger. Below this level nothing is stored. * This is generally initialized with the smallest level of all the appenders * attached to root. */ log4cxx::LevelPtr m_loggerLevel; /** * The highest level of the message received. It's used when sending the actual entry * to the appender. */ log4cxx::LevelPtr m_highestMessageLevel; /** * The name of the log. */ log4cxx::LogString m_name; /** * The messages stored. */ std::vector<sLogEntry> m_messages; /** * The list of available appenders. */ std::vector< std::pair<log4cxx::LevelPtr, log4cxx::AppenderPtr> > m_appenders; boost::posix_time::ptime m_startTime; std::map<std::string, int> m_subTimes; std::string m_totTimingsHeader; std::string m_subTimingsIndentation; }; // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= typedef boost::shared_ptr<moost::logging::scoped_logger> LoggerPtr; // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= class scoped_timing { public: scoped_timing( LoggerPtr& logger, const std::string& str) : m_pLogger(logger), m_str(str), m_startTime(boost::posix_time::microsec_clock::local_time()) {} ~scoped_timing() { try { int timeMs = static_cast<int> ( ( boost::posix_time::microsec_clock::local_time() - m_startTime ).total_milliseconds() ); m_pLogger->addSubTime( m_str, timeMs); } catch (...) {} } private: LoggerPtr& m_pLogger; std::string m_str; boost::posix_time::ptime m_startTime; }; // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #define MLOG_SCOPED_NAMED_DEFINE(logger, name) \ moost::logging::LoggerPtr logger( new moost::logging::scoped_logger( name ) ) #define MLOG_SCOPED_FUNC_DEFINE(logger) \ moost::logging::LoggerPtr logger( new moost::logging::scoped_logger( MLOG_FUNC_NAME() ) ) #define MLOG_SCOPED_NAMED_TIME_DEFINE(logger, name, time) \ moost::logging::LoggerPtr logger( new moost::logging::scoped_logger( name, time ) ) #define MLOG_SCOPED_FUNC_TIME_DEFINE(logger, time) \ moost::logging::LoggerPtr logger( new moost::logging::scoped_logger( MLOG_FUNC_NAME(), time ) ) /** * This is equivalent to: * moost::multi_timer::scoped_time st(fm303_multi_timer(), "name"); * moost::logging::LoggerPtr logger( new moost::logging::scoped_logger("name", st) ); */ #define MLOG_SCOPED_FM303_DEFINE(logger, name) \ moost::multi_timer::scoped_time st(fm303_multi_timer(), name); \ MLOG_SCOPED_NAMED_TIME_DEFINE(logger, name, st) /** * This is equivalent to: * moost::multi_timer::scoped_time st(fm303_multi_timer(), MLOG_FUNC_NAME()); * moost::logging::LoggerPtr logger( new moost::logging::scoped_logger(MLOG_FUNC_NAME(), st) ); */ #define MLOG_SCOPED_FM303_FUNCTION_DEFINE(logger) \ moost::multi_timer::scoped_time st(fm303_multi_timer(), MLOG_FUNC_NAME()); \ MLOG_SCOPED_NAMED_TIME_DEFINE(logger, MLOG_FUNC_NAME(), st) /** * This is equivalent to: * moost::multi_timer::scoped_time st(fm303_multi_timer(), typeid(*this).name()); * moost::logging::LoggerPtr logger( new moost::logging::scoped_logger(typeid(*this).name(), st) ); * */ #define MLOG_SCOPED_FM303_CLASS_DEFINE(logger) \ moost::multi_timer::scoped_time st(fm303_multi_timer(), typeid(*this).name()); \ MLOG_SCOPED_NAMED_TIME_DEFINE(logger, typeid(*this).name(), st) // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #if defined(_MSC_VER) #pragma warning ( pop ) #endif // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= }} #endif // #define MOOST_LOGGING_SCOPED_LOGGER_HPP
[ "mhx@mhxnet.de" ]
mhx@mhxnet.de
36ab576b99b9f75e59e4343c62e506be030821e2
7c369ef9feff08407cabae2c2ed8d7aed7bc67da
/build-ImagerGUI-Desktop_Qt_5_9_0_MinGW_32bit-Debug/debug/moc_okworker.cpp
abd713b591af93ff97c57cf8d27563afb41a5444
[]
no_license
gposluns/MBImager
4d404be69b2dda383e58fc4e1085b993a326b7e7
21db82d6fcb411b0460d6f338ba9aa0fd2f9bdd7
refs/heads/master
2021-01-20T07:04:36.262378
2017-09-01T20:04:47
2017-09-01T20:04:47
89,951,587
1
0
null
2017-06-14T16:17:49
2017-05-01T18:39:25
Verilog
UTF-8
C++
false
false
5,749
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'okworker.h' ** ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../ImagerGUI/okworker.h" #include <QtCore/qbytearray.h> #include <QtCore/qmetatype.h> #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'okworker.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 67 #error "This file was generated using the moc from 5.9.0. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED struct qt_meta_stringdata_okWorker_t { QByteArrayData data[14]; char stringdata0[116]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ qptrdiff(offsetof(qt_meta_stringdata_okWorker_t, stringdata0) + ofs \ - idx * sizeof(QByteArrayData)) \ ) static const qt_meta_stringdata_okWorker_t qt_meta_stringdata_okWorker = { { QT_MOC_LITERAL(0, 0, 8), // "okWorker" QT_MOC_LITERAL(1, 9, 12), // "okLoadFailed" QT_MOC_LITERAL(2, 22, 0), // "" QT_MOC_LITERAL(3, 23, 11), // "debugSignal" QT_MOC_LITERAL(4, 35, 4), // "data" QT_MOC_LITERAL(5, 40, 10), // "showImages" QT_MOC_LITERAL(6, 51, 3), // "exp" QT_MOC_LITERAL(7, 55, 8), // "numMasks" QT_MOC_LITERAL(8, 64, 9), // "maskChngs" QT_MOC_LITERAL(9, 74, 7), // "subcPer" QT_MOC_LITERAL(10, 82, 11), // "bitFileName" QT_MOC_LITERAL(11, 94, 4), // "stop" QT_MOC_LITERAL(12, 99, 11), // "loadPattern" QT_MOC_LITERAL(13, 111, 4) // "path" }, "okWorker\0okLoadFailed\0\0debugSignal\0" "data\0showImages\0exp\0numMasks\0maskChngs\0" "subcPer\0bitFileName\0stop\0loadPattern\0" "path" }; #undef QT_MOC_LITERAL static const uint qt_meta_data_okWorker[] = { // content: 7, // revision 0, // classname 0, 0, // classinfo 5, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 2, // signalCount // signals: name, argc, parameters, tag, flags 1, 0, 39, 2, 0x06 /* Public */, 3, 1, 40, 2, 0x06 /* Public */, // slots: name, argc, parameters, tag, flags 5, 5, 43, 2, 0x0a /* Public */, 11, 0, 54, 2, 0x0a /* Public */, 12, 1, 55, 2, 0x0a /* Public */, // signals: parameters QMetaType::Void, QMetaType::Void, QMetaType::VoidStar, 4, // slots: parameters QMetaType::Void, QMetaType::Int, QMetaType::Int, QMetaType::Int, QMetaType::Int, QMetaType::QString, 6, 7, 8, 9, 10, QMetaType::Void, QMetaType::Void, QMetaType::QString, 13, 0 // eod }; void okWorker::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { okWorker *_t = static_cast<okWorker *>(_o); Q_UNUSED(_t) switch (_id) { case 0: _t->okLoadFailed(); break; case 1: _t->debugSignal((*reinterpret_cast< void*(*)>(_a[1]))); break; case 2: _t->showImages((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4])),(*reinterpret_cast< QString(*)>(_a[5]))); break; case 3: _t->stop(); break; case 4: _t->loadPattern((*reinterpret_cast< QString(*)>(_a[1]))); break; default: ; } } else if (_c == QMetaObject::IndexOfMethod) { int *result = reinterpret_cast<int *>(_a[0]); void **func = reinterpret_cast<void **>(_a[1]); { typedef void (okWorker::*_t)(); if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&okWorker::okLoadFailed)) { *result = 0; return; } } { typedef void (okWorker::*_t)(void * ); if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&okWorker::debugSignal)) { *result = 1; return; } } } } const QMetaObject okWorker::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_okWorker.data, qt_meta_data_okWorker, qt_static_metacall, nullptr, nullptr} }; const QMetaObject *okWorker::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; } void *okWorker::qt_metacast(const char *_clname) { if (!_clname) return nullptr; if (!strcmp(_clname, qt_meta_stringdata_okWorker.stringdata0)) return static_cast<void*>(const_cast< okWorker*>(this)); return QObject::qt_metacast(_clname); } int okWorker::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 5) qt_static_metacall(this, _c, _id, _a); _id -= 5; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 5) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 5; } return _id; } // SIGNAL 0 void okWorker::okLoadFailed() { QMetaObject::activate(this, &staticMetaObject, 0, nullptr); } // SIGNAL 1 void okWorker::debugSignal(void * _t1) { void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 1, _a); } QT_WARNING_POP QT_END_MOC_NAMESPACE
[ "wendywang309@gmail.com" ]
wendywang309@gmail.com
7991c93eb2ec402493baf08ff86049f62e295922
e4380519e0bff853a92a418f79ba01950c625edf
/DV2551-Project/Window.h
713beff9fc87779624bd4fdb2c437c24cf724c7b
[]
no_license
Trimblewick/3d-Project
4c2de141d317c6183fe6c79a395138c37318cdbc
ba56c65234a09ed95a5d8d99826eaef1794ef93b
refs/heads/master
2021-09-10T13:50:21.709518
2018-03-19T20:14:45
2018-03-19T20:14:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
498
h
#pragma once #include <Windows.h> #include <string> class Window { private: unsigned long m_iWidth; unsigned long m_iHeight; float m_fAspectRatio; WNDCLASSEX m_info; HWND m_hwnd; HINSTANCE m_hinstance; RECT m_rect; public: Window(); ~Window(); bool Initialize(HINSTANCE hinstance, int iCmdShow, LONG iWidth, LONG iHeight, WNDPROC EventHandler); int GetWidth(); int GetHeight(); HWND GetWindowHandle(); HINSTANCE GetWindowInstance(); void SetTitle(std::string sTitle); };
[ "gustav.ekelund@hotmail.com" ]
gustav.ekelund@hotmail.com
d45e5c82af41b3928f851ba2f7ba2f640bad83f8
1dbf007249acad6038d2aaa1751cbde7e7842c53
/vpc/include/huaweicloud/vpc/v2/model/NeutronDeleteFirewallPolicyResponse.h
370d922cfa5b57f9c9003149bba66fdff39da032
[]
permissive
huaweicloud/huaweicloud-sdk-cpp-v3
24fc8d93c922598376bdb7d009e12378dff5dd20
71674f4afbb0cd5950f880ec516cfabcde71afe4
refs/heads/master
2023-08-04T19:37:47.187698
2023-08-03T08:25:43
2023-08-03T08:25:43
324,328,641
11
10
Apache-2.0
2021-06-24T07:25:26
2020-12-25T09:11:43
C++
UTF-8
C++
false
false
1,211
h
#ifndef HUAWEICLOUD_SDK_VPC_V2_MODEL_NeutronDeleteFirewallPolicyResponse_H_ #define HUAWEICLOUD_SDK_VPC_V2_MODEL_NeutronDeleteFirewallPolicyResponse_H_ #include <huaweicloud/vpc/v2/VpcExport.h> #include <huaweicloud/core/utils/ModelBase.h> #include <huaweicloud/core/http/HttpResponse.h> namespace HuaweiCloud { namespace Sdk { namespace Vpc { namespace V2 { namespace Model { using namespace HuaweiCloud::Sdk::Core::Utils; using namespace HuaweiCloud::Sdk::Core::Http; /// <summary> /// Response Object /// </summary> class HUAWEICLOUD_VPC_V2_EXPORT NeutronDeleteFirewallPolicyResponse : public ModelBase, public HttpResponse { public: NeutronDeleteFirewallPolicyResponse(); virtual ~NeutronDeleteFirewallPolicyResponse(); ///////////////////////////////////////////// /// ModelBase overrides void validate() override; web::json::value toJson() const override; bool fromJson(const web::json::value& json) override; ///////////////////////////////////////////// /// NeutronDeleteFirewallPolicyResponse members protected: #ifdef RTTR_FLAG RTTR_ENABLE() #endif }; } } } } } #endif // HUAWEICLOUD_SDK_VPC_V2_MODEL_NeutronDeleteFirewallPolicyResponse_H_
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
d1bf592b8b7805404e351928e44e0bc3231335dc
538dcf8e3b72ba747cff2e0d5251473b6d2f2697
/node.cpp
22504d881c3208231f869c184109c14792436429
[]
no_license
cutehuahua/DL_framework
325ecc35b52418b585cda1d62ef146b0abd6cf2c
4c0f74bcd619721f9d0542816762d6712f94ff0f
refs/heads/master
2020-04-06T17:34:03.623707
2018-11-22T11:13:36
2018-11-22T11:13:36
157,665,153
0
0
null
null
null
null
UTF-8
C++
false
false
795
cpp
#include "node.h" //node node::node(): previous(NULL), next(NULL), input_data(NULL), weight(NULL), gradient(NULL), bias(false), nonlinear_layer(false) {} node::~node(){ /* all information except gradient should be reference */ if (next != NULL){ next = NULL; } if (previous != NULL){ previous = NULL;} if (weight != NULL){ weight = NULL;} if (input_data != NULL){ input_data = NULL;} if (gradient != NULL){ delete gradient; gradient = NULL;} } void node_append(node *&a, node *b){ /* append b after a */ if (a == NULL){ if (b == NULL){ a = NULL; } else{ a = b; } } else{ if (b != NULL){ a -> next = b; b -> previous = a; a = b; } } }
[ "shortid321@gmail.com" ]
shortid321@gmail.com
d530dde9854b740277d0839761a4130df2f56db6
2be370f066c67ec56b6bd4bee61e7f4eac46e7ea
/src/En2Cn/En2CnTableModel.h
889de440be960b930402a307e2f6b262ba3751cc
[]
no_license
hulaishun/QtTranslateTool
eb99ec0f7c2d73eebb204f2668c6ac2f600b73f6
55faa543539b96f96abc2b39aeaa3bce2dc5c0fa
refs/heads/master
2020-04-26T11:49:19.300327
2019-04-05T14:58:46
2019-04-05T14:59:00
173,529,766
0
1
null
null
null
null
GB18030
C++
false
false
1,545
h
#ifndef EN2CN_LIST_MODEL_H #define EN2CN_LIST_MODEL_H #include <QObject> #include <QtCore/qabstractitemmodel.h> #include <QtCore/qlist.h> #include <QtCore/qvariant.h> #include "En2CnKeyInfo.h" class CEn2CnTableModel : public QAbstractTableModel { public: explicit CEn2CnTableModel(QObject* parent = nullptr); ~CEn2CnTableModel(); enum EKeyRole { KeyIdRole = Qt::UserRole+1, KeyEnNameRole, KeyCnNameRole, KeySearchRole, }; enum ETableColumn { TABLE_COLUMN_0_EN_NAME = 0, TABLE_COLUMN_1_CN_NAME = 1, TABLE_COLUMN_COUNT = 2 }; void ClearData(); public: //对模型数据的增删改查 void AddKeyInfo(const CEn2CnKeyInfo& keyInfo); void UpdateKeyInfo(const QModelIndex& index, const QString& strEnText, const QString& strCnText); void DelKeyInfo(int iKeyId); void DelKeyInfo(const QModelIndex& index); QModelIndex IndexOfKeyId(int iKeyId); QModelIndex IndexOfEnText(const QString& strEnText); QList<CEn2CnKeyInfo> GetDataList(); virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; protected: virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; private: QList<CEn2CnKeyInfo> m_listData; }; #endif // EN2CN_LIST_MODEL_H
[ "hulaishun@yiwei.com" ]
hulaishun@yiwei.com
8a4a8c7a33c17be3afa8ef267178b6cf0fadfed4
f99119f3578c0967d3659d9c45a8e8c718d4ee0a
/Transform.cpp
2c265b9cdde68a83fa6a7fbc51293d7bea6dec7b
[]
no_license
WayGold/CSE-167-PA3
166f7988f071552b90529613e407f6824bcabd3f
d56de843cea233d69897b242332527ef7fc538f4
refs/heads/master
2020-08-29T07:26:09.099568
2019-11-06T23:21:08
2019-11-06T23:21:08
217,966,324
0
0
null
null
null
null
UTF-8
C++
false
false
2,458
cpp
// // Transform.cpp // CSE 167 PA3 // // Created by Wei Zeng on 10/27/19. // Copyright © 2019 Wei Zeng. All rights reserved. // #include "Transform.hpp" Transform::Transform(std::string name, glm::mat4 T){ this->name = name; this->T = T; } Transform::~Transform(){ for(std::list<Node*>::iterator it = children.begin(); it != children.end(); ++it){ if(*it != nullptr){ //delete(*it); } } } void Transform::draw(GLuint shaderProgram, glm::mat4 C, std::vector<glm::vec3> all_center, std::vector<glm::vec3> all_norm, int & r_count, bool flag){ glm::mat4 M_new = C * T; glm::vec3 tmp = center; center = glm::vec3(C * glm::vec4(center, 1.0f)); if(name == "root"){ double ftox = glm::dot((center - all_center.at(0)), all_norm.at(0)); double ntox = glm::dot((center - all_center.at(1)), all_norm.at(1)); double ltox = glm::dot((center - all_center.at(2)), all_norm.at(2)); double rtox = glm::dot((center - all_center.at(3)), all_norm.at(3)); double utox = glm::dot((center - all_center.at(4)), all_norm.at(4)); double dtox = glm::dot((center - all_center.at(5)), all_norm.at(5)); // std::cerr << "Check robot" << " with center at: " << glm::to_string(center) << std::endl << "ftox: " << ftox << ". ntox: " << ntox << ". ltox: " << ltox << ". rtox: " << rtox << ". utox: " << utox << ". dtox: " << dtox << std::endl; center = tmp; if(ftox < -radius || ntox < -radius || ltox < -radius || rtox < -radius || utox < -radius || dtox < -radius){ // std::cerr << "Not drawing!" << std::endl; if(flag) return; } r_count++; } for(std::list<Node*>::iterator it = children.begin(); it != children.end(); ++it){ // std::cerr << std::endl << "calling draw on: " << (*it)->getName() << std::endl; (*it)->draw(shaderProgram, M_new, all_center, all_norm, r_count, flag); } } void Transform::addChild(Node* input){ // std::cerr << "Adding child: " << input->getName() << " to " << this->getName() << std::endl; input->setParent(this); children.push_back(input); } void Transform::update(glm::mat4 C){ this->T = C * T; } void Transform::set_center(glm::vec3 point){ center = point; } glm::vec3 Transform::get_center(){ return center; } float Transform::get_radius(){ return radius; }
[ "wzeng4wk@gmail.com" ]
wzeng4wk@gmail.com
a98c60a91a282905b3f3803854a9c81b0ed65c53
67fc9e51437e351579fe9d2d349040c25936472a
/wrappers/7.0.0/vtkHyperOctreeContourFilterWrap.cc
f692ae09e83a4a7a8f2fbfae6f15223cf3749ccc
[]
permissive
axkibe/node-vtk
51b3207c7a7d3b59a4dd46a51e754984c3302dec
900ad7b5500f672519da5aa24c99aa5a96466ef3
refs/heads/master
2023-03-05T07:45:45.577220
2020-03-30T09:31:07
2020-03-30T09:31:07
48,490,707
6
0
BSD-3-Clause
2022-12-07T20:41:45
2015-12-23T12:58:43
C++
UTF-8
C++
false
false
13,996
cc
/* this file has been autogenerated by vtkNodeJsWrap */ /* editing this might proof futile */ #define VTK_WRAPPING_CXX #define VTK_STREAMS_FWD_ONLY #include <nan.h> #include "vtkPolyDataAlgorithmWrap.h" #include "vtkHyperOctreeContourFilterWrap.h" #include "vtkObjectWrap.h" #include "vtkIncrementalPointLocatorWrap.h" #include "../../plus/plus.h" using namespace v8; extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap; Nan::Persistent<v8::FunctionTemplate> VtkHyperOctreeContourFilterWrap::ptpl; VtkHyperOctreeContourFilterWrap::VtkHyperOctreeContourFilterWrap() { } VtkHyperOctreeContourFilterWrap::VtkHyperOctreeContourFilterWrap(vtkSmartPointer<vtkHyperOctreeContourFilter> _native) { native = _native; } VtkHyperOctreeContourFilterWrap::~VtkHyperOctreeContourFilterWrap() { } void VtkHyperOctreeContourFilterWrap::Init(v8::Local<v8::Object> exports) { Nan::SetAccessor(exports, Nan::New("vtkHyperOctreeContourFilter").ToLocalChecked(), ConstructorGetter); Nan::SetAccessor(exports, Nan::New("HyperOctreeContourFilter").ToLocalChecked(), ConstructorGetter); } void VtkHyperOctreeContourFilterWrap::ConstructorGetter( v8::Local<v8::String> property, const Nan::PropertyCallbackInfo<v8::Value>& info) { InitPtpl(); info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction()); } void VtkHyperOctreeContourFilterWrap::InitPtpl() { if (!ptpl.IsEmpty()) return; v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New); VtkPolyDataAlgorithmWrap::InitPtpl( ); tpl->Inherit(Nan::New<FunctionTemplate>(VtkPolyDataAlgorithmWrap::ptpl)); tpl->SetClassName(Nan::New("VtkHyperOctreeContourFilterWrap").ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); Nan::SetPrototypeMethod(tpl, "CreateDefaultLocator", CreateDefaultLocator); Nan::SetPrototypeMethod(tpl, "createDefaultLocator", CreateDefaultLocator); Nan::SetPrototypeMethod(tpl, "GenerateValues", GenerateValues); Nan::SetPrototypeMethod(tpl, "generateValues", GenerateValues); Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName); Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName); Nan::SetPrototypeMethod(tpl, "GetLocator", GetLocator); Nan::SetPrototypeMethod(tpl, "getLocator", GetLocator); Nan::SetPrototypeMethod(tpl, "GetMTime", GetMTime); Nan::SetPrototypeMethod(tpl, "getMTime", GetMTime); Nan::SetPrototypeMethod(tpl, "GetNumberOfContours", GetNumberOfContours); Nan::SetPrototypeMethod(tpl, "getNumberOfContours", GetNumberOfContours); Nan::SetPrototypeMethod(tpl, "GetValue", GetValue); Nan::SetPrototypeMethod(tpl, "getValue", GetValue); Nan::SetPrototypeMethod(tpl, "IsA", IsA); Nan::SetPrototypeMethod(tpl, "isA", IsA); Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance); Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance); Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast); Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast); Nan::SetPrototypeMethod(tpl, "SetLocator", SetLocator); Nan::SetPrototypeMethod(tpl, "setLocator", SetLocator); Nan::SetPrototypeMethod(tpl, "SetNumberOfContours", SetNumberOfContours); Nan::SetPrototypeMethod(tpl, "setNumberOfContours", SetNumberOfContours); Nan::SetPrototypeMethod(tpl, "SetValue", SetValue); Nan::SetPrototypeMethod(tpl, "setValue", SetValue); #ifdef VTK_NODE_PLUS_VTKHYPEROCTREECONTOURFILTERWRAP_INITPTPL VTK_NODE_PLUS_VTKHYPEROCTREECONTOURFILTERWRAP_INITPTPL #endif ptpl.Reset( tpl ); } void VtkHyperOctreeContourFilterWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info) { if(!info.IsConstructCall()) { Nan::ThrowError("Constructor not called in a construct call."); return; } if(info.Length() == 0) { vtkSmartPointer<vtkHyperOctreeContourFilter> native = vtkSmartPointer<vtkHyperOctreeContourFilter>::New(); VtkHyperOctreeContourFilterWrap* obj = new VtkHyperOctreeContourFilterWrap(native); obj->Wrap(info.This()); } else { if(info[0]->ToObject() != vtkNodeJsNoWrap ) { Nan::ThrowError("Parameter Error"); return; } } info.GetReturnValue().Set(info.This()); } void VtkHyperOctreeContourFilterWrap::CreateDefaultLocator(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } native->CreateDefaultLocator(); } void VtkHyperOctreeContourFilterWrap::GenerateValues(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); size_t i; if(info.Length() > 0 && info[0]->IsInt32()) { if(info.Length() > 1 && info[1]->IsFloat64Array()) { v8::Local<v8::Float64Array>a1(v8::Local<v8::Float64Array>::Cast(info[1]->ToObject())); if( a1->Length() < 2 ) { Nan::ThrowError("Array too short."); return; } if(info.Length() != 2) { Nan::ThrowError("Too many parameters."); return; } native->GenerateValues( info[0]->Int32Value(), (double *)(a1->Buffer()->GetContents().Data()) ); return; } else if(info.Length() > 1 && info[1]->IsArray()) { v8::Local<v8::Array>a1(v8::Local<v8::Array>::Cast(info[1]->ToObject())); double b1[2]; if( a1->Length() < 2 ) { Nan::ThrowError("Array too short."); return; } for( i = 0; i < 2; i++ ) { if( !a1->Get(i)->IsNumber() ) { Nan::ThrowError("Array contents invalid."); return; } b1[i] = a1->Get(i)->NumberValue(); } if(info.Length() != 2) { Nan::ThrowError("Too many parameters."); return; } native->GenerateValues( info[0]->Int32Value(), b1 ); return; } else if(info.Length() > 1 && info[1]->IsNumber()) { if(info.Length() > 2 && info[2]->IsNumber()) { if(info.Length() != 3) { Nan::ThrowError("Too many parameters."); return; } native->GenerateValues( info[0]->Int32Value(), info[1]->NumberValue(), info[2]->NumberValue() ); return; } } } Nan::ThrowError("Parameter mismatch"); } void VtkHyperOctreeContourFilterWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); char const * r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->GetClassName(); info.GetReturnValue().Set(Nan::New(r).ToLocalChecked()); } void VtkHyperOctreeContourFilterWrap::GetLocator(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); vtkIncrementalPointLocator * r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->GetLocator(); VtkIncrementalPointLocatorWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkIncrementalPointLocatorWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkIncrementalPointLocatorWrap *w = new VtkIncrementalPointLocatorWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().Set(wo); } void VtkHyperOctreeContourFilterWrap::GetMTime(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); unsigned int r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->GetMTime(); info.GetReturnValue().Set(Nan::New(r)); } void VtkHyperOctreeContourFilterWrap::GetNumberOfContours(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); int r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->GetNumberOfContours(); info.GetReturnValue().Set(Nan::New(r)); } void VtkHyperOctreeContourFilterWrap::GetValue(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsInt32()) { double r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->GetValue( info[0]->Int32Value() ); info.GetReturnValue().Set(Nan::New(r)); return; } Nan::ThrowError("Parameter mismatch"); } void VtkHyperOctreeContourFilterWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsString()) { Nan::Utf8String a0(info[0]); int r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->IsA( *a0 ); info.GetReturnValue().Set(Nan::New(r)); return; } Nan::ThrowError("Parameter mismatch"); } void VtkHyperOctreeContourFilterWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); vtkHyperOctreeContourFilter * r; if(info.Length() != 0) { Nan::ThrowError("Too many parameters."); return; } r = native->NewInstance(); VtkHyperOctreeContourFilterWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkHyperOctreeContourFilterWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkHyperOctreeContourFilterWrap *w = new VtkHyperOctreeContourFilterWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().Set(wo); } void VtkHyperOctreeContourFilterWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0])) { VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject()); vtkHyperOctreeContourFilter * r; if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } r = native->SafeDownCast( (vtkObject *) a0->native.GetPointer() ); VtkHyperOctreeContourFilterWrap::InitPtpl(); v8::Local<v8::Value> argv[1] = { Nan::New(vtkNodeJsNoWrap) }; v8::Local<v8::Function> cons = Nan::New<v8::FunctionTemplate>(VtkHyperOctreeContourFilterWrap::ptpl)->GetFunction(); v8::Local<v8::Object> wo = cons->NewInstance(1, argv); VtkHyperOctreeContourFilterWrap *w = new VtkHyperOctreeContourFilterWrap(); w->native = r; w->Wrap(wo); info.GetReturnValue().Set(wo); return; } Nan::ThrowError("Parameter mismatch"); } void VtkHyperOctreeContourFilterWrap::SetLocator(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkIncrementalPointLocatorWrap::ptpl))->HasInstance(info[0])) { VtkIncrementalPointLocatorWrap *a0 = ObjectWrap::Unwrap<VtkIncrementalPointLocatorWrap>(info[0]->ToObject()); if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } native->SetLocator( (vtkIncrementalPointLocator *) a0->native.GetPointer() ); return; } Nan::ThrowError("Parameter mismatch"); } void VtkHyperOctreeContourFilterWrap::SetNumberOfContours(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsInt32()) { if(info.Length() != 1) { Nan::ThrowError("Too many parameters."); return; } native->SetNumberOfContours( info[0]->Int32Value() ); return; } Nan::ThrowError("Parameter mismatch"); } void VtkHyperOctreeContourFilterWrap::SetValue(const Nan::FunctionCallbackInfo<v8::Value>& info) { VtkHyperOctreeContourFilterWrap *wrapper = ObjectWrap::Unwrap<VtkHyperOctreeContourFilterWrap>(info.Holder()); vtkHyperOctreeContourFilter *native = (vtkHyperOctreeContourFilter *)wrapper->native.GetPointer(); if(info.Length() > 0 && info[0]->IsInt32()) { if(info.Length() > 1 && info[1]->IsNumber()) { if(info.Length() != 2) { Nan::ThrowError("Too many parameters."); return; } native->SetValue( info[0]->Int32Value(), info[1]->NumberValue() ); return; } } Nan::ThrowError("Parameter mismatch"); }
[ "axkibe@gmail.com" ]
axkibe@gmail.com
0badeee10c3cf5774b34b6a385e307ad0ee9e111
940812fb30095b16d8c57f3d56b3c11876fc1982
/include/acqua/network/detail/pseudo_header.hpp
ca4d167b293a82129a3dc1b6e964e2f7a904ee87
[]
no_license
harre-orz/acqua
c6d2c494cab201cffdb48e170cf7fd4f66378f32
32face864afc6d39e16c35bc80d648b63afbc63e
refs/heads/master
2021-06-28T07:33:58.097924
2016-11-09T04:23:05
2016-11-09T04:23:05
33,122,378
7
2
null
2016-11-09T04:18:50
2015-03-30T12:41:50
C++
UTF-8
C++
false
false
284
hpp
/*! acqua library Copyright (c) 2015 Haruhiko Uchida The software is released under the MIT license. http://opensource.org/licenses/mit-license.php */ #pragma once namespace acqua { namespace network { namespace detail { template <typename T> class pseudo_header; } } }
[ "harre.orz@gmail.com" ]
harre.orz@gmail.com
34dd1180e4acb5f9b3d6f64192fbfff1ee9a41b3
8436a2f8e2d51dc1d4a2c013de2526b69c88ab58
/main.h
248eba659b594814695b1762ec099741ffee711f
[]
no_license
kpanek206/base-converter
88fb93f14edadc8d8b63f03b8ec0184939774692
71a62486b72adda7f5b2a743b6305e90fddadcf2
refs/heads/master
2022-11-12T23:02:03.848855
2020-07-01T17:02:38
2020-07-01T17:02:38
276,434,699
0
0
null
null
null
null
UTF-8
C++
false
false
250
h
#include <vector> #include <string> using namespace std; char to_char(int a); int to_int(char a); void change_parameter(); pair<vector<int>, vector<int>> conversion(pair<vector<int>, vector<int>> number); void handle_input(string input); int main();
[ "kpanek2006@gmail.com" ]
kpanek2006@gmail.com
033cd2f57619b1f06c22e546ca21dbbc5f275691
f7f64bc305ecf455f0d17daca5076ab2e09beac4
/game/virtualKINO.h
2821c81cd355959bafcdd85bfb9e009f51a6388f
[]
no_license
FeisidisChristos/e-KINO
fb1373b2ba92b03ccd54e170515420e762fbe6fa
fe024a4944bece93df2142377f2567c4ba066f91
refs/heads/master
2021-04-29T03:59:30.385242
2017-01-04T16:31:21
2017-01-04T16:31:21
78,032,103
0
0
null
null
null
null
UTF-8
C++
false
false
917
h
//--------------------------------------------------------------------------- #ifndef virtualKINOH #define virtualKINOH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <ExtCtrls.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TTimer *Timer; void __fastcall FormPaint(TObject *Sender); void __fastcall TimerTimer(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif
[ "noreply@github.com" ]
noreply@github.com
fa58a698d95954a288fcc660cd3cea6b4a2f9656
4bb553d96584401a326d8daa59003f9124273956
/labs/lab7/at_home/ws7home/ws7home/main.cpp
4cce6cacfe66980c9259fc6a87e88b15a38689dc
[]
no_license
monstacruz/OOP244
8e1c1fc54c072bd5d804a173434ae77c93dba14e
f52d35092a2f9586b7254a794bd7d6278dce0e1a
refs/heads/master
2020-04-08T03:25:14.938440
2018-11-24T21:29:59
2018-11-24T21:29:59
158,975,016
0
0
null
null
null
null
UTF-8
C++
false
false
268
cpp
// // main.cpp // ws7home // // Created by mon sta cruz on 2018-07-17. // Copyright © 2018 mon. All rights reserved. // #include <iostream> int main(int argc, const char * argv[]) { // insert code here... std::cout << "Hello, World!\n"; return 0; }
[ "mon@mons-MacBook-Pro.local" ]
mon@mons-MacBook-Pro.local
9620cdeddc825b19f8f855be567ec3b6ed06ccf2
8b6cdb025cd575136abe911debd4414d10f4d59d
/AGameEngineCore/Animation.h
f53e8e08dbdf605fa5e2f8388c15af6ca5d3a6c5
[]
no_license
Julianobsg/AGameEngine
38fedd81184e005ca5d47ec2c6d6391bce5e86d6
6d9469ffb0cfa98f8f1122c2f7bae3dbb4141b58
refs/heads/master
2020-12-24T15:22:38.631591
2016-02-18T22:33:20
2016-02-18T22:33:20
19,335,581
3
0
null
null
null
null
UTF-8
C++
false
false
575
h
#pragma once #include "Texture.h" #include <vector> #include "Debug.h" #include "Timer.h" using namespace std; class Animation { public: int framesPerSecond; vector<Texture*> textures; int actualFrame; Animation(void); ~Animation(void); void AddTexture(string texturePath); void AddTexture(Texture* texture); void Init(SDL_Renderer* renderer); Texture* SetActualFrame(); void Destroy(); void AddClip(int x, int y, int w, int h); void Clip(int x, int y, int w, int h); Texture* LastTexture(); private: int framesCounter; int gamefps; bool clipped; };
[ "julianobsg@gmail.com" ]
julianobsg@gmail.com